Version Description
Download this release
Release Info
Developer | pasyuk |
Plugin | Gmedia Photo Gallery |
Version | 1.12.1 |
Comparing to | |
See all releases |
Code changes from version 1.9.20 to 1.12.1
- admin/admin.php +145 -37
- admin/ajax.php +334 -239
- admin/app.php +67 -84
- admin/assets/css/gmedia.admin.css +158 -5
- admin/assets/js/gmedia.admin.js +140 -26
- admin/logs.php +295 -0
- admin/pages/galleries/tpl/choose-module.php +10 -7
- admin/pages/galleries/tpl/gallery-panel-heading.php +1 -1
- admin/pages/galleries/tpl/module-settings.php +7 -0
- admin/pages/library/tpl/edit-item.php +197 -180
- admin/pages/library/tpl/list-item.php +11 -0
- admin/pages/modules/functions.php +17 -6
- admin/pages/modules/modules.php +62 -21
- admin/pages/settings/tpl/license.php +9 -0
- admin/pages/terms/tpl/album-edit-item.php +11 -0
- admin/processor/class.processor.settings.php +33 -29
- admin/support.php +246 -0
- admin/tpl/search-form.php +1 -1
- app/access.php +5 -1
- assets/jqueryFileTree/images/application.png +0 -0
- assets/jqueryFileTree/images/code.png +0 -0
- assets/jqueryFileTree/images/css.png +0 -0
- assets/jqueryFileTree/images/db.png +0 -0
- assets/jqueryFileTree/images/doc.png +0 -0
- assets/jqueryFileTree/images/file.png +0 -0
- assets/jqueryFileTree/images/film.png +0 -0
- assets/jqueryFileTree/images/flash.png +0 -0
- assets/jqueryFileTree/images/html.png +0 -0
- assets/jqueryFileTree/images/java.png +0 -0
- assets/jqueryFileTree/images/linux.png +0 -0
- assets/jqueryFileTree/images/music.png +0 -0
- assets/jqueryFileTree/images/pdf.png +0 -0
- assets/jqueryFileTree/images/php.png +0 -0
- assets/jqueryFileTree/images/picture.png +0 -0
- assets/jqueryFileTree/images/ppt.png +0 -0
- assets/jqueryFileTree/images/psd.png +0 -0
- assets/jqueryFileTree/images/ruby.png +0 -0
- assets/jqueryFileTree/images/script.png +0 -0
- assets/jqueryFileTree/images/txt.png +0 -0
- assets/jqueryFileTree/images/xls.png +0 -0
- assets/jqueryFileTree/images/zip.png +0 -0
- assets/jqueryFileTree/jqueryFileTree.css +72 -12
- assets/jqueryFileTree/jqueryFileTree.js +66 -62
- assets/mediaelement/background.png +0 -0
- assets/mediaelement/bigplay.png +0 -0
- assets/mediaelement/bigplay.svg +0 -1
- assets/mediaelement/controls.png +0 -0
- assets/mediaelement/controls.svg +0 -1
- assets/mediaelement/flashmediaelement.swf +0 -0
- assets/mediaelement/loading.gif +0 -0
- assets/mediaelement/mediaelement-and-player.min.js +7 -168
- assets/mediaelement/mediaelement-flash-audio-ogg.swf +0 -0
- assets/mediaelement/mediaelement-flash-audio.swf +0 -0
- assets/mediaelement/mediaelement-flash-video-hls.swf +0 -0
- assets/mediaelement/mediaelement-flash-video-mdash.swf +0 -0
- assets/mediaelement/mediaelement-flash-video.swf +0 -0
- assets/mediaelement/mediaelementplayer.min.css +1 -1
- assets/mediaelement/mejs-controls.png +0 -0
- assets/mediaelement/mejs-controls.svg +1 -0
- assets/mediaelement/silverlightmediaelement.xap +0 -0
- assets/spectrum/spectrum.css +507 -0
- assets/spectrum/spectrum.js +2323 -0
- assets/spectrum/spectrum.min.css +1 -0
- assets/spectrum/spectrum.min.js +1 -0
- config/setup.php +74 -41
- config/update.php +14 -6
- grand-media.php +242 -103
- inc/compatibility.php +1 -2
- inc/core.php +1062 -885
- inc/db.connect.php +19 -9
- inc/frontend.filters.php +5 -1
- inc/functions.php +42 -4
- inc/module.options.php +4 -4
- inc/permalinks.php +300 -291
- module/jq-mplayer/index.php +1 -1
- module/jq-mplayer/js/gm-music-player.js +4 -4
- readme.txt +87 -20
- template/functions.php +10 -8
- template/single.php +2 -2
- uninstall.php +3 -1
admin/admin.php
CHANGED
@@ -137,7 +137,10 @@ class GmediaAdmin {
|
|
137 |
|
138 |
$gmediaURL = plugins_url(GMEDIA_FOLDER);
|
139 |
$this->pages = array();
|
140 |
-
$this->pages[] = add_menu_page(__('Gmedia Library', 'grand-media'), "Gmedia{$count}", 'gmedia_library', 'GrandMedia', array(
|
|
|
|
|
|
|
141 |
$this->pages[] = add_submenu_page('GrandMedia', __('Gmedia Library', 'grand-media'), __('Gmedia Library', 'grand-media'), 'gmedia_library', 'GrandMedia', array(&$this, 'shell'));
|
142 |
if(current_user_can('gmedia_library')){
|
143 |
$this->pages[] = add_submenu_page('GrandMedia', __('Add Media Files', 'grand-media'), __('Add/Import Files', 'grand-media'), 'gmedia_upload', 'GrandMedia_AddMedia', array(&$this, 'shell'));
|
@@ -149,6 +152,8 @@ class GmediaAdmin {
|
|
149 |
$this->pages[] = add_submenu_page('GrandMedia', __('Gmedia Settings', 'grand-media'), __('Settings', 'grand-media'), 'manage_options', 'GrandMedia_Settings', array(&$this, 'shell'));
|
150 |
$this->pages[] = add_submenu_page('GrandMedia', __('iOS Application', 'grand-media'), __('iOS Application', 'grand-media'), 'gmedia_settings', 'GrandMedia_App', array(&$this, 'shell'));
|
151 |
$this->pages[] = add_submenu_page('GrandMedia', __('Wordpress Media Library', 'grand-media'), __('WP Media Library', 'grand-media'), 'gmedia_import', 'GrandMedia_WordpressLibrary', array(&$this, 'shell'));
|
|
|
|
|
152 |
}
|
153 |
|
154 |
foreach($this->pages as $page){
|
@@ -186,6 +191,11 @@ class GmediaAdmin {
|
|
186 |
|
187 |
?>
|
188 |
<div id="gmedia-container" class="gmedia-admin">
|
|
|
|
|
|
|
|
|
|
|
189 |
<div id="gmedia-header" class="clearfix">
|
190 |
<div id="gmedia-logo">Gmedia
|
191 |
<small> by CodEasily.com</small>
|
@@ -198,7 +208,7 @@ class GmediaAdmin {
|
|
198 |
<?php echo $sideLinks['sideLinks']; ?>
|
199 |
|
200 |
<?php
|
201 |
-
if((int)$gmGallery->options['feedback']){
|
202 |
$installDate = get_option('gmediaInstallDate');
|
203 |
if($installDate && (strtotime($installDate) < strtotime('2 weeks ago'))){ ?>
|
204 |
<div class="row panel panel-default visible-lg-block">
|
@@ -221,7 +231,7 @@ class GmediaAdmin {
|
|
221 |
</div>
|
222 |
<?php }
|
223 |
}
|
224 |
-
if((int)$gmGallery->options['twitter']){
|
225 |
?>
|
226 |
<div class="row panel visible-lg-block">
|
227 |
<a class="twitter-timeline" href="https://twitter.com/CodEasily/timelines/648240437141086212" data-widget-id="648245214201692161"></a>
|
@@ -261,7 +271,7 @@ class GmediaAdmin {
|
|
261 |
<div class="row">
|
262 |
<ul class="list-group"><li>';
|
263 |
if(empty($gmGallery->options['license_key'])){
|
264 |
-
$content['sideLinks'] .= "\n" . '<a class="list-group-item list-group-item-premium" target="_blank" href="
|
265 |
}
|
266 |
foreach($submenu['GrandMedia'] as $menuKey => $menuItem){
|
267 |
if($menuItem[2] == $gmProcessor->page){
|
@@ -287,13 +297,61 @@ class GmediaAdmin {
|
|
287 |
return $content;
|
288 |
}
|
289 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
function admin_footer(){
|
291 |
$ajax_operations = get_option('gmedia_ajax_long_operations');
|
292 |
-
if(
|
293 |
return;
|
294 |
}
|
295 |
reset($ajax_operations);
|
296 |
$ajax = key($ajax_operations);
|
|
|
|
|
|
|
|
|
297 |
$nonce = wp_create_nonce('gmedia_ajax_long_operations');
|
298 |
?>
|
299 |
<script type="text/javascript">
|
@@ -301,7 +359,7 @@ class GmediaAdmin {
|
|
301 |
var header = $('#gmedia-header');
|
302 |
header.append('<div id="ajax-long-operation"><div class="progress"><div class="progress-bar progress-bar-info" style="width: 0%;"></div><div class="progress-bar-indicator">0%</div></div></div>');
|
303 |
gmAjaxLongOperation = function(){
|
304 |
-
jQuery.post(ajaxurl, {action: '<?php echo $ajax; ?>', _wpnonce_ajax_long_operations: '<?php echo $nonce; ?>'}, function(r)
|
305 |
if(r.data){
|
306 |
jQuery('.progress-bar-info', header).width(r.data.progress);
|
307 |
var indicator = r.data.info? r.data.info + ' ' + r.data.progress : r.data.progress;
|
@@ -369,6 +427,13 @@ class GmediaAdmin {
|
|
369 |
include_once(dirname(__FILE__) . '/wpmedia.php');
|
370 |
grandWPMedia();
|
371 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
372 |
case 'GrandMedia_Update':
|
373 |
include_once(GMEDIA_ABSPATH . 'config/update.php');
|
374 |
gmedia_upgrade_progress_panel();
|
@@ -418,7 +483,10 @@ class GmediaAdmin {
|
|
418 |
wp_register_script('selectize', $gmCore->gmedia_url . '/assets/selectize/selectize.min.js', array('jquery'), '0.12.1');
|
419 |
wp_register_style('selectize', $gmCore->gmedia_url . '/assets/selectize/selectize.bootstrap3.css', array('gmedia-bootstrap'), '0.12.1', 'screen');
|
420 |
|
421 |
-
|
|
|
|
|
|
|
422 |
switch($_GET['page']){
|
423 |
case "GrandMedia" :
|
424 |
if($gmCore->caps['gmedia_edit_media']){
|
@@ -435,6 +503,8 @@ class GmediaAdmin {
|
|
435 |
if($gmProcessor->mode == 'edit'){
|
436 |
wp_enqueue_script('alphanum', $gmCore->gmedia_url . '/assets/jq-plugins/jquery.alphanum.js', array('jquery'), '1.0.16');
|
437 |
|
|
|
|
|
438 |
wp_enqueue_script('moment', $gmCore->gmedia_url . '/assets/bootstrap-datetimepicker/moment.min.js', array('jquery'), '2.5.1');
|
439 |
wp_enqueue_style('datetimepicker', $gmCore->gmedia_url . '/assets/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css', array('gmedia-bootstrap'), '2.1.32');
|
440 |
wp_enqueue_script('datetimepicker', $gmCore->gmedia_url . '/assets/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js', array(
|
@@ -444,15 +514,9 @@ class GmediaAdmin {
|
|
444 |
), '2.1.32');
|
445 |
}
|
446 |
}
|
447 |
-
wp_enqueue_style('selectize');
|
448 |
-
wp_enqueue_script('selectize');
|
449 |
wp_enqueue_script('wavesurfer', $gmCore->gmedia_url . '/assets/wavesurfer/wavesurfer.min.js', array('jquery'), '1.1.5');
|
450 |
break;
|
451 |
case "GrandMedia_WordpressLibrary" :
|
452 |
-
if($gmCore->caps['gmedia_import']){
|
453 |
-
wp_enqueue_style('selectize');
|
454 |
-
wp_enqueue_script('selectize');
|
455 |
-
}
|
456 |
break;
|
457 |
case "GrandMedia_Albums" :
|
458 |
if(isset($_GET['edit_term'])){
|
@@ -460,21 +524,19 @@ class GmediaAdmin {
|
|
460 |
wp_enqueue_style('jquery-ui-smoothness', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/smoothness/jquery-ui.min.css', array(), '1.10.2', 'screen');
|
461 |
wp_enqueue_script('jquery-ui-full', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js', array(), '1.10.2');
|
462 |
}
|
463 |
-
|
464 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
}
|
466 |
break;
|
467 |
case "GrandMedia_Categories" :
|
468 |
-
if(isset($_GET['edit_term'])){
|
469 |
-
wp_enqueue_style('selectize');
|
470 |
-
wp_enqueue_script('selectize');
|
471 |
-
}
|
472 |
break;
|
473 |
case "GrandMedia_AddMedia" :
|
474 |
-
if($gmCore->caps['gmedia_terms']){
|
475 |
-
wp_enqueue_style('selectize');
|
476 |
-
wp_enqueue_script('selectize');
|
477 |
-
}
|
478 |
if($gmCore->caps['gmedia_upload']){
|
479 |
$tab = $gmCore->_get('tab', 'upload');
|
480 |
if($tab == 'upload'){
|
@@ -503,11 +565,12 @@ class GmediaAdmin {
|
|
503 |
wp_enqueue_script('jquery-ui-resizable');
|
504 |
|
505 |
wp_enqueue_script('jquery-ui-sortable');
|
506 |
-
wp_enqueue_style('selectize');
|
507 |
-
wp_enqueue_script('selectize');
|
508 |
|
509 |
wp_enqueue_style('jquery.minicolors', $gmCore->gmedia_url . '/assets/minicolors/jquery.minicolors.css', array('gmedia-bootstrap'), '0.9.13');
|
510 |
wp_enqueue_script('jquery.minicolors', $gmCore->gmedia_url . '/assets/minicolors/jquery.minicolors.js', array('jquery'), '0.9.13');
|
|
|
|
|
|
|
511 |
}
|
512 |
break;
|
513 |
case "GrandMedia_Modules" :
|
@@ -517,8 +580,6 @@ class GmediaAdmin {
|
|
517 |
wp_enqueue_script('jquery-ui-resizable');
|
518 |
|
519 |
wp_enqueue_script('jquery-ui-sortable');
|
520 |
-
wp_enqueue_style('selectize');
|
521 |
-
wp_enqueue_script('selectize');
|
522 |
|
523 |
wp_enqueue_style('jquery.minicolors', $gmCore->gmedia_url . '/assets/minicolors/jquery.minicolors.css', array('gmedia-bootstrap'), '0.9.13');
|
524 |
wp_enqueue_script('jquery.minicolors', $gmCore->gmedia_url . '/assets/minicolors/jquery.minicolors.js', array('jquery'), '0.9.13');
|
@@ -526,6 +587,8 @@ class GmediaAdmin {
|
|
526 |
break;
|
527 |
}
|
528 |
}
|
|
|
|
|
529 |
|
530 |
wp_enqueue_style('grand-media');
|
531 |
wp_enqueue_script('grand-media');
|
@@ -544,17 +607,17 @@ class GmediaAdmin {
|
|
544 |
$screen->add_help_tab(array(
|
545 |
'id' => 'help_' . $screen_id . '_support',
|
546 |
'title' => __('Support'),
|
547 |
-
'content' => '<h4>First steps</h4>
|
548 |
<p>If you have any problems with displaying Gmedia Gallery in admin or on website. Before posting to the Forum try next:</p>
|
549 |
<ul>
|
550 |
<li>Exclude plugin conflicts: Disable other plugins one by one and check if it resolve problem</li>
|
551 |
<li>Exclude theme conflict: Temporary switch to one of default themes and check if gallery works</li>
|
552 |
</ul>
|
553 |
-
<h4>Links</h4>
|
554 |
-
<p><a href="
|
555 |
-
| <a href="
|
556 |
-
| <a href="
|
557 |
-
| <a href="
|
558 |
</p>',
|
559 |
));
|
560 |
|
@@ -566,14 +629,36 @@ class GmediaAdmin {
|
|
566 |
$screen->add_help_tab(array(
|
567 |
'id' => 'help_' . $screen_id . '_license',
|
568 |
'title' => __('License Key'),
|
569 |
-
'content' => '<h4>Should I buy it, to use plugin?</h4>
|
570 |
<p>No, plugin is absolutely free and all modules for it are free to install.</p>
|
571 |
<p>Even premium modules are fully functional and free to test, but have backlink labels. To remove baclink labels from premium modules you need license key.</p>
|
572 |
<p>Note: License Key will remove backlinks from all current and future premium modules, so you can use all available modules on one website.</p>
|
573 |
-
<p>Do not purchase license key before testing module you like. Only if everything works fine and you satisfied with functionality you are good to purchase license. Otherwise use <a href="
|
574 |
<h4>I have license key but I can\'t activate it</h4>
|
575 |
-
<p>Contact developer <a href="mailto
|
576 |
-
<div><a class="btn btn-default" href="' . admin_url('admin.php?page=' . $screen_id . '&license_activate=manual') . '">Manual Activation</a></div>',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
577 |
));
|
578 |
}
|
579 |
break;
|
@@ -811,6 +896,28 @@ class GmediaAdmin {
|
|
811 |
</div>
|
812 |
';
|
813 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
814 |
}
|
815 |
|
816 |
if($settings){
|
@@ -852,6 +959,7 @@ class GmediaAdmin {
|
|
852 |
}
|
853 |
|
854 |
}
|
|
|
855 |
global $gmAdmin;
|
856 |
// Start GmediaAdmin
|
857 |
$gmAdmin = new GmediaAdmin();
|
137 |
|
138 |
$gmediaURL = plugins_url(GMEDIA_FOLDER);
|
139 |
$this->pages = array();
|
140 |
+
$this->pages[] = add_menu_page(__('Gmedia Library', 'grand-media'), "Gmedia{$count}", 'gmedia_library', 'GrandMedia', array(
|
141 |
+
&$this,
|
142 |
+
'shell'
|
143 |
+
), 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjIwcHgiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMjAgMjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPiAgPGltYWdlIGlkPSJpbWFnZTAiIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgeD0iMCIgeT0iMCIKICAgIHhsaW5rOmhyZWY9ImRhdGE6aW1hZ2UvcG5nO2Jhc2U2NCxpVkJPUncwS0dnb0FBQUFOU1VoRVVnQUFBQlFBQUFBVUNBTUFBQUM2ViswL0FBQUFCR2RCVFVFQUFMR1BDL3hoQlFBQUFDQmpTRkpOCkFBQjZKZ0FBZ0lRQUFQb0FBQUNBNkFBQWRUQUFBT3BnQUFBNm1BQUFGM0NjdWxFOEFBQUJrbEJNVkVVeFpua3haM2d4WjNoQ2RJTnUKbEtBK2NZQnBrSjJRcmJhb3Y4YTV5OUdadEx5UnJyZG1qcHMzYTN4WmhKS0txYktPckxXcndjaW52c1dWc2JxM3l0Q1hzcnRWZ1k5UwpmNDZndWNGN25hZzdibjVFZFlWeGxxS01xclN3eGN1aHVzS2Z1TUMrejlSMm1xWTZibjZ1dzhyNy9QekYxTm0weU03dDh2UHo5dmVGCnBhL2Y1K3BiaHBSSWVJZCtvS3FOcTdTZHQ3OWhpcGN5YUhuSDF0clMzdUZIZDRiSzJOMzUrL3YzK2ZxOXp0UmFoWk5QZll5Qm9xeUMKbzYwOGIzOUdkb1poaTVoT2ZJdnE3L0dwdjhiLy8vLzIrUG45L2YzQjBkWkFjb0tZczd3emFIbSt6OVZxa1oxWGc1SFQzK0xZNHVaNgpuYWh3bGFGRGRJVFAzT0JLZVloTWU0bnc5UFhoNmV2eDlmYkwyZDFUZ0k1em1LTXphWHJUM3VLWXM3dlAyOS9WNE9PY3RyN2c2T3VVCnNMbE5mSXU0eTlEbzd2QkZkb1YzbTZibTdlODViWDNJMXR1RHBLN1EzT0JZaEpHUHJMWEMwdGVsdmNSSmVZamI1ZWpOMnQ1eWw2S1cKc3JyYjVPZUFvYXhqakpuZTUrbDJtcVhFMDlpSHByQnRrNTl5bDZOOG5xazRiSDNXNGVUVTMrUFIzZUdxd01jY1RNSnpBQUFBQW5SUwpUbE51MlhMaTRXRUFBQUFCWWt0SFJFVDV0SmpCQUFBQUNYQklXWE1BQUFzVEFBQUxFd0VBbXB3WUFBQUFCM1JKVFVVSDRBc0NDRGNJCmw0WXhCZ0FBQVIxSlJFRlVHTk5qWUdCa1FnT01ESmhpSUZFNGs1bUZGY2FFQzdLeGMzQnljZlB3SWd2eWNmRUxDQW9KYzRxSThvdEIKQmNVRkpDU2xtS1JsWklYbDVCVVVsVUNDeWlxcWF1b2FtbHJhT3N4TXVucjZCb1pBUVNOakUxTW1Kak56QzBzQkt5WW1hMTBiUHFDZwpyWWFkdllLRG81T3ppNnVidTRlOHA1QVhVTkJiMGNmWHo5OHVJRkNDS1VneE9NUk9DR2hScUdaWU9MTmRSR1JVZ0FFVGsxU0VYMVEwCkUwTk1ySGRjZklKVVlwSzdiRExRMHBUVXRIUW1ob3pNTEgzVGhPd2MzY3pjUExEelRMU1lHUElMbUR3S2k0cExtRXFUSWQ3Z0tHUmkKWUF1elk3SXJpeXV2cUlTSVNWVlZBeTJxQ2ErdERtU3BxMk1KckZkcXlNbjN5MjRFQ25weEp6UWxOUHZGeHBxMDVBWUh4N2Z5SW9VUwpNc0FleU5paUF3Q3FwalN3RnBqcGxnQUFBQ1YwUlZoMFpHRjBaVHBqY21WaGRHVUFNakF4TmkweE1TMHdNbFF3T0RvMU5Ub3dPQzB3Ck56b3dNSWl4dXBvQUFBQWxkRVZZZEdSaGRHVTZiVzlrYVdaNUFESXdNVFl0TVRFdE1ESlVNRGc2TlRVNk1EZ3RNRGM2TURENTdBSW0KQUFBQUFFbEZUa1N1UW1DQyIgLz4KPC9zdmc+Cg==', 11);
|
144 |
$this->pages[] = add_submenu_page('GrandMedia', __('Gmedia Library', 'grand-media'), __('Gmedia Library', 'grand-media'), 'gmedia_library', 'GrandMedia', array(&$this, 'shell'));
|
145 |
if(current_user_can('gmedia_library')){
|
146 |
$this->pages[] = add_submenu_page('GrandMedia', __('Add Media Files', 'grand-media'), __('Add/Import Files', 'grand-media'), 'gmedia_upload', 'GrandMedia_AddMedia', array(&$this, 'shell'));
|
152 |
$this->pages[] = add_submenu_page('GrandMedia', __('Gmedia Settings', 'grand-media'), __('Settings', 'grand-media'), 'manage_options', 'GrandMedia_Settings', array(&$this, 'shell'));
|
153 |
$this->pages[] = add_submenu_page('GrandMedia', __('iOS Application', 'grand-media'), __('iOS Application', 'grand-media'), 'gmedia_settings', 'GrandMedia_App', array(&$this, 'shell'));
|
154 |
$this->pages[] = add_submenu_page('GrandMedia', __('Wordpress Media Library', 'grand-media'), __('WP Media Library', 'grand-media'), 'gmedia_import', 'GrandMedia_WordpressLibrary', array(&$this, 'shell'));
|
155 |
+
$this->pages[] = add_submenu_page('GrandMedia', __('Gmedia Logs', 'grand-media'), __('Gmedia Logs', 'grand-media'), 'manage_options', 'GrandMedia_Logs', array(&$this, 'shell'));
|
156 |
+
$this->pages[] = add_submenu_page('GrandMedia', __('Gmedia Support', 'grand-media'), __('Support', 'grand-media'), 'manage_options', 'GrandMedia_Support', array(&$this, 'shell'));
|
157 |
}
|
158 |
|
159 |
foreach($this->pages as $page){
|
191 |
|
192 |
?>
|
193 |
<div id="gmedia-container" class="gmedia-admin">
|
194 |
+
<?php
|
195 |
+
if($gmProcessor->page !== 'GrandMedia_App' && !isset($gmGallery->options['gmedia_service']) && current_user_can('manage_options')){
|
196 |
+
$this->collect_data_permission();
|
197 |
+
}
|
198 |
+
?>
|
199 |
<div id="gmedia-header" class="clearfix">
|
200 |
<div id="gmedia-logo">Gmedia
|
201 |
<small> by CodEasily.com</small>
|
208 |
<?php echo $sideLinks['sideLinks']; ?>
|
209 |
|
210 |
<?php
|
211 |
+
if((int) $gmGallery->options['feedback']){
|
212 |
$installDate = get_option('gmediaInstallDate');
|
213 |
if($installDate && (strtotime($installDate) < strtotime('2 weeks ago'))){ ?>
|
214 |
<div class="row panel panel-default visible-lg-block">
|
231 |
</div>
|
232 |
<?php }
|
233 |
}
|
234 |
+
if((int) $gmGallery->options['twitter']){
|
235 |
?>
|
236 |
<div class="row panel visible-lg-block">
|
237 |
<a class="twitter-timeline" href="https://twitter.com/CodEasily/timelines/648240437141086212" data-widget-id="648245214201692161"></a>
|
271 |
<div class="row">
|
272 |
<ul class="list-group"><li>';
|
273 |
if(empty($gmGallery->options['license_key'])){
|
274 |
+
$content['sideLinks'] .= "\n" . '<a class="list-group-item list-group-item-premium" target="_blank" href="https://codeasily.com/product/one-site-license/">' . __('Get Gmedia Premium', 'grand-media') . '</a></li><li>';
|
275 |
}
|
276 |
foreach($submenu['GrandMedia'] as $menuKey => $menuItem){
|
277 |
if($menuItem[2] == $gmProcessor->page){
|
297 |
return $content;
|
298 |
}
|
299 |
|
300 |
+
function collect_data_permission(){
|
301 |
+
$current_user = wp_get_current_user();
|
302 |
+
$nonce = wp_create_nonce('GmediaService');
|
303 |
+
?>
|
304 |
+
<div class="notice updated gm-message gmedia-service__message">
|
305 |
+
<div class="gm-message-content">
|
306 |
+
<div class="gm-plugin-icon">
|
307 |
+
<img src="<?php echo plugins_url('/grand-media/admin/assets/img/icon-128x128.png') ?>" width="90" height="90">
|
308 |
+
</div>
|
309 |
+
<?php printf( __('<p>Hey %s,<br>Please help us improve <b>Gmedia Gallery</b>! If you opt-in, some data about your usage of <b>Gmedia Gallery</b> will be sent to <a href="https://codeasily.com/" target="_blank" tabindex="1">codeasily.com</a>.
|
310 |
+
These data also required if you will use Gmedia iOS application on your iPhone.
|
311 |
+
If you skip this, that\'s okay! <b>Gmedia Gallery</b> will still work just fine.</p>', 'grand-media'), $current_user->display_name ); ?>
|
312 |
+
</div>
|
313 |
+
<div class="gm-message-actions">
|
314 |
+
<button class="button button-secondary gm_service_action" data-action="skip" data-nonce="<?php echo $nonce; ?>"><?php _e('Skip', 'grand-media'); ?></button>
|
315 |
+
<button class="button button-primary gm_service_action" data-action="allow" data-nonce="<?php echo $nonce; ?>"><?php _e('Allow & Continue', 'grand-media'); ?></button>
|
316 |
+
</div>
|
317 |
+
<div class="gm-message-plus gm-closed">
|
318 |
+
<a class="gm-mp-trigger" href="#" onclick="jQuery('.gm-message-plus').toggleClass('gm-closed gm-opened'); return false;"><?php _e('What permissions are being granted?', 'grand-media'); ?></a>
|
319 |
+
<ul>
|
320 |
+
<li>
|
321 |
+
<i class="dashicons dashicons-admin-users"></i>
|
322 |
+
|
323 |
+
<div>
|
324 |
+
<span><?php _e('Your Profile Overview', 'grand-media'); ?></span>
|
325 |
+
|
326 |
+
<p><?php _e('Name and email address', 'grand-media'); ?></p>
|
327 |
+
</div>
|
328 |
+
</li>
|
329 |
+
<li>
|
330 |
+
<i class="dashicons dashicons-admin-settings"></i>
|
331 |
+
|
332 |
+
<div>
|
333 |
+
<span><?php _e('Your Site Overview', 'grand-media'); ?></span>
|
334 |
+
|
335 |
+
<p><?php _e('Site URL, WP version, PHP version, active theme & plugins', 'grand-media'); ?></p>
|
336 |
+
</div>
|
337 |
+
</li>
|
338 |
+
</ul>
|
339 |
+
</div>
|
340 |
+
</div>
|
341 |
+
<?php
|
342 |
+
}
|
343 |
+
|
344 |
function admin_footer(){
|
345 |
$ajax_operations = get_option('gmedia_ajax_long_operations');
|
346 |
+
if( empty($ajax_operations) || !is_array($ajax_operations)){
|
347 |
return;
|
348 |
}
|
349 |
reset($ajax_operations);
|
350 |
$ajax = key($ajax_operations);
|
351 |
+
if(empty($ajax)){
|
352 |
+
delete_option('gmedia_ajax_long_operations');
|
353 |
+
return;
|
354 |
+
}
|
355 |
$nonce = wp_create_nonce('gmedia_ajax_long_operations');
|
356 |
?>
|
357 |
<script type="text/javascript">
|
359 |
var header = $('#gmedia-header');
|
360 |
header.append('<div id="ajax-long-operation"><div class="progress"><div class="progress-bar progress-bar-info" style="width: 0%;"></div><div class="progress-bar-indicator">0%</div></div></div>');
|
361 |
gmAjaxLongOperation = function(){
|
362 |
+
jQuery.post(ajaxurl, {action: '<?php echo $ajax; ?>', _wpnonce_ajax_long_operations: '<?php echo $nonce; ?>'}, function(r){
|
363 |
if(r.data){
|
364 |
jQuery('.progress-bar-info', header).width(r.data.progress);
|
365 |
var indicator = r.data.info? r.data.info + ' ' + r.data.progress : r.data.progress;
|
427 |
include_once(dirname(__FILE__) . '/wpmedia.php');
|
428 |
grandWPMedia();
|
429 |
break;
|
430 |
+
case 'GrandMedia_Logs':
|
431 |
+
include_once(dirname(__FILE__) . '/logs.php');
|
432 |
+
break;
|
433 |
+
case 'GrandMedia_Support':
|
434 |
+
include_once(dirname(__FILE__) . '/support.php');
|
435 |
+
gmediaSupport();
|
436 |
+
break;
|
437 |
case 'GrandMedia_Update':
|
438 |
include_once(GMEDIA_ABSPATH . 'config/update.php');
|
439 |
gmedia_upgrade_progress_panel();
|
483 |
wp_register_script('selectize', $gmCore->gmedia_url . '/assets/selectize/selectize.min.js', array('jquery'), '0.12.1');
|
484 |
wp_register_style('selectize', $gmCore->gmedia_url . '/assets/selectize/selectize.bootstrap3.css', array('gmedia-bootstrap'), '0.12.1', 'screen');
|
485 |
|
486 |
+
wp_register_style('spectrum', $gmCore->gmedia_url . '/assets/spectrum/spectrum.min.css', array(), '1.8.0');
|
487 |
+
wp_register_script('spectrum', $gmCore->gmedia_url . '/assets/spectrum/spectrum.min.js', array('jquery'), '1.8.0', true);
|
488 |
+
|
489 |
+
if(isset($_GET['page'])){
|
490 |
switch($_GET['page']){
|
491 |
case "GrandMedia" :
|
492 |
if($gmCore->caps['gmedia_edit_media']){
|
503 |
if($gmProcessor->mode == 'edit'){
|
504 |
wp_enqueue_script('alphanum', $gmCore->gmedia_url . '/assets/jq-plugins/jquery.alphanum.js', array('jquery'), '1.0.16');
|
505 |
|
506 |
+
wp_enqueue_script('jquery-ui-sortable');
|
507 |
+
|
508 |
wp_enqueue_script('moment', $gmCore->gmedia_url . '/assets/bootstrap-datetimepicker/moment.min.js', array('jquery'), '2.5.1');
|
509 |
wp_enqueue_style('datetimepicker', $gmCore->gmedia_url . '/assets/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css', array('gmedia-bootstrap'), '2.1.32');
|
510 |
wp_enqueue_script('datetimepicker', $gmCore->gmedia_url . '/assets/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js', array(
|
514 |
), '2.1.32');
|
515 |
}
|
516 |
}
|
|
|
|
|
517 |
wp_enqueue_script('wavesurfer', $gmCore->gmedia_url . '/assets/wavesurfer/wavesurfer.min.js', array('jquery'), '1.1.5');
|
518 |
break;
|
519 |
case "GrandMedia_WordpressLibrary" :
|
|
|
|
|
|
|
|
|
520 |
break;
|
521 |
case "GrandMedia_Albums" :
|
522 |
if(isset($_GET['edit_term'])){
|
524 |
wp_enqueue_style('jquery-ui-smoothness', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/smoothness/jquery-ui.min.css', array(), '1.10.2', 'screen');
|
525 |
wp_enqueue_script('jquery-ui-full', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js', array(), '1.10.2');
|
526 |
}
|
527 |
+
|
528 |
+
wp_enqueue_script('moment', $gmCore->gmedia_url . '/assets/bootstrap-datetimepicker/moment.min.js', array('jquery'), '2.5.1');
|
529 |
+
wp_enqueue_style('datetimepicker', $gmCore->gmedia_url . '/assets/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css', array('gmedia-bootstrap'), '2.1.32');
|
530 |
+
wp_enqueue_script('datetimepicker', $gmCore->gmedia_url . '/assets/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js', array(
|
531 |
+
'jquery',
|
532 |
+
'moment',
|
533 |
+
'gmedia-bootstrap'
|
534 |
+
), '2.1.32');
|
535 |
}
|
536 |
break;
|
537 |
case "GrandMedia_Categories" :
|
|
|
|
|
|
|
|
|
538 |
break;
|
539 |
case "GrandMedia_AddMedia" :
|
|
|
|
|
|
|
|
|
540 |
if($gmCore->caps['gmedia_upload']){
|
541 |
$tab = $gmCore->_get('tab', 'upload');
|
542 |
if($tab == 'upload'){
|
565 |
wp_enqueue_script('jquery-ui-resizable');
|
566 |
|
567 |
wp_enqueue_script('jquery-ui-sortable');
|
|
|
|
|
568 |
|
569 |
wp_enqueue_style('jquery.minicolors', $gmCore->gmedia_url . '/assets/minicolors/jquery.minicolors.css', array('gmedia-bootstrap'), '0.9.13');
|
570 |
wp_enqueue_script('jquery.minicolors', $gmCore->gmedia_url . '/assets/minicolors/jquery.minicolors.js', array('jquery'), '0.9.13');
|
571 |
+
|
572 |
+
wp_enqueue_style('spectrum');
|
573 |
+
wp_enqueue_script('spectrum');
|
574 |
}
|
575 |
break;
|
576 |
case "GrandMedia_Modules" :
|
580 |
wp_enqueue_script('jquery-ui-resizable');
|
581 |
|
582 |
wp_enqueue_script('jquery-ui-sortable');
|
|
|
|
|
583 |
|
584 |
wp_enqueue_style('jquery.minicolors', $gmCore->gmedia_url . '/assets/minicolors/jquery.minicolors.css', array('gmedia-bootstrap'), '0.9.13');
|
585 |
wp_enqueue_script('jquery.minicolors', $gmCore->gmedia_url . '/assets/minicolors/jquery.minicolors.js', array('jquery'), '0.9.13');
|
587 |
break;
|
588 |
}
|
589 |
}
|
590 |
+
wp_enqueue_style('selectize');
|
591 |
+
wp_enqueue_script('selectize');
|
592 |
|
593 |
wp_enqueue_style('grand-media');
|
594 |
wp_enqueue_script('grand-media');
|
607 |
$screen->add_help_tab(array(
|
608 |
'id' => 'help_' . $screen_id . '_support',
|
609 |
'title' => __('Support'),
|
610 |
+
'content' => __('<h4>First steps</h4>
|
611 |
<p>If you have any problems with displaying Gmedia Gallery in admin or on website. Before posting to the Forum try next:</p>
|
612 |
<ul>
|
613 |
<li>Exclude plugin conflicts: Disable other plugins one by one and check if it resolve problem</li>
|
614 |
<li>Exclude theme conflict: Temporary switch to one of default themes and check if gallery works</li>
|
615 |
</ul>
|
616 |
+
<h4>Links</h4>', 'grand-media')
|
617 |
+
. '<p><a href="https://codeasily.com/community/forum/gmedia-gallery-wordpress-plugin/" target="_blank">' . __('Support Forum', 'grand-media') . '</a>
|
618 |
+
| <a href="https://codeasily.com/contact/" target="_blank">' . __('Contact', 'grand-media') . '</a>
|
619 |
+
| <a href="https://codeasily.com/portfolio/gmedia-gallery-modules/" target="_blank">' . __('Demo', 'grand-media') . '</a>
|
620 |
+
| <a href="https://codeasily.com/product/one-site-license/" target="_blank">' . __('Premium', 'grand-media') . '</a>
|
621 |
</p>',
|
622 |
));
|
623 |
|
629 |
$screen->add_help_tab(array(
|
630 |
'id' => 'help_' . $screen_id . '_license',
|
631 |
'title' => __('License Key'),
|
632 |
+
'content' => sprintf(__('<h4>Should I buy it, to use plugin?</h4>
|
633 |
<p>No, plugin is absolutely free and all modules for it are free to install.</p>
|
634 |
<p>Even premium modules are fully functional and free to test, but have backlink labels. To remove baclink labels from premium modules you need license key.</p>
|
635 |
<p>Note: License Key will remove backlinks from all current and future premium modules, so you can use all available modules on one website.</p>
|
636 |
+
<p>Do not purchase license key before testing module you like. Only if everything works fine and you satisfied with functionality you are good to purchase license. Otherwise use <a href="%1$s" target="_blank">Gmedia Support Forum</a>.</p>
|
637 |
<h4>I have license key but I can\'t activate it</h4>
|
638 |
+
<p>Contact developer <a href="mailto:%2$s">%2$s</a> with your problem and wait for additional instructions and code for manual activation</p>', 'grand-media'), 'https://codeasily.com/community/forum/gmedia-gallery-wordpress-plugin/', 'gmediafolder@gmail.com')
|
639 |
+
. '<div><a class="btn btn-default" href="' . admin_url('admin.php?page=' . $screen_id . '&license_activate=manual') . '">' . __('Manual Activation', 'grand-media') . '</a></div>',
|
640 |
+
));
|
641 |
+
}
|
642 |
+
break;
|
643 |
+
case 'GrandMedia_App' :
|
644 |
+
$gm_options = get_option('gmediaOptions');
|
645 |
+
$nonce = wp_create_nonce('GmediaService');
|
646 |
+
if(current_user_can('manage_options') && (int)$gm_options['mobile_app']){
|
647 |
+
$screen->add_help_tab(array(
|
648 |
+
'id' => 'help_' . $screen_id . '_optout',
|
649 |
+
'title' => __('Opt Out'),
|
650 |
+
'content' => __('<h4>We appreciate your help in making the plugin better by letting us track some usage data.</h4>
|
651 |
+
<p>Usage tracking is done in the name of making <strong>Gmedia Gallery</strong> better. Making a better user experience, prioritizing new features, and more good things.</p>
|
652 |
+
<p>By clicking "Opt Out", we will no longer be sending any data from <strong>Gmedia Gallery</strong> to <a href="https://codeasily.com" target="_blank">codeasily.com</a>.</p>
|
653 |
+
<p>You\'ll also not be able to use Gmedia iOS application.</p>', 'grand-media')
|
654 |
+
. '<p><button class="button button-default gm_service_action" data-action="app_deactivate" data-nonce="' . $nonce . '">' . __('Opt Out', 'grand-media') . '</button><span class="spinner" style="float: none;"></span></p>'
|
655 |
+
. '<div style="display:none;">Test:
|
656 |
+
<button type="button" data-action="app_updateinfo" data-nonce="' . $nonce . '" class="btn btn-sm btn-primary gm_service_action">Update</button>
|
657 |
+
<button type="button" data-action="app_updatecron" data-nonce="' . $nonce . '" class="btn btn-sm btn-primary gm_service_action">CronJob</button>
|
658 |
+
<button type="button" data-action="app_deactivateplugin" data-nonce="' . $nonce . '" class="btn btn-sm btn-primary gm_service_action">Deactivate Plugin</button>
|
659 |
+
<button type="button" data-action="app_uninstallplugin" data-nonce="' . $nonce . '" class="btn btn-sm btn-primary gm_service_action">Uninstall Plugin</button>
|
660 |
+
</div>
|
661 |
+
',
|
662 |
));
|
663 |
}
|
664 |
break;
|
896 |
</div>
|
897 |
';
|
898 |
break;
|
899 |
+
case 'GrandMedia_Logs' :
|
900 |
+
$settings = '
|
901 |
+
<div class="form-inline pull-left">
|
902 |
+
<div class="form-group">
|
903 |
+
<input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_log]" class="form-control input-sm" style="width: 5em;" value="' . $gm_screen_options['per_page_gmedia_log'] . '" /> <span>' . __('items per page', 'grand-media') . '</span>
|
904 |
+
</div>
|
905 |
+
<div class="form-group">
|
906 |
+
<select name="gm_screen_options[orderby_gmedia_log]" class="form-control input-sm">
|
907 |
+
<option' . selected($gm_screen_options['orderby_gmedia_log'], 'log_date', false) . ' value="log_date">' . __('Date', 'grand-media') . '</option>
|
908 |
+
<option' . selected($gm_screen_options['orderby_gmedia_log'], 'ID', false) . ' value="ID">' . __('Gmedia ID', 'grand-media') . '</option>
|
909 |
+
<option' . selected($gm_screen_options['orderby_gmedia_log'], 'author', false) . ' value="author">' . __('Author ID', 'grand-media') . '</option>
|
910 |
+
</select> <span>' . __('order items', 'grand-media') . '</span>
|
911 |
+
</div>
|
912 |
+
<div class="form-group">
|
913 |
+
<select name="gm_screen_options[sortorder_gmedia_log]" class="form-control input-sm">
|
914 |
+
<option' . selected($gm_screen_options['sortorder_gmedia_log'], 'DESC', false) . ' value="DESC">' . __('DESC', 'grand-media') . '</option>
|
915 |
+
<option' . selected($gm_screen_options['sortorder_gmedia_log'], 'ASC', false) . ' value="ASC">' . __('ASC', 'grand-media') . '</option>
|
916 |
+
</select> <span>' . __('sort order', 'grand-media') . '</span>
|
917 |
+
</div>
|
918 |
+
</div>
|
919 |
+
';
|
920 |
+
break;
|
921 |
}
|
922 |
|
923 |
if($settings){
|
959 |
}
|
960 |
|
961 |
}
|
962 |
+
|
963 |
global $gmAdmin;
|
964 |
// Start GmediaAdmin
|
965 |
$gmAdmin = new GmediaAdmin();
|
admin/ajax.php
CHANGED
@@ -3,7 +3,7 @@ add_action('wp_ajax_gmedia_update_data', 'gmedia_update_data');
|
|
3 |
function gmedia_update_data(){
|
4 |
global $gmDB, $gmCore;
|
5 |
check_ajax_referer("GmediaGallery");
|
6 |
-
if(!current_user_can('gmedia_edit_media')){
|
7 |
die('-1');
|
8 |
}
|
9 |
|
@@ -11,10 +11,10 @@ function gmedia_update_data(){
|
|
11 |
|
12 |
wp_parse_str($data, $gmedia);
|
13 |
|
14 |
-
if(!empty($gmedia['ID'])){
|
15 |
$item = $gmDB->get_gmedia($gmedia['ID']);
|
16 |
-
if((int)$item->author != get_current_user_id()){
|
17 |
-
if(!current_user_can('gmedia_edit_others_media')){
|
18 |
die('-2');
|
19 |
}
|
20 |
}
|
@@ -22,14 +22,14 @@ function gmedia_update_data(){
|
|
22 |
$gmedia['modified'] = current_time('mysql');
|
23 |
$gmedia['mime_type'] = $item->mime_type;
|
24 |
$gmedia['gmuid'] = $item->gmuid;
|
25 |
-
if(!current_user_can('gmedia_delete_others_media')){
|
26 |
$gmedia['author'] = $item->author;
|
27 |
}
|
28 |
|
29 |
$gmuid = pathinfo($item->gmuid);
|
30 |
|
31 |
$gmedia['filename'] = preg_replace('/[^a-z0-9_\.-]+/i', '_', $gmedia['filename']);
|
32 |
-
if(($gmedia['filename'] != $gmuid['filename']) && (current_user_can('gmedia_delete_others_media') || ((int)$item->author == get_current_user_id()))){
|
33 |
$fileinfo = $gmCore->fileinfo($gmedia['filename'] . '.' . $gmuid['extension']);
|
34 |
if(false !== $fileinfo){
|
35 |
if('image' == $fileinfo['dirname'] && file_is_displayable_image($fileinfo['dirpath'] . '/' . $item->gmuid)){
|
@@ -43,44 +43,47 @@ function gmedia_update_data(){
|
|
43 |
}
|
44 |
}
|
45 |
}
|
46 |
-
if(!current_user_can('gmedia_terms')){
|
47 |
unset($gmedia['terms']);
|
48 |
}
|
49 |
|
50 |
$id = $gmDB->insert_gmedia($gmedia);
|
51 |
-
if(!is_wp_error($id)){
|
52 |
// Meta Stuff
|
53 |
if(isset($gmedia['meta']) && is_array($gmedia['meta'])){
|
54 |
$meta_error = array();
|
55 |
foreach($gmedia['meta'] as $key => $value){
|
56 |
if($gmCore->is_digit($key)){
|
57 |
-
$mid = (int)$key;
|
58 |
//$value = wp_unslash( $value );
|
59 |
-
if(!($meta = $gmDB->get_metadata_by_mid('gmedia', $mid))){
|
60 |
-
$meta_error[] = array(
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
64 |
);
|
65 |
continue;
|
66 |
}
|
67 |
if('' == trim($value)){
|
68 |
-
$meta_error[] = array(
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
73 |
);
|
74 |
continue;
|
75 |
}
|
76 |
|
77 |
if($meta->meta_value != $value){
|
78 |
-
if(!($u = $gmDB->update_metadata_by_mid('gmedia', $mid, $value))){
|
79 |
-
$meta_error[] = array(
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
84 |
);
|
85 |
}
|
86 |
}
|
@@ -110,14 +113,14 @@ function gmedia_update_data(){
|
|
110 |
}
|
111 |
|
112 |
if(current_user_can('gmedia_terms')){
|
113 |
-
if(!empty($gmedia['terms']['gmedia_album'])){
|
114 |
if(isset($gmedia['gmedia_album_order'])){
|
115 |
$album = $gmDB->get_the_gmedia_terms($id, 'gmedia_album');
|
116 |
if($album){
|
117 |
$album = reset($album);
|
118 |
-
if((int)$gmedia['gmedia_album_order'] != (int)$album->gmedia_order){
|
119 |
-
$gmDB->update_term_sortorder($album->term_id, array($id => (int)$gmedia['gmedia_album_order']));
|
120 |
-
$result->gmedia_album_order = (int)$gmedia['gmedia_album_order'];
|
121 |
}
|
122 |
}
|
123 |
}
|
@@ -128,7 +131,7 @@ function gmedia_update_data(){
|
|
128 |
$result->album_status = 'none';
|
129 |
}
|
130 |
}
|
131 |
-
if(!empty($meta_error)){
|
132 |
$result->meta_error = $meta_error;
|
133 |
}
|
134 |
|
@@ -143,7 +146,7 @@ add_action('wp_ajax_gmedit_save', 'gmedit_save');
|
|
143 |
function gmedit_save(){
|
144 |
global $gmDB, $gmCore, $gmGallery;
|
145 |
check_ajax_referer('gmedia_edit', '_wpnonce_edit');
|
146 |
-
if(!current_user_can('gmedia_edit_media')){
|
147 |
die('-1');
|
148 |
}
|
149 |
|
@@ -155,9 +158,9 @@ function gmedit_save(){
|
|
155 |
$applyto = $gmCore->_post('applyto', 'web_thumb');
|
156 |
|
157 |
$item = $gmDB->get_gmedia($gmid);
|
158 |
-
if(!empty($item)){
|
159 |
-
if((int)$item->author != get_current_user_id()){
|
160 |
-
if(!current_user_can('gmedia_edit_others_media')){
|
161 |
die('-2');
|
162 |
}
|
163 |
}
|
@@ -176,23 +179,23 @@ function gmedit_save(){
|
|
176 |
|
177 |
$size = @getimagesize($fileinfo['filepath']);
|
178 |
|
179 |
-
do{
|
180 |
$extensions = array('1' => 'GIF', '2' => 'JPG', '3' => 'PNG', '6' => 'BMP');
|
181 |
if(function_exists('memory_get_usage')){
|
182 |
switch($extensions[ $size[2] ]){
|
183 |
case 'GIF':
|
184 |
$CHANNEL = 1;
|
185 |
-
|
186 |
case 'JPG':
|
187 |
$CHANNEL = $size['channels'];
|
188 |
-
|
189 |
case 'PNG':
|
190 |
$CHANNEL = 3;
|
191 |
-
|
192 |
case 'BMP':
|
193 |
default:
|
194 |
$CHANNEL = 6;
|
195 |
-
|
196 |
}
|
197 |
$MB = 1048576; // number of bytes in 1M
|
198 |
$K64 = 65536; // number of bytes in 64K
|
@@ -227,7 +230,7 @@ function gmedit_save(){
|
|
227 |
@copy($editfile, $fileinfo['filepath_original']);
|
228 |
}
|
229 |
}
|
230 |
-
if(!@file_put_contents($editfile, $image['data'])){
|
231 |
$fail = $fileinfo['basename'] . ": " . __('Can\'t write to file. Permission denied', 'grand-media');
|
232 |
break;
|
233 |
}
|
@@ -317,7 +320,7 @@ add_action('wp_ajax_gmedit_restore', 'gmedit_restore');
|
|
317 |
function gmedit_restore(){
|
318 |
global $gmCore;
|
319 |
check_ajax_referer('gmedia_edit', '_wpnonce_edit');
|
320 |
-
if(!current_user_can('gmedia_edit_media')){
|
321 |
die('-1');
|
322 |
}
|
323 |
|
@@ -341,77 +344,77 @@ function gmedia_get_modal(){
|
|
341 |
$ckey = $gmCore->_post('ckey');
|
342 |
switch($modal){
|
343 |
case 'quick_gallery':
|
344 |
-
if(!current_user_can('gmedia_gallery_manage')){
|
345 |
die('-1');
|
346 |
}
|
347 |
//$ckey = "gmedia_library";
|
348 |
$modal_title = __('Quick Gallery from selected items', 'grand-media');
|
349 |
$modal_button = __('Create Quick Gallery', 'grand-media');
|
350 |
-
|
351 |
case 'quick_gallery_stack':
|
352 |
-
if(!current_user_can('gmedia_gallery_manage')){
|
353 |
die('-1');
|
354 |
}
|
355 |
//$ckey = "gmedia_{$user_ID}_libstack";
|
356 |
$modal_title = __('Quick Gallery from Stack', 'grand-media');
|
357 |
$modal_button = __('Create Quick Gallery', 'grand-media');
|
358 |
-
|
359 |
case 'exclude_categories':
|
360 |
case 'filter_categories':
|
361 |
$modal_title = __('Show Images from Categories', 'grand-media');
|
362 |
$modal_button = __('Show Selected', 'grand-media');
|
363 |
-
|
364 |
case 'assign_category':
|
365 |
-
if(!current_user_can('gmedia_terms')){
|
366 |
die('-1');
|
367 |
}
|
368 |
$modal_title = __('Assign Category for Selected Images', 'grand-media');
|
369 |
$modal_button = __('Assign Category', 'grand-media');
|
370 |
-
|
371 |
case 'unassign_category':
|
372 |
-
if(!current_user_can('gmedia_terms')){
|
373 |
die('-1');
|
374 |
}
|
375 |
$button_class = 'btn-danger';
|
376 |
$modal_title = __('Unassign Categories from Selected Items', 'grand-media');
|
377 |
$modal_button = __('Unassign Categories', 'grand-media');
|
378 |
-
|
379 |
case 'exclude_albums':
|
380 |
case 'filter_albums':
|
381 |
$modal_title = __('Filter Albums', 'grand-media');
|
382 |
$modal_button = __('Show Selected', 'grand-media');
|
383 |
-
|
384 |
case 'assign_album':
|
385 |
-
if(!current_user_can('gmedia_terms')){
|
386 |
die('-1');
|
387 |
}
|
388 |
$modal_title = __('Assign Album for Selected Items', 'grand-media');
|
389 |
$modal_button = __('Assign Album', 'grand-media');
|
390 |
-
|
391 |
case 'exclude_tags':
|
392 |
case 'filter_tags':
|
393 |
$modal_title = __('Filter by Tags', 'grand-media');
|
394 |
$modal_button = __('Show Selected', 'grand-media');
|
395 |
-
|
396 |
case 'add_tags':
|
397 |
-
if(!current_user_can('gmedia_terms')){
|
398 |
die('-1');
|
399 |
}
|
400 |
$modal_title = __('Add Tags to Selected Items', 'grand-media');
|
401 |
$modal_button = __('Add Tags', 'grand-media');
|
402 |
-
|
403 |
case 'delete_tags':
|
404 |
-
if(!current_user_can('gmedia_terms')){
|
405 |
die('-1');
|
406 |
}
|
407 |
$button_class = 'btn-danger';
|
408 |
$modal_title = __('Delete Tags from Selected Items', 'grand-media');
|
409 |
$modal_button = __('Delete Tags', 'grand-media');
|
410 |
-
|
411 |
case 'custom_filter':
|
412 |
$modal_title = __('Custom Filters', 'grand-media');
|
413 |
$modal_button = __('Show Selected', 'grand-media');
|
414 |
-
|
415 |
case 'filter_author':
|
416 |
$modal_title = __('Filter by Author', 'grand-media');
|
417 |
if($gmCore->caps['gmedia_show_others_media']){
|
@@ -419,7 +422,7 @@ function gmedia_get_modal(){
|
|
419 |
} else{
|
420 |
$modal_button = false;
|
421 |
}
|
422 |
-
|
423 |
case 'select_author':
|
424 |
$modal_title = __('Select Author', 'grand-media');
|
425 |
if($gmCore->caps['gmedia_show_others_media']){
|
@@ -427,18 +430,18 @@ function gmedia_get_modal(){
|
|
427 |
} else{
|
428 |
$modal_button = false;
|
429 |
}
|
430 |
-
|
431 |
case 'batch_edit':
|
432 |
-
if(!current_user_can('gmedia_edit_media')){
|
433 |
die('-1');
|
434 |
}
|
435 |
$modal_title = __('Batch Edit', 'grand-media');
|
436 |
$modal_button = __('Batch Save', 'grand-media');
|
437 |
-
|
438 |
default:
|
439 |
$modal_title = ' ';
|
440 |
$modal_button = false;
|
441 |
-
|
442 |
}
|
443 |
|
444 |
$form_action = !empty($_SERVER['HTTP_REFERER'])? $gmCore->get_admin_url(array(), array(), $_SERVER['HTTP_REFERER']) : '';
|
@@ -453,7 +456,7 @@ function gmedia_get_modal(){
|
|
453 |
switch($modal){
|
454 |
case 'quick_gallery':
|
455 |
case 'quick_gallery_stack':
|
456 |
-
if(!empty($ckey)){
|
457 |
$selected_in_library = isset($_COOKIE[ $ckey ])? str_replace('.', ',', $_COOKIE[ $ckey ]) : '';
|
458 |
}
|
459 |
if(empty($selected_in_library)){
|
@@ -476,12 +479,12 @@ function gmedia_get_modal(){
|
|
476 |
$option = array();
|
477 |
$option[] = '<option ' . $selected . ' value="' . esc_attr($mfold) . '">' . $module['title'] . ' - ' . __('Default Settings') . '</option>';
|
478 |
foreach($presets as $preset){
|
479 |
-
if(!(int)$preset->global && '[' . $mfold . ']' === $preset->name){
|
480 |
continue;
|
481 |
}
|
482 |
$selected = selected($gmGallery->options['default_gmedia_module'], $preset->term_id, false);
|
483 |
$by_author = '';
|
484 |
-
if((int)$preset->global){
|
485 |
$by_author = ' [' . get_the_author_meta('display_name', $preset->global) . ']';
|
486 |
}
|
487 |
if('[' . $mfold . ']' === $preset->name){
|
@@ -507,8 +510,9 @@ function gmedia_get_modal(){
|
|
507 |
if($gmCore->caps['gmedia_show_others_media']){
|
508 |
$args = array();
|
509 |
} else{
|
510 |
-
$args = array(
|
511 |
-
|
|
|
512 |
);
|
513 |
}
|
514 |
$gm_terms = $gmDB->get_terms('gmedia_album', $args);
|
@@ -546,8 +550,9 @@ function gmedia_get_modal(){
|
|
546 |
if($gmCore->caps['gmedia_edit_others_media']){
|
547 |
$args = array();
|
548 |
} else{
|
549 |
-
$args = array(
|
550 |
-
|
|
|
551 |
);
|
552 |
}
|
553 |
$gm_terms = $gmDB->get_terms('gmedia_album', $args);
|
@@ -585,13 +590,13 @@ function gmedia_get_modal(){
|
|
585 |
</label></div>
|
586 |
</div>
|
587 |
<script type="text/javascript">
|
588 |
-
jQuery(function($)
|
589 |
var albums = $('#combobox_gmedia_album');
|
590 |
var albums_data = $('option', albums);
|
591 |
//noinspection JSDuplicatedDeclaration
|
592 |
albums.selectize({
|
593 |
<?php if($gmCore->caps['gmedia_album_manage']){ ?>
|
594 |
-
create: function(input)
|
595 |
return {
|
596 |
value: input,
|
597 |
text: input
|
@@ -603,20 +608,20 @@ function gmedia_get_modal(){
|
|
603 |
<?php } ?>
|
604 |
persist: false,
|
605 |
render: {
|
606 |
-
item: function(item, escape)
|
607 |
-
if(0 === (parseInt(item.value, 10) || 0))
|
608 |
return '<div>' + escape(item.text) + '</div>';
|
609 |
}
|
610 |
-
if(item.$order)
|
611 |
var data = $(albums_data[item.$order]).data();
|
612 |
return '<div>' + escape(data.name) + ' <small>' + escape(data.meta) + '</small></div>';
|
613 |
}
|
614 |
},
|
615 |
-
option: function(item, escape)
|
616 |
-
if(0 === (parseInt(item.value) || 0))
|
617 |
return '<div>' + escape(item.text) + '</div>';
|
618 |
}
|
619 |
-
if(item.$order)
|
620 |
var data = $(albums_data[item.$order]).data();
|
621 |
return '<div>' + escape(data.name) + ' <small>' + escape(data.meta) + '</small>' + ' <span class="badge pull-right">' + escape(data.count) + '</span></div>';
|
622 |
}
|
@@ -655,10 +660,10 @@ function gmedia_get_modal(){
|
|
655 |
<input id="combobox_gmedia_category" name="cat_names" class="form-control input-sm" value="" placeholder="<?php _e('Add to Categories...', 'grand-media'); ?>"/>
|
656 |
</div>
|
657 |
<script type="text/javascript">
|
658 |
-
jQuery(function($)
|
659 |
var gm_terms = <?php echo json_encode($gm_terms); ?>;
|
660 |
//noinspection JSUnusedAssignment
|
661 |
-
var items = gm_terms.map(function(x)
|
662 |
//noinspection JSUnresolvedVariable
|
663 |
return {id: x.term_id, name: x.name, count: x.count};
|
664 |
});
|
@@ -675,7 +680,7 @@ function gmedia_get_modal(){
|
|
675 |
persist: false,
|
676 |
<?php if($gmCore->caps['gmedia_category_manage']){ ?>
|
677 |
createOnBlur: true,
|
678 |
-
create: function(input)
|
679 |
return {
|
680 |
name: input
|
681 |
}
|
@@ -684,10 +689,10 @@ function gmedia_get_modal(){
|
|
684 |
create: false,
|
685 |
<?php } ?>
|
686 |
render: {
|
687 |
-
item: function(item, escape)
|
688 |
return '<div>' + escape(item.name) + '</div>';
|
689 |
},
|
690 |
-
option: function(item, escape)
|
691 |
return '<div>' + escape(item.name) + ' <span class="badge">' + escape(item.count) + '</span></div>';
|
692 |
}
|
693 |
}
|
@@ -699,11 +704,13 @@ function gmedia_get_modal(){
|
|
699 |
case 'unassign_category':
|
700 |
// get selected items in Gmedia Library
|
701 |
$selected_items = !empty($ckey)? array_filter(explode('.', $_COOKIE[ $ckey ]), 'is_numeric') : false;
|
702 |
-
if(!empty($selected_items)){
|
703 |
$gm_terms = $gmDB->get_gmedia_terms($selected_items, 'gmedia_category');
|
704 |
}
|
705 |
if(count($gm_terms)){
|
706 |
-
foreach($gm_terms
|
|
|
|
|
707 |
?>
|
708 |
<div class="checkbox">
|
709 |
<label><input type="checkbox" name="category_id[]" value="<?php echo $term->term_id; ?>"> <?php echo esc_html($term->name); ?></label>
|
@@ -726,10 +733,10 @@ function gmedia_get_modal(){
|
|
726 |
<div class="form-group">
|
727 |
<input id="combobox_gmedia_tag" name="tag_ids" class="form-control input-sm" value="" placeholder="<?php _e('Filter Tags...', 'grand-media'); ?>"/></div>
|
728 |
<script type="text/javascript">
|
729 |
-
jQuery(function($)
|
730 |
var gm_terms = <?php echo json_encode($gm_terms); ?>;
|
731 |
//noinspection JSUnusedAssignment
|
732 |
-
var items = gm_terms.map(function(x)
|
733 |
//noinspection JSUnresolvedVariable
|
734 |
return {id: x.term_id, name: x.name, count: x.count};
|
735 |
});
|
@@ -744,10 +751,10 @@ function gmedia_get_modal(){
|
|
744 |
valueField: 'id',
|
745 |
create: false,
|
746 |
render: {
|
747 |
-
item: function(item, escape)
|
748 |
return '<div>' + escape(item.name) + '</div>';
|
749 |
},
|
750 |
-
option: function(item, escape)
|
751 |
return '<div>' + escape(item.name) + ' <span class="badge">' + escape(item.count) + '</span></div>';
|
752 |
}
|
753 |
}
|
@@ -772,10 +779,10 @@ function gmedia_get_modal(){
|
|
772 |
<label><input type="checkbox" name="iptc_tags" value="1"> <?php _e('Import IPTC Keywords from selected images to Tags'); ?></label>
|
773 |
</div>
|
774 |
<script type="text/javascript">
|
775 |
-
jQuery(function($)
|
776 |
var gm_terms = <?php echo json_encode($gm_terms); ?>;
|
777 |
//noinspection JSUnusedAssignment
|
778 |
-
var items = gm_terms.map(function(x)
|
779 |
//noinspection JSUnresolvedVariable
|
780 |
return {id: x.term_id, name: x.name, count: x.count};
|
781 |
});
|
@@ -792,7 +799,7 @@ function gmedia_get_modal(){
|
|
792 |
persist: false,
|
793 |
<?php if($gmCore->caps['gmedia_tag_manage']){ ?>
|
794 |
createOnBlur: true,
|
795 |
-
create: function(input)
|
796 |
return {
|
797 |
name: input
|
798 |
}
|
@@ -801,10 +808,10 @@ function gmedia_get_modal(){
|
|
801 |
create: false,
|
802 |
<?php } ?>
|
803 |
render: {
|
804 |
-
item: function(item, escape)
|
805 |
return '<div>' + escape(item.name) + '</div>';
|
806 |
},
|
807 |
-
option: function(item, escape)
|
808 |
return '<div>' + escape(item.name) + ' <span class="badge">' + escape(item.count) + '</span></div>';
|
809 |
}
|
810 |
}
|
@@ -816,11 +823,13 @@ function gmedia_get_modal(){
|
|
816 |
case 'delete_tags':
|
817 |
// get selected items in Gmedia Library
|
818 |
$selected_items = !empty($ckey)? array_filter(explode('.', $_COOKIE[ $ckey ]), 'is_numeric') : false;
|
819 |
-
if(!empty($selected_items)){
|
820 |
$gm_terms = $gmDB->get_gmedia_terms($selected_items, 'gmedia_tag');
|
821 |
}
|
822 |
if(count($gm_terms)){
|
823 |
-
foreach($gm_terms
|
|
|
|
|
824 |
?>
|
825 |
<div class="checkbox">
|
826 |
<label><input type="checkbox" name="tag_id[]" value="<?php echo $term->term_id; ?>"> <?php echo esc_html($term->name); ?></label>
|
@@ -843,21 +852,32 @@ function gmedia_get_modal(){
|
|
843 |
<?php
|
844 |
$user_ids = $gmCore->get_editable_user_ids();
|
845 |
if($user_ids){
|
846 |
-
if(!in_array($user_ID, $user_ids)){
|
847 |
array_push($user_ids, $user_ID);
|
848 |
}
|
849 |
-
wp_dropdown_users(array(
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
|
|
856 |
} else{
|
857 |
echo '<div>' . get_the_author_meta('display_name', $user_ID) . '</div>';
|
858 |
}
|
859 |
?>
|
860 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
861 |
<?php
|
862 |
} else{
|
863 |
echo '<p>' . __('You are not allowed to see others media') . '</p>';
|
@@ -937,38 +957,39 @@ function gmedia_get_modal(){
|
|
937 |
</div>
|
938 |
<?php $user_ids = current_user_can('gmedia_delete_others_media')? $gmCore->get_editable_user_ids() : false;
|
939 |
if($user_ids){
|
940 |
-
if(!in_array($user_ID, $user_ids)){
|
941 |
array_push($user_ids, $user_ID);
|
942 |
}
|
943 |
?>
|
944 |
<div class="form-group">
|
945 |
<label><?php _e('Author', 'grand-media'); ?></label>
|
946 |
-
<?php wp_dropdown_users(array(
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
|
|
953 |
?>
|
954 |
</div>
|
955 |
<?php } ?>
|
956 |
<script type="text/javascript">
|
957 |
-
jQuery(function($)
|
958 |
-
$('select.batch_set').change(function()
|
959 |
-
if('custom' == $(this).val())
|
960 |
$(this).next().css({display: 'block'});
|
961 |
-
} else
|
962 |
$(this).next().css({display: 'none'});
|
963 |
}
|
964 |
});
|
965 |
});
|
966 |
</script>
|
967 |
<?php
|
968 |
-
|
969 |
default:
|
970 |
_e('Ops! Something wrong.', 'grand-media');
|
971 |
-
|
972 |
}
|
973 |
?>
|
974 |
</div>
|
@@ -992,7 +1013,7 @@ function gmedia_tag_edit(){
|
|
992 |
global $gmCore, $gmDB;
|
993 |
|
994 |
check_ajax_referer('gmedia_terms', '_wpnonce_terms');
|
995 |
-
if(!current_user_can('gmedia_tag_manage') && !current_user_can('gmedia_edit_others_media')){
|
996 |
$out['error'] = $gmCore->alert('danger', __("You are not allowed to edit others media", 'grand-media'));
|
997 |
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
|
998 |
echo json_encode($out);
|
@@ -1004,7 +1025,7 @@ function gmedia_tag_edit(){
|
|
1004 |
$term['term_id'] = intval($gmCore->_post('tag_id', 0));
|
1005 |
if($term['name'] && !$gmCore->is_digit($term['name'])){
|
1006 |
if(($term_id = $gmDB->term_exists($term['term_id']))){
|
1007 |
-
if(!$gmDB->term_exists($term['name'], $term['taxonomy'])){
|
1008 |
$term_id = $gmDB->update_term($term['term_id'], $term);
|
1009 |
if(is_wp_error($term_id)){
|
1010 |
$out['error'] = $gmCore->alert('danger', $term_id->get_error_message());
|
@@ -1034,13 +1055,13 @@ function gmedia_module_preset_delete(){
|
|
1034 |
$out = array('error' => '');
|
1035 |
|
1036 |
check_ajax_referer('GmediaGallery');
|
1037 |
-
if(!current_user_can('gmedia_gallery_manage')){
|
1038 |
$out['error'] = $gmCore->alert('danger', __("You are not allowed to manage galleries", 'grand-media'));
|
1039 |
} else{
|
1040 |
$term_id = intval($gmCore->_post('preset_id', 0));
|
1041 |
$term = $gmDB->get_term($term_id);
|
1042 |
if($term && !is_wp_error($term)){
|
1043 |
-
if(($term->global != $user_ID && !gm_user_can('delete_others_media')) || ((int)$term->global === 0 && !current_user_can('manage_options'))){
|
1044 |
$out['error'] = $gmCore->alert('danger', __("You are not allowed to manage galleries", 'grand-media'));
|
1045 |
|
1046 |
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
|
@@ -1068,7 +1089,7 @@ function gmedia_module_install(){
|
|
1068 |
global $gmCore, $gmGallery;
|
1069 |
|
1070 |
check_ajax_referer('GmediaGallery');
|
1071 |
-
if(!current_user_can('gmedia_module_manage')){
|
1072 |
echo $gmCore->alert('danger', __('You are not allowed to install modules'));
|
1073 |
die();
|
1074 |
}
|
@@ -1083,13 +1104,13 @@ function gmedia_module_install(){
|
|
1083 |
|
1084 |
$mzip = str_replace("\\", "/", $mzip);
|
1085 |
$to_folder = $gmCore->upload['path'] . '/' . $gmGallery->options['folder']['module'] . '/';
|
1086 |
-
if(!wp_mkdir_p($to_folder)){
|
1087 |
echo $gmCore->alert('danger', sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?', 'grand-media'), $to_folder));
|
1088 |
die();
|
1089 |
}
|
1090 |
-
if(!is_writable($to_folder)){
|
1091 |
@chmod($to_folder, 0755);
|
1092 |
-
if(!is_writable($to_folder)){
|
1093 |
echo $gmCore->alert('danger', sprintf(__('Directory %s is not writable by the server.', 'grand-media'), $to_folder));
|
1094 |
die();
|
1095 |
}
|
@@ -1097,11 +1118,11 @@ function gmedia_module_install(){
|
|
1097 |
|
1098 |
global $wp_filesystem;
|
1099 |
// Is a filesystem accessor setup?
|
1100 |
-
if(!$wp_filesystem || !is_object($wp_filesystem)){
|
1101 |
require_once(ABSPATH . 'wp-admin/includes/file.php');
|
1102 |
WP_Filesystem();
|
1103 |
}
|
1104 |
-
if(!is_object($wp_filesystem)){
|
1105 |
$result = new WP_Error('fs_unavailable', __('Could not access filesystem.', 'grand-media'));
|
1106 |
} elseif($wp_filesystem->errors->get_error_code()){
|
1107 |
$result = new WP_Error('fs_error', __('Filesystem error', 'grand-media'), $wp_filesystem->errors);
|
@@ -1137,7 +1158,7 @@ function gmedia_import_wpmedia_modal(){
|
|
1137 |
global $user_ID, $gmDB, $gmCore;
|
1138 |
|
1139 |
check_ajax_referer('GmediaGallery');
|
1140 |
-
if(!current_user_can('gmedia_import')){
|
1141 |
die('-1');
|
1142 |
}
|
1143 |
?>
|
@@ -1193,7 +1214,7 @@ function gmedia_import_wpmedia_modal(){
|
|
1193 |
<input id="combobox_gmedia_tag" name="terms[gmedia_tag]" class="form-control input-sm" value="" placeholder="<?php _e('Add Tags...', 'grand-media'); ?>"/>
|
1194 |
</div>
|
1195 |
<script type="text/javascript">
|
1196 |
-
jQuery(function($)
|
1197 |
//noinspection JSDuplicatedDeclaration
|
1198 |
$('#combobox_gmedia_album').selectize({
|
1199 |
<?php if($gmCore->caps['gmedia_album_manage']){ ?>
|
@@ -1207,13 +1228,13 @@ function gmedia_import_wpmedia_modal(){
|
|
1207 |
|
1208 |
var gm_cat_terms = <?php echo json_encode($gm_cat_terms); ?>;
|
1209 |
//noinspection JSUnusedAssignment
|
1210 |
-
var cat_items = gm_cat_terms.map(function(x)
|
1211 |
return {item: x};
|
1212 |
});
|
1213 |
//noinspection JSDuplicatedDeclaration
|
1214 |
$('#combobox_gmedia_category').selectize({
|
1215 |
<?php if($gmCore->caps['gmedia_category_manage']){ ?>
|
1216 |
-
create: function(input)
|
1217 |
return {
|
1218 |
item: input
|
1219 |
}
|
@@ -1235,13 +1256,13 @@ function gmedia_import_wpmedia_modal(){
|
|
1235 |
|
1236 |
var gm_tag_terms = <?php echo json_encode($gm_tag_terms); ?>;
|
1237 |
//noinspection JSUnusedAssignment
|
1238 |
-
var tag_items = gm_tag_terms.map(function(x)
|
1239 |
return {item: x};
|
1240 |
});
|
1241 |
//noinspection JSDuplicatedDeclaration
|
1242 |
$('#combobox_gmedia_tag').selectize({
|
1243 |
<?php if($gmCore->caps['gmedia_tag_manage']){ ?>
|
1244 |
-
create: function(input)
|
1245 |
return {
|
1246 |
item: input
|
1247 |
}
|
@@ -1270,12 +1291,12 @@ function gmedia_import_wpmedia_modal(){
|
|
1270 |
<div class="help-block"><?php _e('Note: duplicates will be skipped in any way (checked by file hash)') ?></div>
|
1271 |
</div>
|
1272 |
<script type="text/javascript">
|
1273 |
-
jQuery(function($)
|
1274 |
-
$('#import-done').one('click', function()
|
1275 |
$('#import_form').submit();
|
1276 |
$(this).text($(this).data('loading-text')).prop('disabled', true);
|
1277 |
$('#import_window').show();
|
1278 |
-
$(this).one('click', function()
|
1279 |
$('#importModal').modal('hide');
|
1280 |
});
|
1281 |
});
|
@@ -1307,12 +1328,12 @@ function gmedia_relimage(){
|
|
1307 |
check_ajax_referer("GmediaGallery");
|
1308 |
|
1309 |
// check for correct capability
|
1310 |
-
if(!current_user_can('gmedia_library')){
|
1311 |
die('-1');
|
1312 |
}
|
1313 |
|
1314 |
$post_tags = array_filter(array_map('trim', explode(',', stripslashes(urldecode($gmCore->_get('tags', ''))))));
|
1315 |
-
$paged = (int)$gmCore->_get('paged', 1);
|
1316 |
$per_page = 20;
|
1317 |
$s = trim(stripslashes(urldecode($gmCore->_get('search'))));
|
1318 |
if($s && strlen($s) > 2){
|
@@ -1322,19 +1343,20 @@ function gmedia_relimage(){
|
|
1322 |
}
|
1323 |
|
1324 |
$gmediaLib = array();
|
1325 |
-
$relative = (int)$gmCore->_get('rel', 1);
|
1326 |
$continue = true;
|
1327 |
$content = '';
|
1328 |
|
1329 |
if($relative == 1){
|
1330 |
-
$arg = array(
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
|
|
1338 |
);
|
1339 |
$gmediaLib = $gmDB->get_gmedias($arg);
|
1340 |
}
|
@@ -1344,10 +1366,10 @@ function gmedia_relimage(){
|
|
1344 |
if($relative == 1){
|
1345 |
$relative = 0;
|
1346 |
$paged = 1;
|
1347 |
-
$content
|
1348 |
}
|
1349 |
|
1350 |
-
$tag__not_in = "'" . implode("','", array_map('esc_sql', array_unique((array)$post_tags))) . "'";
|
1351 |
$tag__not_in = $wpdb->get_col("
|
1352 |
SELECT term_id
|
1353 |
FROM {$wpdb->prefix}gmedia_term
|
@@ -1355,12 +1377,13 @@ function gmedia_relimage(){
|
|
1355 |
AND name IN ({$tag__not_in})
|
1356 |
");
|
1357 |
|
1358 |
-
$arg = array(
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
|
|
1364 |
);
|
1365 |
$gmediaLib = $gmDB->get_gmedias($arg);
|
1366 |
}
|
@@ -1399,7 +1422,7 @@ add_action('wp_ajax_gmedia_ftp_browser', 'gmedia_ftp_browser');
|
|
1399 |
* @return string folder content
|
1400 |
*/
|
1401 |
function gmedia_ftp_browser(){
|
1402 |
-
if(!current_user_can('gmedia_import')){
|
1403 |
die('No access');
|
1404 |
}
|
1405 |
|
@@ -1417,7 +1440,7 @@ function gmedia_ftp_browser(){
|
|
1417 |
|
1418 |
// The 2 counts for . and ..
|
1419 |
if(count($files) > 2){
|
1420 |
-
echo "<ul class=\"
|
1421 |
// return only directories
|
1422 |
foreach($files as $file){
|
1423 |
if(in_array($file, array('wp-admin', 'wp-includes', 'plugins', 'themes', 'thumb', 'thumbs'))){
|
@@ -1428,6 +1451,16 @@ function gmedia_ftp_browser(){
|
|
1428 |
echo "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . esc_attr($dir . $file) . "/\">" . esc_html($file) . "</a></li>";
|
1429 |
}
|
1430 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1431 |
echo "</ul>";
|
1432 |
}
|
1433 |
}
|
@@ -1441,7 +1474,7 @@ function gmedia_set_post_thumbnail(){
|
|
1441 |
|
1442 |
$post_ID = intval($gmCore->_post('post_id', 0));
|
1443 |
|
1444 |
-
if(!$post_ID || !current_user_can('edit_post', $post_ID)){
|
1445 |
die('-1');
|
1446 |
}
|
1447 |
|
@@ -1463,10 +1496,11 @@ function gmedia_set_post_thumbnail(){
|
|
1463 |
$image = $gmDB->get_gmedia($img_id);
|
1464 |
if($image){
|
1465 |
|
1466 |
-
$args = array(
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
|
|
1470 |
);
|
1471 |
$posts = get_posts($args);
|
1472 |
$attachment_id = null;
|
@@ -1492,12 +1526,13 @@ function gmedia_set_post_thumbnail(){
|
|
1492 |
$title = sanitize_title($image->title);
|
1493 |
$caption = $gmCore->sanitize($image->description);
|
1494 |
|
1495 |
-
$attachment = array(
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
|
|
1501 |
);
|
1502 |
|
1503 |
//require for wp_generate_attachment_metadata which generates image related meta-data also creates thumbs
|
@@ -1535,7 +1570,7 @@ function gmedia_upload_handler(){
|
|
1535 |
|
1536 |
// if nonce is not correct it returns -1
|
1537 |
check_ajax_referer('gmedia_upload', '_wpnonce_upload');
|
1538 |
-
if(!current_user_can('gmedia_upload')){
|
1539 |
wp_die(__('You do not have permission to upload files in Gmedia Library.'));
|
1540 |
}
|
1541 |
|
@@ -1548,7 +1583,7 @@ function gmedia_upload_handler(){
|
|
1548 |
$filename = $gmCore->_req('name');
|
1549 |
|
1550 |
// Get parameters
|
1551 |
-
if(!$filename){
|
1552 |
$return = json_encode(array("error" => array("code" => 100, "message" => __("No file name.", 'grand-media'))));
|
1553 |
die($return);
|
1554 |
}
|
@@ -1607,7 +1642,7 @@ function gmedia_import_handler(){
|
|
1607 |
nocache_headers();
|
1608 |
|
1609 |
check_admin_referer('gmedia_import', '_wpnonce_import');
|
1610 |
-
if(!current_user_can('gmedia_import')){
|
1611 |
wp_die(__('You do not have permission to upload files.'));
|
1612 |
}
|
1613 |
|
@@ -1629,11 +1664,11 @@ function gmedia_import_handler(){
|
|
1629 |
?>
|
1630 |
<html>
|
1631 |
<style type="text/css">
|
1632 |
-
* { margin:0; padding:0; }
|
1633 |
-
pre { display:block; }
|
1634 |
-
p { padding:10px 0; font-size:14px; }
|
1635 |
-
.ok { color:darkgreen; }
|
1636 |
-
.ko { color:darkred; }
|
1637 |
</style>
|
1638 |
<body>
|
1639 |
<?php
|
@@ -1644,10 +1679,10 @@ function gmedia_import_handler(){
|
|
1644 |
|
1645 |
if($path){
|
1646 |
$path = trim(urldecode($path), '/');
|
1647 |
-
if(!empty($path)){
|
1648 |
$fullpath = ABSPATH . trailingslashit($path);
|
1649 |
$files = glob($fullpath . '?*.?*', GLOB_NOSORT);
|
1650 |
-
if(!empty($files)){
|
1651 |
$allowed_ext = get_allowed_mime_types();
|
1652 |
$allowed_ext = array_keys($allowed_ext);
|
1653 |
$allowed_ext = implode('|', $allowed_ext);
|
@@ -1659,7 +1694,7 @@ function gmedia_import_handler(){
|
|
1659 |
$gmuid = basename($filepath);
|
1660 |
if(in_array($gmuid, $gmedias)){
|
1661 |
$fileinfo = $gmCore->fileinfo($gmuid, false);
|
1662 |
-
if(!(('image' == $fileinfo['dirname']) && !is_file($fileinfo['filepath']))){
|
1663 |
unset($files[ $i ]);
|
1664 |
}
|
1665 |
}
|
@@ -1672,7 +1707,7 @@ function gmedia_import_handler(){
|
|
1672 |
}
|
1673 |
foreach($files as $i => $filepath){
|
1674 |
$ext = pathinfo($filepath, PATHINFO_EXTENSION);
|
1675 |
-
if(!in_array(strtolower($ext), $allowed_ext)){
|
1676 |
unset($files[ $i ]);
|
1677 |
}
|
1678 |
}
|
@@ -1689,20 +1724,20 @@ function gmedia_import_handler(){
|
|
1689 |
echo '<h4 style="margin: 0 0 10px">' . __('Import from Flagallery plugin') . ":</h4>" . PHP_EOL;
|
1690 |
|
1691 |
$gallery = $gmCore->_post('gallery');
|
1692 |
-
if(!empty($gallery)){
|
1693 |
-
$album = (!isset($terms['gmedia_album']) || empty($terms['gmedia_album']))? false : true;
|
1694 |
foreach($gallery as $gid){
|
1695 |
$flag_gallery = $wpdb->get_row($wpdb->prepare("SELECT gid, path, title, galdesc FROM {$wpdb->prefix}flag_gallery WHERE gid = %d", $gid), ARRAY_A);
|
1696 |
if(empty($flag_gallery)){
|
1697 |
continue;
|
1698 |
}
|
1699 |
|
1700 |
-
if(!$album){
|
1701 |
$terms['gmedia_album'] = $flag_gallery['title'];
|
1702 |
if($gmCore->is_digit($terms['gmedia_album'])){
|
1703 |
$terms['gmedia_album'] = 'a' . $terms['gmedia_album'];
|
1704 |
}
|
1705 |
-
if(!$gmDB->term_exists($terms['gmedia_album'], 'gmedia_album')){
|
1706 |
$term_id = $gmDB->insert_term($terms['gmedia_album'], 'gmedia_album', array('description' => htmlspecialchars_decode(stripslashes($flag_gallery['galdesc']))));
|
1707 |
}
|
1708 |
}
|
@@ -1729,20 +1764,20 @@ function gmedia_import_handler(){
|
|
1729 |
echo '<h4 style="margin: 0 0 10px">' . __('Import from NextGen plugin') . ":</h4>" . PHP_EOL;
|
1730 |
|
1731 |
$gallery = $gmCore->_post('gallery');
|
1732 |
-
if(!empty($gallery)){
|
1733 |
-
$album = (!isset($terms['gmedia_album']) || empty($terms['gmedia_album']))? false : true;
|
1734 |
foreach($gallery as $gid){
|
1735 |
$ngg_gallery = $wpdb->get_row($wpdb->prepare("SELECT gid, path, title, galdesc FROM {$wpdb->prefix}ngg_gallery WHERE gid = %d", $gid), ARRAY_A);
|
1736 |
if(empty($ngg_gallery)){
|
1737 |
continue;
|
1738 |
}
|
1739 |
|
1740 |
-
if(!$album){
|
1741 |
$terms['gmedia_album'] = $ngg_gallery['title'];
|
1742 |
if($gmCore->is_digit($terms['gmedia_album'])){
|
1743 |
$terms['gmedia_album'] = 'a' . $ngg_gallery['title'];
|
1744 |
}
|
1745 |
-
if(!$gmDB->term_exists($terms['gmedia_album'], 'gmedia_album')){
|
1746 |
$term_id = $gmDB->insert_term($terms['gmedia_album'], 'gmedia_album', array('description' => htmlspecialchars_decode(stripslashes($ngg_gallery['galdesc']))));
|
1747 |
}
|
1748 |
}
|
@@ -1769,13 +1804,14 @@ function gmedia_import_handler(){
|
|
1769 |
|
1770 |
$wpMediaLib = $gmDB->get_wp_media_lib(array('filter' => 'selected', 'selected' => $gmCore->_post('selected')));
|
1771 |
|
1772 |
-
if(!empty($wpMediaLib)){
|
1773 |
|
1774 |
$wp_media = array();
|
1775 |
foreach($wpMediaLib as $item){
|
1776 |
-
$wp_media[] = array(
|
1777 |
-
|
1778 |
-
|
|
|
1779 |
);
|
1780 |
}
|
1781 |
$exists = $gmCore->_post('skip_exists', 0);
|
@@ -1801,21 +1837,31 @@ function gmedia_application(){
|
|
1801 |
|
1802 |
// if nonce is not correct it returns -1
|
1803 |
check_ajax_referer('GmediaService');
|
1804 |
-
if(!current_user_can('manage_options')){
|
1805 |
die('-1');
|
1806 |
}
|
1807 |
|
1808 |
$service = $gmCore->_post('service');
|
1809 |
-
if(!$service){
|
1810 |
die('0');
|
1811 |
}
|
1812 |
-
$
|
1813 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1814 |
|
1815 |
-
$options = $gmGallery->options;
|
1816 |
-
$options['site_email'] = $data['site_email'];
|
1817 |
-
$options['site_title'] = $data['site_title'];
|
1818 |
-
$options['site_description'] = $data['site_description'];
|
1819 |
if($options != $gmGallery->options){
|
1820 |
$gmGallery->options = $options;
|
1821 |
update_option('gmediaOptions', $options);
|
@@ -1838,7 +1884,7 @@ function gmedia_share_page(){
|
|
1838 |
$sharelink = $gmCore->_post('sharelink', '');
|
1839 |
$email = $gmCore->_post('email', '');
|
1840 |
$sharemessage = $gmCore->_post('message', '');
|
1841 |
-
if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
|
1842 |
echo $gmCore->alert('danger', __('Invalid email', 'grand-media') . ': ' . esc_html($email));
|
1843 |
die();
|
1844 |
}
|
@@ -1905,12 +1951,12 @@ function gmedia_add_custom_field(){
|
|
1905 |
|
1906 |
$meta_type = 'gmedia';
|
1907 |
|
1908 |
-
$pid = (int)$_POST['ID'];
|
1909 |
$post = $gmDB->get_gmedia($pid);
|
1910 |
|
1911 |
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
|
1912 |
|
1913 |
-
if(!current_user_can('gmedia_edit_media') || ($user_ID != $post->author && !current_user_can('gmedia_edit_others_media'))){
|
1914 |
echo json_encode(array('error' => array('code' => 100, 'message' => __('You are not allowed to edit others media', 'grand-media')), 'id' => $pid));
|
1915 |
die();
|
1916 |
}
|
@@ -1919,22 +1965,24 @@ function gmedia_add_custom_field(){
|
|
1919 |
die();
|
1920 |
}
|
1921 |
|
1922 |
-
if(!$mid = $gmCore->add_meta($pid, $meta_type)){
|
1923 |
echo json_encode(array('error' => array('code' => 102, 'message' => __('Please provide a custom field value', 'grand-media')), 'id' => $pid));
|
1924 |
die();
|
1925 |
}
|
1926 |
|
1927 |
$column = sanitize_key($meta_type . '_id');
|
1928 |
$meta = $gmDB->get_metadata_by_mid($meta_type, $mid);
|
1929 |
-
$pid = (int)$meta->{$column};
|
1930 |
$meta = get_object_vars($meta);
|
1931 |
-
$result = array(
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
|
|
|
|
1935 |
);
|
1936 |
|
1937 |
-
if(!empty($_POST['metakeyinput'])){
|
1938 |
$result['newmeta_form'] = $gmCore->meta_form($meta_type);
|
1939 |
}
|
1940 |
|
@@ -1950,10 +1998,10 @@ function gmedia_delete_custom_field(){
|
|
1950 |
|
1951 |
$meta_type = 'gmedia';
|
1952 |
|
1953 |
-
$pid = (int)$_POST['ID'];
|
1954 |
$post = $gmDB->get_gmedia($pid);
|
1955 |
|
1956 |
-
if(!current_user_can('gmedia_edit_media') || ($user_ID != $post->author && !current_user_can('gmedia_edit_others_media'))){
|
1957 |
echo json_encode(array('error' => array('code' => 100, 'message' => __('You are not allowed to edit others media', 'grand-media')), 'id' => $pid));
|
1958 |
die();
|
1959 |
}
|
@@ -1964,7 +2012,7 @@ function gmedia_delete_custom_field(){
|
|
1964 |
$column = sanitize_key($meta_type . '_id');
|
1965 |
if(isset($deletemeta) && is_array($deletemeta)){
|
1966 |
foreach($deletemeta as $key => $value){
|
1967 |
-
if(!$meta = $gmDB->get_metadata_by_mid($meta_type, $key)){
|
1968 |
continue;
|
1969 |
}
|
1970 |
if($meta->{$column} != $pid){
|
@@ -1992,14 +2040,14 @@ function gmedia_term_add_custom_field(){
|
|
1992 |
|
1993 |
$meta_type = 'gmedia_term';
|
1994 |
|
1995 |
-
$pid = (int)$_POST['ID'];
|
1996 |
$post = $gmDB->get_term($pid);
|
1997 |
|
1998 |
$taxonomy = $post->taxonomy;
|
1999 |
|
2000 |
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
|
2001 |
|
2002 |
-
if(!current_user_can($taxonomy . '_manage') || ($user_ID != $post->global && !current_user_can('gmedia_edit_others_media'))){
|
2003 |
echo json_encode(array('error' => array('code' => 100, 'message' => __('You are not allowed to edit others media', 'grand-media')), 'id' => $pid));
|
2004 |
die();
|
2005 |
}
|
@@ -2008,22 +2056,24 @@ function gmedia_term_add_custom_field(){
|
|
2008 |
die();
|
2009 |
}
|
2010 |
|
2011 |
-
if(!$mid = $gmCore->add_meta($pid, $meta_type)){
|
2012 |
echo json_encode(array('error' => array('code' => 102, 'message' => __('Please provide a custom field value', 'grand-media')), 'id' => $pid));
|
2013 |
die();
|
2014 |
}
|
2015 |
|
2016 |
$column = sanitize_key($meta_type . '_id');
|
2017 |
$meta = $gmDB->get_metadata_by_mid($meta_type, $mid);
|
2018 |
-
$pid = (int)$meta->{$column};
|
2019 |
$meta = get_object_vars($meta);
|
2020 |
-
$result = array(
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
|
|
|
|
2024 |
);
|
2025 |
|
2026 |
-
if(!empty($_POST['metakeyinput'])){
|
2027 |
$result['newmeta_form'] = $gmCore->meta_form($meta_type);
|
2028 |
}
|
2029 |
|
@@ -2039,14 +2089,14 @@ function gmedia_term_delete_custom_field(){
|
|
2039 |
|
2040 |
$meta_type = 'gmedia_term';
|
2041 |
|
2042 |
-
$pid = (int)$_POST['ID'];
|
2043 |
$post = $gmDB->get_term($pid);
|
2044 |
|
2045 |
$taxonomy = $post->taxonomy;
|
2046 |
|
2047 |
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
|
2048 |
|
2049 |
-
if(!current_user_can($taxonomy . '_manage') || ($user_ID != $post->global && !current_user_can('gmedia_edit_others_media'))){
|
2050 |
echo json_encode(array('error' => array('code' => 100, 'message' => __('You are not allowed to edit others media', 'grand-media')), 'id' => $pid));
|
2051 |
die();
|
2052 |
}
|
@@ -2057,7 +2107,7 @@ function gmedia_term_delete_custom_field(){
|
|
2057 |
$column = sanitize_key($meta_type . '_id');
|
2058 |
if(isset($deletemeta) && is_array($deletemeta)){
|
2059 |
foreach($deletemeta as $key => $value){
|
2060 |
-
if(!$meta = $gmDB->get_metadata_by_mid($meta_type, $key)){
|
2061 |
continue;
|
2062 |
}
|
2063 |
if($meta->{$column} != $pid){
|
@@ -2083,22 +2133,22 @@ function gmedia_term_sortorder(){
|
|
2083 |
check_ajax_referer('gmedia_terms', '_wpnonce_terms');
|
2084 |
|
2085 |
$term_id = $gmCore->_post('term_id');
|
2086 |
-
$idx0 = (int)$gmCore->_post('idx0');
|
2087 |
$ids = $gmCore->_post('ids');
|
2088 |
|
2089 |
-
if(!$idx0 || !is_array($ids)){
|
2090 |
die();
|
2091 |
}
|
2092 |
|
2093 |
-
if(!current_user_can('gmedia_album_manage')){
|
2094 |
wp_send_json(array('error' => array('code' => 100, 'message' => __('You are not allowed to manage this taxonomy', 'grand-media')), 'id' => $term_id));
|
2095 |
}
|
2096 |
|
2097 |
-
if(!$term_id || !($term_id = $gmDB->term_exists($term_id))){
|
2098 |
wp_send_json(array('error' => array('code' => 101, 'message' => __('A term with the id provided does not exists', 'grand-media')), 'id' => $term_id));
|
2099 |
}
|
2100 |
$term = $gmDB->get_term($term_id);
|
2101 |
-
if(((int)$term->global != (int)$user_ID) && !current_user_can('gmedia_edit_others_media')){
|
2102 |
wp_send_json(array('error' => array('code' => 102, 'message' => __('You are not allowed to edit others media', 'grand-media')), 'id' => $term_id));
|
2103 |
}
|
2104 |
|
@@ -2135,7 +2185,7 @@ function gmedia_upgrade_process(){
|
|
2135 |
}
|
2136 |
$result['timeout'] = $timeout;
|
2137 |
|
2138 |
-
if(!empty($info)){
|
2139 |
$result['content'] = '<div>' . implode("</div>\n<div>", $info) . '</div>';
|
2140 |
} elseif($db_version == GMEDIA_DBVERSION){
|
2141 |
$result['status'] = 'done';
|
@@ -2164,7 +2214,7 @@ function gmedia_hash_files(){
|
|
2164 |
)
|
2165 |
LIMIT 20";
|
2166 |
$unhashed = $wpdb->get_results($sql);
|
2167 |
-
if(!$unhashed){
|
2168 |
$ajax_operations = get_option('gmedia_ajax_long_operations', array());
|
2169 |
unset($ajax_operations['gmedia_hash_files']);
|
2170 |
if(empty($ajax_operations)){
|
@@ -2201,12 +2251,12 @@ function gmedia_recreate_images(){
|
|
2201 |
|
2202 |
$gmid = 0;
|
2203 |
$ajax_operations = get_option('gmedia_ajax_long_operations', array());
|
2204 |
-
if(!empty($ajax_operations['gmedia_recreate_images'])){
|
2205 |
$all_count = count($ajax_operations['gmedia_recreate_images']);
|
2206 |
$recreate_ids = array_filter($ajax_operations['gmedia_recreate_images']);
|
2207 |
$do_count = count($recreate_ids);
|
2208 |
|
2209 |
-
if(!empty($recreate_ids)){
|
2210 |
$gmid = reset($recreate_ids);
|
2211 |
$gmCore->recreate_images_from_original($gmid);
|
2212 |
|
@@ -2230,6 +2280,31 @@ function gmedia_recreate_images(){
|
|
2230 |
wp_send_json_success(array('progress' => '100%', 'info' => __('Done:', 'grand-media'), 'done' => true, 'id' => $gmid));
|
2231 |
}
|
2232 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2233 |
add_action('wp_ajax_gmedia_save_waveform', 'gmedia_save_waveform');
|
2234 |
add_action('wp_ajax_nopriv_gmedia_save_waveform', 'gmedia_save_waveform');
|
2235 |
function gmedia_save_waveform(){
|
@@ -2297,11 +2372,11 @@ function gmedia_module_interaction(){
|
|
2297 |
* @var $rate
|
2298 |
*/
|
2299 |
extract($_POST['rate'], EXTR_OVERWRITE);
|
2300 |
-
if(!intval($gmid) || (null === $gmDB->get_gmedia($gmid))){
|
2301 |
die('0');
|
2302 |
}
|
2303 |
$rating = $gmDB->get_metadata('gmedia', $gmid, '_rating', true);
|
2304 |
-
$rating = wp_parse_args((array)$rating, array('votes' => 0, 'value' => 0));
|
2305 |
$old_rate = 0;
|
2306 |
|
2307 |
$transient_key = 'gm_rate_day' . date('w');
|
@@ -2356,7 +2431,7 @@ function gmedia_module_load_comments(){
|
|
2356 |
|
2357 |
$data = $gmCore->_post('data', false);
|
2358 |
|
2359 |
-
$post_id = (int)$data['post_id'];
|
2360 |
if($post_id){
|
2361 |
$comments_link = apply_filters('gmedia_comments_link', add_query_arg('comments', 'show', get_permalink($post_id)), $post_id);
|
2362 |
$comments_count = wp_count_comments($post_id);
|
@@ -2376,3 +2451,23 @@ function gmedia_module_load_comments(){
|
|
2376 |
die();
|
2377 |
}
|
2378 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
function gmedia_update_data(){
|
4 |
global $gmDB, $gmCore;
|
5 |
check_ajax_referer("GmediaGallery");
|
6 |
+
if( !current_user_can('gmedia_edit_media')){
|
7 |
die('-1');
|
8 |
}
|
9 |
|
11 |
|
12 |
wp_parse_str($data, $gmedia);
|
13 |
|
14 |
+
if( !empty($gmedia['ID'])){
|
15 |
$item = $gmDB->get_gmedia($gmedia['ID']);
|
16 |
+
if((int) $item->author != get_current_user_id()){
|
17 |
+
if( !current_user_can('gmedia_edit_others_media')){
|
18 |
die('-2');
|
19 |
}
|
20 |
}
|
22 |
$gmedia['modified'] = current_time('mysql');
|
23 |
$gmedia['mime_type'] = $item->mime_type;
|
24 |
$gmedia['gmuid'] = $item->gmuid;
|
25 |
+
if( !current_user_can('gmedia_delete_others_media')){
|
26 |
$gmedia['author'] = $item->author;
|
27 |
}
|
28 |
|
29 |
$gmuid = pathinfo($item->gmuid);
|
30 |
|
31 |
$gmedia['filename'] = preg_replace('/[^a-z0-9_\.-]+/i', '_', $gmedia['filename']);
|
32 |
+
if(($gmedia['filename'] != $gmuid['filename']) && (current_user_can('gmedia_delete_others_media') || ((int) $item->author == get_current_user_id()))){
|
33 |
$fileinfo = $gmCore->fileinfo($gmedia['filename'] . '.' . $gmuid['extension']);
|
34 |
if(false !== $fileinfo){
|
35 |
if('image' == $fileinfo['dirname'] && file_is_displayable_image($fileinfo['dirpath'] . '/' . $item->gmuid)){
|
43 |
}
|
44 |
}
|
45 |
}
|
46 |
+
if( !current_user_can('gmedia_terms')){
|
47 |
unset($gmedia['terms']);
|
48 |
}
|
49 |
|
50 |
$id = $gmDB->insert_gmedia($gmedia);
|
51 |
+
if( !is_wp_error($id)){
|
52 |
// Meta Stuff
|
53 |
if(isset($gmedia['meta']) && is_array($gmedia['meta'])){
|
54 |
$meta_error = array();
|
55 |
foreach($gmedia['meta'] as $key => $value){
|
56 |
if($gmCore->is_digit($key)){
|
57 |
+
$mid = (int) $key;
|
58 |
//$value = wp_unslash( $value );
|
59 |
+
if( !($meta = $gmDB->get_metadata_by_mid('gmedia', $mid))){
|
60 |
+
$meta_error[] = array(
|
61 |
+
'error' => 'no_meta',
|
62 |
+
'message' => __('No record in DataBase.', 'grand-media'),
|
63 |
+
'meta_id' => $mid,
|
64 |
+
'meta_key' => $meta->meta_key
|
65 |
);
|
66 |
continue;
|
67 |
}
|
68 |
if('' == trim($value)){
|
69 |
+
$meta_error[] = array(
|
70 |
+
'error' => 'empty_value',
|
71 |
+
'message' => __('Please provide a custom field value.', 'grand-media'),
|
72 |
+
'meta_id' => $mid,
|
73 |
+
'meta_key' => $meta->meta_key,
|
74 |
+
'meta_value' => $meta->meta_value
|
75 |
);
|
76 |
continue;
|
77 |
}
|
78 |
|
79 |
if($meta->meta_value != $value){
|
80 |
+
if( !($u = $gmDB->update_metadata_by_mid('gmedia', $mid, $value))){
|
81 |
+
$meta_error[] = array(
|
82 |
+
'error' => 'meta_update',
|
83 |
+
'message' => __('Something goes wrong.', 'grand-media'),
|
84 |
+
'meta_id' => $mid,
|
85 |
+
'meta_key' => $meta->meta_key,
|
86 |
+
'meta_value' => $meta->meta_value
|
87 |
);
|
88 |
}
|
89 |
}
|
113 |
}
|
114 |
|
115 |
if(current_user_can('gmedia_terms')){
|
116 |
+
if( !empty($gmedia['terms']['gmedia_album'])){
|
117 |
if(isset($gmedia['gmedia_album_order'])){
|
118 |
$album = $gmDB->get_the_gmedia_terms($id, 'gmedia_album');
|
119 |
if($album){
|
120 |
$album = reset($album);
|
121 |
+
if((int) $gmedia['gmedia_album_order'] != (int) $album->gmedia_order){
|
122 |
+
$gmDB->update_term_sortorder($album->term_id, array($id => (int) $gmedia['gmedia_album_order']));
|
123 |
+
$result->gmedia_album_order = (int) $gmedia['gmedia_album_order'];
|
124 |
}
|
125 |
}
|
126 |
}
|
131 |
$result->album_status = 'none';
|
132 |
}
|
133 |
}
|
134 |
+
if( !empty($meta_error)){
|
135 |
$result->meta_error = $meta_error;
|
136 |
}
|
137 |
|
146 |
function gmedit_save(){
|
147 |
global $gmDB, $gmCore, $gmGallery;
|
148 |
check_ajax_referer('gmedia_edit', '_wpnonce_edit');
|
149 |
+
if( !current_user_can('gmedia_edit_media')){
|
150 |
die('-1');
|
151 |
}
|
152 |
|
158 |
$applyto = $gmCore->_post('applyto', 'web_thumb');
|
159 |
|
160 |
$item = $gmDB->get_gmedia($gmid);
|
161 |
+
if( !empty($item)){
|
162 |
+
if((int) $item->author != get_current_user_id()){
|
163 |
+
if( !current_user_can('gmedia_edit_others_media')){
|
164 |
die('-2');
|
165 |
}
|
166 |
}
|
179 |
|
180 |
$size = @getimagesize($fileinfo['filepath']);
|
181 |
|
182 |
+
do {
|
183 |
$extensions = array('1' => 'GIF', '2' => 'JPG', '3' => 'PNG', '6' => 'BMP');
|
184 |
if(function_exists('memory_get_usage')){
|
185 |
switch($extensions[ $size[2] ]){
|
186 |
case 'GIF':
|
187 |
$CHANNEL = 1;
|
188 |
+
break;
|
189 |
case 'JPG':
|
190 |
$CHANNEL = $size['channels'];
|
191 |
+
break;
|
192 |
case 'PNG':
|
193 |
$CHANNEL = 3;
|
194 |
+
break;
|
195 |
case 'BMP':
|
196 |
default:
|
197 |
$CHANNEL = 6;
|
198 |
+
break;
|
199 |
}
|
200 |
$MB = 1048576; // number of bytes in 1M
|
201 |
$K64 = 65536; // number of bytes in 64K
|
230 |
@copy($editfile, $fileinfo['filepath_original']);
|
231 |
}
|
232 |
}
|
233 |
+
if( !@file_put_contents($editfile, $image['data'])){
|
234 |
$fail = $fileinfo['basename'] . ": " . __('Can\'t write to file. Permission denied', 'grand-media');
|
235 |
break;
|
236 |
}
|
320 |
function gmedit_restore(){
|
321 |
global $gmCore;
|
322 |
check_ajax_referer('gmedia_edit', '_wpnonce_edit');
|
323 |
+
if( !current_user_can('gmedia_edit_media')){
|
324 |
die('-1');
|
325 |
}
|
326 |
|
344 |
$ckey = $gmCore->_post('ckey');
|
345 |
switch($modal){
|
346 |
case 'quick_gallery':
|
347 |
+
if( !current_user_can('gmedia_gallery_manage')){
|
348 |
die('-1');
|
349 |
}
|
350 |
//$ckey = "gmedia_library";
|
351 |
$modal_title = __('Quick Gallery from selected items', 'grand-media');
|
352 |
$modal_button = __('Create Quick Gallery', 'grand-media');
|
353 |
+
break;
|
354 |
case 'quick_gallery_stack':
|
355 |
+
if( !current_user_can('gmedia_gallery_manage')){
|
356 |
die('-1');
|
357 |
}
|
358 |
//$ckey = "gmedia_{$user_ID}_libstack";
|
359 |
$modal_title = __('Quick Gallery from Stack', 'grand-media');
|
360 |
$modal_button = __('Create Quick Gallery', 'grand-media');
|
361 |
+
break;
|
362 |
case 'exclude_categories':
|
363 |
case 'filter_categories':
|
364 |
$modal_title = __('Show Images from Categories', 'grand-media');
|
365 |
$modal_button = __('Show Selected', 'grand-media');
|
366 |
+
break;
|
367 |
case 'assign_category':
|
368 |
+
if( !current_user_can('gmedia_terms')){
|
369 |
die('-1');
|
370 |
}
|
371 |
$modal_title = __('Assign Category for Selected Images', 'grand-media');
|
372 |
$modal_button = __('Assign Category', 'grand-media');
|
373 |
+
break;
|
374 |
case 'unassign_category':
|
375 |
+
if( !current_user_can('gmedia_terms')){
|
376 |
die('-1');
|
377 |
}
|
378 |
$button_class = 'btn-danger';
|
379 |
$modal_title = __('Unassign Categories from Selected Items', 'grand-media');
|
380 |
$modal_button = __('Unassign Categories', 'grand-media');
|
381 |
+
break;
|
382 |
case 'exclude_albums':
|
383 |
case 'filter_albums':
|
384 |
$modal_title = __('Filter Albums', 'grand-media');
|
385 |
$modal_button = __('Show Selected', 'grand-media');
|
386 |
+
break;
|
387 |
case 'assign_album':
|
388 |
+
if( !current_user_can('gmedia_terms')){
|
389 |
die('-1');
|
390 |
}
|
391 |
$modal_title = __('Assign Album for Selected Items', 'grand-media');
|
392 |
$modal_button = __('Assign Album', 'grand-media');
|
393 |
+
break;
|
394 |
case 'exclude_tags':
|
395 |
case 'filter_tags':
|
396 |
$modal_title = __('Filter by Tags', 'grand-media');
|
397 |
$modal_button = __('Show Selected', 'grand-media');
|
398 |
+
break;
|
399 |
case 'add_tags':
|
400 |
+
if( !current_user_can('gmedia_terms')){
|
401 |
die('-1');
|
402 |
}
|
403 |
$modal_title = __('Add Tags to Selected Items', 'grand-media');
|
404 |
$modal_button = __('Add Tags', 'grand-media');
|
405 |
+
break;
|
406 |
case 'delete_tags':
|
407 |
+
if( !current_user_can('gmedia_terms')){
|
408 |
die('-1');
|
409 |
}
|
410 |
$button_class = 'btn-danger';
|
411 |
$modal_title = __('Delete Tags from Selected Items', 'grand-media');
|
412 |
$modal_button = __('Delete Tags', 'grand-media');
|
413 |
+
break;
|
414 |
case 'custom_filter':
|
415 |
$modal_title = __('Custom Filters', 'grand-media');
|
416 |
$modal_button = __('Show Selected', 'grand-media');
|
417 |
+
break;
|
418 |
case 'filter_author':
|
419 |
$modal_title = __('Filter by Author', 'grand-media');
|
420 |
if($gmCore->caps['gmedia_show_others_media']){
|
422 |
} else{
|
423 |
$modal_button = false;
|
424 |
}
|
425 |
+
break;
|
426 |
case 'select_author':
|
427 |
$modal_title = __('Select Author', 'grand-media');
|
428 |
if($gmCore->caps['gmedia_show_others_media']){
|
430 |
} else{
|
431 |
$modal_button = false;
|
432 |
}
|
433 |
+
break;
|
434 |
case 'batch_edit':
|
435 |
+
if( !current_user_can('gmedia_edit_media')){
|
436 |
die('-1');
|
437 |
}
|
438 |
$modal_title = __('Batch Edit', 'grand-media');
|
439 |
$modal_button = __('Batch Save', 'grand-media');
|
440 |
+
break;
|
441 |
default:
|
442 |
$modal_title = ' ';
|
443 |
$modal_button = false;
|
444 |
+
break;
|
445 |
}
|
446 |
|
447 |
$form_action = !empty($_SERVER['HTTP_REFERER'])? $gmCore->get_admin_url(array(), array(), $_SERVER['HTTP_REFERER']) : '';
|
456 |
switch($modal){
|
457 |
case 'quick_gallery':
|
458 |
case 'quick_gallery_stack':
|
459 |
+
if( !empty($ckey)){
|
460 |
$selected_in_library = isset($_COOKIE[ $ckey ])? str_replace('.', ',', $_COOKIE[ $ckey ]) : '';
|
461 |
}
|
462 |
if(empty($selected_in_library)){
|
479 |
$option = array();
|
480 |
$option[] = '<option ' . $selected . ' value="' . esc_attr($mfold) . '">' . $module['title'] . ' - ' . __('Default Settings') . '</option>';
|
481 |
foreach($presets as $preset){
|
482 |
+
if( !(int) $preset->global && '[' . $mfold . ']' === $preset->name){
|
483 |
continue;
|
484 |
}
|
485 |
$selected = selected($gmGallery->options['default_gmedia_module'], $preset->term_id, false);
|
486 |
$by_author = '';
|
487 |
+
if((int) $preset->global){
|
488 |
$by_author = ' [' . get_the_author_meta('display_name', $preset->global) . ']';
|
489 |
}
|
490 |
if('[' . $mfold . ']' === $preset->name){
|
510 |
if($gmCore->caps['gmedia_show_others_media']){
|
511 |
$args = array();
|
512 |
} else{
|
513 |
+
$args = array(
|
514 |
+
'global' => array(0, $user_ID),
|
515 |
+
'orderby' => 'global_desc_name'
|
516 |
);
|
517 |
}
|
518 |
$gm_terms = $gmDB->get_terms('gmedia_album', $args);
|
550 |
if($gmCore->caps['gmedia_edit_others_media']){
|
551 |
$args = array();
|
552 |
} else{
|
553 |
+
$args = array(
|
554 |
+
'global' => array(0, $user_ID),
|
555 |
+
'orderby' => 'global_desc_name'
|
556 |
);
|
557 |
}
|
558 |
$gm_terms = $gmDB->get_terms('gmedia_album', $args);
|
590 |
</label></div>
|
591 |
</div>
|
592 |
<script type="text/javascript">
|
593 |
+
jQuery(function($){
|
594 |
var albums = $('#combobox_gmedia_album');
|
595 |
var albums_data = $('option', albums);
|
596 |
//noinspection JSDuplicatedDeclaration
|
597 |
albums.selectize({
|
598 |
<?php if($gmCore->caps['gmedia_album_manage']){ ?>
|
599 |
+
create: function(input){
|
600 |
return {
|
601 |
value: input,
|
602 |
text: input
|
608 |
<?php } ?>
|
609 |
persist: false,
|
610 |
render: {
|
611 |
+
item: function(item, escape){
|
612 |
+
if(0 === (parseInt(item.value, 10) || 0)){
|
613 |
return '<div>' + escape(item.text) + '</div>';
|
614 |
}
|
615 |
+
if(item.$order){
|
616 |
var data = $(albums_data[item.$order]).data();
|
617 |
return '<div>' + escape(data.name) + ' <small>' + escape(data.meta) + '</small></div>';
|
618 |
}
|
619 |
},
|
620 |
+
option: function(item, escape){
|
621 |
+
if(0 === (parseInt(item.value) || 0)){
|
622 |
return '<div>' + escape(item.text) + '</div>';
|
623 |
}
|
624 |
+
if(item.$order){
|
625 |
var data = $(albums_data[item.$order]).data();
|
626 |
return '<div>' + escape(data.name) + ' <small>' + escape(data.meta) + '</small>' + ' <span class="badge pull-right">' + escape(data.count) + '</span></div>';
|
627 |
}
|
660 |
<input id="combobox_gmedia_category" name="cat_names" class="form-control input-sm" value="" placeholder="<?php _e('Add to Categories...', 'grand-media'); ?>"/>
|
661 |
</div>
|
662 |
<script type="text/javascript">
|
663 |
+
jQuery(function($){
|
664 |
var gm_terms = <?php echo json_encode($gm_terms); ?>;
|
665 |
//noinspection JSUnusedAssignment
|
666 |
+
var items = gm_terms.map(function(x){
|
667 |
//noinspection JSUnresolvedVariable
|
668 |
return {id: x.term_id, name: x.name, count: x.count};
|
669 |
});
|
680 |
persist: false,
|
681 |
<?php if($gmCore->caps['gmedia_category_manage']){ ?>
|
682 |
createOnBlur: true,
|
683 |
+
create: function(input){
|
684 |
return {
|
685 |
name: input
|
686 |
}
|
689 |
create: false,
|
690 |
<?php } ?>
|
691 |
render: {
|
692 |
+
item: function(item, escape){
|
693 |
return '<div>' + escape(item.name) + '</div>';
|
694 |
},
|
695 |
+
option: function(item, escape){
|
696 |
return '<div>' + escape(item.name) + ' <span class="badge">' + escape(item.count) + '</span></div>';
|
697 |
}
|
698 |
}
|
704 |
case 'unassign_category':
|
705 |
// get selected items in Gmedia Library
|
706 |
$selected_items = !empty($ckey)? array_filter(explode('.', $_COOKIE[ $ckey ]), 'is_numeric') : false;
|
707 |
+
if( !empty($selected_items)){
|
708 |
$gm_terms = $gmDB->get_gmedia_terms($selected_items, 'gmedia_category');
|
709 |
}
|
710 |
if(count($gm_terms)){
|
711 |
+
foreach($gm_terms
|
712 |
+
|
713 |
+
as $term){
|
714 |
?>
|
715 |
<div class="checkbox">
|
716 |
<label><input type="checkbox" name="category_id[]" value="<?php echo $term->term_id; ?>"> <?php echo esc_html($term->name); ?></label>
|
733 |
<div class="form-group">
|
734 |
<input id="combobox_gmedia_tag" name="tag_ids" class="form-control input-sm" value="" placeholder="<?php _e('Filter Tags...', 'grand-media'); ?>"/></div>
|
735 |
<script type="text/javascript">
|
736 |
+
jQuery(function($){
|
737 |
var gm_terms = <?php echo json_encode($gm_terms); ?>;
|
738 |
//noinspection JSUnusedAssignment
|
739 |
+
var items = gm_terms.map(function(x){
|
740 |
//noinspection JSUnresolvedVariable
|
741 |
return {id: x.term_id, name: x.name, count: x.count};
|
742 |
});
|
751 |
valueField: 'id',
|
752 |
create: false,
|
753 |
render: {
|
754 |
+
item: function(item, escape){
|
755 |
return '<div>' + escape(item.name) + '</div>';
|
756 |
},
|
757 |
+
option: function(item, escape){
|
758 |
return '<div>' + escape(item.name) + ' <span class="badge">' + escape(item.count) + '</span></div>';
|
759 |
}
|
760 |
}
|
779 |
<label><input type="checkbox" name="iptc_tags" value="1"> <?php _e('Import IPTC Keywords from selected images to Tags'); ?></label>
|
780 |
</div>
|
781 |
<script type="text/javascript">
|
782 |
+
jQuery(function($){
|
783 |
var gm_terms = <?php echo json_encode($gm_terms); ?>;
|
784 |
//noinspection JSUnusedAssignment
|
785 |
+
var items = gm_terms.map(function(x){
|
786 |
//noinspection JSUnresolvedVariable
|
787 |
return {id: x.term_id, name: x.name, count: x.count};
|
788 |
});
|
799 |
persist: false,
|
800 |
<?php if($gmCore->caps['gmedia_tag_manage']){ ?>
|
801 |
createOnBlur: true,
|
802 |
+
create: function(input){
|
803 |
return {
|
804 |
name: input
|
805 |
}
|
808 |
create: false,
|
809 |
<?php } ?>
|
810 |
render: {
|
811 |
+
item: function(item, escape){
|
812 |
return '<div>' + escape(item.name) + '</div>';
|
813 |
},
|
814 |
+
option: function(item, escape){
|
815 |
return '<div>' + escape(item.name) + ' <span class="badge">' + escape(item.count) + '</span></div>';
|
816 |
}
|
817 |
}
|
823 |
case 'delete_tags':
|
824 |
// get selected items in Gmedia Library
|
825 |
$selected_items = !empty($ckey)? array_filter(explode('.', $_COOKIE[ $ckey ]), 'is_numeric') : false;
|
826 |
+
if( !empty($selected_items)){
|
827 |
$gm_terms = $gmDB->get_gmedia_terms($selected_items, 'gmedia_tag');
|
828 |
}
|
829 |
if(count($gm_terms)){
|
830 |
+
foreach($gm_terms
|
831 |
+
|
832 |
+
as $term){
|
833 |
?>
|
834 |
<div class="checkbox">
|
835 |
<label><input type="checkbox" name="tag_id[]" value="<?php echo $term->term_id; ?>"> <?php echo esc_html($term->name); ?></label>
|
852 |
<?php
|
853 |
$user_ids = $gmCore->get_editable_user_ids();
|
854 |
if($user_ids){
|
855 |
+
if( !in_array($user_ID, $user_ids)){
|
856 |
array_push($user_ids, $user_ID);
|
857 |
}
|
858 |
+
wp_dropdown_users(array(
|
859 |
+
'show_option_all' => ' — ',
|
860 |
+
'include' => $user_ids,
|
861 |
+
'include_selected' => true,
|
862 |
+
'name' => 'author_ids',
|
863 |
+
'selected' => $user_ID,
|
864 |
+
'class' => 'form-control combobox_authors'
|
865 |
+
));
|
866 |
} else{
|
867 |
echo '<div>' . get_the_author_meta('display_name', $user_ID) . '</div>';
|
868 |
}
|
869 |
?>
|
870 |
</div>
|
871 |
+
<script type="text/javascript">
|
872 |
+
jQuery(function(){
|
873 |
+
jQuery('.combobox_authors').selectize({
|
874 |
+
create: false,
|
875 |
+
maxItems: 1,
|
876 |
+
openOnFocus: true,
|
877 |
+
hideSelected: true
|
878 |
+
});
|
879 |
+
});
|
880 |
+
</script>
|
881 |
<?php
|
882 |
} else{
|
883 |
echo '<p>' . __('You are not allowed to see others media') . '</p>';
|
957 |
</div>
|
958 |
<?php $user_ids = current_user_can('gmedia_delete_others_media')? $gmCore->get_editable_user_ids() : false;
|
959 |
if($user_ids){
|
960 |
+
if( !in_array($user_ID, $user_ids)){
|
961 |
array_push($user_ids, $user_ID);
|
962 |
}
|
963 |
?>
|
964 |
<div class="form-group">
|
965 |
<label><?php _e('Author', 'grand-media'); ?></label>
|
966 |
+
<?php wp_dropdown_users(array(
|
967 |
+
'show_option_none' => __('Skip. Do not change', 'grand-media'),
|
968 |
+
'include' => $user_ids,
|
969 |
+
'include_selected' => true,
|
970 |
+
'name' => 'batch_author',
|
971 |
+
'selected' => - 1,
|
972 |
+
'class' => 'input-sm form-control'
|
973 |
+
));
|
974 |
?>
|
975 |
</div>
|
976 |
<?php } ?>
|
977 |
<script type="text/javascript">
|
978 |
+
jQuery(function($){
|
979 |
+
$('select.batch_set').change(function(){
|
980 |
+
if('custom' == $(this).val()){
|
981 |
$(this).next().css({display: 'block'});
|
982 |
+
} else{
|
983 |
$(this).next().css({display: 'none'});
|
984 |
}
|
985 |
});
|
986 |
});
|
987 |
</script>
|
988 |
<?php
|
989 |
+
break;
|
990 |
default:
|
991 |
_e('Ops! Something wrong.', 'grand-media');
|
992 |
+
break;
|
993 |
}
|
994 |
?>
|
995 |
</div>
|
1013 |
global $gmCore, $gmDB;
|
1014 |
|
1015 |
check_ajax_referer('gmedia_terms', '_wpnonce_terms');
|
1016 |
+
if( !current_user_can('gmedia_tag_manage') && !current_user_can('gmedia_edit_others_media')){
|
1017 |
$out['error'] = $gmCore->alert('danger', __("You are not allowed to edit others media", 'grand-media'));
|
1018 |
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
|
1019 |
echo json_encode($out);
|
1025 |
$term['term_id'] = intval($gmCore->_post('tag_id', 0));
|
1026 |
if($term['name'] && !$gmCore->is_digit($term['name'])){
|
1027 |
if(($term_id = $gmDB->term_exists($term['term_id']))){
|
1028 |
+
if( !$gmDB->term_exists($term['name'], $term['taxonomy'])){
|
1029 |
$term_id = $gmDB->update_term($term['term_id'], $term);
|
1030 |
if(is_wp_error($term_id)){
|
1031 |
$out['error'] = $gmCore->alert('danger', $term_id->get_error_message());
|
1055 |
$out = array('error' => '');
|
1056 |
|
1057 |
check_ajax_referer('GmediaGallery');
|
1058 |
+
if( !current_user_can('gmedia_gallery_manage')){
|
1059 |
$out['error'] = $gmCore->alert('danger', __("You are not allowed to manage galleries", 'grand-media'));
|
1060 |
} else{
|
1061 |
$term_id = intval($gmCore->_post('preset_id', 0));
|
1062 |
$term = $gmDB->get_term($term_id);
|
1063 |
if($term && !is_wp_error($term)){
|
1064 |
+
if(($term->global != $user_ID && !gm_user_can('delete_others_media')) || ((int) $term->global === 0 && !current_user_can('manage_options'))){
|
1065 |
$out['error'] = $gmCore->alert('danger', __("You are not allowed to manage galleries", 'grand-media'));
|
1066 |
|
1067 |
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
|
1089 |
global $gmCore, $gmGallery;
|
1090 |
|
1091 |
check_ajax_referer('GmediaGallery');
|
1092 |
+
if( !current_user_can('gmedia_module_manage')){
|
1093 |
echo $gmCore->alert('danger', __('You are not allowed to install modules'));
|
1094 |
die();
|
1095 |
}
|
1104 |
|
1105 |
$mzip = str_replace("\\", "/", $mzip);
|
1106 |
$to_folder = $gmCore->upload['path'] . '/' . $gmGallery->options['folder']['module'] . '/';
|
1107 |
+
if( !wp_mkdir_p($to_folder)){
|
1108 |
echo $gmCore->alert('danger', sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?', 'grand-media'), $to_folder));
|
1109 |
die();
|
1110 |
}
|
1111 |
+
if( !is_writable($to_folder)){
|
1112 |
@chmod($to_folder, 0755);
|
1113 |
+
if( !is_writable($to_folder)){
|
1114 |
echo $gmCore->alert('danger', sprintf(__('Directory %s is not writable by the server.', 'grand-media'), $to_folder));
|
1115 |
die();
|
1116 |
}
|
1118 |
|
1119 |
global $wp_filesystem;
|
1120 |
// Is a filesystem accessor setup?
|
1121 |
+
if( !$wp_filesystem || !is_object($wp_filesystem)){
|
1122 |
require_once(ABSPATH . 'wp-admin/includes/file.php');
|
1123 |
WP_Filesystem();
|
1124 |
}
|
1125 |
+
if( !is_object($wp_filesystem)){
|
1126 |
$result = new WP_Error('fs_unavailable', __('Could not access filesystem.', 'grand-media'));
|
1127 |
} elseif($wp_filesystem->errors->get_error_code()){
|
1128 |
$result = new WP_Error('fs_error', __('Filesystem error', 'grand-media'), $wp_filesystem->errors);
|
1158 |
global $user_ID, $gmDB, $gmCore;
|
1159 |
|
1160 |
check_ajax_referer('GmediaGallery');
|
1161 |
+
if( !current_user_can('gmedia_import')){
|
1162 |
die('-1');
|
1163 |
}
|
1164 |
?>
|
1214 |
<input id="combobox_gmedia_tag" name="terms[gmedia_tag]" class="form-control input-sm" value="" placeholder="<?php _e('Add Tags...', 'grand-media'); ?>"/>
|
1215 |
</div>
|
1216 |
<script type="text/javascript">
|
1217 |
+
jQuery(function($){
|
1218 |
//noinspection JSDuplicatedDeclaration
|
1219 |
$('#combobox_gmedia_album').selectize({
|
1220 |
<?php if($gmCore->caps['gmedia_album_manage']){ ?>
|
1228 |
|
1229 |
var gm_cat_terms = <?php echo json_encode($gm_cat_terms); ?>;
|
1230 |
//noinspection JSUnusedAssignment
|
1231 |
+
var cat_items = gm_cat_terms.map(function(x){
|
1232 |
return {item: x};
|
1233 |
});
|
1234 |
//noinspection JSDuplicatedDeclaration
|
1235 |
$('#combobox_gmedia_category').selectize({
|
1236 |
<?php if($gmCore->caps['gmedia_category_manage']){ ?>
|
1237 |
+
create: function(input){
|
1238 |
return {
|
1239 |
item: input
|
1240 |
}
|
1256 |
|
1257 |
var gm_tag_terms = <?php echo json_encode($gm_tag_terms); ?>;
|
1258 |
//noinspection JSUnusedAssignment
|
1259 |
+
var tag_items = gm_tag_terms.map(function(x){
|
1260 |
return {item: x};
|
1261 |
});
|
1262 |
//noinspection JSDuplicatedDeclaration
|
1263 |
$('#combobox_gmedia_tag').selectize({
|
1264 |
<?php if($gmCore->caps['gmedia_tag_manage']){ ?>
|
1265 |
+
create: function(input){
|
1266 |
return {
|
1267 |
item: input
|
1268 |
}
|
1291 |
<div class="help-block"><?php _e('Note: duplicates will be skipped in any way (checked by file hash)') ?></div>
|
1292 |
</div>
|
1293 |
<script type="text/javascript">
|
1294 |
+
jQuery(function($){
|
1295 |
+
$('#import-done').one('click', function(){
|
1296 |
$('#import_form').submit();
|
1297 |
$(this).text($(this).data('loading-text')).prop('disabled', true);
|
1298 |
$('#import_window').show();
|
1299 |
+
$(this).one('click', function(){
|
1300 |
$('#importModal').modal('hide');
|
1301 |
});
|
1302 |
});
|
1328 |
check_ajax_referer("GmediaGallery");
|
1329 |
|
1330 |
// check for correct capability
|
1331 |
+
if( !current_user_can('gmedia_library')){
|
1332 |
die('-1');
|
1333 |
}
|
1334 |
|
1335 |
$post_tags = array_filter(array_map('trim', explode(',', stripslashes(urldecode($gmCore->_get('tags', ''))))));
|
1336 |
+
$paged = (int) $gmCore->_get('paged', 1);
|
1337 |
$per_page = 20;
|
1338 |
$s = trim(stripslashes(urldecode($gmCore->_get('search'))));
|
1339 |
if($s && strlen($s) > 2){
|
1343 |
}
|
1344 |
|
1345 |
$gmediaLib = array();
|
1346 |
+
$relative = (int) $gmCore->_get('rel', 1);
|
1347 |
$continue = true;
|
1348 |
$content = '';
|
1349 |
|
1350 |
if($relative == 1){
|
1351 |
+
$arg = array(
|
1352 |
+
'mime_type' => 'image/*',
|
1353 |
+
'orderby' => 'ID',
|
1354 |
+
'order' => 'DESC',
|
1355 |
+
'per_page' => $per_page,
|
1356 |
+
'page' => $paged,
|
1357 |
+
's' => $s,
|
1358 |
+
'tag_name__in' => $post_tags,
|
1359 |
+
'null_tags' => true
|
1360 |
);
|
1361 |
$gmediaLib = $gmDB->get_gmedias($arg);
|
1362 |
}
|
1366 |
if($relative == 1){
|
1367 |
$relative = 0;
|
1368 |
$paged = 1;
|
1369 |
+
$content .= '<li class="emptydb">' . __('No items related by tags.', 'grand-media') . '</li>' . "\n";
|
1370 |
}
|
1371 |
|
1372 |
+
$tag__not_in = "'" . implode("','", array_map('esc_sql', array_unique((array) $post_tags))) . "'";
|
1373 |
$tag__not_in = $wpdb->get_col("
|
1374 |
SELECT term_id
|
1375 |
FROM {$wpdb->prefix}gmedia_term
|
1377 |
AND name IN ({$tag__not_in})
|
1378 |
");
|
1379 |
|
1380 |
+
$arg = array(
|
1381 |
+
'mime_type' => 'image/*',
|
1382 |
+
'orderby' => 'ID',
|
1383 |
+
'order' => 'DESC',
|
1384 |
+
'per_page' => $per_page,
|
1385 |
+
'page' => $paged,
|
1386 |
+
'tag__not_in' => $tag__not_in
|
1387 |
);
|
1388 |
$gmediaLib = $gmDB->get_gmedias($arg);
|
1389 |
}
|
1422 |
* @return string folder content
|
1423 |
*/
|
1424 |
function gmedia_ftp_browser(){
|
1425 |
+
if( !current_user_can('gmedia_import')){
|
1426 |
die('No access');
|
1427 |
}
|
1428 |
|
1440 |
|
1441 |
// The 2 counts for . and ..
|
1442 |
if(count($files) > 2){
|
1443 |
+
echo "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
|
1444 |
// return only directories
|
1445 |
foreach($files as $file){
|
1446 |
if(in_array($file, array('wp-admin', 'wp-includes', 'plugins', 'themes', 'thumb', 'thumbs'))){
|
1451 |
echo "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . esc_attr($dir . $file) . "/\">" . esc_html($file) . "</a></li>";
|
1452 |
}
|
1453 |
}
|
1454 |
+
// All files
|
1455 |
+
foreach($files as $file){
|
1456 |
+
if(file_exists($root . $dir . $file) && $file != '.' && $file != '..' && !is_dir($root . $dir . $file)){
|
1457 |
+
$ext = preg_replace('/^.*\./', '', $file);
|
1458 |
+
if($file === '.' . $ext){
|
1459 |
+
continue;
|
1460 |
+
}
|
1461 |
+
echo "<li class=\"file ext_$ext\"><a href=\"#\" rel=\"" . esc_attr($dir) . "\">" . esc_html($file) . "</a></li>";
|
1462 |
+
}
|
1463 |
+
}
|
1464 |
echo "</ul>";
|
1465 |
}
|
1466 |
}
|
1474 |
|
1475 |
$post_ID = intval($gmCore->_post('post_id', 0));
|
1476 |
|
1477 |
+
if( !$post_ID || !current_user_can('edit_post', $post_ID)){
|
1478 |
die('-1');
|
1479 |
}
|
1480 |
|
1496 |
$image = $gmDB->get_gmedia($img_id);
|
1497 |
if($image){
|
1498 |
|
1499 |
+
$args = array(
|
1500 |
+
'post_type' => 'attachment',
|
1501 |
+
'meta_key' => '_gmedia_image_id',
|
1502 |
+
'meta_compare' => '==',
|
1503 |
+
'meta_value' => $img_id
|
1504 |
);
|
1505 |
$posts = get_posts($args);
|
1506 |
$attachment_id = null;
|
1526 |
$title = sanitize_title($image->title);
|
1527 |
$caption = $gmCore->sanitize($image->description);
|
1528 |
|
1529 |
+
$attachment = array(
|
1530 |
+
'post_title' => $title,
|
1531 |
+
'post_content' => $caption,
|
1532 |
+
'post_status' => 'attachment',
|
1533 |
+
'post_parent' => 0,
|
1534 |
+
'post_mime_type' => $image->mime_type,
|
1535 |
+
'guid' => $url
|
1536 |
);
|
1537 |
|
1538 |
//require for wp_generate_attachment_metadata which generates image related meta-data also creates thumbs
|
1570 |
|
1571 |
// if nonce is not correct it returns -1
|
1572 |
check_ajax_referer('gmedia_upload', '_wpnonce_upload');
|
1573 |
+
if( !current_user_can('gmedia_upload')){
|
1574 |
wp_die(__('You do not have permission to upload files in Gmedia Library.'));
|
1575 |
}
|
1576 |
|
1583 |
$filename = $gmCore->_req('name');
|
1584 |
|
1585 |
// Get parameters
|
1586 |
+
if( !$filename){
|
1587 |
$return = json_encode(array("error" => array("code" => 100, "message" => __("No file name.", 'grand-media'))));
|
1588 |
die($return);
|
1589 |
}
|
1642 |
nocache_headers();
|
1643 |
|
1644 |
check_admin_referer('gmedia_import', '_wpnonce_import');
|
1645 |
+
if( !current_user_can('gmedia_import')){
|
1646 |
wp_die(__('You do not have permission to upload files.'));
|
1647 |
}
|
1648 |
|
1664 |
?>
|
1665 |
<html>
|
1666 |
<style type="text/css">
|
1667 |
+
* { margin: 0; padding: 0; }
|
1668 |
+
pre { display: block; }
|
1669 |
+
p { padding: 10px 0; font-size: 14px; }
|
1670 |
+
.ok { color: darkgreen; }
|
1671 |
+
.ko { color: darkred; }
|
1672 |
</style>
|
1673 |
<body>
|
1674 |
<?php
|
1679 |
|
1680 |
if($path){
|
1681 |
$path = trim(urldecode($path), '/');
|
1682 |
+
if( !empty($path)){
|
1683 |
$fullpath = ABSPATH . trailingslashit($path);
|
1684 |
$files = glob($fullpath . '?*.?*', GLOB_NOSORT);
|
1685 |
+
if( !empty($files)){
|
1686 |
$allowed_ext = get_allowed_mime_types();
|
1687 |
$allowed_ext = array_keys($allowed_ext);
|
1688 |
$allowed_ext = implode('|', $allowed_ext);
|
1694 |
$gmuid = basename($filepath);
|
1695 |
if(in_array($gmuid, $gmedias)){
|
1696 |
$fileinfo = $gmCore->fileinfo($gmuid, false);
|
1697 |
+
if( !(('image' == $fileinfo['dirname']) && !is_file($fileinfo['filepath']))){
|
1698 |
unset($files[ $i ]);
|
1699 |
}
|
1700 |
}
|
1707 |
}
|
1708 |
foreach($files as $i => $filepath){
|
1709 |
$ext = pathinfo($filepath, PATHINFO_EXTENSION);
|
1710 |
+
if( !in_array(strtolower($ext), $allowed_ext)){
|
1711 |
unset($files[ $i ]);
|
1712 |
}
|
1713 |
}
|
1724 |
echo '<h4 style="margin: 0 0 10px">' . __('Import from Flagallery plugin') . ":</h4>" . PHP_EOL;
|
1725 |
|
1726 |
$gallery = $gmCore->_post('gallery');
|
1727 |
+
if( !empty($gallery)){
|
1728 |
+
$album = ( !isset($terms['gmedia_album']) || empty($terms['gmedia_album']))? false : true;
|
1729 |
foreach($gallery as $gid){
|
1730 |
$flag_gallery = $wpdb->get_row($wpdb->prepare("SELECT gid, path, title, galdesc FROM {$wpdb->prefix}flag_gallery WHERE gid = %d", $gid), ARRAY_A);
|
1731 |
if(empty($flag_gallery)){
|
1732 |
continue;
|
1733 |
}
|
1734 |
|
1735 |
+
if( !$album){
|
1736 |
$terms['gmedia_album'] = $flag_gallery['title'];
|
1737 |
if($gmCore->is_digit($terms['gmedia_album'])){
|
1738 |
$terms['gmedia_album'] = 'a' . $terms['gmedia_album'];
|
1739 |
}
|
1740 |
+
if( !$gmDB->term_exists($terms['gmedia_album'], 'gmedia_album')){
|
1741 |
$term_id = $gmDB->insert_term($terms['gmedia_album'], 'gmedia_album', array('description' => htmlspecialchars_decode(stripslashes($flag_gallery['galdesc']))));
|
1742 |
}
|
1743 |
}
|
1764 |
echo '<h4 style="margin: 0 0 10px">' . __('Import from NextGen plugin') . ":</h4>" . PHP_EOL;
|
1765 |
|
1766 |
$gallery = $gmCore->_post('gallery');
|
1767 |
+
if( !empty($gallery)){
|
1768 |
+
$album = ( !isset($terms['gmedia_album']) || empty($terms['gmedia_album']))? false : true;
|
1769 |
foreach($gallery as $gid){
|
1770 |
$ngg_gallery = $wpdb->get_row($wpdb->prepare("SELECT gid, path, title, galdesc FROM {$wpdb->prefix}ngg_gallery WHERE gid = %d", $gid), ARRAY_A);
|
1771 |
if(empty($ngg_gallery)){
|
1772 |
continue;
|
1773 |
}
|
1774 |
|
1775 |
+
if( !$album){
|
1776 |
$terms['gmedia_album'] = $ngg_gallery['title'];
|
1777 |
if($gmCore->is_digit($terms['gmedia_album'])){
|
1778 |
$terms['gmedia_album'] = 'a' . $ngg_gallery['title'];
|
1779 |
}
|
1780 |
+
if( !$gmDB->term_exists($terms['gmedia_album'], 'gmedia_album')){
|
1781 |
$term_id = $gmDB->insert_term($terms['gmedia_album'], 'gmedia_album', array('description' => htmlspecialchars_decode(stripslashes($ngg_gallery['galdesc']))));
|
1782 |
}
|
1783 |
}
|
1804 |
|
1805 |
$wpMediaLib = $gmDB->get_wp_media_lib(array('filter' => 'selected', 'selected' => $gmCore->_post('selected')));
|
1806 |
|
1807 |
+
if( !empty($wpMediaLib)){
|
1808 |
|
1809 |
$wp_media = array();
|
1810 |
foreach($wpMediaLib as $item){
|
1811 |
+
$wp_media[] = array(
|
1812 |
+
'file' => get_attached_file($item->ID),
|
1813 |
+
'title' => $item->post_title,
|
1814 |
+
'description' => $item->post_content
|
1815 |
);
|
1816 |
}
|
1817 |
$exists = $gmCore->_post('skip_exists', 0);
|
1837 |
|
1838 |
// if nonce is not correct it returns -1
|
1839 |
check_ajax_referer('GmediaService');
|
1840 |
+
if( !current_user_can('manage_options')){
|
1841 |
die('-1');
|
1842 |
}
|
1843 |
|
1844 |
$service = $gmCore->_post('service');
|
1845 |
+
if( !$service){
|
1846 |
die('0');
|
1847 |
}
|
1848 |
+
$options = $gmGallery->options;
|
1849 |
+
|
1850 |
+
if('skip' === $service){
|
1851 |
+
$options['gmedia_service'] = $service;
|
1852 |
+
if((int)$options['mobile_app']){
|
1853 |
+
$options['mobile_app'] = 0;
|
1854 |
+
$service = 'app_deactivate';
|
1855 |
+
} else{
|
1856 |
+
$gmGallery->options = $options;
|
1857 |
+
update_option('gmediaOptions', $options);
|
1858 |
+
wp_send_json_success();
|
1859 |
+
}
|
1860 |
+
} elseif('allow' === $service){
|
1861 |
+
$options['gmedia_service'] = $service;
|
1862 |
+
$service = 'app_activate';
|
1863 |
+
}
|
1864 |
|
|
|
|
|
|
|
|
|
1865 |
if($options != $gmGallery->options){
|
1866 |
$gmGallery->options = $options;
|
1867 |
update_option('gmediaOptions', $options);
|
1884 |
$sharelink = $gmCore->_post('sharelink', '');
|
1885 |
$email = $gmCore->_post('email', '');
|
1886 |
$sharemessage = $gmCore->_post('message', '');
|
1887 |
+
if( !filter_var($email, FILTER_VALIDATE_EMAIL)){
|
1888 |
echo $gmCore->alert('danger', __('Invalid email', 'grand-media') . ': ' . esc_html($email));
|
1889 |
die();
|
1890 |
}
|
1951 |
|
1952 |
$meta_type = 'gmedia';
|
1953 |
|
1954 |
+
$pid = (int) $_POST['ID'];
|
1955 |
$post = $gmDB->get_gmedia($pid);
|
1956 |
|
1957 |
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
|
1958 |
|
1959 |
+
if( !current_user_can('gmedia_edit_media') || ($user_ID != $post->author && !current_user_can('gmedia_edit_others_media'))){
|
1960 |
echo json_encode(array('error' => array('code' => 100, 'message' => __('You are not allowed to edit others media', 'grand-media')), 'id' => $pid));
|
1961 |
die();
|
1962 |
}
|
1965 |
die();
|
1966 |
}
|
1967 |
|
1968 |
+
if( !$mid = $gmCore->add_meta($pid, $meta_type)){
|
1969 |
echo json_encode(array('error' => array('code' => 102, 'message' => __('Please provide a custom field value', 'grand-media')), 'id' => $pid));
|
1970 |
die();
|
1971 |
}
|
1972 |
|
1973 |
$column = sanitize_key($meta_type . '_id');
|
1974 |
$meta = $gmDB->get_metadata_by_mid($meta_type, $mid);
|
1975 |
+
$pid = (int) $meta->{$column};
|
1976 |
$meta = get_object_vars($meta);
|
1977 |
+
$result = array(
|
1978 |
+
'success' => array(
|
1979 |
+
'meta_id' => $mid,
|
1980 |
+
'data' => $gmCore->_list_meta_item($meta, $meta_type)
|
1981 |
+
),
|
1982 |
+
'id' => $pid
|
1983 |
);
|
1984 |
|
1985 |
+
if( !empty($_POST['metakeyinput'])){
|
1986 |
$result['newmeta_form'] = $gmCore->meta_form($meta_type);
|
1987 |
}
|
1988 |
|
1998 |
|
1999 |
$meta_type = 'gmedia';
|
2000 |
|
2001 |
+
$pid = (int) $_POST['ID'];
|
2002 |
$post = $gmDB->get_gmedia($pid);
|
2003 |
|
2004 |
+
if( !current_user_can('gmedia_edit_media') || ($user_ID != $post->author && !current_user_can('gmedia_edit_others_media'))){
|
2005 |
echo json_encode(array('error' => array('code' => 100, 'message' => __('You are not allowed to edit others media', 'grand-media')), 'id' => $pid));
|
2006 |
die();
|
2007 |
}
|
2012 |
$column = sanitize_key($meta_type . '_id');
|
2013 |
if(isset($deletemeta) && is_array($deletemeta)){
|
2014 |
foreach($deletemeta as $key => $value){
|
2015 |
+
if( !$meta = $gmDB->get_metadata_by_mid($meta_type, $key)){
|
2016 |
continue;
|
2017 |
}
|
2018 |
if($meta->{$column} != $pid){
|
2040 |
|
2041 |
$meta_type = 'gmedia_term';
|
2042 |
|
2043 |
+
$pid = (int) $_POST['ID'];
|
2044 |
$post = $gmDB->get_term($pid);
|
2045 |
|
2046 |
$taxonomy = $post->taxonomy;
|
2047 |
|
2048 |
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
|
2049 |
|
2050 |
+
if( !current_user_can($taxonomy . '_manage') || ($user_ID != $post->global && !current_user_can('gmedia_edit_others_media'))){
|
2051 |
echo json_encode(array('error' => array('code' => 100, 'message' => __('You are not allowed to edit others media', 'grand-media')), 'id' => $pid));
|
2052 |
die();
|
2053 |
}
|
2056 |
die();
|
2057 |
}
|
2058 |
|
2059 |
+
if( !$mid = $gmCore->add_meta($pid, $meta_type)){
|
2060 |
echo json_encode(array('error' => array('code' => 102, 'message' => __('Please provide a custom field value', 'grand-media')), 'id' => $pid));
|
2061 |
die();
|
2062 |
}
|
2063 |
|
2064 |
$column = sanitize_key($meta_type . '_id');
|
2065 |
$meta = $gmDB->get_metadata_by_mid($meta_type, $mid);
|
2066 |
+
$pid = (int) $meta->{$column};
|
2067 |
$meta = get_object_vars($meta);
|
2068 |
+
$result = array(
|
2069 |
+
'success' => array(
|
2070 |
+
'meta_id' => $mid,
|
2071 |
+
'data' => $gmCore->_list_meta_item($meta, $meta_type)
|
2072 |
+
),
|
2073 |
+
'id' => $pid
|
2074 |
);
|
2075 |
|
2076 |
+
if( !empty($_POST['metakeyinput'])){
|
2077 |
$result['newmeta_form'] = $gmCore->meta_form($meta_type);
|
2078 |
}
|
2079 |
|
2089 |
|
2090 |
$meta_type = 'gmedia_term';
|
2091 |
|
2092 |
+
$pid = (int) $_POST['ID'];
|
2093 |
$post = $gmDB->get_term($pid);
|
2094 |
|
2095 |
$taxonomy = $post->taxonomy;
|
2096 |
|
2097 |
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
|
2098 |
|
2099 |
+
if( !current_user_can($taxonomy . '_manage') || ($user_ID != $post->global && !current_user_can('gmedia_edit_others_media'))){
|
2100 |
echo json_encode(array('error' => array('code' => 100, 'message' => __('You are not allowed to edit others media', 'grand-media')), 'id' => $pid));
|
2101 |
die();
|
2102 |
}
|
2107 |
$column = sanitize_key($meta_type . '_id');
|
2108 |
if(isset($deletemeta) && is_array($deletemeta)){
|
2109 |
foreach($deletemeta as $key => $value){
|
2110 |
+
if( !$meta = $gmDB->get_metadata_by_mid($meta_type, $key)){
|
2111 |
continue;
|
2112 |
}
|
2113 |
if($meta->{$column} != $pid){
|
2133 |
check_ajax_referer('gmedia_terms', '_wpnonce_terms');
|
2134 |
|
2135 |
$term_id = $gmCore->_post('term_id');
|
2136 |
+
$idx0 = (int) $gmCore->_post('idx0');
|
2137 |
$ids = $gmCore->_post('ids');
|
2138 |
|
2139 |
+
if( !$idx0 || !is_array($ids)){
|
2140 |
die();
|
2141 |
}
|
2142 |
|
2143 |
+
if( !current_user_can('gmedia_album_manage')){
|
2144 |
wp_send_json(array('error' => array('code' => 100, 'message' => __('You are not allowed to manage this taxonomy', 'grand-media')), 'id' => $term_id));
|
2145 |
}
|
2146 |
|
2147 |
+
if( !$term_id || !($term_id = $gmDB->term_exists($term_id))){
|
2148 |
wp_send_json(array('error' => array('code' => 101, 'message' => __('A term with the id provided does not exists', 'grand-media')), 'id' => $term_id));
|
2149 |
}
|
2150 |
$term = $gmDB->get_term($term_id);
|
2151 |
+
if(((int) $term->global != (int) $user_ID) && !current_user_can('gmedia_edit_others_media')){
|
2152 |
wp_send_json(array('error' => array('code' => 102, 'message' => __('You are not allowed to edit others media', 'grand-media')), 'id' => $term_id));
|
2153 |
}
|
2154 |
|
2185 |
}
|
2186 |
$result['timeout'] = $timeout;
|
2187 |
|
2188 |
+
if( !empty($info)){
|
2189 |
$result['content'] = '<div>' . implode("</div>\n<div>", $info) . '</div>';
|
2190 |
} elseif($db_version == GMEDIA_DBVERSION){
|
2191 |
$result['status'] = 'done';
|
2214 |
)
|
2215 |
LIMIT 20";
|
2216 |
$unhashed = $wpdb->get_results($sql);
|
2217 |
+
if( !$unhashed){
|
2218 |
$ajax_operations = get_option('gmedia_ajax_long_operations', array());
|
2219 |
unset($ajax_operations['gmedia_hash_files']);
|
2220 |
if(empty($ajax_operations)){
|
2251 |
|
2252 |
$gmid = 0;
|
2253 |
$ajax_operations = get_option('gmedia_ajax_long_operations', array());
|
2254 |
+
if( !empty($ajax_operations['gmedia_recreate_images'])){
|
2255 |
$all_count = count($ajax_operations['gmedia_recreate_images']);
|
2256 |
$recreate_ids = array_filter($ajax_operations['gmedia_recreate_images']);
|
2257 |
$do_count = count($recreate_ids);
|
2258 |
|
2259 |
+
if( !empty($recreate_ids)){
|
2260 |
$gmid = reset($recreate_ids);
|
2261 |
$gmCore->recreate_images_from_original($gmid);
|
2262 |
|
2280 |
wp_send_json_success(array('progress' => '100%', 'info' => __('Done:', 'grand-media'), 'done' => true, 'id' => $gmid));
|
2281 |
}
|
2282 |
|
2283 |
+
add_action('wp_ajax_gmedia_feedback', 'gmedia_feedback');
|
2284 |
+
function gmedia_feedback(){
|
2285 |
+
global $gmCore;
|
2286 |
+
|
2287 |
+
check_ajax_referer('gmedia_feedback', '_wpnonce_gmedia_feedback');
|
2288 |
+
|
2289 |
+
$data = $gmCore->_post('data');
|
2290 |
+
|
2291 |
+
if(!empty($data)){
|
2292 |
+
$current_user = wp_get_current_user();
|
2293 |
+
$title = "Deactivate Reason: " . urldecode($data['reason']);
|
2294 |
+
$content = 'Website: ' . home_url() . "\r\n\r\n";
|
2295 |
+
foreach($data as $key=>$val){
|
2296 |
+
$content .= ucwords(str_replace('_', ' ', $key)) . ': ' . urldecode($val) . "\r\n\r\n";
|
2297 |
+
}
|
2298 |
+
$headers = array(
|
2299 |
+
"From: Gmedia Feedback <feedback@gmedia.gallery>",
|
2300 |
+
"Reply-To: {$current_user->display_name} <{$current_user->user_email}>"
|
2301 |
+
);
|
2302 |
+
wp_mail('codeasily@gmail.com', $title, $content, $headers);
|
2303 |
+
}
|
2304 |
+
|
2305 |
+
wp_send_json_success();
|
2306 |
+
}
|
2307 |
+
|
2308 |
add_action('wp_ajax_gmedia_save_waveform', 'gmedia_save_waveform');
|
2309 |
add_action('wp_ajax_nopriv_gmedia_save_waveform', 'gmedia_save_waveform');
|
2310 |
function gmedia_save_waveform(){
|
2372 |
* @var $rate
|
2373 |
*/
|
2374 |
extract($_POST['rate'], EXTR_OVERWRITE);
|
2375 |
+
if( !intval($gmid) || (null === $gmDB->get_gmedia($gmid))){
|
2376 |
die('0');
|
2377 |
}
|
2378 |
$rating = $gmDB->get_metadata('gmedia', $gmid, '_rating', true);
|
2379 |
+
$rating = wp_parse_args((array) $rating, array('votes' => 0, 'value' => 0));
|
2380 |
$old_rate = 0;
|
2381 |
|
2382 |
$transient_key = 'gm_rate_day' . date('w');
|
2431 |
|
2432 |
$data = $gmCore->_post('data', false);
|
2433 |
|
2434 |
+
$post_id = (int) $data['post_id'];
|
2435 |
if($post_id){
|
2436 |
$comments_link = apply_filters('gmedia_comments_link', add_query_arg('comments', 'show', get_permalink($post_id)), $post_id);
|
2437 |
$comments_count = wp_count_comments($post_id);
|
2451 |
die();
|
2452 |
}
|
2453 |
|
2454 |
+
add_action('wp_ajax_gmedia_get_data', 'gmedia_get_data');
|
2455 |
+
function gmedia_get_data(){
|
2456 |
+
global $gmDB, $gmProcessor;
|
2457 |
+
|
2458 |
+
/** @var $gmProcessorLibrary */
|
2459 |
+
include_once(GMEDIA_ABSPATH . 'admin/processor/class.processor.library.php');
|
2460 |
+
|
2461 |
+
$gmProcessorLibrary->user_options = $gmProcessor::user_options();
|
2462 |
+
$query_args = $gmProcessorLibrary->query_args();
|
2463 |
+
$gmedia_query = $gmDB->get_gmedias($query_args);
|
2464 |
+
foreach($gmedia_query as &$item) {
|
2465 |
+
gmedia_item_more_data( $item );
|
2466 |
+
}
|
2467 |
+
|
2468 |
+
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
|
2469 |
+
echo json_encode($gmedia_query);
|
2470 |
+
|
2471 |
+
die();
|
2472 |
+
}
|
2473 |
+
|
admin/app.php
CHANGED
@@ -4,7 +4,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])){
|
|
4 |
}
|
5 |
|
6 |
/**
|
7 |
-
*
|
8 |
* @return mixed content
|
9 |
*/
|
10 |
function gmediaApp(){
|
@@ -13,56 +13,80 @@ function gmediaApp(){
|
|
13 |
if(false !== ($force_app_status = $gmCore->_get('force_app_status'))){
|
14 |
$gm_options = get_option('gmediaOptions');
|
15 |
$gm_options['mobile_app'] = (int)$force_app_status;
|
|
|
|
|
|
|
|
|
|
|
16 |
update_option('gmediaOptions', $gm_options);
|
17 |
}
|
18 |
-
$alert = '';
|
19 |
-
$btn_state = '';
|
20 |
-
if('127.0.0.1' == $_SERVER['SERVER_ADDR']){
|
21 |
-
$alert = $gmCore->alert('danger', __('Your server is not accessable by iOS application', 'grand-media'));
|
22 |
-
$btn_state = ' disabled';
|
23 |
-
}
|
24 |
|
25 |
-
$
|
26 |
-
|
27 |
-
$
|
28 |
-
$site_ID = $gmGallery->options['site_ID'];
|
29 |
$mobile_app = (int)$gmGallery->options['mobile_app'];
|
30 |
|
|
|
|
|
31 |
?>
|
32 |
-
<
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
<div class="panel-body" id="gm_application_data">
|
48 |
<?php if(current_user_can('manage_options')){ ?>
|
49 |
<div class="container-fluid">
|
50 |
<div class="row">
|
51 |
<div class="col-xs-6">
|
52 |
-
<?php /* ?>
|
53 |
-
<div class="gm_service_actions">
|
54 |
-
<p><button type="button" data-action="app_activate" class="btn btn-primary"><?php _e('Activate GmediaService', 'grand-media'); ?></button>
|
55 |
-
<button type="button" data-action="app_deactivate" class="btn btn-primary"><?php _e('Deactivate GmediaService', 'grand-media'); ?></button></p>
|
56 |
-
|
57 |
-
<p><button type="button" data-action="app_updateinfo" class="btn btn-primary"><?php _e('Update GmediaService', 'grand-media'); ?></button>
|
58 |
-
<button type="button" data-action="app_updatecron" class="btn btn-primary"><?php _e('Cron Job GmediaService', 'grand-media'); ?></button></p>
|
59 |
-
|
60 |
-
<p><button type="button" data-action="app_deactivateplugin" class="btn btn-primary"><?php _e('Deactivate Plugin GmediaService', 'grand-media'); ?></button>
|
61 |
-
<button type="button" data-action="app_uninstallplugin" class="btn btn-primary"><?php _e('Uninstall Plugin GmediaService', 'grand-media'); ?></button></p>
|
62 |
-
</div>
|
63 |
-
<?php */ ?>
|
64 |
<!--<p><?php echo 'Server address: ' . $_SERVER['SERVER_ADDR'];
|
65 |
echo '<br>Remote address: ' . $_SERVER['REMOTE_ADDR'];
|
|
|
66 |
?></p>-->
|
67 |
<div class="gmapp-description">
|
68 |
<div style="text-align:center; margin-bottom:30px;">
|
@@ -104,21 +128,20 @@ function gmediaApp(){
|
|
104 |
<p><?php _e('Below you can see information about your website that will be used by GmediaService and iOS application, so you\'ll be able to manage your Gmedia Library with your smartphone and other people can find and view your public collections.', 'grand-media'); ?></p>
|
105 |
<div class="form-group">
|
106 |
<label><?php _e('Email', 'grand-media') ?>:</label>
|
107 |
-
<input type="text" name="site_email" class="form-control input-sm" value="<?php esc_attr_e(
|
108 |
</div>
|
109 |
<div class="form-group">
|
110 |
<label><?php _e('Site URL', 'grand-media') ?>:</label>
|
111 |
-
<input type="text"
|
112 |
</div>
|
113 |
<div class="form-group">
|
114 |
<label><?php _e('Site Title', 'grand-media') ?>:</label>
|
115 |
-
<input type="text" name="site_title" class="form-control input-sm" value="<?php esc_attr_e(
|
116 |
</div>
|
117 |
<div class="form-group">
|
118 |
<label><?php _e('Site Description', 'grand-media') ?>:</label>
|
119 |
-
<textarea rows="2" cols="10" name="site_description" class="form-control input-sm"
|
120 |
</div>
|
121 |
-
<p><?php _e('Also the list of your Gmedia Tags will be shared with GmediaService.') ?></p>
|
122 |
</div>
|
123 |
|
124 |
<div class="gmapp-description">
|
@@ -149,48 +172,8 @@ function gmediaApp(){
|
|
149 |
</div>
|
150 |
</div>
|
151 |
</div>
|
152 |
-
<script type="text/javascript">
|
153 |
-
jQuery(function($) {
|
154 |
-
|
155 |
-
function gmedia_application(service) {
|
156 |
-
var post_data = {
|
157 |
-
action: 'gmedia_application',
|
158 |
-
service: service,
|
159 |
-
data: $('#gm_application_data :input').serialize(),
|
160 |
-
_wpnonce: $('#_wpnonce').val()
|
161 |
-
};
|
162 |
-
$.post(ajaxurl, post_data, function(data, textStatus, jqXHR) {
|
163 |
-
console.log(data);
|
164 |
-
if(data.error) {
|
165 |
-
$('#gmedia-msg-panel').append(data.error);
|
166 |
-
} else if(data.message) {
|
167 |
-
$('#gmedia-msg-panel').append(data.message);
|
168 |
-
}
|
169 |
-
//noinspection JSUnresolvedVariable
|
170 |
-
if(parseInt(data.mobile_app)) {
|
171 |
-
$('.gm_service_actions > .btn-group').removeClass('hidden');
|
172 |
-
$('.gmapp_activate').addClass('hidden');
|
173 |
-
} else {
|
174 |
-
$('.gm_service_actions > .btn-group').addClass('hidden');
|
175 |
-
$('.gmapp_activate').removeClass('hidden');
|
176 |
-
}
|
177 |
-
});
|
178 |
-
}
|
179 |
-
|
180 |
-
<?php if($mobile_app){ ?>
|
181 |
-
gmedia_application('app_checkstatus');
|
182 |
-
<?php } ?>
|
183 |
-
|
184 |
-
$('.gm_service_actions button').on('click', function() {
|
185 |
-
var service = $(this).attr('data-action');
|
186 |
-
gmedia_application(service);
|
187 |
-
});
|
188 |
-
|
189 |
-
});
|
190 |
-
|
191 |
-
</script>
|
192 |
<?php } ?>
|
193 |
</div>
|
194 |
-
</
|
195 |
<?php
|
196 |
}
|
4 |
}
|
5 |
|
6 |
/**
|
7 |
+
* gmediaApp()
|
8 |
* @return mixed content
|
9 |
*/
|
10 |
function gmediaApp(){
|
13 |
if(false !== ($force_app_status = $gmCore->_get('force_app_status'))){
|
14 |
$gm_options = get_option('gmediaOptions');
|
15 |
$gm_options['mobile_app'] = (int)$force_app_status;
|
16 |
+
$gmGallery->options['mobile_app'] = $gm_options['mobile_app'];
|
17 |
+
if(!$gm_options['site_ID']){
|
18 |
+
$gm_options['site_ID'] = (int)$gmCore->_get('force_site_id');
|
19 |
+
$gmGallery->options['site_ID'] = $gm_options['site_ID'];
|
20 |
+
}
|
21 |
update_option('gmediaOptions', $gm_options);
|
22 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
+
$alert = $gmCore->alert('danger', __('Your server is not accessable by iOS application', 'grand-media'));
|
25 |
+
|
26 |
+
$site_ID = (int)$gmGallery->options['site_ID'];
|
|
|
27 |
$mobile_app = (int)$gmGallery->options['mobile_app'];
|
28 |
|
29 |
+
$current_user = wp_get_current_user();
|
30 |
+
|
31 |
?>
|
32 |
+
<div class="panel panel-default" id="gm_application">
|
33 |
+
<?php wp_nonce_field('GmediaService'); ?>
|
34 |
+
<div class="panel-body" id="gmedia-service-msg-panel"><?php
|
35 |
+
if(empty($_SERVER['HTTP_X_REAL_IP']) && ('127.0.0.1' == $_SERVER['REMOTE_ADDR'] || '::1' == $_SERVER['REMOTE_ADDR'])){
|
36 |
+
echo $alert;
|
37 |
+
} else{
|
38 |
+
if(!$mobile_app || !$site_ID){
|
39 |
+
echo $alert;
|
40 |
+
?>
|
41 |
+
<div class="notice updated gm-message">
|
42 |
+
<div class="gm-message-content">
|
43 |
+
<div class="gm-plugin-icon">
|
44 |
+
<img src="<?php echo plugins_url('/grand-media/admin/assets/img/icon-128x128.png') ?>" width="80" height="80">
|
45 |
+
</div>
|
46 |
+
<?php printf( __('<p>Hey %s,<br>You should allow some data about your <b>Gmedia Gallery</b> to be sent to <a href="https://codeasily.com/" target="_blank" tabindex="1">codeasily.com</a> in order to use iOS application.
|
47 |
+
<br />These data required if you want to use Gmedia iOS application on your iPhone.</p>', 'grand-media'), $current_user->display_name ); ?>
|
48 |
+
</div>
|
49 |
+
<div class="gm-message-actions">
|
50 |
+
<span class="spinner" style="float: none;"></span>
|
51 |
+
<button class="button button-primary gm_service_action" data-action="allow" data-nonce="<?php echo wp_create_nonce('GmediaService'); ?>"><?php _e('Allow & Continue', 'grand-media'); ?></button>
|
52 |
+
</div>
|
53 |
+
<div class="gm-message-plus gm-closed">
|
54 |
+
<a class="gm-mp-trigger" href="#" onclick="jQuery('.gm-message-plus').toggleClass('gm-closed gm-opened'); return false;"><?php _e('What permissions are being granted?', 'grand-media'); ?></a>
|
55 |
+
<ul>
|
56 |
+
<li>
|
57 |
+
<i class="dashicons dashicons-admin-users"></i>
|
58 |
+
|
59 |
+
<div>
|
60 |
+
<span><?php _e('Your Profile Overview', 'grand-media'); ?></span>
|
61 |
+
|
62 |
+
<p><?php _e('Name and email address', 'grand-media'); ?></p>
|
63 |
+
</div>
|
64 |
+
</li>
|
65 |
+
<li>
|
66 |
+
<i class="dashicons dashicons-admin-settings"></i>
|
67 |
+
|
68 |
+
<div>
|
69 |
+
<span><?php _e('Your Site Overview', 'grand-media'); ?></span>
|
70 |
+
|
71 |
+
<p><?php _e('Site URL, WP version, PHP version, active theme & plugins', 'grand-media'); ?></p>
|
72 |
+
</div>
|
73 |
+
</li>
|
74 |
+
</ul>
|
75 |
+
</div>
|
76 |
+
</div>
|
77 |
+
<?php
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
?></div>
|
82 |
<div class="panel-body" id="gm_application_data">
|
83 |
<?php if(current_user_can('manage_options')){ ?>
|
84 |
<div class="container-fluid">
|
85 |
<div class="row">
|
86 |
<div class="col-xs-6">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
<!--<p><?php echo 'Server address: ' . $_SERVER['SERVER_ADDR'];
|
88 |
echo '<br>Remote address: ' . $_SERVER['REMOTE_ADDR'];
|
89 |
+
echo '<br>HTTP X Real IP: ' . isset($_SERVER['HTTP_X_REAL_IP'])? $_SERVER['HTTP_X_REAL_IP'] : '';
|
90 |
?></p>-->
|
91 |
<div class="gmapp-description">
|
92 |
<div style="text-align:center; margin-bottom:30px;">
|
128 |
<p><?php _e('Below you can see information about your website that will be used by GmediaService and iOS application, so you\'ll be able to manage your Gmedia Library with your smartphone and other people can find and view your public collections.', 'grand-media'); ?></p>
|
129 |
<div class="form-group">
|
130 |
<label><?php _e('Email', 'grand-media') ?>:</label>
|
131 |
+
<input type="text" name="site_email" class="form-control input-sm" value="<?php esc_attr_e(get_option('admin_email')); ?>" readonly/>
|
132 |
</div>
|
133 |
<div class="form-group">
|
134 |
<label><?php _e('Site URL', 'grand-media') ?>:</label>
|
135 |
+
<input type="text" name="site_url" class="form-control input-sm" value="<?php echo home_url(); ?>" readonly/>
|
136 |
</div>
|
137 |
<div class="form-group">
|
138 |
<label><?php _e('Site Title', 'grand-media') ?>:</label>
|
139 |
+
<input type="text" name="site_title" class="form-control input-sm" value="<?php esc_attr_e(get_bloginfo('name')); ?>" readonly/>
|
140 |
</div>
|
141 |
<div class="form-group">
|
142 |
<label><?php _e('Site Description', 'grand-media') ?>:</label>
|
143 |
+
<textarea rows="2" cols="10" name="site_description" class="form-control input-sm" readonly><?php esc_attr_e(get_bloginfo('description')); ?></textarea>
|
144 |
</div>
|
|
|
145 |
</div>
|
146 |
|
147 |
<div class="gmapp-description">
|
172 |
</div>
|
173 |
</div>
|
174 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
<?php } ?>
|
176 |
</div>
|
177 |
+
</div>
|
178 |
<?php
|
179 |
}
|
admin/assets/css/gmedia.admin.css
CHANGED
@@ -422,6 +422,70 @@ label.cb_media-object-gallery {
|
|
422 |
.gmedia-actions > *:first-child {margin-left: 0;}
|
423 |
.gmedia-actions > *:last-child {margin-right: 0;}
|
424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
.gm-item-cell .gm-cell-bottom {
|
426 |
position:relative;
|
427 |
min-height:20px;
|
@@ -697,14 +761,15 @@ div#pluploadUploader_container .plupload_filelist_footer {
|
|
697 |
}
|
698 |
div#pluploadUploader_buttons { margin-bottom:5px; }
|
699 |
div.plupload_started { float:left; }
|
700 |
-
div.panel-body, div#gmedia-msg-panel {
|
701 |
-webkit-transition:all .2s ease-in-out;
|
702 |
transition:all .2s ease-in-out;
|
703 |
}
|
704 |
-
div.panel-body:empty, div#gmedia-msg-panel:empty {
|
705 |
padding:0;
|
706 |
}
|
707 |
-
div#gmedia-msg-panel .alert
|
|
|
708 |
padding:2px 35px 2px 12px;
|
709 |
margin-bottom:5px;
|
710 |
}
|
@@ -878,7 +943,6 @@ a.edit_tag_save.btn {
|
|
878 |
#gmedia-edit-term .gm-img-thumbnail img { max-height: 150px; }
|
879 |
.choose-module {
|
880 |
padding:10px;
|
881 |
-
cursor:pointer;
|
882 |
overflow:hidden;
|
883 |
margin:0;
|
884 |
}
|
@@ -905,12 +969,21 @@ a.edit_tag_save.btn {
|
|
905 |
padding-bottom:0;
|
906 |
margin-bottom:0;
|
907 |
}
|
|
|
|
|
|
|
908 |
#chooseModuleModal .choose-module {
|
909 |
border-bottom: 1px solid #444444;
|
910 |
}
|
911 |
#chooseModuleModal .choose-module:last-child {
|
912 |
border-bottom: none;
|
913 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
914 |
.presetlist a { }
|
915 |
.gm-preset-id {
|
916 |
font-size:smaller;
|
@@ -1191,14 +1264,17 @@ body.gmedia_library .panel {
|
|
1191 |
#previewModal .modal-header .btn-primary {display:none;}
|
1192 |
#previewModal .select_gmedia .modal-header .btn-primary {display:inline-block;}
|
1193 |
#previewModal .select_gmedia_image .modal-header .btn-primary {display:inline-block;}
|
|
|
1194 |
|
1195 |
.edit_gmedia_item .modal-header {display:none;}
|
1196 |
.edit_gmedia_item .modal-body {padding:0;}
|
1197 |
.edit_gmedia_item iframe {max-height:calc(100vh - 110px);}
|
1198 |
|
1199 |
.select_gmedia .modal-body,
|
|
|
1200 |
.select_gmedia_image .modal-body {padding:0;}
|
1201 |
.select_gmedia iframe,
|
|
|
1202 |
.select_gmedia_image iframe {max-height:calc(100vh - 160px);}
|
1203 |
.no-transition {transition:none !important; -webkit-transition:none !important;}
|
1204 |
|
@@ -1466,4 +1542,81 @@ select[multiple].input-group-xs > .input-group-btn > .btn {
|
|
1466 |
.input-group-btn:last-child > .dropdown-toggle {
|
1467 |
border-bottom-left-radius:0;
|
1468 |
border-top-left-radius:0;
|
1469 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
422 |
.gmedia-actions > *:first-child {margin-left: 0;}
|
423 |
.gmedia-actions > *:last-child {margin-right: 0;}
|
424 |
|
425 |
+
.related-media-previews {}
|
426 |
+
.related-media-previews::before,
|
427 |
+
.related-media-previews::after {
|
428 |
+
content:"";
|
429 |
+
display: table;
|
430 |
+
clear: both;
|
431 |
+
height: 0;
|
432 |
+
overflow: hidden;
|
433 |
+
}
|
434 |
+
p.thumbnail.gmedia-related-image,
|
435 |
+
.related-media-previews p.gmedia-related-image {
|
436 |
+
width: 30%;
|
437 |
+
float: left;
|
438 |
+
display: inline-block;
|
439 |
+
position: relative;
|
440 |
+
margin-right: 3%;
|
441 |
+
margin-top: 7px;
|
442 |
+
}
|
443 |
+
.edit-gmedia p.thumbnail.gmedia-related-image,
|
444 |
+
.edit-gmedia .related-media-previews p.gmedia-related-image {
|
445 |
+
width: 44%;
|
446 |
+
float: none;
|
447 |
+
vertical-align: top;
|
448 |
+
}
|
449 |
+
p.thumbnail.gmedia-related-image .gm-remove {
|
450 |
+
padding: 1px;
|
451 |
+
font-size: 15px;
|
452 |
+
font-weight: bold;
|
453 |
+
line-height: 0.7;
|
454 |
+
border-radius: 50%;
|
455 |
+
width: 1em;
|
456 |
+
height: 1em;
|
457 |
+
box-sizing: content-box;
|
458 |
+
color: #fff;
|
459 |
+
background-color: #cc0d00;
|
460 |
+
text-align: center;
|
461 |
+
position: absolute;
|
462 |
+
right: -0.5em;
|
463 |
+
top: -0.5em;
|
464 |
+
transform: scale(0);
|
465 |
+
transition: transform 0.1s ease-in;
|
466 |
+
cursor: pointer;
|
467 |
+
}
|
468 |
+
p.thumbnail.gmedia-related-image:hover .gm-remove {
|
469 |
+
transform: scale(1);
|
470 |
+
}
|
471 |
+
p.thumbnail.gmedia-related-image .image-wrapper {
|
472 |
+
display: block;
|
473 |
+
position: relative;
|
474 |
+
width: 100%;
|
475 |
+
height: 0;
|
476 |
+
padding-bottom: 62.5%;
|
477 |
+
cursor: move;
|
478 |
+
}
|
479 |
+
p.thumbnail.gmedia-related-image img.gmedia-thumb {
|
480 |
+
position: absolute;
|
481 |
+
left: 0;
|
482 |
+
top: 0;
|
483 |
+
width: 100%;
|
484 |
+
height: 100%;
|
485 |
+
display: block;
|
486 |
+
object-fit: contain;
|
487 |
+
}
|
488 |
+
|
489 |
.gm-item-cell .gm-cell-bottom {
|
490 |
position:relative;
|
491 |
min-height:20px;
|
761 |
}
|
762 |
div#pluploadUploader_buttons { margin-bottom:5px; }
|
763 |
div.plupload_started { float:left; }
|
764 |
+
div.panel-body, div#gmedia-msg-panel, #gmedia-service-msg-panel {
|
765 |
-webkit-transition:all .2s ease-in-out;
|
766 |
transition:all .2s ease-in-out;
|
767 |
}
|
768 |
+
div.panel-body:empty, div#gmedia-msg-panel:empty, #gmedia-service-msg-panel:empty {
|
769 |
padding:0;
|
770 |
}
|
771 |
+
div#gmedia-msg-panel .alert,
|
772 |
+
#gmedia-service-msg-panel .alert {
|
773 |
padding:2px 35px 2px 12px;
|
774 |
margin-bottom:5px;
|
775 |
}
|
943 |
#gmedia-edit-term .gm-img-thumbnail img { max-height: 150px; }
|
944 |
.choose-module {
|
945 |
padding:10px;
|
|
|
946 |
overflow:hidden;
|
947 |
margin:0;
|
948 |
}
|
969 |
padding-bottom:0;
|
970 |
margin-bottom:0;
|
971 |
}
|
972 |
+
#gmedia_modules .buttons a.btn {
|
973 |
+
margin-bottom: 7px;
|
974 |
+
}
|
975 |
#chooseModuleModal .choose-module {
|
976 |
border-bottom: 1px solid #444444;
|
977 |
}
|
978 |
#chooseModuleModal .choose-module:last-child {
|
979 |
border-bottom: none;
|
980 |
}
|
981 |
+
.modules-body .media {
|
982 |
+
display:none;
|
983 |
+
}
|
984 |
+
.modules-body .module-filtered {
|
985 |
+
display:block;
|
986 |
+
}
|
987 |
.presetlist a { }
|
988 |
.gm-preset-id {
|
989 |
font-size:smaller;
|
1264 |
#previewModal .modal-header .btn-primary {display:none;}
|
1265 |
#previewModal .select_gmedia .modal-header .btn-primary {display:inline-block;}
|
1266 |
#previewModal .select_gmedia_image .modal-header .btn-primary {display:inline-block;}
|
1267 |
+
#previewModal .select_gmedia_related .modal-header .btn-primary {display:inline-block;}
|
1268 |
|
1269 |
.edit_gmedia_item .modal-header {display:none;}
|
1270 |
.edit_gmedia_item .modal-body {padding:0;}
|
1271 |
.edit_gmedia_item iframe {max-height:calc(100vh - 110px);}
|
1272 |
|
1273 |
.select_gmedia .modal-body,
|
1274 |
+
.select_gmedia_related .modal-body,
|
1275 |
.select_gmedia_image .modal-body {padding:0;}
|
1276 |
.select_gmedia iframe,
|
1277 |
+
.select_gmedia_related iframe,
|
1278 |
.select_gmedia_image iframe {max-height:calc(100vh - 160px);}
|
1279 |
.no-transition {transition:none !important; -webkit-transition:none !important;}
|
1280 |
|
1542 |
.input-group-btn:last-child > .dropdown-toggle {
|
1543 |
border-bottom-left-radius:0;
|
1544 |
border-top-left-radius:0;
|
1545 |
+
}
|
1546 |
+
|
1547 |
+
.notice.updated.gm-message {
|
1548 |
+
margin-left: 0;
|
1549 |
+
margin-bottom: 30px;
|
1550 |
+
/* clear: both; */
|
1551 |
+
max-width: 800px;
|
1552 |
+
}
|
1553 |
+
|
1554 |
+
.gm-plugin-icon {
|
1555 |
+
float: left;
|
1556 |
+
margin-right: 15px;
|
1557 |
+
}
|
1558 |
+
|
1559 |
+
.gm-message-content * {
|
1560 |
+
font-size: 14px;
|
1561 |
+
}
|
1562 |
+
|
1563 |
+
.gm-message-actions {
|
1564 |
+
background-color: #e6eef1;
|
1565 |
+
padding: 10px 12px;
|
1566 |
+
margin: 0 -12px;
|
1567 |
+
text-align: right;
|
1568 |
+
}
|
1569 |
+
|
1570 |
+
.gm-message-actions button {
|
1571 |
+
margin-left: 20px !important;
|
1572 |
+
}
|
1573 |
+
|
1574 |
+
.gm-message-plus.gm-closed ul {
|
1575 |
+
display: none;
|
1576 |
+
}
|
1577 |
+
|
1578 |
+
.gm-message-plus {
|
1579 |
+
text-align: center;
|
1580 |
+
padding: 4px 0;
|
1581 |
+
}
|
1582 |
+
|
1583 |
+
.gm-message-plus.gm-opened ul {
|
1584 |
+
display: block;
|
1585 |
+
text-align: left;
|
1586 |
+
margin: 20px 20px 10px 20px;
|
1587 |
+
}
|
1588 |
+
|
1589 |
+
.gm-message-plus ul li {
|
1590 |
+
margin-bottom: 12px;
|
1591 |
+
}
|
1592 |
+
|
1593 |
+
.gm-message-plus ul li i.dashicons {
|
1594 |
+
float: left;
|
1595 |
+
font-size: 40px;
|
1596 |
+
width: 40px;
|
1597 |
+
height: 40px;
|
1598 |
+
}
|
1599 |
+
|
1600 |
+
.gm-message-plus ul li div {
|
1601 |
+
margin-left: 55px;
|
1602 |
+
}
|
1603 |
+
|
1604 |
+
.gm-message-plus ul li div span {
|
1605 |
+
font-weight: bold;
|
1606 |
+
text-transform: uppercase;
|
1607 |
+
color: #23282d;
|
1608 |
+
}
|
1609 |
+
|
1610 |
+
.gm-message-plus ul li div p{
|
1611 |
+
margin: 2px 0 0 0
|
1612 |
+
}
|
1613 |
+
|
1614 |
+
/* Spectrum */
|
1615 |
+
.form-group .sp-replacer {
|
1616 |
+
width: 100%;
|
1617 |
+
border-radius: 3px;
|
1618 |
+
}
|
1619 |
+
.form-group .sp-preview {
|
1620 |
+
width: calc(100% - 18px);
|
1621 |
+
border-radius: 3px;
|
1622 |
+
}
|
admin/assets/js/gmedia.admin.js
CHANGED
@@ -358,6 +358,25 @@ var GmediaLibrary = {
|
|
358 |
jQuery(document).on('click.gmedia', '#wp-link-cancel, #wp-link-close, #wp-link-backdrop', function(e) {
|
359 |
closeLinkModal()
|
360 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
}
|
362 |
};
|
363 |
|
@@ -492,38 +511,38 @@ var GmediaAddMedia = {
|
|
492 |
* Gmedia Terms
|
493 |
*/
|
494 |
var GmediaTerms = {
|
495 |
-
init: function()
|
496 |
|
497 |
-
if(jQuery('body').hasClass('GrandMedia_Tags'))
|
498 |
jQuery('#gm-list-table').data('edit', false);
|
499 |
-
gmedia_DOM.on('keypress', 'input.edit_tag_input', function(e)
|
500 |
var tagdiv = jQuery('#tag_' + jQuery(this).data('tag_id'));
|
501 |
var charCode = e.charCode || e.keyCode || e.which;
|
502 |
-
if(charCode == 13)
|
503 |
e.preventDefault();
|
504 |
edit_tag(tagdiv);
|
505 |
}
|
506 |
-
}).on('blur', 'input.edit_tag_input', function()
|
507 |
var tagdiv = jQuery('#tag_' + jQuery(this).data('tag_id'));
|
508 |
edit_tag(tagdiv);
|
509 |
});
|
510 |
|
511 |
-
gmedia_DOM.on('click', '.edit_tag_link', function(e)
|
512 |
e.preventDefault();
|
513 |
var id = jQuery(this).attr('href');
|
514 |
jQuery(this).hide();
|
515 |
jQuery(id).find('.edit_tag_form').show().find('input').focus();
|
516 |
jQuery('#gm-list-table').data('edit', true);
|
517 |
});
|
518 |
-
gmedia_DOM.on('click', '.edit_tag_save', function(e)
|
519 |
e.preventDefault();
|
520 |
});
|
521 |
|
522 |
-
function edit_tag(tagdiv)
|
523 |
var inp = tagdiv.find('.edit_tag_form input');
|
524 |
var new_tag_name = jQuery.trim(inp.val());
|
525 |
var old_tag_name = inp.attr('placeholder');
|
526 |
-
if((old_tag_name == new_tag_name) || ('' === new_tag_name) || jQuery.isNumeric())
|
527 |
inp.val(old_tag_name);
|
528 |
tagdiv.find('.edit_tag_form').hide();
|
529 |
tagdiv.find('.edit_tag_link').show();
|
@@ -535,12 +554,12 @@ var GmediaTerms = {
|
|
535 |
tag_name: new_tag_name,
|
536 |
_wpnonce_terms: jQuery('#_wpnonce_terms').val()
|
537 |
};
|
538 |
-
jQuery.post(ajaxurl, post_data, function(data, textStatus, jqXHR)
|
539 |
console.log(data);
|
540 |
-
if(data.error)
|
541 |
//inp.val(inp.attr('placeholder'));
|
542 |
jQuery('#gmedia-panel').before(data.error);
|
543 |
-
} else
|
544 |
//new_tag_name = new_tag_name.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
|
545 |
inp.attr('placeholder', new_tag_name);
|
546 |
tagdiv.find('.edit_tag_link').text(new_tag_name).show();
|
@@ -552,17 +571,18 @@ var GmediaTerms = {
|
|
552 |
}
|
553 |
}
|
554 |
|
555 |
-
gmedia_DOM.on('click', '.term-shortcode input', function()
|
556 |
this.setSelectionRange(0, 0);
|
557 |
this.setSelectionRange(0, this.value.length);
|
558 |
});
|
559 |
-
gmedia_DOM.on('change', '.term-shortcode input', function()
|
560 |
shortcode_inp_autowidth(this);
|
561 |
});
|
562 |
-
jQuery('.term-shortcode input', gmedia_DOM).each(function(i, e)
|
563 |
shortcode_inp_autowidth(this)
|
564 |
});
|
565 |
-
|
|
|
566 |
var inp = jQuery(e),
|
567 |
buffer = inp.next('.input-buffer');
|
568 |
buffer.text(inp.val());
|
@@ -570,13 +590,13 @@ var GmediaTerms = {
|
|
570 |
}
|
571 |
|
572 |
var sortable = jQuery('#gm-sortable');
|
573 |
-
if(sortable.length && !jQuery('#gmedia-panel', sortable).hasClass('gmedia-filtered'))
|
574 |
var sortdiv = jQuery('#gm-list-table', sortable);
|
575 |
var post_data = sortable.data();
|
576 |
post_data['idx0'] = parseInt(sortdiv.attr('data-idx0'));
|
577 |
|
578 |
var _ids = [];
|
579 |
-
jQuery('.gm-item-cell', sortdiv).each(function(index)
|
580 |
_ids.push(jQuery(this).attr('data-id'));
|
581 |
});
|
582 |
sortdiv.sortable({
|
@@ -587,17 +607,17 @@ var GmediaTerms = {
|
|
587 |
helper: 'clone',
|
588 |
revert: true,
|
589 |
forcePlaceholderSize: true,
|
590 |
-
stop: function(event, ui)
|
591 |
var ids = [];
|
592 |
-
jQuery('.gm-item-cell', sortdiv).each(function(index)
|
593 |
ids.push(jQuery(this).attr('data-id'));
|
594 |
});
|
595 |
|
596 |
-
if(_ids.toString() != ids.toString())
|
597 |
_ids = ids;
|
598 |
jQuery('.panel-heading .spinner', sortable).addClass('is-active');
|
599 |
post_data['ids'] = ids
|
600 |
-
jQuery.post(ajaxurl, post_data, function(data, textStatus, jqXHR)
|
601 |
jQuery('.panel-heading .spinner', sortable).removeClass('is-active');
|
602 |
console.log(data);
|
603 |
});
|
@@ -609,11 +629,16 @@ var GmediaTerms = {
|
|
609 |
gmedia_DOM.on('change', '#gmedia_term_orderby', function(){
|
610 |
if('custom' == jQuery(this).val()){
|
611 |
jQuery('#gmedia_term_order').val('ASC').addClass('disabled');
|
612 |
-
} else
|
613 |
jQuery('#gmedia_term_order').removeClass('disabled');
|
614 |
}
|
615 |
});
|
616 |
|
|
|
|
|
|
|
|
|
|
|
617 |
}
|
618 |
};
|
619 |
|
@@ -935,6 +960,29 @@ var GmediaFunction = {
|
|
935 |
return GmediaFunction.confirm(jQuery(this).data('confirm'));
|
936 |
});
|
937 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
938 |
gmedia_DOM.on('click', '.show-settings-link', function(e) {
|
939 |
e.preventDefault();
|
940 |
jQuery('#show-settings-link').trigger('click');
|
@@ -1073,6 +1121,53 @@ var GmediaFunction = {
|
|
1073 |
jQuery('#previewModal').modal('hide');
|
1074 |
});
|
1075 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1076 |
jQuery(document).on('click.gmedia', '#previewModal .select_gmedia:not(.assign_gmedia_term) .btn-primary', function() {
|
1077 |
var field = jQuery('.previewModal_initiator').closest('.form-group').find('.form-control');
|
1078 |
var valData = field.val().split(',');
|
@@ -1276,7 +1371,7 @@ var GmediaFunction = {
|
|
1276 |
});
|
1277 |
|
1278 |
|
1279 |
-
gmedia_DOM.on('change', 'form.edit-gmedia :input', function() {
|
1280 |
if(jQuery(this).hasClass('edit-gmedia-ignore')) {
|
1281 |
return;
|
1282 |
}
|
@@ -1367,7 +1462,7 @@ var GmediaFunction = {
|
|
1367 |
});
|
1368 |
});
|
1369 |
|
1370 |
-
gmedia_DOM.on('keydown', 'form :input:visible:not(:submit,:button,:reset,textarea
|
1371 |
var charCode = e.charCode || e.keyCode || e.which;
|
1372 |
if(13 == charCode && !jQuery(this).parent().hasClass('selectize-input')) {
|
1373 |
var inputs = jQuery(this).parents("form").eq(0).find(":input:visible");
|
@@ -1452,6 +1547,25 @@ var GmediaFunction = {
|
|
1452 |
});
|
1453 |
});
|
1454 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1455 |
if(jQuery(".panel-fixed-header").length) {
|
1456 |
setPanelHeadersWidth();
|
1457 |
setTimeout(function() {
|
@@ -1486,7 +1600,7 @@ window.closeModal = function(id) {
|
|
1486 |
|
1487 |
|
1488 |
/*
|
1489 |
-
* jQuery functions for GRAND
|
1490 |
*/
|
1491 |
function GmediaInit(){
|
1492 |
gmedia_DOM = jQuery('#gmedia-container');
|
358 |
jQuery(document).on('click.gmedia', '#wp-link-cancel, #wp-link-close, #wp-link-backdrop', function(e) {
|
359 |
closeLinkModal()
|
360 |
});
|
361 |
+
|
362 |
+
var related_sortable = jQuery('.related-media-previews');
|
363 |
+
if(related_sortable.length){
|
364 |
+
related_sortable.sortable({
|
365 |
+
items: '.gmedia-related-image',
|
366 |
+
handle: '.image-wrapper',
|
367 |
+
placeholder: 'gmedia-related-image',
|
368 |
+
tolerance: 'pointer',
|
369 |
+
//helper: 'clone',
|
370 |
+
revert: true,
|
371 |
+
forcePlaceholderSize: true,
|
372 |
+
stop: function(event, ui){
|
373 |
+
console.log(ui);
|
374 |
+
ui.item.find('input').trigger('change');
|
375 |
+
}
|
376 |
+
});
|
377 |
+
}
|
378 |
+
|
379 |
+
|
380 |
}
|
381 |
};
|
382 |
|
511 |
* Gmedia Terms
|
512 |
*/
|
513 |
var GmediaTerms = {
|
514 |
+
init: function(){
|
515 |
|
516 |
+
if(jQuery('body').hasClass('GrandMedia_Tags')){
|
517 |
jQuery('#gm-list-table').data('edit', false);
|
518 |
+
gmedia_DOM.on('keypress', 'input.edit_tag_input', function(e){
|
519 |
var tagdiv = jQuery('#tag_' + jQuery(this).data('tag_id'));
|
520 |
var charCode = e.charCode || e.keyCode || e.which;
|
521 |
+
if(charCode == 13){
|
522 |
e.preventDefault();
|
523 |
edit_tag(tagdiv);
|
524 |
}
|
525 |
+
}).on('blur', 'input.edit_tag_input', function(){
|
526 |
var tagdiv = jQuery('#tag_' + jQuery(this).data('tag_id'));
|
527 |
edit_tag(tagdiv);
|
528 |
});
|
529 |
|
530 |
+
gmedia_DOM.on('click', '.edit_tag_link', function(e){
|
531 |
e.preventDefault();
|
532 |
var id = jQuery(this).attr('href');
|
533 |
jQuery(this).hide();
|
534 |
jQuery(id).find('.edit_tag_form').show().find('input').focus();
|
535 |
jQuery('#gm-list-table').data('edit', true);
|
536 |
});
|
537 |
+
gmedia_DOM.on('click', '.edit_tag_save', function(e){
|
538 |
e.preventDefault();
|
539 |
});
|
540 |
|
541 |
+
function edit_tag(tagdiv){
|
542 |
var inp = tagdiv.find('.edit_tag_form input');
|
543 |
var new_tag_name = jQuery.trim(inp.val());
|
544 |
var old_tag_name = inp.attr('placeholder');
|
545 |
+
if((old_tag_name == new_tag_name) || ('' === new_tag_name) || jQuery.isNumeric()){
|
546 |
inp.val(old_tag_name);
|
547 |
tagdiv.find('.edit_tag_form').hide();
|
548 |
tagdiv.find('.edit_tag_link').show();
|
554 |
tag_name: new_tag_name,
|
555 |
_wpnonce_terms: jQuery('#_wpnonce_terms').val()
|
556 |
};
|
557 |
+
jQuery.post(ajaxurl, post_data, function(data, textStatus, jqXHR){
|
558 |
console.log(data);
|
559 |
+
if(data.error){
|
560 |
//inp.val(inp.attr('placeholder'));
|
561 |
jQuery('#gmedia-panel').before(data.error);
|
562 |
+
} else{
|
563 |
//new_tag_name = new_tag_name.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
|
564 |
inp.attr('placeholder', new_tag_name);
|
565 |
tagdiv.find('.edit_tag_link').text(new_tag_name).show();
|
571 |
}
|
572 |
}
|
573 |
|
574 |
+
gmedia_DOM.on('click', '.term-shortcode input', function(){
|
575 |
this.setSelectionRange(0, 0);
|
576 |
this.setSelectionRange(0, this.value.length);
|
577 |
});
|
578 |
+
gmedia_DOM.on('change', '.term-shortcode input', function(){
|
579 |
shortcode_inp_autowidth(this);
|
580 |
});
|
581 |
+
jQuery('.term-shortcode input', gmedia_DOM).each(function(i, e){
|
582 |
shortcode_inp_autowidth(this)
|
583 |
});
|
584 |
+
|
585 |
+
function shortcode_inp_autowidth(e){
|
586 |
var inp = jQuery(e),
|
587 |
buffer = inp.next('.input-buffer');
|
588 |
buffer.text(inp.val());
|
590 |
}
|
591 |
|
592 |
var sortable = jQuery('#gm-sortable');
|
593 |
+
if(sortable.length && !jQuery('#gmedia-panel', sortable).hasClass('gmedia-filtered')){
|
594 |
var sortdiv = jQuery('#gm-list-table', sortable);
|
595 |
var post_data = sortable.data();
|
596 |
post_data['idx0'] = parseInt(sortdiv.attr('data-idx0'));
|
597 |
|
598 |
var _ids = [];
|
599 |
+
jQuery('.gm-item-cell', sortdiv).each(function(index){
|
600 |
_ids.push(jQuery(this).attr('data-id'));
|
601 |
});
|
602 |
sortdiv.sortable({
|
607 |
helper: 'clone',
|
608 |
revert: true,
|
609 |
forcePlaceholderSize: true,
|
610 |
+
stop: function(event, ui){
|
611 |
var ids = [];
|
612 |
+
jQuery('.gm-item-cell', sortdiv).each(function(index){
|
613 |
ids.push(jQuery(this).attr('data-id'));
|
614 |
});
|
615 |
|
616 |
+
if(_ids.toString() != ids.toString()){
|
617 |
_ids = ids;
|
618 |
jQuery('.panel-heading .spinner', sortable).addClass('is-active');
|
619 |
post_data['ids'] = ids
|
620 |
+
jQuery.post(ajaxurl, post_data, function(data, textStatus, jqXHR){
|
621 |
jQuery('.panel-heading .spinner', sortable).removeClass('is-active');
|
622 |
console.log(data);
|
623 |
});
|
629 |
gmedia_DOM.on('change', '#gmedia_term_orderby', function(){
|
630 |
if('custom' == jQuery(this).val()){
|
631 |
jQuery('#gmedia_term_order').val('ASC').addClass('disabled');
|
632 |
+
} else{
|
633 |
jQuery('#gmedia_term_order').removeClass('disabled');
|
634 |
}
|
635 |
});
|
636 |
|
637 |
+
// Date/Time picker
|
638 |
+
if(jQuery.fn.datetimepicker){
|
639 |
+
jQuery('.input-group.gmedia_date').datetimepicker({useSeconds: true});
|
640 |
+
}
|
641 |
+
|
642 |
}
|
643 |
};
|
644 |
|
960 |
return GmediaFunction.confirm(jQuery(this).data('confirm'));
|
961 |
});
|
962 |
|
963 |
+
jQuery(document).on('click.gmedia', '.gm_service_action', function() {
|
964 |
+
var el = jQuery(this),
|
965 |
+
service = jQuery(this).attr('data-action'),
|
966 |
+
nonce = jQuery(this).attr('data-nonce');
|
967 |
+
var post_data = {
|
968 |
+
action: 'gmedia_application',
|
969 |
+
service: service,
|
970 |
+
_wpnonce: nonce
|
971 |
+
};
|
972 |
+
jQuery.post(ajaxurl, post_data, function(data, textStatus, jqXHR) {
|
973 |
+
console.log(data);
|
974 |
+
el.siblings('.spinner').removeClass('is-active');
|
975 |
+
if(data.error) {
|
976 |
+
jQuery('#gmedia-service-msg-panel').prepend(data.error);
|
977 |
+
} else if(data.message) {
|
978 |
+
jQuery('#gmedia-service-msg-panel').html(data.message);
|
979 |
+
}
|
980 |
+
});
|
981 |
+
|
982 |
+
el.siblings('.spinner').addClass('is-active');
|
983 |
+
jQuery('.gmedia-service__message').remove();
|
984 |
+
});
|
985 |
+
|
986 |
gmedia_DOM.on('click', '.show-settings-link', function(e) {
|
987 |
e.preventDefault();
|
988 |
jQuery('#show-settings-link').trigger('click');
|
1121 |
jQuery('#previewModal').modal('hide');
|
1122 |
});
|
1123 |
|
1124 |
+
jQuery(document).on('click.gmedia', '#previewModal .select_gmedia_related .btn-primary', function() {
|
1125 |
+
var relatedDiv = jQuery('.previewModal_initiator').closest('.form-group').find('.related-media-previews');
|
1126 |
+
var fields = relatedDiv.find('input');
|
1127 |
+
var valData = [],
|
1128 |
+
getData = [];
|
1129 |
+
if(fields){
|
1130 |
+
fields.each(function(){
|
1131 |
+
valData.push(jQuery(this).val());
|
1132 |
+
});
|
1133 |
+
}
|
1134 |
+
var storage = getStorage();
|
1135 |
+
storedData = storage.get('gmedia_library:frame').split('.');
|
1136 |
+
jQuery.each(storedData, function(i, id) {
|
1137 |
+
if(!id) {
|
1138 |
+
return true;
|
1139 |
+
}
|
1140 |
+
if(jQuery.inArray(id, valData) === -1) {
|
1141 |
+
getData.push(id);
|
1142 |
+
}
|
1143 |
+
});
|
1144 |
+
if(getData.length){
|
1145 |
+
jQuery.get(ajaxurl, {action: 'gmedia_get_data', gmedia__in: getData}, function(data, textStatus, jqXHR) {
|
1146 |
+
if(jQuery.isArray(data) && data.length){
|
1147 |
+
var thumbHTML
|
1148 |
+
jQuery.each(data, function(i, item){
|
1149 |
+
thumbHTML = '<p class="thumbnail gmedia-related-image">' +
|
1150 |
+
'<span class="image-wrapper"><img class="gmedia-thumb" src="" alt=""></span>' +
|
1151 |
+
'<span class="gm-remove">×</span>' +
|
1152 |
+
'<input type="hidden" name="meta[_related][]" value="">' +
|
1153 |
+
'</p>';
|
1154 |
+
jQuery(thumbHTML).find('img').attr('src', item.url_thumb).end().find('input').val(item.ID).end().appendTo(relatedDiv);
|
1155 |
+
});
|
1156 |
+
relatedDiv.sortable( "refresh" );
|
1157 |
+
relatedDiv.closest('form').find('input[name="title"]').trigger('change');
|
1158 |
+
}
|
1159 |
+
});
|
1160 |
+
}
|
1161 |
+
storage.set('gmedia_library:frame', '');
|
1162 |
+
jQuery('#previewModal').modal('hide');
|
1163 |
+
});
|
1164 |
+
|
1165 |
+
jQuery(document).on('click.gmedia', '.related-media-previews .gm-remove', function() {
|
1166 |
+
var inpTitle = jQuery(this).closest('form').find('input[name="title"]');
|
1167 |
+
jQuery(this).closest('.gmedia-related-image').remove();
|
1168 |
+
inpTitle.trigger('change');
|
1169 |
+
});
|
1170 |
+
|
1171 |
jQuery(document).on('click.gmedia', '#previewModal .select_gmedia:not(.assign_gmedia_term) .btn-primary', function() {
|
1172 |
var field = jQuery('.previewModal_initiator').closest('.form-group').find('.form-control');
|
1173 |
var valData = field.val().split(',');
|
1371 |
});
|
1372 |
|
1373 |
|
1374 |
+
gmedia_DOM.on('change', 'form.edit-gmedia :input:not([name="doaction[]"])', function() {
|
1375 |
if(jQuery(this).hasClass('edit-gmedia-ignore')) {
|
1376 |
return;
|
1377 |
}
|
1462 |
});
|
1463 |
});
|
1464 |
|
1465 |
+
gmedia_DOM.on('keydown', 'form :input:visible:not(:submit,:button,:reset,textarea,.allow-key-enter)', function(e) {
|
1466 |
var charCode = e.charCode || e.keyCode || e.which;
|
1467 |
if(13 == charCode && !jQuery(this).parent().hasClass('selectize-input')) {
|
1468 |
var inputs = jQuery(this).parents("form").eq(0).find(":input:visible");
|
1547 |
});
|
1548 |
});
|
1549 |
|
1550 |
+
gmedia_DOM.on('click', '.filter-modules > *', function(){
|
1551 |
+
jQuery('.filter-modules > .btn-primary').removeClass('btn-primary').addClass('btn-default');
|
1552 |
+
jQuery('.filter-modules > .label-primary').removeClass('label-primary').addClass('label-default');
|
1553 |
+
if(jQuery(this).is('button')){
|
1554 |
+
jQuery(this).addClass('btn-primary').removeClass('btn-default');
|
1555 |
+
} else{
|
1556 |
+
jQuery(this).addClass('label-primary').removeClass('label-default');
|
1557 |
+
}
|
1558 |
+
var filter = jQuery(this).attr('data-filter');
|
1559 |
+
jQuery('#gmedia_modules .media').removeClass('module-filtered').filter('.module-' + filter).addClass('module-filtered');
|
1560 |
+
if(!jQuery('#gmedia_modules .module-filtered').length){
|
1561 |
+
if('not-installed' == filter){
|
1562 |
+
jQuery('#gmedia_modules .nomodules.nomodule-' + filter).addClass('module-filtered');
|
1563 |
+
} else{
|
1564 |
+
jQuery('#gmedia_modules .nomodules.nomodule-tag').addClass('module-filtered');
|
1565 |
+
}
|
1566 |
+
}
|
1567 |
+
})
|
1568 |
+
|
1569 |
if(jQuery(".panel-fixed-header").length) {
|
1570 |
setPanelHeadersWidth();
|
1571 |
setTimeout(function() {
|
1600 |
|
1601 |
|
1602 |
/*
|
1603 |
+
* jQuery functions for GRAND Media
|
1604 |
*/
|
1605 |
function GmediaInit(){
|
1606 |
gmedia_DOM = jQuery('#gmedia-container');
|
admin/logs.php
ADDED
@@ -0,0 +1,295 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Gmedia Logs
|
4 |
+
*/
|
5 |
+
|
6 |
+
// don't load directly
|
7 |
+
if( !defined('ABSPATH')){
|
8 |
+
die('-1');
|
9 |
+
}
|
10 |
+
|
11 |
+
global $user_ID, $wpdb, $gmDB, $gmCore, $gmGallery, $gmProcessor;
|
12 |
+
|
13 |
+
$gmedia_url = $gmProcessor->url;
|
14 |
+
$gmedia_user_options = $gmProcessor->user_options;
|
15 |
+
|
16 |
+
if(isset($_GET['do_gmedia']) && 'clear_logs' == $_GET['do_gmedia']){
|
17 |
+
check_admin_referer('gmedia_clear_logs', '_wpnonce_clear_logs');
|
18 |
+
$wpdb->query("DELETE FROM {$wpdb->prefix}gmedia_log WHERE 1 = 1");
|
19 |
+
}
|
20 |
+
|
21 |
+
|
22 |
+
$gmedia_filter = array();
|
23 |
+
|
24 |
+
$openPage = !empty($_GET['pager'])? (int) $_GET['pager'] : 1;
|
25 |
+
|
26 |
+
$where = '';
|
27 |
+
$search = '';
|
28 |
+
$orderby = 'ORDER BY l.' . esc_sql($gmedia_user_options['orderby_gmedia_log']) . ' ' . esc_sql($gmedia_user_options['sortorder_gmedia_log']);
|
29 |
+
$lim = '';
|
30 |
+
|
31 |
+
if(isset($_POST['filter_author'])){
|
32 |
+
$authors = $gmCore->_post('author_ids');
|
33 |
+
$_GET['author'] = (int) $authors;
|
34 |
+
}
|
35 |
+
if(isset($_GET['author'])){
|
36 |
+
$author = (int) $_GET['author'];
|
37 |
+
$where .= "AND l.log_author = '{$author}' ";
|
38 |
+
$gmedia_filter['author'] = $author;
|
39 |
+
}
|
40 |
+
if(isset($_GET['log_event'])){
|
41 |
+
$where .= $wpdb->prepare("AND l.log = '%s' ", $_GET['log_event']);
|
42 |
+
$gmedia_filter['log_event'] = $_GET['log_event'];
|
43 |
+
}
|
44 |
+
if(isset($_GET['s'])){
|
45 |
+
$s = trim($_GET['s']);
|
46 |
+
if('#' == substr($s, 0, 1)){
|
47 |
+
$ids = wp_parse_id_list(substr($s, 1));
|
48 |
+
$where .= ' AND l.ID IN (\'' . implode("','", $ids) . '\')';
|
49 |
+
$s = false;
|
50 |
+
$gmedia_filter['search'] = $s;
|
51 |
+
}
|
52 |
+
if( !empty($s)){
|
53 |
+
// added slashes screw with quote grouping when done early, so done later
|
54 |
+
$s = stripslashes($s);
|
55 |
+
|
56 |
+
// split the words it a array if seperated by a space or comma
|
57 |
+
preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches);
|
58 |
+
$search_terms = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]);
|
59 |
+
|
60 |
+
$n = '%';
|
61 |
+
$searchand = '';
|
62 |
+
|
63 |
+
foreach((array) $search_terms as $term){
|
64 |
+
$term = addslashes_gpc($term);
|
65 |
+
$search .= "{$searchand}(g.title LIKE '{$n}{$term}{$n}') OR (g.description LIKE '{$n}{$term}{$n}')";
|
66 |
+
$searchand = ' AND ';
|
67 |
+
}
|
68 |
+
|
69 |
+
$term = esc_sql($s);
|
70 |
+
if(count($search_terms) > 1 && $search_terms[0] != $s){
|
71 |
+
$search .= " OR (g.title LIKE '{$n}{$term}{$n}') OR (g.description LIKE '{$n}{$term}{$n}')";
|
72 |
+
}
|
73 |
+
|
74 |
+
if( !empty($search)){
|
75 |
+
$search = " AND ({$search}) ";
|
76 |
+
}
|
77 |
+
$gmedia_filter['search'] = $s;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
$limit = intval($gmedia_user_options['per_page_gmedia_log']);
|
82 |
+
if($limit > 0){
|
83 |
+
$offset = ($openPage - 1) * $limit;
|
84 |
+
$lim = " LIMIT {$offset}, {$limit}";
|
85 |
+
}
|
86 |
+
|
87 |
+
$query = "SELECT SQL_CALC_FOUND_ROWS * FROM {$wpdb->prefix}gmedia_log AS l INNER JOIN {$wpdb->prefix}gmedia AS g ON g.ID = l.ID WHERE 1=1 $where $search $orderby $lim";
|
88 |
+
//echo '<pre>' . print_r($query, true) . '</pre>';
|
89 |
+
$logs = $wpdb->get_results($query);
|
90 |
+
$totalResult = (int) $wpdb->get_var("SELECT FOUND_ROWS()");
|
91 |
+
|
92 |
+
if((1 > $limit) || (0 == $totalResult)){
|
93 |
+
$limit = $totalResult;
|
94 |
+
$pages = 1;
|
95 |
+
} else{
|
96 |
+
$pages = ceil($totalResult / $limit);
|
97 |
+
}
|
98 |
+
|
99 |
+
$gmDB->pages = $pages;
|
100 |
+
$gmDB->openPage = $openPage;
|
101 |
+
$gmedia_pager = $gmDB->query_pager();
|
102 |
+
|
103 |
+
?>
|
104 |
+
<div class="panel panel-default panel-fixed-header" id="gmedia-panel">
|
105 |
+
<div class="panel-heading-fake"></div>
|
106 |
+
<div class="panel-heading clearfix" style="padding-bottom:2px;">
|
107 |
+
<div class="pull-right" style="margin-bottom:3px;">
|
108 |
+
<div class="clearfix">
|
109 |
+
<?php include(GMEDIA_ABSPATH . 'admin/tpl/search-form.php'); ?>
|
110 |
+
|
111 |
+
<div class="btn-toolbar pull-right" style="margin-bottom:4px; margin-left:4px;">
|
112 |
+
<?php if( !$gmProcessor->gmediablank){ ?>
|
113 |
+
<a title="<?php _e('More Screen Settings', 'grand-media'); ?>" class="show-settings-link pull-right btn btn-default btn-xs"><span class="glyphicon glyphicon-cog"></span></a>
|
114 |
+
<?php } ?>
|
115 |
+
</div>
|
116 |
+
</div>
|
117 |
+
|
118 |
+
<?php echo $gmedia_pager; ?>
|
119 |
+
|
120 |
+
<div class="spinner"></div>
|
121 |
+
|
122 |
+
</div>
|
123 |
+
<div class="btn-toolbar pull-left" style="margin-bottom:7px;">
|
124 |
+
<div class="btn-group">
|
125 |
+
<?php if( !empty($gmedia_filter)){ ?>
|
126 |
+
<a class="btn btn-warning" title="<?php _e('Reset Filter', 'grand-media'); ?>" rel="total" href="<?php echo gm_get_admin_url(array(), array(), $gmedia_url); ?>"><?php _e('Reset Filter', 'grand-media'); ?></a>
|
127 |
+
<?php } else{ ?>
|
128 |
+
<button type="button" class="btn btn-default" data-toggle="dropdown"><?php _e('Filter', 'grand-media'); ?></button>
|
129 |
+
<?php } ?>
|
130 |
+
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
131 |
+
<span class="caret"></span>
|
132 |
+
<span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span>
|
133 |
+
</button>
|
134 |
+
<ul class="dropdown-menu" role="menu">
|
135 |
+
<li role="presentation" class="dropdown-header"><?php _e('FILTER BY AUTHOR', 'grand-media'); ?></li>
|
136 |
+
<li class="gmedia_author<?php echo isset($gmedia_filter['author'])? ' active' : ''; ?>">
|
137 |
+
<a href="#libModal" data-modal="filter_author" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Choose authors', 'grand-media'); ?></a>
|
138 |
+
</li>
|
139 |
+
<li role="presentation" class="dropdown-header"><?php _e('FILTER BY EVENT', 'grand-media'); ?></li>
|
140 |
+
<li class="gmedia_event<?php echo (isset($gmedia_filter['log_event']) && 'view' == $gmedia_filter['log_event'])? ' active' : ''; ?>">
|
141 |
+
<a href="<?php echo add_query_arg(array('log_event' => 'view'), $gmedia_url) ?>"><?php _e('View / Play', 'grand-media'); ?></a>
|
142 |
+
</li>
|
143 |
+
<li class="gmedia_event<?php echo (isset($gmedia_filter['log_event']) && 'like' == $gmedia_filter['log_event'])? ' active' : ''; ?>">
|
144 |
+
<a href="<?php echo add_query_arg(array('log_event' => 'like'), $gmedia_url) ?>"><?php _e('Like', 'grand-media'); ?></a>
|
145 |
+
</li>
|
146 |
+
<li class="gmedia_event<?php echo (isset($gmedia_filter['log_event']) && 'rate' == $gmedia_filter['log_event'])? ' active' : ''; ?>">
|
147 |
+
<a href="<?php echo add_query_arg(array('log_event' => 'rate'), $gmedia_url) ?>"><?php _e('Rate', 'grand-media'); ?></a>
|
148 |
+
</li>
|
149 |
+
</ul>
|
150 |
+
</div>
|
151 |
+
<a class="btn btn-danger pull-left" href="<?php echo wp_nonce_url(gm_get_admin_url(array('do_gmedia' => 'clear_logs'), array(), $gmedia_url), 'gmedia_clear_logs', '_wpnonce_clear_logs') ?>" data-confirm="<?php _e("You are about to clear all Gmedia logs.\n\r'Cancel' to stop, 'OK' to clear.", "grand-media"); ?>"><?php _e('Clear Logs', 'grand-media'); ?></a>
|
152 |
+
|
153 |
+
</div>
|
154 |
+
|
155 |
+
</div>
|
156 |
+
<form class="panel-body" id="gm-log-table" style="margin-bottom:4px;">
|
157 |
+
<?php
|
158 |
+
if(empty($gmGallery->options['license_key'])){
|
159 |
+
?>
|
160 |
+
<div class="alert alert-warning" role="alert"><strong><?php _e('It\'s a premium feature. Gmedia Logger requires License Key.') ?></strong></div>
|
161 |
+
<?php
|
162 |
+
} elseif(!empty($gmGallery->options['disable_logs'])){
|
163 |
+
?>
|
164 |
+
<div class="alert alert-warning" role="alert"><strong><?php _e('Gmedia Logger is disabled in settings.') ?></strong></div>
|
165 |
+
<?php
|
166 |
+
}
|
167 |
+
?>
|
168 |
+
<div class="table-responsive">
|
169 |
+
<table class="table table-condensed table-hover">
|
170 |
+
<thead>
|
171 |
+
<tr>
|
172 |
+
<th><?php _e('Media', 'grand-media'); ?></th>
|
173 |
+
<th><?php _e('Info', 'grand-media'); ?></th>
|
174 |
+
<th><?php _e('Log Date', 'grand-media'); ?></th>
|
175 |
+
<th><?php _e('User / IP', 'grand-media'); ?></th>
|
176 |
+
<th><?php _e('Event', 'grand-media'); ?></th>
|
177 |
+
</tr>
|
178 |
+
</thead>
|
179 |
+
<tbody>
|
180 |
+
<?php
|
181 |
+
if($logs){
|
182 |
+
foreach($logs as $item){
|
183 |
+
gmedia_item_more_data($item);
|
184 |
+
?>
|
185 |
+
<tr>
|
186 |
+
<td style="width:150px;">
|
187 |
+
<div class="thumbnail" style="margin-bottom: 0;">
|
188 |
+
<?php
|
189 |
+
$images = $gmCore->gm_get_media_image($item, 'all');
|
190 |
+
$thumb = '<img class="gmedia-thumb" src="' . $images['thumb'] . '" alt=""/>';
|
191 |
+
|
192 |
+
if( !empty($images['icon'])){
|
193 |
+
$thumb .= '<img class="gmedia-typethumb" src="' . $images['icon'] . '" alt=""/>';
|
194 |
+
}
|
195 |
+
echo $thumb;
|
196 |
+
?>
|
197 |
+
</div>
|
198 |
+
</td>
|
199 |
+
<td>
|
200 |
+
<p class="media-meta"><span class="label label-default"><?php echo "#{$item->ID}"; ?>:</span> <b><?php echo esc_html($item->title); ?> </b></p>
|
201 |
+
<p class="media-meta">
|
202 |
+
<span class="label label-default"><?php _e('Album', 'grand-media'); ?>:</span>
|
203 |
+
<?php
|
204 |
+
if($item->album){
|
205 |
+
$terms_album = array();
|
206 |
+
foreach($item->album as $c){
|
207 |
+
$terms_album[] = esc_html($c->name);
|
208 |
+
}
|
209 |
+
$terms_album = join(', ', $terms_album);
|
210 |
+
} else{
|
211 |
+
$terms_album = '—';
|
212 |
+
}
|
213 |
+
echo $terms_album;
|
214 |
+
?>
|
215 |
+
<br/><span class="label label-default"><?php _e('Category', 'grand-media'); ?>:</span>
|
216 |
+
<?php
|
217 |
+
if($item->categories){
|
218 |
+
$terms_category = array();
|
219 |
+
foreach($item->categories as $c){
|
220 |
+
$terms_category[] = esc_html($c->name);
|
221 |
+
}
|
222 |
+
$terms_category = join(', ', $terms_category);
|
223 |
+
} else{
|
224 |
+
$terms_category = __('Uncategorized', 'grand-media');
|
225 |
+
}
|
226 |
+
echo $terms_category;
|
227 |
+
?>
|
228 |
+
<br/><span class="label label-default"><?php _e('Tags', 'grand-media'); ?>:</span>
|
229 |
+
<?php
|
230 |
+
if($item->tags){
|
231 |
+
$terms_tag = array();
|
232 |
+
foreach($item->tags as $c){
|
233 |
+
$terms_tag[] = esc_html($c->name);
|
234 |
+
}
|
235 |
+
$terms_tag = join(', ', $terms_tag);
|
236 |
+
} else{
|
237 |
+
$terms_tag = '—';
|
238 |
+
}
|
239 |
+
echo $terms_tag;
|
240 |
+
?>
|
241 |
+
</p>
|
242 |
+
<p class="media-meta">
|
243 |
+
<span class="label label-default"><?php _e('Views / Likes', 'grand-media'); ?>:</span>
|
244 |
+
<?php echo (isset($item->meta['views'][0])? $item->meta['views'][0] : '0') . ' / ' . (isset($item->meta['likes'][0])? $item->meta['likes'][0] : '0'); ?>
|
245 |
+
|
246 |
+
<?php if(isset($item->meta['_rating'][0])){
|
247 |
+
$ratings = maybe_unserialize($item->meta['_rating'][0]); ?>
|
248 |
+
<br/><span class="label label-default"><?php _e('Rating', 'grand-media'); ?>:</span> <?php echo $ratings['value'] . ' / ' . $ratings['votes']; ?>
|
249 |
+
<?php } ?>
|
250 |
+
<br/><span class="label label-default"><?php _e('Type', 'grand-media'); ?>:</span> <?php echo $item->mime_type; ?>
|
251 |
+
<br/><span class="label label-default"><?php _e('Filename', 'grand-media'); ?>:</span> <a href="<?php echo gm_get_admin_url(array('page' => 'GrandMedia', 'gmedia__in' => $item->ID), array(), $gmedia_url); ?>"><?php echo $item->gmuid; ?></a>
|
252 |
+
</p>
|
253 |
+
</td>
|
254 |
+
<td><p><?php echo $item->log_date; ?></p></td>
|
255 |
+
<td>
|
256 |
+
<p><?php
|
257 |
+
$author_name = $item->log_author? get_user_option('display_name', $item->log_author) : __('Guest', 'grand-media');
|
258 |
+
printf('<a class="gmedia-author" href="%s">%s</a>', esc_url(add_query_arg(array('author' => $item->log_author), $gmedia_url)), $author_name);
|
259 |
+
?></p>
|
260 |
+
<p class="media-meta"><span class="label label-default"><?php _e('IP Address', 'grand-media'); ?>:</span> <?php echo $item->ip_address; ?></p>
|
261 |
+
</td>
|
262 |
+
<td><p><?php
|
263 |
+
switch($item->log){
|
264 |
+
case 'view':
|
265 |
+
_e('View / Play', 'grand-media');
|
266 |
+
break;
|
267 |
+
case 'like':
|
268 |
+
_e('Like', 'grand-media');
|
269 |
+
break;
|
270 |
+
case 'rate':
|
271 |
+
echo __('Rate', 'grand-media') . ": {$item->log_data}";
|
272 |
+
break;
|
273 |
+
}
|
274 |
+
?></p></td>
|
275 |
+
</tr>
|
276 |
+
<?php
|
277 |
+
}
|
278 |
+
} else {
|
279 |
+
echo '<tr><td colspan="5" style="font-weight: bold; text-align: center; padding: 30px 0;">' . __('No Records.', 'grand-media') . '</td></tr>';
|
280 |
+
}
|
281 |
+
?>
|
282 |
+
</tbody>
|
283 |
+
|
284 |
+
</table>
|
285 |
+
</div>
|
286 |
+
<?php
|
287 |
+
wp_original_referer_field(true, 'previous');
|
288 |
+
wp_nonce_field('GmediaGallery');
|
289 |
+
?>
|
290 |
+
</form>
|
291 |
+
</div>
|
292 |
+
|
293 |
+
<div class="modal fade gmedia-modal" id="libModal" tabindex="-1" role="dialog" aria-hidden="true">
|
294 |
+
<div class="modal-dialog"></div>
|
295 |
+
</div>
|
admin/pages/galleries/tpl/choose-module.php
CHANGED
@@ -39,17 +39,20 @@ global $gmCore, $gmDB, $gmGallery;
|
|
39 |
}
|
40 |
$mclass = ' module-' . $module_info['type'] . ' module-' . $module_info['status'];
|
41 |
?>
|
42 |
-
<div
|
43 |
-
<a href="<?php echo
|
44 |
-
<img class="media-object" src="<?php echo $module_url . '/screenshot.png'; ?>" alt="<?php esc_attr_e($module_info['title']); ?>" width="
|
45 |
</a>
|
46 |
|
47 |
<div class="media-body" style="margin-left:180px;">
|
48 |
<h4 class="media-heading"><?php echo $module_info['title']; ?></h4>
|
49 |
-
|
50 |
-
<
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
53 |
</div>
|
54 |
</div>
|
55 |
<?php
|
39 |
}
|
40 |
$mclass = ' module-' . $module_info['type'] . ' module-' . $module_info['status'];
|
41 |
?>
|
42 |
+
<div class="choose-module media<?php echo $mclass; ?>">
|
43 |
+
<a class="thumbnail pull-left" role="button" data-toggle="collapse" href="#collapseDescr_<?php echo $module_name; ?>" aria-expanded="false" aria-controls="collapseDescr_<?php echo $module_name; ?>">
|
44 |
+
<img class="media-object" src="<?php echo $module_url . '/screenshot.png'; ?>" alt="<?php esc_attr_e($module_info['title']); ?>" width="100"/>
|
45 |
</a>
|
46 |
|
47 |
<div class="media-body" style="margin-left:180px;">
|
48 |
<h4 class="media-heading"><?php echo $module_info['title']; ?></h4>
|
49 |
+
<p class="version" style="margin: 6px 0;"><?php echo __('Version', 'grand-media') . ': ' . $module_info['version']; ?></p>
|
50 |
+
<div class="description collapse" id="collapseDescr_<?php echo $module_name; ?>"><?php echo nl2br($module_info['description']); ?></div>
|
51 |
+
<div class="action-buttons text-right">
|
52 |
+
<a href="<?php echo $gmCore->get_admin_url(array('page' => 'GrandMedia_Modules', 'preset_module' => $module_name), array(), admin_url('admin.php')); ?>" class="btn btn-default"><?php _e('Create Preset', 'grand-media'); ?></a>
|
53 |
+
|
54 |
+
<a href="<?php echo add_query_arg(array('gallery_module' => $module_name), $gmedia_url); ?>" class="btn btn-primary"><?php _e('Create Gallery', 'grand-media'); ?></a>
|
55 |
+
</div>
|
56 |
</div>
|
57 |
</div>
|
58 |
<?php
|
admin/pages/galleries/tpl/gallery-panel-heading.php
CHANGED
@@ -13,7 +13,7 @@ if(!defined('ABSPATH')){
|
|
13 |
*/
|
14 |
$curpage = $gmCore->_get('page', 'GrandMedia');
|
15 |
$refurl = strpos(wp_get_referer(), "page={$curpage}")? wp_get_referer() : $gmProcessor->url;
|
16 |
-
$referer = remove_query_arg(array('edit_term', '
|
17 |
?>
|
18 |
<div class="panel-heading-fake"></div>
|
19 |
<div class="panel-heading clearfix">
|
13 |
*/
|
14 |
$curpage = $gmCore->_get('page', 'GrandMedia');
|
15 |
$refurl = strpos(wp_get_referer(), "page={$curpage}")? wp_get_referer() : $gmProcessor->url;
|
16 |
+
$referer = remove_query_arg(array('edit_term', 'gallery_module'), $refurl);
|
17 |
?>
|
18 |
<div class="panel-heading-fake"></div>
|
19 |
<div class="panel-heading clearfix">
|
admin/pages/galleries/tpl/module-settings.php
CHANGED
@@ -112,6 +112,13 @@ global $gmGallery;
|
|
112 |
theme: 'bootstrap'
|
113 |
});
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
$('[data-watch]', main).each(function() {
|
116 |
var el = $(this);
|
117 |
gmedia_options_conditional_logic(el, 0);
|
112 |
theme: 'bootstrap'
|
113 |
});
|
114 |
|
115 |
+
$('input', main).filter('[data-type="rgba"]').spectrum({
|
116 |
+
showInput: true,
|
117 |
+
showAlpha: true,
|
118 |
+
allowEmpty: false,
|
119 |
+
preferredFormat: 'rgb'
|
120 |
+
});
|
121 |
+
|
122 |
$('[data-watch]', main).each(function() {
|
123 |
var el = $(this);
|
124 |
gmedia_options_conditional_logic(el, 0);
|
admin/pages/library/tpl/edit-item.php
CHANGED
@@ -1,285 +1,302 @@
|
|
1 |
<?php
|
2 |
// don't load directly
|
3 |
-
if(!defined('ABSPATH')){
|
4 |
-
|
5 |
}
|
6 |
|
7 |
/**
|
8 |
* Edit Gmedia Item
|
9 |
*/
|
10 |
?>
|
11 |
-
<form class="cb_list-item list-group-item row d-row edit-gmedia <?php echo implode(' ', $item->classes); ?>" id="list-item-<?php echo $item->ID; ?>" data-id="<?php echo $item->ID; ?>" data-type="<?php echo $item->type; ?>" role="form">
|
12 |
<div class="col-sm-4" style="max-width:340px;">
|
13 |
<input name="ID" type="hidden" value="<?php echo $item->ID; ?>"/>
|
14 |
<div class="thumbwrap">
|
15 |
<div class="cb_media-object">
|
16 |
<span data-clicktarget="gmimageedit<?php echo $item->ID; ?>" class="thumbnail gmedia-cover-image">
|
17 |
-
<?php echo gmedia_item_thumbnail($item); ?>
|
18 |
</span>
|
19 |
</div>
|
20 |
-
<label class="gm-item-check"><input name="doaction[]" type="checkbox"<?php echo $item->selected? ' checked="checked"' : ''; ?> data-type="<?php echo $item->type; ?>" value="<?php echo $item->ID; ?>"/></label>
|
21 |
-
<label class="gm-stack hidden"><input name="stack[]" type="checkbox"<?php echo $item->in_stack? ' checked="checked"' : ''; ?> data-type="<?php echo $item->type; ?>" value="<?php echo $item->ID; ?>"/></label>
|
22 |
</div>
|
23 |
<div class="gmedia-actions">
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
</div>
|
29 |
-
<?php
|
30 |
-
if('audio' == $item->type){
|
31 |
-
echo gmedia_waveform_player($item);
|
32 |
-
}
|
33 |
-
?>
|
34 |
</div>
|
35 |
<div class="col-sm-8">
|
36 |
<div class="row">
|
37 |
<div class="form-group col-lg-6">
|
38 |
-
<label><?php _e('Title', 'grand-media'); ?></label>
|
39 |
-
<input name="title" type="text" class="form-control input-sm" placeholder="<?php _e('Title', 'grand-media'); ?>" value="<?php esc_attr_e($item->title); ?>">
|
40 |
</div>
|
41 |
<div class="form-group col-lg-6">
|
42 |
-
<label><?php _e('Link URL', 'grand-media'); ?></label>
|
43 |
<div class="input-group">
|
44 |
<input name="link" type="text" class="form-control input-sm gmedia-custom-link-field" id="gmlink<?php echo $item->ID; ?>" value="<?php echo $item->link; ?>"/>
|
45 |
-
<span class="input-group-btn"><button type="button" class="btn btn-sm btn-primary gmedia-custom-link" data-target="gmlink<?php echo $item->ID; ?>" title="<?php _e('Link to existing WP content', 'grand-media'); ?>"><span class="glyphicon glyphicon-link"></span></button></span>
|
46 |
</div>
|
47 |
</div>
|
48 |
</div>
|
49 |
<div class="row">
|
50 |
<div class="form-group col-lg-6">
|
51 |
-
<label><?php _e('Description', 'grand-media'); ?></label>
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
65 |
</div>
|
66 |
<div class="col-lg-6">
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
<div class="form-group status-album bg-status-<?php echo $album_status; ?>">
|
103 |
-
<label><?php _e('Album ', 'grand-media'); ?></label>
|
104 |
-
<input type="text" class="gm-order-input" name="gmedia_album_order" title="<?php _e('Sort order (custom) in the chosen Album', 'grand-media'); ?>" value="<?php echo $alb_id? reset($item->album)->gmedia_order : '0'; ?>" <?php echo $alb_id? '' : 'disabled' ?>/>
|
105 |
-
<select name="terms[gmedia_album]" data-create="<?php echo gm_user_can('album_manage')? 'true' : 'false'; ?>" class="combobox_gmedia_album form-control input-sm" placeholder="<?php _e('Album Name...', 'grand-media'); ?>">
|
106 |
-
<option<?php echo $alb_id? '' : ' selected="selected"'; ?> value=""></option>
|
107 |
-
|
108 |
</select>
|
109 |
</div>
|
110 |
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
<div class="form-group">
|
123 |
-
<label><?php _e('Categories', 'grand-media'); ?></label>
|
124 |
-
<input name="terms[gmedia_category]" data-create="<?php echo gm_user_can('category_manage')? 'true' : 'false'; ?>" class="combobox_gmedia_category form-control input-sm" value="<?php echo $terms_category; ?>" placeholder="<?php _e('Uncategorized', 'grand-media'); ?>"/>
|
125 |
</div>
|
126 |
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
<div class="form-group">
|
139 |
-
<label><?php _e('Tags ', 'grand-media'); ?></label>
|
140 |
-
<input name="terms[gmedia_tag]" data-create="<?php echo gm_user_can('tag_manage')? 'true' : 'false'; ?>" class="combobox_gmedia_tag form-control input-sm" value="<?php echo $terms_tag; ?>"/>
|
141 |
</div>
|
142 |
-
|
143 |
</div>
|
144 |
</div>
|
145 |
<div class="row">
|
146 |
<div class="col-lg-6">
|
147 |
-
|
148 |
<div class="form-group">
|
149 |
-
<label><?php _e('Alternative Text', 'grand-media'); ?></label>
|
150 |
-
<input type="text" class="form-control input-sm" name="meta[_image_alt]" value="<?php echo isset($item->meta['_image_alt'][0])? esc_attr($item->meta['_image_alt'][0]) : ''; ?>" placeholder="<?php _e('if empty, same as Title', 'grand-media'); ?>"/>
|
151 |
</div>
|
152 |
-
|
153 |
<div class="form-group">
|
154 |
-
<label><?php _e('Filename', 'grand-media'); ?>
|
155 |
<small style="white-space:nowrap;">(ext: .<?php echo $item->ext; ?>)</small>
|
156 |
</label>
|
157 |
-
<input name="filename" type="text" class="form-control input-sm gmedia-filename" <?php echo (!gm_user_can('delete_others_media') && ((int)$item->author !== $user_ID))? 'readonly' : ''; ?> value="<?php echo pathinfo($item->gmuid, PATHINFO_FILENAME); ?>"/>
|
158 |
</div>
|
159 |
<div class="form-group">
|
160 |
-
<label><?php _e('Date', 'grand-media'); ?></label>
|
161 |
|
162 |
<div class="input-group gmedia_date input-group-sm" data-date-format="YYYY-MM-DD HH:mm:ss">
|
163 |
<input name="date" type="text" readonly="readonly" class="form-control input-sm" value="<?php echo $item->date; ?>"/>
|
164 |
-
|
165 |
<span class="glyphicon glyphicon-calendar"></span></button></span>
|
166 |
</div>
|
167 |
</div>
|
168 |
<div class="form-group status-item bg-status-<?php echo $item->status; ?>">
|
169 |
-
<label><?php _e('Status', 'grand-media'); ?></label>
|
170 |
<select name="status" class="form-control input-sm">
|
171 |
-
<option <?php selected($item->status, 'publish'); ?> value="publish"><?php _e('Public', 'grand-media'); ?></option>
|
172 |
-
<option <?php selected($item->status, 'private'); ?> value="private"><?php _e('Private', 'grand-media'); ?></option>
|
173 |
-
<option <?php selected($item->status, 'draft'); ?> value="draft"><?php _e('Draft', 'grand-media'); ?></option>
|
174 |
</select>
|
175 |
</div>
|
176 |
-
|
177 |
<div class="form-group">
|
178 |
-
<a href="<?php echo add_query_arg(array('page' => 'GrandMedia', 'gmediablank' => 'comments', 'gmedia_id' => $item->ID), $gmProcessor->url); ?>" data-target="#previewModal" data-width="900" data-height="500" class="preview-modal gmpost-com-count pull-right" title="<?php esc_attr_e('Comments', 'grand-media'); ?>">
|
179 |
<b class="comment-count"><?php echo $item->comment_count; ?></b>
|
180 |
<span class="glyphicon glyphicon-comment"></span>
|
181 |
</a>
|
182 |
-
<label><?php _e('Comment Status', 'grand-media'); ?></label>
|
183 |
<select name="comment_status" class="form-control input-sm">
|
184 |
-
<option <?php selected($item->comment_status, 'open'); ?> value="open"><?php _e('Open', 'grand-media'); ?></option>
|
185 |
-
<option <?php selected($item->comment_status, 'closed'); ?> value="closed"><?php _e('Closed', 'grand-media'); ?></option>
|
186 |
</select>
|
187 |
</div>
|
188 |
-
|
189 |
</div>
|
190 |
<div class="col-lg-6">
|
191 |
-
|
192 |
-
<label><?php _e('Author', 'grand-media'); ?></label>
|
193 |
-
<?php $user_ids = gm_user_can('delete_others_media')? $gmCore->get_editable_user_ids() : false;
|
194 |
-
if($user_ids){
|
195 |
-
if(!in_array($user_ID, $user_ids)){
|
196 |
-
array_push($user_ids, $user_ID);
|
197 |
-
}
|
198 |
-
wp_dropdown_users(array('include' => $user_ids,
|
199 |
-
'include_selected' => true,
|
200 |
-
'name' => 'author',
|
201 |
-
'selected' => $item->author,
|
202 |
-
'class' => 'form-control',
|
203 |
-
'multi' => true
|
204 |
-
));
|
205 |
-
} else{
|
206 |
-
echo '<input type="hidden" name="author" value="' . $item->author . '"/>';
|
207 |
-
echo '<div>' . get_the_author_meta('display_name', $item->author) . '</div>';
|
208 |
-
}
|
209 |
-
?>
|
210 |
-
</div>
|
211 |
-
<?php if('image' != $item->type || ('image' == $item->type && !$item->editor)){ ?>
|
212 |
<div class="form-group">
|
213 |
-
<label><?php _e('Custom Cover', 'grand-media');
|
214 |
-
|
215 |
<div class="input-group">
|
216 |
-
<input type="text" class="form-control input-sm gmedia-cover-id" name="meta[_cover]" value="<?php echo isset($item->meta['_cover'][0])? $item->meta['_cover'][0] : ''; ?>" placeholder="<?php _e('Gmedia Image ID', 'grand-media'); ?>"/>
|
217 |
-
<span class="input-group-btn"><a href="<?php echo $gmCore->get_admin_url(array(
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
|
|
222 |
</div>
|
223 |
</div>
|
224 |
-
|
225 |
-
|
226 |
<div class="form-group">
|
227 |
-
<label><?php _e('GPS Location', 'grand-media'); ?></label>
|
228 |
|
229 |
<div class="input-group input-group-sm">
|
230 |
-
<input name="meta[_gps]" type="text" class="form-control input-sm gps_map_coordinates" value="<?php echo $item->gps; ?>" placeholder="<?php _e('Latitude, Longtitude', 'grand-media'); ?>" autocomplete="off"/>
|
231 |
-
|
232 |
<span class="glyphicon glyphicon-map-marker"></span></a></span>
|
233 |
</div>
|
234 |
</div>
|
235 |
-
|
236 |
<p class="media-meta">
|
237 |
-
<span class="label label-default"><?php _e('
|
238 |
-
<br/><span class="label label-default"><?php _e('
|
239 |
-
<br/><span class="label label-default"><?php _e('
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
|
|
245 |
<a href="<?php echo $item->url_original; ?>"
|
246 |
data-target="#previewModal"
|
247 |
data-width="<?php echo $item->meta['_metadata'][0]['original']['width']; ?>"
|
248 |
data-height="<?php echo $item->meta['_metadata'][0]['original']['height']; ?>"
|
249 |
class="preview-modal"
|
250 |
-
title="<?php _e('Original', 'grand-media'); ?>"><?php echo $item->meta['_metadata'][0]['original']['width'] . '×' . $item->meta['_metadata'][0]['original']['height']; ?></a>,
|
251 |
-
|
252 |
-
<span title="<?php _e('Original', 'grand-media'); ?>"><?php echo $item->meta['_metadata'][0]['original']['width'] . '×' . $item->meta['_metadata'][0]['original']['height']; ?></span>,
|
253 |
-
|
254 |
<a href="<?php echo $item->url; ?>"
|
255 |
data-target="#previewModal"
|
256 |
data-width="<?php echo $item->meta['_metadata'][0]['web']['width']; ?>"
|
257 |
data-height="<?php echo $item->meta['_metadata'][0]['web']['height']; ?>"
|
258 |
class="preview-modal"
|
259 |
-
title="<?php _e('Webimage', 'grand-media'); ?>"><?php echo $item->meta['_metadata'][0]['web']['width'] . '×' . $item->meta['_metadata'][0]['web']['height']; ?></a>,
|
260 |
<a href="<?php echo $item->url_thumb; ?>"
|
261 |
data-target="#previewModal"
|
262 |
data-width="<?php echo $item->meta['_metadata'][0]['thumb']['width']; ?>"
|
263 |
data-height="<?php echo $item->meta['_metadata'][0]['thumb']['height']; ?>"
|
264 |
class="preview-modal"
|
265 |
-
title="<?php _e('Thumbnail', 'grand-media'); ?>"><?php echo $item->meta['_metadata'][0]['thumb']['width'] . '×' . $item->meta['_metadata'][0]['thumb']['height']; ?></a>
|
266 |
-
<br/><span class="label label-default"><?php _e('File Size', 'grand-media') ?>:</span> <?php
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
<br/><span class="label label-default"><?php _e('File Size', 'grand-media') ?>:</span> <?php echo $gmCore->filesize($item->path); ?>
|
271 |
-
|
272 |
-
|
273 |
-
<br/><span class="label label-default"><?php _e('Created', 'grand-media') ?>:</span> <?php echo date('Y-m-d H:i:s ', $item->meta['_created_timestamp'][0]); ?>
|
274 |
-
|
275 |
-
<br/><span class="label label-default"><?php _e('Uploaded', 'grand-media') ?>:</span> <?php echo $item->date; ?>
|
276 |
-
<br/><span class="label label-default"><?php _e('Last Edited', 'grand-media') ?>:</span> <span class="gm-last-edited modified"><?php echo $item->modified; ?></span>
|
277 |
</p>
|
278 |
</div>
|
279 |
</div>
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
</div>
|
285 |
</form>
|
1 |
<?php
|
2 |
// don't load directly
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
+
die( '-1' );
|
5 |
}
|
6 |
|
7 |
/**
|
8 |
* Edit Gmedia Item
|
9 |
*/
|
10 |
?>
|
11 |
+
<form class="cb_list-item list-group-item row d-row edit-gmedia <?php echo implode( ' ', $item->classes ); ?>" id="list-item-<?php echo $item->ID; ?>" data-id="<?php echo $item->ID; ?>" data-type="<?php echo $item->type; ?>" role="form">
|
12 |
<div class="col-sm-4" style="max-width:340px;">
|
13 |
<input name="ID" type="hidden" value="<?php echo $item->ID; ?>"/>
|
14 |
<div class="thumbwrap">
|
15 |
<div class="cb_media-object">
|
16 |
<span data-clicktarget="gmimageedit<?php echo $item->ID; ?>" class="thumbnail gmedia-cover-image">
|
17 |
+
<?php echo gmedia_item_thumbnail( $item ); ?>
|
18 |
</span>
|
19 |
</div>
|
20 |
+
<label class="gm-item-check"><input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> data-type="<?php echo $item->type; ?>" value="<?php echo $item->ID; ?>"/></label>
|
21 |
+
<label class="gm-stack hidden"><input name="stack[]" type="checkbox"<?php echo $item->in_stack ? ' checked="checked"' : ''; ?> data-type="<?php echo $item->type; ?>" value="<?php echo $item->ID; ?>"/></label>
|
22 |
</div>
|
23 |
<div class="gmedia-actions">
|
24 |
+
<?php $media_action_links = gmedia_item_actions( $item );
|
25 |
+
unset( $media_action_links['edit_data'] );
|
26 |
+
echo implode( ' | ', $media_action_links );
|
27 |
+
?>
|
28 |
+
</div>
|
29 |
+
<?php
|
30 |
+
if ( 'audio' == $item->type ) {
|
31 |
+
echo gmedia_waveform_player( $item );
|
32 |
+
}
|
33 |
+
?>
|
34 |
+
<div class="form-group">
|
35 |
+
<label><?php _e( 'Related Media', 'grand-media' ); ?>:
|
36 |
+
<a href="<?php echo $gmCore->get_admin_url(
|
37 |
+
array(
|
38 |
+
'page' => 'GrandMedia',
|
39 |
+
'mode' => 'select_multiple',
|
40 |
+
'gmediablank' => 'library'
|
41 |
+
), array(), true ); ?>"
|
42 |
+
class="preview-modal"
|
43 |
+
data-target="#previewModal"
|
44 |
+
data-width="1200"
|
45 |
+
data-height="500"
|
46 |
+
data-cls="select_gmedia_related"
|
47 |
+
title="<?php _e( 'Choose Related Media', 'grand-media' ); ?>">
|
48 |
+
<?php _e( 'choose' ); ?>
|
49 |
+
<span class="glyphicon glyphicon-picture"></span>
|
50 |
+
</a>
|
51 |
+
</label>
|
52 |
+
<div class="related-media-previews">
|
53 |
+
<?php
|
54 |
+
$related_ids = isset( $item->meta['_related'][0] ) ? $item->meta['_related'][0] : array();
|
55 |
+
if(!empty($related_ids)){
|
56 |
+
$related_media = $gmDB->get_gmedias(array('gmedia__in' => $related_ids, 'orderby' => 'gmedia__in'));
|
57 |
+
foreach($related_media as $r_item){
|
58 |
+
?><p class="thumbnail gmedia-related-image">
|
59 |
+
<span class="image-wrapper"><?php echo gmedia_item_thumbnail( $r_item ); ?></span>
|
60 |
+
<span class="gm-remove">×</span>
|
61 |
+
<input type="hidden" name="meta[_related][]" value="<?php echo $r_item->ID; ?>" />
|
62 |
+
</p><?php
|
63 |
+
}
|
64 |
+
}
|
65 |
+
?>
|
66 |
+
</div>
|
67 |
</div>
|
|
|
|
|
|
|
|
|
|
|
68 |
</div>
|
69 |
<div class="col-sm-8">
|
70 |
<div class="row">
|
71 |
<div class="form-group col-lg-6">
|
72 |
+
<label><?php _e( 'Title', 'grand-media' ); ?></label>
|
73 |
+
<input name="title" type="text" class="form-control input-sm" placeholder="<?php _e( 'Title', 'grand-media' ); ?>" value="<?php esc_attr_e( $item->title ); ?>">
|
74 |
</div>
|
75 |
<div class="form-group col-lg-6">
|
76 |
+
<label><?php _e( 'Link URL', 'grand-media' ); ?></label>
|
77 |
<div class="input-group">
|
78 |
<input name="link" type="text" class="form-control input-sm gmedia-custom-link-field" id="gmlink<?php echo $item->ID; ?>" value="<?php echo $item->link; ?>"/>
|
79 |
+
<span class="input-group-btn"><button type="button" class="btn btn-sm btn-primary gmedia-custom-link" data-target="gmlink<?php echo $item->ID; ?>" title="<?php _e( 'Link to existing WP content', 'grand-media' ); ?>"><span class="glyphicon glyphicon-link"></span></button></span>
|
80 |
</div>
|
81 |
</div>
|
82 |
</div>
|
83 |
<div class="row">
|
84 |
<div class="form-group col-lg-6">
|
85 |
+
<label><?php _e( 'Description', 'grand-media' ); ?></label>
|
86 |
+
<?php if ( ( 'false' != $gmedia_user_options['library_edit_quicktags'] ) || ( $gmProcessor->gmediablank && ( 1 == $resultPerPage ) ) ) {
|
87 |
+
wp_editor( esc_textarea( $item->description ), "gm{$item->ID}_description", array(
|
88 |
+
'editor_class' => 'form-control input-sm',
|
89 |
+
'editor_height' => 140,
|
90 |
+
'wpautop' => false,
|
91 |
+
'media_buttons' => false,
|
92 |
+
'textarea_name' => 'description',
|
93 |
+
'textarea_rows' => '4',
|
94 |
+
'tinymce' => false,
|
95 |
+
'quicktags' => array( 'buttons' => apply_filters( 'gmedia_editor_quicktags', 'strong,em,link,ul,li,close' ) )
|
96 |
+
) );
|
97 |
+
} else {
|
98 |
+
echo "<textarea id='gm{$item->ID}_description' class='form-control input-sm' name='description' cols='20' rows='4' style='height:174px'>" . esc_textarea( $item->description ) . '</textarea>';
|
99 |
+
} ?>
|
100 |
</div>
|
101 |
<div class="col-lg-6">
|
102 |
+
<?php if ( gm_user_can( 'terms' ) ) { ?>
|
103 |
+
<?php
|
104 |
+
$alb_id = empty( $item->album ) ? 0 : reset( $item->album )->term_id;
|
105 |
+
$term_type = 'gmedia_album';
|
106 |
+
$args = array();
|
107 |
+
if ( ! gm_user_can( 'edit_others_media' ) ) {
|
108 |
+
$args = array( 'global' => array( 0, $user_ID ), 'orderby' => 'global_desc_name' );
|
109 |
+
}
|
110 |
+
$gm_terms = $gmDB->get_terms( $term_type, $args );
|
111 |
|
112 |
+
$terms_album = '';
|
113 |
+
$album_status = 'none';
|
114 |
+
if ( count( $gm_terms ) ) {
|
115 |
+
foreach ( $gm_terms as $term ) {
|
116 |
+
$author_name = '';
|
117 |
+
if ( $term->global ) {
|
118 |
+
if ( gm_user_can( 'edit_others_media' ) ) {
|
119 |
+
$author_name .= ' ' . sprintf( __( 'by %s', 'grand-media' ), get_the_author_meta( 'display_name', $term->global ) );
|
120 |
+
}
|
121 |
+
} else {
|
122 |
+
$author_name .= ' (' . __( 'shared', 'grand-media' ) . ')';
|
123 |
+
}
|
124 |
+
if ( 'publish' != $term->status ) {
|
125 |
+
$author_name .= ' [' . $term->status . ']';
|
126 |
+
}
|
127 |
|
128 |
+
$selected_option = '';
|
129 |
+
if ( $alb_id == $term->term_id ) {
|
130 |
+
$selected_option = ' selected="selected"';
|
131 |
+
$album_status = $term->status;
|
132 |
+
}
|
133 |
+
$terms_album .= '<option' . $selected_option . ' value="' . $term->term_id . '">' . esc_html( $term->name ) . $author_name . '</option>' . "\n";
|
134 |
+
}
|
135 |
+
}
|
136 |
+
?>
|
137 |
<div class="form-group status-album bg-status-<?php echo $album_status; ?>">
|
138 |
+
<label><?php _e( 'Album ', 'grand-media' ); ?></label>
|
139 |
+
<input type="text" class="gm-order-input" name="gmedia_album_order" title="<?php _e( 'Sort order (custom) in the chosen Album', 'grand-media' ); ?>" value="<?php echo $alb_id ? reset( $item->album )->gmedia_order : '0'; ?>" <?php echo $alb_id ? '' : 'disabled' ?>/>
|
140 |
+
<select name="terms[gmedia_album]" data-create="<?php echo gm_user_can( 'album_manage' ) ? 'true' : 'false'; ?>" class="combobox_gmedia_album form-control input-sm" placeholder="<?php _e( 'Album Name...', 'grand-media' ); ?>">
|
141 |
+
<option<?php echo $alb_id ? '' : ' selected="selected"'; ?> value=""></option>
|
142 |
+
<?php echo $terms_album; ?>
|
143 |
</select>
|
144 |
</div>
|
145 |
|
146 |
+
<?php
|
147 |
+
if ( ! empty( $item->categories ) ) {
|
148 |
+
$terms_category = array();
|
149 |
+
foreach ( $item->categories as $c ) {
|
150 |
+
$terms_category[] = esc_html( $c->name );
|
151 |
+
}
|
152 |
+
$terms_category = join( ',', $terms_category );
|
153 |
+
} else {
|
154 |
+
$terms_category = '';
|
155 |
+
}
|
156 |
+
?>
|
157 |
<div class="form-group">
|
158 |
+
<label><?php _e( 'Categories', 'grand-media' ); ?></label>
|
159 |
+
<input name="terms[gmedia_category]" data-create="<?php echo gm_user_can( 'category_manage' ) ? 'true' : 'false'; ?>" class="combobox_gmedia_category form-control input-sm" value="<?php echo $terms_category; ?>" placeholder="<?php _e( 'Uncategorized', 'grand-media' ); ?>"/>
|
160 |
</div>
|
161 |
|
162 |
+
<?php
|
163 |
+
if ( ! empty( $item->tags ) ) {
|
164 |
+
$terms_tag = array();
|
165 |
+
foreach ( $item->tags as $c ) {
|
166 |
+
$terms_tag[] = esc_html( $c->name );
|
167 |
+
}
|
168 |
+
$terms_tag = join( ',', $terms_tag );
|
169 |
+
} else {
|
170 |
+
$terms_tag = '';
|
171 |
+
}
|
172 |
+
?>
|
173 |
<div class="form-group">
|
174 |
+
<label><?php _e( 'Tags ', 'grand-media' ); ?></label>
|
175 |
+
<input name="terms[gmedia_tag]" data-create="<?php echo gm_user_can( 'tag_manage' ) ? 'true' : 'false'; ?>" class="combobox_gmedia_tag form-control input-sm" value="<?php echo $terms_tag; ?>"/>
|
176 |
</div>
|
177 |
+
<?php } ?>
|
178 |
</div>
|
179 |
</div>
|
180 |
<div class="row">
|
181 |
<div class="col-lg-6">
|
182 |
+
<?php if ( 'image' == $item->type ) { ?>
|
183 |
<div class="form-group">
|
184 |
+
<label><?php _e( 'Alternative Text', 'grand-media' ); ?></label>
|
185 |
+
<input type="text" class="form-control input-sm" name="meta[_image_alt]" value="<?php echo isset( $item->meta['_image_alt'][0] ) ? esc_attr( $item->meta['_image_alt'][0] ) : ''; ?>" placeholder="<?php _e( 'if empty, same as Title', 'grand-media' ); ?>"/>
|
186 |
</div>
|
187 |
+
<?php } ?>
|
188 |
<div class="form-group">
|
189 |
+
<label><?php _e( 'Filename', 'grand-media' ); ?>
|
190 |
<small style="white-space:nowrap;">(ext: .<?php echo $item->ext; ?>)</small>
|
191 |
</label>
|
192 |
+
<input name="filename" type="text" class="form-control input-sm gmedia-filename" <?php echo ( ! gm_user_can( 'delete_others_media' ) && ( (int) $item->author !== $user_ID ) ) ? 'readonly' : ''; ?> value="<?php echo pathinfo( $item->gmuid, PATHINFO_FILENAME ); ?>"/>
|
193 |
</div>
|
194 |
<div class="form-group">
|
195 |
+
<label><?php _e( 'Date', 'grand-media' ); ?></label>
|
196 |
|
197 |
<div class="input-group gmedia_date input-group-sm" data-date-format="YYYY-MM-DD HH:mm:ss">
|
198 |
<input name="date" type="text" readonly="readonly" class="form-control input-sm" value="<?php echo $item->date; ?>"/>
|
199 |
+
<span class="input-group-btn"><button type="button" class="btn btn-primary">
|
200 |
<span class="glyphicon glyphicon-calendar"></span></button></span>
|
201 |
</div>
|
202 |
</div>
|
203 |
<div class="form-group status-item bg-status-<?php echo $item->status; ?>">
|
204 |
+
<label><?php _e( 'Status', 'grand-media' ); ?></label>
|
205 |
<select name="status" class="form-control input-sm">
|
206 |
+
<option <?php selected( $item->status, 'publish' ); ?> value="publish"><?php _e( 'Public', 'grand-media' ); ?></option>
|
207 |
+
<option <?php selected( $item->status, 'private' ); ?> value="private"><?php _e( 'Private', 'grand-media' ); ?></option>
|
208 |
+
<option <?php selected( $item->status, 'draft' ); ?> value="draft"><?php _e( 'Draft', 'grand-media' ); ?></option>
|
209 |
</select>
|
210 |
</div>
|
211 |
+
<?php if ( ! empty( $item->post_id ) ) { ?>
|
212 |
<div class="form-group">
|
213 |
+
<a href="<?php echo add_query_arg( array( 'page' => 'GrandMedia', 'gmediablank' => 'comments', 'gmedia_id' => $item->ID ), $gmProcessor->url ); ?>" data-target="#previewModal" data-width="900" data-height="500" class="preview-modal gmpost-com-count pull-right" title="<?php esc_attr_e( 'Comments', 'grand-media' ); ?>">
|
214 |
<b class="comment-count"><?php echo $item->comment_count; ?></b>
|
215 |
<span class="glyphicon glyphicon-comment"></span>
|
216 |
</a>
|
217 |
+
<label><?php _e( 'Comment Status', 'grand-media' ); ?></label>
|
218 |
<select name="comment_status" class="form-control input-sm">
|
219 |
+
<option <?php selected( $item->comment_status, 'open' ); ?> value="open"><?php _e( 'Open', 'grand-media' ); ?></option>
|
220 |
+
<option <?php selected( $item->comment_status, 'closed' ); ?> value="closed"><?php _e( 'Closed', 'grand-media' ); ?></option>
|
221 |
</select>
|
222 |
</div>
|
223 |
+
<?php } ?>
|
224 |
</div>
|
225 |
<div class="col-lg-6">
|
226 |
+
<?php if ( 'image' != $item->type || ( 'image' == $item->type && ! $item->editor ) ) { ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
<div class="form-group">
|
228 |
+
<label><?php _e( 'Custom Cover', 'grand-media' );
|
229 |
+
echo ' <small>(' . __( 'media image ID', 'grand-media' ) . ')</small>'; ?></label>
|
230 |
<div class="input-group">
|
231 |
+
<input type="text" class="form-control input-sm gmedia-cover-id" name="meta[_cover]" value="<?php echo isset( $item->meta['_cover'][0] ) ? $item->meta['_cover'][0] : ''; ?>" placeholder="<?php _e( 'Gmedia Image ID', 'grand-media' ); ?>"/>
|
232 |
+
<span class="input-group-btn"><a href="<?php echo $gmCore->get_admin_url( array(
|
233 |
+
'page' => 'GrandMedia',
|
234 |
+
'mode' => 'select_single',
|
235 |
+
'gmediablank' => 'library',
|
236 |
+
'filter' => 'image'
|
237 |
+
), array(), true ); ?>" class="btn btn-sm btn-primary preview-modal" data-target="#previewModal" data-width="1200" data-height="500" data-cls="select_gmedia_image" title="<?php _e( 'Choose Cover Image', 'grand-media' ); ?>"><span class="glyphicon glyphicon-picture"></span></a></span>
|
238 |
</div>
|
239 |
</div>
|
240 |
+
<?php } ?>
|
241 |
+
<?php if ( ( 'image' == $item->type ) || ( 'video' == $item->type ) ) { ?>
|
242 |
<div class="form-group">
|
243 |
+
<label><?php _e( 'GPS Location', 'grand-media' ); ?></label>
|
244 |
|
245 |
<div class="input-group input-group-sm">
|
246 |
+
<input name="meta[_gps]" type="text" class="form-control input-sm gps_map_coordinates" value="<?php echo $item->gps; ?>" placeholder="<?php _e( 'Latitude, Longtitude', 'grand-media' ); ?>" autocomplete="off"/>
|
247 |
+
<span class="input-group-btn"><a href="<?php echo add_query_arg( array( 'page' => 'GrandMedia', 'gmediablank' => 'map_editor', 'id' => $item->ID ), $gmProcessor->url ); ?>" class="btn btn-primary gmedit-modal" data-target="#gmeditModal">
|
248 |
<span class="glyphicon glyphicon-map-marker"></span></a></span>
|
249 |
</div>
|
250 |
</div>
|
251 |
+
<?php } ?>
|
252 |
<p class="media-meta">
|
253 |
+
<span class="label label-default"><?php _e( 'Author', 'grand-media' ); ?>:</span> <?php echo get_the_author_meta( 'display_name', $item->author ); ?>
|
254 |
+
<br/><span class="label label-default"><?php _e( 'ID', 'grand-media' ) ?>:</span> <strong><?php echo $item->ID; ?></strong>
|
255 |
+
<br/><span class="label label-default"><?php _e( 'Post ID', 'grand-media' ) ?>:</span> <strong><?php echo $item->post_id; ?></strong>
|
256 |
+
<br/><span class="label label-default"><?php _e( 'Type', 'grand-media' ); ?>:</span> <?php echo $item->mime_type; ?>
|
257 |
+
<?php if ( ( 'image' == $item->type ) && $item->editor && ! empty( $item->meta['_metadata'] ) ) { ?>
|
258 |
+
<br/><span class="label label-default"><?php _e( 'Dimensions', 'grand-media' ); ?>:</span>
|
259 |
+
<?php
|
260 |
+
$is_file_original = (bool) $item->path_original;
|
261 |
+
if ( $is_file_original ) { ?>
|
262 |
<a href="<?php echo $item->url_original; ?>"
|
263 |
data-target="#previewModal"
|
264 |
data-width="<?php echo $item->meta['_metadata'][0]['original']['width']; ?>"
|
265 |
data-height="<?php echo $item->meta['_metadata'][0]['original']['height']; ?>"
|
266 |
class="preview-modal"
|
267 |
+
title="<?php _e( 'Original', 'grand-media' ); ?>"><?php echo $item->meta['_metadata'][0]['original']['width'] . '×' . $item->meta['_metadata'][0]['original']['height']; ?></a>,
|
268 |
+
<?php } else { ?>
|
269 |
+
<span title="<?php _e( 'Original', 'grand-media' ); ?>"><?php echo $item->meta['_metadata'][0]['original']['width'] . '×' . $item->meta['_metadata'][0]['original']['height']; ?></span>,
|
270 |
+
<?php } ?>
|
271 |
<a href="<?php echo $item->url; ?>"
|
272 |
data-target="#previewModal"
|
273 |
data-width="<?php echo $item->meta['_metadata'][0]['web']['width']; ?>"
|
274 |
data-height="<?php echo $item->meta['_metadata'][0]['web']['height']; ?>"
|
275 |
class="preview-modal"
|
276 |
+
title="<?php _e( 'Webimage', 'grand-media' ); ?>"><?php echo $item->meta['_metadata'][0]['web']['width'] . '×' . $item->meta['_metadata'][0]['web']['height']; ?></a>,
|
277 |
<a href="<?php echo $item->url_thumb; ?>"
|
278 |
data-target="#previewModal"
|
279 |
data-width="<?php echo $item->meta['_metadata'][0]['thumb']['width']; ?>"
|
280 |
data-height="<?php echo $item->meta['_metadata'][0]['thumb']['height']; ?>"
|
281 |
class="preview-modal"
|
282 |
+
title="<?php _e( 'Thumbnail', 'grand-media' ); ?>"><?php echo $item->meta['_metadata'][0]['thumb']['width'] . '×' . $item->meta['_metadata'][0]['thumb']['height']; ?></a>
|
283 |
+
<br/><span class="label label-default"><?php _e( 'File Size', 'grand-media' ) ?>:</span> <?php
|
284 |
+
echo ( $is_file_original ? $gmCore->filesize( $item->path_original ) : '—' ) . ', ';
|
285 |
+
echo $gmCore->filesize( $item->path ) . ', ' . $gmCore->filesize( $item->path_thumb ); ?>
|
286 |
+
<?php } else { ?>
|
287 |
+
<br/><span class="label label-default"><?php _e( 'File Size', 'grand-media' ) ?>:</span> <?php echo $gmCore->filesize( $item->path ); ?>
|
288 |
+
<?php } ?>
|
289 |
+
<?php if ( ! empty( $item->meta['_created_timestamp'][0] ) ) { ?>
|
290 |
+
<br/><span class="label label-default"><?php _e( 'Created', 'grand-media' ) ?>:</span> <?php echo date( 'Y-m-d H:i:s ', $item->meta['_created_timestamp'][0] ); ?>
|
291 |
+
<?php } ?>
|
292 |
+
<br/><span class="label label-default"><?php _e( 'Uploaded', 'grand-media' ) ?>:</span> <?php echo $item->date; ?>
|
293 |
+
<br/><span class="label label-default"><?php _e( 'Last Edited', 'grand-media' ) ?>:</span> <span class="gm-last-edited modified"><?php echo $item->modified; ?></span>
|
294 |
</p>
|
295 |
</div>
|
296 |
</div>
|
297 |
+
<?php
|
298 |
+
$gmCore->gmedia_custom_meta_box( $item->ID );
|
299 |
+
do_action( 'gmedia_edit_form' );
|
300 |
+
?>
|
301 |
</div>
|
302 |
</form>
|
admin/pages/library/tpl/list-item.php
CHANGED
@@ -28,6 +28,17 @@ if(!defined('ABSPATH')) {
|
|
28 |
echo gmedia_waveform_player($item);
|
29 |
}
|
30 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
</div>
|
32 |
<div class="col-sm-8">
|
33 |
<div class="row" style="margin:0;">
|
28 |
echo gmedia_waveform_player($item);
|
29 |
}
|
30 |
?>
|
31 |
+
<div class="related-media-previews">
|
32 |
+
<?php
|
33 |
+
$related_ids = isset( $item->meta['_related'][0] ) ? $item->meta['_related'][0] : array();
|
34 |
+
if(!empty($related_ids)){
|
35 |
+
$related_media = $gmDB->get_gmedias(array('gmedia__in' => $related_ids, 'orderby' => 'gmedia__in'));
|
36 |
+
foreach($related_media as $r_item){
|
37 |
+
?><p class="thumbnail gmedia-related-image"><span class="image-wrapper"><?php echo gmedia_item_thumbnail( $r_item ); ?></span></p><?php
|
38 |
+
}
|
39 |
+
}
|
40 |
+
?>
|
41 |
+
</div>
|
42 |
</div>
|
43 |
<div class="col-sm-8">
|
44 |
<div class="row" style="margin:0;">
|
admin/pages/modules/functions.php
CHANGED
@@ -7,19 +7,30 @@ function gmedia_module_action_buttons($module){
|
|
7 |
global $gmCore, $gmProcessor;
|
8 |
|
9 |
$buttons = array();
|
10 |
-
if('remote' == $module['place']){
|
|
|
|
|
|
|
|
|
11 |
$buttons['install'] = '<a class="btn btn-primary ' . (gm_user_can('module_manage')? 'module_install' : 'disabled') . '" data-module="' . $module['name'] . '" data-loading-text="' . __('Loading...', 'grand-media') . '" href="' . esc_url($module['download']) . '">' . __('Install Module', 'grand-media') . '</a>';
|
12 |
-
}
|
13 |
-
$buttons['create'] = '<a class="btn btn-success" href="' . $gmCore->get_admin_url(array('page' => 'GrandMedia_Galleries', 'gallery_module' => $module['
|
14 |
}
|
15 |
if(!empty($module['demo']) && $module['demo'] != '#'){
|
16 |
$buttons['demo'] = '<a class="btn btn-default" target="_blank" href="' . $module['demo'] . '">' . __('View Demo', 'grand-media') . '</a>';
|
17 |
}
|
18 |
if(!empty($module['update']) && 'remote' != $module['place']){
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
-
if(('
|
22 |
-
$buttons['delete'] = '<a class="btn btn-danger" href="' . wp_nonce_url($gmCore->get_admin_url(array('delete_module' => $module['
|
23 |
}
|
24 |
if(!empty($module['download'])){
|
25 |
$buttons['download'] = '<a class="btn btn-link" href="' . $module['download'] . '" download="true">' . __('Download module ZIP', 'grand-media') . '</a>';
|
7 |
global $gmCore, $gmProcessor;
|
8 |
|
9 |
$buttons = array();
|
10 |
+
if(('remote' == $module['place']) && !empty($module['buy'])){
|
11 |
+
//$sale = !empty($module['sale'])? 'onsale' : '';
|
12 |
+
$buttons['buy'] = '<a class="btn btn-primary" href="' . $module['buy'] . '" target="_blank">' . __('Buy Now (no license required)', 'grand-media') . ' <span>' . $module['price'] . '</span></a>';
|
13 |
+
}
|
14 |
+
if('remote' == $module['place'] && !empty($module['download'])){
|
15 |
$buttons['install'] = '<a class="btn btn-primary ' . (gm_user_can('module_manage')? 'module_install' : 'disabled') . '" data-module="' . $module['name'] . '" data-loading-text="' . __('Loading...', 'grand-media') . '" href="' . esc_url($module['download']) . '">' . __('Install Module', 'grand-media') . '</a>';
|
16 |
+
} elseif('remote' != $module['place']){
|
17 |
+
$buttons['create'] = '<a class="btn btn-success" href="' . $gmCore->get_admin_url(array('page' => 'GrandMedia_Galleries', 'gallery_module' => $module['name']), array(), true) . '">' . __('Create Gallery', 'grand-media') . '</a>';
|
18 |
}
|
19 |
if(!empty($module['demo']) && $module['demo'] != '#'){
|
20 |
$buttons['demo'] = '<a class="btn btn-default" target="_blank" href="' . $module['demo'] . '">' . __('View Demo', 'grand-media') . '</a>';
|
21 |
}
|
22 |
if(!empty($module['update']) && 'remote' != $module['place']){
|
23 |
+
if(empty($module['buy'])) {
|
24 |
+
$buttons['update'] = '<a class="btn btn-warning module_install" data-module="' . $module['name'] . '" data-loading-text="' . __( 'Loading...', 'grand-media' ) . '" href="' . esc_url( $module['download'] ) . '">' . __( 'Update Module', 'grand-media' ) . " (v{$module['update']})</a>";
|
25 |
+
} else{
|
26 |
+
if(!empty($module['download'])) {
|
27 |
+
$buttons['update'] = '<a class="btn btn-warning module_install" data-module="' . $module['name'] . '" data-loading-text="' . __( 'Loading...', 'grand-media' ) . '" href="' . esc_url( $module['download'] ) . '">' . __( 'Update Module (license required)', 'grand-media' ) . " (v{$module['update']})</a>";
|
28 |
+
}
|
29 |
+
$buttons['update2'] = '<a class="btn btn-warning" target="_blank" href="' . esc_url( $module['buy'] ) . '">' . __( 'Download Update (no license required)', 'grand-media' ) . " (v{$module['update']})</a>";
|
30 |
+
}
|
31 |
}
|
32 |
+
if(('remote' != $module['place']) && ('phantom' != $module['name']) && gm_user_can('module_manage')){
|
33 |
+
$buttons['delete'] = '<a class="btn btn-danger" href="' . wp_nonce_url($gmCore->get_admin_url(array('delete_module' => $module['name']), array(), $gmProcessor->url), 'gmedia_module_delete', '_wpnonce_module_delete') . '">' . __('Delete Module', 'grand-media') . '</a>';
|
34 |
}
|
35 |
if(!empty($module['download'])){
|
36 |
$buttons['download'] = '<a class="btn btn-link" href="' . $module['download'] . '" download="true">' . __('Download module ZIP', 'grand-media') . '</a>';
|
admin/pages/modules/modules.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*/
|
5 |
|
6 |
// don't load directly
|
7 |
-
if(!defined('ABSPATH')){
|
8 |
die('-1');
|
9 |
}
|
10 |
|
@@ -12,6 +12,17 @@ global $gmCore, $gmProcessor, $gmGallery, $gmDB;
|
|
12 |
|
13 |
$gmedia_url = $gmProcessor->url;
|
14 |
$modules = $gmProcessor->modules;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
if(isset($modules['error'])){
|
17 |
echo $gmCore->alert('danger', $modules['error']);
|
@@ -22,52 +33,82 @@ if(isset($modules['error'])){
|
|
22 |
<div id="gmedia_modules_wrapper" data-update="<?php echo $gmGallery->options['modules_update'] ?>">
|
23 |
<div class="panel panel-default">
|
24 |
<div class="panel-heading clearfix">
|
25 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
</div>
|
29 |
<div class="panel-body" id="gmedia-msg-panel"></div>
|
30 |
-
<div class="panel-body">
|
31 |
<?php
|
32 |
// installed modules
|
33 |
-
if(!empty($modules['in'])){
|
34 |
foreach($modules['in'] as $module){
|
35 |
$module['screenshot_url'] = $module['module_url'] . '/screenshot.png';
|
36 |
-
$module['mclass'] = ' module-
|
37 |
if($module['update']){
|
38 |
$module['mclass'] .= ' module-update';
|
39 |
}
|
|
|
|
|
|
|
40 |
|
41 |
include(dirname(__FILE__) . '/tpl/module-item.php');
|
42 |
|
43 |
}
|
44 |
}
|
45 |
-
?>
|
46 |
-
</div>
|
47 |
-
</div>
|
48 |
|
49 |
-
|
50 |
-
<div class="panel panel-default">
|
51 |
-
<div class="panel-heading clearfix">
|
52 |
-
<h3 class="panel-title"><?php _e('Not Installed Modules', 'grand-media'); ?></h3>
|
53 |
-
</div>
|
54 |
-
<div class="panel-body" id="gmedia-msg-panel"></div>
|
55 |
-
<div class="panel-body">
|
56 |
<?php
|
57 |
//$out_dirpath = dirname($gmGallery->options['modules_xml']);
|
58 |
$out_dirpath = 'https://codeasily.com/gmedia_modules';
|
59 |
foreach($modules['out'] as $module){
|
60 |
-
$module['mclass']
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
$module['screenshot_url'] = $out_dirpath . '/' . $module['name'] . '.png';
|
62 |
|
63 |
include(dirname(__FILE__) . '/tpl/module-item.php');
|
64 |
|
65 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
</div>
|
67 |
</div>
|
68 |
-
|
69 |
-
|
70 |
-
?>
|
71 |
</div>
|
72 |
</div>
|
73 |
|
4 |
*/
|
5 |
|
6 |
// don't load directly
|
7 |
+
if( !defined('ABSPATH')){
|
8 |
die('-1');
|
9 |
}
|
10 |
|
12 |
|
13 |
$gmedia_url = $gmProcessor->url;
|
14 |
$modules = $gmProcessor->modules;
|
15 |
+
$tags = array();
|
16 |
+
if(!empty($modules['xml'])){
|
17 |
+
foreach($modules['xml'] as $module){
|
18 |
+
$tags = array_merge($tags, $module['tags']);
|
19 |
+
}
|
20 |
+
}
|
21 |
+
if(!empty($tags)){
|
22 |
+
$tags = array_unique($tags);
|
23 |
+
sort($tags);
|
24 |
+
}
|
25 |
+
//echo '<pre style="max-height: 500px; overflow:auto;">' . print_r($modules, true) . '</pre>';
|
26 |
|
27 |
if(isset($modules['error'])){
|
28 |
echo $gmCore->alert('danger', $modules['error']);
|
33 |
<div id="gmedia_modules_wrapper" data-update="<?php echo $gmGallery->options['modules_update'] ?>">
|
34 |
<div class="panel panel-default">
|
35 |
<div class="panel-heading clearfix">
|
36 |
+
<div class="clearfix">
|
37 |
+
<a href="#installModuleModal" class="btn btn-primary pull-right<?php echo current_user_can('manage_options')? '' : ' disabled'; ?>" data-toggle="modal"><?php _e('Install Module ZIP'); ?></a>
|
38 |
+
|
39 |
+
<div class="btn-group pull-left filter-modules" style="margin-right: 10px;">
|
40 |
+
<button type="button" data-filter="installed" class="btn btn-primary"><?php _e('Modules', 'grand-media'); ?></button>
|
41 |
+
<button type="button" data-filter="not-installed" class="btn btn-default"><?php _e('Add New', 'grand-media'); ?></button>
|
42 |
+
<button type="button" data-filter="tag-trend" class="btn btn-default"><?php _e('Trends', 'grand-media'); ?></button>
|
43 |
+
</div>
|
44 |
|
45 |
+
<?php if(!empty($tags)){ ?>
|
46 |
+
<div class="btn-group pull-left">
|
47 |
+
<button type="button" class="btn btn-default" onclick="jQuery(this).toggleClass('active');" data-toggle="collapse" data-target="#collapseFeatures" aria-expanded="false" aria-controls="collapseFeatures">
|
48 |
+
Feature Filters <span class="caret"></span>
|
49 |
+
</button>
|
50 |
+
</div>
|
51 |
+
<?php } ?>
|
52 |
+
</div>
|
53 |
+
<?php if(!empty($tags)){ ?>
|
54 |
+
<div class="collapse" id="collapseFeatures">
|
55 |
+
<div class="filter-modules" style="padding-top: 10px;">
|
56 |
+
<?php foreach($tags as $tag){ ?>
|
57 |
+
<span style="cursor: pointer;" data-filter="tag-<?php echo sanitize_key($tag); ?>" class="label label-default"><?php echo strtoupper($tag); ?></span>
|
58 |
+
<?php } ?>
|
59 |
+
</div>
|
60 |
+
</div>
|
61 |
+
<?php } ?>
|
62 |
</div>
|
63 |
<div class="panel-body" id="gmedia-msg-panel"></div>
|
64 |
+
<div class="panel-body modules-body">
|
65 |
<?php
|
66 |
// installed modules
|
67 |
+
if( !empty($modules['in'])){
|
68 |
foreach($modules['in'] as $module){
|
69 |
$module['screenshot_url'] = $module['module_url'] . '/screenshot.png';
|
70 |
+
$module['mclass'] = ' module-filtered module-installed';
|
71 |
if($module['update']){
|
72 |
$module['mclass'] .= ' module-update';
|
73 |
}
|
74 |
+
foreach($module['tags'] as $tag){
|
75 |
+
$module['mclass'] .= ' module-tag-' . sanitize_key($tag);
|
76 |
+
}
|
77 |
|
78 |
include(dirname(__FILE__) . '/tpl/module-item.php');
|
79 |
|
80 |
}
|
81 |
}
|
|
|
|
|
|
|
82 |
|
83 |
+
if( !empty($modules['out'])){ ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
<?php
|
85 |
//$out_dirpath = dirname($gmGallery->options['modules_xml']);
|
86 |
$out_dirpath = 'https://codeasily.com/gmedia_modules';
|
87 |
foreach($modules['out'] as $module){
|
88 |
+
$module['mclass'] = ' module-not-installed';
|
89 |
+
if($module['update']){
|
90 |
+
$module['mclass'] .= ' module-update';
|
91 |
+
}
|
92 |
+
foreach($module['tags'] as $tag){
|
93 |
+
$module['mclass'] .= ' module-tag-' . sanitize_key($tag);
|
94 |
+
}
|
95 |
$module['screenshot_url'] = $out_dirpath . '/' . $module['name'] . '.png';
|
96 |
|
97 |
include(dirname(__FILE__) . '/tpl/module-item.php');
|
98 |
|
99 |
+
}
|
100 |
+
}
|
101 |
+
wp_nonce_field('GmediaGallery');
|
102 |
+
?>
|
103 |
+
<div class="media nomodules nomodule-not-installed">
|
104 |
+
<h4 class="media-heading"><?php _e('No uninstalled modules', 'grand-media'); ?></h4>
|
105 |
+
</div>
|
106 |
+
<div class="media nomodules nomodule-tag">
|
107 |
+
<h4 class="media-heading"><?php _e('No modules to show', 'grand-media'); ?></h4>
|
108 |
</div>
|
109 |
</div>
|
110 |
+
</div>
|
111 |
+
|
|
|
112 |
</div>
|
113 |
</div>
|
114 |
|
admin/pages/settings/tpl/license.php
CHANGED
@@ -46,6 +46,15 @@ if( !defined('ABSPATH')){
|
|
46 |
<p class="help-block"><?php _e('Warning: You can\'t undo this operation. Checking this option you agree to delete original images. You will not be able: restore images after modification in the Image Editor; re-create web-optimized images; ...', 'grand-media'); ?></p>
|
47 |
</div>
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
<hr/>
|
50 |
<div class="form-group">
|
51 |
<label><?php _e('Gmedia Tags & Categories', 'grand-media'); ?></label>
|
46 |
<p class="help-block"><?php _e('Warning: You can\'t undo this operation. Checking this option you agree to delete original images. You will not be able: restore images after modification in the Image Editor; re-create web-optimized images; ...', 'grand-media'); ?></p>
|
47 |
</div>
|
48 |
|
49 |
+
<div class="form-group">
|
50 |
+
<label><?php _e('Disable Logs', 'grand-media') ?>:</label>
|
51 |
+
<div class="checkbox" style="margin:0;">
|
52 |
+
<input type="hidden" name="set[disable_logs]" value="0"/>
|
53 |
+
<label><input type="checkbox" name="set[disable_logs]" value="1" <?php checked($gmGallery->options['disable_logs'], '1'); ?> /> <?php _e('Disable Gmedia Logs page', 'grand-media'); ?>
|
54 |
+
</label>
|
55 |
+
</div>
|
56 |
+
</div>
|
57 |
+
|
58 |
<hr/>
|
59 |
<div class="form-group">
|
60 |
<label><?php _e('Gmedia Tags & Categories', 'grand-media'); ?></label>
|
admin/pages/terms/tpl/album-edit-item.php
CHANGED
@@ -158,6 +158,17 @@ $_module_preset = !empty($term->meta['_module_preset'][0])? $term->meta['_module
|
|
158 |
<input type="text" class="form-control input-sm" name="term[slug]" value="<?php esc_attr_e($term->slug); ?>"/>
|
159 |
</div>
|
160 |
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
<?php $cover_id = isset($term->meta['_cover'][0])? $term->meta['_cover'][0] : ''; ?>
|
162 |
<div class="form-group">
|
163 |
<label><?php _e('Album Cover', 'grand-media'); ?></label>
|
158 |
<input type="text" class="form-control input-sm" name="term[slug]" value="<?php esc_attr_e($term->slug); ?>"/>
|
159 |
</div>
|
160 |
<?php } ?>
|
161 |
+
<?php if(isset($term->post_date)){ ?>
|
162 |
+
<div class="form-group">
|
163 |
+
<label><?php _e('Date', 'grand-media'); ?></label>
|
164 |
+
|
165 |
+
<div class="input-group gmedia_date input-group-sm" data-date-format="YYYY-MM-DD HH:mm:ss">
|
166 |
+
<input name="term[post_date]" type="text" readonly="readonly" class="form-control input-sm" value="<?php echo $term->post_date; ?>"/>
|
167 |
+
<span class="input-group-btn"><button type="button" class="btn btn-primary">
|
168 |
+
<span class="glyphicon glyphicon-calendar"></span></button></span>
|
169 |
+
</div>
|
170 |
+
</div>
|
171 |
+
<?php } ?>
|
172 |
<?php $cover_id = isset($term->meta['_cover'][0])? $term->meta['_cover'][0] : ''; ?>
|
173 |
<div class="form-group">
|
174 |
<label><?php _e('Album Cover', 'grand-media'); ?></label>
|
admin/processor/class.processor.settings.php
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
/**
|
4 |
* GmediaProcessor_Settings
|
5 |
*/
|
6 |
-
class GmediaProcessor_Settings extends GmediaProcessor{
|
7 |
private static $me = null;
|
8 |
|
9 |
protected function processor(){
|
10 |
global $gmCore, $gmGallery, $gmDB;
|
11 |
|
12 |
-
if(!$gmCore->caps['gmedia_settings']){
|
13 |
wp_die(__('You are not allowed to change gmedia settings', 'grand-media'));
|
14 |
}
|
15 |
$lk_check = isset($_POST['license-key-activate']);
|
@@ -18,10 +18,10 @@ class GmediaProcessor_Settings extends GmediaProcessor{
|
|
18 |
|
19 |
$set = $gmCore->_post('set', array());
|
20 |
|
21 |
-
if(!empty($set['purchase_key']) && (empty($set['license_key']) || empty($set['license_key2']))){
|
22 |
$lk_check = true;
|
23 |
}
|
24 |
-
if(empty($set['purchase_key']) && (!empty($set['license_key']) || !empty($set['license_key2']))){
|
25 |
$set['license_name'] = '';
|
26 |
$set['purchase_key'] = '';
|
27 |
$set['license_key'] = '';
|
@@ -35,14 +35,14 @@ class GmediaProcessor_Settings extends GmediaProcessor{
|
|
35 |
}
|
36 |
if(
|
37 |
$set['endpoint'] !== $gmGallery->options['endpoint']
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
){
|
45 |
-
$flush_rewrite_rules
|
46 |
$set['flush_rewrite_rules'] = true;
|
47 |
}
|
48 |
|
@@ -51,7 +51,7 @@ class GmediaProcessor_Settings extends GmediaProcessor{
|
|
51 |
}
|
52 |
|
53 |
$capabilities = $gmCore->_post('capability', array());
|
54 |
-
if(!empty($capabilities) && current_user_can('manage_options')){
|
55 |
global $wp_roles;
|
56 |
$_roles = $wp_roles->roles;
|
57 |
$_roles = array_keys(apply_filters('editable_roles', $_roles));
|
@@ -105,7 +105,7 @@ class GmediaProcessor_Settings extends GmediaProcessor{
|
|
105 |
}
|
106 |
}
|
107 |
|
108 |
-
if(isset($set['delete_originals']) && (int)$set['delete_originals']){
|
109 |
// if (($handle = opendir($gmCore->upload['path'] . '/' . $gmGallery->options['folder']['image_original']))) {
|
110 |
// while (false !== ($file = readdir($handle))) {
|
111 |
// // do something with the file
|
@@ -114,8 +114,8 @@ class GmediaProcessor_Settings extends GmediaProcessor{
|
|
114 |
// }
|
115 |
// closedir($handle);
|
116 |
// }
|
117 |
-
$files = glob(
|
118 |
-
if(!empty($files)){
|
119 |
foreach($files as $file){
|
120 |
@unlink($file);
|
121 |
}
|
@@ -125,7 +125,7 @@ class GmediaProcessor_Settings extends GmediaProcessor{
|
|
125 |
|
126 |
update_option('gmediaOptions', $gmGallery->options);
|
127 |
if(isset($_POST['GmediaHashID_salt'])){
|
128 |
-
update_option('GmediaHashID_salt', (string)$_POST['GmediaHashID_salt']);
|
129 |
}
|
130 |
if($flush_rewrite_rules){
|
131 |
flush_rewrite_rules(false);
|
@@ -136,18 +136,20 @@ class GmediaProcessor_Settings extends GmediaProcessor{
|
|
136 |
if($lk_check){
|
137 |
check_admin_referer('gmedia_settings', '_wpnonce_settings');
|
138 |
$license_key = $gmCore->_post('set');
|
139 |
-
if(!empty($license_key['purchase_key'])){
|
140 |
global $wp_version;
|
141 |
$gmedia_ua = "WordPress/{$wp_version} | ";
|
142 |
$gmedia_ua .= 'Gmedia/' . constant('GMEDIA_VERSION');
|
143 |
|
144 |
-
$response = wp_remote_post('
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
|
|
151 |
));
|
152 |
|
153 |
if(is_wp_error($response)){
|
@@ -190,9 +192,11 @@ class GmediaProcessor_Settings extends GmediaProcessor{
|
|
190 |
$gmGallery->options['license_key'] = $_temp_options['license_key'];
|
191 |
$gmGallery->options['license_key2'] = $_temp_options['license_key2'];
|
192 |
// don't reset mobile app
|
193 |
-
$gmGallery->options['
|
194 |
-
$gmGallery->options['
|
195 |
-
$gmGallery->options['mobile_app']
|
|
|
|
|
196 |
delete_metadata('user', 0, 'gm_screen_options', '', true);
|
197 |
update_option('gmediaOptions', $gmGallery->options);
|
198 |
|
@@ -209,8 +213,8 @@ class GmediaProcessor_Settings extends GmediaProcessor{
|
|
209 |
|
210 |
}
|
211 |
|
212 |
-
public static function getMe()
|
213 |
-
if
|
214 |
self::$me = new GmediaProcessor_Settings();
|
215 |
}
|
216 |
|
3 |
/**
|
4 |
* GmediaProcessor_Settings
|
5 |
*/
|
6 |
+
class GmediaProcessor_Settings extends GmediaProcessor {
|
7 |
private static $me = null;
|
8 |
|
9 |
protected function processor(){
|
10 |
global $gmCore, $gmGallery, $gmDB;
|
11 |
|
12 |
+
if( !$gmCore->caps['gmedia_settings']){
|
13 |
wp_die(__('You are not allowed to change gmedia settings', 'grand-media'));
|
14 |
}
|
15 |
$lk_check = isset($_POST['license-key-activate']);
|
18 |
|
19 |
$set = $gmCore->_post('set', array());
|
20 |
|
21 |
+
if( !empty($set['purchase_key']) && (empty($set['license_key']) || empty($set['license_key2']))){
|
22 |
$lk_check = true;
|
23 |
}
|
24 |
+
if(empty($set['purchase_key']) && ( !empty($set['license_key']) || !empty($set['license_key2']))){
|
25 |
$set['license_name'] = '';
|
26 |
$set['purchase_key'] = '';
|
27 |
$set['license_key'] = '';
|
35 |
}
|
36 |
if(
|
37 |
$set['endpoint'] !== $gmGallery->options['endpoint']
|
38 |
+
|| $set['gmedia_post_slug'] !== $gmGallery->options['gmedia_post_slug']
|
39 |
+
|| $set['gmedia_album_post_slug'] !== $gmGallery->options['gmedia_album_post_slug']
|
40 |
+
|| $set['gmedia_gallery_post_slug'] !== $gmGallery->options['gmedia_gallery_post_slug']
|
41 |
+
|| $set['gmedia_has_archive'] !== $gmGallery->options['gmedia_has_archive']
|
42 |
+
|| $set['gmedia_album_has_archive'] !== $gmGallery->options['gmedia_album_has_archive']
|
43 |
+
|| $set['gmedia_gallery_has_archive'] !== $gmGallery->options['gmedia_gallery_has_archive']
|
44 |
){
|
45 |
+
$flush_rewrite_rules = true;
|
46 |
$set['flush_rewrite_rules'] = true;
|
47 |
}
|
48 |
|
51 |
}
|
52 |
|
53 |
$capabilities = $gmCore->_post('capability', array());
|
54 |
+
if( !empty($capabilities) && current_user_can('manage_options')){
|
55 |
global $wp_roles;
|
56 |
$_roles = $wp_roles->roles;
|
57 |
$_roles = array_keys(apply_filters('editable_roles', $_roles));
|
105 |
}
|
106 |
}
|
107 |
|
108 |
+
if(isset($set['delete_originals']) && (int) $set['delete_originals']){
|
109 |
// if (($handle = opendir($gmCore->upload['path'] . '/' . $gmGallery->options['folder']['image_original']))) {
|
110 |
// while (false !== ($file = readdir($handle))) {
|
111 |
// // do something with the file
|
114 |
// }
|
115 |
// closedir($handle);
|
116 |
// }
|
117 |
+
$files = glob($gmCore->upload['path'] . '/' . $gmGallery->options['folder']['image_original'] . '/*', GLOB_NOSORT);
|
118 |
+
if( !empty($files)){
|
119 |
foreach($files as $file){
|
120 |
@unlink($file);
|
121 |
}
|
125 |
|
126 |
update_option('gmediaOptions', $gmGallery->options);
|
127 |
if(isset($_POST['GmediaHashID_salt'])){
|
128 |
+
update_option('GmediaHashID_salt', (string) $_POST['GmediaHashID_salt']);
|
129 |
}
|
130 |
if($flush_rewrite_rules){
|
131 |
flush_rewrite_rules(false);
|
136 |
if($lk_check){
|
137 |
check_admin_referer('gmedia_settings', '_wpnonce_settings');
|
138 |
$license_key = $gmCore->_post('set');
|
139 |
+
if( !empty($license_key['purchase_key'])){
|
140 |
global $wp_version;
|
141 |
$gmedia_ua = "WordPress/{$wp_version} | ";
|
142 |
$gmedia_ua .= 'Gmedia/' . constant('GMEDIA_VERSION');
|
143 |
|
144 |
+
$response = wp_remote_post('https://codeasily.com/rest/gmedia-key.php', array(
|
145 |
+
'body' => array('key' => $license_key['purchase_key'], 'site' => site_url()),
|
146 |
+
'headers' => array(
|
147 |
+
'Content-Type' => 'application/x-www-form-urlencoded; ' . 'charset=' . get_option('blog_charset'),
|
148 |
+
'Host' => 'codeasily.com',
|
149 |
+
'User-Agent' => $gmedia_ua
|
150 |
+
),
|
151 |
+
'httpversion' => '1.0',
|
152 |
+
'timeout' => 45
|
153 |
));
|
154 |
|
155 |
if(is_wp_error($response)){
|
192 |
$gmGallery->options['license_key'] = $_temp_options['license_key'];
|
193 |
$gmGallery->options['license_key2'] = $_temp_options['license_key2'];
|
194 |
// don't reset mobile app
|
195 |
+
$gmGallery->options['site_ID'] = $_temp_options['site_ID'];
|
196 |
+
$gmGallery->options['mobile_app'] = (int)$_temp_options['mobile_app'];
|
197 |
+
if($gmGallery->options['mobile_app'] && isset($_temp_options['gmedia_service'])){
|
198 |
+
$gmGallery->options['gmedia_service'] = $_temp_options['gmedia_service'];
|
199 |
+
}
|
200 |
delete_metadata('user', 0, 'gm_screen_options', '', true);
|
201 |
update_option('gmediaOptions', $gmGallery->options);
|
202 |
|
213 |
|
214 |
}
|
215 |
|
216 |
+
public static function getMe(){
|
217 |
+
if(self::$me == null){
|
218 |
self::$me = new GmediaProcessor_Settings();
|
219 |
}
|
220 |
|
admin/support.php
ADDED
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])){
|
3 |
+
die('You are not allowed to call this page directly.');
|
4 |
+
}
|
5 |
+
|
6 |
+
/**
|
7 |
+
* gmediaSupport()
|
8 |
+
* @return void content
|
9 |
+
*/
|
10 |
+
function gmediaSupport(){
|
11 |
+
global $gmCore, $gmGallery;
|
12 |
+
$current_user = wp_get_current_user();
|
13 |
+
$alert = '';
|
14 |
+
|
15 |
+
$subject = $gmCore->_post('subject');
|
16 |
+
$name = trim($gmCore->_post('name', ''));
|
17 |
+
$email = trim($gmCore->_post('email', ''));
|
18 |
+
$summary = trim($gmCore->_post('summary', ''));
|
19 |
+
$message = trim($gmCore->_post('message', ''));
|
20 |
+
|
21 |
+
$domain = trim($gmCore->_post('domain', ''));
|
22 |
+
$link = trim($gmCore->_post('link', ''));
|
23 |
+
$wp_admin_user = trim($gmCore->_post('wp_admin_user', ''));
|
24 |
+
$wp_admin_password = trim($gmCore->_post('wp_admin_password', ''));
|
25 |
+
$ftp_host = trim($gmCore->_post('ftp_host', ''));
|
26 |
+
$ftp_user = trim($gmCore->_post('ftp_user', ''));
|
27 |
+
$ftp_password = trim($gmCore->_post('ftp_password', ''));
|
28 |
+
|
29 |
+
if($subject && $name && $email && is_email($email) && $summary && $message){
|
30 |
+
$subjects = array(
|
31 |
+
'billing_issue' => 'Billing Issue',
|
32 |
+
'feature_request' => 'Feature Request',
|
33 |
+
'customization' => 'Customization',
|
34 |
+
'pre_sale_question' => 'Pre-Sale Question',
|
35 |
+
'bug' => 'Bug'
|
36 |
+
);
|
37 |
+
$title = $subjects[ $subject ];
|
38 |
+
$content = "{$summary}\r\n\r\n";
|
39 |
+
$content .= "Email: {$name} <{$email}>\r\n\r\n";
|
40 |
+
|
41 |
+
$section = '';
|
42 |
+
if($domain){
|
43 |
+
$section .= "Domain: {$domain}\r\n";
|
44 |
+
}
|
45 |
+
if($link){
|
46 |
+
$section .= "Link: {$link}\r\n";
|
47 |
+
}
|
48 |
+
if($section){
|
49 |
+
$content .= "{$section}\r\n";
|
50 |
+
$section = '';
|
51 |
+
}
|
52 |
+
if($wp_admin_user && $wp_admin_password){
|
53 |
+
$section .= "WP URI: " . wp_login_url() . "\r\n";
|
54 |
+
$section .= "WP User: {$wp_admin_user}\r\n";
|
55 |
+
$section .= "WP Pass: {$wp_admin_password}\r\n";
|
56 |
+
}
|
57 |
+
if($section){
|
58 |
+
$content .= "{$section}\r\n";
|
59 |
+
$section = '';
|
60 |
+
}
|
61 |
+
if($ftp_host && $ftp_user && $ftp_password){
|
62 |
+
$section .= "FTP Host: {$ftp_host}\r\n";
|
63 |
+
$section .= "FTP User: {$ftp_user}\r\n";
|
64 |
+
$section .= "FTP Pass: {$ftp_password}\r\n";
|
65 |
+
}
|
66 |
+
if($section){
|
67 |
+
$content .= "{$section}\r\n";
|
68 |
+
$section = '';
|
69 |
+
}
|
70 |
+
$content .= "Message: \r\n{$message}\r\n\r\n";
|
71 |
+
$headers = array(
|
72 |
+
"From: Gmedia Support <support@gmedia.gallery>",
|
73 |
+
"Reply-To: {$name} <{$email}>"
|
74 |
+
);
|
75 |
+
if(wp_mail('gmediafolder@gmail.com', $title, $content, $headers)){
|
76 |
+
$alert = $gmCore->alert('success', __('Your message has been sent! We\'ll get back to you as soon as we can.', 'grand-media'));
|
77 |
+
$subject = $name = $email = $summary = $message = $domain = $link = $wp_admin_user = $wp_admin_password = $ftp_host = $ftp_user = $ftp_password = '';
|
78 |
+
} else{
|
79 |
+
$alert = $gmCore->alert('danger', __('Can\'t send message. Something is wrong.', 'grand-media'));
|
80 |
+
}
|
81 |
+
} elseif( !empty($_POST)){
|
82 |
+
$alert = $gmCore->alert('danger', __('Fill all required (*) fields, please.', 'grand-media'));
|
83 |
+
}
|
84 |
+
|
85 |
+
?>
|
86 |
+
<div class="panel panel-default" id="gm_support">
|
87 |
+
<div class="panel-body" id="gmedia-msg-panel"><?php echo $alert; ?></div>
|
88 |
+
<form method="post" class="panel-body" id="gm_support_form">
|
89 |
+
<?php if(current_user_can('manage_options')){ ?>
|
90 |
+
<div class="container-fluid">
|
91 |
+
<div class="form-header clearfix">
|
92 |
+
<div class="alignleft">
|
93 |
+
<img src="<?php echo plugins_url('/grand-media/admin/assets/img/icon-128x128.png'); ?>" alt="" style="width:94px; height:94px;">
|
94 |
+
</div>
|
95 |
+
<div class="form-header-body">
|
96 |
+
<h1 class="form-title">Have questions? We're happy to help!</h1>
|
97 |
+
<h2 class="plugin-title">Gmedia Gallery</h2>
|
98 |
+
<h3>We'll do our best to get back to you as soon as we can.</h3>
|
99 |
+
</div>
|
100 |
+
</div>
|
101 |
+
<div class="row">
|
102 |
+
<div class="col-sm-7">
|
103 |
+
<section id="contact_form">
|
104 |
+
<div>
|
105 |
+
<fieldset>
|
106 |
+
<div class="form-group has-feedback">
|
107 |
+
<label class="control-label"><?php _e('First and Last Name', 'grand-media'); ?> *</label>
|
108 |
+
<input type="text" name="name" class="form-control" value="<?php echo $name? $name : $current_user->display_name; ?>" required>
|
109 |
+
<span class="glyphicon glyphicon-user form-control-feedback"></span>
|
110 |
+
</div>
|
111 |
+
<div class="form-group has-feedback">
|
112 |
+
<label class="control-label"><?php _e('Your Email Address', 'grand-media'); ?> *</label>
|
113 |
+
<input type="email" name="email" class="form-control" value="<?php echo $email? $email : $current_user->user_email; ?>" required>
|
114 |
+
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
|
115 |
+
</div>
|
116 |
+
<div class="form-group hidden">
|
117 |
+
<label class="control-label"><?php _e('Context', 'grand-media'); ?></label>
|
118 |
+
<select id="context_plugin" class="form-control">
|
119 |
+
<option>GmediaGallery</option>
|
120 |
+
</select>
|
121 |
+
</div>
|
122 |
+
<div class="form-group form-subjects">
|
123 |
+
<label class="control-label"><?php _e('Subject', 'grand-media'); ?> *</label>
|
124 |
+
<div class="well well-sm" style="background-color: #fff;">
|
125 |
+
<div class="radio"><label><input type="radio" name="subject" <?php /* checked($subject, 'billing_issue', true); */ ?> value="billing_issue" required data-sections=".message" data-msglabel="<?php esc_attr_e('Please describe the issue you are having. Be detailed but brief.', 'grand-media'); ?>"> <?php _e('Billing Issue', 'grand-media'); ?></label></div>
|
126 |
+
<div class="radio"><label><input type="radio" name="subject" <?php /* checked($subject, 'feature_request', true); */ ?> value="feature_request" required data-sections=".message" data-msglabel="<?php esc_attr_e('Describe the feature you would like to see added.', 'grand-media'); ?>"> <?php _e('Feature Request', 'grand-media'); ?></label></div>
|
127 |
+
<div class="radio"><label><input type="radio" name="subject" <?php /* checked($subject, 'customization', true); */ ?> value="customization" required data-sections=".site,.message" data-msglabel="<?php esc_attr_e('Please describe the use-case and the different features you would like to be custom developed for you.', 'grand-media'); ?>"> <?php _e('Customization', 'grand-media'); ?></label></div>
|
128 |
+
<div class="radio"><label><input type="radio" name="subject" <?php /* checked($subject, 'pre_sale_question', true); */ ?> value="pre_sale_question" required data-sections=".message" data-msglabel="<?php esc_attr_e('What would you like to know before purchasing?', 'grand-media'); ?>"> <?php _e('Pre-Sale Question', 'grand-media'); ?></label></div>
|
129 |
+
<div class="radio"><label><input type="radio" name="subject" <?php /* checked($subject, 'bug', true); */ ?> value="bug" required data-sections=".site,.message,.credentials" data-msglabel="<?php esc_attr_e('Please describe the bug and how to reproduce it.', 'grand-media'); ?>"> <?php _e('Bug', 'grand-media'); ?></label></div>
|
130 |
+
</div>
|
131 |
+
</div>
|
132 |
+
</fieldset>
|
133 |
+
<div class="dynamic">
|
134 |
+
<fieldset class="message">
|
135 |
+
<div class="form-group has-feedback">
|
136 |
+
<label class="control-label"><?php _e('Summary (In 10 words or less, summarize your issue or question)', 'grand-media'); ?> *</label>
|
137 |
+
<input type="text" name="summary" class="form-control" value="<?php echo $summary; ?>" required>
|
138 |
+
<span class="glyphicon glyphicon-th-large form-control-feedback"></span>
|
139 |
+
</div>
|
140 |
+
<div class="form-group has-feedback">
|
141 |
+
<label class="control-label"><span id="msglabel"><?php _e('Please describe the issue you are having. Be detailed but brief', 'grand-media'); ?></span> *</label>
|
142 |
+
<textarea name="message" cols="44" rows="10" class="form-control" required><?php echo $message ?></textarea>
|
143 |
+
<span class="glyphicon glyphicon-edit form-control-feedback"></span>
|
144 |
+
</div>
|
145 |
+
</fieldset>
|
146 |
+
<fieldset class="site">
|
147 |
+
<div class="form-group has-feedback">
|
148 |
+
<label class="control-label"><?php _e('Your Site Address', 'grand-media'); ?></label>
|
149 |
+
<input type="text" name="domain" class="form-control" value="<?php echo $domain? $domain : home_url(); ?>">
|
150 |
+
<span class="glyphicon glyphicon-globe form-control-feedback"></span>
|
151 |
+
</div>
|
152 |
+
<div class="form-group has-feedback">
|
153 |
+
<label class="control-label"><?php _e('If it\'s about a specific page on your site, please add the relevant link', 'grand-media'); ?></label>
|
154 |
+
<input type="text" name="link" class="form-control" value="<?php echo $link; ?>" placeholder="<?php printf(__('Relevant Page on Your Site (E.g. %s)', 'grand-media'), home_url('/relevant-page/')); ?>">
|
155 |
+
<span class="glyphicon glyphicon-globe form-control-feedback"></span>
|
156 |
+
</div>
|
157 |
+
</fieldset>
|
158 |
+
<fieldset class="credentials">
|
159 |
+
<h4 class="title" data-toggle="collapse" href="#wpLogin"><span><?php _e('WordPress Login', 'grand-media'); ?></span>
|
160 |
+
<small class="glyphicon glyphicon-plus"></small>
|
161 |
+
</h4>
|
162 |
+
<div id="wpLogin" class="collapse">
|
163 |
+
<div class="form-group has-feedback">
|
164 |
+
<label class="control-label"><?php _e('Username', 'grand-media'); ?></label>
|
165 |
+
<input type="text" name="wp_admin_user" class="form-control" value="<?php echo $wp_admin_user; ?>">
|
166 |
+
<span class="glyphicon glyphicon-user form-control-feedback"></span>
|
167 |
+
</div>
|
168 |
+
<div class="form-group has-feedback">
|
169 |
+
<label class="control-label"><?php _e('Password', 'grand-media'); ?></label>
|
170 |
+
<input type="password" name="wp_admin_password" class="form-control" value="<?php echo $wp_admin_password; ?>">
|
171 |
+
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
|
172 |
+
</div>
|
173 |
+
<p><?php _e('Instead of providing your primary admin account, create a new admin that can be disabled when the support case is closed.', 'grand-media'); ?></p>
|
174 |
+
</div>
|
175 |
+
</fieldset>
|
176 |
+
<fieldset class="credentials">
|
177 |
+
<h4 class="title" data-toggle="collapse" href="#ftpAccess"><span><?php _e('FTP Access', 'grand-media'); ?></span>
|
178 |
+
<small class="glyphicon glyphicon-plus"></small>
|
179 |
+
</h4>
|
180 |
+
<div id="ftpAccess" class="collapse">
|
181 |
+
<div class="form-group has-feedback">
|
182 |
+
<label class="control-label"><?php _e('FTP Host', 'grand-media'); ?></label>
|
183 |
+
<input type="text" name="ftp_host" class="form-control" value="<?php echo $ftp_host; ?>">
|
184 |
+
<span class="glyphicon glyphicon-globe form-control-feedback"></span>
|
185 |
+
</div>
|
186 |
+
<div class="form-group has-feedback">
|
187 |
+
<label class="control-label"><?php _e('FTP User', 'grand-media'); ?></label>
|
188 |
+
<input type="text" name="ftp_user" class="form-control" value="<?php echo $ftp_user; ?>">
|
189 |
+
<span class="glyphicon glyphicon-user form-control-feedback"></span>
|
190 |
+
</div>
|
191 |
+
<div class="form-group has-feedback">
|
192 |
+
<label class="control-label"><?php _e('FTP Password', 'grand-media'); ?></label>
|
193 |
+
<input type="password" name="ftp_password" class="form-control" value="<?php echo $ftp_password; ?>">
|
194 |
+
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
|
195 |
+
</div>
|
196 |
+
<p><?php _e('Instead of providing your primary FTP account, create a new FTP user that can be disabled when the support case is closed.', 'grand-media'); ?></p>
|
197 |
+
</div>
|
198 |
+
</fieldset>
|
199 |
+
</div>
|
200 |
+
</div>
|
201 |
+
<footer style="margin-top: 20px;">
|
202 |
+
<button class="btn btn-lg btn-primary"><?php _e('Submit', 'grand-media'); ?></button>
|
203 |
+
</footer>
|
204 |
+
</section>
|
205 |
+
</div>
|
206 |
+
<div class="col-sm-5">
|
207 |
+
<section class="well well-md">
|
208 |
+
<h3>Frequently Asked Questions</h3>
|
209 |
+
<div id="faq">
|
210 |
+
<ul class="clearfix">
|
211 |
+
<li><p>All submitted data will not be saved and is used solely for the purposes your support request. You will not be added to a mailing list, solicited without your permission, nor will your site be administered after this support case is closed.</p></li>
|
212 |
+
|
213 |
+
</ul>
|
214 |
+
</div>
|
215 |
+
</section>
|
216 |
+
</div>
|
217 |
+
</div>
|
218 |
+
<style>
|
219 |
+
#gm_support .form-header { margin-bottom: 20px; }
|
220 |
+
#gm_support .form-header-body { margin-left: 110px; padding-top: 15px; padding-bottom: 0; }
|
221 |
+
#gm_support h1.form-title { font-size: 20px; font-weight: bold; line-height: 1.2em; margin: 0; }
|
222 |
+
#gm_support h2.plugin-title { font-size: 18px; line-height: 1.2em; margin: 0; }
|
223 |
+
#gm_support h3 { font-size: 14px; line-height: 1.8em; margin: 0; }
|
224 |
+
#gm_support .form-subjects .radio { margin: 7px 0; }
|
225 |
+
#gm_support .credentials h4 { cursor: pointer; color: #2e6286; }
|
226 |
+
#gm_support .credentials h4:hover { cursor: pointer; color: #2e6da4; }
|
227 |
+
#gm_support .dynamic fieldset { display: none; }
|
228 |
+
</style>
|
229 |
+
<script>
|
230 |
+
jQuery(function($){
|
231 |
+
$('.form-subjects input').on('change', function(){
|
232 |
+
console.log(this);
|
233 |
+
var label = $(this).attr('data-msglabel'),
|
234 |
+
sections = $(this).attr('data-sections');
|
235 |
+
$('.dynamic fieldset').hide().filter(sections).show();
|
236 |
+
$('#msglabel').text(label);
|
237 |
+
});
|
238 |
+
});
|
239 |
+
</script>
|
240 |
+
|
241 |
+
</div>
|
242 |
+
</form>
|
243 |
+
<?php } ?>
|
244 |
+
</div>
|
245 |
+
<?php
|
246 |
+
}
|
admin/tpl/search-form.php
CHANGED
@@ -25,7 +25,7 @@ global $gmCore;
|
|
25 |
}
|
26 |
$gm_search_string = $gmCore->_get('s', '');
|
27 |
?>
|
28 |
-
<input id="gmedia-search" class="form-control input-xs" type="text" name="s" placeholder="<?php _e('Search...', 'grand-media'); ?>" value="<?php esc_attr_e($gm_search_string); ?>"/>
|
29 |
</div>
|
30 |
<button type="submit" class="btn btn-default input-xs"><span class="glyphicon glyphicon-search"></span></button>
|
31 |
</form>
|
25 |
}
|
26 |
$gm_search_string = $gmCore->_get('s', '');
|
27 |
?>
|
28 |
+
<input id="gmedia-search" class="form-control input-xs allow-key-enter" type="text" name="s" placeholder="<?php _e('Search...', 'grand-media'); ?>" value="<?php esc_attr_e($gm_search_string); ?>"/>
|
29 |
</div>
|
30 |
<button type="submit" class="btn btn-default input-xs"><span class="glyphicon glyphicon-search"></span></button>
|
31 |
</form>
|
app/access.php
CHANGED
@@ -31,6 +31,7 @@ if(isset($_FILES['userfile']['name'])){
|
|
31 |
$globaldata = file_get_contents("php://input");
|
32 |
}
|
33 |
|
|
|
34 |
if($globaldata){
|
35 |
|
36 |
$json = json_decode($globaldata);
|
@@ -43,7 +44,6 @@ if($globaldata){
|
|
43 |
gmedia_ios_app_counters($json->counter);
|
44 |
}
|
45 |
|
46 |
-
$gmedia_options = get_option('gmediaOptions');
|
47 |
if(isset($json->cookie) && !empty($json->cookie)){
|
48 |
if(empty($gmedia_options['mobile_app'])){
|
49 |
$out['error'] = array('code' => 'app_inactive', 'message' => 'Service not enabled/activated for this site');
|
@@ -1592,10 +1592,12 @@ function gmedia_ios_app_counters($data){
|
|
1592 |
$counters['views'] = $gmDB->get_metadata('gmedia', $gmID, 'views', true);
|
1593 |
$counters['views'] += 1;
|
1594 |
$gmDB->update_metadata('gmedia', $gmID, 'views', $counters['views']);
|
|
|
1595 |
if(isset($counters['likes'])){
|
1596 |
$counters['likes'] = $gmDB->get_metadata('gmedia', $gmID, 'likes', true);
|
1597 |
$counters['likes'] += 1;
|
1598 |
$gmDB->update_metadata('gmedia', $gmID, 'likes', $counters['likes']);
|
|
|
1599 |
}
|
1600 |
|
1601 |
}
|
@@ -1606,6 +1608,8 @@ function gmedia_ios_app_counters($data){
|
|
1606 |
$time += microtime(true);
|
1607 |
//$time = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"];
|
1608 |
$out['microtime'] = $time;
|
|
|
1609 |
|
1610 |
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
|
|
|
1611 |
echo json_encode($out);
|
31 |
$globaldata = file_get_contents("php://input");
|
32 |
}
|
33 |
|
34 |
+
$gmedia_options = get_option('gmediaOptions');
|
35 |
if($globaldata){
|
36 |
|
37 |
$json = json_decode($globaldata);
|
44 |
gmedia_ios_app_counters($json->counter);
|
45 |
}
|
46 |
|
|
|
47 |
if(isset($json->cookie) && !empty($json->cookie)){
|
48 |
if(empty($gmedia_options['mobile_app'])){
|
49 |
$out['error'] = array('code' => 'app_inactive', 'message' => 'Service not enabled/activated for this site');
|
1592 |
$counters['views'] = $gmDB->get_metadata('gmedia', $gmID, 'views', true);
|
1593 |
$counters['views'] += 1;
|
1594 |
$gmDB->update_metadata('gmedia', $gmID, 'views', $counters['views']);
|
1595 |
+
do_action('gmedia_view', $gmID);
|
1596 |
if(isset($counters['likes'])){
|
1597 |
$counters['likes'] = $gmDB->get_metadata('gmedia', $gmID, 'likes', true);
|
1598 |
$counters['likes'] += 1;
|
1599 |
$gmDB->update_metadata('gmedia', $gmID, 'likes', $counters['likes']);
|
1600 |
+
do_action('gmedia_like', $gmID);
|
1601 |
}
|
1602 |
|
1603 |
}
|
1608 |
$time += microtime(true);
|
1609 |
//$time = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"];
|
1610 |
$out['microtime'] = $time;
|
1611 |
+
$out['key'] = $gmedia_options['license_key'];
|
1612 |
|
1613 |
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
|
1614 |
+
header('Access-Control-Allow-Origin: *');
|
1615 |
echo json_encode($out);
|
assets/jqueryFileTree/images/application.png
ADDED
Binary file
|
assets/jqueryFileTree/images/code.png
ADDED
Binary file
|
assets/jqueryFileTree/images/css.png
ADDED
Binary file
|
assets/jqueryFileTree/images/db.png
ADDED
Binary file
|
assets/jqueryFileTree/images/doc.png
ADDED
Binary file
|
assets/jqueryFileTree/images/file.png
ADDED
Binary file
|
assets/jqueryFileTree/images/film.png
ADDED
Binary file
|
assets/jqueryFileTree/images/flash.png
ADDED
Binary file
|
assets/jqueryFileTree/images/html.png
ADDED
Binary file
|
assets/jqueryFileTree/images/java.png
ADDED
Binary file
|
assets/jqueryFileTree/images/linux.png
ADDED
Binary file
|
assets/jqueryFileTree/images/music.png
ADDED
Binary file
|
assets/jqueryFileTree/images/pdf.png
ADDED
Binary file
|
assets/jqueryFileTree/images/php.png
ADDED
Binary file
|
assets/jqueryFileTree/images/picture.png
ADDED
Binary file
|
assets/jqueryFileTree/images/ppt.png
ADDED
Binary file
|
assets/jqueryFileTree/images/psd.png
ADDED
Binary file
|
assets/jqueryFileTree/images/ruby.png
ADDED
Binary file
|
assets/jqueryFileTree/images/script.png
ADDED
Binary file
|
assets/jqueryFileTree/images/txt.png
ADDED
Binary file
|
assets/jqueryFileTree/images/xls.png
ADDED
Binary file
|
assets/jqueryFileTree/images/zip.png
ADDED
Binary file
|
assets/jqueryFileTree/jqueryFileTree.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
.browsefiles {margin-left:5px;}
|
2 |
|
3 |
-
ul.
|
4 |
font-family: Verdana, sans-serif;
|
5 |
font-size: 12px;
|
6 |
line-height: 18px;
|
@@ -8,35 +8,95 @@ ul.jqueryDirTree {
|
|
8 |
margin: 0px;
|
9 |
}
|
10 |
|
11 |
-
ul.
|
12 |
list-style: none;
|
13 |
padding: 1px 0px 1px 18px;
|
14 |
margin: 0px;
|
15 |
white-space: nowrap;
|
16 |
}
|
17 |
|
18 |
-
ul.
|
19 |
color: #333;
|
20 |
text-decoration: none;
|
21 |
display: block;
|
22 |
padding: 0px 4px 2px;
|
23 |
}
|
24 |
|
25 |
-
ul.
|
26 |
-
background: #
|
27 |
}
|
28 |
-
|
|
|
29 |
background: #21759b;
|
30 |
color: #ffffff;
|
31 |
}
|
32 |
-
ul.
|
33 |
background: none;
|
34 |
}
|
35 |
-
ul.
|
36 |
background: #bdf;
|
37 |
}
|
38 |
-
|
39 |
/* Core Styles */
|
40 |
-
.
|
41 |
-
.
|
42 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
.browsefiles {margin-left:5px;}
|
2 |
|
3 |
+
ul.jqueryFileTree {
|
4 |
font-family: Verdana, sans-serif;
|
5 |
font-size: 12px;
|
6 |
line-height: 18px;
|
8 |
margin: 0px;
|
9 |
}
|
10 |
|
11 |
+
ul.jqueryFileTree li {
|
12 |
list-style: none;
|
13 |
padding: 1px 0px 1px 18px;
|
14 |
margin: 0px;
|
15 |
white-space: nowrap;
|
16 |
}
|
17 |
|
18 |
+
ul.jqueryFileTree a {
|
19 |
color: #333;
|
20 |
text-decoration: none;
|
21 |
display: block;
|
22 |
padding: 0px 4px 2px;
|
23 |
}
|
24 |
|
25 |
+
ul.jqueryFileTree a:hover {
|
26 |
+
background: #BDF;
|
27 |
}
|
28 |
+
|
29 |
+
ul.jqueryFileTree li.active > a {
|
30 |
background: #21759b;
|
31 |
color: #ffffff;
|
32 |
}
|
33 |
+
ul.jqueryFileTree li.active li a {
|
34 |
background: none;
|
35 |
}
|
36 |
+
ul.jqueryFileTree li.active li a:hover {
|
37 |
background: #bdf;
|
38 |
}
|
|
|
39 |
/* Core Styles */
|
40 |
+
.jqueryFileTree li.directory { background: url(images/directory.png) 0 2px no-repeat; }
|
41 |
+
.jqueryFileTree li.expanded { background: url(images/folder_open.png) 0 2px no-repeat; }
|
42 |
+
.jqueryFileTree li.file { background: url(images/file.png) 0 2px no-repeat; }
|
43 |
+
.jqueryFileTree li.wait { background: url(images/spinner.gif) 0 2px no-repeat; }
|
44 |
+
/* File Extensions*/
|
45 |
+
.jqueryFileTree li.ext_3gp { background: url(images/film.png) 0 2px no-repeat; }
|
46 |
+
.jqueryFileTree li.ext_afp { background: url(images/code.png) 0 2px no-repeat; }
|
47 |
+
.jqueryFileTree li.ext_afpa { background: url(images/code.png) 0 2px no-repeat; }
|
48 |
+
.jqueryFileTree li.ext_asp { background: url(images/code.png) 0 2px no-repeat; }
|
49 |
+
.jqueryFileTree li.ext_aspx { background: url(images/code.png) 0 2px no-repeat; }
|
50 |
+
.jqueryFileTree li.ext_avi { background: url(images/film.png) 0 2px no-repeat; }
|
51 |
+
.jqueryFileTree li.ext_bat { background: url(images/application.png) 0 2px no-repeat; }
|
52 |
+
.jqueryFileTree li.ext_bmp { background: url(images/picture.png) 0 2px no-repeat; }
|
53 |
+
.jqueryFileTree li.ext_c { background: url(images/code.png) 0 2px no-repeat; }
|
54 |
+
.jqueryFileTree li.ext_cfm { background: url(images/code.png) 0 2px no-repeat; }
|
55 |
+
.jqueryFileTree li.ext_cgi { background: url(images/code.png) 0 2px no-repeat; }
|
56 |
+
.jqueryFileTree li.ext_com { background: url(images/application.png) 0 2px no-repeat; }
|
57 |
+
.jqueryFileTree li.ext_cpp { background: url(images/code.png) 0 2px no-repeat; }
|
58 |
+
.jqueryFileTree li.ext_css { background: url(images/css.png) 0 2px no-repeat; }
|
59 |
+
.jqueryFileTree li.ext_doc { background: url(images/doc.png) 0 2px no-repeat; }
|
60 |
+
.jqueryFileTree li.ext_exe { background: url(images/application.png) 0 2px no-repeat; }
|
61 |
+
.jqueryFileTree li.ext_gif { background: url(images/picture.png) 0 2px no-repeat; }
|
62 |
+
.jqueryFileTree li.ext_fla { background: url(images/flash.png) 0 2px no-repeat; }
|
63 |
+
.jqueryFileTree li.ext_h { background: url(images/code.png) 0 2px no-repeat; }
|
64 |
+
.jqueryFileTree li.ext_htm { background: url(images/html.png) 0 2px no-repeat; }
|
65 |
+
.jqueryFileTree li.ext_html { background: url(images/html.png) 0 2px no-repeat; }
|
66 |
+
.jqueryFileTree li.ext_jar { background: url(images/java.png) 0 2px no-repeat; }
|
67 |
+
.jqueryFileTree li.ext_jpg { background: url(images/picture.png) 0 2px no-repeat; }
|
68 |
+
.jqueryFileTree li.ext_jpeg { background: url(images/picture.png) 0 2px no-repeat; }
|
69 |
+
.jqueryFileTree li.ext_js { background: url(images/script.png) 0 2px no-repeat; }
|
70 |
+
.jqueryFileTree li.ext_lasso { background: url(images/code.png) 0 2px no-repeat; }
|
71 |
+
.jqueryFileTree li.ext_log { background: url(images/txt.png) 0 2px no-repeat; }
|
72 |
+
.jqueryFileTree li.ext_m4p { background: url(images/music.png) 0 2px no-repeat; }
|
73 |
+
.jqueryFileTree li.ext_mov { background: url(images/film.png) 0 2px no-repeat; }
|
74 |
+
.jqueryFileTree li.ext_mp3 { background: url(images/music.png) 0 2px no-repeat; }
|
75 |
+
.jqueryFileTree li.ext_mp4 { background: url(images/film.png) 0 2px no-repeat; }
|
76 |
+
.jqueryFileTree li.ext_mpg { background: url(images/film.png) 0 2px no-repeat; }
|
77 |
+
.jqueryFileTree li.ext_mpeg { background: url(images/film.png) 0 2px no-repeat; }
|
78 |
+
.jqueryFileTree li.ext_ogg { background: url(images/music.png) 0 2px no-repeat; }
|
79 |
+
.jqueryFileTree li.ext_pcx { background: url(images/picture.png) 0 2px no-repeat; }
|
80 |
+
.jqueryFileTree li.ext_pdf { background: url(images/pdf.png) 0 2px no-repeat; }
|
81 |
+
.jqueryFileTree li.ext_php { background: url(images/php.png) 0 2px no-repeat; }
|
82 |
+
.jqueryFileTree li.ext_png { background: url(images/picture.png) 0 2px no-repeat; }
|
83 |
+
.jqueryFileTree li.ext_ppt { background: url(images/ppt.png) 0 2px no-repeat; }
|
84 |
+
.jqueryFileTree li.ext_psd { background: url(images/psd.png) 0 2px no-repeat; }
|
85 |
+
.jqueryFileTree li.ext_pl { background: url(images/script.png) 0 2px no-repeat; }
|
86 |
+
.jqueryFileTree li.ext_py { background: url(images/script.png) 0 2px no-repeat; }
|
87 |
+
.jqueryFileTree li.ext_rb { background: url(images/ruby.png) 0 2px no-repeat; }
|
88 |
+
.jqueryFileTree li.ext_rbx { background: url(images/ruby.png) 0 2px no-repeat; }
|
89 |
+
.jqueryFileTree li.ext_rhtml { background: url(images/ruby.png) 0 2px no-repeat; }
|
90 |
+
.jqueryFileTree li.ext_rpm { background: url(images/linux.png) 0 2px no-repeat; }
|
91 |
+
.jqueryFileTree li.ext_ruby { background: url(images/ruby.png) 0 2px no-repeat; }
|
92 |
+
.jqueryFileTree li.ext_sql { background: url(images/db.png) 0 2px no-repeat; }
|
93 |
+
.jqueryFileTree li.ext_swf { background: url(images/flash.png) 0 2px no-repeat; }
|
94 |
+
.jqueryFileTree li.ext_tif { background: url(images/picture.png) 0 2px no-repeat; }
|
95 |
+
.jqueryFileTree li.ext_tiff { background: url(images/picture.png) 0 2px no-repeat; }
|
96 |
+
.jqueryFileTree li.ext_txt { background: url(images/txt.png) 0 2px no-repeat; }
|
97 |
+
.jqueryFileTree li.ext_vb { background: url(images/code.png) 0 2px no-repeat; }
|
98 |
+
.jqueryFileTree li.ext_wav { background: url(images/music.png) 0 2px no-repeat; }
|
99 |
+
.jqueryFileTree li.ext_wmv { background: url(images/film.png) 0 2px no-repeat; }
|
100 |
+
.jqueryFileTree li.ext_xls { background: url(images/xls.png) 0 2px no-repeat; }
|
101 |
+
.jqueryFileTree li.ext_xml { background: url(images/code.png) 0 2px no-repeat; }
|
102 |
+
.jqueryFileTree li.ext_zip { background: url(images/zip.png) 0 2px no-repeat; }
|
assets/jqueryFileTree/jqueryFileTree.js
CHANGED
@@ -31,68 +31,72 @@
|
|
31 |
// is copyright 2008 A Beautiful Site, LLC.
|
32 |
//
|
33 |
if(jQuery) (function($){
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
if( o.expandSpeed == undefined ) o.expandSpeed= 200;
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
if( o.multiFolder == undefined ) o.multiFolder = false;
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
|
|
98 |
})(jQuery);
|
31 |
// is copyright 2008 A Beautiful Site, LLC.
|
32 |
//
|
33 |
if(jQuery) (function($){
|
34 |
+
|
35 |
+
$.extend($.fn, {
|
36 |
+
fileTree: function(o, h) {
|
37 |
+
// Defaults
|
38 |
+
if( !o ) var o = {};
|
39 |
+
if( o.root == undefined ) o.root = '/';
|
40 |
+
if( o.script == undefined ) o.script = 'jqueryFileTree.php';
|
41 |
+
if( o.folderEvent == undefined ) o.folderEvent = 'click';
|
42 |
if( o.expandSpeed == undefined ) o.expandSpeed= 200;
|
43 |
+
if( o.collapseSpeed == undefined ) o.collapseSpeed= 500;
|
44 |
+
if( o.expandEasing == undefined ) o.expandEasing = null;
|
45 |
+
if( o.collapseEasing == undefined ) o.collapseEasing = null;
|
46 |
if( o.multiFolder == undefined ) o.multiFolder = false;
|
47 |
+
if( o.loadMessage == undefined ) o.loadMessage = 'Loading...';
|
48 |
+
|
49 |
+
$(this).each( function() {
|
50 |
+
|
51 |
+
function showTree(c, t) {
|
52 |
+
$(c).addClass('wait');
|
53 |
+
$(".jqueryFileTree.start").remove();
|
54 |
+
$.post(o.script, { dir: t }, function(data) {
|
55 |
+
$(c).find('.start').html('');
|
56 |
+
$(c).removeClass('wait').append(data);
|
57 |
+
if( o.root == t ) $(c).find('UL:hidden').show(); else $(c).find('UL:hidden').slideDown({ duration: o.expandSpeed, easing: o.expandEasing });
|
58 |
+
bindTree(c);
|
59 |
+
});
|
60 |
+
}
|
61 |
+
|
62 |
+
function bindTree(t) {
|
63 |
+
$(t).find('LI A').bind(o.folderEvent, function() {
|
64 |
+
if( $(this).parent().hasClass('directory') ) {
|
65 |
+
if( $(this).parent().hasClass('collapsed') ) {
|
66 |
+
// Expand
|
67 |
+
if( !o.multiFolder ) {
|
68 |
+
$(this).parent().parent().find('UL').slideUp({ duration: o.collapseSpeed, easing: o.collapseEasing });
|
69 |
+
$(this).parent().parent().find('LI.directory').removeClass('expanded').addClass('collapsed');
|
70 |
+
}
|
71 |
+
$(this).parent().find('UL').remove(); // cleanup
|
72 |
+
showTree( $(this).parent(), escape($(this).attr('rel').match( /.*\// )) );
|
73 |
+
$(this).parent().removeClass('collapsed').addClass('expanded');
|
74 |
+
} else {
|
75 |
+
// Collapse
|
76 |
+
$(this).parent().find('UL').slideUp({ duration: o.collapseSpeed, easing: o.collapseEasing });
|
77 |
+
$(this).parent().removeClass('expanded').addClass('collapsed');
|
78 |
+
}
|
79 |
+
} else {
|
80 |
+
h($(this).attr('rel'));
|
81 |
+
}
|
82 |
+
return false;
|
83 |
+
});
|
84 |
+
// Prevent A from triggering the # on non-click events
|
85 |
+
if( o.folderEvent.toLowerCase != 'click' ) $(t).find('LI A').bind('click', function() { return false; });
|
86 |
+
|
87 |
+
$(t).find('li.directory > a').bind('click', function() {
|
88 |
+
h($(this).attr('rel'));
|
89 |
+
$(this).parents('#file_browser').find('.active').removeClass('active');
|
90 |
+
$(this).parent().addClass('active');
|
91 |
+
return false;
|
92 |
+
});
|
93 |
+
}
|
94 |
+
// Loading message
|
95 |
+
$(this).html('<ul class="jqueryFileTree start"><li class="wait">' + o.loadMessage + '<li></ul>');
|
96 |
+
// Get the initial file list
|
97 |
+
showTree( $(this), escape(o.root) );
|
98 |
+
});
|
99 |
+
}
|
100 |
+
});
|
101 |
+
|
102 |
})(jQuery);
|
assets/mediaelement/background.png
DELETED
Binary file
|
assets/mediaelement/bigplay.png
DELETED
Binary file
|
assets/mediaelement/bigplay.svg
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<?xml version="1.0" standalone="no"?>
|
|
assets/mediaelement/controls.png
DELETED
Binary file
|
assets/mediaelement/controls.svg
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<?xml version="1.0" standalone="no"?>
|
|
assets/mediaelement/flashmediaelement.swf
DELETED
Binary file
|
assets/mediaelement/loading.gif
DELETED
Binary file
|
assets/mediaelement/mediaelement-and-player.min.js
CHANGED
@@ -1,173 +1,12 @@
|
|
1 |
/*!
|
2 |
-
* MediaElement.js
|
3 |
-
*
|
4 |
-
* http://mediaelementjs.com/
|
5 |
-
*
|
6 |
-
* Creates a JavaScript object that mimics HTML5 MediaElement API
|
7 |
-
* for browsers that don't understand HTML5 or can't play the provided codec
|
8 |
-
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
|
9 |
-
*
|
10 |
-
* Copyright 2010-2013, John Dyer (http://j.hn)
|
11 |
-
* License: MIT
|
12 |
-
*
|
13 |
-
*/var mejs=mejs||{};mejs.version="2.13.0";mejs.meIndex=0;
|
14 |
-
mejs.plugins={silverlight:[{version:[3,0],types:["video/mp4","video/m4v","video/mov","video/wmv","audio/wma","audio/m4a","audio/mp3","audio/wav","audio/mpeg"]}],flash:[{version:[9,0,124],types:["video/mp4","video/m4v","video/mov","video/flv","video/rtmp","video/x-flv","audio/flv","audio/x-flv","audio/mp3","audio/m4a","audio/mpeg","video/youtube","video/x-youtube"]}],youtube:[{version:null,types:["video/youtube","video/x-youtube","audio/youtube","audio/x-youtube"]}],vimeo:[{version:null,types:["video/vimeo",
|
15 |
-
"video/x-vimeo"]}]};
|
16 |
-
mejs.Utility={encodeUrl:function(a){return encodeURIComponent(a)},escapeHTML:function(a){return a.toString().split("&").join("&").split("<").join("<").split('"').join(""")},absolutizeUrl:function(a){var b=document.createElement("div");b.innerHTML='<a href="'+this.escapeHTML(a)+'">x</a>';return b.firstChild.href},getScriptPath:function(a){for(var b=0,c,d="",e="",f,g,h=document.getElementsByTagName("script"),l=h.length,j=a.length;b<l;b++){f=h[b].src;c=f.lastIndexOf("/");if(c>-1){g=f.substring(c+
|
17 |
-
1);f=f.substring(0,c+1)}else{g=f;f=""}for(c=0;c<j;c++){e=a[c];e=g.indexOf(e);if(e>-1){d=f;break}}if(d!=="")break}return d},secondsToTimeCode:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;var e=Math.floor(a/3600)%24,f=Math.floor(a/60)%60,g=Math.floor(a%60);a=Math.floor((a%1*d).toFixed(3));return(b||e>0?(e<10?"0"+e:e)+":":"")+(f<10?"0"+f:f)+":"+(g<10?"0"+g:g)+(c?":"+(a<10?"0"+a:a):"")},timeCodeToSeconds:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d==
|
18 |
-
"undefined")d=25;a=a.split(":");b=parseInt(a[0],10);var e=parseInt(a[1],10),f=parseInt(a[2],10),g=0,h=0;if(c)g=parseInt(a[3])/d;return h=b*3600+e*60+f+g},convertSMPTEtoSeconds:function(a){if(typeof a!="string")return false;a=a.replace(",",".");var b=0,c=a.indexOf(".")!=-1?a.split(".")[1].length:0,d=1;a=a.split(":").reverse();for(var e=0;e<a.length;e++){d=1;if(e>0)d=Math.pow(60,e);b+=Number(a[e])*d}return Number(b.toFixed(c))},removeSwf:function(a){var b=document.getElementById(a);if(b&&/object|embed/i.test(b.nodeName))if(mejs.MediaFeatures.isIE){b.style.display=
|
19 |
-
"none";(function(){b.readyState==4?mejs.Utility.removeObjectInIE(a):setTimeout(arguments.callee,10)})()}else b.parentNode.removeChild(b)},removeObjectInIE:function(a){if(a=document.getElementById(a)){for(var b in a)if(typeof a[b]=="function")a[b]=null;a.parentNode.removeChild(a)}}};
|
20 |
-
mejs.PluginDetector={hasPluginVersion:function(a,b){var c=this.plugins[a];b[1]=b[1]||0;b[2]=b[2]||0;return c[0]>b[0]||c[0]==b[0]&&c[1]>b[1]||c[0]==b[0]&&c[1]==b[1]&&c[2]>=b[2]?true:false},nav:window.navigator,ua:window.navigator.userAgent.toLowerCase(),plugins:[],addPlugin:function(a,b,c,d,e){this.plugins[a]=this.detectPlugin(b,c,d,e)},detectPlugin:function(a,b,c,d){var e=[0,0,0],f;if(typeof this.nav.plugins!="undefined"&&typeof this.nav.plugins[a]=="object"){if((c=this.nav.plugins[a].description)&&
|
21 |
-
!(typeof this.nav.mimeTypes!="undefined"&&this.nav.mimeTypes[b]&&!this.nav.mimeTypes[b].enabledPlugin)){e=c.replace(a,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".");for(a=0;a<e.length;a++)e[a]=parseInt(e[a].match(/\d+/),10)}}else if(typeof window.ActiveXObject!="undefined")try{if(f=new ActiveXObject(c))e=d(f)}catch(g){}return e}};
|
22 |
-
mejs.PluginDetector.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(a){var b=[];if(a=a.GetVariable("$version")){a=a.split(" ")[1].split(",");b=[parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10)]}return b});
|
23 |
-
mejs.PluginDetector.addPlugin("silverlight","Silverlight Plug-In","application/x-silverlight-2","AgControl.AgControl",function(a){var b=[0,0,0,0],c=function(d,e,f,g){for(;d.isVersionSupported(e[0]+"."+e[1]+"."+e[2]+"."+e[3]);)e[f]+=g;e[f]-=g};c(a,b,0,1);c(a,b,1,1);c(a,b,2,1E4);c(a,b,2,1E3);c(a,b,2,100);c(a,b,2,10);c(a,b,2,1);c(a,b,3,1);return b});
|
24 |
-
mejs.MediaFeatures={init:function(){var a=this,b=document,c=mejs.PluginDetector.nav,d=mejs.PluginDetector.ua.toLowerCase(),e,f=["source","track","audio","video"];a.isiPad=d.match(/ipad/i)!==null;a.isiPhone=d.match(/iphone/i)!==null;a.isiOS=a.isiPhone||a.isiPad;a.isAndroid=d.match(/android/i)!==null;a.isBustedAndroid=d.match(/android 2\.[12]/)!==null;a.isBustedNativeHTTPS=location.protocol==="https:"&&(d.match(/android [12]\./)!==null||d.match(/macintosh.* version.* safari/)!==null);a.isIE=c.appName.toLowerCase().indexOf("microsoft")!=
|
25 |
-
-1;a.isChrome=d.match(/chrome/gi)!==null;a.isFirefox=d.match(/firefox/gi)!==null;a.isWebkit=d.match(/webkit/gi)!==null;a.isGecko=d.match(/gecko/gi)!==null&&!a.isWebkit;a.isOpera=d.match(/opera/gi)!==null;a.hasTouch="ontouchstart"in window&&window.ontouchstart!=null;a.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect;for(c=0;c<f.length;c++)e=document.createElement(f[c]);a.supportsMediaTag=typeof e.canPlayType!=="undefined"||a.isBustedAndroid;
|
26 |
-
try{e.canPlayType("video/mp4")}catch(g){a.supportsMediaTag=false}a.hasSemiNativeFullScreen=typeof e.webkitEnterFullscreen!=="undefined";a.hasWebkitNativeFullScreen=typeof e.webkitRequestFullScreen!=="undefined";a.hasMozNativeFullScreen=typeof e.mozRequestFullScreen!=="undefined";a.hasTrueNativeFullScreen=a.hasWebkitNativeFullScreen||a.hasMozNativeFullScreen;a.nativeFullScreenEnabled=a.hasTrueNativeFullScreen;if(a.hasMozNativeFullScreen)a.nativeFullScreenEnabled=e.mozFullScreenEnabled;if(this.isChrome)a.hasSemiNativeFullScreen=
|
27 |
-
false;if(a.hasTrueNativeFullScreen){a.fullScreenEventName=a.hasWebkitNativeFullScreen?"webkitfullscreenchange":"mozfullscreenchange";a.isFullScreen=function(){if(e.mozRequestFullScreen)return b.mozFullScreen;else if(e.webkitRequestFullScreen)return b.webkitIsFullScreen};a.requestFullScreen=function(h){if(a.hasWebkitNativeFullScreen)h.webkitRequestFullScreen();else a.hasMozNativeFullScreen&&h.mozRequestFullScreen()};a.cancelFullScreen=function(){if(a.hasWebkitNativeFullScreen)document.webkitCancelFullScreen();
|
28 |
-
else a.hasMozNativeFullScreen&&document.mozCancelFullScreen()}}if(a.hasSemiNativeFullScreen&&d.match(/mac os x 10_5/i)){a.hasNativeFullScreen=false;a.hasSemiNativeFullScreen=false}}};mejs.MediaFeatures.init();
|
29 |
-
mejs.HtmlMediaElement={pluginType:"native",isFullScreen:false,setCurrentTime:function(a){this.currentTime=a},setMuted:function(a){this.muted=a},setVolume:function(a){this.volume=a},stop:function(){this.pause()},setSrc:function(a){for(var b=this.getElementsByTagName("source");b.length>0;)this.removeChild(b[0]);if(typeof a=="string")this.src=a;else{var c;for(b=0;b<a.length;b++){c=a[b];if(this.canPlayType(c.type)){this.src=c.src;break}}}},setVideoSize:function(a,b){this.width=a;this.height=b}};
|
30 |
-
mejs.PluginMediaElement=function(a,b,c){this.id=a;this.pluginType=b;this.src=c;this.events={};this.attributes={}};
|
31 |
-
mejs.PluginMediaElement.prototype={pluginElement:null,pluginType:"",isFullScreen:false,playbackRate:-1,defaultPlaybackRate:-1,seekable:[],played:[],paused:true,ended:false,seeking:false,duration:0,error:null,tagName:"",muted:false,volume:1,currentTime:0,play:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.playVideo():this.pluginApi.playMedia();this.paused=false}},load:function(){if(this.pluginApi!=null){this.pluginType!="youtube"&&this.pluginApi.loadMedia();this.paused=
|
32 |
-
false}},pause:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.pauseVideo():this.pluginApi.pauseMedia();this.paused=true}},stop:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.stopVideo():this.pluginApi.stopMedia();this.paused=true}},canPlayType:function(a){var b,c,d,e=mejs.plugins[this.pluginType];for(b=0;b<e.length;b++){d=e[b];if(mejs.PluginDetector.hasPluginVersion(this.pluginType,d.version))for(c=0;c<d.types.length;c++)if(a==d.types[c])return"probably"}return""},
|
33 |
-
positionFullscreenButton:function(a,b,c){this.pluginApi!=null&&this.pluginApi.positionFullscreenButton&&this.pluginApi.positionFullscreenButton(Math.floor(a),Math.floor(b),c)},hideFullscreenButton:function(){this.pluginApi!=null&&this.pluginApi.hideFullscreenButton&&this.pluginApi.hideFullscreenButton()},setSrc:function(a){if(typeof a=="string"){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(a));this.src=mejs.Utility.absolutizeUrl(a)}else{var b,c;for(b=0;b<a.length;b++){c=a[b];if(this.canPlayType(c.type)){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(c.src));
|
34 |
-
this.src=mejs.Utility.absolutizeUrl(a);break}}}},setCurrentTime:function(a){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.seekTo(a):this.pluginApi.setCurrentTime(a);this.currentTime=a}},setVolume:function(a){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.setVolume(a*100):this.pluginApi.setVolume(a);this.volume=a}},setMuted:function(a){if(this.pluginApi!=null){if(this.pluginType=="youtube"){a?this.pluginApi.mute():this.pluginApi.unMute();this.muted=a;this.dispatchEvent("volumechange")}else this.pluginApi.setMuted(a);
|
35 |
-
this.muted=a}},setVideoSize:function(a,b){if(this.pluginElement.style){this.pluginElement.style.width=a+"px";this.pluginElement.style.height=b+"px"}this.pluginApi!=null&&this.pluginApi.setVideoSize&&this.pluginApi.setVideoSize(a,b)},setFullscreen:function(a){this.pluginApi!=null&&this.pluginApi.setFullscreen&&this.pluginApi.setFullscreen(a)},enterFullScreen:function(){this.pluginApi!=null&&this.pluginApi.setFullscreen&&this.setFullscreen(true)},exitFullScreen:function(){this.pluginApi!=null&&this.pluginApi.setFullscreen&&
|
36 |
-
this.setFullscreen(false)},addEventListener:function(a,b){this.events[a]=this.events[a]||[];this.events[a].push(b)},removeEventListener:function(a,b){if(!a){this.events={};return true}var c=this.events[a];if(!c)return true;if(!b){this.events[a]=[];return true}for(i=0;i<c.length;i++)if(c[i]===b){this.events[a].splice(i,1);return true}return false},dispatchEvent:function(a){var b,c,d=this.events[a];if(d){c=Array.prototype.slice.call(arguments,1);for(b=0;b<d.length;b++)d[b].apply(null,c)}},hasAttribute:function(a){return a in
|
37 |
-
this.attributes},removeAttribute:function(a){delete this.attributes[a]},getAttribute:function(a){if(this.hasAttribute(a))return this.attributes[a];return""},setAttribute:function(a,b){this.attributes[a]=b},remove:function(){mejs.Utility.removeSwf(this.pluginElement.id);mejs.MediaPluginBridge.unregisterPluginElement(this.pluginElement.id)}};
|
38 |
-
mejs.MediaPluginBridge={pluginMediaElements:{},htmlMediaElements:{},registerPluginElement:function(a,b,c){this.pluginMediaElements[a]=b;this.htmlMediaElements[a]=c},unregisterPluginElement:function(a){delete this.pluginMediaElements[a];delete this.htmlMediaElements[a]},initPlugin:function(a){var b=this.pluginMediaElements[a],c=this.htmlMediaElements[a];if(b){switch(b.pluginType){case "flash":b.pluginElement=b.pluginApi=document.getElementById(a);break;case "silverlight":b.pluginElement=document.getElementById(b.id);
|
39 |
-
b.pluginApi=b.pluginElement.Content.MediaElementJS}b.pluginApi!=null&&b.success&&b.success(b,c)}},fireEvent:function(a,b,c){var d,e;if(a=this.pluginMediaElements[a]){b={type:b,target:a};for(d in c){a[d]=c[d];b[d]=c[d]}e=c.bufferedTime||0;b.target.buffered=b.buffered={start:function(){return 0},end:function(){return e},length:1};a.dispatchEvent(b.type,b)}}};
|
40 |
-
mejs.MediaElementDefaults={mode:"auto",plugins:["flash","silverlight","youtube","vimeo"],enablePluginDebug:false,httpsBasicAuthSite:false,type:"",pluginPath:mejs.Utility.getScriptPath(["mediaelement.js","mediaelement.min.js","mediaelement-and-player.js","mediaelement-and-player.min.js"]),flashName:"flashmediaelement.swf",flashStreamer:"",enablePluginSmoothing:false,enablePseudoStreaming:false,pseudoStreamingStartQueryParam:"start",silverlightName:"silverlightmediaelement.xap",defaultVideoWidth:480,
|
41 |
-
defaultVideoHeight:270,pluginWidth:-1,pluginHeight:-1,pluginVars:[],timerRate:250,startVolume:0.8,success:function(){},error:function(){}};mejs.MediaElement=function(a,b){return mejs.HtmlMediaElementShim.create(a,b)};
|
42 |
-
mejs.HtmlMediaElementShim={create:function(a,b){var c=mejs.MediaElementDefaults,d=typeof a=="string"?document.getElementById(a):a,e=d.tagName.toLowerCase(),f=e==="audio"||e==="video",g=f?d.getAttribute("src"):d.getAttribute("href");e=d.getAttribute("poster");var h=d.getAttribute("autoplay"),l=d.getAttribute("preload"),j=d.getAttribute("controls"),k;for(k in b)c[k]=b[k];g=typeof g=="undefined"||g===null||g==""?null:g;e=typeof e=="undefined"||e===null?"":e;l=typeof l=="undefined"||l===null||l==="false"?
|
43 |
-
"none":l;h=!(typeof h=="undefined"||h===null||h==="false");j=!(typeof j=="undefined"||j===null||j==="false");k=this.determinePlayback(d,c,mejs.MediaFeatures.supportsMediaTag,f,g);k.url=k.url!==null?mejs.Utility.absolutizeUrl(k.url):"";if(k.method=="native"){if(mejs.MediaFeatures.isBustedAndroid){d.src=k.url;d.addEventListener("click",function(){d.play()},false)}return this.updateNative(k,c,h,l)}else if(k.method!=="")return this.createPlugin(k,c,e,h,l,j);else{this.createErrorMessage(k,c,e);return this}},
|
44 |
-
determinePlayback:function(a,b,c,d,e){var f=[],g,h,l,j={method:"",url:"",htmlMediaElement:a,isVideo:a.tagName.toLowerCase()!="audio"},k;if(typeof b.type!="undefined"&&b.type!=="")if(typeof b.type=="string")f.push({type:b.type,url:e});else for(g=0;g<b.type.length;g++)f.push({type:b.type[g],url:e});else if(e!==null){l=this.formatType(e,a.getAttribute("type"));f.push({type:l,url:e})}else for(g=0;g<a.childNodes.length;g++){h=a.childNodes[g];if(h.nodeType==1&&h.tagName.toLowerCase()=="source"){e=h.getAttribute("src");
|
45 |
-
l=this.formatType(e,h.getAttribute("type"));h=h.getAttribute("media");if(!h||!window.matchMedia||window.matchMedia&&window.matchMedia(h).matches)f.push({type:l,url:e})}}if(!d&&f.length>0&&f[0].url!==null&&this.getTypeFromFile(f[0].url).indexOf("audio")>-1)j.isVideo=false;if(mejs.MediaFeatures.isBustedAndroid)a.canPlayType=function(m){return m.match(/video\/(mp4|m4v)/gi)!==null?"maybe":""};if(c&&(b.mode==="auto"||b.mode==="auto_plugin"||b.mode==="native")&&!(mejs.MediaFeatures.isBustedNativeHTTPS&&
|
46 |
-
b.httpsBasicAuthSite===true)){if(!d){g=document.createElement(j.isVideo?"video":"audio");a.parentNode.insertBefore(g,a);a.style.display="none";j.htmlMediaElement=a=g}for(g=0;g<f.length;g++)if(a.canPlayType(f[g].type).replace(/no/,"")!==""||a.canPlayType(f[g].type.replace(/mp3/,"mpeg")).replace(/no/,"")!==""){j.method="native";j.url=f[g].url;break}if(j.method==="native"){if(j.url!==null)a.src=j.url;if(b.mode!=="auto_plugin")return j}}if(b.mode==="auto"||b.mode==="auto_plugin"||b.mode==="shim")for(g=
|
47 |
-
0;g<f.length;g++){l=f[g].type;for(a=0;a<b.plugins.length;a++){e=b.plugins[a];h=mejs.plugins[e];for(c=0;c<h.length;c++){k=h[c];if(k.version==null||mejs.PluginDetector.hasPluginVersion(e,k.version))for(d=0;d<k.types.length;d++)if(l==k.types[d]){j.method=e;j.url=f[g].url;return j}}}}if(b.mode==="auto_plugin"&&j.method==="native")return j;if(j.method===""&&f.length>0)j.url=f[0].url;return j},formatType:function(a,b){return a&&!b?this.getTypeFromFile(a):b&&~b.indexOf(";")?b.substr(0,b.indexOf(";")):b},
|
48 |
-
getTypeFromFile:function(a){a=a.split("?")[0];a=a.substring(a.lastIndexOf(".")+1).toLowerCase();return(/(mp4|m4v|ogg|ogv|webm|webmv|flv|wmv|mpeg|mov)/gi.test(a)?"video":"audio")+"/"+this.getTypeFromExtension(a)},getTypeFromExtension:function(a){switch(a){case "mp4":case "m4v":return"mp4";case "webm":case "webma":case "webmv":return"webm";case "ogg":case "oga":case "ogv":return"ogg";default:return a}},createErrorMessage:function(a,b,c){var d=a.htmlMediaElement,e=document.createElement("div");e.className=
|
49 |
-
"me-cannotplay";try{e.style.width=d.width+"px";e.style.height=d.height+"px"}catch(f){}e.innerHTML=b.customError?b.customError:c!==""?'<a href="'+a.url+'"><img src="'+c+'" width="100%" height="100%" /></a>':'<a href="'+a.url+'"><span>'+mejs.i18n.t("Download File")+"</span></a>";d.parentNode.insertBefore(e,d);d.style.display="none";b.error(d)},createPlugin:function(a,b,c,d,e,f){c=a.htmlMediaElement;var g=1,h=1,l="me_"+a.method+"_"+mejs.meIndex++,j=new mejs.PluginMediaElement(l,a.method,a.url),k=document.createElement("div"),
|
50 |
-
m;j.tagName=c.tagName;for(m=0;m<c.attributes.length;m++){var n=c.attributes[m];n.specified==true&&j.setAttribute(n.name,n.value)}for(m=c.parentNode;m!==null&&m.tagName.toLowerCase()!="body";){if(m.parentNode.tagName.toLowerCase()=="p"){m.parentNode.parentNode.insertBefore(m,m.parentNode);break}m=m.parentNode}if(a.isVideo){g=b.pluginWidth>0?b.pluginWidth:b.videoWidth>0?b.videoWidth:c.getAttribute("width")!==null?c.getAttribute("width"):b.defaultVideoWidth;h=b.pluginHeight>0?b.pluginHeight:b.videoHeight>
|
51 |
-
0?b.videoHeight:c.getAttribute("height")!==null?c.getAttribute("height"):b.defaultVideoHeight;g=mejs.Utility.encodeUrl(g);h=mejs.Utility.encodeUrl(h)}else if(b.enablePluginDebug){g=320;h=240}j.success=b.success;mejs.MediaPluginBridge.registerPluginElement(l,j,c);k.className="me-plugin";k.id=l+"_container";a.isVideo?c.parentNode.insertBefore(k,c):document.body.insertBefore(k,document.body.childNodes[0]);d=["id="+l,"isvideo="+(a.isVideo?"true":"false"),"autoplay="+(d?"true":"false"),"preload="+e,"width="+
|
52 |
-
g,"startvolume="+b.startVolume,"timerrate="+b.timerRate,"flashstreamer="+b.flashStreamer,"height="+h,"pseudostreamstart="+b.pseudoStreamingStartQueryParam];if(a.url!==null)a.method=="flash"?d.push("file="+mejs.Utility.encodeUrl(a.url)):d.push("file="+a.url);b.enablePluginDebug&&d.push("debug=true");b.enablePluginSmoothing&&d.push("smoothing=true");b.enablePseudoStreaming&&d.push("pseudostreaming=true");f&&d.push("controls=true");if(b.pluginVars)d=d.concat(b.pluginVars);switch(a.method){case "silverlight":k.innerHTML=
|
53 |
-
'<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+l+'" name="'+l+'" width="'+g+'" height="'+h+'" class="mejs-shim"><param name="initParams" value="'+d.join(",")+'" /><param name="windowless" value="true" /><param name="background" value="black" /><param name="minRuntimeVersion" value="3.0.0.0" /><param name="autoUpgrade" value="true" /><param name="source" value="'+b.pluginPath+b.silverlightName+'" /></object>';break;case "flash":if(mejs.MediaFeatures.isIE){a=
|
54 |
-
document.createElement("div");k.appendChild(a);a.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+l+'" width="'+g+'" height="'+h+'" class="mejs-shim"><param name="movie" value="'+b.pluginPath+b.flashName+"?x="+new Date+'" /><param name="flashvars" value="'+d.join("&")+'" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>'}else k.innerHTML=
|
55 |
-
'<embed id="'+l+'" name="'+l+'" play="true" loop="false" quality="high" bgcolor="#000000" wmode="transparent" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" src="'+b.pluginPath+b.flashName+'" flashvars="'+d.join("&")+'" width="'+g+'" height="'+h+'" class="mejs-shim"></embed>';break;case "youtube":b=a.url.substr(a.url.lastIndexOf("=")+1);youtubeSettings={container:k,containerId:k.id,pluginMediaElement:j,pluginId:l,
|
56 |
-
videoId:b,height:h,width:g};mejs.PluginDetector.hasPluginVersion("flash",[10,0,0])?mejs.YouTubeApi.createFlash(youtubeSettings):mejs.YouTubeApi.enqueueIframe(youtubeSettings);break;case "vimeo":j.vimeoid=a.url.substr(a.url.lastIndexOf("/")+1);k.innerHTML='<iframe src="http://player.vimeo.com/video/'+j.vimeoid+'?portrait=0&byline=0&title=0" width="'+g+'" height="'+h+'" frameborder="0" class="mejs-shim"></iframe>'}c.style.display="none";c.removeAttribute("autoplay");return j},updateNative:function(a,
|
57 |
-
b){var c=a.htmlMediaElement,d;for(d in mejs.HtmlMediaElement)c[d]=mejs.HtmlMediaElement[d];b.success(c,c);return c}};
|
58 |
-
mejs.YouTubeApi={isIframeStarted:false,isIframeLoaded:false,loadIframeApi:function(){if(!this.isIframeStarted){var a=document.createElement("script");a.src="//www.youtube.com/player_api";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b);this.isIframeStarted=true}},iframeQueue:[],enqueueIframe:function(a){if(this.isLoaded)this.createIframe(a);else{this.loadIframeApi();this.iframeQueue.push(a)}},createIframe:function(a){var b=a.pluginMediaElement,c=new YT.Player(a.containerId,
|
59 |
-
{height:a.height,width:a.width,videoId:a.videoId,playerVars:{controls:0},events:{onReady:function(){a.pluginMediaElement.pluginApi=c;mejs.MediaPluginBridge.initPlugin(a.pluginId);setInterval(function(){mejs.YouTubeApi.createEvent(c,b,"timeupdate")},250)},onStateChange:function(d){mejs.YouTubeApi.handleStateChange(d.data,c,b)}}})},createEvent:function(a,b,c){c={type:c,target:b};if(a&&a.getDuration){b.currentTime=c.currentTime=a.getCurrentTime();b.duration=c.duration=a.getDuration();c.paused=b.paused;
|
60 |
-
c.ended=b.ended;c.muted=a.isMuted();c.volume=a.getVolume()/100;c.bytesTotal=a.getVideoBytesTotal();c.bufferedBytes=a.getVideoBytesLoaded();var d=c.bufferedBytes/c.bytesTotal*c.duration;c.target.buffered=c.buffered={start:function(){return 0},end:function(){return d},length:1}}b.dispatchEvent(c.type,c)},iFrameReady:function(){for(this.isIframeLoaded=this.isLoaded=true;this.iframeQueue.length>0;)this.createIframe(this.iframeQueue.pop())},flashPlayers:{},createFlash:function(a){this.flashPlayers[a.pluginId]=
|
61 |
-
a;var b,c="//www.youtube.com/apiplayer?enablejsapi=1&playerapiid="+a.pluginId+"&version=3&autoplay=0&controls=0&modestbranding=1&loop=0";if(mejs.MediaFeatures.isIE){b=document.createElement("div");a.container.appendChild(b);b.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+a.pluginId+'" width="'+a.width+'" height="'+a.height+'" class="mejs-shim"><param name="movie" value="'+
|
62 |
-
c+'" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>'}else a.container.innerHTML='<object type="application/x-shockwave-flash" id="'+a.pluginId+'" data="'+c+'" width="'+a.width+'" height="'+a.height+'" style="visibility: visible; " class="mejs-shim"><param name="allowScriptAccess" value="always"><param name="wmode" value="transparent"></object>'},flashReady:function(a){var b=this.flashPlayers[a],c=
|
63 |
-
document.getElementById(a),d=b.pluginMediaElement;d.pluginApi=d.pluginElement=c;mejs.MediaPluginBridge.initPlugin(a);c.cueVideoById(b.videoId);a=b.containerId+"_callback";window[a]=function(e){mejs.YouTubeApi.handleStateChange(e,c,d)};c.addEventListener("onStateChange",a);setInterval(function(){mejs.YouTubeApi.createEvent(c,d,"timeupdate")},250)},handleStateChange:function(a,b,c){switch(a){case -1:c.paused=true;c.ended=true;mejs.YouTubeApi.createEvent(b,c,"loadedmetadata");break;case 0:c.paused=false;
|
64 |
-
c.ended=true;mejs.YouTubeApi.createEvent(b,c,"ended");break;case 1:c.paused=false;c.ended=false;mejs.YouTubeApi.createEvent(b,c,"play");mejs.YouTubeApi.createEvent(b,c,"playing");break;case 2:c.paused=true;c.ended=false;mejs.YouTubeApi.createEvent(b,c,"pause");break;case 3:mejs.YouTubeApi.createEvent(b,c,"progress")}}};function onYouTubePlayerAPIReady(){mejs.YouTubeApi.iFrameReady()}function onYouTubePlayerReady(a){mejs.YouTubeApi.flashReady(a)}window.mejs=mejs;window.MediaElement=mejs.MediaElement;
|
65 |
-
(function(a,b){var c={locale:{language:"",strings:{}},methods:{}};c.locale.getLanguage=function(){return c.locale.language||navigator.language};if(typeof mejsL10n!="undefined")c.locale.language=mejsL10n.language;c.locale.INIT_LANGUAGE=c.locale.getLanguage();c.methods.checkPlain=function(d){var e,f,g={"&":"&",'"':""","<":"<",">":">"};d=String(d);for(e in g)if(g.hasOwnProperty(e)){f=RegExp(e,"g");d=d.replace(f,g[e])}return d};c.methods.formatString=function(d,e){for(var f in e){switch(f.charAt(0)){case "@":e[f]=
|
66 |
-
c.methods.checkPlain(e[f]);break;case "!":break;default:e[f]='<em class="placeholder">'+c.methods.checkPlain(e[f])+"</em>"}d=d.replace(f,e[f])}return d};c.methods.t=function(d,e,f){if(c.locale.strings&&c.locale.strings[f.context]&&c.locale.strings[f.context][d])d=c.locale.strings[f.context][d];if(e)d=c.methods.formatString(d,e);return d};c.t=function(d,e,f){if(typeof d==="string"&&d.length>0){var g=c.locale.getLanguage();f=f||{context:g};return c.methods.t(d,e,f)}else throw{name:"InvalidArgumentException",
|
67 |
-
message:"First argument is either not a string or empty."};};b.i18n=c})(document,mejs);(function(a){if(typeof mejsL10n!="undefined")a[mejsL10n.language]=mejsL10n.strings})(mejs.i18n.locale.strings);(function(a){a.de={Fullscreen:"Vollbild","Go Fullscreen":"Vollbild an","Turn off Fullscreen":"Vollbild aus",Close:"Schlie\u00dfen"}})(mejs.i18n.locale.strings);
|
68 |
-
(function(a){a.zh={Fullscreen:"\u5168\u87a2\u5e55","Go Fullscreen":"\u5168\u5c4f\u6a21\u5f0f","Turn off Fullscreen":"\u9000\u51fa\u5168\u5c4f\u6a21\u5f0f",Close:"\u95dc\u9589"}})(mejs.i18n.locale.strings);
|
69 |
-
|
70 |
-
/*!
|
71 |
-
* MediaElementPlayer
|
72 |
-
* http://mediaelementjs.com/
|
73 |
*
|
74 |
-
*
|
75 |
-
* using
|
76 |
*
|
77 |
-
* Copyright 2010-
|
78 |
* License: MIT
|
79 |
*
|
80 |
-
*/
|
81 |
-
(function(f){mejs.MepDefaults={poster:"",showPosterWhenEnded:false,defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:30,defaultSeekBackwardInterval:function(a){return a.duration*0.05},defaultSeekForwardInterval:function(a){return a.duration*0.05},audioWidth:-1,audioHeight:-1,startVolume:0.8,loop:false,autoRewind:true,enableAutosize:true,alwaysShowHours:false,showTimecodeFrameCount:false,framesPerSecond:25,autosizeProgress:true,alwaysShowControls:false,
|
82 |
-
hideVideoControlsOnLoad:false,clickToPlayPause:true,iPadUseNativeControls:false,iPhoneUseNativeControls:false,AndroidUseNativeControls:false,features:["playpause","current","progress","duration","tracks","volume","fullscreen"],isVideo:true,enableKeyboard:true,pauseOtherPlayers:true,keyActions:[{keys:[32,179],action:function(a,b){b.paused||b.ended?b.play():b.pause()}},{keys:[38],action:function(a,b){b.setVolume(Math.min(b.volume+0.1,1))}},{keys:[40],action:function(a,b){b.setVolume(Math.max(b.volume-
|
83 |
-
0.1,0))}},{keys:[37,227],action:function(a,b){if(!isNaN(b.duration)&&b.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}var c=Math.max(b.currentTime-a.options.defaultSeekBackwardInterval(b),0);b.setCurrentTime(c)}}},{keys:[39,228],action:function(a,b){if(!isNaN(b.duration)&&b.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}var c=Math.min(b.currentTime+a.options.defaultSeekForwardInterval(b),b.duration);b.setCurrentTime(c)}}},{keys:[70],action:function(a){if(typeof a.enterFullScreen!=
|
84 |
-
"undefined")a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}}]};mejs.mepIndex=0;mejs.players={};mejs.MediaElementPlayer=function(a,b){if(!(this instanceof mejs.MediaElementPlayer))return new mejs.MediaElementPlayer(a,b);this.$media=this.$node=f(a);this.node=this.media=this.$media[0];if(typeof this.node.player!="undefined")return this.node.player;else this.node.player=this;if(typeof b=="undefined")b=this.$node.data("mejsoptions");this.options=f.extend({},mejs.MepDefaults,b);this.id="mep_"+mejs.mepIndex++;
|
85 |
-
mejs.players[this.id]=this;this.init();return this};mejs.MediaElementPlayer.prototype={hasFocus:false,controlsAreVisible:true,init:function(){var a=this,b=mejs.MediaFeatures,c=f.extend(true,{},a.options,{success:function(d,g){a.meReady(d,g)},error:function(d){a.handleError(d)}}),e=a.media.tagName.toLowerCase();a.isDynamic=e!=="audio"&&e!=="video";a.isVideo=a.isDynamic?a.options.isVideo:e!=="audio"&&a.options.isVideo;if(b.isiPad&&a.options.iPadUseNativeControls||b.isiPhone&&a.options.iPhoneUseNativeControls){a.$media.attr("controls",
|
86 |
-
"controls");if(b.isiPad&&a.media.getAttribute("autoplay")!==null){a.media.load();a.media.play()}}else if(!(b.isAndroid&&a.options.AndroidUseNativeControls)){a.$media.removeAttr("controls");a.container=f('<div id="'+a.id+'" class="mejs-container '+(mejs.MediaFeatures.svg?"svg":"no-svg")+'"><div class="mejs-inner"><div class="mejs-mediaelement"></div><div class="mejs-layers"></div><div class="mejs-controls"></div><div class="mejs-clear"></div></div></div>').addClass(a.$media[0].className).insertBefore(a.$media);
|
87 |
-
a.container.addClass((b.isAndroid?"mejs-android ":"")+(b.isiOS?"mejs-ios ":"")+(b.isiPad?"mejs-ipad ":"")+(b.isiPhone?"mejs-iphone ":"")+(a.isVideo?"mejs-video ":"mejs-audio "));if(b.isiOS){b=a.$media.clone();a.container.find(".mejs-mediaelement").append(b);a.$media.remove();a.$node=a.$media=b;a.node=a.media=b[0]}else a.container.find(".mejs-mediaelement").append(a.$media);a.controls=a.container.find(".mejs-controls");a.layers=a.container.find(".mejs-layers");b=a.isVideo?"video":"audio";e=b.substring(0,
|
88 |
-
1).toUpperCase()+b.substring(1);a.width=a.options[b+"Width"]>0||a.options[b+"Width"].toString().indexOf("%")>-1?a.options[b+"Width"]:a.media.style.width!==""&&a.media.style.width!==null?a.media.style.width:a.media.getAttribute("width")!==null?a.$media.attr("width"):a.options["default"+e+"Width"];a.height=a.options[b+"Height"]>0||a.options[b+"Height"].toString().indexOf("%")>-1?a.options[b+"Height"]:a.media.style.height!==""&&a.media.style.height!==null?a.media.style.height:a.$media[0].getAttribute("height")!==
|
89 |
-
null?a.$media.attr("height"):a.options["default"+e+"Height"];a.setPlayerSize(a.width,a.height);c.pluginWidth=a.width;c.pluginHeight=a.height}mejs.MediaElement(a.$media[0],c);typeof a.container!="undefined"&&a.controlsAreVisible&&a.container.trigger("controlsshown")},showControls:function(a){var b=this;a=typeof a=="undefined"||a;if(!b.controlsAreVisible){if(a){b.controls.css("visibility","visible").stop(true,true).fadeIn(200,function(){b.controlsAreVisible=true;b.container.trigger("controlsshown")});
|
90 |
-
b.container.find(".mejs-control").css("visibility","visible").stop(true,true).fadeIn(200,function(){b.controlsAreVisible=true})}else{b.controls.css("visibility","visible").css("display","block");b.container.find(".mejs-control").css("visibility","visible").css("display","block");b.controlsAreVisible=true;b.container.trigger("controlsshown")}b.setControlsSize()}},hideControls:function(a){var b=this;a=typeof a=="undefined"||a;if(!(!b.controlsAreVisible||b.options.alwaysShowControls))if(a){b.controls.stop(true,
|
91 |
-
true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block");b.controlsAreVisible=false;b.container.trigger("controlshidden")});b.container.find(".mejs-control").stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block")})}else{b.controls.css("visibility","hidden").css("display","block");b.container.find(".mejs-control").css("visibility","hidden").css("display","block");b.controlsAreVisible=false;b.container.trigger("controlshidden")}},
|
92 |
-
controlsTimer:null,startControlsTimer:function(a){var b=this;a=typeof a!="undefined"?a:1500;b.killControlsTimer("start");b.controlsTimer=setTimeout(function(){b.hideControls();b.killControlsTimer("hide")},a)},killControlsTimer:function(){if(this.controlsTimer!==null){clearTimeout(this.controlsTimer);delete this.controlsTimer;this.controlsTimer=null}},controlsEnabled:true,disableControls:function(){this.killControlsTimer();this.hideControls(false);this.controlsEnabled=false},enableControls:function(){this.showControls(false);
|
93 |
-
this.controlsEnabled=true},meReady:function(a,b){var c=this,e=mejs.MediaFeatures,d=b.getAttribute("autoplay");d=!(typeof d=="undefined"||d===null||d==="false");var g;if(!c.created){c.created=true;c.media=a;c.domNode=b;if(!(e.isAndroid&&c.options.AndroidUseNativeControls)&&!(e.isiPad&&c.options.iPadUseNativeControls)&&!(e.isiPhone&&c.options.iPhoneUseNativeControls)){c.buildposter(c,c.controls,c.layers,c.media);c.buildkeyboard(c,c.controls,c.layers,c.media);c.buildoverlays(c,c.controls,c.layers,c.media);
|
94 |
-
c.findTracks();for(g in c.options.features){e=c.options.features[g];if(c["build"+e])try{c["build"+e](c,c.controls,c.layers,c.media)}catch(k){}}c.container.trigger("controlsready");c.setPlayerSize(c.width,c.height);c.setControlsSize();if(c.isVideo){if(mejs.MediaFeatures.hasTouch)c.$media.bind("touchstart",function(){if(c.controlsAreVisible)c.hideControls(false);else c.controlsEnabled&&c.showControls(false)});else{mejs.MediaElementPlayer.prototype.clickToPlayPauseCallback=function(){if(c.options.clickToPlayPause)c.media.paused?
|
95 |
-
c.media.play():c.media.pause()};c.media.addEventListener("click",c.clickToPlayPauseCallback,false);c.container.bind("mouseenter mouseover",function(){if(c.controlsEnabled)if(!c.options.alwaysShowControls){c.killControlsTimer("enter");c.showControls();c.startControlsTimer(2500)}}).bind("mousemove",function(){if(c.controlsEnabled){c.controlsAreVisible||c.showControls();c.options.alwaysShowControls||c.startControlsTimer(2500)}}).bind("mouseleave",function(){c.controlsEnabled&&!c.media.paused&&!c.options.alwaysShowControls&&
|
96 |
-
c.startControlsTimer(1E3)})}c.options.hideVideoControlsOnLoad&&c.hideControls(false);d&&!c.options.alwaysShowControls&&c.hideControls();c.options.enableAutosize&&c.media.addEventListener("loadedmetadata",function(j){if(c.options.videoHeight<=0&&c.domNode.getAttribute("height")===null&&!isNaN(j.target.videoHeight)){c.setPlayerSize(j.target.videoWidth,j.target.videoHeight);c.setControlsSize();c.media.setVideoSize(j.target.videoWidth,j.target.videoHeight)}},false)}a.addEventListener("play",function(){for(var j in mejs.players){var m=
|
97 |
-
mejs.players[j];m.id!=c.id&&c.options.pauseOtherPlayers&&!m.paused&&!m.ended&&m.pause();m.hasFocus=false}c.hasFocus=true},false);c.media.addEventListener("ended",function(){if(c.options.autoRewind)try{c.media.setCurrentTime(0)}catch(j){}c.media.pause();c.setProgressRail&&c.setProgressRail();c.setCurrentRail&&c.setCurrentRail();if(c.options.loop)c.media.play();else!c.options.alwaysShowControls&&c.controlsEnabled&&c.showControls()},false);c.media.addEventListener("loadedmetadata",function(){c.updateDuration&&
|
98 |
-
c.updateDuration();c.updateCurrent&&c.updateCurrent();if(!c.isFullScreen){c.setPlayerSize(c.width,c.height);c.setControlsSize()}},false);setTimeout(function(){c.setPlayerSize(c.width,c.height);c.setControlsSize()},50);c.globalBind("resize",function(){c.isFullScreen||mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen||c.setPlayerSize(c.width,c.height);c.setControlsSize()});c.media.pluginType=="youtube"&&c.container.find(".mejs-overlay-play").hide()}if(d&&a.pluginType=="native"){a.load();
|
99 |
-
a.play()}if(c.options.success)typeof c.options.success=="string"?window[c.options.success](c.media,c.domNode,c):c.options.success(c.media,c.domNode,c)}},handleError:function(a){this.controls.hide();this.options.error&&this.options.error(a)},setPlayerSize:function(a,b){if(typeof a!="undefined")this.width=a;if(typeof b!="undefined")this.height=b;if(this.height.toString().indexOf("%")>0||this.$node.css("max-width")==="100%"||parseInt(this.$node.css("max-width").replace(/px/,""),10)/this.$node.offsetParent().width()===
|
100 |
-
1||this.$node[0].currentStyle&&this.$node[0].currentStyle.maxWidth==="100%"){var c=this.isVideo?this.media.videoWidth&&this.media.videoWidth>0?this.media.videoWidth:this.options.defaultVideoWidth:this.options.defaultAudioWidth,e=this.isVideo?this.media.videoHeight&&this.media.videoHeight>0?this.media.videoHeight:this.options.defaultVideoHeight:this.options.defaultAudioHeight,d=this.container.parent().closest(":visible").width();c=this.isVideo||!this.options.autosizeProgress?parseInt(d*e/c,10):e;if(this.container.parent()[0].tagName.toLowerCase()===
|
101 |
-
"body"){d=f(window).width();c=f(window).height()}if(c!=0&&d!=0){this.container.width(d).height(c);this.$media.add(this.container.find(".mejs-shim")).width("100%").height("100%");this.isVideo&&this.media.setVideoSize&&this.media.setVideoSize(d,c);this.layers.children(".mejs-layer").width("100%").height("100%")}}else{this.container.width(this.width).height(this.height);this.layers.children(".mejs-layer").width(this.width).height(this.height)}d=this.layers.find(".mejs-overlay-play");c=d.find(".mejs-overlay-button");
|
102 |
-
d.height(this.container.height()-this.controls.height());c.css("margin-top","-"+(c.height()/2-this.controls.height()/2).toString()+"px")},setControlsSize:function(){var a=0,b=0,c=this.controls.find(".mejs-time-rail"),e=this.controls.find(".mejs-time-total");this.controls.find(".mejs-time-current");this.controls.find(".mejs-time-loaded");var d=c.siblings();if(this.options&&!this.options.autosizeProgress)b=parseInt(c.css("width"));if(b===0||!b){d.each(function(){var g=f(this);if(g.css("position")!=
|
103 |
-
"absolute"&&g.is(":visible"))a+=f(this).outerWidth(true)});b=this.controls.width()-a-(c.outerWidth(true)-c.width())}c.width(b);e.width(b-(e.outerWidth(true)-e.width()));this.setProgressRail&&this.setProgressRail();this.setCurrentRail&&this.setCurrentRail()},buildposter:function(a,b,c,e){var d=f('<div class="mejs-poster mejs-layer"></div>').appendTo(c);b=a.$media.attr("poster");if(a.options.poster!=="")b=a.options.poster;b!==""&&b!=null?this.setPoster(b):d.hide();e.addEventListener("play",function(){d.hide()},
|
104 |
-
false);a.options.showPosterWhenEnded&&a.options.autoRewind&&e.addEventListener("ended",function(){d.show()},false)},setPoster:function(a){var b=this.container.find(".mejs-poster"),c=b.find("img");if(c.length==0)c=f('<img width="100%" height="100%" />').appendTo(b);c.attr("src",a);b.css({"background-image":"url("+a+")"})},buildoverlays:function(a,b,c,e){var d=this;if(a.isVideo){var g=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(c),
|
105 |
-
k=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-error"></div></div>').hide().appendTo(c),j=f('<div class="mejs-overlay mejs-layer mejs-overlay-play"><div class="mejs-overlay-button"></div></div>').appendTo(c).click(function(){if(d.options.clickToPlayPause)e.paused?e.play():e.pause()});e.addEventListener("play",function(){j.hide();g.hide();b.find(".mejs-time-buffering").hide();k.hide()},false);e.addEventListener("playing",function(){j.hide();g.hide();b.find(".mejs-time-buffering").hide();
|
106 |
-
k.hide()},false);e.addEventListener("seeking",function(){g.show();b.find(".mejs-time-buffering").show()},false);e.addEventListener("seeked",function(){g.hide();b.find(".mejs-time-buffering").hide()},false);e.addEventListener("pause",function(){mejs.MediaFeatures.isiPhone||j.show()},false);e.addEventListener("waiting",function(){g.show();b.find(".mejs-time-buffering").show()},false);e.addEventListener("loadeddata",function(){g.show();b.find(".mejs-time-buffering").show()},false);e.addEventListener("canplay",
|
107 |
-
function(){g.hide();b.find(".mejs-time-buffering").hide()},false);e.addEventListener("error",function(){g.hide();b.find(".mejs-time-buffering").hide();k.show();k.find("mejs-overlay-error").html("Error loading this resource")},false)}},buildkeyboard:function(a,b,c,e){this.globalBind("keydown",function(d){if(a.hasFocus&&a.options.enableKeyboard)for(var g=0,k=a.options.keyActions.length;g<k;g++)for(var j=a.options.keyActions[g],m=0,q=j.keys.length;m<q;m++)if(d.keyCode==j.keys[m]){d.preventDefault();
|
108 |
-
j.action(a,e,d.keyCode);return false}return true});this.globalBind("click",function(d){if(f(d.target).closest(".mejs-container").length==0)a.hasFocus=false})},findTracks:function(){var a=this,b=a.$media.find("track");a.tracks=[];b.each(function(c,e){e=f(e);a.tracks.push({srclang:e.attr("srclang")?e.attr("srclang").toLowerCase():"",src:e.attr("src"),kind:e.attr("kind"),label:e.attr("label")||"",entries:[],isLoaded:false})})},changeSkin:function(a){this.container[0].className="mejs-container "+a;this.setPlayerSize(this.width,
|
109 |
-
this.height);this.setControlsSize()},play:function(){this.media.play()},pause:function(){try{this.media.pause()}catch(a){}},load:function(){this.media.load()},setMuted:function(a){this.media.setMuted(a)},setCurrentTime:function(a){this.media.setCurrentTime(a)},getCurrentTime:function(){return this.media.currentTime},setVolume:function(a){this.media.setVolume(a)},getVolume:function(){return this.media.volume},setSrc:function(a){this.media.setSrc(a)},remove:function(){var a,b;for(a in this.options.features){b=
|
110 |
-
this.options.features[a];if(this["clean"+b])try{this["clean"+b](this)}catch(c){}}if(this.isDynamic)this.$node.insertBefore(this.container);else{this.$media.prop("controls",true);this.$node.clone().show().insertBefore(this.container);this.$node.remove()}this.media.pluginType!=="native"&&this.media.remove();delete mejs.players[this.id];this.container.remove();this.globalUnbind();delete this.node.player}};(function(){function a(c,e){var d={d:[],w:[]};f.each((c||"").split(" "),function(g,k){var j=k+"."+
|
111 |
-
e;if(j.indexOf(".")===0){d.d.push(j);d.w.push(j)}else d[b.test(k)?"w":"d"].push(j)});d.d=d.d.join(" ");d.w=d.w.join(" ");return d}var b=/^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/;mejs.MediaElementPlayer.prototype.globalBind=function(c,e,d){c=a(c,this.id);c.d&&f(document).bind(c.d,e,d);c.w&&f(window).bind(c.w,e,d)};mejs.MediaElementPlayer.prototype.globalUnbind=function(c,e){c=a(c,this.id);c.d&&f(document).unbind(c.d,e);c.w&&f(window).unbind(c.w,
|
112 |
-
e)}})();if(typeof jQuery!="undefined")jQuery.fn.mediaelementplayer=function(a){a===false?this.each(function(){var b=jQuery(this).data("mediaelementplayer");b&&b.remove();jQuery(this).removeData("mediaelementplayer")}):this.each(function(){jQuery(this).data("mediaelementplayer",new mejs.MediaElementPlayer(this,a))});return this};f(document).ready(function(){f(".mejs-player").mediaelementplayer()});window.MediaElementPlayer=mejs.MediaElementPlayer})(mejs.$);
|
113 |
-
(function(f){f.extend(mejs.MepDefaults,{playpauseText:mejs.i18n.t("Play/Pause")});f.extend(MediaElementPlayer.prototype,{buildplaypause:function(a,b,c,e){var d=f('<div class="mejs-button mejs-playpause-button mejs-play" ><button type="button" aria-controls="'+this.id+'" title="'+this.options.playpauseText+'" aria-label="'+this.options.playpauseText+'"></button></div>').appendTo(b).click(function(g){g.preventDefault();e.paused?e.play():e.pause();return false});e.addEventListener("play",function(){d.removeClass("mejs-play").addClass("mejs-pause")},
|
114 |
-
false);e.addEventListener("playing",function(){d.removeClass("mejs-play").addClass("mejs-pause")},false);e.addEventListener("pause",function(){d.removeClass("mejs-pause").addClass("mejs-play")},false);e.addEventListener("paused",function(){d.removeClass("mejs-pause").addClass("mejs-play")},false)}})})(mejs.$);
|
115 |
-
(function(f){f.extend(mejs.MepDefaults,{stopText:"Stop"});f.extend(MediaElementPlayer.prototype,{buildstop:function(a,b,c,e){f('<div class="mejs-button mejs-stop-button mejs-stop"><button type="button" aria-controls="'+this.id+'" title="'+this.options.stopText+'" aria-label="'+this.options.stopText+'"></button></div>').appendTo(b).click(function(){e.paused||e.pause();if(e.currentTime>0){e.setCurrentTime(0);e.pause();b.find(".mejs-time-current").width("0px");b.find(".mejs-time-handle").css("left",
|
116 |
-
"0px");b.find(".mejs-time-float-current").html(mejs.Utility.secondsToTimeCode(0));b.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0));c.find(".mejs-poster").show()}})}})})(mejs.$);
|
117 |
-
(function(f){f.extend(MediaElementPlayer.prototype,{buildprogress:function(a,b,c,e){f('<div class="mejs-time-rail"><span class="mejs-time-total"><span class="mejs-time-buffering"></span><span class="mejs-time-loaded"></span><span class="mejs-time-current"></span><span class="mejs-time-handle"></span><span class="mejs-time-float"><span class="mejs-time-float-current">00:00</span><span class="mejs-time-float-corner"></span></span></span></div>').appendTo(b);b.find(".mejs-time-buffering").hide();var d=
|
118 |
-
this,g=b.find(".mejs-time-total");c=b.find(".mejs-time-loaded");var k=b.find(".mejs-time-current"),j=b.find(".mejs-time-handle"),m=b.find(".mejs-time-float"),q=b.find(".mejs-time-float-current"),p=function(h){h=h.pageX;var l=g.offset(),r=g.outerWidth(true),n=0,o=n=0;if(e.duration){if(h<l.left)h=l.left;else if(h>r+l.left)h=r+l.left;o=h-l.left;n=o/r;n=n<=0.02?0:n*e.duration;t&&n!==e.currentTime&&e.setCurrentTime(n);if(!mejs.MediaFeatures.hasTouch){m.css("left",o);q.html(mejs.Utility.secondsToTimeCode(n));
|
119 |
-
m.show()}}},t=false;g.bind("mousedown",function(h){if(h.which===1){t=true;p(h);d.globalBind("mousemove.dur",function(l){p(l)});d.globalBind("mouseup.dur",function(){t=false;m.hide();d.globalUnbind(".dur")});return false}}).bind("mouseenter",function(){d.globalBind("mousemove.dur",function(h){p(h)});mejs.MediaFeatures.hasTouch||m.show()}).bind("mouseleave",function(){if(!t){d.globalUnbind(".dur");m.hide()}});e.addEventListener("progress",function(h){a.setProgressRail(h);a.setCurrentRail(h)},false);
|
120 |
-
e.addEventListener("timeupdate",function(h){a.setProgressRail(h);a.setCurrentRail(h)},false);d.loaded=c;d.total=g;d.current=k;d.handle=j},setProgressRail:function(a){var b=a!=undefined?a.target:this.media,c=null;if(b&&b.buffered&&b.buffered.length>0&&b.buffered.end&&b.duration)c=b.buffered.end(0)/b.duration;else if(b&&b.bytesTotal!=undefined&&b.bytesTotal>0&&b.bufferedBytes!=undefined)c=b.bufferedBytes/b.bytesTotal;else if(a&&a.lengthComputable&&a.total!=0)c=a.loaded/a.total;if(c!==null){c=Math.min(1,
|
121 |
-
Math.max(0,c));this.loaded&&this.total&&this.loaded.width(this.total.width()*c)}},setCurrentRail:function(){if(this.media.currentTime!=undefined&&this.media.duration)if(this.total&&this.handle){var a=Math.round(this.total.width()*this.media.currentTime/this.media.duration),b=a-Math.round(this.handle.outerWidth(true)/2);this.current.width(a);this.handle.css("left",b)}}})})(mejs.$);
|
122 |
-
(function(f){f.extend(mejs.MepDefaults,{duration:-1,timeAndDurationSeparator:"<span> | </span>"});f.extend(MediaElementPlayer.prototype,{buildcurrent:function(a,b,c,e){f('<div class="mejs-time"><span class="mejs-currenttime">'+(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00")+"</span></div>").appendTo(b);this.currenttime=this.controls.find(".mejs-currenttime");e.addEventListener("timeupdate",function(){a.updateCurrent()},false)},buildduration:function(a,b,
|
123 |
-
c,e){if(b.children().last().find(".mejs-currenttime").length>0)f(this.options.timeAndDurationSeparator+'<span class="mejs-duration">'+(this.options.duration>0?mejs.Utility.secondsToTimeCode(this.options.duration,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25):(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span>").appendTo(b.find(".mejs-time"));else{b.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container");
|
124 |
-
f('<div class="mejs-time mejs-duration-container"><span class="mejs-duration">'+(this.options.duration>0?mejs.Utility.secondsToTimeCode(this.options.duration,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25):(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span></div>").appendTo(b)}this.durationD=this.controls.find(".mejs-duration");e.addEventListener("timeupdate",function(){a.updateDuration()},
|
125 |
-
false)},updateCurrent:function(){if(this.currenttime)this.currenttime.html(mejs.Utility.secondsToTimeCode(this.media.currentTime,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25))},updateDuration:function(){this.container.toggleClass("mejs-long-video",this.media.duration>3600);if(this.durationD&&(this.options.duration>0||this.media.duration))this.durationD.html(mejs.Utility.secondsToTimeCode(this.options.duration>0?this.options.duration:
|
126 |
-
this.media.duration,this.options.alwaysShowHours,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25))}})})(mejs.$);
|
127 |
-
(function(f){f.extend(mejs.MepDefaults,{muteText:mejs.i18n.t("Mute Toggle"),hideVolumeOnTouchDevices:true,audioVolume:"horizontal",videoVolume:"vertical"});f.extend(MediaElementPlayer.prototype,{buildvolume:function(a,b,c,e){if(!(mejs.MediaFeatures.hasTouch&&this.options.hideVolumeOnTouchDevices)){var d=this,g=d.isVideo?d.options.videoVolume:d.options.audioVolume,k=g=="horizontal"?f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+d.id+'" title="'+d.options.muteText+
|
128 |
-
'" aria-label="'+d.options.muteText+'"></button></div><div class="mejs-horizontal-volume-slider"><div class="mejs-horizontal-volume-total"></div><div class="mejs-horizontal-volume-current"></div><div class="mejs-horizontal-volume-handle"></div></div>').appendTo(b):f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+d.id+'" title="'+d.options.muteText+'" aria-label="'+d.options.muteText+'"></button><div class="mejs-volume-slider"><div class="mejs-volume-total"></div><div class="mejs-volume-current"></div><div class="mejs-volume-handle"></div></div></div>').appendTo(b),
|
129 |
-
j=d.container.find(".mejs-volume-slider, .mejs-horizontal-volume-slider"),m=d.container.find(".mejs-volume-total, .mejs-horizontal-volume-total"),q=d.container.find(".mejs-volume-current, .mejs-horizontal-volume-current"),p=d.container.find(".mejs-volume-handle, .mejs-horizontal-volume-handle"),t=function(n,o){if(!j.is(":visible")&&typeof o=="undefined"){j.show();t(n,true);j.hide()}else{n=Math.max(0,n);n=Math.min(n,1);n==0?k.removeClass("mejs-mute").addClass("mejs-unmute"):k.removeClass("mejs-unmute").addClass("mejs-mute");
|
130 |
-
if(g=="vertical"){var s=m.height(),u=m.position(),v=s-s*n;p.css("top",Math.round(u.top+v-p.height()/2));q.height(s-v);q.css("top",u.top+v)}else{s=m.width();u=m.position();s=s*n;p.css("left",Math.round(u.left+s-p.width()/2));q.width(Math.round(s))}}},h=function(n){var o=null,s=m.offset();if(g=="vertical"){o=m.height();parseInt(m.css("top").replace(/px/,""),10);o=(o-(n.pageY-s.top))/o;if(s.top==0||s.left==0)return}else{o=m.width();o=(n.pageX-s.left)/o}o=Math.max(0,o);o=Math.min(o,1);t(o);o==0?e.setMuted(true):
|
131 |
-
e.setMuted(false);e.setVolume(o)},l=false,r=false;k.hover(function(){j.show();r=true},function(){r=false;!l&&g=="vertical"&&j.hide()});j.bind("mouseover",function(){r=true}).bind("mousedown",function(n){h(n);d.globalBind("mousemove.vol",function(o){h(o)});d.globalBind("mouseup.vol",function(){l=false;d.globalUnbind(".vol");!r&&g=="vertical"&&j.hide()});l=true;return false});k.find("button").click(function(){e.setMuted(!e.muted)});e.addEventListener("volumechange",function(){if(!l)if(e.muted){t(0);
|
132 |
-
k.removeClass("mejs-mute").addClass("mejs-unmute")}else{t(e.volume);k.removeClass("mejs-unmute").addClass("mejs-mute")}},false);if(d.container.is(":visible")){t(a.options.startVolume);a.options.startVolume===0&&e.setMuted(true);e.pluginType==="native"&&e.setVolume(a.options.startVolume)}}}})})(mejs.$);
|
133 |
-
(function(f){f.extend(mejs.MepDefaults,{usePluginFullScreen:true,newWindowCallback:function(){return""},fullscreenText:mejs.i18n.t("Fullscreen")});f.extend(MediaElementPlayer.prototype,{isFullScreen:false,isNativeFullScreen:false,isInIframe:false,buildfullscreen:function(a,b,c,e){if(a.isVideo){a.isInIframe=window.location!=window.parent.location;if(mejs.MediaFeatures.hasTrueNativeFullScreen){c=function(){if(a.isFullScreen)if(mejs.MediaFeatures.isFullScreen()){a.isNativeFullScreen=true;a.setControlsSize()}else{a.isNativeFullScreen=
|
134 |
-
false;a.exitFullScreen()}};mejs.MediaFeatures.hasMozNativeFullScreen?a.globalBind(mejs.MediaFeatures.fullScreenEventName,c):a.container.bind(mejs.MediaFeatures.fullScreenEventName,c)}var d=this,g=f('<div class="mejs-button mejs-fullscreen-button"><button type="button" aria-controls="'+d.id+'" title="'+d.options.fullscreenText+'" aria-label="'+d.options.fullscreenText+'"></button></div>').appendTo(b);if(d.media.pluginType==="native"||!d.options.usePluginFullScreen&&!mejs.MediaFeatures.isFirefox)g.click(function(){mejs.MediaFeatures.hasTrueNativeFullScreen&&
|
135 |
-
mejs.MediaFeatures.isFullScreen()||a.isFullScreen?a.exitFullScreen():a.enterFullScreen()});else{var k=null;if(function(){var h=document.createElement("x"),l=document.documentElement,r=window.getComputedStyle;if(!("pointerEvents"in h.style))return false;h.style.pointerEvents="auto";h.style.pointerEvents="x";l.appendChild(h);r=r&&r(h,"").pointerEvents==="auto";l.removeChild(h);return!!r}()&&!mejs.MediaFeatures.isOpera){var j=false,m=function(){if(j){for(var h in q)q[h].hide();g.css("pointer-events",
|
136 |
-
"");d.controls.css("pointer-events","");d.media.removeEventListener("click",d.clickToPlayPauseCallback);j=false}},q={};b=["top","left","right","bottom"];var p,t=function(){var h=g.offset().left-d.container.offset().left,l=g.offset().top-d.container.offset().top,r=g.outerWidth(true),n=g.outerHeight(true),o=d.container.width(),s=d.container.height();for(p in q)q[p].css({position:"absolute",top:0,left:0});q.top.width(o).height(l);q.left.width(h).height(n).css({top:l});q.right.width(o-h-r).height(n).css({top:l,
|
137 |
-
left:h+r});q.bottom.width(o).height(s-n-l).css({top:l+n})};d.globalBind("resize",function(){t()});p=0;for(c=b.length;p<c;p++)q[b[p]]=f('<div class="mejs-fullscreen-hover" />').appendTo(d.container).mouseover(m).hide();g.on("mouseover",function(){if(!d.isFullScreen){var h=g.offset(),l=a.container.offset();e.positionFullscreenButton(h.left-l.left,h.top-l.top,false);g.css("pointer-events","none");d.controls.css("pointer-events","none");d.media.addEventListener("click",d.clickToPlayPauseCallback);for(p in q)q[p].show();
|
138 |
-
t();j=true}});e.addEventListener("fullscreenchange",function(){d.isFullScreen=!d.isFullScreen;d.isFullScreen?d.media.removeEventListener("click",d.clickToPlayPauseCallback):d.media.addEventListener("click",d.clickToPlayPauseCallback);m()});d.globalBind("mousemove",function(h){if(j){var l=g.offset();if(h.pageY<l.top||h.pageY>l.top+g.outerHeight(true)||h.pageX<l.left||h.pageX>l.left+g.outerWidth(true)){g.css("pointer-events","");d.controls.css("pointer-events","");j=false}}})}else g.on("mouseover",
|
139 |
-
function(){if(k!==null){clearTimeout(k);delete k}var h=g.offset(),l=a.container.offset();e.positionFullscreenButton(h.left-l.left,h.top-l.top,true)}).on("mouseout",function(){if(k!==null){clearTimeout(k);delete k}k=setTimeout(function(){e.hideFullscreenButton()},1500)})}a.fullscreenBtn=g;d.globalBind("keydown",function(h){if((mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||d.isFullScreen)&&h.keyCode==27)a.exitFullScreen()})}},cleanfullscreen:function(a){a.exitFullScreen()},
|
140 |
-
containerSizeTimeout:null,enterFullScreen:function(){var a=this;if(!(a.media.pluginType!=="native"&&(mejs.MediaFeatures.isFirefox||a.options.usePluginFullScreen))){f(document.documentElement).addClass("mejs-fullscreen");normalHeight=a.container.height();normalWidth=a.container.width();if(a.media.pluginType==="native")if(mejs.MediaFeatures.hasTrueNativeFullScreen){mejs.MediaFeatures.requestFullScreen(a.container[0]);a.isInIframe&&setTimeout(function c(){if(a.isNativeFullScreen)f(window).width()!==
|
141 |
-
screen.width?a.exitFullScreen():setTimeout(c,500)},500)}else if(mejs.MediaFeatures.hasSemiNativeFullScreen){a.media.webkitEnterFullscreen();return}if(a.isInIframe){var b=a.options.newWindowCallback(this);if(b!=="")if(mejs.MediaFeatures.hasTrueNativeFullScreen)setTimeout(function(){if(!a.isNativeFullScreen){a.pause();window.open(b,a.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no")}},250);else{a.pause();window.open(b,a.id,
|
142 |
-
"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no");return}}a.container.addClass("mejs-container-fullscreen").width("100%").height("100%");a.containerSizeTimeout=setTimeout(function(){a.container.css({width:"100%",height:"100%"});a.setControlsSize()},500);if(a.media.pluginType==="native")a.$media.width("100%").height("100%");else{a.container.find(".mejs-shim").width("100%").height("100%");a.media.setVideoSize(f(window).width(),
|
143 |
-
f(window).height())}a.layers.children("div").width("100%").height("100%");a.fullscreenBtn&&a.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen");a.setControlsSize();a.isFullScreen=true}},exitFullScreen:function(){clearTimeout(this.containerSizeTimeout);if(this.media.pluginType!=="native"&&mejs.MediaFeatures.isFirefox)this.media.setFullscreen(false);else{if(mejs.MediaFeatures.hasTrueNativeFullScreen&&(mejs.MediaFeatures.isFullScreen()||this.isFullScreen))mejs.MediaFeatures.cancelFullScreen();
|
144 |
-
f(document.documentElement).removeClass("mejs-fullscreen");this.container.removeClass("mejs-container-fullscreen").width(normalWidth).height(normalHeight);if(this.media.pluginType==="native")this.$media.width(normalWidth).height(normalHeight);else{this.container.find(".mejs-shim").width(normalWidth).height(normalHeight);this.media.setVideoSize(normalWidth,normalHeight)}this.layers.children("div").width(normalWidth).height(normalHeight);this.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen");
|
145 |
-
this.setControlsSize();this.isFullScreen=false}}})})(mejs.$);
|
146 |
-
(function(f){f.extend(mejs.MepDefaults,{startLanguage:"",tracksText:mejs.i18n.t("Captions/Subtitles"),hideCaptionsButtonWhenEmpty:true,toggleCaptionsButtonWhenOnlyOne:false,slidesSelector:""});f.extend(MediaElementPlayer.prototype,{hasChapters:false,buildtracks:function(a,b,c,e){if(a.tracks.length!=0){var d;if(this.domNode.textTracks)for(d=this.domNode.textTracks.length-1;d>=0;d--)this.domNode.textTracks[d].mode="hidden";a.chapters=f('<div class="mejs-chapters mejs-layer"></div>').prependTo(c).hide();a.captions=
|
147 |
-
f('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position mejs-captions-position-hover"><span class="mejs-captions-text"></span></div></div>').prependTo(c).hide();a.captionsText=a.captions.find(".mejs-captions-text");a.captionsButton=f('<div class="mejs-button mejs-captions-button"><button type="button" aria-controls="'+this.id+'" title="'+this.options.tracksText+'" aria-label="'+this.options.tracksText+'"></button><div class="mejs-captions-selector"><ul><li><input type="radio" name="'+
|
148 |
-
a.id+'_captions" id="'+a.id+'_captions_none" value="none" checked="checked" /><label for="'+a.id+'_captions_none">'+mejs.i18n.t("None")+"</label></li></ul></div></div>").appendTo(b);for(d=b=0;d<a.tracks.length;d++)a.tracks[d].kind=="subtitles"&&b++;this.options.toggleCaptionsButtonWhenOnlyOne&&b==1?a.captionsButton.on("click",function(){a.setTrack(a.selectedTrack==null?a.tracks[0].srclang:"none")}):a.captionsButton.hover(function(){f(this).find(".mejs-captions-selector").css("visibility","visible")},
|
149 |
-
function(){f(this).find(".mejs-captions-selector").css("visibility","hidden")}).on("click","input[type=radio]",function(){lang=this.value;a.setTrack(lang)});a.options.alwaysShowControls?a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover"):a.container.bind("controlsshown",function(){a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover")}).bind("controlshidden",function(){e.paused||a.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover")});
|
150 |
-
a.trackToLoad=-1;a.selectedTrack=null;a.isLoadingTrack=false;for(d=0;d<a.tracks.length;d++)a.tracks[d].kind=="subtitles"&&a.addTrackButton(a.tracks[d].srclang,a.tracks[d].label);a.loadNextTrack();e.addEventListener("timeupdate",function(){a.displayCaptions()},false);if(a.options.slidesSelector!=""){a.slidesContainer=f(a.options.slidesSelector);e.addEventListener("timeupdate",function(){a.displaySlides()},false)}e.addEventListener("loadedmetadata",function(){a.displayChapters()},false);a.container.hover(function(){if(a.hasChapters){a.chapters.css("visibility",
|
151 |
-
"visible");a.chapters.fadeIn(200).height(a.chapters.find(".mejs-chapter").outerHeight())}},function(){a.hasChapters&&!e.paused&&a.chapters.fadeOut(200,function(){f(this).css("visibility","hidden");f(this).css("display","block")})});a.node.getAttribute("autoplay")!==null&&a.chapters.css("visibility","hidden")}},setTrack:function(a){var b;if(a=="none"){this.selectedTrack=null;this.captionsButton.removeClass("mejs-captions-enabled")}else for(b=0;b<this.tracks.length;b++)if(this.tracks[b].srclang==a){this.selectedTrack==
|
152 |
-
null&&this.captionsButton.addClass("mejs-captions-enabled");this.selectedTrack=this.tracks[b];this.captions.attr("lang",this.selectedTrack.srclang);this.displayCaptions();break}},loadNextTrack:function(){this.trackToLoad++;if(this.trackToLoad<this.tracks.length){this.isLoadingTrack=true;this.loadTrack(this.trackToLoad)}else{this.isLoadingTrack=false;this.checkForTracks()}},loadTrack:function(a){var b=this,c=b.tracks[a];f.ajax({url:c.src,dataType:"text",success:function(e){c.entries=typeof e=="string"&&
|
153 |
-
/<tt\s+xml/ig.exec(e)?mejs.TrackFormatParser.dfxp.parse(e):mejs.TrackFormatParser.webvvt.parse(e);c.isLoaded=true;b.enableTrackButton(c.srclang,c.label);b.loadNextTrack();c.kind=="chapters"&&b.media.addEventListener("play",function(){b.media.duration>0&&b.displayChapters(c)},false);c.kind=="slides"&&b.setupSlides(c)},error:function(){b.loadNextTrack()}})},enableTrackButton:function(a,b){if(b==="")b=mejs.language.codes[a]||a;this.captionsButton.find("input[value="+a+"]").prop("disabled",false).siblings("label").html(b);
|
154 |
-
this.options.startLanguage==a&&f("#"+this.id+"_captions_"+a).click();this.adjustLanguageBox()},addTrackButton:function(a,b){if(b==="")b=mejs.language.codes[a]||a;this.captionsButton.find("ul").append(f('<li><input type="radio" name="'+this.id+'_captions" id="'+this.id+"_captions_"+a+'" value="'+a+'" disabled="disabled" /><label for="'+this.id+"_captions_"+a+'">'+b+" (loading)</label></li>"));this.adjustLanguageBox();this.container.find(".mejs-captions-translations option[value="+a+"]").remove()},
|
155 |
-
adjustLanguageBox:function(){this.captionsButton.find(".mejs-captions-selector").height(this.captionsButton.find(".mejs-captions-selector ul").outerHeight(true)+this.captionsButton.find(".mejs-captions-translations").outerHeight(true))},checkForTracks:function(){var a=false;if(this.options.hideCaptionsButtonWhenEmpty){for(i=0;i<this.tracks.length;i++)if(this.tracks[i].kind=="subtitles"){a=true;break}if(!a){this.captionsButton.hide();this.setControlsSize()}}},displayCaptions:function(){if(typeof this.tracks!=
|
156 |
-
"undefined"){var a,b=this.selectedTrack;if(b!=null&&b.isLoaded)for(a=0;a<b.entries.times.length;a++)if(this.media.currentTime>=b.entries.times[a].start&&this.media.currentTime<=b.entries.times[a].stop){this.captionsText.html(b.entries.text[a]);this.captions.show().height(0);return}this.captions.hide()}},setupSlides:function(a){this.slides=a;this.slides.entries.imgs=[this.slides.entries.text.length];this.showSlide(0)},showSlide:function(a){if(!(typeof this.tracks=="undefined"||typeof this.slidesContainer==
|
157 |
-
"undefined")){var b=this,c=b.slides.entries.text[a],e=b.slides.entries.imgs[a];if(typeof e=="undefined"||typeof e.fadeIn=="undefined")b.slides.entries.imgs[a]=e=f('<img src="'+c+'">').on("load",function(){e.appendTo(b.slidesContainer).hide().fadeIn().siblings(":visible").fadeOut()});else!e.is(":visible")&&!e.is(":animated")&&e.fadeIn().siblings(":visible").fadeOut()}},displaySlides:function(){if(typeof this.slides!="undefined"){var a=this.slides,b;for(b=0;b<a.entries.times.length;b++)if(this.media.currentTime>=
|
158 |
-
a.entries.times[b].start&&this.media.currentTime<=a.entries.times[b].stop){this.showSlide(b);break}}},displayChapters:function(){var a;for(a=0;a<this.tracks.length;a++)if(this.tracks[a].kind=="chapters"&&this.tracks[a].isLoaded){this.drawChapters(this.tracks[a]);this.hasChapters=true;break}},drawChapters:function(a){var b=this,c,e,d=e=0;b.chapters.empty();for(c=0;c<a.entries.times.length;c++){e=a.entries.times[c].stop-a.entries.times[c].start;e=Math.floor(e/b.media.duration*100);if(e+d>100||c==a.entries.times.length-
|
159 |
-
1&&e+d<100)e=100-d;b.chapters.append(f('<div class="mejs-chapter" rel="'+a.entries.times[c].start+'" style="left: '+d.toString()+"%;width: "+e.toString()+'%;"><div class="mejs-chapter-block'+(c==a.entries.times.length-1?" mejs-chapter-block-last":"")+'"><span class="ch-title">'+a.entries.text[c]+'</span><span class="ch-time">'+mejs.Utility.secondsToTimeCode(a.entries.times[c].start)+"–"+mejs.Utility.secondsToTimeCode(a.entries.times[c].stop)+"</span></div></div>"));d+=e}b.chapters.find("div.mejs-chapter").click(function(){b.media.setCurrentTime(parseFloat(f(this).attr("rel")));
|
160 |
-
b.media.paused&&b.media.play()});b.chapters.show()}});mejs.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",be:"Belarusian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese","zh-cn":"Chinese Simplified","zh-tw":"Chinese Traditional",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",tl:"Filipino",fi:"Finnish",fr:"French",gl:"Galician",de:"German",el:"Greek",ht:"Haitian Creole",iw:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",
|
161 |
-
ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",mt:"Maltese",no:"Norwegian",fa:"Persian",pl:"Polish",pt:"Portuguese",ro:"Romanian",ru:"Russian",sr:"Serbian",sk:"Slovak",sl:"Slovenian",es:"Spanish",sw:"Swahili",sv:"Swedish",tl:"Tagalog",th:"Thai",tr:"Turkish",uk:"Ukrainian",vi:"Vietnamese",cy:"Welsh",yi:"Yiddish"}};mejs.TrackFormatParser={webvvt:{pattern_identifier:/^([a-zA-z]+-)?[0-9]+$/,pattern_timecode:/^([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,
|
162 |
-
parse:function(a){var b=0;a=mejs.TrackFormatParser.split2(a,/\r?\n/);for(var c={text:[],times:[]},e,d;b<a.length;b++)if(this.pattern_identifier.exec(a[b])){b++;if((e=this.pattern_timecode.exec(a[b]))&&b<a.length){b++;d=a[b];for(b++;a[b]!==""&&b<a.length;){d=d+"\n"+a[b];b++}d=f.trim(d).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,"<a href='$1' target='_blank'>$1</a>");c.text.push(d);c.times.push({start:mejs.Utility.convertSMPTEtoSeconds(e[1])==0?0.2:mejs.Utility.convertSMPTEtoSeconds(e[1]),
|
163 |
-
stop:mejs.Utility.convertSMPTEtoSeconds(e[3]),settings:e[5]})}}return c}},dfxp:{parse:function(a){a=f(a).filter("tt");var b=0;b=a.children("div").eq(0);var c=b.find("p");b=a.find("#"+b.attr("style"));var e,d;a={text:[],times:[]};if(b.length){d=b.removeAttr("id").get(0).attributes;if(d.length){e={};for(b=0;b<d.length;b++)e[d[b].name.split(":")[1]]=d[b].value}}for(b=0;b<c.length;b++){var g;d={start:null,stop:null,style:null};if(c.eq(b).attr("begin"))d.start=mejs.Utility.convertSMPTEtoSeconds(c.eq(b).attr("begin"));
|
164 |
-
if(!d.start&&c.eq(b-1).attr("end"))d.start=mejs.Utility.convertSMPTEtoSeconds(c.eq(b-1).attr("end"));if(c.eq(b).attr("end"))d.stop=mejs.Utility.convertSMPTEtoSeconds(c.eq(b).attr("end"));if(!d.stop&&c.eq(b+1).attr("begin"))d.stop=mejs.Utility.convertSMPTEtoSeconds(c.eq(b+1).attr("begin"));if(e){g="";for(var k in e)g+=k+":"+e[k]+";"}if(g)d.style=g;if(d.start==0)d.start=0.2;a.times.push(d);d=f.trim(c.eq(b).html()).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,
|
165 |
-
"<a href='$1' target='_blank'>$1</a>");a.text.push(d);if(a.times.start==0)a.times.start=2}return a}},split2:function(a,b){return a.split(b)}};if("x\n\ny".split(/\n/gi).length!=3)mejs.TrackFormatParser.split2=function(a,b){var c=[],e="",d;for(d=0;d<a.length;d++){e+=a.substring(d,d+1);if(b.test(e)){c.push(e.replace(b,""));e=""}}c.push(e);return c}})(mejs.$);
|
166 |
-
(function(f){f.extend(mejs.MepDefaults,{contextMenuItems:[{render:function(a){if(typeof a.enterFullScreen=="undefined")return null;return a.isFullScreen?mejs.i18n.t("Turn off Fullscreen"):mejs.i18n.t("Go Fullscreen")},click:function(a){a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}},{render:function(a){return a.media.muted?mejs.i18n.t("Unmute"):mejs.i18n.t("Mute")},click:function(a){a.media.muted?a.setMuted(false):a.setMuted(true)}},{isSeparator:true},{render:function(){return mejs.i18n.t("Download Video")},
|
167 |
-
click:function(a){window.location.href=a.media.currentSrc}}]});f.extend(MediaElementPlayer.prototype,{buildcontextmenu:function(a){a.contextMenu=f('<div class="mejs-contextmenu"></div>').appendTo(f("body")).hide();a.container.bind("contextmenu",function(b){if(a.isContextMenuEnabled){b.preventDefault();a.renderContextMenu(b.clientX-1,b.clientY-1);return false}});a.container.bind("click",function(){a.contextMenu.hide()});a.contextMenu.bind("mouseleave",function(){a.startContextMenuTimer()})},cleancontextmenu:function(a){a.contextMenu.remove()},
|
168 |
-
isContextMenuEnabled:true,enableContextMenu:function(){this.isContextMenuEnabled=true},disableContextMenu:function(){this.isContextMenuEnabled=false},contextMenuTimeout:null,startContextMenuTimer:function(){var a=this;a.killContextMenuTimer();a.contextMenuTimer=setTimeout(function(){a.hideContextMenu();a.killContextMenuTimer()},750)},killContextMenuTimer:function(){var a=this.contextMenuTimer;if(a!=null){clearTimeout(a);delete a}},hideContextMenu:function(){this.contextMenu.hide()},renderContextMenu:function(a,
|
169 |
-
b){for(var c=this,e="",d=c.options.contextMenuItems,g=0,k=d.length;g<k;g++)if(d[g].isSeparator)e+='<div class="mejs-contextmenu-separator"></div>';else{var j=d[g].render(c);if(j!=null)e+='<div class="mejs-contextmenu-item" data-itemindex="'+g+'" id="element-'+Math.random()*1E6+'">'+j+"</div>"}c.contextMenu.empty().append(f(e)).css({top:b,left:a}).show();c.contextMenu.find(".mejs-contextmenu-item").each(function(){var m=f(this),q=parseInt(m.data("itemindex"),10),p=c.options.contextMenuItems[q];typeof p.show!=
|
170 |
-
"undefined"&&p.show(m,c);m.click(function(){typeof p.click!="undefined"&&p.click(c);c.contextMenu.hide()})});setTimeout(function(){c.killControlsTimer("rev3")},100)}})})(mejs.$);
|
171 |
-
(function(f){f.extend(mejs.MepDefaults,{postrollCloseText:mejs.i18n.t("Close")});f.extend(MediaElementPlayer.prototype,{buildpostroll:function(a,b,c){var e=this.container.find('link[rel="postroll"]').attr("href");if(typeof e!=="undefined"){a.postroll=f('<div class="mejs-postroll-layer mejs-layer"><a class="mejs-postroll-close" onclick="$(this).parent().hide();return false;">'+this.options.postrollCloseText+'</a><div class="mejs-postroll-layer-content"></div></div>').prependTo(c).hide();this.media.addEventListener("ended",
|
172 |
-
function(){f.ajax({dataType:"html",url:e,success:function(d){c.find(".mejs-postroll-layer-content").html(d)}});a.postroll.show()},false)}}})})(mejs.$);
|
173 |
-
|
1 |
/*!
|
2 |
+
* MediaElement.js
|
3 |
+
* http://www.mediaelementjs.com/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
*
|
5 |
+
* Wrapper that mimics native HTML5 MediaElement (audio and video)
|
6 |
+
* using a variety of technologies (pure JavaScript, Flash, iframe)
|
7 |
*
|
8 |
+
* Copyright 2010-2017, John Dyer (http://j.hn/)
|
9 |
* License: MIT
|
10 |
*
|
11 |
+
*/
|
12 |
+
!function e(t,n,i){function o(a,s){if(!n[a]){if(!t[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(r)return r(a,!0);var d=new Error("Cannot find module '"+a+"'");throw d.code="MODULE_NOT_FOUND",d}var u=n[a]={exports:{}};t[a][0].call(u.exports,function(e){var n=t[a][1][e];return o(n||e)},u,u.exports,e,t,n,i)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a<i.length;a++)o(i[a]);return o}({1:[function(e,t,n){},{}],2:[function(e,t,n){(function(n){var i,o=void 0!==n?n:"undefined"!=typeof window?window:{},r=e(1);"undefined"!=typeof document?i=document:(i=o["__GLOBAL_DOCUMENT_CACHE@4"])||(i=o["__GLOBAL_DOCUMENT_CACHE@4"]=r),t.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{1:1}],3:[function(e,t,n){(function(e){var n;n="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(e,t,n){!function(e){function n(){}function i(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],l(e,this)}function o(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,i._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null!==n){var i;try{i=n(e._value)}catch(e){return void a(t.promise,e)}r(t.promise,i)}else(1===e._state?r:a)(t.promise,e._value)})):e._deferreds.push(t)}function r(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof i)return e._state=3,e._value=t,void s(e);if("function"==typeof n)return void l(function(e,t){return function(){e.apply(t,arguments)}}(n,t),e)}e._state=1,e._value=t,s(e)}catch(t){a(e,t)}}function a(e,t){e._state=2,e._value=t,s(e)}function s(e){2===e._state&&0===e._deferreds.length&&i._immediateFn(function(){e._handled||i._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t<n;t++)o(e,e._deferreds[t]);e._deferreds=null}function l(e,t){var n=!1;try{e(function(e){n||(n=!0,r(t,e))},function(e){n||(n=!0,a(t,e))})}catch(e){if(n)return;n=!0,a(t,e)}}var d=setTimeout;i.prototype.catch=function(e){return this.then(null,e)},i.prototype.then=function(e,t){var i=new this.constructor(n);return o(this,new function(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}(e,t,i)),i},i.all=function(e){var t=Array.prototype.slice.call(e);return new i(function(e,n){function i(r,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,function(e){i(r,e)},n)}t[r]=a,0==--o&&e(t)}catch(e){n(e)}}if(0===t.length)return e([]);for(var o=t.length,r=0;r<t.length;r++)i(r,t[r])})},i.resolve=function(e){return e&&"object"==typeof e&&e.constructor===i?e:new i(function(t){t(e)})},i.reject=function(e){return new i(function(t,n){n(e)})},i.race=function(e){return new i(function(t,n){for(var i=0,o=e.length;i<o;i++)e[i].then(t,n)})},i._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){d(e,0)},i._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)},i._setImmediateFn=function(e){i._immediateFn=e},i._setUnhandledRejectionFn=function(e){i._unhandledRejectionFn=e},void 0!==t&&t.exports?t.exports=i:e.Promise||(e.Promise=i)}(this)},{}],5:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(e){return e&&e.__esModule?e:{default:e}}(e(7)),r=e(15),a=e(27),s={lang:"en",en:r.EN};s.language=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(null!==t&&void 0!==t&&t.length){if("string"!=typeof t[0])throw new TypeError("Language code must be a string value");if(!/^[a-z]{2,3}((\-|_)[a-z]{2})?$/i.test(t[0]))throw new TypeError("Language code must have format 2-3 letters and. optionally, hyphen, underscore followed by 2 more letters");s.lang=t[0],void 0===s[t[0]]?(t[1]=null!==t[1]&&void 0!==t[1]&&"object"===i(t[1])?t[1]:{},s[t[0]]=(0,a.isObjectEmpty)(t[1])?r.EN:t[1]):null!==t[1]&&void 0!==t[1]&&"object"===i(t[1])&&(s[t[0]]=t[1])}return s.lang},s.t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof e&&e.length){var n=void 0,o=void 0,r=s.language(),l=function(e,t,n){if("object"!==(void 0===e?"undefined":i(e))||"number"!=typeof t||"number"!=typeof n)return e;return[function(){return arguments.length<=1?void 0:arguments[1]},function(){return 1===(arguments.length<=0?void 0:arguments[0])?arguments.length<=1?void 0:arguments[1]:arguments.length<=2?void 0:arguments[2]},function(){return 0===(arguments.length<=0?void 0:arguments[0])||1===(arguments.length<=0?void 0:arguments[0])?arguments.length<=1?void 0:arguments[1]:arguments.length<=2?void 0:arguments[2]},function(){return(arguments.length<=0?void 0:arguments[0])%10==1&&(arguments.length<=0?void 0:arguments[0])%100!=11?arguments.length<=1?void 0:arguments[1]:0!==(arguments.length<=0?void 0:arguments[0])?arguments.length<=2?void 0:arguments[2]:arguments.length<=3?void 0:arguments[3]},function(){return 1===(arguments.length<=0?void 0:arguments[0])||11===(arguments.length<=0?void 0:arguments[0])?arguments.length<=1?void 0:arguments[1]:2===(arguments.length<=0?void 0:arguments[0])||12===(arguments.length<=0?void 0:arguments[0])?arguments.length<=2?void 0:arguments[2]:(arguments.length<=0?void 0:arguments[0])>2&&(arguments.length<=0?void 0:arguments[0])<20?arguments.length<=3?void 0:arguments[3]:arguments.length<=4?void 0:arguments[4]},function(){return 1===(arguments.length<=0?void 0:arguments[0])?arguments.length<=1?void 0:arguments[1]:0===(arguments.length<=0?void 0:arguments[0])||(arguments.length<=0?void 0:arguments[0])%100>0&&(arguments.length<=0?void 0:arguments[0])%100<20?arguments.length<=2?void 0:arguments[2]:arguments.length<=3?void 0:arguments[3]},function(){return(arguments.length<=0?void 0:arguments[0])%10==1&&(arguments.length<=0?void 0:arguments[0])%100!=11?arguments.length<=1?void 0:arguments[1]:(arguments.length<=0?void 0:arguments[0])%10>=2&&((arguments.length<=0?void 0:arguments[0])%100<10||(arguments.length<=0?void 0:arguments[0])%100>=20)?arguments.length<=2?void 0:arguments[2]:[3]},function(){return(arguments.length<=0?void 0:arguments[0])%10==1&&(arguments.length<=0?void 0:arguments[0])%100!=11?arguments.length<=1?void 0:arguments[1]:(arguments.length<=0?void 0:arguments[0])%10>=2&&(arguments.length<=0?void 0:arguments[0])%10<=4&&((arguments.length<=0?void 0:arguments[0])%100<10||(arguments.length<=0?void 0:arguments[0])%100>=20)?arguments.length<=2?void 0:arguments[2]:arguments.length<=3?void 0:arguments[3]},function(){return 1===(arguments.length<=0?void 0:arguments[0])?arguments.length<=1?void 0:arguments[1]:(arguments.length<=0?void 0:arguments[0])>=2&&(arguments.length<=0?void 0:arguments[0])<=4?arguments.length<=2?void 0:arguments[2]:arguments.length<=3?void 0:arguments[3]},function(){return 1===(arguments.length<=0?void 0:arguments[0])?arguments.length<=1?void 0:arguments[1]:(arguments.length<=0?void 0:arguments[0])%10>=2&&(arguments.length<=0?void 0:arguments[0])%10<=4&&((arguments.length<=0?void 0:arguments[0])%100<10||(arguments.length<=0?void 0:arguments[0])%100>=20)?arguments.length<=2?void 0:arguments[2]:arguments.length<=3?void 0:arguments[3]},function(){return(arguments.length<=0?void 0:arguments[0])%100==1?arguments.length<=2?void 0:arguments[2]:(arguments.length<=0?void 0:arguments[0])%100==2?arguments.length<=3?void 0:arguments[3]:(arguments.length<=0?void 0:arguments[0])%100==3||(arguments.length<=0?void 0:arguments[0])%100==4?arguments.length<=4?void 0:arguments[4]:arguments.length<=1?void 0:arguments[1]},function(){return 1===(arguments.length<=0?void 0:arguments[0])?arguments.length<=1?void 0:arguments[1]:2===(arguments.length<=0?void 0:arguments[0])?arguments.length<=2?void 0:arguments[2]:(arguments.length<=0?void 0:arguments[0])>2&&(arguments.length<=0?void 0:arguments[0])<7?arguments.length<=3?void 0:arguments[3]:(arguments.length<=0?void 0:arguments[0])>6&&(arguments.length<=0?void 0:arguments[0])<11?arguments.length<=4?void 0:arguments[4]:arguments.length<=5?void 0:arguments[5]},function(){return 0===(arguments.length<=0?void 0:arguments[0])?arguments.length<=1?void 0:arguments[1]:1===(arguments.length<=0?void 0:arguments[0])?arguments.length<=2?void 0:arguments[2]:2===(arguments.length<=0?void 0:arguments[0])?arguments.length<=3?void 0:arguments[3]:(arguments.length<=0?void 0:arguments[0])%100>=3&&(arguments.length<=0?void 0:arguments[0])%100<=10?arguments.length<=4?void 0:arguments[4]:(arguments.length<=0?void 0:arguments[0])%100>=11?arguments.length<=5?void 0:arguments[5]:arguments.length<=6?void 0:arguments[6]},function(){return 1===(arguments.length<=0?void 0:arguments[0])?arguments.length<=1?void 0:arguments[1]:0===(arguments.length<=0?void 0:arguments[0])||(arguments.length<=0?void 0:arguments[0])%100>1&&(arguments.length<=0?void 0:arguments[0])%100<11?arguments.length<=2?void 0:arguments[2]:(arguments.length<=0?void 0:arguments[0])%100>10&&(arguments.length<=0?void 0:arguments[0])%100<20?arguments.length<=3?void 0:arguments[3]:arguments.length<=4?void 0:arguments[4]},function(){return(arguments.length<=0?void 0:arguments[0])%10==1?arguments.length<=1?void 0:arguments[1]:(arguments.length<=0?void 0:arguments[0])%10==2?arguments.length<=2?void 0:arguments[2]:arguments.length<=3?void 0:arguments[3]},function(){return 11!==(arguments.length<=0?void 0:arguments[0])&&(arguments.length<=0?void 0:arguments[0])%10==1?arguments.length<=1?void 0:arguments[1]:arguments.length<=2?void 0:arguments[2]},function(){return 1===(arguments.length<=0?void 0:arguments[0])?arguments.length<=1?void 0:arguments[1]:(arguments.length<=0?void 0:arguments[0])%10>=2&&(arguments.length<=0?void 0:arguments[0])%10<=4&&((arguments.length<=0?void 0:arguments[0])%100<10||(arguments.length<=0?void 0:arguments[0])%100>=20)?arguments.length<=2?void 0:arguments[2]:arguments.length<=3?void 0:arguments[3]},function(){return 1===(arguments.length<=0?void 0:arguments[0])?arguments.length<=1?void 0:arguments[1]:2===(arguments.length<=0?void 0:arguments[0])?arguments.length<=2?void 0:arguments[2]:8!==(arguments.length<=0?void 0:arguments[0])&&11!==(arguments.length<=0?void 0:arguments[0])?arguments.length<=3?void 0:arguments[3]:arguments.length<=4?void 0:arguments[4]},function(){return 0===(arguments.length<=0?void 0:arguments[0])?arguments.length<=1?void 0:arguments[1]:arguments.length<=2?void 0:arguments[2]},function(){return 1===(arguments.length<=0?void 0:arguments[0])?arguments.length<=1?void 0:arguments[1]:2===(arguments.length<=0?void 0:arguments[0])?arguments.length<=2?void 0:arguments[2]:3===(arguments.length<=0?void 0:arguments[0])?arguments.length<=3?void 0:arguments[3]:arguments.length<=4?void 0:arguments[4]},function(){return 0===(arguments.length<=0?void 0:arguments[0])?arguments.length<=1?void 0:arguments[1]:1===(arguments.length<=0?void 0:arguments[0])?arguments.length<=2?void 0:arguments[2]:arguments.length<=3?void 0:arguments[3]}][n].apply(null,[t].concat(e))};return void 0!==s[r]&&(n=s[r][e],null!==t&&"number"==typeof t&&(o=s[r]["mejs.plural-form"],n=l.apply(null,[n,t,o]))),!n&&s.en&&(n=s.en[e],null!==t&&"number"==typeof t&&(o=s.en["mejs.plural-form"],n=l.apply(null,[n,t,o]))),n=n||e,null!==t&&"number"==typeof t&&(n=n.replace("%1",t)),(0,a.escapeHTML)(n)}return e},o.default.i18n=s,"undefined"!=typeof mejsL10n&&o.default.i18n.language(mejsL10n.language,mejsL10n.strings),n.default=s},{15:15,27:27,7:7}],6:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=i(e(3)),a=i(e(2)),s=i(e(7)),l=e(27),d=e(28),u=e(8),c=e(25),f=function e(t,n,i){var f=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var p=this;i=Array.isArray(i)?i:null,p.defaults={renderers:[],fakeNodeName:"mediaelementwrapper",pluginPath:"build/",shimScriptAccess:"sameDomain"},n=Object.assign(p.defaults,n),p.mediaElement=a.default.createElement(n.fakeNodeName);var m=t,h=!1;if("string"==typeof t?p.mediaElement.originalNode=a.default.getElementById(t):(p.mediaElement.originalNode=t,m=t.id),void 0===p.mediaElement.originalNode||null===p.mediaElement.originalNode)return null;p.mediaElement.options=n,m=m||"mejs_"+Math.random().toString().slice(2),p.mediaElement.originalNode.setAttribute("id",m+"_from_mejs");var v=p.mediaElement.originalNode.tagName.toLowerCase();["video","audio"].indexOf(v)>-1&&!p.mediaElement.originalNode.getAttribute("preload")&&p.mediaElement.originalNode.setAttribute("preload","none"),p.mediaElement.originalNode.parentNode.insertBefore(p.mediaElement,p.mediaElement.originalNode),p.mediaElement.appendChild(p.mediaElement.originalNode);var g=function(e,t){if("https:"===r.default.location.protocol&&0===e.indexOf("http:")&&c.IS_IOS&&s.default.html5media.mediaTypes.indexOf(t)>-1){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===this.readyState&&200===this.status){var t=(r.default.URL||r.default.webkitURL).createObjectURL(this.response);return p.mediaElement.originalNode.setAttribute("src",t),t}return e},n.open("GET",e),n.responseType="blob",n.send()}return e},y=void 0;if(null!==i)y=i;else if(null!==p.mediaElement.originalNode)switch(y=[],p.mediaElement.originalNode.nodeName.toLowerCase()){case"iframe":y.push({type:"",src:p.mediaElement.originalNode.getAttribute("src")});break;case"audio":case"video":var E=p.mediaElement.originalNode.children.length,b=p.mediaElement.originalNode.getAttribute("src");if(b){var S=p.mediaElement.originalNode,x=(0,d.formatType)(b,S.getAttribute("type"));y.push({type:x,src:g(b,x)})}for(var w=0;w<E;w++){var P=p.mediaElement.originalNode.children[w];if("source"===P.tagName.toLowerCase()){var T=P.getAttribute("src"),C=(0,d.formatType)(T,P.getAttribute("type"));y.push({type:C,src:g(T,C)})}}}p.mediaElement.id=m,p.mediaElement.renderers={},p.mediaElement.events={},p.mediaElement.promises=[],p.mediaElement.renderer=null,p.mediaElement.rendererName=null,p.mediaElement.changeRenderer=function(e,t){var n=f,i=Object.keys(t[0]).length>2?t[0]:t[0].src;if(void 0!==n.mediaElement.renderer&&null!==n.mediaElement.renderer&&n.mediaElement.renderer.name===e)return n.mediaElement.renderer.pause(),n.mediaElement.renderer.stop&&n.mediaElement.renderer.stop(),n.mediaElement.renderer.show(),n.mediaElement.renderer.setSrc(i),!0;void 0!==n.mediaElement.renderer&&null!==n.mediaElement.renderer&&(n.mediaElement.renderer.pause(),n.mediaElement.renderer.stop&&n.mediaElement.renderer.stop(),n.mediaElement.renderer.hide());var o=n.mediaElement.renderers[e],r=null;if(void 0!==o&&null!==o)return o.show(),o.setSrc(i),n.mediaElement.renderer=o,n.mediaElement.rendererName=e,!0;for(var a=n.mediaElement.options.renderers.length?n.mediaElement.options.renderers:u.renderer.order,s=0,l=a.length;s<l;s++){var d=a[s];if(d===e){r=u.renderer.renderers[d];var c=Object.assign(r.options,n.mediaElement.options);return o=r.create(n.mediaElement,c,t),o.name=e,n.mediaElement.renderers[r.name]=o,n.mediaElement.renderer=o,n.mediaElement.rendererName=e,o.show(),!0}}return!1},p.mediaElement.setSize=function(e,t){void 0!==p.mediaElement.renderer&&null!==p.mediaElement.renderer&&p.mediaElement.renderer.setSize(e,t)},p.mediaElement.generateError=function(e,t){e=e||"",t=Array.isArray(t)?t:[];var n=(0,l.createEvent)("error",p.mediaElement);n.message=e,n.urls=t,p.mediaElement.dispatchEvent(n),h=!0};var k=s.default.html5media.properties,_=s.default.html5media.methods,N=function(e,t,n,i){var o=e[t];Object.defineProperty(e,t,{get:function(){return n.apply(e,[o])},set:function(t){return o=i.apply(e,[t])}})},A=function(e){if("src"!==e){var t=""+e.substring(0,1).toUpperCase()+e.substring(1),n=function(){return void 0!==p.mediaElement.renderer&&null!==p.mediaElement.renderer&&"function"==typeof p.mediaElement.renderer["get"+t]?p.mediaElement.renderer["get"+t]():null},i=function(e){void 0!==p.mediaElement.renderer&&null!==p.mediaElement.renderer&&"function"==typeof p.mediaElement.renderer["set"+t]&&p.mediaElement.renderer["set"+t](e)};N(p.mediaElement,e,n,i),p.mediaElement["get"+t]=n,p.mediaElement["set"+t]=i}},L=function(){return void 0!==p.mediaElement.renderer&&null!==p.mediaElement.renderer?p.mediaElement.renderer.getSrc():null},F=function(e){var t=[];if("string"==typeof e)t.push({src:e,type:e?(0,d.getTypeFromFile)(e):""});else if("object"===(void 0===e?"undefined":o(e))&&void 0!==e.src){var n=(0,d.absolutizeUrl)(e.src),i=e.type,r=Object.assign(e,{src:n,type:""!==i&&null!==i&&void 0!==i||!n?i:(0,d.getTypeFromFile)(n)});t.push(r)}else if(Array.isArray(e))for(var a=0,s=e.length;a<s;a++){var c=(0,d.absolutizeUrl)(e[a].src),f=e[a].type,m=Object.assign(e[a],{src:c,type:""!==f&&null!==f&&void 0!==f||!c?f:(0,d.getTypeFromFile)(c)});t.push(m)}var h=u.renderer.select(t,p.mediaElement.options.renderers.length?p.mediaElement.options.renderers:[]),v=void 0;if(p.mediaElement.paused||(p.mediaElement.pause(),v=(0,l.createEvent)("pause",p.mediaElement),p.mediaElement.dispatchEvent(v)),p.mediaElement.originalNode.src=t[0].src||"",null!==h||!t[0].src)return t[0].src?p.mediaElement.changeRenderer(h.rendererName,t):null;p.mediaElement.generateError("No renderer found",t)},j=function(e,t){try{if("play"===e&&"native_dash"===p.mediaElement.rendererName){var n=p.mediaElement.renderer[e](t);n&&"function"==typeof n.then&&n.catch(function(){p.mediaElement.paused&&setTimeout(function(){var e=p.mediaElement.renderer.play();void 0!==e&&e.catch(function(){p.mediaElement.renderer.paused||p.mediaElement.renderer.pause()})},150)})}else p.mediaElement.renderer[e](t)}catch(e){p.mediaElement.generateError(e,y)}},I=function(e){p.mediaElement[e]=function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return void 0!==p.mediaElement.renderer&&null!==p.mediaElement.renderer&&"function"==typeof p.mediaElement.renderer[e]&&(p.mediaElement.promises.length?Promise.all(p.mediaElement.promises).then(function(){j(e,n)}).catch(function(e){p.mediaElement.generateError(e,y)}):j(e,n)),null}};N(p.mediaElement,"src",L,F),p.mediaElement.getSrc=L,p.mediaElement.setSrc=F;for(var M=0,O=k.length;M<O;M++)A(k[M]);for(var D=0,V=_.length;D<V;D++)I(_[D]);return p.mediaElement.addEventListener=function(e,t){p.mediaElement.events[e]=p.mediaElement.events[e]||[],p.mediaElement.events[e].push(t)},p.mediaElement.removeEventListener=function(e,t){if(!e)return p.mediaElement.events={},!0;var n=p.mediaElement.events[e];if(!n)return!0;if(!t)return p.mediaElement.events[e]=[],!0;for(var i=0;i<n.length;i++)if(n[i]===t)return p.mediaElement.events[e].splice(i,1),!0;return!1},p.mediaElement.dispatchEvent=function(e){var t=p.mediaElement.events[e.type];if(t)for(var n=0;n<t.length;n++)t[n].apply(null,[e])},p.mediaElement.destroy=function(){var e=p.mediaElement.originalNode.cloneNode(!0),t=p.mediaElement.parentElement;e.removeAttribute("id"),e.remove(),p.mediaElement.remove(),t.append(e)},y.length&&(p.mediaElement.src=y),p.mediaElement.promises.length?Promise.all(p.mediaElement.promises).then(function(){p.mediaElement.options.success&&p.mediaElement.options.success(p.mediaElement,p.mediaElement.originalNode)}).catch(function(){h&&p.mediaElement.options.error&&p.mediaElement.options.error(p.mediaElement,p.mediaElement.originalNode)}):(p.mediaElement.options.success&&p.mediaElement.options.success(p.mediaElement,p.mediaElement.originalNode),h&&p.mediaElement.options.error&&p.mediaElement.options.error(p.mediaElement,p.mediaElement.originalNode)),p.mediaElement};r.default.MediaElement=f,s.default.MediaElement=f,n.default=f},{2:2,25:25,27:27,28:28,3:3,7:7,8:8}],7:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(e){return e&&e.__esModule?e:{default:e}}(e(3)),o={};o.version="4.2.8",o.html5media={properties:["volume","src","currentTime","muted","duration","paused","ended","buffered","error","networkState","readyState","seeking","seekable","currentSrc","preload","bufferedBytes","bufferedTime","initialTime","startOffsetTime","defaultPlaybackRate","playbackRate","played","autoplay","loop","controls"],readOnlyProperties:["duration","paused","ended","buffered","error","networkState","readyState","seeking","seekable"],methods:["load","play","pause","canPlayType"],events:["loadstart","durationchange","loadedmetadata","loadeddata","progress","canplay","canplaythrough","suspend","abort","error","emptied","stalled","play","playing","pause","waiting","seeking","seeked","timeupdate","ended","ratechange","volumechange"],mediaTypes:["audio/mp3","audio/ogg","audio/oga","audio/wav","audio/x-wav","audio/wave","audio/x-pn-wav","audio/mpeg","audio/mp4","video/mp4","video/webm","video/ogg","video/ogv"]},i.default.mejs=o,n.default=o},{3:3}],8:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.renderer=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(e){return e&&e.__esModule?e:{default:e}}(e(7)),a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.renderers={},this.order=[]}return o(e,[{key:"add",value:function(e){if(void 0===e.name)throw new TypeError("renderer must contain at least `name` property");this.renderers[e.name]=e,this.order.push(e.name)}},{key:"select",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=t.length;if(t=t.length?t:this.order,!n){var i=[/^(html5|native)/i,/^flash/i,/iframe$/i],o=function(e){for(var t=0,n=i.length;t<n;t++)if(i[t].test(e))return t;return i.length};t.sort(function(e,t){return o(e)-o(t)})}for(var r=0,a=t.length;r<a;r++){var s=t[r],l=this.renderers[s];if(null!==l&&void 0!==l)for(var d=0,u=e.length;d<u;d++)if("function"==typeof l.canPlayType&&"string"==typeof e[d].type&&l.canPlayType(e[d].type))return{rendererName:l.name,src:e[d].src}}return null}},{key:"order",set:function(e){if(!Array.isArray(e))throw new TypeError("order must be an array of strings.");this._order=e},get:function(){return this._order}},{key:"renderers",set:function(e){if(null!==e&&"object"!==(void 0===e?"undefined":i(e)))throw new TypeError("renderers must be an array of objects.");this._renderers=e},get:function(){return this._renderers}}]),e}(),s=n.renderer=new a;r.default.Renderers=s},{7:7}],9:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=i(e(3)),r=i(e(2)),a=i(e(5)),s=e(16),l=i(s),d=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(e(25)),u=e(27),c=e(26),f=e(28);Object.assign(s.config,{usePluginFullScreen:!0,fullscreenText:null,useFakeFullscreen:!1}),Object.assign(l.default.prototype,{isFullScreen:!1,isNativeFullScreen:!1,isInIframe:!1,isPluginClickThroughCreated:!1,fullscreenMode:"",containerSizeTimeout:null,buildfullscreen:function(e){if(e.isVideo){e.isInIframe=o.default.location!==o.default.parent.location,e.detectFullscreenMode();var t=this,n=(0,u.isString)(t.options.fullscreenText)?t.options.fullscreenText:a.default.t("mejs.fullscreen"),i=r.default.createElement("div");if(i.className=t.options.classPrefix+"button "+t.options.classPrefix+"fullscreen-button",i.innerHTML='<button type="button" aria-controls="'+t.id+'" title="'+n+'" aria-label="'+n+'" tabindex="0"></button>',t.addControlElement(i,"fullscreen"),i.addEventListener("click",function(){d.HAS_TRUE_NATIVE_FULLSCREEN&&d.IS_FULLSCREEN||e.isFullScreen?e.exitFullScreen():e.enterFullScreen()}),e.fullscreenBtn=i,t.options.keyActions.push({keys:[70],action:function(e,t,n,i){i.ctrlKey||void 0!==e.enterFullScreen&&(e.isFullScreen?e.exitFullScreen():e.enterFullScreen())}}),t.exitFullscreenCallback=function(n){27===(n.which||n.keyCode||0)&&(d.HAS_TRUE_NATIVE_FULLSCREEN&&d.IS_FULLSCREEN||t.isFullScreen)&&e.exitFullScreen()},t.globalBind("keydown",t.exitFullscreenCallback),t.normalHeight=0,t.normalWidth=0,d.HAS_TRUE_NATIVE_FULLSCREEN){e.globalBind(d.FULLSCREEN_EVENT_NAME,function(){e.isFullScreen&&(d.isFullScreen()?(e.isNativeFullScreen=!0,e.setControlsSize()):(e.isNativeFullScreen=!1,e.exitFullScreen()))})}}},cleanfullscreen:function(e){e.exitFullScreen(),e.globalUnbind("keydown",e.exitFullscreenCallback)},detectFullscreenMode:function(){var e=null!==this.media.rendererName&&/(native|html5)/i.test(this.media.rendererName),t="";return d.HAS_TRUE_NATIVE_FULLSCREEN&&e?t="native-native":d.HAS_TRUE_NATIVE_FULLSCREEN&&!e?t="plugin-native":this.usePluginFullScreen&&d.SUPPORT_POINTER_EVENTS&&(t="plugin-click"),this.fullscreenMode=t,t},enterFullScreen:function(){var e=this,t=null!==e.media.rendererName&&/(html5|native)/i.test(e.media.rendererName),n=getComputedStyle(e.getElement(e.container));if(!1===e.options.useFakeFullscreen&&d.IS_IOS&&d.HAS_IOS_FULLSCREEN&&"function"==typeof e.media.originalNode.webkitEnterFullscreen&&e.media.originalNode.canPlayType((0,f.getTypeFromFile)(e.media.getSrc())))e.media.originalNode.webkitEnterFullscreen();else{if((0,c.addClass)(r.default.documentElement,e.options.classPrefix+"fullscreen"),(0,c.addClass)(e.getElement(e.container),e.options.classPrefix+"container-fullscreen"),e.normalHeight=parseFloat(n.height),e.normalWidth=parseFloat(n.width),"native-native"!==e.fullscreenMode&&"plugin-native"!==e.fullscreenMode||(d.requestFullScreen(e.getElement(e.container)),e.isInIframe&&setTimeout(function t(){if(e.isNativeFullScreen){var n=o.default.innerWidth||r.default.documentElement.clientWidth||r.default.body.clientWidth,i=screen.width;Math.abs(i-n)>.002*i?e.exitFullScreen():setTimeout(t,500)}},1e3)),e.getElement(e.container).style.width="100%",e.getElement(e.container).style.height="100%",e.containerSizeTimeout=setTimeout(function(){e.getElement(e.container).style.width="100%",e.getElement(e.container).style.height="100%",e.setControlsSize()},500),t)e.node.style.width="100%",e.node.style.height="100%";else for(var i=e.getElement(e.container).querySelectorAll("embed, object, video"),a=i.length,s=0;s<a;s++)i[s].style.width="100%",i[s].style.height="100%";e.options.setDimensions&&"function"==typeof e.media.setSize&&e.media.setSize(screen.width,screen.height);for(var l=e.getElement(e.layers).children,p=l.length,m=0;m<p;m++)l[m].style.width="100%",l[m].style.height="100%";e.fullscreenBtn&&((0,c.removeClass)(e.fullscreenBtn,e.options.classPrefix+"fullscreen"),(0,c.addClass)(e.fullscreenBtn,e.options.classPrefix+"unfullscreen")),e.setControlsSize(),e.isFullScreen=!0;var h=Math.min(screen.width/e.width,screen.height/e.height),v=e.getElement(e.container).querySelector("."+e.options.classPrefix+"captions-text");v&&(v.style.fontSize=100*h+"%",v.style.lineHeight="normal",e.getElement(e.container).querySelector("."+e.options.classPrefix+"captions-position").style.bottom=(screen.height-e.normalHeight)/2-e.getElement(e.controls).offsetHeight/2+h+15+"px");var g=(0,u.createEvent)("enteredfullscreen",e.getElement(e.container));e.getElement(e.container).dispatchEvent(g)}},exitFullScreen:function(){var e=null!==this.media.rendererName&&/(native|html5)/i.test(this.media.rendererName);if(clearTimeout(this.containerSizeTimeout),d.HAS_TRUE_NATIVE_FULLSCREEN&&(d.IS_FULLSCREEN||this.isFullScreen)&&d.cancelFullScreen(),(0,c.removeClass)(r.default.documentElement,this.options.classPrefix+"fullscreen"),(0,c.removeClass)(this.getElement(this.container),this.options.classPrefix+"container-fullscreen"),this.options.setDimensions){if(this.getElement(this.container).style.width=this.normalWidth+"px",this.getElement(this.container).style.height=this.normalHeight+"px",e)this.node.style.width=this.normalWidth+"px",this.node.style.height=this.normalHeight+"px";else for(var t=this.getElement(this.container).querySelectorAll("embed, object, video"),n=t.length,i=0;i<n;i++)t[i].style.width=this.normalWidth+"px",t[i].style.height=this.normalHeight+"px";"function"==typeof this.media.setSize&&this.media.setSize(this.normalWidth,this.normalHeight);for(var o=this.getElement(this.layers).children,a=o.length,s=0;s<a;s++)o[s].style.width=this.normalWidth+"px",o[s].style.height=this.normalHeight+"px"}this.fullscreenBtn&&((0,c.removeClass)(this.fullscreenBtn,this.options.classPrefix+"unfullscreen"),(0,c.addClass)(this.fullscreenBtn,this.options.classPrefix+"fullscreen")),this.setControlsSize(),this.isFullScreen=!1;var l=this.getElement(this.container).querySelector("."+this.options.classPrefix+"captions-text");l&&(l.style.fontSize="",l.style.lineHeight="",this.getElement(this.container).querySelector("."+this.options.classPrefix+"captions-position").style.bottom="");var f=(0,u.createEvent)("exitedfullscreen",this.getElement(this.container));this.getElement(this.container).dispatchEvent(f)}})},{16:16,2:2,25:25,26:26,27:27,28:28,3:3,5:5}],10:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=i(e(2)),r=e(16),a=i(r),s=i(e(5)),l=e(27),d=e(26);Object.assign(r.config,{playText:null,pauseText:null}),Object.assign(a.default.prototype,{buildplaypause:function(e,t,n,i){function r(e){"play"===e?((0,d.removeClass)(p,a.options.classPrefix+"play"),(0,d.removeClass)(p,a.options.classPrefix+"replay"),(0,d.addClass)(p,a.options.classPrefix+"pause"),m.setAttribute("title",f),m.setAttribute("aria-label",f)):((0,d.removeClass)(p,a.options.classPrefix+"pause"),(0,d.removeClass)(p,a.options.classPrefix+"replay"),(0,d.addClass)(p,a.options.classPrefix+"play"),m.setAttribute("title",c),m.setAttribute("aria-label",c))}var a=this,u=a.options,c=(0,l.isString)(u.playText)?u.playText:s.default.t("mejs.play"),f=(0,l.isString)(u.pauseText)?u.pauseText:s.default.t("mejs.pause"),p=o.default.createElement("div");p.className=a.options.classPrefix+"button "+a.options.classPrefix+"playpause-button "+a.options.classPrefix+"play",p.innerHTML='<button type="button" aria-controls="'+a.id+'" title="'+c+'" aria-label="'+f+'" tabindex="0"></button>',p.addEventListener("click",function(){a.paused?a.play():a.pause()});var m=p.querySelector("button");a.addControlElement(p,"playpause"),r("pse"),i.addEventListener("loadedmetadata",function(){-1===i.rendererName.indexOf("flash")&&r("pse")}),i.addEventListener("play",function(){r("play")}),i.addEventListener("playing",function(){r("play")}),i.addEventListener("pause",function(){r("pse")}),i.addEventListener("ended",function(){e.options.loop||((0,d.removeClass)(p,a.options.classPrefix+"pause"),(0,d.removeClass)(p,a.options.classPrefix+"play"),(0,d.addClass)(p,a.options.classPrefix+"replay"),m.setAttribute("title",c),m.setAttribute("aria-label",c))})}})},{16:16,2:2,26:26,27:27,5:5}],11:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=i(e(2)),r=e(16),a=i(r),s=i(e(5)),l=e(25),d=e(30),u=e(26);Object.assign(r.config,{enableProgressTooltip:!0,useSmoothHover:!0,forceLive:!1}),Object.assign(a.default.prototype,{buildprogress:function(e,t,n,i){var a=0,c=!1,f=!1,p=this,m=e.options.autoRewind,h=e.options.enableProgressTooltip?'<span class="'+p.options.classPrefix+'time-float"><span class="'+p.options.classPrefix+'time-float-current">00:00</span><span class="'+p.options.classPrefix+'time-float-corner"></span></span>':"",v=o.default.createElement("div");v.className=p.options.classPrefix+"time-rail",v.innerHTML='<span class="'+p.options.classPrefix+"time-total "+p.options.classPrefix+'time-slider"><span class="'+p.options.classPrefix+'time-buffering"></span><span class="'+p.options.classPrefix+'time-loaded"></span><span class="'+p.options.classPrefix+'time-current"></span><span class="'+p.options.classPrefix+'time-hovered no-hover"></span><span class="'+p.options.classPrefix+'time-handle"><span class="'+p.options.classPrefix+'time-handle-content"></span></span>'+h+"</span>",p.addControlElement(v,"progress"),p.options.keyActions.push({keys:[37,227],action:function(e){if(!isNaN(e.duration)&&e.duration>0){e.isVideo&&(e.showControls(),e.startControlsTimer()),e.getElement(e.container).querySelector("."+r.config.classPrefix+"time-total").focus();var t=Math.max(e.currentTime-e.options.defaultSeekBackwardInterval(e),0);e.setCurrentTime(t)}}},{keys:[39,228],action:function(e){if(!isNaN(e.duration)&&e.duration>0){e.isVideo&&(e.showControls(),e.startControlsTimer()),e.getElement(e.container).querySelector("."+r.config.classPrefix+"time-total").focus();var t=Math.min(e.currentTime+e.options.defaultSeekForwardInterval(e),e.duration);e.setCurrentTime(t)}}}),p.rail=t.querySelector("."+p.options.classPrefix+"time-rail"),p.total=t.querySelector("."+p.options.classPrefix+"time-total"),p.loaded=t.querySelector("."+p.options.classPrefix+"time-loaded"),p.current=t.querySelector("."+p.options.classPrefix+"time-current"),p.handle=t.querySelector("."+p.options.classPrefix+"time-handle"),p.timefloat=t.querySelector("."+p.options.classPrefix+"time-float"),p.timefloatcurrent=t.querySelector("."+p.options.classPrefix+"time-float-current"),p.slider=t.querySelector("."+p.options.classPrefix+"time-slider"),p.hovered=t.querySelector("."+p.options.classPrefix+"time-hovered"),p.buffer=t.querySelector("."+p.options.classPrefix+"time-buffering"),p.newTime=0,p.forcedHandlePause=!1,p.setTransformStyle=function(e,t){e.style.transform=t,e.style.webkitTransform=t,e.style.MozTransform=t,e.style.msTransform=t,e.style.OTransform=t},p.buffer.style.display="none";var g=function(t){var n=getComputedStyle(p.total),i=(0,u.offset)(p.total),o=p.total.offsetWidth,r=void 0!==n.webkitTransform?"webkitTransform":void 0!==n.mozTransform?"mozTransform ":void 0!==n.oTransform?"oTransform":void 0!==n.msTransform?"msTransform":"transform",a="WebKitCSSMatrix"in window?"WebKitCSSMatrix":"MSCSSMatrix"in window?"MSCSSMatrix":"CSSMatrix"in window?"CSSMatrix":void 0,s=0,f=0,m=0,h=void 0;if(h=t.originalEvent&&t.originalEvent.changedTouches?t.originalEvent.changedTouches[0].pageX:t.changedTouches?t.changedTouches[0].pageX:t.pageX,p.getDuration()){if(h<i.left?h=i.left:h>o+i.left&&(h=o+i.left),m=h-i.left,s=m/o,p.newTime=s<=.02?0:s*p.getDuration(),c&&null!==p.getCurrentTime()&&p.newTime.toFixed(4)!==p.getCurrentTime().toFixed(4)&&(p.setCurrentRailHandle(p.newTime),p.updateCurrent(p.newTime)),!l.IS_IOS&&!l.IS_ANDROID){if(m<0&&(m=0),p.options.useSmoothHover&&null!==a&&void 0!==window[a]){var v=new window[a](getComputedStyle(p.handle)[r]).m41,g=m/parseFloat(getComputedStyle(p.total).width)-v/parseFloat(getComputedStyle(p.total).width);p.hovered.style.left=v+"px",p.setTransformStyle(p.hovered,"scaleX("+g+")"),p.hovered.setAttribute("pos",m),g>=0?(0,u.removeClass)(p.hovered,"negative"):(0,u.addClass)(p.hovered,"negative")}if(p.timefloat){var y=p.timefloat.offsetWidth/2,E=mejs.Utils.offset(p.getElement(p.container)),b=getComputedStyle(p.timefloat);f=h-E.left<p.timefloat.offsetWidth?y:h-E.left>=p.getElement(p.container).offsetWidth-y?p.total.offsetWidth-y:m,(0,u.hasClass)(p.getElement(p.container),p.options.classPrefix+"long-video")&&(f+=parseFloat(b.marginLeft)/2+p.timefloat.offsetWidth/2),p.timefloat.style.left=f+"px",p.timefloatcurrent.innerHTML=(0,d.secondsToTimeCode)(p.newTime,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond,e.options.secondsDecimalLength,e.options.timeFormat),p.timefloat.style.display="block"}}}else l.IS_IOS||l.IS_ANDROID||!p.timefloat||(f=p.timefloat.offsetWidth+o>=p.getElement(p.container).offsetWidth?p.timefloat.offsetWidth/2:0,p.timefloat.style.left=f+"px",p.timefloat.style.left=f+"px",p.timefloat.style.display="block")},y=function(){new Date-a>=1e3&&p.play()},E=function(){c&&null!==p.getCurrentTime()&&p.newTime.toFixed(4)!==p.getCurrentTime().toFixed(4)&&(p.setCurrentTime(p.newTime),p.setCurrentRail(),p.updateCurrent(p.newTime)),p.forcedHandlePause&&(p.slider.focus(),p.play()),p.forcedHandlePause=!1};p.slider.addEventListener("focus",function(){e.options.autoRewind=!1}),p.slider.addEventListener("blur",function(){e.options.autoRewind=m}),p.slider.addEventListener("keydown",function(t){if(new Date-a>=1e3&&(f=p.paused),p.options.keyActions.length){var n=t.which||t.keyCode||0,o=p.getDuration(),r=e.options.defaultSeekForwardInterval(i),s=e.options.defaultSeekBackwardInterval(i),d=p.getCurrentTime(),u=p.getElement(p.container).querySelector("."+p.options.classPrefix+"volume-slider");if(38===n||40===n){u&&(u.style.display="block"),p.isVideo&&(p.showControls(),p.startControlsTimer());var c=38===n?Math.min(p.volume+.1,1):Math.max(p.volume-.1,0),m=c<=0;return p.setVolume(c),void p.setMuted(m)}switch(u&&(u.style.display="none"),n){case 37:p.getDuration()!==1/0&&(d-=s);break;case 39:p.getDuration()!==1/0&&(d+=r);break;case 36:d=0;break;case 35:d=o;break;case 13:case 32:return void(l.IS_FIREFOX&&(p.paused?p.play():p.pause()));default:return}d=d<0?0:d>=o?o:Math.floor(d),a=new Date,f||e.pause(),d<p.getDuration()&&!f&&setTimeout(y,1100),p.setCurrentTime(d),e.showControls(),t.preventDefault(),t.stopPropagation()}});var b=["mousedown","touchstart"];p.slider.addEventListener("dragstart",function(){return!1});for(var S=0,x=b.length;S<x;S++)p.slider.addEventListener(b[S],function(e){if(p.forcedHandlePause=!1,p.getDuration()!==1/0&&(1===e.which||0===e.which)){p.paused||(p.pause(),p.forcedHandlePause=!0),c=!0,g(e);for(var t=["mouseup","touchend"],n=0,i=t.length;n<i;n++)p.getElement(p.container).addEventListener(t[n],function(e){var t=e.target;(t===p.slider||t.closest("."+p.options.classPrefix+"time-slider"))&&g(e)});p.globalBind("mouseup.dur touchend.dur",function(){E(),c=!1,p.timefloat&&(p.timefloat.style.display="none")})}},!(!l.SUPPORT_PASSIVE_EVENT||"touchstart"!==b[S])&&{passive:!0});p.slider.addEventListener("mouseenter",function(e){e.target===p.slider&&p.getDuration()!==1/0&&(p.getElement(p.container).addEventListener("mousemove",function(e){var t=e.target;(t===p.slider||t.closest("."+p.options.classPrefix+"time-slider"))&&g(e)}),!p.timefloat||l.IS_IOS||l.IS_ANDROID||(p.timefloat.style.display="block"),p.hovered&&!l.IS_IOS&&!l.IS_ANDROID&&p.options.useSmoothHover&&(0,u.removeClass)(p.hovered,"no-hover"))}),p.slider.addEventListener("mouseleave",function(){p.getDuration()!==1/0&&(c||(p.timefloat&&(p.timefloat.style.display="none"),p.hovered&&p.options.useSmoothHover&&(0,u.addClass)(p.hovered,"no-hover")))}),p.broadcastCallback=function(n){var r=t.querySelector("."+p.options.classPrefix+"broadcast");if(p.options.forceLive||p.getDuration()===1/0){if(!r||p.options.forceLive){var a=o.default.createElement("span");a.className=p.options.classPrefix+"broadcast",a.innerText=s.default.t("mejs.live-broadcast"),p.slider.style.display="none",p.rail.appendChild(a)}}else r&&(p.slider.style.display="",r.remove()),e.setProgressRail(n),p.forcedHandlePause||e.setCurrentRail(n),function(){var t=p.getCurrentTime(),n=s.default.t("mejs.time-slider"),o=(0,d.secondsToTimeCode)(t,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond,e.options.secondsDecimalLength,e.options.timeFormat),r=p.getDuration();p.slider.setAttribute("role","slider"),p.slider.tabIndex=0,i.paused?(p.slider.setAttribute("aria-label",n),p.slider.setAttribute("aria-valuemin",0),p.slider.setAttribute("aria-valuemax",r),p.slider.setAttribute("aria-valuenow",t),p.slider.setAttribute("aria-valuetext",o)):(p.slider.removeAttribute("aria-label"),p.slider.removeAttribute("aria-valuemin"),p.slider.removeAttribute("aria-valuemax"),p.slider.removeAttribute("aria-valuenow"),p.slider.removeAttribute("aria-valuetext"))}()},i.addEventListener("progress",p.broadcastCallback),i.addEventListener("timeupdate",p.broadcastCallback),i.addEventListener("play",function(){p.buffer.style.display="none"}),i.addEventListener("playing",function(){p.buffer.style.display="none"}),i.addEventListener("seeking",function(){p.buffer.style.display=""}),i.addEventListener("seeked",function(){p.buffer.style.display="none"}),i.addEventListener("pause",function(){p.buffer.style.display="none"}),i.addEventListener("waiting",function(){p.buffer.style.display=""}),i.addEventListener("loadeddata",function(){p.buffer.style.display=""}),i.addEventListener("canplay",function(){p.buffer.style.display="none"}),i.addEventListener("error",function(){p.buffer.style.display="none"}),p.getElement(p.container).addEventListener("controlsresize",function(t){p.getDuration()!==1/0&&(e.setProgressRail(t),p.forcedHandlePause||e.setCurrentRail(t))})},cleanprogress:function(e,t,n,i){i.removeEventListener("progress",e.broadcastCallback),i.removeEventListener("timeupdate",e.broadcastCallback),e.rail&&e.rail.remove()},setProgressRail:function(e){var t=void 0!==e?e.detail.target||e.target:this.media,n=null;t&&t.buffered&&t.buffered.length>0&&t.buffered.end&&this.getDuration()?n=t.buffered.end(t.buffered.length-1)/this.getDuration():t&&void 0!==t.bytesTotal&&t.bytesTotal>0&&void 0!==t.bufferedBytes?n=t.bufferedBytes/t.bytesTotal:e&&e.lengthComputable&&0!==e.total&&(n=e.loaded/e.total),null!==n&&(n=Math.min(1,Math.max(0,n)),this.loaded&&this.setTransformStyle(this.loaded,"scaleX("+n+")"))},setCurrentRailHandle:function(e){this.setCurrentRailMain(this,e)},setCurrentRail:function(){this.setCurrentRailMain(this)},setCurrentRailMain:function(e,t){if(void 0!==e.getCurrentTime()&&e.getDuration()){var n=void 0===t?e.getCurrentTime():t;if(e.total&&e.handle){var i=parseFloat(getComputedStyle(e.total).width),o=Math.round(i*n/e.getDuration()),r=o-Math.round(e.handle.offsetWidth/2);if(r=r<0?0:r,e.setTransformStyle(e.current,"scaleX("+o/i+")"),e.setTransformStyle(e.handle,"translateX("+r+"px)"),e.options.useSmoothHover&&!(0,u.hasClass)(e.hovered,"no-hover")){var a=parseInt(e.hovered.getAttribute("pos"),10),s=(a=isNaN(a)?0:a)/i-r/i;e.hovered.style.left=r+"px",e.setTransformStyle(e.hovered,"scaleX("+s+")"),s>=0?(0,u.removeClass)(e.hovered,"negative"):(0,u.addClass)(e.hovered,"negative")}}}}})},{16:16,2:2,25:25,26:26,30:30,5:5}],12:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=i(e(2)),r=e(16),a=i(r),s=e(30),l=e(26);Object.assign(r.config,{duration:0,timeAndDurationSeparator:"<span> | </span>"}),Object.assign(a.default.prototype,{buildcurrent:function(e,t,n,i){var r=this,a=o.default.createElement("div");a.className=r.options.classPrefix+"time",a.setAttribute("role","timer"),a.setAttribute("aria-live","off"),a.innerHTML='<span class="'+r.options.classPrefix+'currenttime">'+(0,s.secondsToTimeCode)(0,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond,e.options.secondsDecimalLength,e.options.timeFormat)+"</span>",r.addControlElement(a,"current"),e.updateCurrent(),r.updateTimeCallback=function(){r.controlsAreVisible&&e.updateCurrent()},i.addEventListener("timeupdate",r.updateTimeCallback)},cleancurrent:function(e,t,n,i){i.removeEventListener("timeupdate",e.updateTimeCallback)},buildduration:function(e,t,n,i){var r=this;if(t.lastChild.querySelector("."+r.options.classPrefix+"currenttime"))t.querySelector("."+r.options.classPrefix+"time").innerHTML+=r.options.timeAndDurationSeparator+'<span class="'+r.options.classPrefix+'duration">'+(0,s.secondsToTimeCode)(r.options.duration,r.options.alwaysShowHours,r.options.showTimecodeFrameCount,r.options.framesPerSecond,r.options.secondsDecimalLength,r.options.timeFormat)+"</span>";else{t.querySelector("."+r.options.classPrefix+"currenttime")&&(0,l.addClass)(t.querySelector("."+r.options.classPrefix+"currenttime").parentNode,r.options.classPrefix+"currenttime-container");var a=o.default.createElement("div");a.className=r.options.classPrefix+"time "+r.options.classPrefix+"duration-container",a.innerHTML='<span class="'+r.options.classPrefix+'duration">'+(0,s.secondsToTimeCode)(r.options.duration,r.options.alwaysShowHours,r.options.showTimecodeFrameCount,r.options.framesPerSecond,r.options.secondsDecimalLength,r.options.timeFormat)+"</span>",r.addControlElement(a,"duration")}r.updateDurationCallback=function(){r.controlsAreVisible&&e.updateDuration()},i.addEventListener("timeupdate",r.updateDurationCallback)},cleanduration:function(e,t,n,i){i.removeEventListener("timeupdate",e.updateDurationCallback)},updateCurrent:function(){var e=this.getCurrentTime();isNaN(e)&&(e=0);var t=(0,s.secondsToTimeCode)(e,this.options.alwaysShowHours,this.options.showTimecodeFrameCount,this.options.framesPerSecond,this.options.secondsDecimalLength,this.options.timeFormat);t.length>5?(0,l.addClass)(this.getElement(this.container),this.options.classPrefix+"long-video"):(0,l.removeClass)(this.getElement(this.container),this.options.classPrefix+"long-video"),this.getElement(this.controls).querySelector("."+this.options.classPrefix+"currenttime")&&(this.getElement(this.controls).querySelector("."+this.options.classPrefix+"currenttime").innerText=t)},updateDuration:function(){var e=this.getDuration();(isNaN(e)||e===1/0||e<0)&&(this.media.duration=this.options.duration=e=0),this.options.duration>0&&(e=this.options.duration);var t=(0,s.secondsToTimeCode)(e,this.options.alwaysShowHours,this.options.showTimecodeFrameCount,this.options.framesPerSecond,this.options.secondsDecimalLength,this.options.timeFormat);t.length>5?(0,l.addClass)(this.getElement(this.container),this.options.classPrefix+"long-video"):(0,l.removeClass)(this.getElement(this.container),this.options.classPrefix+"long-video"),this.getElement(this.controls).querySelector("."+this.options.classPrefix+"duration")&&e>0&&(this.getElement(this.controls).querySelector("."+this.options.classPrefix+"duration").innerHTML=t)}})},{16:16,2:2,26:26,30:30}],13:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=i(e(2)),r=i(e(7)),a=i(e(5)),s=e(16),l=i(s),d=e(30),u=e(27),c=e(26);Object.assign(s.config,{startLanguage:"",tracksText:null,chaptersText:null,tracksAriaLive:!1,hideCaptionsButtonWhenEmpty:!0,toggleCaptionsButtonWhenOnlyOne:!1,slidesSelector:""}),Object.assign(l.default.prototype,{hasChapters:!1,buildtracks:function(e,t,n,i){if(this.findTracks(),e.tracks.length||e.trackFiles&&0!==!e.trackFiles.length){var r=this,s=r.options.tracksAriaLive?' role="log" aria-live="assertive" aria-atomic="false"':"",l=(0,u.isString)(r.options.tracksText)?r.options.tracksText:a.default.t("mejs.captions-subtitles"),d=(0,u.isString)(r.options.chaptersText)?r.options.chaptersText:a.default.t("mejs.captions-chapters"),f=null===e.trackFiles?e.tracks.length:e.trackFiles.length;if(r.domNode.textTracks)for(var p=r.domNode.textTracks.length-1;p>=0;p--)r.domNode.textTracks[p].mode="hidden";r.cleartracks(e),e.captions=o.default.createElement("div"),e.captions.className=r.options.classPrefix+"captions-layer "+r.options.classPrefix+"layer",e.captions.innerHTML='<div class="'+r.options.classPrefix+"captions-position "+r.options.classPrefix+'captions-position-hover"'+s+'><span class="'+r.options.classPrefix+'captions-text"></span></div>',e.captions.style.display="none",n.insertBefore(e.captions,n.firstChild),e.captionsText=e.captions.querySelector("."+r.options.classPrefix+"captions-text"),e.captionsButton=o.default.createElement("div"),e.captionsButton.className=r.options.classPrefix+"button "+r.options.classPrefix+"captions-button",e.captionsButton.innerHTML='<button type="button" aria-controls="'+r.id+'" title="'+l+'" aria-label="'+l+'" tabindex="0"></button><div class="'+r.options.classPrefix+"captions-selector "+r.options.classPrefix+'offscreen"><ul class="'+r.options.classPrefix+'captions-selector-list"><li class="'+r.options.classPrefix+'captions-selector-list-item"><input type="radio" class="'+r.options.classPrefix+'captions-selector-input" name="'+e.id+'_captions" id="'+e.id+'_captions_none" value="none" checked disabled><label class="'+r.options.classPrefix+"captions-selector-label "+r.options.classPrefix+'captions-selected" for="'+e.id+'_captions_none">'+a.default.t("mejs.none")+"</label></li></ul></div>",r.addControlElement(e.captionsButton,"tracks"),e.captionsButton.querySelector("."+r.options.classPrefix+"captions-selector-input").disabled=!1,e.chaptersButton=o.default.createElement("div"),e.chaptersButton.className=r.options.classPrefix+"button "+r.options.classPrefix+"chapters-button",e.chaptersButton.innerHTML='<button type="button" aria-controls="'+r.id+'" title="'+d+'" aria-label="'+d+'" tabindex="0"></button><div class="'+r.options.classPrefix+"chapters-selector "+r.options.classPrefix+'offscreen"><ul class="'+r.options.classPrefix+'chapters-selector-list"></ul></div>';for(var m=0,h=0;h<f;h++){var v=e.tracks[h].kind;e.tracks[h].src.trim()&&("subtitles"===v||"captions"===v?m++:"chapters"!==v||t.querySelector("."+r.options.classPrefix+"chapter-selector")||e.captionsButton.parentNode.insertBefore(e.chaptersButton,e.captionsButton))}e.trackToLoad=-1,e.selectedTrack=null,e.isLoadingTrack=!1;for(var g=0;g<f;g++){var y=e.tracks[g].kind;!e.tracks[g].src.trim()||"subtitles"!==y&&"captions"!==y||e.addTrackButton(e.tracks[g].trackId,e.tracks[g].srclang,e.tracks[g].label)}e.loadNextTrack();var E=["mouseenter","focusin"],b=["mouseleave","focusout"];if(r.options.toggleCaptionsButtonWhenOnlyOne&&1===m)e.captionsButton.addEventListener("click",function(t){var n="none";null===e.selectedTrack&&(n=e.tracks[0].trackId);var i=t.keyCode||t.which;e.setTrack(n,void 0!==i)});else{for(var S=e.captionsButton.querySelectorAll("."+r.options.classPrefix+"captions-selector-label"),x=e.captionsButton.querySelectorAll("input[type=radio]"),w=0,P=E.length;w<P;w++)e.captionsButton.addEventListener(E[w],function(){(0,c.removeClass)(this.querySelector("."+r.options.classPrefix+"captions-selector"),r.options.classPrefix+"offscreen")});for(var T=0,C=b.length;T<C;T++)e.captionsButton.addEventListener(b[T],function(){(0,c.addClass)(this.querySelector("."+r.options.classPrefix+"captions-selector"),r.options.classPrefix+"offscreen")});for(var k=0,_=x.length;k<_;k++)x[k].addEventListener("click",function(t){var n=t.keyCode||t.which;e.setTrack(this.value,void 0!==n)});for(var N=0,A=S.length;N<A;N++)S[N].addEventListener("click",function(e){var t=(0,c.siblings)(this,function(e){return"INPUT"===e.tagName})[0],n=(0,u.createEvent)("click",t);t.dispatchEvent(n),e.preventDefault()});e.captionsButton.addEventListener("keydown",function(e){e.stopPropagation()})}for(var L=0,F=E.length;L<F;L++)e.chaptersButton.addEventListener(E[L],function(){this.querySelector("."+r.options.classPrefix+"chapters-selector-list").children.length&&(0,c.removeClass)(this.querySelector("."+r.options.classPrefix+"chapters-selector"),r.options.classPrefix+"offscreen")});for(var j=0,I=b.length;j<I;j++)e.chaptersButton.addEventListener(b[j],function(){(0,c.addClass)(this.querySelector("."+r.options.classPrefix+"chapters-selector"),r.options.classPrefix+"offscreen")});e.chaptersButton.addEventListener("keydown",function(e){e.stopPropagation()}),e.options.alwaysShowControls?(0,c.addClass)(e.getElement(e.container).querySelector("."+r.options.classPrefix+"captions-position"),r.options.classPrefix+"captions-position-hover"):(e.getElement(e.container).addEventListener("controlsshown",function(){(0,c.addClass)(e.getElement(e.container).querySelector("."+r.options.classPrefix+"captions-position"),r.options.classPrefix+"captions-position-hover")}),e.getElement(e.container).addEventListener("controlshidden",function(){i.paused||(0,c.removeClass)(e.getElement(e.container).querySelector("."+r.options.classPrefix+"captions-position"),r.options.classPrefix+"captions-position-hover")})),i.addEventListener("timeupdate",function(){e.displayCaptions()}),""!==e.options.slidesSelector&&(e.slidesContainer=o.default.querySelectorAll(e.options.slidesSelector),i.addEventListener("timeupdate",function(){e.displaySlides()}))}},cleartracks:function(e){e&&(e.captions&&e.captions.remove(),e.chapters&&e.chapters.remove(),e.captionsText&&e.captionsText.remove(),e.captionsButton&&e.captionsButton.remove(),e.chaptersButton&&e.chaptersButton.remove())},rebuildtracks:function(){this.findTracks(),this.buildtracks(this,this.getElement(this.controls),this.getElement(this.layers),this.media)},findTracks:function(){var e=null===this.trackFiles?this.node.querySelectorAll("track"):this.trackFiles,t=e.length;this.tracks=[];for(var n=0;n<t;n++){var i=e[n],o=i.getAttribute("srclang").toLowerCase()||"",r=this.id+"_track_"+n+"_"+i.getAttribute("kind")+"_"+o;this.tracks.push({trackId:r,srclang:o,src:i.getAttribute("src"),kind:i.getAttribute("kind"),label:i.getAttribute("label")||"",entries:[],isLoaded:!1})}},setTrack:function(e,t){for(var n=this,i=n.captionsButton.querySelectorAll('input[type="radio"]'),o=n.captionsButton.querySelectorAll("."+n.options.classPrefix+"captions-selected"),r=n.captionsButton.querySelector('input[value="'+e+'"]'),a=0,s=i.length;a<s;a++)i[a].checked=!1;for(var l=0,d=o.length;l<d;l++)(0,c.removeClass)(o[l],n.options.classPrefix+"captions-selected");r.checked=!0;for(var f=(0,c.siblings)(r,function(e){return(0,c.hasClass)(e,n.options.classPrefix+"captions-selector-label")}),p=0,m=f.length;p<m;p++)(0,c.addClass)(f[p],n.options.classPrefix+"captions-selected");if("none"===e)n.selectedTrack=null,(0,c.removeClass)(n.captionsButton,n.options.classPrefix+"captions-enabled");else for(var h=0,v=n.tracks.length;h<v;h++){var g=n.tracks[h];if(g.trackId===e){null===n.selectedTrack&&(0,c.addClass)(n.captionsButton,n.options.classPrefix+"captions-enabled"),n.selectedTrack=g,n.captions.setAttribute("lang",n.selectedTrack.srclang),n.displayCaptions();break}}var y=(0,u.createEvent)("captionschange",n.media);y.detail.caption=n.selectedTrack,n.media.dispatchEvent(y),t||setTimeout(function(){n.getElement(n.container).focus()},500)},loadNextTrack:function(){this.trackToLoad++,this.trackToLoad<this.tracks.length?(this.isLoadingTrack=!0,this.loadTrack(this.trackToLoad)):(this.isLoadingTrack=!1,this.checkForTracks())},loadTrack:function(e){var t=this,n=t.tracks[e];void 0===n||void 0===n.src&&""===n.src||(0,c.ajax)(n.src,"text",function(e){n.entries="string"==typeof e&&/<tt\s+xml/gi.exec(e)?r.default.TrackFormatParser.dfxp.parse(e):r.default.TrackFormatParser.webvtt.parse(e),n.isLoaded=!0,t.enableTrackButton(n),t.loadNextTrack(),"slides"===n.kind?t.setupSlides(n):"chapters"!==n.kind||t.hasChapters||(t.drawChapters(n),t.hasChapters=!0)},function(){t.removeTrackButton(n.trackId),t.loadNextTrack()})},enableTrackButton:function(e){var t=this,n=e.srclang,i=o.default.getElementById(""+e.trackId);if(i){var s=e.label;""===s&&(s=a.default.t(r.default.language.codes[n])||n),i.disabled=!1;for(var l=(0,c.siblings)(i,function(e){return(0,c.hasClass)(e,t.options.classPrefix+"captions-selector-label")}),d=0,f=l.length;d<f;d++)l[d].innerHTML=s;if(t.options.startLanguage===n){i.checked=!0;var p=(0,u.createEvent)("click",i);i.dispatchEvent(p)}}},removeTrackButton:function(e){var t=o.default.getElementById(""+e);if(t){var n=t.closest("li");n&&n.remove()}},addTrackButton:function(e,t,n){""===n&&(n=a.default.t(r.default.language.codes[t])||t),this.captionsButton.querySelector("ul").innerHTML+='<li class="'+this.options.classPrefix+'captions-selector-list-item"><input type="radio" class="'+this.options.classPrefix+'captions-selector-input" name="'+this.id+'_captions" id="'+e+'" value="'+e+'" disabled><label class="'+this.options.classPrefix+'captions-selector-label"for="'+e+'">'+n+" (loading)</label></li>"},checkForTracks:function(){var e=!1;if(this.options.hideCaptionsButtonWhenEmpty){for(var t=0,n=this.tracks.length;t<n;t++){var i=this.tracks[t].kind;if(("subtitles"===i||"captions"===i)&&this.tracks[t].isLoaded){e=!0;break}}this.captionsButton.style.display=e?"":"none",this.setControlsSize()}},displayCaptions:function(){if(void 0!==this.tracks){var e=this.selectedTrack;if(null!==e&&e.isLoaded){var t=this.searchTrackPosition(e.entries,this.media.currentTime);if(t>-1)return this.captionsText.innerHTML=function(e){var t=o.default.createElement("div");t.innerHTML=e;for(var n=t.getElementsByTagName("script"),i=n.length;i--;)n[i].remove();for(var r=t.getElementsByTagName("*"),a=0,s=r.length;a<s;a++)for(var l=r[a].attributes,d=Array.prototype.slice.call(l),u=0,c=d.length;u<c;u++)d[u].name.startsWith("on")||d[u].value.startsWith("javascript")?r[a].remove():"style"===d[u].name&&r[a].removeAttribute(d[u].name);return t.innerHTML}(e.entries[t].text),this.captionsText.className=this.options.classPrefix+"captions-text "+(e.entries[t].identifier||""),this.captions.style.display="",void(this.captions.style.height="0px");this.captions.style.display="none"}else this.captions.style.display="none"}},setupSlides:function(e){this.slides=e,this.slides.entries.imgs=[this.slides.entries.length],this.showSlide(0)},showSlide:function(e){var t=this,n=this;if(void 0!==n.tracks&&void 0!==n.slidesContainer){var i=n.slides.entries[e].text,r=n.slides.entries[e].imgs;if(void 0===r||void 0===r.fadeIn){var a=o.default.createElement("img");a.src=i,a.addEventListener("load",function(){var e=t,i=(0,c.siblings)(e,function(e){return i(e)});e.style.display="none",n.slidesContainer.innerHTML+=e.innerHTML,(0,c.fadeIn)(n.slidesContainer.querySelector(a));for(var o=0,r=i.length;o<r;o++)(0,c.fadeOut)(i[o],400)}),n.slides.entries[e].imgs=r=a}else if(!(0,c.visible)(r)){var s=(0,c.siblings)(self,function(e){return s(e)});(0,c.fadeIn)(n.slidesContainer.querySelector(r));for(var l=0,d=s.length;l<d;l++)(0,c.fadeOut)(s[l])}}},displaySlides:function(){if(void 0!==this.slides){var e=this.slides,t=this.searchTrackPosition(e.entries,this.media.currentTime);t>-1&&this.showSlide(t)}},drawChapters:function(e){var t=this,n=e.entries.length;if(n){t.chaptersButton.querySelector("ul").innerHTML="";for(var i=0;i<n;i++)t.chaptersButton.querySelector("ul").innerHTML+='<li class="'+t.options.classPrefix+'chapters-selector-list-item" role="menuitemcheckbox" aria-live="polite" aria-disabled="false" aria-checked="false"><input type="radio" class="'+t.options.classPrefix+'captions-selector-input" name="'+t.id+'_chapters" id="'+t.id+"_chapters_"+i+'" value="'+e.entries[i].start+'" disabled><label class="'+t.options.classPrefix+'chapters-selector-label"for="'+t.id+"_chapters_"+i+'">'+e.entries[i].text+"</label></li>";for(var o=t.chaptersButton.querySelectorAll('input[type="radio"]'),r=t.chaptersButton.querySelectorAll("."+t.options.classPrefix+"chapters-selector-label"),a=0,s=o.length;a<s;a++)o[a].disabled=!1,o[a].checked=!1,o[a].addEventListener("click",function(e){var n=t.chaptersButton.querySelectorAll("li"),i=(0,c.siblings)(this,function(e){return(0,c.hasClass)(e,t.options.classPrefix+"chapters-selector-label")})[0];this.checked=!0,this.parentNode.setAttribute("aria-checked",!0),(0,c.addClass)(i,t.options.classPrefix+"chapters-selected"),(0,c.removeClass)(t.chaptersButton.querySelector("."+t.options.classPrefix+"chapters-selected"),t.options.classPrefix+"chapters-selected");for(var o=0,r=n.length;o<r;o++)n[o].setAttribute("aria-checked",!1);void 0===(e.keyCode||e.which)&&setTimeout(function(){t.getElement(t.container).focus()},500),t.media.setCurrentTime(parseFloat(this.value)),t.media.paused&&t.media.play()});for(var l=0,d=r.length;l<d;l++)r[l].addEventListener("click",function(e){var t=(0,c.siblings)(this,function(e){return"INPUT"===e.tagName})[0],n=(0,u.createEvent)("click",t);t.dispatchEvent(n),e.preventDefault()})}},searchTrackPosition:function(e,t){for(var n=0,i=e.length-1,o=void 0,r=void 0,a=void 0;n<=i;){if(o=n+i>>1,r=e[o].start,a=e[o].stop,t>=r&&t<a)return o;r<t?n=o+1:r>t&&(i=o-1)}return-1}}),r.default.language={codes:{af:"mejs.afrikaans",sq:"mejs.albanian",ar:"mejs.arabic",be:"mejs.belarusian",bg:"mejs.bulgarian",ca:"mejs.catalan",zh:"mejs.chinese","zh-cn":"mejs.chinese-simplified","zh-tw":"mejs.chines-traditional",hr:"mejs.croatian",cs:"mejs.czech",da:"mejs.danish",nl:"mejs.dutch",en:"mejs.english",et:"mejs.estonian",fl:"mejs.filipino",fi:"mejs.finnish",fr:"mejs.french",gl:"mejs.galician",de:"mejs.german",el:"mejs.greek",ht:"mejs.haitian-creole",iw:"mejs.hebrew",hi:"mejs.hindi",hu:"mejs.hungarian",is:"mejs.icelandic",id:"mejs.indonesian",ga:"mejs.irish",it:"mejs.italian",ja:"mejs.japanese",ko:"mejs.korean",lv:"mejs.latvian",lt:"mejs.lithuanian",mk:"mejs.macedonian",ms:"mejs.malay",mt:"mejs.maltese",no:"mejs.norwegian",fa:"mejs.persian",pl:"mejs.polish",pt:"mejs.portuguese",ro:"mejs.romanian",ru:"mejs.russian",sr:"mejs.serbian",sk:"mejs.slovak",sl:"mejs.slovenian",es:"mejs.spanish",sw:"mejs.swahili",sv:"mejs.swedish",tl:"mejs.tagalog",th:"mejs.thai",tr:"mejs.turkish",uk:"mejs.ukrainian",vi:"mejs.vietnamese",cy:"mejs.welsh",yi:"mejs.yiddish"}},r.default.TrackFormatParser={webvtt:{pattern:/^((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,parse:function(e){for(var t=e.split(/\r?\n/),n=[],i=void 0,o=void 0,r=void 0,a=0,s=t.length;a<s;a++){if((i=this.pattern.exec(t[a]))&&a<t.length){for(a-1>=0&&""!==t[a-1]&&(r=t[a-1]),o=t[++a],a++;""!==t[a]&&a<t.length;)o=o+"\n"+t[a],a++;o=o.trim().replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,"<a href='$1' target='_blank'>$1</a>"),n.push({identifier:r,start:0===(0,d.convertSMPTEtoSeconds)(i[1])?.2:(0,d.convertSMPTEtoSeconds)(i[1]),stop:(0,d.convertSMPTEtoSeconds)(i[3]),text:o,settings:i[5]})}r=""}return n}},dfxp:{parse:function(e){var t=(e=$(e).filter("tt")).firstChild,n=t.querySelectorAll("p"),i=e.getElementById(""+t.attr("style")),o=[],r=void 0;if(i.length){i.removeAttribute("id");var a=i.attributes;if(a.length){r={};for(var s=0,l=a.length;s<l;s++)r[a[s].name.split(":")[1]]=a[s].value}}for(var u=0,c=n.length;u<c;u++){var f=void 0,p={start:null,stop:null,style:null,text:null};if(n.eq(u).attr("begin")&&(p.start=(0,d.convertSMPTEtoSeconds)(n.eq(u).attr("begin"))),!p.start&&n.eq(u-1).attr("end")&&(p.start=(0,d.convertSMPTEtoSeconds)(n.eq(u-1).attr("end"))),n.eq(u).attr("end")&&(p.stop=(0,d.convertSMPTEtoSeconds)(n.eq(u).attr("end"))),!p.stop&&n.eq(u+1).attr("begin")&&(p.stop=(0,d.convertSMPTEtoSeconds)(n.eq(u+1).attr("begin"))),r){f="";for(var m in r)f+=m+":"+r[m]+";"}f&&(p.style=f),0===p.start&&(p.start=.2),p.text=n.eq(u).innerHTML.trim().replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,"<a href='$1' target='_blank'>$1</a>"),o.push(p)}return o}}}},{16:16,2:2,26:26,27:27,30:30,5:5,7:7}],14:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=i(e(2)),r=e(16),a=i(r),s=i(e(5)),l=e(25),d=e(27),u=e(26);Object.assign(r.config,{muteText:null,unmuteText:null,allyVolumeControlText:null,hideVolumeOnTouchDevices:!0,audioVolume:"horizontal",videoVolume:"vertical",startVolume:.8}),Object.assign(a.default.prototype,{buildvolume:function(e,t,n,i){if(!l.IS_ANDROID&&!l.IS_IOS||!this.options.hideVolumeOnTouchDevices){var a=this,c=a.isVideo?a.options.videoVolume:a.options.audioVolume,f=(0,d.isString)(a.options.muteText)?a.options.muteText:s.default.t("mejs.mute"),p=(0,d.isString)(a.options.unmuteText)?a.options.unmuteText:s.default.t("mejs.unmute"),m=(0,d.isString)(a.options.allyVolumeControlText)?a.options.allyVolumeControlText:s.default.t("mejs.volume-help-text"),h=o.default.createElement("div");if(h.className=a.options.classPrefix+"button "+a.options.classPrefix+"volume-button "+a.options.classPrefix+"mute",h.innerHTML="horizontal"===c?'<button type="button" aria-controls="'+a.id+'" title="'+f+'" aria-label="'+f+'" tabindex="0"></button>':'<button type="button" aria-controls="'+a.id+'" title="'+f+'" aria-label="'+f+'" tabindex="0"></button><a href="javascript:void(0);" class="'+a.options.classPrefix+'volume-slider" aria-label="'+s.default.t("mejs.volume-slider")+'" aria-valuemin="0" aria-valuemax="100" role="slider" aria-orientation="vertical"><span class="'+a.options.classPrefix+'offscreen">'+m+'</span><div class="'+a.options.classPrefix+'volume-total"><div class="'+a.options.classPrefix+'volume-current"></div><div class="'+a.options.classPrefix+'volume-handle"></div></div></a>',a.addControlElement(h,"volume"),a.options.keyActions.push({keys:[38],action:function(e){var t=e.getElement(e.container).querySelector("."+r.config.classPrefix+"volume-slider");(t||e.getElement(e.container).querySelector("."+r.config.classPrefix+"volume-slider").matches(":focus"))&&(t.style.display="block"),e.isVideo&&(e.showControls(),e.startControlsTimer());var n=Math.min(e.volume+.1,1);e.setVolume(n),n>0&&e.setMuted(!1)}},{keys:[40],action:function(e){var t=e.getElement(e.container).querySelector("."+r.config.classPrefix+"volume-slider");t&&(t.style.display="block"),e.isVideo&&(e.showControls(),e.startControlsTimer());var n=Math.max(e.volume-.1,0);e.setVolume(n),n<=.1&&e.setMuted(!0)}},{keys:[77],action:function(e){e.getElement(e.container).querySelector("."+r.config.classPrefix+"volume-slider").style.display="block",e.isVideo&&(e.showControls(),e.startControlsTimer()),e.media.muted?e.setMuted(!1):e.setMuted(!0)}}),"horizontal"===c){var v=o.default.createElement("a");v.className=a.options.classPrefix+"horizontal-volume-slider",v.href="javascript:void(0);",v.setAttribute("aria-label",s.default.t("mejs.volume-slider")),v.setAttribute("aria-valuemin",0),v.setAttribute("aria-valuemax",100),v.setAttribute("role","slider"),v.innerHTML+='<span class="'+a.options.classPrefix+'offscreen">'+m+'</span><div class="'+a.options.classPrefix+'horizontal-volume-total"><div class="'+a.options.classPrefix+'horizontal-volume-current"></div><div class="'+a.options.classPrefix+'horizontal-volume-handle"></div></div>',h.parentNode.insertBefore(v,h.nextSibling)}var g=!1,y=!1,E=!1,b="vertical"===c?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-slider"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-slider"),S="vertical"===c?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-total"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-total"),x="vertical"===c?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-current"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-current"),w="vertical"===c?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-handle"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-handle"),P=function(e){if(null!==e&&!isNaN(e)&&void 0!==e){if(e=Math.max(0,e),0===(e=Math.min(e,1))){(0,u.removeClass)(h,a.options.classPrefix+"mute"),(0,u.addClass)(h,a.options.classPrefix+"unmute");var t=h.firstElementChild;t.setAttribute("title",p),t.setAttribute("aria-label",p)}else{(0,u.removeClass)(h,a.options.classPrefix+"unmute"),(0,u.addClass)(h,a.options.classPrefix+"mute");var n=h.firstElementChild;n.setAttribute("title",f),n.setAttribute("aria-label",f)}var i=100*e+"%",o=getComputedStyle(w);"vertical"===c?(x.style.bottom=0,x.style.height=i,w.style.bottom=i,w.style.marginBottom=-parseFloat(o.height)/2+"px"):(x.style.left=0,x.style.width=i,w.style.left=i,w.style.marginLeft=-parseFloat(o.width)/2+"px")}},T=function(e){var t=(0,u.offset)(S),n=getComputedStyle(S);E=!0;var i=null;if("vertical"===c){var o=parseFloat(n.height);if(i=(o-(e.pageY-t.top))/o,0===t.top||0===t.left)return}else{var r=parseFloat(n.width);i=(e.pageX-t.left)/r}i=Math.max(0,i),i=Math.min(i,1),P(i),a.setMuted(0===i),a.setVolume(i),e.preventDefault(),e.stopPropagation()},C=function(){a.muted?(P(0),(0,u.removeClass)(h,a.options.classPrefix+"mute"),(0,u.addClass)(h,a.options.classPrefix+"unmute")):(P(i.volume),(0,u.removeClass)(h,a.options.classPrefix+"unmute"),(0,u.addClass)(h,a.options.classPrefix+"mute"))};e.getElement(e.container).addEventListener("keydown",function(e){!!e.target.closest("."+a.options.classPrefix+"container")||"vertical"!==c||(b.style.display="none")}),h.addEventListener("mouseenter",function(e){e.target===h&&(b.style.display="block",y=!0,e.preventDefault(),e.stopPropagation())}),h.addEventListener("focusin",function(){b.style.display="block",y=!0}),h.addEventListener("focusout",function(e){e.relatedTarget&&(!e.relatedTarget||e.relatedTarget.matches("."+a.options.classPrefix+"volume-slider"))||"vertical"!==c||(b.style.display="none")}),h.addEventListener("mouseleave",function(){y=!1,g||"vertical"!==c||(b.style.display="none")}),h.addEventListener("focusout",function(){y=!1}),h.addEventListener("keydown",function(e){if(a.options.keyActions.length){var t=e.which||e.keyCode||0,n=i.volume;switch(t){case 38:n=Math.min(n+.1,1);break;case 40:n=Math.max(0,n-.1);break;default:return!0}g=!1,P(n),i.setVolume(n),e.preventDefault(),e.stopPropagation()}}),h.querySelector("button").addEventListener("click",function(){i.setMuted(!i.muted);var e=(0,d.createEvent)("volumechange",i);i.dispatchEvent(e)}),b.addEventListener("dragstart",function(){return!1}),b.addEventListener("mouseover",function(){y=!0}),b.addEventListener("focusin",function(){b.style.display="block",y=!0}),b.addEventListener("focusout",function(){y=!1,g||"vertical"!==c||(b.style.display="none")}),b.addEventListener("mousedown",function(e){T(e),a.globalBind("mousemove.vol",function(e){var t=e.target;g&&(t===b||t.closest("vertical"===c?"."+a.options.classPrefix+"volume-slider":"."+a.options.classPrefix+"horizontal-volume-slider"))&&T(e)}),a.globalBind("mouseup.vol",function(){g=!1,y||"vertical"!==c||(b.style.display="none")}),g=!0,e.preventDefault(),e.stopPropagation()}),i.addEventListener("volumechange",function(e){g||C(),function(){var e=Math.floor(100*i.volume);b.setAttribute("aria-valuenow",e),b.setAttribute("aria-valuetext",e+"%")}()});var k=!1;i.addEventListener("rendererready",function(){E||setTimeout(function(){k=!0,(0===e.options.startVolume||i.originalNode.muted)&&(i.setMuted(!0),e.options.startVolume=0),i.setVolume(e.options.startVolume),a.setControlsSize()},250)}),i.addEventListener("loadedmetadata",function(){setTimeout(function(){E||k||((0===e.options.startVolume||i.originalNode.muted)&&i.setMuted(!0),i.setVolume(e.options.startVolume),a.setControlsSize()),k=!1},250)}),(0===e.options.startVolume||i.originalNode.muted)&&(i.setMuted(!0),e.options.startVolume=0,C()),a.getElement(a.container).addEventListener("controlsresize",function(){C()})}}})},{16:16,2:2,25:25,26:26,27:27,5:5}],15:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.EN={"mejs.plural-form":1,"mejs.download-file":"Download File","mejs.install-flash":"You are using a browser that does not have Flash player enabled or installed. Please turn on your Flash player plugin or download the latest version from https://get.adobe.com/flashplayer/","mejs.fullscreen":"Fullscreen","mejs.play":"Play","mejs.pause":"Pause","mejs.time-slider":"Time Slider","mejs.time-help-text":"Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.","mejs.live-broadcast":"Live Broadcast","mejs.volume-help-text":"Use Up/Down Arrow keys to increase or decrease volume.","mejs.unmute":"Unmute","mejs.mute":"Mute","mejs.volume-slider":"Volume Slider","mejs.video-player":"Video Player","mejs.audio-player":"Audio Player","mejs.captions-subtitles":"Captions/Subtitles","mejs.captions-chapters":"Chapters","mejs.none":"None","mejs.afrikaans":"Afrikaans","mejs.albanian":"Albanian","mejs.arabic":"Arabic","mejs.belarusian":"Belarusian","mejs.bulgarian":"Bulgarian","mejs.catalan":"Catalan","mejs.chinese":"Chinese","mejs.chinese-simplified":"Chinese (Simplified)","mejs.chinese-traditional":"Chinese (Traditional)","mejs.croatian":"Croatian","mejs.czech":"Czech","mejs.danish":"Danish","mejs.dutch":"Dutch","mejs.english":"English","mejs.estonian":"Estonian","mejs.filipino":"Filipino","mejs.finnish":"Finnish","mejs.french":"French","mejs.galician":"Galician","mejs.german":"German","mejs.greek":"Greek","mejs.haitian-creole":"Haitian Creole","mejs.hebrew":"Hebrew","mejs.hindi":"Hindi","mejs.hungarian":"Hungarian","mejs.icelandic":"Icelandic","mejs.indonesian":"Indonesian","mejs.irish":"Irish","mejs.italian":"Italian","mejs.japanese":"Japanese","mejs.korean":"Korean","mejs.latvian":"Latvian","mejs.lithuanian":"Lithuanian","mejs.macedonian":"Macedonian","mejs.malay":"Malay","mejs.maltese":"Maltese","mejs.norwegian":"Norwegian","mejs.persian":"Persian","mejs.polish":"Polish","mejs.portuguese":"Portuguese","mejs.romanian":"Romanian","mejs.russian":"Russian","mejs.serbian":"Serbian","mejs.slovak":"Slovak","mejs.slovenian":"Slovenian","mejs.spanish":"Spanish","mejs.swahili":"Swahili","mejs.swedish":"Swedish","mejs.tagalog":"Tagalog","mejs.thai":"Thai","mejs.turkish":"Turkish","mejs.ukrainian":"Ukrainian","mejs.vietnamese":"Vietnamese","mejs.welsh":"Welsh","mejs.yiddish":"Yiddish"}},{}],16:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0}),n.config=void 0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=i(e(3)),s=i(e(2)),l=i(e(7)),d=i(e(6)),u=i(e(17)),c=i(e(5)),f=e(25),p=e(27),m=e(30),h=e(28),v=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(e(26));l.default.mepIndex=0,l.default.players={};var g=n.config={poster:"",showPosterWhenEnded:!1,showPosterWhenPaused:!1,defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:40,defaultSeekBackwardInterval:function(e){return.05*e.getDuration()},defaultSeekForwardInterval:function(e){return.05*e.getDuration()},setDimensions:!0,audioWidth:-1,audioHeight:-1,loop:!1,autoRewind:!0,enableAutosize:!0,timeFormat:"",alwaysShowHours:!1,showTimecodeFrameCount:!1,framesPerSecond:25,alwaysShowControls:!1,hideVideoControlsOnLoad:!1,hideVideoControlsOnPause:!1,clickToPlayPause:!0,controlsTimeoutDefault:1500,controlsTimeoutMouseEnter:2500,controlsTimeoutMouseLeave:1e3,iPadUseNativeControls:!1,iPhoneUseNativeControls:!1,AndroidUseNativeControls:!1,features:["playpause","current","progress","duration","tracks","volume","fullscreen"],useDefaultControls:!1,isVideo:!0,stretching:"auto",classPrefix:"mejs__",enableKeyboard:!0,pauseOtherPlayers:!0,secondsDecimalLength:0,customError:null,keyActions:[{keys:[32,179],action:function(e){f.IS_FIREFOX||(e.paused||e.ended?e.play():e.pause())}}]};l.default.MepDefaults=g;var y=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var i="string"==typeof t?s.default.getElementById(t):t;if(!(this instanceof e))return new e(i,n);if(this.node=this.media=i,this.node){if(this.media.player)return this.media.player;if(this.hasFocus=!1,this.controlsAreVisible=!0,this.controlsEnabled=!0,this.controlsTimer=null,this.currentMediaTime=0,this.proxy=null,void 0===n){var o=this.node.getAttribute("data-mejsoptions");n=o?JSON.parse(o):{}}return this.options=Object.assign({},g,n),this.options.loop&&!this.media.getAttribute("loop")?(this.media.loop=!0,this.node.loop=!0):this.media.loop&&(this.options.loop=!0),this.options.timeFormat||(this.options.timeFormat="mm:ss",this.options.alwaysShowHours&&(this.options.timeFormat="hh:mm:ss"),this.options.showTimecodeFrameCount&&(this.options.timeFormat+=":ff")),(0,m.calculateTimeFormat)(0,this.options,this.options.framesPerSecond||25),this.id="mep_"+l.default.mepIndex++,l.default.players[this.id]=this,this.init(),this}}return r(e,[{key:"getElement",value:function(e){return e}},{key:"init",value:function(){var e=this,t=Object.assign({},e.options,{success:function(t,n){e._meReady(t,n)},error:function(t){e._handleError(t)}}),n=e.node.tagName.toLowerCase();if(e.isDynamic="audio"!==n&&"video"!==n&&"iframe"!==n,e.isVideo=e.isDynamic?e.options.isVideo:"audio"!==n&&e.options.isVideo,e.mediaFiles=null,e.trackFiles=null,f.IS_IPAD&&e.options.iPadUseNativeControls||f.IS_IPHONE&&e.options.iPhoneUseNativeControls)e.node.setAttribute("controls",!0),f.IS_IPAD&&e.node.getAttribute("autoplay")&&e.play();else if(!e.isVideo&&(e.isVideo||!e.options.features.length&&!e.options.useDefaultControls)||f.IS_ANDROID&&e.options.AndroidUseNativeControls)e.isVideo||e.options.features.length||e.options.useDefaultControls||(e.node.style.display="none");else{e.node.removeAttribute("controls");var i=e.isVideo?c.default.t("mejs.video-player"):c.default.t("mejs.audio-player"),o=s.default.createElement("span");if(o.className=e.options.classPrefix+"offscreen",o.innerText=i,e.media.parentNode.insertBefore(o,e.media),e.container=s.default.createElement("div"),e.getElement(e.container).id=e.id,e.getElement(e.container).className=e.options.classPrefix+"container "+e.options.classPrefix+"container-keyboard-inactive "+e.media.className,e.getElement(e.container).tabIndex=0,e.getElement(e.container).setAttribute("role","application"),e.getElement(e.container).setAttribute("aria-label",i),e.getElement(e.container).innerHTML='<div class="'+e.options.classPrefix+'inner"><div class="'+e.options.classPrefix+'mediaelement"></div><div class="'+e.options.classPrefix+'layers"></div><div class="'+e.options.classPrefix+'controls"></div></div>',e.getElement(e.container).addEventListener("focus",function(t){if(!e.controlsAreVisible&&!e.hasFocus&&e.controlsEnabled){e.showControls(!0);var n=(0,p.isNodeAfter)(t.relatedTarget,e.getElement(e.container))?"."+e.options.classPrefix+"controls ."+e.options.classPrefix+"button:last-child > button":"."+e.options.classPrefix+"playpause-button > button";e.getElement(e.container).querySelector(n).focus()}}),e.node.parentNode.insertBefore(e.getElement(e.container),e.node),e.options.features.length||e.options.useDefaultControls||(e.getElement(e.container).style.background="transparent",e.getElement(e.container).querySelector("."+e.options.classPrefix+"controls").style.display="none"),e.isVideo&&"fill"===e.options.stretching&&!v.hasClass(e.getElement(e.container).parentNode,e.options.classPrefix+"fill-container")){e.outerContainer=e.media.parentNode;var r=s.default.createElement("div");r.className=e.options.classPrefix+"fill-container",e.getElement(e.container).parentNode.insertBefore(r,e.getElement(e.container)),r.appendChild(e.getElement(e.container))}if(f.IS_ANDROID&&v.addClass(e.getElement(e.container),e.options.classPrefix+"android"),f.IS_IOS&&v.addClass(e.getElement(e.container),e.options.classPrefix+"ios"),f.IS_IPAD&&v.addClass(e.getElement(e.container),e.options.classPrefix+"ipad"),f.IS_IPHONE&&v.addClass(e.getElement(e.container),e.options.classPrefix+"iphone"),v.addClass(e.getElement(e.container),e.isVideo?e.options.classPrefix+"video":e.options.classPrefix+"audio"),f.IS_SAFARI&&!f.IS_IOS){v.addClass(e.getElement(e.container),e.options.classPrefix+"hide-cues");for(var a=e.node.cloneNode(),u=e.node.children,m=[],g=[],y=0,E=u.length;y<E;y++){var b=u[y];!function(){switch(b.tagName.toLowerCase()){case"source":var e={};Array.prototype.slice.call(b.attributes).forEach(function(t){e[t.name]=t.value}),e.type=(0,h.formatType)(e.src,e.type),m.push(e);break;case"track":b.mode="hidden",g.push(b);break;default:a.appendChild(b)}}()}e.node.remove(),e.node=e.media=a,m.length&&(e.mediaFiles=m),g.length&&(e.trackFiles=g)}e.getElement(e.container).querySelector("."+e.options.classPrefix+"mediaelement").appendChild(e.node),e.media.player=e,e.controls=e.getElement(e.container).querySelector("."+e.options.classPrefix+"controls"),e.layers=e.getElement(e.container).querySelector("."+e.options.classPrefix+"layers");var S=e.isVideo?"video":"audio",x=S.substring(0,1).toUpperCase()+S.substring(1);e.options[S+"Width"]>0||e.options[S+"Width"].toString().indexOf("%")>-1?e.width=e.options[S+"Width"]:""!==e.node.style.width&&null!==e.node.style.width?e.width=e.node.style.width:e.node.getAttribute("width")?e.width=e.node.getAttribute("width"):e.width=e.options["default"+x+"Width"],e.options[S+"Height"]>0||e.options[S+"Height"].toString().indexOf("%")>-1?e.height=e.options[S+"Height"]:""!==e.node.style.height&&null!==e.node.style.height?e.height=e.node.style.height:e.node.getAttribute("height")?e.height=e.node.getAttribute("height"):e.height=e.options["default"+x+"Height"],e.initialAspectRatio=e.height>=e.width?e.width/e.height:e.height/e.width,e.setPlayerSize(e.width,e.height),t.pluginWidth=e.width,t.pluginHeight=e.height}if(l.default.MepDefaults=t,new d.default(e.media,t,e.mediaFiles),void 0!==e.getElement(e.container)&&e.options.features.length&&e.controlsAreVisible&&!e.options.hideVideoControlsOnLoad){var w=(0,p.createEvent)("controlsshown",e.getElement(e.container));e.getElement(e.container).dispatchEvent(w)}}},{key:"showControls",value:function(e){var t=this;if(e=void 0===e||e,!t.controlsAreVisible&&t.isVideo){if(e)!function(){v.fadeIn(t.getElement(t.controls),200,function(){v.removeClass(t.getElement(t.controls),t.options.classPrefix+"offscreen");var e=(0,p.createEvent)("controlsshown",t.getElement(t.container));t.getElement(t.container).dispatchEvent(e)});for(var e=t.getElement(t.container).querySelectorAll("."+t.options.classPrefix+"control"),n=function(n,i){v.fadeIn(e[n],200,function(){v.removeClass(e[n],t.options.classPrefix+"offscreen")})},i=0,o=e.length;i<o;i++)n(i)}();else{v.removeClass(t.getElement(t.controls),t.options.classPrefix+"offscreen"),t.getElement(t.controls).style.display="",t.getElement(t.controls).style.opacity=1;for(var n=t.getElement(t.container).querySelectorAll("."+t.options.classPrefix+"control"),i=0,o=n.length;i<o;i++)v.removeClass(n[i],t.options.classPrefix+"offscreen"),n[i].style.display="";var r=(0,p.createEvent)("controlsshown",t.getElement(t.container));t.getElement(t.container).dispatchEvent(r)}t.controlsAreVisible=!0,t.setControlsSize()}}},{key:"hideControls",value:function(e,t){var n=this;if(e=void 0===e||e,!0===t||!(!n.controlsAreVisible||n.options.alwaysShowControls||n.paused&&4===n.readyState&&(!n.options.hideVideoControlsOnLoad&&n.currentTime<=0||!n.options.hideVideoControlsOnPause&&n.currentTime>0)||n.isVideo&&!n.options.hideVideoControlsOnLoad&&!n.readyState||n.ended)){if(e)!function(){v.fadeOut(n.getElement(n.controls),200,function(){v.addClass(n.getElement(n.controls),n.options.classPrefix+"offscreen"),n.getElement(n.controls).style.display="";var e=(0,p.createEvent)("controlshidden",n.getElement(n.container));n.getElement(n.container).dispatchEvent(e)});for(var e=n.getElement(n.container).querySelectorAll("."+n.options.classPrefix+"control"),t=function(t,i){v.fadeOut(e[t],200,function(){v.addClass(e[t],n.options.classPrefix+"offscreen"),e[t].style.display=""})},i=0,o=e.length;i<o;i++)t(i)}();else{v.addClass(n.getElement(n.controls),n.options.classPrefix+"offscreen"),n.getElement(n.controls).style.display="",n.getElement(n.controls).style.opacity=0;for(var i=n.getElement(n.container).querySelectorAll("."+n.options.classPrefix+"control"),o=0,r=i.length;o<r;o++)v.addClass(i[o],n.options.classPrefix+"offscreen"),i[o].style.display="";var a=(0,p.createEvent)("controlshidden",n.getElement(n.container));n.getElement(n.container).dispatchEvent(a)}n.controlsAreVisible=!1}}},{key:"startControlsTimer",value:function(e){var t=this;e=void 0!==e?e:t.options.controlsTimeoutDefault,t.killControlsTimer("start"),t.controlsTimer=setTimeout(function(){t.hideControls(),t.killControlsTimer("hide")},e)}},{key:"killControlsTimer",value:function(){null!==this.controlsTimer&&(clearTimeout(this.controlsTimer),delete this.controlsTimer,this.controlsTimer=null)}},{key:"disableControls",value:function(){this.killControlsTimer(),this.controlsEnabled=!1,this.hideControls(!1,!0)}},{key:"enableControls",value:function(){this.controlsEnabled=!0,this.showControls(!1)}},{key:"_setDefaultPlayer",value:function(){var e=this;e.proxy&&e.proxy.pause(),e.proxy=new u.default(e),e.media.addEventListener("loadedmetadata",function(){e.getCurrentTime()>0&&e.currentMediaTime>0&&(e.setCurrentTime(e.currentMediaTime),f.IS_IOS||f.IS_ANDROID||e.play())})}},{key:"_meReady",value:function(e,t){var n=this,i=t.getAttribute("autoplay"),o=!(void 0===i||null===i||"false"===i),r=null!==e.rendererName&&/(native|html5)/i.test(n.media.rendererName);if(n.getElement(n.controls)&&n.enableControls(),n.getElement(n.container)&&n.getElement(n.container).querySelector("."+n.options.classPrefix+"overlay-play")&&(n.getElement(n.container).querySelector("."+n.options.classPrefix+"overlay-play").style.display=""),!n.created){if(n.created=!0,n.media=e,n.domNode=t,!(f.IS_ANDROID&&n.options.AndroidUseNativeControls||f.IS_IPAD&&n.options.iPadUseNativeControls||f.IS_IPHONE&&n.options.iPhoneUseNativeControls)){if(!n.isVideo&&!n.options.features.length&&!n.options.useDefaultControls)return o&&r&&n.play(),void(n.options.success&&("string"==typeof n.options.success?a.default[n.options.success](n.media,n.domNode,n):n.options.success(n.media,n.domNode,n)));if(n.featurePosition={},n._setDefaultPlayer(),n.buildposter(n,n.getElement(n.controls),n.getElement(n.layers),n.media),n.buildkeyboard(n,n.getElement(n.controls),n.getElement(n.layers),n.media),n.buildoverlays(n,n.getElement(n.controls),n.getElement(n.layers),n.media),n.options.useDefaultControls){var d=["playpause","current","progress","duration","tracks","volume","fullscreen"];n.options.features=d.concat(n.options.features.filter(function(e){return-1===d.indexOf(e)}))}n.buildfeatures(n,n.getElement(n.controls),n.getElement(n.layers),n.media);var u=(0,p.createEvent)("controlsready",n.getElement(n.container));n.getElement(n.container).dispatchEvent(u),n.setPlayerSize(n.width,n.height),n.setControlsSize(),n.isVideo&&(n.clickToPlayPauseCallback=function(){if(n.options.clickToPlayPause){var e=n.getElement(n.container).querySelector("."+n.options.classPrefix+"overlay-button"),t=e.getAttribute("aria-pressed");n.paused&&t?n.pause():n.paused?n.play():n.pause(),e.setAttribute("aria-pressed",!t),n.getElement(n.container).focus()}},n.createIframeLayer(),n.media.addEventListener("click",n.clickToPlayPauseCallback),!f.IS_ANDROID&&!f.IS_IOS||n.options.alwaysShowControls?(n.getElement(n.container).addEventListener("mouseenter",function(){n.controlsEnabled&&(n.options.alwaysShowControls||(n.killControlsTimer("enter"),n.showControls(),n.startControlsTimer(n.options.controlsTimeoutMouseEnter)))}),n.getElement(n.container).addEventListener("mousemove",function(){n.controlsEnabled&&(n.controlsAreVisible||n.showControls(),n.options.alwaysShowControls||n.startControlsTimer(n.options.controlsTimeoutMouseEnter))}),n.getElement(n.container).addEventListener("mouseleave",function(){n.controlsEnabled&&(n.paused||n.options.alwaysShowControls||n.startControlsTimer(n.options.controlsTimeoutMouseLeave))})):n.node.addEventListener("touchstart",function(){n.controlsAreVisible?n.hideControls(!1):n.controlsEnabled&&n.showControls(!1)},!!f.SUPPORT_PASSIVE_EVENT&&{passive:!0}),n.options.hideVideoControlsOnLoad&&n.hideControls(!1),n.options.enableAutosize&&n.media.addEventListener("loadedmetadata",function(e){var t=void 0!==e?e.detail.target||e.target:n.media;n.options.videoHeight<=0&&!n.domNode.getAttribute("height")&&!n.domNode.style.height&&null!==t&&!isNaN(t.videoHeight)&&(n.setPlayerSize(t.videoWidth,t.videoHeight),n.setControlsSize(),n.media.setSize(t.videoWidth,t.videoHeight))})),n.media.addEventListener("play",function(){n.hasFocus=!0;for(var e in l.default.players)if(l.default.players.hasOwnProperty(e)){var t=l.default.players[e];t.id===n.id||!n.options.pauseOtherPlayers||t.paused||t.ended||(t.pause(),t.hasFocus=!1)}f.IS_ANDROID||f.IS_IOS||n.options.alwaysShowControls||!n.isVideo||n.hideControls()}),n.media.addEventListener("ended",function(){if(n.options.autoRewind)try{n.setCurrentTime(0),setTimeout(function(){var e=n.getElement(n.container).querySelector("."+n.options.classPrefix+"overlay-loading");e&&e.parentNode&&(e.parentNode.style.display="none")},20)}catch(e){}"function"==typeof n.media.renderer.stop?n.media.renderer.stop():n.pause(),n.setProgressRail&&n.setProgressRail(),n.setCurrentRail&&n.setCurrentRail(),n.options.loop?n.play():!n.options.alwaysShowControls&&n.controlsEnabled&&n.showControls()}),n.media.addEventListener("loadedmetadata",function(){(0,m.calculateTimeFormat)(n.getDuration(),n.options,n.options.framesPerSecond||25),n.updateDuration&&n.updateDuration(),n.updateCurrent&&n.updateCurrent(),n.isFullScreen||(n.setPlayerSize(n.width,n.height),n.setControlsSize())});var c=null;n.media.addEventListener("timeupdate",function(){isNaN(n.getDuration())||c===n.getDuration()||(c=n.getDuration(),(0,m.calculateTimeFormat)(c,n.options,n.options.framesPerSecond||25),n.updateDuration&&n.updateDuration(),n.updateCurrent&&n.updateCurrent(),n.setControlsSize())}),n.getElement(n.container).addEventListener("click",function(e){v.addClass(e.currentTarget,n.options.classPrefix+"container-keyboard-inactive")}),n.getElement(n.container).addEventListener("focusin",function(e){v.removeClass(e.currentTarget,n.options.classPrefix+"container-keyboard-inactive"),!n.isVideo||f.IS_ANDROID||f.IS_IOS||!n.controlsEnabled||n.options.alwaysShowControls||(n.killControlsTimer("enter"),n.showControls(),n.startControlsTimer(n.options.controlsTimeoutMouseEnter))}),n.getElement(n.container).addEventListener("focusout",function(e){setTimeout(function(){e.relatedTarget&&n.keyboardAction&&!e.relatedTarget.closest("."+n.options.classPrefix+"container")&&(n.keyboardAction=!1,!n.isVideo||n.options.alwaysShowControls||n.paused||n.startControlsTimer(n.options.controlsTimeoutMouseLeave))},0)}),setTimeout(function(){n.setPlayerSize(n.width,n.height),n.setControlsSize()},0),n.globalResizeCallback=function(){n.isFullScreen||f.HAS_TRUE_NATIVE_FULLSCREEN&&s.default.webkitIsFullScreen||n.setPlayerSize(n.width,n.height),n.setControlsSize()},n.globalBind("resize",n.globalResizeCallback)}o&&r&&n.play(),n.options.success&&("string"==typeof n.options.success?a.default[n.options.success](n.media,n.domNode,n):n.options.success(n.media,n.domNode,n))}}},{key:"_handleError",value:function(e,t,n){var i=this.getElement(this.layers).querySelector("."+this.options.classPrefix+"overlay-play");i&&(i.style.display="none"),this.options.error&&this.options.error(e,t,n),this.getElement(this.container).querySelector("."+this.options.classPrefix+"cannotplay")&&this.getElement(this.container).querySelector("."+this.options.classPrefix+"cannotplay").remove();var o=s.default.createElement("div");o.className=this.options.classPrefix+"cannotplay",o.style.width="100%",o.style.height="100%";var r="function"==typeof this.options.customError?this.options.customError(this.media,this.media.originalNode):this.options.customError,a="";if(!r){var d=this.media.originalNode.getAttribute("poster");if(d&&(a='<img src="'+d+'" alt="'+l.default.i18n.t("mejs.download-file")+'">'),e.message&&(r="<p>"+e.message+"</p>"),e.urls)for(var u=0,c=e.urls.length;u<c;u++){var f=e.urls[u];r+='<a href="'+f.src+'" data-type="'+f.type+'"><span>'+l.default.i18n.t("mejs.download-file")+": "+f.src+"</span></a>"}}r&&this.getElement(this.layers).querySelector("."+this.options.classPrefix+"overlay-error")&&(o.innerHTML=r,this.getElement(this.layers).querySelector("."+this.options.classPrefix+"overlay-error").innerHTML=""+a+o.outerHTML,this.getElement(this.layers).querySelector("."+this.options.classPrefix+"overlay-error").parentNode.style.display="block"),this.controlsEnabled&&this.disableControls()}},{key:"setPlayerSize",value:function(e,t){if(!this.options.setDimensions)return!1;switch(void 0!==e&&(this.width=e),void 0!==t&&(this.height=t),this.options.stretching){case"fill":this.isVideo?this.setFillMode():this.setDimensions(this.width,this.height);break;case"responsive":this.setResponsiveMode();break;case"none":this.setDimensions(this.width,this.height);break;default:!0===this.hasFluidMode()?this.setResponsiveMode():this.setDimensions(this.width,this.height)}}},{key:"hasFluidMode",value:function(){return-1!==this.height.toString().indexOf("%")||this.node&&this.node.style.maxWidth&&"none"!==this.node.style.maxWidth&&this.node.style.maxWidth!==this.width||this.node&&this.node.currentStyle&&"100%"===this.node.currentStyle.maxWidth}},{key:"setResponsiveMode",value:function(){var e=this,t=function(){for(var t=void 0,n=e.getElement(e.container);n;){try{if(f.IS_FIREFOX&&"html"===n.tagName.toLowerCase()&&a.default.self!==a.default.top&&null!==a.default.frameElement)return a.default.frameElement;t=n.parentElement}catch(e){t=n.parentElement}if(t&&v.visible(t))return t;n=t}return null}(),n=t?getComputedStyle(t,null):getComputedStyle(s.default.body,null),i=e.isVideo?e.node.videoWidth&&e.node.videoWidth>0?e.node.videoWidth:e.node.getAttribute("width")?e.node.getAttribute("width"):e.options.defaultVideoWidth:e.options.defaultAudioWidth,o=e.isVideo?e.node.videoHeight&&e.node.videoHeight>0?e.node.videoHeight:e.node.getAttribute("height")?e.node.getAttribute("height"):e.options.defaultVideoHeight:e.options.defaultAudioHeight,r=function(){var t=1;return e.isVideo?(t=e.node.videoWidth&&e.node.videoWidth>0&&e.node.videoHeight&&e.node.videoHeight>0?e.height>=e.width?e.node.videoWidth/e.node.videoHeight:e.node.videoHeight/e.node.videoWidth:e.initialAspectRatio,(isNaN(t)||t<.01||t>100)&&(t=1),t):t}(),l=parseFloat(n.height),d=void 0,u=parseFloat(n.width);if(d=e.isVideo?"100%"===e.height?parseFloat(u*o/i,10):e.height>=e.width?parseFloat(u/r,10):parseFloat(u*r,10):o,isNaN(d)&&(d=l),e.getElement(e.container).parentNode.length>0&&"body"===e.getElement(e.container).parentNode.tagName.toLowerCase()&&(u=a.default.innerWidth||s.default.documentElement.clientWidth||s.default.body.clientWidth,d=a.default.innerHeight||s.default.documentElement.clientHeight||s.default.body.clientHeight),d&&u){e.getElement(e.container).style.width=u+"px",e.getElement(e.container).style.height=d+"px",e.node.style.width="100%",e.node.style.height="100%",e.isVideo&&e.media.setSize&&e.media.setSize(u,d);for(var c=e.getElement(e.layers).children,p=0,m=c.length;p<m;p++)c[p].style.width="100%",c[p].style.height="100%"}}},{key:"setFillMode",value:function(){var e=this,t=a.default.self!==a.default.top&&null!==a.default.frameElement,n=function(){for(var t=void 0,n=e.getElement(e.container);n;){try{if(f.IS_FIREFOX&&"html"===n.tagName.toLowerCase()&&a.default.self!==a.default.top&&null!==a.default.frameElement)return a.default.frameElement;t=n.parentElement}catch(e){t=n.parentElement}if(t&&v.visible(t))return t;n=t}return null}(),i=n?getComputedStyle(n,null):getComputedStyle(s.default.body,null);"none"!==e.node.style.height&&e.node.style.height!==e.height&&(e.node.style.height="auto"),"none"!==e.node.style.maxWidth&&e.node.style.maxWidth!==e.width&&(e.node.style.maxWidth="none"),"none"!==e.node.style.maxHeight&&e.node.style.maxHeight!==e.height&&(e.node.style.maxHeight="none"),e.node.currentStyle&&("100%"===e.node.currentStyle.height&&(e.node.currentStyle.height="auto"),"100%"===e.node.currentStyle.maxWidth&&(e.node.currentStyle.maxWidth="none"),"100%"===e.node.currentStyle.maxHeight&&(e.node.currentStyle.maxHeight="none")),t||parseFloat(i.width)||(n.style.width=e.media.offsetWidth+"px"),t||parseFloat(i.height)||(n.style.height=e.media.offsetHeight+"px"),i=getComputedStyle(n);var o=parseFloat(i.width),r=parseFloat(i.height);e.setDimensions("100%","100%");var l=e.getElement(e.container).querySelector("."+e.options.classPrefix+"poster>img");l&&(l.style.display="");for(var d=e.getElement(e.container).querySelectorAll("object, embed, iframe, video"),u=e.height,c=e.width,p=o,m=u*o/c,h=c*r/u,g=r,y=h>o==!1,E=y?Math.floor(p):Math.floor(h),b=y?Math.floor(m):Math.floor(g),S=y?o+"px":E+"px",x=y?b+"px":r+"px",w=0,P=d.length;w<P;w++)d[w].style.height=x,d[w].style.width=S,e.media.setSize&&e.media.setSize(S,x),d[w].style.marginLeft=Math.floor((o-E)/2)+"px",d[w].style.marginTop=0}},{key:"setDimensions",value:function(e,t){e=(0,p.isString)(e)&&e.indexOf("%")>-1?e:parseFloat(e)+"px",t=(0,p.isString)(t)&&t.indexOf("%")>-1?t:parseFloat(t)+"px",this.getElement(this.container).style.width=e,this.getElement(this.container).style.height=t;for(var n=this.getElement(this.layers).children,i=0,o=n.length;i<o;i++)n[i].style.width=e,n[i].style.height=t}},{key:"setControlsSize",value:function(){var e=this;if(v.visible(e.getElement(e.container)))if(e.rail&&v.visible(e.rail)){for(var t=e.total?getComputedStyle(e.total,null):null,n=t?parseFloat(t.marginLeft)+parseFloat(t.marginRight):0,i=getComputedStyle(e.rail),o=parseFloat(i.marginLeft)+parseFloat(i.marginRight),r=0,a=v.siblings(e.rail,function(t){return t!==e.rail}),s=a.length,l=0;l<s;l++)r+=a[l].offsetWidth;r+=n+(0===n?2*o:o)+1,e.getElement(e.container).style.minWidth=r+"px";var d=(0,p.createEvent)("controlsresize",e.getElement(e.container));e.getElement(e.container).dispatchEvent(d)}else{for(var u=e.getElement(e.controls).children,c=0,f=0,m=u.length;f<m;f++)c+=u[f].offsetWidth;e.getElement(e.container).style.minWidth=c+"px"}}},{key:"addControlElement",value:function(e,t){if(void 0!==this.featurePosition[t]){var n=this.getElement(this.controls).children[this.featurePosition[t]-1];n.parentNode.insertBefore(e,n.nextSibling)}else{this.getElement(this.controls).appendChild(e);for(var i=this.getElement(this.controls).children,o=0,r=i.length;o<r;o++)if(e===i[o]){this.featurePosition[t]=o;break}}}},{key:"createIframeLayer",value:function(){var e=this;if(e.isVideo&&null!==e.media.rendererName&&e.media.rendererName.indexOf("iframe")>-1&&!s.default.getElementById(e.media.id+"-iframe-overlay")){var t=s.default.createElement("div"),n=s.default.getElementById(e.media.id+"_"+e.media.rendererName);t.id=e.media.id+"-iframe-overlay",t.className=e.options.classPrefix+"iframe-overlay",t.addEventListener("click",function(t){e.options.clickToPlayPause&&(e.paused?e.play():e.pause(),t.preventDefault(),t.stopPropagation())}),n.parentNode.insertBefore(t,n)}}},{key:"resetSize",value:function(){var e=this;setTimeout(function(){e.setPlayerSize(e.width,e.height),e.setControlsSize()},50)}},{key:"setPoster",value:function(e){if(this.getElement(this.container)){var t=this.getElement(this.container).querySelector("."+this.options.classPrefix+"poster");t||((t=s.default.createElement("div")).className=this.options.classPrefix+"poster "+this.options.classPrefix+"layer",this.getElement(this.layers).appendChild(t));var n=t.querySelector("img");!n&&e&&((n=s.default.createElement("img")).className=this.options.classPrefix+"poster-img",n.width="100%",n.height="100%",t.style.display="",t.appendChild(n)),e?(n.setAttribute("src",e),t.style.backgroundImage='url("'+e+'")',t.style.display=""):n?(t.style.backgroundImage="none",t.style.display="none",n.remove()):t.style.display="none"}else(f.IS_IPAD&&this.options.iPadUseNativeControls||f.IS_IPHONE&&this.options.iPhoneUseNativeControls||f.IS_ANDROID&&this.options.AndroidUseNativeControls)&&(this.media.originalNode.poster=e)}},{key:"changeSkin",value:function(e){this.getElement(this.container).className=this.options.classPrefix+"container "+e,this.setPlayerSize(this.width,this.height),this.setControlsSize()}},{key:"globalBind",value:function(e,t){var n=this.node?this.node.ownerDocument:s.default;if((e=(0,p.splitEvents)(e,this.id)).d)for(var i=e.d.split(" "),o=0,r=i.length;o<r;o++)i[o].split(".").reduce(function(e,i){return n.addEventListener(i,t,!1),i},"");if(e.w)for(var l=e.w.split(" "),d=0,u=l.length;d<u;d++)l[d].split(".").reduce(function(e,n){return a.default.addEventListener(n,t,!1),n},"")}},{key:"globalUnbind",value:function(e,t){var n=this.node?this.node.ownerDocument:s.default;if((e=(0,p.splitEvents)(e,this.id)).d)for(var i=e.d.split(" "),o=0,r=i.length;o<r;o++)i[o].split(".").reduce(function(e,i){return n.removeEventListener(i,t,!1),i},"");if(e.w)for(var l=e.w.split(" "),d=0,u=l.length;d<u;d++)l[d].split(".").reduce(function(e,n){return a.default.removeEventListener(n,t,!1),n},"")}},{key:"buildfeatures",value:function(e,t,n,i){for(var o=0,r=this.options.features.length;o<r;o++){var a=this.options.features[o];if(this["build"+a])try{this["build"+a](e,t,n,i)}catch(e){console.error("error building "+a,e)}}}},{key:"buildposter",value:function(e,t,n,i){var o=s.default.createElement("div");o.className=this.options.classPrefix+"poster "+this.options.classPrefix+"layer",n.appendChild(o);var r=i.originalNode.getAttribute("poster");""!==e.options.poster&&(r&&f.IS_IOS&&i.originalNode.removeAttribute("poster"),r=e.options.poster),r?this.setPoster(r):null!==this.media.renderer&&"function"==typeof this.media.renderer.getPosterUrl?this.setPoster(this.media.renderer.getPosterUrl()):o.style.display="none",i.addEventListener("play",function(){o.style.display="none"}),i.addEventListener("playing",function(){o.style.display="none"}),e.options.showPosterWhenEnded&&e.options.autoRewind&&i.addEventListener("ended",function(){o.style.display=""}),i.addEventListener("error",function(){o.style.display="none"}),e.options.showPosterWhenPaused&&i.addEventListener("pause",function(){e.ended||(o.style.display="")})}},{key:"buildoverlays",value:function(e,t,n,i){if(e.isVideo){var o=this,r=s.default.createElement("div"),a=s.default.createElement("div"),l=s.default.createElement("div");r.style.display="none",r.className=o.options.classPrefix+"overlay "+o.options.classPrefix+"layer",r.innerHTML='<div class="'+o.options.classPrefix+'overlay-loading"><span class="'+o.options.classPrefix+'overlay-loading-bg-img"></span></div>',n.appendChild(r),a.style.display="none",a.className=o.options.classPrefix+"overlay "+o.options.classPrefix+"layer",a.innerHTML='<div class="'+o.options.classPrefix+'overlay-error"></div>',n.appendChild(a),l.className=o.options.classPrefix+"overlay "+o.options.classPrefix+"layer "+o.options.classPrefix+"overlay-play",l.innerHTML='<div class="'+o.options.classPrefix+'overlay-button" role="button" tabindex="0" aria-label="'+c.default.t("mejs.play")+'" aria-pressed="false"></div>',l.addEventListener("click",function(){if(o.options.clickToPlayPause){var e=o.getElement(o.container).querySelector("."+o.options.classPrefix+"overlay-button"),t=e.getAttribute("aria-pressed");o.paused?o.play():o.pause(),e.setAttribute("aria-pressed",!!t),o.getElement(o.container).focus()}}),l.addEventListener("keydown",function(e){var t=e.keyCode||e.which||0;if(13===t||f.IS_FIREFOX&&32===t){var n=(0,p.createEvent)("click",l);return l.dispatchEvent(n),!1}}),n.appendChild(l),null!==o.media.rendererName&&(/(youtube|facebook)/i.test(o.media.rendererName)&&!(o.media.originalNode.getAttribute("poster")||e.options.poster||"function"==typeof o.media.renderer.getPosterUrl&&o.media.renderer.getPosterUrl())||f.IS_STOCK_ANDROID||o.media.originalNode.getAttribute("autoplay"))&&(l.style.display="none");var d=!1;i.addEventListener("play",function(){l.style.display="none",r.style.display="none",a.style.display="none",d=!1}),i.addEventListener("playing",function(){l.style.display="none",r.style.display="none",a.style.display="none",d=!1}),i.addEventListener("seeking",function(){l.style.display="none",r.style.display="",d=!1}),i.addEventListener("seeked",function(){l.style.display=o.paused&&!f.IS_STOCK_ANDROID?"":"none",r.style.display="none",d=!1}),i.addEventListener("pause",function(){r.style.display="none",f.IS_STOCK_ANDROID||d||(l.style.display=""),d=!1}),i.addEventListener("waiting",function(){r.style.display="",d=!1}),i.addEventListener("loadeddata",function(){r.style.display="",f.IS_ANDROID&&(i.canplayTimeout=setTimeout(function(){if(s.default.createEvent){var e=s.default.createEvent("HTMLEvents");return e.initEvent("canplay",!0,!0),i.dispatchEvent(e)}},300)),d=!1}),i.addEventListener("canplay",function(){r.style.display="none",clearTimeout(i.canplayTimeout),d=!1}),i.addEventListener("error",function(e){o._handleError(e,o.media,o.node),r.style.display="none",l.style.display="none",d=!0}),i.addEventListener("loadedmetadata",function(){o.controlsEnabled||o.enableControls()}),i.addEventListener("keydown",function(t){o.onkeydown(e,i,t),d=!1})}}},{key:"buildkeyboard",value:function(e,t,n,i){var o=this;o.getElement(o.container).addEventListener("keydown",function(){o.keyboardAction=!0}),o.globalKeydownCallback=function(t){var n=s.default.activeElement.closest("."+o.options.classPrefix+"container"),r=o.media.closest("."+o.options.classPrefix+"container");return o.hasFocus=!(!n||!r||n.id!==r.id),o.onkeydown(e,i,t)},o.globalClickCallback=function(e){o.hasFocus=!!e.target.closest("."+o.options.classPrefix+"container")},o.globalBind("keydown",o.globalKeydownCallback),o.globalBind("click",o.globalClickCallback)}},{key:"onkeydown",value:function(e,t,n){if(e.hasFocus&&e.options.enableKeyboard)for(var i=0,o=e.options.keyActions.length;i<o;i++)for(var r=e.options.keyActions[i],a=0,s=r.keys.length;a<s;a++)if(n.keyCode===r.keys[a])return r.action(e,t,n.keyCode,n),n.preventDefault(),void n.stopPropagation();return!0}},{key:"play",value:function(){this.proxy.play()}},{key:"pause",value:function(){this.proxy.pause()}},{key:"load",value:function(){this.proxy.load()}},{key:"setCurrentTime",value:function(e){this.proxy.setCurrentTime(e)}},{key:"getCurrentTime",value:function(){return this.proxy.currentTime}},{key:"getDuration",value:function(){return this.proxy.duration}},{key:"setVolume",value:function(e){this.proxy.volume=e}},{key:"getVolume",value:function(){return this.proxy.getVolume()}},{key:"setMuted",value:function(e){this.proxy.setMuted(e)}},{key:"setSrc",value:function(e){this.controlsEnabled||this.enableControls(),this.proxy.setSrc(e)}},{key:"getSrc",value:function(){return this.proxy.getSrc()}},{key:"canPlayType",value:function(e){return this.proxy.canPlayType(e)}},{key:"remove",value:function(){var e=this,t=e.media.rendererName,n=e.media.originalNode.src;for(var i in e.options.features){var r=e.options.features[i];if(e["clean"+r])try{e["clean"+r](e,e.getElement(e.layers),e.getElement(e.controls),e.media)}catch(e){console.error("error cleaning "+r,e)}}var a=e.node.getAttribute("width"),d=e.node.getAttribute("height");if(a?-1===a.indexOf("%")&&(a+="px"):a="auto",d?-1===d.indexOf("%")&&(d+="px"):d="auto",e.node.style.width=a,e.node.style.height=d,e.setPlayerSize(0,0),e.isDynamic?e.getElement(e.container).parentNode.insertBefore(e.node,e.getElement(e.container)):function(){e.node.setAttribute("controls",!0),e.node.setAttribute("id",e.node.getAttribute("id").replace("_"+t,"").replace("_from_mejs",""));var i=e.getElement(e.container).querySelector("."+e.options.classPrefix+"poster>img");if(i&&e.node.setAttribute("poster",i.src),delete e.node.autoplay,""!==e.media.canPlayType((0,h.getTypeFromFile)(n))&&e.node.setAttribute("src",n),~t.indexOf("iframe")){s.default.getElementById(e.media.id+"-iframe-overlay").remove()}var o=e.node.cloneNode();if(o.style.display="",e.getElement(e.container).parentNode.insertBefore(o,e.getElement(e.container)),e.node.remove(),e.mediaFiles)for(var r=0,a=e.mediaFiles.length;r<a;r++){var l=s.default.createElement("source");l.setAttribute("src",e.mediaFiles[r].src),l.setAttribute("type",e.mediaFiles[r].type),o.appendChild(l)}if(e.trackFiles)for(var d=function(t,n){var i=e.trackFiles[t],r=s.default.createElement("track");r.kind=i.kind,r.label=i.label,r.srclang=i.srclang,r.src=i.src,o.appendChild(r),r.addEventListener("load",function(){this.mode="showing",o.textTracks[t].mode="showing"})},u=0,c=e.trackFiles.length;u<c;u++)d(u);delete e.node,delete e.mediaFiles,delete e.trackFiles}(),"function"==typeof e.media.renderer.destroy&&e.media.renderer.destroy(),delete l.default.players[e.id],"object"===o(e.getElement(e.container))){e.getElement(e.container).parentNode.querySelector("."+e.options.classPrefix+"offscreen").remove(),e.getElement(e.container).remove()}e.globalUnbind("resize",e.globalResizeCallback),e.globalUnbind("keydown",e.globalKeydownCallback),e.globalUnbind("click",e.globalClickCallback),delete e.media.player}},{key:"paused",get:function(){return this.proxy.paused}},{key:"muted",get:function(){return this.proxy.muted},set:function(e){this.setMuted(e)}},{key:"ended",get:function(){return this.proxy.ended}},{key:"readyState",get:function(){return this.proxy.readyState}},{key:"currentTime",set:function(e){this.setCurrentTime(e)},get:function(){return this.getCurrentTime()}},{key:"duration",get:function(){return this.getDuration()}},{key:"volume",set:function(e){this.setVolume(e)},get:function(){return this.getVolume()}},{key:"src",set:function(e){this.setSrc(e)},get:function(){return this.getSrc()}}]),e}();a.default.MediaElementPlayer=y,l.default.MediaElementPlayer=y,n.default=y},{17:17,2:2,25:25,26:26,27:27,28:28,3:3,30:30,5:5,6:6,7:7}],17:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(e){return e&&e.__esModule?e:{default:e}}(e(3)),r=function(){function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.media=t.media,this.isVideo=t.isVideo,this.classPrefix=t.options.classPrefix,this.createIframeLayer=function(){return t.createIframeLayer()},this.setPoster=function(e){return t.setPoster(e)},this}return i(e,[{key:"play",value:function(){this.media.play()}},{key:"pause",value:function(){this.media.pause()}},{key:"load",value:function(){this.isLoaded||this.media.load(),this.isLoaded=!0}},{key:"setCurrentTime",value:function(e){this.media.setCurrentTime(e)}},{key:"getCurrentTime",value:function(){return this.media.currentTime}},{key:"getDuration",value:function(){return this.media.getDuration()}},{key:"setVolume",value:function(e){this.media.setVolume(e)}},{key:"getVolume",value:function(){return this.media.getVolume()}},{key:"setMuted",value:function(e){this.media.setMuted(e)}},{key:"setSrc",value:function(e){var t=document.getElementById(this.media.id+"-iframe-overlay");t&&t.remove(),this.media.setSrc(e),this.createIframeLayer(),null!==this.media.renderer&&"function"==typeof this.media.renderer.getPosterUrl&&this.setPoster(this.media.renderer.getPosterUrl())}},{key:"getSrc",value:function(){return this.media.getSrc()}},{key:"canPlayType",value:function(e){return this.media.canPlayType(e)}},{key:"paused",get:function(){return this.media.paused}},{key:"muted",set:function(e){this.setMuted(e)},get:function(){return this.media.muted}},{key:"ended",get:function(){return this.media.ended}},{key:"readyState",get:function(){return this.media.readyState}},{key:"currentTime",set:function(e){this.setCurrentTime(e)},get:function(){return this.getCurrentTime()}},{key:"duration",get:function(){return this.getDuration()}},{key:"volume",set:function(e){this.setVolume(e)},get:function(){return this.getVolume()}},{key:"src",set:function(e){this.setSrc(e)},get:function(){return this.getSrc()}}]),e}();n.default=r,o.default.DefaultPlayer=r},{3:3}],18:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=i(e(3)),r=i(e(7)),a=i(e(16));"undefined"!=typeof jQuery?r.default.$=o.default.jQuery=o.default.$=jQuery:"undefined"!=typeof Zepto?r.default.$=o.default.Zepto=o.default.$=Zepto:"undefined"!=typeof ender&&(r.default.$=o.default.ender=o.default.$=ender),function(e){void 0!==e&&(e.fn.mediaelementplayer=function(t){return!1===t?this.each(function(){var t=e(this).data("mediaelementplayer");t&&t.remove(),e(this).removeData("mediaelementplayer")}):this.each(function(){e(this).data("mediaelementplayer",new a.default(this,t))}),this},e(document).ready(function(){e("."+r.default.MepDefaults.classPrefix+"player").mediaelementplayer()}))}(r.default.$)},{16:16,3:3,7:7}],19:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=i(e(3)),a=i(e(7)),s=e(8),l=e(27),d=e(28),u=e(25),c=e(26),f={promise:null,load:function(e){return"undefined"!=typeof dashjs?f.promise=new Promise(function(e){e()}).then(function(){f._createPlayer(e)}):(e.options.path="string"==typeof e.options.path?e.options.path:"https://cdn.dashjs.org/latest/dash.all.min.js",f.promise=f.promise||(0,c.loadScript)(e.options.path),f.promise.then(function(){f._createPlayer(e)})),f.promise},_createPlayer:function(e){var t=dashjs.MediaPlayer().create();return r.default["__ready__"+e.id](t),t}},p={name:"native_dash",options:{prefix:"native_dash",dash:{path:"https://cdn.dashjs.org/latest/dash.all.min.js",debug:!1,drm:{},robustnessLevel:""}},canPlayType:function(e){return u.HAS_MSE&&["application/dash+xml"].indexOf(e.toLowerCase())>-1},create:function(e,t,n){var i=e.originalNode,d=e.id+"_"+t.prefix,u=i.autoplay,c=i.children,p=null,m=null;i.removeAttribute("type");for(var h=0,v=c.length;h<v;h++)c[h].removeAttribute("type");p=i.cloneNode(!0),t=Object.assign(t,e.options);for(var g=a.default.html5media.properties,y=a.default.html5media.events.concat(["click","mouseover","mouseout"]).filter(function(e){return"error"!==e}),E=function(t){var n=(0,l.createEvent)(t.type,e);e.dispatchEvent(n)},b=function(e){var n=""+e.substring(0,1).toUpperCase()+e.substring(1);p["get"+n]=function(){return null!==m?p[e]:null},p["set"+n]=function(n){if(-1===a.default.html5media.readOnlyProperties.indexOf(e))if("src"===e){var i="object"===(void 0===n?"undefined":o(n))&&n.src?n.src:n;if(p[e]=i,null!==m){m.reset();for(var r=0,s=y.length;r<s;r++)p.removeEventListener(y[r],E);m=f._createPlayer({options:t.dash,id:d}),n&&"object"===(void 0===n?"undefined":o(n))&&"object"===o(n.drm)&&(m.setProtectionData(n.drm),(0,l.isString)(t.dash.robustnessLevel)&&t.dash.robustnessLevel&&m.getProtectionController().setRobustnessLevel(t.dash.robustnessLevel)),m.attachSource(i),u&&m.play()}}else p[e]=n}},S=0,x=g.length;S<x;S++)b(g[S]);if(r.default["__ready__"+d]=function(n){e.dashPlayer=m=n;for(var i=dashjs.MediaPlayer.events,r=function(e){"loadedmetadata"===e&&(m.getDebug().setLogToBrowserConsole(t.dash.debug),m.initialize(),m.setScheduleWhilePaused(!1),m.setFastSwitchEnabled(!0),m.attachView(p),m.setAutoPlay(!1),"object"!==o(t.dash.drm)||a.default.Utils.isObjectEmpty(t.dash.drm)||(m.setProtectionData(t.dash.drm),(0,l.isString)(t.dash.robustnessLevel)&&t.dash.robustnessLevel&&m.getProtectionController().setRobustnessLevel(t.dash.robustnessLevel)),m.attachSource(p.getSrc())),p.addEventListener(e,E)},s=0,d=y.length;s<d;s++)r(y[s]);var u=function(t){if("error"===t.type.toLowerCase())e.generateError(t.message,p.src),console.error(t);else{var n=(0,l.createEvent)(t.type,e);n.data=t,e.dispatchEvent(n)}};for(var c in i)i.hasOwnProperty(c)&&m.on(i[c],function(e){return u(e)})},n&&n.length>0)for(var w=0,P=n.length;w<P;w++)if(s.renderer.renderers[t.prefix].canPlayType(n[w].type)){p.setAttribute("src",n[w].src),void 0!==n[w].drm&&(t.dash.drm=n[w].drm);break}p.setAttribute("id",d),i.parentNode.insertBefore(p,i),i.autoplay=!1,i.style.display="none",p.setSize=function(e,t){return p.style.width=e+"px",p.style.height=t+"px",p},p.hide=function(){return p.pause(),p.style.display="none",p},p.show=function(){return p.style.display="",p},p.destroy=function(){null!==m&&m.reset()};var T=(0,l.createEvent)("rendererready",p);return e.dispatchEvent(T),e.promises.push(f.load({options:t.dash,id:d})),p}};d.typeChecks.push(function(e){return~e.toLowerCase().indexOf(".mpd")?"application/dash+xml":null}),s.renderer.add(p)},{25:25,26:26,27:27,28:28,3:3,7:7,8:8}],20:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0}),n.PluginDetector=void 0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=i(e(3)),a=i(e(2)),s=i(e(7)),l=i(e(5)),d=e(8),u=e(27),c=e(25),f=e(28),p=n.PluginDetector={plugins:[],hasPluginVersion:function(e,t){var n=p.plugins[e];return t[1]=t[1]||0,t[2]=t[2]||0,n[0]>t[0]||n[0]===t[0]&&n[1]>t[1]||n[0]===t[0]&&n[1]===t[1]&&n[2]>=t[2]},addPlugin:function(e,t,n,i,o){p.plugins[e]=p.detectPlugin(t,n,i,o)},detectPlugin:function(e,t,n,i){var a=[0,0,0],s=void 0,l=void 0;if(null!==c.NAV.plugins&&void 0!==c.NAV.plugins&&"object"===o(c.NAV.plugins[e])){if((s=c.NAV.plugins[e].description)&&(void 0===c.NAV.mimeTypes||!c.NAV.mimeTypes[t]||c.NAV.mimeTypes[t].enabledPlugin))for(var d=0,u=(a=s.replace(e,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".")).length;d<u;d++)a[d]=parseInt(a[d].match(/\d+/),10)}else if(void 0!==r.default.ActiveXObject)try{(l=new ActiveXObject(n))&&(a=i(l))}catch(e){}return a}};p.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(e){var t=[],n=e.GetVariable("$version");return n&&(n=n.split(" ")[1].split(","),t=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]),t});var m=function(e,t,n){var i={},o=!1;i.options=t,i.id=e.id+"_"+i.options.prefix,i.mediaElement=e,i.flashState={},i.flashApi=null,i.flashApiStack=[];for(var p=s.default.html5media.properties,m=function(e){i.flashState[e]=null;var t=""+e.substring(0,1).toUpperCase()+e.substring(1);i["get"+t]=function(){if(null!==i.flashApi){if("function"==typeof i.flashApi["get_"+e]){var t=i.flashApi["get_"+e]();return"buffered"===e?{start:function(){return 0},end:function(){return t},length:1}:t}return null}return null},i["set"+t]=function(t){if("src"===e&&(t=(0,f.absolutizeUrl)(t)),null!==i.flashApi&&void 0!==i.flashApi["set_"+e])try{i.flashApi["set_"+e](t)}catch(e){}else i.flashApiStack.push({type:"set",propName:e,value:t})}},h=0,v=p.length;h<v;h++)m(p[h]);var g=s.default.html5media.methods,y=function(e){i[e]=function(){if(o)if(null!==i.flashApi){if(i.flashApi["fire_"+e])try{i.flashApi["fire_"+e]()}catch(e){}}else i.flashApiStack.push({type:"call",methodName:e})}};g.push("stop");for(var E=0,b=g.length;E<b;E++)y(g[E]);for(var S=["rendererready"],x=0,w=S.length;x<w;x++){var P=(0,u.createEvent)(S[x],i);e.dispatchEvent(P)}r.default["__ready__"+i.id]=function(){if(i.flashReady=!0,i.flashApi=a.default.getElementById("__"+i.id),i.flashApiStack.length)for(var e=0,t=i.flashApiStack.length;e<t;e++){var n=i.flashApiStack[e];if("set"===n.type){var o=n.propName,r=""+o.substring(0,1).toUpperCase()+o.substring(1);i["set"+r](n.value)}else"call"===n.type&&i[n.methodName]()}},r.default["__event__"+i.id]=function(e,t){var n=(0,u.createEvent)(e,i);if(t)try{n.data=JSON.parse(t),n.details.data=JSON.parse(t)}catch(e){n.message=t}i.mediaElement.dispatchEvent(n)},i.flashWrapper=a.default.createElement("div"),-1===["always","sameDomain"].indexOf(i.options.shimScriptAccess)&&(i.options.shimScriptAccess="sameDomain");var T=e.originalNode.autoplay,C=["uid="+i.id,"autoplay="+T,"allowScriptAccess="+i.options.shimScriptAccess,"preload="+(e.originalNode.getAttribute("preload")||"")],k=null!==e.originalNode&&"video"===e.originalNode.tagName.toLowerCase(),_=k?e.originalNode.height:1,N=k?e.originalNode.width:1;e.originalNode.getAttribute("src")&&C.push("src="+e.originalNode.getAttribute("src")),!0===i.options.enablePseudoStreaming&&(C.push("pseudostreamstart="+i.options.pseudoStreamingStartQueryParam),C.push("pseudostreamtype="+i.options.pseudoStreamingType)),i.options.streamDelimiter&&C.push("streamdelimiter="+encodeURIComponent(i.options.streamDelimiter)),i.options.proxyType&&C.push("proxytype="+i.options.proxyType),e.appendChild(i.flashWrapper),e.originalNode.style.display="none";var A=[];if(c.IS_IE||c.IS_EDGE){var L=a.default.createElement("div");i.flashWrapper.appendChild(L),A=c.IS_EDGE?['type="application/x-shockwave-flash"','data="'+i.options.pluginPath+i.options.filename+'"','id="__'+i.id+'"','width="'+N+'"','height="'+_+"'\""]:['classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"','codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"','id="__'+i.id+'"','width="'+N+'"','height="'+_+'"'],k||A.push('style="clip: rect(0 0 0 0); position: absolute;"'),L.outerHTML="<object "+A.join(" ")+'><param name="movie" value="'+i.options.pluginPath+i.options.filename+"?x="+new Date+'" /><param name="flashvars" value="'+C.join("&")+'" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="'+i.options.shimScriptAccess+'" /><param name="allowFullScreen" value="true" /><div>'+l.default.t("mejs.install-flash")+"</div></object>"}else A=['id="__'+i.id+'"','name="__'+i.id+'"','play="true"','loop="false"','quality="high"','bgcolor="#000000"','wmode="transparent"','allowScriptAccess="'+i.options.shimScriptAccess+'"','allowFullScreen="true"','type="application/x-shockwave-flash"','pluginspage="//www.macromedia.com/go/getflashplayer"','src="'+i.options.pluginPath+i.options.filename+'"','flashvars="'+C.join("&")+'"'],k?(A.push('width="'+N+'"'),A.push('height="'+_+'"')):A.push('style="position: fixed; left: -9999em; top: -9999em;"'),i.flashWrapper.innerHTML="<embed "+A.join(" ")+">";if(i.flashNode=i.flashWrapper.lastChild,i.hide=function(){o=!1,k&&(i.flashNode.style.display="none")},i.show=function(){o=!0,k&&(i.flashNode.style.display="")},i.setSize=function(e,t){i.flashNode.style.width=e+"px",i.flashNode.style.height=t+"px",null!==i.flashApi&&"function"==typeof i.flashApi.fire_setSize&&i.flashApi.fire_setSize(e,t)},i.destroy=function(){i.flashNode.remove()},n&&n.length>0)for(var F=0,j=n.length;F<j;F++)if(d.renderer.renderers[t.prefix].canPlayType(n[F].type)){i.setSrc(n[F].src);break}return i};if(p.hasPluginVersion("flash",[10,0,0])){f.typeChecks.push(function(e){return(e=e.toLowerCase()).startsWith("rtmp")?~e.indexOf(".mp3")?"audio/rtmp":"video/rtmp":/\.og(a|g)/i.test(e)?"audio/ogg":~e.indexOf(".m3u8")?"application/x-mpegURL":~e.indexOf(".mpd")?"application/dash+xml":~e.indexOf(".flv")?"video/flv":null});var h={name:"flash_video",options:{prefix:"flash_video",filename:"mediaelement-flash-video.swf",enablePseudoStreaming:!1,pseudoStreamingStartQueryParam:"start",pseudoStreamingType:"byte",proxyType:"",streamDelimiter:""},canPlayType:function(e){return~["video/mp4","video/rtmp","audio/rtmp","rtmp/mp4","audio/mp4","video/flv","video/x-flv"].indexOf(e.toLowerCase())},create:m};d.renderer.add(h);var v={name:"flash_hls",options:{prefix:"flash_hls",filename:"mediaelement-flash-video-hls.swf"},canPlayType:function(e){return~["application/x-mpegurl","application/vnd.apple.mpegurl","audio/mpegurl","audio/hls","video/hls"].indexOf(e.toLowerCase())},create:m};d.renderer.add(v);var g={name:"flash_dash",options:{prefix:"flash_dash",filename:"mediaelement-flash-video-mdash.swf"},canPlayType:function(e){return~["application/dash+xml"].indexOf(e.toLowerCase())},create:m};d.renderer.add(g);var y={name:"flash_audio",options:{prefix:"flash_audio",filename:"mediaelement-flash-audio.swf"},canPlayType:function(e){return~["audio/mp3"].indexOf(e.toLowerCase())},create:m};d.renderer.add(y);var E={name:"flash_audio_ogg",options:{prefix:"flash_audio_ogg",filename:"mediaelement-flash-audio-ogg.swf"},canPlayType:function(e){return~["audio/ogg","audio/oga","audio/ogv"].indexOf(e.toLowerCase())},create:m};d.renderer.add(E)}},{2:2,25:25,27:27,28:28,3:3,5:5,7:7,8:8}],21:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=i(e(3)),a=i(e(7)),s=e(8),l=e(27),d=e(25),u=e(28),c=e(26),f={promise:null,load:function(e){return"undefined"!=typeof flvjs?f.promise=new Promise(function(e){e()}).then(function(){f._createPlayer(e)}):(e.options.path="string"==typeof e.options.path?e.options.path:"https://cdn.jsdelivr.net/npm/flv.js@latest",f.promise=f.promise||(0,c.loadScript)(e.options.path),f.promise.then(function(){f._createPlayer(e)})),f.promise},_createPlayer:function(e){flvjs.LoggingControl.enableDebug=e.options.debug,flvjs.LoggingControl.enableVerbose=e.options.debug;var t=flvjs.createPlayer(e.options,e.configs);return r.default["__ready__"+e.id](t),t}},p={name:"native_flv",options:{prefix:"native_flv",flv:{path:"https://cdn.jsdelivr.net/npm/flv.js@latest",cors:!0,debug:!1}},canPlayType:function(e){return d.HAS_MSE&&["video/x-flv","video/flv"].indexOf(e.toLowerCase())>-1},create:function(e,t,n){var i=e.originalNode,d=e.id+"_"+t.prefix,u=null,c=null;u=i.cloneNode(!0),t=Object.assign(t,e.options);for(var p=a.default.html5media.properties,m=a.default.html5media.events.concat(["click","mouseover","mouseout"]).filter(function(e){return"error"!==e}),h=function(t){var n=(0,l.createEvent)(t.type,e);e.dispatchEvent(n)},v=function(e){var n=""+e.substring(0,1).toUpperCase()+e.substring(1);u["get"+n]=function(){return null!==c?u[e]:null},u["set"+n]=function(n){if(-1===a.default.html5media.readOnlyProperties.indexOf(e))if("src"===e){if(u[e]="object"===(void 0===n?"undefined":o(n))&&n.src?n.src:n,null!==c){var i={};i.type="flv",i.url=n,i.cors=t.flv.cors,i.debug=t.flv.debug,i.path=t.flv.path;var r=t.flv.configs;c.destroy();for(var s=0,l=m.length;s<l;s++)u.removeEventListener(m[s],h);(c=f._createPlayer({options:i,configs:r,id:d})).attachMediaElement(u),c.load()}}else u[e]=n}},g=0,y=p.length;g<y;g++)v(p[g]);if(r.default["__ready__"+d]=function(t){e.flvPlayer=c=t;for(var n=flvjs.Events,i=function(e){"loadedmetadata"===e&&(c.unload(),c.detachMediaElement(),c.attachMediaElement(u),c.load()),u.addEventListener(e,h)},o=0,r=m.length;o<r;o++)i(m[o]);var a=function(t){n.hasOwnProperty(t)&&c.on(n[t],function(){for(var i=arguments.length,o=Array(i),r=0;r<i;r++)o[r]=arguments[r];return function(t,n){if("error"===t){var i=n[0]+": "+n[1]+" "+n[2].msg;e.generateError(i,u.src)}else{var o=(0,l.createEvent)(t,e);o.data=n,e.dispatchEvent(o)}}(n[t],o)})};for(var s in n)a(s)},n&&n.length>0)for(var E=0,b=n.length;E<b;E++)if(s.renderer.renderers[t.prefix].canPlayType(n[E].type)){u.setAttribute("src",n[E].src);break}u.setAttribute("id",d),i.parentNode.insertBefore(u,i),i.autoplay=!1,i.style.display="none";var S={};S.type="flv",S.url=u.src,S.cors=t.flv.cors,S.debug=t.flv.debug,S.path=t.flv.path;var x=t.flv.configs;u.setSize=function(e,t){return u.style.width=e+"px",u.style.height=t+"px",u},u.hide=function(){return null!==c&&c.pause(),u.style.display="none",u},u.show=function(){return u.style.display="",u},u.destroy=function(){null!==c&&c.destroy()};var w=(0,l.createEvent)("rendererready",u);return e.dispatchEvent(w),e.promises.push(f.load({options:S,configs:x,id:d})),u}};u.typeChecks.push(function(e){return~e.toLowerCase().indexOf(".flv")?"video/flv":null}),s.renderer.add(p)},{25:25,26:26,27:27,28:28,3:3,7:7,8:8}],22:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=i(e(3)),a=i(e(7)),s=e(8),l=e(27),d=e(25),u=e(28),c=e(26),f={promise:null,load:function(e){return"undefined"!=typeof Hls?f.promise=new Promise(function(e){e()}).then(function(){f._createPlayer(e)}):(e.options.path="string"==typeof e.options.path?e.options.path:"https://cdn.jsdelivr.net/npm/hls.js@latest",f.promise=f.promise||(0,c.loadScript)(e.options.path),f.promise.then(function(){f._createPlayer(e)})),f.promise},_createPlayer:function(e){var t=new Hls(e.options);return r.default["__ready__"+e.id](t),t}},p={name:"native_hls",options:{prefix:"native_hls",hls:{path:"https://cdn.jsdelivr.net/npm/hls.js@latest",autoStartLoad:!1,debug:!1}},canPlayType:function(e){return d.HAS_MSE&&["application/x-mpegurl","application/vnd.apple.mpegurl","audio/mpegurl","audio/hls","video/hls"].indexOf(e.toLowerCase())>-1},create:function(e,t,n){var i=e.originalNode,d=e.id+"_"+t.prefix,u=i.getAttribute("preload"),c=i.autoplay,p=null,m=null,h=0,v=n.length;m=i.cloneNode(!0),(t=Object.assign(t,e.options)).hls.autoStartLoad=u&&"none"!==u||c;for(var g=a.default.html5media.properties,y=a.default.html5media.events.concat(["click","mouseover","mouseout"]).filter(function(e){return"error"!==e}),E=function(t){var n=(0,l.createEvent)(t.type,e);e.dispatchEvent(n)},b=function(e){var n=""+e.substring(0,1).toUpperCase()+e.substring(1);m["get"+n]=function(){return null!==p?m[e]:null},m["set"+n]=function(n){if(-1===a.default.html5media.readOnlyProperties.indexOf(e))if("src"===e){if(m[e]="object"===(void 0===n?"undefined":o(n))&&n.src?n.src:n,null!==p){p.destroy();for(var i=0,r=y.length;i<r;i++)m.removeEventListener(y[i],E);(p=f._createPlayer({options:t.hls,id:d})).loadSource(n),p.attachMedia(m)}}else m[e]=n}},S=0,x=g.length;S<x;S++)b(g[S]);if(r.default["__ready__"+d]=function(t){e.hlsPlayer=p=t;for(var i=Hls.Events,o=function(t){if("loadedmetadata"===t){var n=e.originalNode.src;p.detachMedia(),p.loadSource(n),p.attachMedia(m)}m.addEventListener(t,E)},r=0,a=y.length;r<a;r++)o(y[r]);var s=void 0,d=void 0,u=function(t){i.hasOwnProperty(t)&&p.on(i[t],function(){for(var o=arguments.length,r=Array(o),a=0;a<o;a++)r[a]=arguments[a];return function(t,i){if("hlsError"===t){if(console.warn(i),(i=i[1]).fatal)switch(i.type){case"mediaError":var o=(new Date).getTime();if(!s||o-s>3e3)s=(new Date).getTime(),p.recoverMediaError();else if(!d||o-d>3e3)d=(new Date).getTime(),console.warn("Attempting to swap Audio Codec and recover from media error"),p.swapAudioCodec(),p.recoverMediaError();else{var r="Cannot recover, last media error recovery failed";e.generateError(r,m.src),console.error(r)}break;case"networkError":"manifestLoadError"===i.details&&h<v&&void 0!==n[h+1]?(m.setSrc(n[h++].src),m.load(),m.play()):(e.generateError("Network error",n),console.error("Network error"));break;default:p.destroy()}}else{var a=(0,l.createEvent)(t,e);a.data=i,e.dispatchEvent(a)}}(i[t],r)})};for(var c in i)u(c)},v>0)for(;h<v;h++)if(s.renderer.renderers[t.prefix].canPlayType(n[h].type)){m.setAttribute("src",n[h].src);break}"auto"===u||c||(m.addEventListener("play",function(){null!==p&&p.startLoad()}),m.addEventListener("pause",function(){null!==p&&p.stopLoad()})),m.setAttribute("id",d),i.parentNode.insertBefore(m,i),i.autoplay=!1,i.style.display="none",m.setSize=function(e,t){return m.style.width=e+"px",m.style.height=t+"px",m},m.hide=function(){return m.pause(),m.style.display="none",m},m.show=function(){return m.style.display="",m},m.destroy=function(){null!==p&&(p.stopLoad(),p.destroy())};var w=(0,l.createEvent)("rendererready",m);return e.dispatchEvent(w),e.promises.push(f.load({options:t.hls,id:d})),m}};u.typeChecks.push(function(e){return~e.toLowerCase().indexOf(".m3u8")?"application/x-mpegURL":null}),s.renderer.add(p)},{25:25,26:26,27:27,28:28,3:3,7:7,8:8}],23:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=i(e(3)),r=i(e(2)),a=i(e(7)),s=e(8),l=e(27),d=e(25),u={name:"html5",options:{prefix:"html5"},canPlayType:function(e){var t=r.default.createElement("video");return d.IS_ANDROID&&/\/mp(3|4)$/i.test(e)||~["application/x-mpegurl","vnd.apple.mpegurl","audio/mpegurl","audio/hls","video/hls"].indexOf(e.toLowerCase())&&d.SUPPORTS_NATIVE_HLS?"yes":t.canPlayType?t.canPlayType(e.toLowerCase()).replace(/no/,""):""},create:function(e,t,n){var i=e.id+"_"+t.prefix,o=!1,d=null;void 0===e.originalNode||null===e.originalNode?(d=r.default.createElement("audio"),e.appendChild(d)):d=e.originalNode,d.setAttribute("id",i);for(var u=a.default.html5media.properties,c=function(e){var t=""+e.substring(0,1).toUpperCase()+e.substring(1);d["get"+t]=function(){return d[e]},d["set"+t]=function(t){-1===a.default.html5media.readOnlyProperties.indexOf(e)&&(d[e]=t)}},f=0,p=u.length;f<p;f++)c(u[f]);for(var m=a.default.html5media.events.concat(["click","mouseover","mouseout"]).filter(function(e){return"error"!==e}),h=function(t){d.addEventListener(t,function(t){if(o){var n=(0,l.createEvent)(t.type,t.target);e.dispatchEvent(n)}})},v=0,g=m.length;v<g;v++)h(m[v]);d.setSize=function(e,t){return d.style.width=e+"px",d.style.height=t+"px",d},d.hide=function(){return o=!1,d.style.display="none",d},d.show=function(){return o=!0,d.style.display="",d};var y=0,E=n.length;if(E>0)for(;y<E;y++)if(s.renderer.renderers[t.prefix].canPlayType(n[y].type)){d.setAttribute("src",n[y].src);break}d.addEventListener("error",function(t){4===t.target.error.code&&o&&(y<E&&void 0!==n[y+1]?(d.src=n[y++].src,d.load(),d.play()):e.generateError("Media error: Format(s) not supported or source(s) not found",n))});var b=(0,l.createEvent)("rendererready",d);return e.dispatchEvent(b),d}};o.default.HtmlMediaElement=a.default.HtmlMediaElement=u,s.renderer.add(u)},{2:2,25:25,27:27,3:3,7:7,8:8}],24:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=i(e(3)),r=i(e(2)),a=i(e(7)),s=e(8),l=e(27),d=e(28),u=e(26),c={isIframeStarted:!1,isIframeLoaded:!1,iframeQueue:[],enqueueIframe:function(e){c.isLoaded="undefined"!=typeof YT&&YT.loaded,c.isLoaded?c.createIframe(e):(c.loadIframeApi(),c.iframeQueue.push(e))},loadIframeApi:function(){c.isIframeStarted||((0,u.loadScript)("https://www.youtube.com/player_api"),c.isIframeStarted=!0)},iFrameReady:function(){for(c.isLoaded=!0,c.isIframeLoaded=!0;c.iframeQueue.length>0;){var e=c.iframeQueue.pop();c.createIframe(e)}},createIframe:function(e){return new YT.Player(e.containerId,e)},getYouTubeId:function(e){var t="";e.indexOf("?")>0?""===(t=c.getYouTubeIdFromParam(e))&&(t=c.getYouTubeIdFromUrl(e)):t=c.getYouTubeIdFromUrl(e);return(t=t.substring(t.lastIndexOf("/")+1).split("?"))[0]},getYouTubeIdFromParam:function(e){if(void 0===e||null===e||!e.trim().length)return null;for(var t=e.split("?")[1].split("&"),n="",i=0,o=t.length;i<o;i++){var r=t[i].split("=");if("v"===r[0]){n=r[1];break}}return n},getYouTubeIdFromUrl:function(e){if(void 0===e||null===e||!e.trim().length)return null;return(e=e.split("?")[0]).substring(e.lastIndexOf("/")+1)},getYouTubeNoCookieUrl:function(e){if(void 0===e||null===e||!e.trim().length||-1===e.indexOf("//www.youtube"))return e;var t=e.split("/");return t[2]=t[2].replace(".com","-nocookie.com"),t.join("/")}},f={name:"youtube_iframe",options:{prefix:"youtube_iframe",youtube:{autoplay:0,controls:0,disablekb:1,end:0,loop:0,modestbranding:0,playsinline:0,rel:0,showinfo:0,start:0,iv_load_policy:3,nocookie:!1,imageQuality:null}},canPlayType:function(e){return~["video/youtube","video/x-youtube"].indexOf(e.toLowerCase())},create:function(e,t,n){var i={},s=[],d=null,u=!0,f=!1,p=null;i.options=t,i.id=e.id+"_"+t.prefix,i.mediaElement=e;for(var m=a.default.html5media.properties,h=function(t){var n=""+t.substring(0,1).toUpperCase()+t.substring(1);i["get"+n]=function(){if(null!==d){switch(t){case"currentTime":return d.getCurrentTime();case"duration":return d.getDuration();case"volume":return d.getVolume()/100;case"paused":return u;case"ended":return f;case"muted":return d.isMuted();case"buffered":var e=d.getVideoLoadedFraction(),n=d.getDuration();return{start:function(){return 0},end:function(){return e*n},length:1};case"src":return d.getVideoUrl();case"readyState":return 4}return null}return null},i["set"+n]=function(n){if(null!==d)switch(t){case"src":var o="string"==typeof n?n:n[0].src,r=c.getYouTubeId(o);e.originalNode.autoplay?d.loadVideoById(r):d.cueVideoById(r);break;case"currentTime":d.seekTo(n);break;case"muted":n?d.mute():d.unMute(),setTimeout(function(){var t=(0,l.createEvent)("volumechange",i);e.dispatchEvent(t)},50);break;case"volume":n,d.setVolume(100*n),setTimeout(function(){var t=(0,l.createEvent)("volumechange",i);e.dispatchEvent(t)},50);break;case"readyState":var a=(0,l.createEvent)("canplay",i);e.dispatchEvent(a)}else s.push({type:"set",propName:t,value:n})}},v=0,g=m.length;v<g;v++)h(m[v]);for(var y=a.default.html5media.methods,E=function(e){i[e]=function(){if(null!==d)switch(e){case"play":return u=!1,d.playVideo();case"pause":return u=!0,d.pauseVideo();case"load":return null}else s.push({type:"call",methodName:e})}},b=0,S=y.length;b<S;b++)E(y[b]);var x=r.default.createElement("div");x.id=i.id,i.options.youtube.nocookie&&(e.originalNode.src=c.getYouTubeNoCookieUrl(n[0].src)),e.originalNode.parentNode.insertBefore(x,e.originalNode),e.originalNode.style.display="none";var w="audio"===e.originalNode.tagName.toLowerCase(),P=w?"1":e.originalNode.height,T=w?"1":e.originalNode.width,C=c.getYouTubeId(n[0].src),k={id:i.id,containerId:x.id,videoId:C,height:P,width:T,playerVars:Object.assign({controls:0,rel:0,disablekb:1,showinfo:0,modestbranding:0,html5:1,iv_load_policy:3},i.options.youtube),origin:o.default.location.host,events:{onReady:function(t){if(e.youTubeApi=d=t.target,e.youTubeState={paused:!0,ended:!1},s.length)for(var n=0,o=s.length;n<o;n++){var r=s[n];if("set"===r.type){var a=r.propName,u=""+a.substring(0,1).toUpperCase()+a.substring(1);i["set"+u](r.value)}else"call"===r.type&&i[r.methodName]()}p=d.getIframe(),e.originalNode.muted&&d.mute();for(var c=["mouseover","mouseout"],f=function(t){var n=(0,l.createEvent)(t.type,i);e.dispatchEvent(n)},m=0,h=c.length;m<h;m++)p.addEventListener(c[m],f,!1);for(var v=["rendererready","loadedmetadata","loadeddata","canplay"],g=0,y=v.length;g<y;g++){var E=(0,l.createEvent)(v[g],i);e.dispatchEvent(E)}},onStateChange:function(t){var n=[];switch(t.data){case-1:n=["loadedmetadata"],u=!0,f=!1;break;case 0:n=["ended"],u=!1,f=!i.options.youtube.loop,i.options.youtube.loop||i.stopInterval();break;case 1:n=["play","playing"],u=!1,f=!1,i.startInterval();break;case 2:n=["pause"],u=!0,f=!1,i.stopInterval();break;case 3:n=["progress"],f=!1;break;case 5:n=["loadeddata","loadedmetadata","canplay"],u=!0,f=!1}for(var o=0,r=n.length;o<r;o++){var a=(0,l.createEvent)(n[o],i);e.dispatchEvent(a)}},onError:function(t){return function(t){var i="";switch(t.data){case 2:i="The request contains an invalid parameter value. Verify that video ID has 11 characters and that contains no invalid characters, such as exclamation points or asterisks.";break;case 5:i="The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.";break;case 100:i="The video requested was not found. Either video has been removed or has been marked as private.";break;case 101:case 105:i="The owner of the requested video does not allow it to be played in embedded players.";break;default:i="Unknown error."}e.generateError("Code "+t.data+": "+i,n)}(t)}}};return(w||e.originalNode.hasAttribute("playsinline"))&&(k.playerVars.playsinline=1),e.originalNode.controls&&(k.playerVars.controls=1),e.originalNode.autoplay&&(k.playerVars.autoplay=1),e.originalNode.loop&&(k.playerVars.loop=1),(k.playerVars.loop&&1===parseInt(k.playerVars.loop,10)||e.originalNode.src.indexOf("loop=")>-1)&&!k.playerVars.playlist&&-1===e.originalNode.src.indexOf("playlist=")&&(k.playerVars.playlist=c.getYouTubeId(e.originalNode.src)),c.enqueueIframe(k),i.onEvent=function(t,n,i){null!==i&&void 0!==i&&(e.youTubeState=i)},i.setSize=function(e,t){null!==d&&d.setSize(e,t)},i.hide=function(){i.stopInterval(),i.pause(),p&&(p.style.display="none")},i.show=function(){p&&(p.style.display="")},i.destroy=function(){d.destroy()},i.interval=null,i.startInterval=function(){i.interval=setInterval(function(){var t=(0,l.createEvent)("timeupdate",i);e.dispatchEvent(t)},250)},i.stopInterval=function(){i.interval&&clearInterval(i.interval)},i.getPosterUrl=function(){var n=t.youtube.imageQuality,i=c.getYouTubeId(e.originalNode.src);return n&&["default","hqdefault","mqdefault","sddefault","maxresdefault"].indexOf(n)>-1&&i?"https://img.youtube.com/vi/"+i+"/"+n+".jpg":""},i}};o.default.onYouTubePlayerAPIReady=function(){c.iFrameReady()},d.typeChecks.push(function(e){return/\/\/(www\.youtube|youtu\.?be)/i.test(e)?"video/x-youtube":null}),s.renderer.add(f)},{2:2,26:26,27:27,28:28,3:3,7:7,8:8}],25:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0}),n.cancelFullScreen=n.requestFullScreen=n.isFullScreen=n.FULLSCREEN_EVENT_NAME=n.HAS_NATIVE_FULLSCREEN_ENABLED=n.HAS_TRUE_NATIVE_FULLSCREEN=n.HAS_IOS_FULLSCREEN=n.HAS_MS_NATIVE_FULLSCREEN=n.HAS_MOZ_NATIVE_FULLSCREEN=n.HAS_WEBKIT_NATIVE_FULLSCREEN=n.HAS_NATIVE_FULLSCREEN=n.SUPPORTS_NATIVE_HLS=n.SUPPORT_PASSIVE_EVENT=n.SUPPORT_POINTER_EVENTS=n.HAS_MSE=n.IS_STOCK_ANDROID=n.IS_SAFARI=n.IS_FIREFOX=n.IS_CHROME=n.IS_EDGE=n.IS_IE=n.IS_ANDROID=n.IS_IOS=n.IS_IPOD=n.IS_IPHONE=n.IS_IPAD=n.UA=n.NAV=void 0;for(var o=i(e(3)),r=i(e(2)),a=i(e(7)),s=n.NAV=o.default.navigator,l=n.UA=s.userAgent.toLowerCase(),d=n.IS_IPAD=/ipad/i.test(l)&&!o.default.MSStream,u=n.IS_IPHONE=/iphone/i.test(l)&&!o.default.MSStream,c=n.IS_IPOD=/ipod/i.test(l)&&!o.default.MSStream,f=(n.IS_IOS=/ipad|iphone|ipod/i.test(l)&&!o.default.MSStream,n.IS_ANDROID=/android/i.test(l)),p=n.IS_IE=/(trident|microsoft)/i.test(s.appName),m=(n.IS_EDGE="msLaunchUri"in s&&!("documentMode"in r.default)),h=n.IS_CHROME=/chrome/i.test(l),v=n.IS_FIREFOX=/firefox/i.test(l),g=n.IS_SAFARI=/safari/i.test(l)&&!h,y=n.IS_STOCK_ANDROID=/^mozilla\/\d+\.\d+\s\(linux;\su;/i.test(l),E=(n.HAS_MSE="MediaSource"in o.default),b=n.SUPPORT_POINTER_EVENTS=function(){var e=r.default.createElement("x"),t=r.default.documentElement,n=o.default.getComputedStyle;if(!("pointerEvents"in e.style))return!1;e.style.pointerEvents="auto",e.style.pointerEvents="x",t.appendChild(e);var i=n&&"auto"===n(e,"").pointerEvents;return e.remove(),!!i}(),S=n.SUPPORT_PASSIVE_EVENT=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});o.default.addEventListener("test",null,t)}catch(e){}return e}(),x=["source","track","audio","video"],w=void 0,P=0,T=x.length;P<T;P++)w=r.default.createElement(x[P]);var C=n.SUPPORTS_NATIVE_HLS=g||f&&(h||y)||p&&/edge/i.test(l),k=void 0!==w.webkitEnterFullscreen,_=void 0!==w.requestFullscreen;k&&/mac os x 10_5/i.test(l)&&(_=!1,k=!1);var N=void 0!==w.webkitRequestFullScreen,A=void 0!==w.mozRequestFullScreen,L=void 0!==w.msRequestFullscreen,F=N||A||L,j=F,I="",M=void 0,O=void 0,D=void 0;A?j=r.default.mozFullScreenEnabled:L&&(j=r.default.msFullscreenEnabled),h&&(k=!1),F&&(N?I="webkitfullscreenchange":A?I="mozfullscreenchange":L&&(I="MSFullscreenChange"),n.isFullScreen=M=function(){return A?r.default.mozFullScreen:N?r.default.webkitIsFullScreen:L?null!==r.default.msFullscreenElement:void 0},n.requestFullScreen=O=function(e){N?e.webkitRequestFullScreen():A?e.mozRequestFullScreen():L&&e.msRequestFullscreen()},n.cancelFullScreen=D=function(){N?r.default.webkitCancelFullScreen():A?r.default.mozCancelFullScreen():L&&r.default.msExitFullscreen()});var V=n.HAS_NATIVE_FULLSCREEN=_,R=n.HAS_WEBKIT_NATIVE_FULLSCREEN=N,H=n.HAS_MOZ_NATIVE_FULLSCREEN=A,U=n.HAS_MS_NATIVE_FULLSCREEN=L,q=n.HAS_IOS_FULLSCREEN=k,B=n.HAS_TRUE_NATIVE_FULLSCREEN=F,z=n.HAS_NATIVE_FULLSCREEN_ENABLED=j,W=n.FULLSCREEN_EVENT_NAME=I;n.isFullScreen=M,n.requestFullScreen=O,n.cancelFullScreen=D,a.default.Features=a.default.Features||{},a.default.Features.isiPad=d,a.default.Features.isiPod=c,a.default.Features.isiPhone=u,a.default.Features.isiOS=a.default.Features.isiPhone||a.default.Features.isiPad,a.default.Features.isAndroid=f,a.default.Features.isIE=p,a.default.Features.isEdge=m,a.default.Features.isChrome=h,a.default.Features.isFirefox=v,a.default.Features.isSafari=g,a.default.Features.isStockAndroid=y,a.default.Features.hasMSE=E,a.default.Features.supportsNativeHLS=C,a.default.Features.supportsPointerEvents=b,a.default.Features.supportsPassiveEvent=S,a.default.Features.hasiOSFullScreen=q,a.default.Features.hasNativeFullscreen=V,a.default.Features.hasWebkitNativeFullScreen=R,a.default.Features.hasMozNativeFullScreen=H,a.default.Features.hasMsNativeFullScreen=U,a.default.Features.hasTrueNativeFullScreen=B,a.default.Features.nativeFullScreenEnabled=z,a.default.Features.fullScreenEventName=W,a.default.Features.isFullScreen=M,a.default.Features.requestFullScreen=O,a.default.Features.cancelFullScreen=D},{2:2,3:3,7:7}],26:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e){return new Promise(function(t,n){var i=p.default.createElement("script");i.src=e,i.async=!0,i.onload=function(){i.remove(),t()},i.onerror=function(){i.remove(),n()},p.default.head.appendChild(i)})}function r(e){var t=e.getBoundingClientRect(),n=f.default.pageXOffset||p.default.documentElement.scrollLeft,i=f.default.pageYOffset||p.default.documentElement.scrollTop;return{top:t.top+i,left:t.left+n}}function a(e,t){y(e,t)?b(e,t):E(e,t)}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:400,n=arguments[2];e.style.opacity||(e.style.opacity=1);var i=null;f.default.requestAnimationFrame(function o(r){var a=r-(i=i||r),s=parseFloat(1-a/t,2);e.style.opacity=s<0?0:s,a>t?n&&"function"==typeof n&&n():f.default.requestAnimationFrame(o)})}function l(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:400,n=arguments[2];e.style.opacity||(e.style.opacity=0);var i=null;f.default.requestAnimationFrame(function o(r){var a=r-(i=i||r),s=parseFloat(a/t,2);e.style.opacity=s>1?1:s,a>t?n&&"function"==typeof n&&n():f.default.requestAnimationFrame(o)})}function d(e,t){var n=[];e=e.parentNode.firstChild;do{t&&!t(e)||n.push(e)}while(e=e.nextSibling);return n}function u(e){return void 0!==e.getClientRects&&"function"===e.getClientRects?!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length):!(!e.offsetWidth&&!e.offsetHeight)}function c(e,t,n,i){var o=f.default.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),r="application/x-www-form-urlencoded; charset=UTF-8",a=!1,s="*/".concat("*");switch(t){case"text":r="text/plain";break;case"json":r="application/json, text/javascript";break;case"html":r="text/html";break;case"xml":r="application/xml, text/xml"}"application/x-www-form-urlencoded"!==r&&(s=r+", */*; q=0.01"),o&&(o.open("GET",e,!0),o.setRequestHeader("Accept",s),o.onreadystatechange=function(){if(!a&&4===o.readyState)if(200===o.status){a=!0;var e=void 0;switch(t){case"json":e=JSON.parse(o.responseText);break;case"xml":e=o.responseXML;break;default:e=o.responseText}n(e)}else"function"==typeof i&&i(o.status)},o.send())}Object.defineProperty(n,"__esModule",{value:!0}),n.removeClass=n.addClass=n.hasClass=void 0,n.loadScript=o,n.offset=r,n.toggleClass=a,n.fadeOut=s,n.fadeIn=l,n.siblings=d,n.visible=u,n.ajax=c;var f=i(e(3)),p=i(e(2)),m=i(e(7)),h=void 0,v=void 0,g=void 0;"classList"in p.default.documentElement?(h=function(e,t){return void 0!==e.classList&&e.classList.contains(t)},v=function(e,t){return e.classList.add(t)},g=function(e,t){return e.classList.remove(t)}):(h=function(e,t){return new RegExp("\\b"+t+"\\b").test(e.className)},v=function(e,t){y(e,t)||(e.className+=" "+t)},g=function(e,t){e.className=e.className.replace(new RegExp("\\b"+t+"\\b","g"),"")});var y=n.hasClass=h,E=n.addClass=v,b=n.removeClass=g;m.default.Utils=m.default.Utils||{},m.default.Utils.offset=r,m.default.Utils.hasClass=y,m.default.Utils.addClass=E,m.default.Utils.removeClass=b,m.default.Utils.toggleClass=a,m.default.Utils.fadeIn=l,m.default.Utils.fadeOut=s,m.default.Utils.siblings=d,m.default.Utils.visible=u,m.default.Utils.ajax=c,m.default.Utils.loadScript=o},{2:2,3:3,7:7}],27:[function(e,t,n){"use strict";function i(e){if("string"!=typeof e)throw new Error("Argument passed must be a string");var t={"&":"&","<":"<",">":">",'"':"""};return e.replace(/[&<>"]/g,function(e){return t[e]})}function o(e,t){var n=this,i=arguments,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"!=typeof e)throw new Error("First argument must be a function");if("number"!=typeof t)throw new Error("Second argument must be a numeric value");var r=void 0;return function(){var a=n,s=i,l=o&&!r;clearTimeout(r),r=setTimeout(function(){r=null,o||e.apply(a,s)},t),l&&e.apply(a,s)}}function r(e){return Object.getOwnPropertyNames(e).length<=0}function a(e,t){var n=/^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/,i={d:[],w:[]};return(e||"").split(" ").forEach(function(e){var o=e+(t?"."+t:"");o.startsWith(".")?(i.d.push(o),i.w.push(o)):i[n.test(e)?"w":"d"].push(o)}),i.d=i.d.join(" "),i.w=i.w.join(" "),i}function s(e,t){if("string"!=typeof e)throw new Error("Event name must be a string");var n=e.match(/([a-z]+\.([a-z]+))/i),i={target:t};return null!==n&&(e=n[1],i.namespace=n[2]),new window.CustomEvent(e,{detail:i})}function l(e,t){return!!(e&&t&&2&e.compareDocumentPosition(t))}function d(e){return"string"==typeof e}Object.defineProperty(n,"__esModule",{value:!0}),n.escapeHTML=i,n.debounce=o,n.isObjectEmpty=r,n.splitEvents=a,n.createEvent=s,n.isNodeAfter=l,n.isString=d;var u=function(e){return e&&e.__esModule?e:{default:e}}(e(7));u.default.Utils=u.default.Utils||{},u.default.Utils.escapeHTML=i,u.default.Utils.debounce=o,u.default.Utils.isObjectEmpty=r,u.default.Utils.splitEvents=a,u.default.Utils.createEvent=s,u.default.Utils.isNodeAfter=l,u.default.Utils.isString=d},{7:7}],28:[function(e,t,n){"use strict";function i(e){if("string"!=typeof e)throw new Error("`url` argument must be a string");var t=document.createElement("div");return t.innerHTML='<a href="'+(0,u.escapeHTML)(e)+'">x</a>',t.firstChild.href}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e&&!t?a(e):t}function r(e){if("string"!=typeof e)throw new Error("`type` argument must be a string");return e&&e.indexOf(";")>-1?e.substr(0,e.indexOf(";")):e}function a(e){if("string"!=typeof e)throw new Error("`url` argument must be a string");for(var t=0,n=c.length;t<n;t++){var i=c[t](e);if(i)return i}var o=l(s(e)),r="video/mp4";return o&&(~["mp4","m4v","ogg","ogv","webm","flv","mpeg","mov"].indexOf(o)?r="video/"+o:~["mp3","oga","wav","mid","midi"].indexOf(o)&&(r="audio/"+o)),r}function s(e){if("string"!=typeof e)throw new Error("`url` argument must be a string");var t=e.split("?")[0].split("\\").pop().split("/").pop();return~t.indexOf(".")?t.substring(t.lastIndexOf(".")+1):""}function l(e){if("string"!=typeof e)throw new Error("`extension` argument must be a string");switch(e){case"mp4":case"m4v":return"mp4";case"webm":case"webma":case"webmv":return"webm";case"ogg":case"oga":case"ogv":return"ogg";default:return e}}Object.defineProperty(n,"__esModule",{value:!0}),n.typeChecks=void 0,n.absolutizeUrl=i,n.formatType=o,n.getMimeFromType=r,n.getTypeFromFile=a,n.getExtension=s,n.normalizeExtension=l;var d=function(e){return e&&e.__esModule?e:{default:e}}(e(7)),u=e(27),c=n.typeChecks=[];d.default.Utils=d.default.Utils||{},d.default.Utils.typeChecks=c,d.default.Utils.absolutizeUrl=i,d.default.Utils.formatType=o,d.default.Utils.getMimeFromType=r,d.default.Utils.getTypeFromFile=a,d.default.Utils.getExtension=s,d.default.Utils.normalizeExtension=l},{27:27,7:7}],29:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=i(e(2)),r=i(e(4));if([Element.prototype,CharacterData.prototype,DocumentType.prototype].forEach(function(e){e.hasOwnProperty("remove")||Object.defineProperty(e,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){this.parentNode.removeChild(this)}})}),function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=o.default.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}if("function"==typeof window.CustomEvent)return!1;e.prototype=window.Event.prototype,window.CustomEvent=e}(),"function"!=typeof Object.assign&&(Object.assign=function(e){if(null===e||void 0===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1,i=arguments.length;n<i;n++){var o=arguments[n];if(null!==o)for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(t[r]=o[r])}return t}),String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length-1;--n>=0&&t.item(n)!==this;);return n>-1}),window.Element&&!Element.prototype.closest&&(Element.prototype.closest=function(e){var t=(this.document||this.ownerDocument).querySelectorAll(e),n=void 0,i=this;do{for(n=t.length;--n>=0&&t.item(n)!==i;);}while(n<0&&(i=i.parentElement));return i}),function(){for(var e=0,t=["ms","moz","webkit","o"],n=0;n<t.length&&!window.requestAnimationFrame;++n)window.requestAnimationFrame=window[t[n]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[n]+"CancelAnimationFrame"]||window[t[n]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t){var n=(new Date).getTime(),i=Math.max(0,16-(n-e)),o=window.setTimeout(function(){t(n+i)},i);return e=n+i,o}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})}(),/firefox/i.test(navigator.userAgent)){var a=window.getComputedStyle;window.getComputedStyle=function(e,t){var n=a(e,t);return null===n?{getPropertyValue:function(){}}:n}}window.Promise||(window.Promise=r.default),function(e){e&&e.prototype&&null===e.prototype.children&&Object.defineProperty(e.prototype,"children",{get:function(){for(var e=0,t=void 0,n=this.childNodes,i=[];t=n[e++];)1===t.nodeType&&i.push(t);return i}})}(window.Node||window.Element)},{2:2,4:4}],30:[function(e,t,n){"use strict";function i(){return!((arguments.length>0&&void 0!==arguments[0]?arguments[0]:25)%1==0)}function o(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:25,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"hh:mm:ss";e=!e||"number"!=typeof e||e<0?0:e;var s=Math.round(.066666*o),l=Math.round(o),d=24*Math.round(3600*o),u=Math.round(600*o),c=i(o)?";":":",f=void 0,p=void 0,m=void 0,h=void 0,v=Math.round(e*o);if(i(o)){v<0&&(v=d+v);var g=(v%=d)%u;v+=9*s*Math.floor(v/u),g>s&&(v+=s*Math.floor((g-s)/Math.round(60*l-s)));var y=Math.floor(v/l);f=Math.floor(Math.floor(y/60)/60),p=Math.floor(y/60)%60,m=n?y%60:Math.floor(v/l%60).toFixed(r)}else f=Math.floor(e/3600)%24,p=Math.floor(e/60)%60,m=n?Math.floor(e%60):Math.floor(e%60).toFixed(r);f=f<=0?0:f,p=p<=0?0:p,m=60===(m=m<=0?0:m)?0:m,p=60===p?0:p;for(var E=a.split(":"),b={},S=0,x=E.length;S<x;++S){for(var w="",P=0,T=E[S].length;P<T;P++)w.indexOf(E[S][P])<0&&(w+=E[S][P]);~["f","s","m","h"].indexOf(w)&&(b[w]=E[S].length)}var C=t||f>0?(f<10&&b.h>1?"0"+f:f)+":":"";return C+=(p<10&&b.m>1?"0"+p:p)+":",C+=""+(m<10&&b.s>1?"0"+m:m),n&&(C+=(h=(h=(v%l).toFixed(0))<=0?0:h)<10&&b.f?c+"0"+h:""+c+h),C}function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:25;if("string"!=typeof e)throw new TypeError("Time must be a string");if(e.indexOf(";")>0&&(e=e.replace(";",":")),!/\d{2}(\:\d{2}){0,3}/i.test(e))throw new TypeError("Time code must have the format `00:00:00`");var n=e.split(":"),o=void 0,r=0,a=0,s=0,l=0,d=0,u=Math.round(.066666*t),c=Math.round(t),f=3600*c,p=60*c;switch(n.length){default:case 1:s=parseInt(n[0],10);break;case 2:a=parseInt(n[0],10),s=parseInt(n[1],10);break;case 3:r=parseInt(n[0],10),a=parseInt(n[1],10),s=parseInt(n[2],10);break;case 4:r=parseInt(n[0],10),a=parseInt(n[1],10),s=parseInt(n[2],10),l=parseInt(n[3],10)}return o=i(t)?f*r+p*a+c*s+l-u*((d=60*r+a)-Math.floor(d/10)):(f*r+p*a+t*s+l)/t,parseFloat(o.toFixed(3))}function a(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:25;e=!e||"number"!=typeof e||e<0?0:e;for(var i=Math.floor(e/3600)%24,o=Math.floor(e/60)%60,r=Math.floor(e%60),a=[[Math.floor((e%1*n).toFixed(3)),"f"],[r,"s"],[o,"m"],[i,"h"]],s=t.timeFormat,l=s[1]===s[0],d=l?2:1,u=s.length<d?s[d]:":",c=s[0],f=!1,p=0,m=a.length;p<m;p++)if(~s.indexOf(a[p][1]))f=!0;else if(f){for(var h=!1,v=p;v<m;v++)if(a[v][0]>0){h=!0;break}if(!h)break;l||(s=c+s),s=a[p][1]+u+s,l&&(s=a[p][1]+s),c=a[p][1]}t.timeFormat=s}function s(e){if("string"!=typeof e)throw new TypeError("Argument must be a string value");for(var t=~(e=e.replace(",",".")).indexOf(".")?e.split(".")[1].length:0,n=0,i=1,o=0,r=(e=e.split(":").reverse()).length;o<r;o++)i=1,o>0&&(i=Math.pow(60,o)),n+=Number(e[o])*i;return Number(n.toFixed(t))}Object.defineProperty(n,"__esModule",{value:!0}),n.isDropFrame=i,n.secondsToTimeCode=o,n.timeCodeToSeconds=r,n.calculateTimeFormat=a,n.convertSMPTEtoSeconds=s;var l=function(e){return e&&e.__esModule?e:{default:e}}(e(7));l.default.Utils=l.default.Utils||{},l.default.Utils.secondsToTimeCode=o,l.default.Utils.timeCodeToSeconds=r,l.default.Utils.calculateTimeFormat=a,l.default.Utils.convertSMPTEtoSeconds=s},{7:7}]},{},[29,6,5,15,23,20,19,21,22,24,16,18,17,9,10,11,12,13,14]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/mediaelement/mediaelement-flash-audio-ogg.swf
ADDED
Binary file
|
assets/mediaelement/mediaelement-flash-audio.swf
ADDED
Binary file
|
assets/mediaelement/mediaelement-flash-video-hls.swf
ADDED
Binary file
|
assets/mediaelement/mediaelement-flash-video-mdash.swf
ADDED
Binary file
|
assets/mediaelement/mediaelement-flash-video.swf
ADDED
Binary file
|
assets/mediaelement/mediaelementplayer.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.mejs-container{position:relative;background:#000;font-family:Helvetica,Arial;text-align:left;vertical-align:top;text-indent:0;}.me-plugin{position:absolute;}.mejs-embed,.mejs-embed body{width:100%;height:100%;margin:0;padding:0;background:#000;overflow:hidden;}.mejs-fullscreen{overflow:hidden!important;}.mejs-container-fullscreen{position:fixed;left:0;top:0;right:0;bottom:0;overflow:hidden;z-index:1000;}.mejs-container-fullscreen .mejs-mediaelement,.mejs-container-fullscreen video{width:100%;height:100%;}.mejs-clear{clear:both;}.mejs-background{position:absolute;top:0;left:0;}.mejs-mediaelement{position:absolute;top:0;left:0;width:100%;height:100%;}.mejs-poster{position:absolute;top:0;left:0;background-size:contain;background-position:50% 50%;background-repeat:no-repeat;}:root .mejs-poster img{display:none;}.mejs-poster img{border:0;padding:0;border:0;}.mejs-overlay{position:absolute;top:0;left:0;}.mejs-overlay-play{cursor:pointer;}.mejs-overlay-button{position:absolute;top:50%;left:50%;width:100px;height:100px;margin:-50px 0 0 -50px;background:url(bigplay.svg) no-repeat;}.no-svg .mejs-overlay-button{background-image:url(bigplay.png);}.mejs-overlay:hover .mejs-overlay-button{background-position:0 -100px;}.mejs-overlay-loading{position:absolute;top:50%;left:50%;width:80px;height:80px;margin:-40px 0 0 -40px;background:#333;background:url(background.png);background:rgba(0,0,0,0.9);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(50,50,50,0.9)),to(rgba(0,0,0,0.9)));background:-webkit-linear-gradient(top,rgba(50,50,50,0.9),rgba(0,0,0,0.9));background:-moz-linear-gradient(top,rgba(50,50,50,0.9),rgba(0,0,0,0.9));background:-o-linear-gradient(top,rgba(50,50,50,0.9),rgba(0,0,0,0.9));background:-ms-linear-gradient(top,rgba(50,50,50,0.9),rgba(0,0,0,0.9));background:linear-gradient(rgba(50,50,50,0.9),rgba(0,0,0,0.9));}.mejs-overlay-loading span{display:block;width:80px;height:80px;background:transparent url(loading.gif) 50% 50% no-repeat;}.mejs-container .mejs-controls{position:absolute;list-style-type:none;margin:0;padding:0;bottom:0;left:0;background:url(background.png);background:rgba(0,0,0,0.7);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(50,50,50,0.7)),to(rgba(0,0,0,0.7)));background:-webkit-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-moz-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-o-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-ms-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:linear-gradient(rgba(50,50,50,0.7),rgba(0,0,0,0.7));height:30px;width:100%;}.mejs-container .mejs-controls div{list-style-type:none;background-image:none;display:block;float:left;margin:0;padding:0;width:26px;height:26px;font-size:11px;line-height:11px;font-family:Helvetica,Arial;border:0;}.mejs-controls .mejs-button button{cursor:pointer;display:block;font-size:0;line-height:0;text-decoration:none;margin:7px 5px;padding:0;position:absolute;height:16px;width:16px;border:0;background:transparent url(controls.svg) no-repeat;}.no-svg .mejs-controls .mejs-button button{background-image:url(controls.png);}.mejs-controls .mejs-button button:focus{outline:solid 1px yellow;}.mejs-container .mejs-controls .mejs-time{color:#fff;display:block;height:17px;width:auto;padding:8px 3px 0 3px;overflow:hidden;text-align:center;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}.mejs-container .mejs-controls .mejs-time span{color:#fff;font-size:11px;line-height:12px;display:block;float:left;margin:1px 2px 0 0;width:auto;}.mejs-controls .mejs-play button{background-position:0 0;}.mejs-controls .mejs-pause button{background-position:0 -16px;}.mejs-controls .mejs-stop button{background-position:-112px 0;}.mejs-controls div.mejs-time-rail{direction:ltr;width:200px;padding-top:5px;}.mejs-controls .mejs-time-rail span{display:block;position:absolute;width:180px;height:10px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;cursor:pointer;}.mejs-controls .mejs-time-rail .mejs-time-total{margin:5px;background:#333;background:rgba(50,50,50,0.8);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(30,30,30,0.8)),to(rgba(60,60,60,0.8)));background:-webkit-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-moz-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-o-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-ms-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:linear-gradient(rgba(30,30,30,0.8),rgba(60,60,60,0.8));}.mejs-controls .mejs-time-rail .mejs-time-buffering{width:100%;background-image:-o-linear-gradient(-45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(-45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(-45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-ms-linear-gradient(-45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(-45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);-webkit-background-size:15px 15px;-moz-background-size:15px 15px;-o-background-size:15px 15px;background-size:15px 15px;-webkit-animation:buffering-stripes 2s linear infinite;-moz-animation:buffering-stripes 2s linear infinite;-ms-animation:buffering-stripes 2s linear infinite;-o-animation:buffering-stripes 2s linear infinite;animation:buffering-stripes 2s linear infinite;}@-webkit-keyframes buffering-stripes{from{background-position:0 0;}to{background-position:30px 0;}}@-moz-keyframes buffering-stripes{from{background-position:0 0;}to{background-position:30px 0;}}@-ms-keyframes buffering-stripes{from{background-position:0 0;}to{background-position:30px 0;}}@-o-keyframes buffering-stripes{from{background-position:0 0;}to{background-position:30px 0;}}@keyframes buffering-stripes{from{background-position:0 0;}to{background-position:30px 0;}}.mejs-controls .mejs-time-rail .mejs-time-loaded{background:#3caac8;background:rgba(60,170,200,0.8);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(44,124,145,0.8)),to(rgba(78,183,212,0.8)));background:-webkit-linear-gradient(top,rgba(44,124,145,0.8),rgba(78,183,212,0.8));background:-moz-linear-gradient(top,rgba(44,124,145,0.8),rgba(78,183,212,0.8));background:-o-linear-gradient(top,rgba(44,124,145,0.8),rgba(78,183,212,0.8));background:-ms-linear-gradient(top,rgba(44,124,145,0.8),rgba(78,183,212,0.8));background:linear-gradient(rgba(44,124,145,0.8),rgba(78,183,212,0.8));width:0;}.mejs-controls .mejs-time-rail .mejs-time-current{background:#fff;background:rgba(255,255,255,0.8);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(255,255,255,0.9)),to(rgba(200,200,200,0.8)));background:-webkit-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-moz-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-o-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-ms-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:linear-gradient(rgba(255,255,255,0.9),rgba(200,200,200,0.8));width:0;}.mejs-controls .mejs-time-rail .mejs-time-handle{display:none;position:absolute;margin:0;width:10px;background:#fff;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;cursor:pointer;border:solid 2px #333;top:-2px;text-align:center;}.mejs-controls .mejs-time-rail .mejs-time-float{position:absolute;display:none;background:#eee;width:36px;height:17px;border:solid 1px #333;top:-26px;margin-left:-18px;text-align:center;color:#111;}.mejs-controls .mejs-time-rail .mejs-time-float-current{margin:2px;width:30px;display:block;text-align:center;left:0;}.mejs-controls .mejs-time-rail .mejs-time-float-corner{position:absolute;display:block;width:0;height:0;line-height:0;border:solid 5px #eee;border-color:#eee transparent transparent transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;top:15px;left:13px;}.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float{width:48px;}.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float-current{width:44px;}.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float-corner{left:18px;}.mejs-controls .mejs-fullscreen-button button{background-position:-32px 0;}.mejs-controls .mejs-unfullscreen button{background-position:-32px -16px;}.mejs-controls .mejs-mute button{background-position:-16px -16px;}.mejs-controls .mejs-unmute button{background-position:-16px 0;}.mejs-controls .mejs-volume-button{position:relative;}.mejs-controls .mejs-volume-button .mejs-volume-slider{display:none;height:115px;width:25px;background:url(background.png);background:rgba(50,50,50,0.7);-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;top:-115px;left:0;z-index:1;position:absolute;margin:0;}.mejs-controls .mejs-volume-button:hover{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px;}.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-total{position:absolute;left:11px;top:8px;width:2px;height:100px;background:#ddd;background:rgba(255,255,255,0.5);margin:0;}.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-current{position:absolute;left:11px;top:8px;width:2px;height:100px;background:#ddd;background:rgba(255,255,255,0.9);margin:0;}.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-handle{position:absolute;left:4px;top:-3px;width:16px;height:6px;background:#ddd;background:rgba(255,255,255,0.9);cursor:N-resize;-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px;margin:0;}.mejs-controls div.mejs-horizontal-volume-slider{height:26px;width:60px;position:relative;}.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total{position:absolute;left:0;top:11px;width:50px;height:8px;margin:0;padding:0;font-size:1px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;background:#333;background:rgba(50,50,50,0.8);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(30,30,30,0.8)),to(rgba(60,60,60,0.8)));background:-webkit-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-moz-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-o-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-ms-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:linear-gradient(rgba(30,30,30,0.8),rgba(60,60,60,0.8));}.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current{position:absolute;left:0;top:11px;width:50px;height:8px;margin:0;padding:0;font-size:1px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;background:#fff;background:rgba(255,255,255,0.8);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(255,255,255,0.9)),to(rgba(200,200,200,0.8)));background:-webkit-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-moz-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-o-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-ms-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:linear-gradient(rgba(255,255,255,0.9),rgba(200,200,200,0.8));}.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-handle{display:none;}.mejs-controls .mejs-captions-button{position:relative;}.mejs-controls .mejs-captions-button button{background-position:-48px 0;}.mejs-controls .mejs-captions-button .mejs-captions-selector{visibility:hidden;position:absolute;bottom:26px;right:-10px;width:130px;height:100px;background:url(background.png);background:rgba(50,50,50,0.7);border:solid 1px transparent;padding:10px;overflow:hidden;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}.mejs-controls .mejs-captions-button .mejs-captions-selector ul{margin:0;padding:0;display:block;list-style-type:none!important;overflow:hidden;}.mejs-controls .mejs-captions-button .mejs-captions-selector ul li{margin:0 0 6px 0;padding:0;list-style-type:none!important;display:block;color:#fff;overflow:hidden;}.mejs-controls .mejs-captions-button .mejs-captions-selector ul li input{clear:both;float:left;margin:3px 3px 0 5px;}.mejs-controls .mejs-captions-button .mejs-captions-selector ul li label{width:100px;float:left;padding:4px 0 0 0;line-height:15px;font-family:helvetica,arial;font-size:10px;}.mejs-controls .mejs-captions-button .mejs-captions-translations{font-size:10px;margin:0 0 5px 0;}.mejs-chapters{position:absolute;top:0;left:0;-xborder-right:solid 1px #fff;width:10000px;z-index:1;}.mejs-chapters .mejs-chapter{position:absolute;float:left;background:#222;background:rgba(0,0,0,0.7);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(50,50,50,0.7)),to(rgba(0,0,0,0.7)));background:-webkit-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-moz-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-o-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-ms-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:linear-gradient(rgba(50,50,50,0.7),rgba(0,0,0,0.7));filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,startColorstr=#323232,endColorstr=#000000);overflow:hidden;border:0;}.mejs-chapters .mejs-chapter .mejs-chapter-block{font-size:11px;color:#fff;padding:5px;display:block;border-right:solid 1px #333;border-bottom:solid 1px #333;cursor:pointer;}.mejs-chapters .mejs-chapter .mejs-chapter-block-last{border-right:none;}.mejs-chapters .mejs-chapter .mejs-chapter-block:hover{background:#666;background:rgba(102,102,102,0.7);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(102,102,102,0.7)),to(rgba(50,50,50,0.6)));background:-webkit-linear-gradient(top,rgba(102,102,102,0.7),rgba(50,50,50,0.6));background:-moz-linear-gradient(top,rgba(102,102,102,0.7),rgba(50,50,50,0.6));background:-o-linear-gradient(top,rgba(102,102,102,0.7),rgba(50,50,50,0.6));background:-ms-linear-gradient(top,rgba(102,102,102,0.7),rgba(50,50,50,0.6));background:linear-gradient(rgba(102,102,102,0.7),rgba(50,50,50,0.6));filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,startColorstr=#666666,endColorstr=#323232);}.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-title{font-size:12px;font-weight:bold;display:block;white-space:nowrap;text-overflow:ellipsis;margin:0 0 3px 0;line-height:12px;}.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-timespan{font-size:12px;line-height:12px;margin:3px 0 4px 0;display:block;white-space:nowrap;text-overflow:ellipsis;}.mejs-captions-layer{position:absolute;bottom:0;left:0;text-align:center;line-height:22px;font-size:12px;color:#fff;}.mejs-captions-layer a{color:#fff;text-decoration:underline;}.mejs-captions-layer[lang=ar]{font-size:20px;font-weight:normal;}.mejs-captions-position{position:absolute;width:100%;bottom:15px;left:0;}.mejs-captions-position-hover{bottom:45px;}.mejs-captions-text{padding:3px 5px;background:url(background.png);background:rgba(20,20,20,0.8);}.me-cannotplay a{color:#fff;font-weight:bold;}.me-cannotplay span{padding:15px;display:block;}.mejs-controls .mejs-loop-off button{background-position:-64px -16px;}.mejs-controls .mejs-loop-on button{background-position:-64px 0;}.mejs-controls .mejs-backlight-off button{background-position:-80px -16px;}.mejs-controls .mejs-backlight-on button{background-position:-80px 0;}.mejs-controls .mejs-picturecontrols-button{background-position:-96px 0;}.mejs-contextmenu{position:absolute;width:150px;padding:10px;border-radius:4px;top:0;left:0;background:#fff;border:solid 1px #999;z-index:1001;}.mejs-contextmenu .mejs-contextmenu-separator{height:1px;font-size:0;margin:5px 6px;background:#333;}.mejs-contextmenu .mejs-contextmenu-item{font-family:Helvetica,Arial;font-size:12px;padding:4px 6px;cursor:pointer;color:#333;}.mejs-contextmenu .mejs-contextmenu-item:hover{background:#2C7C91;color:#fff;}.mejs-controls .mejs-sourcechooser-button{position:relative;}.mejs-controls .mejs-sourcechooser-button button{background-position:-128px 0;}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector{visibility:hidden;position:absolute;bottom:26px;right:-10px;width:130px;height:100px;background:url(background.png);background:rgba(50,50,50,0.7);border:solid 1px transparent;padding:10px;overflow:hidden;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul{margin:0;padding:0;display:block;list-style-type:none!important;overflow:hidden;}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li{margin:0 0 6px 0;padding:0;list-style-type:none!important;display:block;color:#fff;overflow:hidden;}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li input{clear:both;float:left;margin:3px 3px 0 5px;}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li label{width:100px;float:left;padding:4px 0 0 0;line-height:15px;font-family:helvetica,arial;font-size:10px;}.mejs-postroll-layer{position:absolute;bottom:0;left:0;width:100%;height:100%;background:url(background.png);background:rgba(50,50,50,0.7);z-index:1000;overflow:hidden;}.mejs-postroll-layer-content{width:100%;height:100%;}.mejs-postroll-close{position:absolute;right:0;top:0;background:url(background.png);background:rgba(50,50,50,0.7);color:#fff;padding:4px;z-index:100;cursor:pointer;}
|
1 |
+
.mejs__offscreen{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal}.mejs__container{background:#000;font-family:Helvetica,Arial,serif;position:relative;text-align:left;text-indent:0;vertical-align:top}.mejs__container,.mejs__container *{box-sizing:border-box}.mejs__container video::-webkit-media-controls,.mejs__container video::-webkit-media-controls-panel,.mejs__container video::-webkit-media-controls-panel-container,.mejs__container video::-webkit-media-controls-start-playback-button{-webkit-appearance:none;display:none!important}.mejs__fill-container,.mejs__fill-container .mejs__container{height:100%;width:100%}.mejs__fill-container{background:transparent;margin:0 auto;overflow:hidden;position:relative}.mejs__container:focus{outline:none}.mejs__iframe-overlay{height:100%;position:absolute;width:100%}.mejs__embed,.mejs__embed body{background:#000;height:100%;margin:0;overflow:hidden;padding:0;width:100%}.mejs__fullscreen{overflow:hidden!important}.mejs__container-fullscreen{bottom:0;left:0;overflow:hidden;position:fixed;right:0;top:0;z-index:1000}.mejs__container-fullscreen .mejs__mediaelement,.mejs__container-fullscreen video{height:100%!important;width:100%!important}.mejs__background,.mejs__mediaelement{left:0;position:absolute;top:0}.mejs__mediaelement{height:100%;width:100%;z-index:0}.mejs__poster{background-position:50% 50%;background-repeat:no-repeat;background-size:cover;left:0;position:absolute;top:0;z-index:1}:root .mejs__poster-img{display:none}.mejs__poster-img{border:0;padding:0}.mejs__overlay{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;left:0;position:absolute;top:0}.mejs__layer{z-index:1}.mejs__overlay-play{cursor:pointer}.mejs__overlay-button{background:url(mejs-controls.svg) no-repeat;background-position:0 -39px;height:80px;width:80px}.mejs__overlay:hover>.mejs__overlay-button{background-position:-80px -39px}.mejs__overlay-loading{height:80px;width:80px}.mejs__overlay-loading-bg-img{-webkit-animation:a 1s linear infinite;animation:a 1s linear infinite;background:transparent url(mejs-controls.svg) -160px -40px no-repeat;display:block;height:80px;width:80px;z-index:1}@-webkit-keyframes a{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.mejs__controls{bottom:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:40px;left:0;list-style-type:none;margin:0;padding:0 10px;position:absolute;width:100%;z-index:3}.mejs__controls:not([style*="display: none"]){background:rgba(255,0,0,.7);background:-webkit-linear-gradient(transparent,rgba(0,0,0,.35));background:linear-gradient(transparent,rgba(0,0,0,.35))}.mejs__button,.mejs__time,.mejs__time-rail{font-size:10px;height:40px;line-height:10px;margin:0;width:32px}.mejs__button>button{background:transparent url(mejs-controls.svg);border:0;cursor:pointer;display:block;font-size:0;height:20px;line-height:0;margin:10px 6px;overflow:hidden;padding:0;position:absolute;text-decoration:none;width:20px}.mejs__button>button:focus{outline:1px dotted #999}.mejs__container-keyboard-inactive [role=slider],.mejs__container-keyboard-inactive [role=slider]:focus,.mejs__container-keyboard-inactive a,.mejs__container-keyboard-inactive a:focus,.mejs__container-keyboard-inactive button,.mejs__container-keyboard-inactive button:focus{outline:0}.mejs__time{box-sizing:content-box;color:#fff;font-size:11px;font-weight:700;height:24px;overflow:hidden;padding:16px 6px 0;text-align:center;width:auto}.mejs__play>button{background-position:0 0}.mejs__pause>button{background-position:-20px 0}.mejs__replay>button{background-position:-160px 0}.mejs__time-rail{direction:ltr;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;height:40px;margin:0 10px;padding-top:10px;position:relative}.mejs__time-buffering,.mejs__time-current,.mejs__time-float,.mejs__time-float-corner,.mejs__time-float-current,.mejs__time-hovered,.mejs__time-loaded,.mejs__time-marker,.mejs__time-total{border-radius:2px;cursor:pointer;display:block;height:10px;position:absolute}.mejs__time-total{background:hsla(0,0%,100%,.3);margin:5px 0 0;width:100%}.mejs__time-buffering{-webkit-animation:b 2s linear infinite;animation:b 2s linear infinite;background:-webkit-linear-gradient(135deg,hsla(0,0%,100%,.4) 25%,transparent 0,transparent 50%,hsla(0,0%,100%,.4) 0,hsla(0,0%,100%,.4) 75%,transparent 0,transparent);background:linear-gradient(-45deg,hsla(0,0%,100%,.4) 25%,transparent 0,transparent 50%,hsla(0,0%,100%,.4) 0,hsla(0,0%,100%,.4) 75%,transparent 0,transparent);background-size:15px 15px;width:100%}@-webkit-keyframes b{0%{background-position:0 0}to{background-position:30px 0}}@keyframes b{0%{background-position:0 0}to{background-position:30px 0}}.mejs__time-loaded{background:hsla(0,0%,100%,.3)}.mejs__time-current,.mejs__time-handle-content{background:hsla(0,0%,100%,.9)}.mejs__time-hovered{background:hsla(0,0%,100%,.5);z-index:10}.mejs__time-hovered.negative{background:rgba(0,0,0,.2)}.mejs__time-buffering,.mejs__time-current,.mejs__time-hovered,.mejs__time-loaded{left:0;-webkit-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0);-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0;-webkit-transition:all .15s ease-in;transition:all .15s ease-in;width:100%}.mejs__time-buffering{-webkit-transform:scaleX(1);-ms-transform:scaleX(1);transform:scaleX(1)}.mejs__time-hovered{-webkit-transition:height .1s cubic-bezier(.44,0,1,1);transition:height .1s cubic-bezier(.44,0,1,1)}.mejs__time-hovered.no-hover{-webkit-transform:scaleX(0)!important;-ms-transform:scaleX(0)!important;transform:scaleX(0)!important}.mejs__time-handle,.mejs__time-handle-content{border:4px solid transparent;cursor:pointer;left:0;position:absolute;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0);z-index:11}.mejs__time-handle-content{border:4px solid hsla(0,0%,100%,.9);border-radius:50%;height:10px;left:-7px;top:-4px;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);width:10px}.mejs__time-rail .mejs__time-handle-content:active,.mejs__time-rail .mejs__time-handle-content:focus,.mejs__time-rail:hover .mejs__time-handle-content{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.mejs__time-float{background:#eee;border:1px solid #333;bottom:100%;color:#111;display:none;height:17px;margin-bottom:9px;position:absolute;text-align:center;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);width:36px}.mejs__time-float-current{display:block;left:0;margin:2px;text-align:center;width:30px}.mejs__time-float-corner{border:5px solid #eee;border-color:#eee transparent transparent;border-radius:0;display:block;height:0;left:50%;line-height:0;position:absolute;top:100%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);width:0}.mejs__long-video .mejs__time-float{margin-left:-23px;width:64px}.mejs__long-video .mejs__time-float-current{width:60px}.mejs__broadcast{color:#fff;height:10px;position:absolute;top:15px;width:100%}.mejs__fullscreen-button>button{background-position:-80px 0}.mejs__unfullscreen>button{background-position:-100px 0}.mejs__mute>button{background-position:-60px 0}.mejs__unmute>button{background-position:-40px 0}.mejs__volume-button{position:relative}.mejs__volume-button>.mejs__volume-slider{-webkit-backface-visibility:hidden;background:rgba(50,50,50,.7);border-radius:0;bottom:100%;display:none;height:115px;left:50%;margin:0;position:absolute;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);width:25px;z-index:1}.mejs__volume-button:hover{border-radius:0 0 4px 4px}.mejs__volume-total{background:hsla(0,0%,100%,.5);height:100px;left:50%;margin:0;position:absolute;top:8px;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);width:2px}.mejs__volume-current{left:0;margin:0;width:100%}.mejs__volume-current,.mejs__volume-handle{background:hsla(0,0%,100%,.9);position:absolute}.mejs__volume-handle{border-radius:1px;cursor:ns-resize;height:6px;left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);width:16px}.mejs__horizontal-volume-slider{display:block;height:36px;position:relative;vertical-align:middle;width:56px}.mejs__horizontal-volume-total{background:rgba(50,50,50,.8);height:8px;top:16px;width:50px}.mejs__horizontal-volume-current,.mejs__horizontal-volume-total{border-radius:2px;font-size:1px;left:0;margin:0;padding:0;position:absolute}.mejs__horizontal-volume-current{background:hsla(0,0%,100%,.8);height:100%;top:0;width:100%}.mejs__horizontal-volume-handle{display:none}.mejs__captions-button,.mejs__chapters-button{position:relative}.mejs__captions-button>button{background-position:-140px 0}.mejs__chapters-button>button{background-position:-180px 0}.mejs__captions-button>.mejs__captions-selector,.mejs__chapters-button>.mejs__chapters-selector{background:rgba(50,50,50,.7);border:1px solid transparent;border-radius:0;bottom:100%;margin-right:-43px;overflow:hidden;padding:0;position:absolute;right:50%;visibility:visible;width:86px}.mejs__chapters-button>.mejs__chapters-selector{margin-right:-55px;width:110px}.mejs__captions-selector-list,.mejs__chapters-selector-list{list-style-type:none!important;margin:0;overflow:hidden;padding:0}.mejs__captions-selector-list-item,.mejs__chapters-selector-list-item{color:#fff;cursor:pointer;display:block;list-style-type:none!important;margin:0 0 6px;overflow:hidden;padding:0}.mejs__captions-selector-list-item:hover,.mejs__chapters-selector-list-item:hover{background-color:#c8c8c8!important;background-color:hsla(0,0%,100%,.4)!important}.mejs__captions-selector-input,.mejs__chapters-selector-input{clear:both;float:left;left:-1000px;margin:3px 3px 0 5px;position:absolute}.mejs__captions-selector-label,.mejs__chapters-selector-label{cursor:pointer;float:left;font-size:10px;line-height:15px;padding:4px 10px 0;width:100%}.mejs__captions-selected,.mejs__chapters-selected{color:#21f8f8}.mejs__captions-translations{font-size:10px;margin:0 0 5px}.mejs__captions-layer{bottom:0;color:#fff;font-size:16px;left:0;line-height:20px;position:absolute;text-align:center}.mejs__captions-layer a{color:#fff;text-decoration:underline}.mejs__captions-layer[lang=ar]{font-size:20px;font-weight:400}.mejs__captions-position{bottom:15px;left:0;position:absolute;width:100%}.mejs__captions-position-hover{bottom:35px}.mejs__captions-text,.mejs__captions-text *{background:hsla(0,0%,8%,.5);box-shadow:5px 0 0 hsla(0,0%,8%,.5),-5px 0 0 hsla(0,0%,8%,.5);padding:0;white-space:pre-wrap}.mejs__container.mejs__hide-cues video::-webkit-media-text-track-container{display:none}.mejs__overlay-error{position:relative}.mejs__overlay-error>img{left:0;max-width:100%;position:absolute;top:0;z-index:-1}.mejs__cannotplay,.mejs__cannotplay a{color:#fff;font-size:.8em}.mejs__cannotplay{position:relative}.mejs__cannotplay a,.mejs__cannotplay p{display:inline-block;padding:0 15px;width:100%}
|
assets/mediaelement/mejs-controls.png
ADDED
Binary file
|
assets/mediaelement/mejs-controls.svg
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="120" viewBox="0 0 400 120"><style>.st0{fill:#FFFFFF;width:16px;height:16px} .st1{fill:none;stroke:#FFFFFF;stroke-width:1.5;stroke-linecap:round;} .st2{fill:none;stroke:#FFFFFF;stroke-width:2;stroke-linecap:round;} .st3{fill:none;stroke:#FFFFFF;} .st4{fill:#231F20;} .st5{opacity:0.75;fill:none;stroke:#FFFFFF;stroke-width:5;enable-background:new;} .st6{fill:none;stroke:#FFFFFF;stroke-width:5;} .st7{opacity:0.4;fill:#FFFFFF;enable-background:new;} .st8{opacity:0.6;fill:#FFFFFF;enable-background:new;} .st9{opacity:0.8;fill:#FFFFFF;enable-background:new;} .st10{opacity:0.9;fill:#FFFFFF;enable-background:new;} .st11{opacity:0.3;fill:#FFFFFF;enable-background:new;} .st12{opacity:0.5;fill:#FFFFFF;enable-background:new;} .st13{opacity:0.7;fill:#FFFFFF;enable-background:new;}</style><path class="st0" d="M16.5 8.5c.3.1.4.5.2.8-.1.1-.1.2-.2.2l-11.4 7c-.5.3-.8.1-.8-.5V2c0-.5.4-.8.8-.5l11.4 7z"/><path class="st0" d="M24 1h2.2c.6 0 1 .4 1 1v14c0 .6-.4 1-1 1H24c-.6 0-1-.4-1-1V2c0-.5.4-1 1-1zm9.8 0H36c.6 0 1 .4 1 1v14c0 .6-.4 1-1 1h-2.2c-.6 0-1-.4-1-1V2c0-.5.4-1 1-1z"/><path class="st0" d="M81 1.4c0-.6.4-1 1-1h5.4c.6 0 .7.3.3.7l-6 6c-.4.4-.7.3-.7-.3V1.4zm0 15.8c0 .6.4 1 1 1h5.4c.6 0 .7-.3.3-.7l-6-6c-.4-.4-.7-.3-.7.3v5.4zM98.8 1.4c0-.6-.4-1-1-1h-5.4c-.6 0-.7.3-.3.7l6 6c.4.4.7.3.7-.3V1.4zm0 15.8c0 .6-.4 1-1 1h-5.4c-.6 0-.7-.3-.3-.7l6-6c.4-.4.7-.3.7.3v5.4z"/><path class="st0" d="M112.7 5c0 .6.4 1 1 1h4.1c.6 0 .7-.3.3-.7L113.4.6c-.4-.4-.7-.3-.7.3V5zm-7.1 1c.6 0 1-.4 1-1V.9c0-.6-.3-.7-.7-.3l-4.7 4.7c-.4.4-.3.7.3.7h4.1zm1 7.1c0-.6-.4-1-1-1h-4.1c-.6 0-.7.3-.3.7l4.7 4.7c.4.4.7.3.7-.3v-4.1zm7.1-1c-.6 0-1 .4-1 1v4.1c0 .5.3.7.7.3l4.7-4.7c.4-.4.3-.7-.3-.7h-4.1z"/><path class="st0" d="M67 5.8c-.5.4-1.2.6-1.8.6H62c-.6 0-1 .4-1 1v5.7c0 .6.4 1 1 1h4.2c.3.2.5.4.8.6l3.5 2.6c.4.3.8.1.8-.4V3.5c0-.5-.4-.7-.8-.4L67 5.8z"/><path class="st1" d="M73.9 2.5s3.9-.8 3.9 7.7-3.9 7.8-3.9 7.8"/><path class="st1" d="M72.6 6.4s2.6-.4 2.6 3.8-2.6 3.9-2.6 3.9"/><path class="st0" d="M47 5.8c-.5.4-1.2.6-1.8.6H42c-.6 0-1 .4-1 1v5.7c0 .6.4 1 1 1h4.2c.3.2.5.4.8.6l3.5 2.6c.4.3.8.1.8-.4V3.5c0-.5-.4-.7-.8-.4L47 5.8z"/><path class="st2" d="M52.8 7l5.4 5.4m-5.4 0L58.2 7"/><path class="st3" d="M128.7 8.6c-6.2-4.2-6.5 7.8 0 3.9m6.5-3.9c-6.2-4.2-6.5 7.8 0 3.9"/><path class="st0" d="M122.2 3.4h15.7v13.1h-15.7V3.4zM120.8 2v15.7h18.3V2h-18.3z"/><path class="st0" d="M143.2 3h14c1.1 0 2 .9 2 2v10c0 1.1-.9 2-2 2h-14c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2z"/><path class="st4" d="M146.4 13.8c-.8 0-1.6-.4-2.1-1-1.1-1.4-1-3.4.1-4.8.5-.6 2-1.7 4.6.2l-.6.8c-1.4-1-2.6-1.1-3.3-.3-.8 1-.8 2.4-.1 3.5.7.9 1.9.8 3.4-.1l.5.9c-.7.5-1.6.7-2.5.8zm7.5 0c-.8 0-1.6-.4-2.1-1-1.1-1.4-1-3.4.1-4.8.5-.6 2-1.7 4.6.2l-.5.8c-1.4-1-2.6-1.1-3.3-.3-.8 1-.8 2.4-.1 3.5.7.9 1.9.8 3.4-.1l.5.9c-.8.5-1.7.7-2.6.8z"/><path class="st0" d="M60.3 77c.6.2.8.8.6 1.4-.1.3-.3.5-.6.6L30 96.5c-1 .6-1.7.1-1.7-1v-35c0-1.1.8-1.5 1.7-1L60.3 77z"/><path class="st5" d="M2.5 79c0-20.7 16.8-37.5 37.5-37.5S77.5 58.3 77.5 79 60.7 116.5 40 116.5 2.5 99.7 2.5 79z"/><path class="st0" d="M140.3 77c.6.2.8.8.6 1.4-.1.3-.3.5-.6.6L110 96.5c-1 .6-1.7.1-1.7-1v-35c0-1.1.8-1.5 1.7-1L140.3 77z"/><path class="st6" d="M82.5 79c0-20.7 16.8-37.5 37.5-37.5s37.5 16.8 37.5 37.5-16.8 37.5-37.5 37.5S82.5 99.7 82.5 79z"/><circle class="st0" cx="201.9" cy="47.1" r="8.1"/><circle class="st7" cx="233.9" cy="79" r="5"/><circle class="st8" cx="201.9" cy="110.9" r="6"/><circle class="st9" cx="170.1" cy="79" r="7"/><circle class="st10" cx="178.2" cy="56.3" r="7.5"/><circle class="st11" cx="226.3" cy="56.1" r="4.5"/><circle class="st12" cx="225.8" cy="102.8" r="5.5"/><circle class="st13" cx="178.2" cy="102.8" r="6.5"/><path class="st0" d="M178 9.4c0 .4-.4.7-.9.7-.1 0-.2 0-.2-.1L172 8.2c-.5-.2-.6-.6-.1-.8l6.2-3.6c.5-.3.8-.1.7.5l-.8 5.1z"/><path class="st0" d="M169.4 15.9c-1 0-2-.2-2.9-.7-2-1-3.2-3-3.2-5.2.1-3.4 2.9-6 6.3-6 2.5.1 4.8 1.7 5.6 4.1l.1-.1 2.1 1.1c-.6-4.4-4.7-7.5-9.1-6.9-3.9.6-6.9 3.9-7 7.9 0 2.9 1.7 5.6 4.3 7 1.2.6 2.5.9 3.8 1 2.6 0 5-1.2 6.6-3.3l-1.8-.9c-1.2 1.2-3 2-4.8 2z"/><path class="st0" d="M183.4 3.2c.8 0 1.5.7 1.5 1.5s-.7 1.5-1.5 1.5-1.5-.7-1.5-1.5c0-.9.7-1.5 1.5-1.5zm5.1 0h8.5c.9 0 1.5.7 1.5 1.5s-.7 1.5-1.5 1.5h-8.5c-.9 0-1.5-.7-1.5-1.5-.1-.9.6-1.5 1.5-1.5zm-5.1 5c.8 0 1.5.7 1.5 1.5s-.7 1.5-1.5 1.5-1.5-.7-1.5-1.5c0-.9.7-1.5 1.5-1.5zm5.1 0h8.5c.9 0 1.5.7 1.5 1.5s-.7 1.5-1.5 1.5h-8.5c-.9 0-1.5-.7-1.5-1.5-.1-.9.6-1.5 1.5-1.5zm-5.1 5c.8 0 1.5.7 1.5 1.5s-.7 1.5-1.5 1.5-1.5-.7-1.5-1.5c0-.9.7-1.5 1.5-1.5zm5.1 0h8.5c.9 0 1.5.7 1.5 1.5s-.7 1.5-1.5 1.5h-8.5c-.9 0-1.5-.7-1.5-1.5-.1-.9.6-1.5 1.5-1.5z"/></svg>
|
assets/mediaelement/silverlightmediaelement.xap
DELETED
Binary file
|
assets/spectrum/spectrum.css
ADDED
@@ -0,0 +1,507 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/***
|
2 |
+
Spectrum Colorpicker v1.8.0
|
3 |
+
https://github.com/bgrins/spectrum
|
4 |
+
Author: Brian Grinstead
|
5 |
+
License: MIT
|
6 |
+
***/
|
7 |
+
|
8 |
+
.sp-container {
|
9 |
+
position:absolute;
|
10 |
+
top:0;
|
11 |
+
left:0;
|
12 |
+
display:inline-block;
|
13 |
+
*display: inline;
|
14 |
+
*zoom: 1;
|
15 |
+
/* https://github.com/bgrins/spectrum/issues/40 */
|
16 |
+
z-index: 9999994;
|
17 |
+
overflow: hidden;
|
18 |
+
}
|
19 |
+
.sp-container.sp-flat {
|
20 |
+
position: relative;
|
21 |
+
}
|
22 |
+
|
23 |
+
/* Fix for * { box-sizing: border-box; } */
|
24 |
+
.sp-container,
|
25 |
+
.sp-container * {
|
26 |
+
-webkit-box-sizing: content-box;
|
27 |
+
-moz-box-sizing: content-box;
|
28 |
+
box-sizing: content-box;
|
29 |
+
}
|
30 |
+
|
31 |
+
/* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */
|
32 |
+
.sp-top {
|
33 |
+
position:relative;
|
34 |
+
width: 100%;
|
35 |
+
display:inline-block;
|
36 |
+
}
|
37 |
+
.sp-top-inner {
|
38 |
+
position:absolute;
|
39 |
+
top:0;
|
40 |
+
left:0;
|
41 |
+
bottom:0;
|
42 |
+
right:0;
|
43 |
+
}
|
44 |
+
.sp-color {
|
45 |
+
position: absolute;
|
46 |
+
top:0;
|
47 |
+
left:0;
|
48 |
+
bottom:0;
|
49 |
+
right:20%;
|
50 |
+
}
|
51 |
+
.sp-hue {
|
52 |
+
position: absolute;
|
53 |
+
top:0;
|
54 |
+
right:0;
|
55 |
+
bottom:0;
|
56 |
+
left:84%;
|
57 |
+
height: 100%;
|
58 |
+
}
|
59 |
+
|
60 |
+
.sp-clear-enabled .sp-hue {
|
61 |
+
top:33px;
|
62 |
+
height: 77.5%;
|
63 |
+
}
|
64 |
+
|
65 |
+
.sp-fill {
|
66 |
+
padding-top: 80%;
|
67 |
+
}
|
68 |
+
.sp-sat, .sp-val {
|
69 |
+
position: absolute;
|
70 |
+
top:0;
|
71 |
+
left:0;
|
72 |
+
right:0;
|
73 |
+
bottom:0;
|
74 |
+
}
|
75 |
+
|
76 |
+
.sp-alpha-enabled .sp-top {
|
77 |
+
margin-bottom: 18px;
|
78 |
+
}
|
79 |
+
.sp-alpha-enabled .sp-alpha {
|
80 |
+
display: block;
|
81 |
+
}
|
82 |
+
.sp-alpha-handle {
|
83 |
+
position:absolute;
|
84 |
+
top:-4px;
|
85 |
+
bottom: -4px;
|
86 |
+
width: 6px;
|
87 |
+
left: 50%;
|
88 |
+
cursor: pointer;
|
89 |
+
border: 1px solid black;
|
90 |
+
background: white;
|
91 |
+
opacity: .8;
|
92 |
+
}
|
93 |
+
.sp-alpha {
|
94 |
+
display: none;
|
95 |
+
position: absolute;
|
96 |
+
bottom: -14px;
|
97 |
+
right: 0;
|
98 |
+
left: 0;
|
99 |
+
height: 8px;
|
100 |
+
}
|
101 |
+
.sp-alpha-inner {
|
102 |
+
border: solid 1px #333;
|
103 |
+
}
|
104 |
+
|
105 |
+
.sp-clear {
|
106 |
+
display: none;
|
107 |
+
}
|
108 |
+
|
109 |
+
.sp-clear.sp-clear-display {
|
110 |
+
background-position: center;
|
111 |
+
}
|
112 |
+
|
113 |
+
.sp-clear-enabled .sp-clear {
|
114 |
+
display: block;
|
115 |
+
position:absolute;
|
116 |
+
top:0px;
|
117 |
+
right:0;
|
118 |
+
bottom:0;
|
119 |
+
left:84%;
|
120 |
+
height: 28px;
|
121 |
+
}
|
122 |
+
|
123 |
+
/* Don't allow text selection */
|
124 |
+
.sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-clear, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button {
|
125 |
+
-webkit-user-select:none;
|
126 |
+
-moz-user-select: -moz-none;
|
127 |
+
-o-user-select:none;
|
128 |
+
user-select: none;
|
129 |
+
}
|
130 |
+
|
131 |
+
.sp-container.sp-input-disabled .sp-input-container {
|
132 |
+
display: none;
|
133 |
+
}
|
134 |
+
.sp-container.sp-buttons-disabled .sp-button-container {
|
135 |
+
display: none;
|
136 |
+
}
|
137 |
+
.sp-container.sp-palette-buttons-disabled .sp-palette-button-container {
|
138 |
+
display: none;
|
139 |
+
}
|
140 |
+
.sp-palette-only .sp-picker-container {
|
141 |
+
display: none;
|
142 |
+
}
|
143 |
+
.sp-palette-disabled .sp-palette-container {
|
144 |
+
display: none;
|
145 |
+
}
|
146 |
+
|
147 |
+
.sp-initial-disabled .sp-initial {
|
148 |
+
display: none;
|
149 |
+
}
|
150 |
+
|
151 |
+
|
152 |
+
/* Gradients for hue, saturation and value instead of images. Not pretty... but it works */
|
153 |
+
.sp-sat {
|
154 |
+
background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0)));
|
155 |
+
background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0));
|
156 |
+
background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
|
157 |
+
background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
|
158 |
+
background-image: -ms-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
|
159 |
+
background-image: linear-gradient(to right, #fff, rgba(204, 154, 129, 0));
|
160 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";
|
161 |
+
filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81');
|
162 |
+
}
|
163 |
+
.sp-val {
|
164 |
+
background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0)));
|
165 |
+
background-image: -webkit-linear-gradient(bottom, #000000, rgba(204, 154, 129, 0));
|
166 |
+
background-image: -moz-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
|
167 |
+
background-image: -o-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
|
168 |
+
background-image: -ms-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
|
169 |
+
background-image: linear-gradient(to top, #000, rgba(204, 154, 129, 0));
|
170 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";
|
171 |
+
filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000');
|
172 |
+
}
|
173 |
+
|
174 |
+
.sp-hue {
|
175 |
+
background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
176 |
+
background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
177 |
+
background: -o-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
178 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#ff0000), color-stop(0.17, #ffff00), color-stop(0.33, #00ff00), color-stop(0.5, #00ffff), color-stop(0.67, #0000ff), color-stop(0.83, #ff00ff), to(#ff0000));
|
179 |
+
background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
180 |
+
background: linear-gradient(to bottom, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
181 |
+
}
|
182 |
+
|
183 |
+
/* IE filters do not support multiple color stops.
|
184 |
+
Generate 6 divs, line them up, and do two color gradients for each.
|
185 |
+
Yes, really.
|
186 |
+
*/
|
187 |
+
.sp-1 {
|
188 |
+
height:17%;
|
189 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00');
|
190 |
+
}
|
191 |
+
.sp-2 {
|
192 |
+
height:16%;
|
193 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00');
|
194 |
+
}
|
195 |
+
.sp-3 {
|
196 |
+
height:17%;
|
197 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff');
|
198 |
+
}
|
199 |
+
.sp-4 {
|
200 |
+
height:17%;
|
201 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff');
|
202 |
+
}
|
203 |
+
.sp-5 {
|
204 |
+
height:16%;
|
205 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff');
|
206 |
+
}
|
207 |
+
.sp-6 {
|
208 |
+
height:17%;
|
209 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000');
|
210 |
+
}
|
211 |
+
|
212 |
+
.sp-hidden {
|
213 |
+
display: none !important;
|
214 |
+
}
|
215 |
+
|
216 |
+
/* Clearfix hack */
|
217 |
+
.sp-cf:before, .sp-cf:after { content: ""; display: table; }
|
218 |
+
.sp-cf:after { clear: both; }
|
219 |
+
.sp-cf { *zoom: 1; }
|
220 |
+
|
221 |
+
/* Mobile devices, make hue slider bigger so it is easier to slide */
|
222 |
+
@media (max-device-width: 480px) {
|
223 |
+
.sp-color { right: 40%; }
|
224 |
+
.sp-hue { left: 63%; }
|
225 |
+
.sp-fill { padding-top: 60%; }
|
226 |
+
}
|
227 |
+
.sp-dragger {
|
228 |
+
border-radius: 5px;
|
229 |
+
height: 5px;
|
230 |
+
width: 5px;
|
231 |
+
border: 1px solid #fff;
|
232 |
+
background: #000;
|
233 |
+
cursor: pointer;
|
234 |
+
position:absolute;
|
235 |
+
top:0;
|
236 |
+
left: 0;
|
237 |
+
}
|
238 |
+
.sp-slider {
|
239 |
+
position: absolute;
|
240 |
+
top:0;
|
241 |
+
cursor:pointer;
|
242 |
+
height: 3px;
|
243 |
+
left: -1px;
|
244 |
+
right: -1px;
|
245 |
+
border: 1px solid #000;
|
246 |
+
background: white;
|
247 |
+
opacity: .8;
|
248 |
+
}
|
249 |
+
|
250 |
+
/*
|
251 |
+
Theme authors:
|
252 |
+
Here are the basic themeable display options (colors, fonts, global widths).
|
253 |
+
See http://bgrins.github.io/spectrum/themes/ for instructions.
|
254 |
+
*/
|
255 |
+
|
256 |
+
.sp-container {
|
257 |
+
border-radius: 0;
|
258 |
+
background-color: #ECECEC;
|
259 |
+
border: solid 1px #f0c49B;
|
260 |
+
padding: 0;
|
261 |
+
}
|
262 |
+
.sp-container, .sp-container button, .sp-container input, .sp-color, .sp-hue, .sp-clear {
|
263 |
+
font: normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
|
264 |
+
-webkit-box-sizing: border-box;
|
265 |
+
-moz-box-sizing: border-box;
|
266 |
+
-ms-box-sizing: border-box;
|
267 |
+
box-sizing: border-box;
|
268 |
+
}
|
269 |
+
.sp-top {
|
270 |
+
margin-bottom: 3px;
|
271 |
+
}
|
272 |
+
.sp-color, .sp-hue, .sp-clear {
|
273 |
+
border: solid 1px #666;
|
274 |
+
}
|
275 |
+
|
276 |
+
/* Input */
|
277 |
+
.sp-input-container {
|
278 |
+
float:right;
|
279 |
+
width: 100px;
|
280 |
+
margin-bottom: 4px;
|
281 |
+
}
|
282 |
+
.sp-initial-disabled .sp-input-container {
|
283 |
+
width: 100%;
|
284 |
+
}
|
285 |
+
.sp-input {
|
286 |
+
font-size: 12px !important;
|
287 |
+
border: 1px inset;
|
288 |
+
padding: 4px 5px;
|
289 |
+
margin: 0;
|
290 |
+
width: 100%;
|
291 |
+
background:transparent;
|
292 |
+
border-radius: 3px;
|
293 |
+
color: #222;
|
294 |
+
}
|
295 |
+
.sp-input:focus {
|
296 |
+
border: 1px solid orange;
|
297 |
+
}
|
298 |
+
.sp-input.sp-validation-error {
|
299 |
+
border: 1px solid red;
|
300 |
+
background: #fdd;
|
301 |
+
}
|
302 |
+
.sp-picker-container , .sp-palette-container {
|
303 |
+
float:left;
|
304 |
+
position: relative;
|
305 |
+
padding: 10px;
|
306 |
+
padding-bottom: 300px;
|
307 |
+
margin-bottom: -290px;
|
308 |
+
}
|
309 |
+
.sp-picker-container {
|
310 |
+
width: 172px;
|
311 |
+
border-left: solid 1px #fff;
|
312 |
+
}
|
313 |
+
|
314 |
+
/* Palettes */
|
315 |
+
.sp-palette-container {
|
316 |
+
border-right: solid 1px #ccc;
|
317 |
+
}
|
318 |
+
|
319 |
+
.sp-palette-only .sp-palette-container {
|
320 |
+
border: 0;
|
321 |
+
}
|
322 |
+
|
323 |
+
.sp-palette .sp-thumb-el {
|
324 |
+
display: block;
|
325 |
+
position:relative;
|
326 |
+
float:left;
|
327 |
+
width: 24px;
|
328 |
+
height: 15px;
|
329 |
+
margin: 3px;
|
330 |
+
cursor: pointer;
|
331 |
+
border:solid 2px transparent;
|
332 |
+
}
|
333 |
+
.sp-palette .sp-thumb-el:hover, .sp-palette .sp-thumb-el.sp-thumb-active {
|
334 |
+
border-color: orange;
|
335 |
+
}
|
336 |
+
.sp-thumb-el {
|
337 |
+
position:relative;
|
338 |
+
}
|
339 |
+
|
340 |
+
/* Initial */
|
341 |
+
.sp-initial {
|
342 |
+
float: left;
|
343 |
+
border: solid 1px #333;
|
344 |
+
}
|
345 |
+
.sp-initial span {
|
346 |
+
width: 30px;
|
347 |
+
height: 25px;
|
348 |
+
border:none;
|
349 |
+
display:block;
|
350 |
+
float:left;
|
351 |
+
margin:0;
|
352 |
+
}
|
353 |
+
|
354 |
+
.sp-initial .sp-clear-display {
|
355 |
+
background-position: center;
|
356 |
+
}
|
357 |
+
|
358 |
+
/* Buttons */
|
359 |
+
.sp-palette-button-container,
|
360 |
+
.sp-button-container {
|
361 |
+
float: right;
|
362 |
+
}
|
363 |
+
|
364 |
+
/* Replacer (the little preview div that shows up instead of the <input>) */
|
365 |
+
.sp-replacer {
|
366 |
+
margin:0;
|
367 |
+
overflow:hidden;
|
368 |
+
cursor:pointer;
|
369 |
+
padding: 4px;
|
370 |
+
display:inline-block;
|
371 |
+
*zoom: 1;
|
372 |
+
*display: inline;
|
373 |
+
border: solid 1px #91765d;
|
374 |
+
background: #eee;
|
375 |
+
color: #333;
|
376 |
+
vertical-align: middle;
|
377 |
+
}
|
378 |
+
.sp-replacer:hover, .sp-replacer.sp-active {
|
379 |
+
border-color: #F0C49B;
|
380 |
+
color: #111;
|
381 |
+
}
|
382 |
+
.sp-replacer.sp-disabled {
|
383 |
+
cursor:default;
|
384 |
+
border-color: silver;
|
385 |
+
color: silver;
|
386 |
+
}
|
387 |
+
.sp-dd {
|
388 |
+
padding: 2px 0;
|
389 |
+
height: 16px;
|
390 |
+
line-height: 16px;
|
391 |
+
float:left;
|
392 |
+
font-size:10px;
|
393 |
+
}
|
394 |
+
.sp-preview {
|
395 |
+
position:relative;
|
396 |
+
width:25px;
|
397 |
+
height: 20px;
|
398 |
+
border: solid 1px #222;
|
399 |
+
margin-right: 5px;
|
400 |
+
float:left;
|
401 |
+
z-index: 0;
|
402 |
+
}
|
403 |
+
|
404 |
+
.sp-palette {
|
405 |
+
*width: 220px;
|
406 |
+
max-width: 220px;
|
407 |
+
}
|
408 |
+
.sp-palette .sp-thumb-el {
|
409 |
+
width:16px;
|
410 |
+
height: 16px;
|
411 |
+
margin:2px 1px;
|
412 |
+
border: solid 1px #d0d0d0;
|
413 |
+
}
|
414 |
+
|
415 |
+
.sp-container {
|
416 |
+
padding-bottom:0;
|
417 |
+
}
|
418 |
+
|
419 |
+
|
420 |
+
/* Buttons: http://hellohappy.org/css3-buttons/ */
|
421 |
+
.sp-container button {
|
422 |
+
background-color: #eeeeee;
|
423 |
+
background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
|
424 |
+
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
|
425 |
+
background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
|
426 |
+
background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
|
427 |
+
background-image: linear-gradient(to bottom, #eeeeee, #cccccc);
|
428 |
+
border: 1px solid #ccc;
|
429 |
+
border-bottom: 1px solid #bbb;
|
430 |
+
border-radius: 3px;
|
431 |
+
color: #333;
|
432 |
+
font-size: 14px;
|
433 |
+
line-height: 1;
|
434 |
+
padding: 5px 4px;
|
435 |
+
text-align: center;
|
436 |
+
text-shadow: 0 1px 0 #eee;
|
437 |
+
vertical-align: middle;
|
438 |
+
}
|
439 |
+
.sp-container button:hover {
|
440 |
+
background-color: #dddddd;
|
441 |
+
background-image: -webkit-linear-gradient(top, #dddddd, #bbbbbb);
|
442 |
+
background-image: -moz-linear-gradient(top, #dddddd, #bbbbbb);
|
443 |
+
background-image: -ms-linear-gradient(top, #dddddd, #bbbbbb);
|
444 |
+
background-image: -o-linear-gradient(top, #dddddd, #bbbbbb);
|
445 |
+
background-image: linear-gradient(to bottom, #dddddd, #bbbbbb);
|
446 |
+
border: 1px solid #bbb;
|
447 |
+
border-bottom: 1px solid #999;
|
448 |
+
cursor: pointer;
|
449 |
+
text-shadow: 0 1px 0 #ddd;
|
450 |
+
}
|
451 |
+
.sp-container button:active {
|
452 |
+
border: 1px solid #aaa;
|
453 |
+
border-bottom: 1px solid #888;
|
454 |
+
-webkit-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
455 |
+
-moz-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
456 |
+
-ms-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
457 |
+
-o-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
458 |
+
box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
459 |
+
}
|
460 |
+
.sp-cancel {
|
461 |
+
font-size: 11px;
|
462 |
+
color: #d93f3f !important;
|
463 |
+
margin:0;
|
464 |
+
padding:2px;
|
465 |
+
margin-right: 5px;
|
466 |
+
vertical-align: middle;
|
467 |
+
text-decoration:none;
|
468 |
+
|
469 |
+
}
|
470 |
+
.sp-cancel:hover {
|
471 |
+
color: #d93f3f !important;
|
472 |
+
text-decoration: underline;
|
473 |
+
}
|
474 |
+
|
475 |
+
|
476 |
+
.sp-palette span:hover, .sp-palette span.sp-thumb-active {
|
477 |
+
border-color: #000;
|
478 |
+
}
|
479 |
+
|
480 |
+
.sp-preview, .sp-alpha, .sp-thumb-el {
|
481 |
+
position:relative;
|
482 |
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);
|
483 |
+
}
|
484 |
+
.sp-preview-inner, .sp-alpha-inner, .sp-thumb-inner {
|
485 |
+
display:block;
|
486 |
+
position:absolute;
|
487 |
+
top:0;left:0;bottom:0;right:0;
|
488 |
+
}
|
489 |
+
|
490 |
+
.sp-palette .sp-thumb-inner {
|
491 |
+
background-position: 50% 50%;
|
492 |
+
background-repeat: no-repeat;
|
493 |
+
}
|
494 |
+
|
495 |
+
.sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner {
|
496 |
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=);
|
497 |
+
}
|
498 |
+
|
499 |
+
.sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner {
|
500 |
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=);
|
501 |
+
}
|
502 |
+
|
503 |
+
.sp-clear-display {
|
504 |
+
background-repeat:no-repeat;
|
505 |
+
background-position: center;
|
506 |
+
background-image: url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==);
|
507 |
+
}
|
assets/spectrum/spectrum.js
ADDED
@@ -0,0 +1,2323 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Spectrum Colorpicker v1.8.0
|
2 |
+
// https://github.com/bgrins/spectrum
|
3 |
+
// Author: Brian Grinstead
|
4 |
+
// License: MIT
|
5 |
+
|
6 |
+
(function (factory) {
|
7 |
+
"use strict";
|
8 |
+
|
9 |
+
if (typeof define === 'function' && define.amd) { // AMD
|
10 |
+
define(['jquery'], factory);
|
11 |
+
}
|
12 |
+
else if (typeof exports == "object" && typeof module == "object") { // CommonJS
|
13 |
+
module.exports = factory(require('jquery'));
|
14 |
+
}
|
15 |
+
else { // Browser
|
16 |
+
factory(jQuery);
|
17 |
+
}
|
18 |
+
})(function($, undefined) {
|
19 |
+
"use strict";
|
20 |
+
|
21 |
+
var defaultOpts = {
|
22 |
+
|
23 |
+
// Callbacks
|
24 |
+
beforeShow: noop,
|
25 |
+
move: noop,
|
26 |
+
change: noop,
|
27 |
+
show: noop,
|
28 |
+
hide: noop,
|
29 |
+
|
30 |
+
// Options
|
31 |
+
color: false,
|
32 |
+
flat: false,
|
33 |
+
showInput: false,
|
34 |
+
allowEmpty: false,
|
35 |
+
showButtons: true,
|
36 |
+
clickoutFiresChange: true,
|
37 |
+
showInitial: false,
|
38 |
+
showPalette: false,
|
39 |
+
showPaletteOnly: false,
|
40 |
+
hideAfterPaletteSelect: false,
|
41 |
+
togglePaletteOnly: false,
|
42 |
+
showSelectionPalette: true,
|
43 |
+
localStorageKey: false,
|
44 |
+
appendTo: "body",
|
45 |
+
maxSelectionSize: 7,
|
46 |
+
cancelText: "cancel",
|
47 |
+
chooseText: "choose",
|
48 |
+
togglePaletteMoreText: "more",
|
49 |
+
togglePaletteLessText: "less",
|
50 |
+
clearText: "Clear Color Selection",
|
51 |
+
noColorSelectedText: "No Color Selected",
|
52 |
+
preferredFormat: false,
|
53 |
+
className: "", // Deprecated - use containerClassName and replacerClassName instead.
|
54 |
+
containerClassName: "",
|
55 |
+
replacerClassName: "",
|
56 |
+
showAlpha: false,
|
57 |
+
theme: "sp-light",
|
58 |
+
palette: [["#ffffff", "#000000", "#ff0000", "#ff8000", "#ffff00", "#008000", "#0000ff", "#4b0082", "#9400d3"]],
|
59 |
+
selectionPalette: [],
|
60 |
+
disabled: false,
|
61 |
+
offset: null
|
62 |
+
},
|
63 |
+
spectrums = [],
|
64 |
+
IE = !!/msie/i.exec( window.navigator.userAgent ),
|
65 |
+
rgbaSupport = (function() {
|
66 |
+
function contains( str, substr ) {
|
67 |
+
return !!~('' + str).indexOf(substr);
|
68 |
+
}
|
69 |
+
|
70 |
+
var elem = document.createElement('div');
|
71 |
+
var style = elem.style;
|
72 |
+
style.cssText = 'background-color:rgba(0,0,0,.5)';
|
73 |
+
return contains(style.backgroundColor, 'rgba') || contains(style.backgroundColor, 'hsla');
|
74 |
+
})(),
|
75 |
+
replaceInput = [
|
76 |
+
"<div class='sp-replacer'>",
|
77 |
+
"<div class='sp-preview'><div class='sp-preview-inner'></div></div>",
|
78 |
+
"<div class='sp-dd'>▼</div>",
|
79 |
+
"</div>"
|
80 |
+
].join(''),
|
81 |
+
markup = (function () {
|
82 |
+
|
83 |
+
// IE does not support gradients with multiple stops, so we need to simulate
|
84 |
+
// that for the rainbow slider with 8 divs that each have a single gradient
|
85 |
+
var gradientFix = "";
|
86 |
+
if (IE) {
|
87 |
+
for (var i = 1; i <= 6; i++) {
|
88 |
+
gradientFix += "<div class='sp-" + i + "'></div>";
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
return [
|
93 |
+
"<div class='sp-container sp-hidden'>",
|
94 |
+
"<div class='sp-palette-container'>",
|
95 |
+
"<div class='sp-palette sp-thumb sp-cf'></div>",
|
96 |
+
"<div class='sp-palette-button-container sp-cf'>",
|
97 |
+
"<button type='button' class='sp-palette-toggle'></button>",
|
98 |
+
"</div>",
|
99 |
+
"</div>",
|
100 |
+
"<div class='sp-picker-container'>",
|
101 |
+
"<div class='sp-top sp-cf'>",
|
102 |
+
"<div class='sp-fill'></div>",
|
103 |
+
"<div class='sp-top-inner'>",
|
104 |
+
"<div class='sp-color'>",
|
105 |
+
"<div class='sp-sat'>",
|
106 |
+
"<div class='sp-val'>",
|
107 |
+
"<div class='sp-dragger'></div>",
|
108 |
+
"</div>",
|
109 |
+
"</div>",
|
110 |
+
"</div>",
|
111 |
+
"<div class='sp-clear sp-clear-display'>",
|
112 |
+
"</div>",
|
113 |
+
"<div class='sp-hue'>",
|
114 |
+
"<div class='sp-slider'></div>",
|
115 |
+
gradientFix,
|
116 |
+
"</div>",
|
117 |
+
"</div>",
|
118 |
+
"<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>",
|
119 |
+
"</div>",
|
120 |
+
"<div class='sp-input-container sp-cf'>",
|
121 |
+
"<input class='sp-input' type='text' spellcheck='false' />",
|
122 |
+
"</div>",
|
123 |
+
"<div class='sp-initial sp-thumb sp-cf'></div>",
|
124 |
+
"<div class='sp-button-container sp-cf'>",
|
125 |
+
"<a class='sp-cancel' href='#'></a>",
|
126 |
+
"<button type='button' class='sp-choose'></button>",
|
127 |
+
"</div>",
|
128 |
+
"</div>",
|
129 |
+
"</div>"
|
130 |
+
].join("");
|
131 |
+
})();
|
132 |
+
|
133 |
+
function paletteTemplate (p, color, className, opts) {
|
134 |
+
var html = [];
|
135 |
+
for (var i = 0; i < p.length; i++) {
|
136 |
+
var current = p[i];
|
137 |
+
if(current) {
|
138 |
+
var tiny = tinycolor(current);
|
139 |
+
var c = tiny.toHsl().l < 0.5 ? "sp-thumb-el sp-thumb-dark" : "sp-thumb-el sp-thumb-light";
|
140 |
+
c += (tinycolor.equals(color, current)) ? " sp-thumb-active" : "";
|
141 |
+
var formattedString = tiny.toString(opts.preferredFormat || "rgb");
|
142 |
+
var swatchStyle = rgbaSupport ? ("background-color:" + tiny.toRgbString()) : "filter:" + tiny.toFilter();
|
143 |
+
html.push('<span title="' + formattedString + '" data-color="' + tiny.toRgbString() + '" class="' + c + '"><span class="sp-thumb-inner" style="' + swatchStyle + ';" /></span>');
|
144 |
+
} else {
|
145 |
+
var cls = 'sp-clear-display';
|
146 |
+
html.push($('<div />')
|
147 |
+
.append($('<span data-color="" style="background-color:transparent;" class="' + cls + '"></span>')
|
148 |
+
.attr('title', opts.noColorSelectedText)
|
149 |
+
)
|
150 |
+
.html()
|
151 |
+
);
|
152 |
+
}
|
153 |
+
}
|
154 |
+
return "<div class='sp-cf " + className + "'>" + html.join('') + "</div>";
|
155 |
+
}
|
156 |
+
|
157 |
+
function hideAll() {
|
158 |
+
for (var i = 0; i < spectrums.length; i++) {
|
159 |
+
if (spectrums[i]) {
|
160 |
+
spectrums[i].hide();
|
161 |
+
}
|
162 |
+
}
|
163 |
+
}
|
164 |
+
|
165 |
+
function instanceOptions(o, callbackContext) {
|
166 |
+
var opts = $.extend({}, defaultOpts, o);
|
167 |
+
opts.callbacks = {
|
168 |
+
'move': bind(opts.move, callbackContext),
|
169 |
+
'change': bind(opts.change, callbackContext),
|
170 |
+
'show': bind(opts.show, callbackContext),
|
171 |
+
'hide': bind(opts.hide, callbackContext),
|
172 |
+
'beforeShow': bind(opts.beforeShow, callbackContext)
|
173 |
+
};
|
174 |
+
|
175 |
+
return opts;
|
176 |
+
}
|
177 |
+
|
178 |
+
function spectrum(element, o) {
|
179 |
+
|
180 |
+
var opts = instanceOptions(o, element),
|
181 |
+
flat = opts.flat,
|
182 |
+
showSelectionPalette = opts.showSelectionPalette,
|
183 |
+
localStorageKey = opts.localStorageKey,
|
184 |
+
theme = opts.theme,
|
185 |
+
callbacks = opts.callbacks,
|
186 |
+
resize = throttle(reflow, 10),
|
187 |
+
visible = false,
|
188 |
+
isDragging = false,
|
189 |
+
dragWidth = 0,
|
190 |
+
dragHeight = 0,
|
191 |
+
dragHelperHeight = 0,
|
192 |
+
slideHeight = 0,
|
193 |
+
slideWidth = 0,
|
194 |
+
alphaWidth = 0,
|
195 |
+
alphaSlideHelperWidth = 0,
|
196 |
+
slideHelperHeight = 0,
|
197 |
+
currentHue = 0,
|
198 |
+
currentSaturation = 0,
|
199 |
+
currentValue = 0,
|
200 |
+
currentAlpha = 1,
|
201 |
+
palette = [],
|
202 |
+
paletteArray = [],
|
203 |
+
paletteLookup = {},
|
204 |
+
selectionPalette = opts.selectionPalette.slice(0),
|
205 |
+
maxSelectionSize = opts.maxSelectionSize,
|
206 |
+
draggingClass = "sp-dragging",
|
207 |
+
shiftMovementDirection = null;
|
208 |
+
|
209 |
+
var doc = element.ownerDocument,
|
210 |
+
body = doc.body,
|
211 |
+
boundElement = $(element),
|
212 |
+
disabled = false,
|
213 |
+
container = $(markup, doc).addClass(theme),
|
214 |
+
pickerContainer = container.find(".sp-picker-container"),
|
215 |
+
dragger = container.find(".sp-color"),
|
216 |
+
dragHelper = container.find(".sp-dragger"),
|
217 |
+
slider = container.find(".sp-hue"),
|
218 |
+
slideHelper = container.find(".sp-slider"),
|
219 |
+
alphaSliderInner = container.find(".sp-alpha-inner"),
|
220 |
+
alphaSlider = container.find(".sp-alpha"),
|
221 |
+
alphaSlideHelper = container.find(".sp-alpha-handle"),
|
222 |
+
textInput = container.find(".sp-input"),
|
223 |
+
paletteContainer = container.find(".sp-palette"),
|
224 |
+
initialColorContainer = container.find(".sp-initial"),
|
225 |
+
cancelButton = container.find(".sp-cancel"),
|
226 |
+
clearButton = container.find(".sp-clear"),
|
227 |
+
chooseButton = container.find(".sp-choose"),
|
228 |
+
toggleButton = container.find(".sp-palette-toggle"),
|
229 |
+
isInput = boundElement.is("input"),
|
230 |
+
isInputTypeColor = isInput && boundElement.attr("type") === "color" && inputTypeColorSupport(),
|
231 |
+
shouldReplace = isInput && !flat,
|
232 |
+
replacer = (shouldReplace) ? $(replaceInput).addClass(theme).addClass(opts.className).addClass(opts.replacerClassName) : $([]),
|
233 |
+
offsetElement = (shouldReplace) ? replacer : boundElement,
|
234 |
+
previewElement = replacer.find(".sp-preview-inner"),
|
235 |
+
initialColor = opts.color || (isInput && boundElement.val()),
|
236 |
+
colorOnShow = false,
|
237 |
+
currentPreferredFormat = opts.preferredFormat,
|
238 |
+
clickoutFiresChange = !opts.showButtons || opts.clickoutFiresChange,
|
239 |
+
isEmpty = !initialColor,
|
240 |
+
allowEmpty = opts.allowEmpty && !isInputTypeColor;
|
241 |
+
|
242 |
+
function applyOptions() {
|
243 |
+
|
244 |
+
if (opts.showPaletteOnly) {
|
245 |
+
opts.showPalette = true;
|
246 |
+
}
|
247 |
+
|
248 |
+
toggleButton.text(opts.showPaletteOnly ? opts.togglePaletteMoreText : opts.togglePaletteLessText);
|
249 |
+
|
250 |
+
if (opts.palette) {
|
251 |
+
palette = opts.palette.slice(0);
|
252 |
+
paletteArray = $.isArray(palette[0]) ? palette : [palette];
|
253 |
+
paletteLookup = {};
|
254 |
+
for (var i = 0; i < paletteArray.length; i++) {
|
255 |
+
for (var j = 0; j < paletteArray[i].length; j++) {
|
256 |
+
var rgb = tinycolor(paletteArray[i][j]).toRgbString();
|
257 |
+
paletteLookup[rgb] = true;
|
258 |
+
}
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
container.toggleClass("sp-flat", flat);
|
263 |
+
container.toggleClass("sp-input-disabled", !opts.showInput);
|
264 |
+
container.toggleClass("sp-alpha-enabled", opts.showAlpha);
|
265 |
+
container.toggleClass("sp-clear-enabled", allowEmpty);
|
266 |
+
container.toggleClass("sp-buttons-disabled", !opts.showButtons);
|
267 |
+
container.toggleClass("sp-palette-buttons-disabled", !opts.togglePaletteOnly);
|
268 |
+
container.toggleClass("sp-palette-disabled", !opts.showPalette);
|
269 |
+
container.toggleClass("sp-palette-only", opts.showPaletteOnly);
|
270 |
+
container.toggleClass("sp-initial-disabled", !opts.showInitial);
|
271 |
+
container.addClass(opts.className).addClass(opts.containerClassName);
|
272 |
+
|
273 |
+
reflow();
|
274 |
+
}
|
275 |
+
|
276 |
+
function initialize() {
|
277 |
+
|
278 |
+
if (IE) {
|
279 |
+
container.find("*:not(input)").attr("unselectable", "on");
|
280 |
+
}
|
281 |
+
|
282 |
+
applyOptions();
|
283 |
+
|
284 |
+
if (shouldReplace) {
|
285 |
+
boundElement.after(replacer).hide();
|
286 |
+
}
|
287 |
+
|
288 |
+
if (!allowEmpty) {
|
289 |
+
clearButton.hide();
|
290 |
+
}
|
291 |
+
|
292 |
+
if (flat) {
|
293 |
+
boundElement.after(container).hide();
|
294 |
+
}
|
295 |
+
else {
|
296 |
+
|
297 |
+
var appendTo = opts.appendTo === "parent" ? boundElement.parent() : $(opts.appendTo);
|
298 |
+
if (appendTo.length !== 1) {
|
299 |
+
appendTo = $("body");
|
300 |
+
}
|
301 |
+
|
302 |
+
appendTo.append(container);
|
303 |
+
}
|
304 |
+
|
305 |
+
updateSelectionPaletteFromStorage();
|
306 |
+
|
307 |
+
offsetElement.bind("click.spectrum touchstart.spectrum", function (e) {
|
308 |
+
if (!disabled) {
|
309 |
+
toggle();
|
310 |
+
}
|
311 |
+
|
312 |
+
e.stopPropagation();
|
313 |
+
|
314 |
+
if (!$(e.target).is("input")) {
|
315 |
+
e.preventDefault();
|
316 |
+
}
|
317 |
+
});
|
318 |
+
|
319 |
+
if(boundElement.is(":disabled") || (opts.disabled === true)) {
|
320 |
+
disable();
|
321 |
+
}
|
322 |
+
|
323 |
+
// Prevent clicks from bubbling up to document. This would cause it to be hidden.
|
324 |
+
container.click(stopPropagation);
|
325 |
+
|
326 |
+
// Handle user typed input
|
327 |
+
textInput.change(setFromTextInput);
|
328 |
+
textInput.bind("paste", function () {
|
329 |
+
setTimeout(setFromTextInput, 1);
|
330 |
+
});
|
331 |
+
textInput.keydown(function (e) { if (e.keyCode == 13) { setFromTextInput(); } });
|
332 |
+
|
333 |
+
cancelButton.text(opts.cancelText);
|
334 |
+
cancelButton.bind("click.spectrum", function (e) {
|
335 |
+
e.stopPropagation();
|
336 |
+
e.preventDefault();
|
337 |
+
revert();
|
338 |
+
hide();
|
339 |
+
});
|
340 |
+
|
341 |
+
clearButton.attr("title", opts.clearText);
|
342 |
+
clearButton.bind("click.spectrum", function (e) {
|
343 |
+
e.stopPropagation();
|
344 |
+
e.preventDefault();
|
345 |
+
isEmpty = true;
|
346 |
+
move();
|
347 |
+
|
348 |
+
if(flat) {
|
349 |
+
//for the flat style, this is a change event
|
350 |
+
updateOriginalInput(true);
|
351 |
+
}
|
352 |
+
});
|
353 |
+
|
354 |
+
chooseButton.text(opts.chooseText);
|
355 |
+
chooseButton.bind("click.spectrum", function (e) {
|
356 |
+
e.stopPropagation();
|
357 |
+
e.preventDefault();
|
358 |
+
|
359 |
+
if (IE && textInput.is(":focus")) {
|
360 |
+
textInput.trigger('change');
|
361 |
+
}
|
362 |
+
|
363 |
+
if (isValid()) {
|
364 |
+
updateOriginalInput(true);
|
365 |
+
hide();
|
366 |
+
}
|
367 |
+
});
|
368 |
+
|
369 |
+
toggleButton.text(opts.showPaletteOnly ? opts.togglePaletteMoreText : opts.togglePaletteLessText);
|
370 |
+
toggleButton.bind("click.spectrum", function (e) {
|
371 |
+
e.stopPropagation();
|
372 |
+
e.preventDefault();
|
373 |
+
|
374 |
+
opts.showPaletteOnly = !opts.showPaletteOnly;
|
375 |
+
|
376 |
+
// To make sure the Picker area is drawn on the right, next to the
|
377 |
+
// Palette area (and not below the palette), first move the Palette
|
378 |
+
// to the left to make space for the picker, plus 5px extra.
|
379 |
+
// The 'applyOptions' function puts the whole container back into place
|
380 |
+
// and takes care of the button-text and the sp-palette-only CSS class.
|
381 |
+
if (!opts.showPaletteOnly && !flat) {
|
382 |
+
container.css('left', '-=' + (pickerContainer.outerWidth(true) + 5));
|
383 |
+
}
|
384 |
+
applyOptions();
|
385 |
+
});
|
386 |
+
|
387 |
+
draggable(alphaSlider, function (dragX, dragY, e) {
|
388 |
+
currentAlpha = (dragX / alphaWidth);
|
389 |
+
isEmpty = false;
|
390 |
+
if (e.shiftKey) {
|
391 |
+
currentAlpha = Math.round(currentAlpha * 10) / 10;
|
392 |
+
}
|
393 |
+
|
394 |
+
move();
|
395 |
+
}, dragStart, dragStop);
|
396 |
+
|
397 |
+
draggable(slider, function (dragX, dragY) {
|
398 |
+
currentHue = parseFloat(dragY / slideHeight);
|
399 |
+
isEmpty = false;
|
400 |
+
if (!opts.showAlpha) {
|
401 |
+
currentAlpha = 1;
|
402 |
+
}
|
403 |
+
move();
|
404 |
+
}, dragStart, dragStop);
|
405 |
+
|
406 |
+
draggable(dragger, function (dragX, dragY, e) {
|
407 |
+
|
408 |
+
// shift+drag should snap the movement to either the x or y axis.
|
409 |
+
if (!e.shiftKey) {
|
410 |
+
shiftMovementDirection = null;
|
411 |
+
}
|
412 |
+
else if (!shiftMovementDirection) {
|
413 |
+
var oldDragX = currentSaturation * dragWidth;
|
414 |
+
var oldDragY = dragHeight - (currentValue * dragHeight);
|
415 |
+
var furtherFromX = Math.abs(dragX - oldDragX) > Math.abs(dragY - oldDragY);
|
416 |
+
|
417 |
+
shiftMovementDirection = furtherFromX ? "x" : "y";
|
418 |
+
}
|
419 |
+
|
420 |
+
var setSaturation = !shiftMovementDirection || shiftMovementDirection === "x";
|
421 |
+
var setValue = !shiftMovementDirection || shiftMovementDirection === "y";
|
422 |
+
|
423 |
+
if (setSaturation) {
|
424 |
+
currentSaturation = parseFloat(dragX / dragWidth);
|
425 |
+
}
|
426 |
+
if (setValue) {
|
427 |
+
currentValue = parseFloat((dragHeight - dragY) / dragHeight);
|
428 |
+
}
|
429 |
+
|
430 |
+
isEmpty = false;
|
431 |
+
if (!opts.showAlpha) {
|
432 |
+
currentAlpha = 1;
|
433 |
+
}
|
434 |
+
|
435 |
+
move();
|
436 |
+
|
437 |
+
}, dragStart, dragStop);
|
438 |
+
|
439 |
+
if (!!initialColor) {
|
440 |
+
set(initialColor);
|
441 |
+
|
442 |
+
// In case color was black - update the preview UI and set the format
|
443 |
+
// since the set function will not run (default color is black).
|
444 |
+
updateUI();
|
445 |
+
currentPreferredFormat = opts.preferredFormat || tinycolor(initialColor).format;
|
446 |
+
|
447 |
+
addColorToSelectionPalette(initialColor);
|
448 |
+
}
|
449 |
+
else {
|
450 |
+
updateUI();
|
451 |
+
}
|
452 |
+
|
453 |
+
if (flat) {
|
454 |
+
show();
|
455 |
+
}
|
456 |
+
|
457 |
+
function paletteElementClick(e) {
|
458 |
+
if (e.data && e.data.ignore) {
|
459 |
+
set($(e.target).closest(".sp-thumb-el").data("color"));
|
460 |
+
move();
|
461 |
+
}
|
462 |
+
else {
|
463 |
+
set($(e.target).closest(".sp-thumb-el").data("color"));
|
464 |
+
move();
|
465 |
+
updateOriginalInput(true);
|
466 |
+
if (opts.hideAfterPaletteSelect) {
|
467 |
+
hide();
|
468 |
+
}
|
469 |
+
}
|
470 |
+
|
471 |
+
return false;
|
472 |
+
}
|
473 |
+
|
474 |
+
var paletteEvent = IE ? "mousedown.spectrum" : "click.spectrum touchstart.spectrum";
|
475 |
+
paletteContainer.delegate(".sp-thumb-el", paletteEvent, paletteElementClick);
|
476 |
+
initialColorContainer.delegate(".sp-thumb-el:nth-child(1)", paletteEvent, { ignore: true }, paletteElementClick);
|
477 |
+
}
|
478 |
+
|
479 |
+
function updateSelectionPaletteFromStorage() {
|
480 |
+
|
481 |
+
if (localStorageKey && window.localStorage) {
|
482 |
+
|
483 |
+
// Migrate old palettes over to new format. May want to remove this eventually.
|
484 |
+
try {
|
485 |
+
var oldPalette = window.localStorage[localStorageKey].split(",#");
|
486 |
+
if (oldPalette.length > 1) {
|
487 |
+
delete window.localStorage[localStorageKey];
|
488 |
+
$.each(oldPalette, function(i, c) {
|
489 |
+
addColorToSelectionPalette(c);
|
490 |
+
});
|
491 |
+
}
|
492 |
+
}
|
493 |
+
catch(e) { }
|
494 |
+
|
495 |
+
try {
|
496 |
+
selectionPalette = window.localStorage[localStorageKey].split(";");
|
497 |
+
}
|
498 |
+
catch (e) { }
|
499 |
+
}
|
500 |
+
}
|
501 |
+
|
502 |
+
function addColorToSelectionPalette(color) {
|
503 |
+
if (showSelectionPalette) {
|
504 |
+
var rgb = tinycolor(color).toRgbString();
|
505 |
+
if (!paletteLookup[rgb] && $.inArray(rgb, selectionPalette) === -1) {
|
506 |
+
selectionPalette.push(rgb);
|
507 |
+
while(selectionPalette.length > maxSelectionSize) {
|
508 |
+
selectionPalette.shift();
|
509 |
+
}
|
510 |
+
}
|
511 |
+
|
512 |
+
if (localStorageKey && window.localStorage) {
|
513 |
+
try {
|
514 |
+
window.localStorage[localStorageKey] = selectionPalette.join(";");
|
515 |
+
}
|
516 |
+
catch(e) { }
|
517 |
+
}
|
518 |
+
}
|
519 |
+
}
|
520 |
+
|
521 |
+
function getUniqueSelectionPalette() {
|
522 |
+
var unique = [];
|
523 |
+
if (opts.showPalette) {
|
524 |
+
for (var i = 0; i < selectionPalette.length; i++) {
|
525 |
+
var rgb = tinycolor(selectionPalette[i]).toRgbString();
|
526 |
+
|
527 |
+
if (!paletteLookup[rgb]) {
|
528 |
+
unique.push(selectionPalette[i]);
|
529 |
+
}
|
530 |
+
}
|
531 |
+
}
|
532 |
+
|
533 |
+
return unique.reverse().slice(0, opts.maxSelectionSize);
|
534 |
+
}
|
535 |
+
|
536 |
+
function drawPalette() {
|
537 |
+
|
538 |
+
var currentColor = get();
|
539 |
+
|
540 |
+
var html = $.map(paletteArray, function (palette, i) {
|
541 |
+
return paletteTemplate(palette, currentColor, "sp-palette-row sp-palette-row-" + i, opts);
|
542 |
+
});
|
543 |
+
|
544 |
+
updateSelectionPaletteFromStorage();
|
545 |
+
|
546 |
+
if (selectionPalette) {
|
547 |
+
html.push(paletteTemplate(getUniqueSelectionPalette(), currentColor, "sp-palette-row sp-palette-row-selection", opts));
|
548 |
+
}
|
549 |
+
|
550 |
+
paletteContainer.html(html.join(""));
|
551 |
+
}
|
552 |
+
|
553 |
+
function drawInitial() {
|
554 |
+
if (opts.showInitial) {
|
555 |
+
var initial = colorOnShow;
|
556 |
+
var current = get();
|
557 |
+
initialColorContainer.html(paletteTemplate([initial, current], current, "sp-palette-row-initial", opts));
|
558 |
+
}
|
559 |
+
}
|
560 |
+
|
561 |
+
function dragStart() {
|
562 |
+
if (dragHeight <= 0 || dragWidth <= 0 || slideHeight <= 0) {
|
563 |
+
reflow();
|
564 |
+
}
|
565 |
+
isDragging = true;
|
566 |
+
container.addClass(draggingClass);
|
567 |
+
shiftMovementDirection = null;
|
568 |
+
boundElement.trigger('dragstart.spectrum', [ get() ]);
|
569 |
+
}
|
570 |
+
|
571 |
+
function dragStop() {
|
572 |
+
isDragging = false;
|
573 |
+
container.removeClass(draggingClass);
|
574 |
+
boundElement.trigger('dragstop.spectrum', [ get() ]);
|
575 |
+
}
|
576 |
+
|
577 |
+
function setFromTextInput() {
|
578 |
+
|
579 |
+
var value = textInput.val();
|
580 |
+
|
581 |
+
if ((value === null || value === "") && allowEmpty) {
|
582 |
+
set(null);
|
583 |
+
updateOriginalInput(true);
|
584 |
+
}
|
585 |
+
else {
|
586 |
+
var tiny = tinycolor(value);
|
587 |
+
if (tiny.isValid()) {
|
588 |
+
set(tiny);
|
589 |
+
updateOriginalInput(true);
|
590 |
+
}
|
591 |
+
else {
|
592 |
+
textInput.addClass("sp-validation-error");
|
593 |
+
}
|
594 |
+
}
|
595 |
+
}
|
596 |
+
|
597 |
+
function toggle() {
|
598 |
+
if (visible) {
|
599 |
+
hide();
|
600 |
+
}
|
601 |
+
else {
|
602 |
+
show();
|
603 |
+
}
|
604 |
+
}
|
605 |
+
|
606 |
+
function show() {
|
607 |
+
var event = $.Event('beforeShow.spectrum');
|
608 |
+
|
609 |
+
if (visible) {
|
610 |
+
reflow();
|
611 |
+
return;
|
612 |
+
}
|
613 |
+
|
614 |
+
boundElement.trigger(event, [ get() ]);
|
615 |
+
|
616 |
+
if (callbacks.beforeShow(get()) === false || event.isDefaultPrevented()) {
|
617 |
+
return;
|
618 |
+
}
|
619 |
+
|
620 |
+
hideAll();
|
621 |
+
visible = true;
|
622 |
+
|
623 |
+
$(doc).bind("keydown.spectrum", onkeydown);
|
624 |
+
$(doc).bind("click.spectrum", clickout);
|
625 |
+
$(window).bind("resize.spectrum", resize);
|
626 |
+
replacer.addClass("sp-active");
|
627 |
+
container.removeClass("sp-hidden");
|
628 |
+
|
629 |
+
reflow();
|
630 |
+
updateUI();
|
631 |
+
|
632 |
+
colorOnShow = get();
|
633 |
+
|
634 |
+
drawInitial();
|
635 |
+
callbacks.show(colorOnShow);
|
636 |
+
boundElement.trigger('show.spectrum', [ colorOnShow ]);
|
637 |
+
}
|
638 |
+
|
639 |
+
function onkeydown(e) {
|
640 |
+
// Close on ESC
|
641 |
+
if (e.keyCode === 27) {
|
642 |
+
hide();
|
643 |
+
}
|
644 |
+
}
|
645 |
+
|
646 |
+
function clickout(e) {
|
647 |
+
// Return on right click.
|
648 |
+
if (e.button == 2) { return; }
|
649 |
+
|
650 |
+
// If a drag event was happening during the mouseup, don't hide
|
651 |
+
// on click.
|
652 |
+
if (isDragging) { return; }
|
653 |
+
|
654 |
+
if (clickoutFiresChange) {
|
655 |
+
updateOriginalInput(true);
|
656 |
+
}
|
657 |
+
else {
|
658 |
+
revert();
|
659 |
+
}
|
660 |
+
hide();
|
661 |
+
}
|
662 |
+
|
663 |
+
function hide() {
|
664 |
+
// Return if hiding is unnecessary
|
665 |
+
if (!visible || flat) { return; }
|
666 |
+
visible = false;
|
667 |
+
|
668 |
+
$(doc).unbind("keydown.spectrum", onkeydown);
|
669 |
+
$(doc).unbind("click.spectrum", clickout);
|
670 |
+
$(window).unbind("resize.spectrum", resize);
|
671 |
+
|
672 |
+
replacer.removeClass("sp-active");
|
673 |
+
container.addClass("sp-hidden");
|
674 |
+
|
675 |
+
callbacks.hide(get());
|
676 |
+
boundElement.trigger('hide.spectrum', [ get() ]);
|
677 |
+
}
|
678 |
+
|
679 |
+
function revert() {
|
680 |
+
set(colorOnShow, true);
|
681 |
+
}
|
682 |
+
|
683 |
+
function set(color, ignoreFormatChange) {
|
684 |
+
if (tinycolor.equals(color, get())) {
|
685 |
+
// Update UI just in case a validation error needs
|
686 |
+
// to be cleared.
|
687 |
+
updateUI();
|
688 |
+
return;
|
689 |
+
}
|
690 |
+
|
691 |
+
var newColor, newHsv;
|
692 |
+
if (!color && allowEmpty) {
|
693 |
+
isEmpty = true;
|
694 |
+
} else {
|
695 |
+
isEmpty = false;
|
696 |
+
newColor = tinycolor(color);
|
697 |
+
newHsv = newColor.toHsv();
|
698 |
+
|
699 |
+
currentHue = (newHsv.h % 360) / 360;
|
700 |
+
currentSaturation = newHsv.s;
|
701 |
+
currentValue = newHsv.v;
|
702 |
+
currentAlpha = newHsv.a;
|
703 |
+
}
|
704 |
+
updateUI();
|
705 |
+
|
706 |
+
if (newColor && newColor.isValid() && !ignoreFormatChange) {
|
707 |
+
currentPreferredFormat = opts.preferredFormat || newColor.getFormat();
|
708 |
+
}
|
709 |
+
}
|
710 |
+
|
711 |
+
function get(opts) {
|
712 |
+
opts = opts || { };
|
713 |
+
|
714 |
+
if (allowEmpty && isEmpty) {
|
715 |
+
return null;
|
716 |
+
}
|
717 |
+
|
718 |
+
return tinycolor.fromRatio({
|
719 |
+
h: currentHue,
|
720 |
+
s: currentSaturation,
|
721 |
+
v: currentValue,
|
722 |
+
a: Math.round(currentAlpha * 100) / 100
|
723 |
+
}, { format: opts.format || currentPreferredFormat });
|
724 |
+
}
|
725 |
+
|
726 |
+
function isValid() {
|
727 |
+
return !textInput.hasClass("sp-validation-error");
|
728 |
+
}
|
729 |
+
|
730 |
+
function move() {
|
731 |
+
updateUI();
|
732 |
+
|
733 |
+
callbacks.move(get());
|
734 |
+
boundElement.trigger('move.spectrum', [ get() ]);
|
735 |
+
}
|
736 |
+
|
737 |
+
function updateUI() {
|
738 |
+
|
739 |
+
textInput.removeClass("sp-validation-error");
|
740 |
+
|
741 |
+
updateHelperLocations();
|
742 |
+
|
743 |
+
// Update dragger background color (gradients take care of saturation and value).
|
744 |
+
var flatColor = tinycolor.fromRatio({ h: currentHue, s: 1, v: 1 });
|
745 |
+
dragger.css("background-color", flatColor.toHexString());
|
746 |
+
|
747 |
+
// Get a format that alpha will be included in (hex and names ignore alpha)
|
748 |
+
var format = currentPreferredFormat;
|
749 |
+
if (currentAlpha < 1 && !(currentAlpha === 0 && format === "name")) {
|
750 |
+
if (format === "hex" || format === "hex3" || format === "hex6" || format === "name") {
|
751 |
+
format = "rgb";
|
752 |
+
}
|
753 |
+
}
|
754 |
+
|
755 |
+
var realColor = get({ format: format }),
|
756 |
+
displayColor = '';
|
757 |
+
|
758 |
+
//reset background info for preview element
|
759 |
+
previewElement.removeClass("sp-clear-display");
|
760 |
+
previewElement.css('background-color', 'transparent');
|
761 |
+
|
762 |
+
if (!realColor && allowEmpty) {
|
763 |
+
// Update the replaced elements background with icon indicating no color selection
|
764 |
+
previewElement.addClass("sp-clear-display");
|
765 |
+
}
|
766 |
+
else {
|
767 |
+
var realHex = realColor.toHexString(),
|
768 |
+
realRgb = realColor.toRgbString();
|
769 |
+
|
770 |
+
// Update the replaced elements background color (with actual selected color)
|
771 |
+
if (rgbaSupport || realColor.alpha === 1) {
|
772 |
+
previewElement.css("background-color", realRgb);
|
773 |
+
}
|
774 |
+
else {
|
775 |
+
previewElement.css("background-color", "transparent");
|
776 |
+
previewElement.css("filter", realColor.toFilter());
|
777 |
+
}
|
778 |
+
|
779 |
+
if (opts.showAlpha) {
|
780 |
+
var rgb = realColor.toRgb();
|
781 |
+
rgb.a = 0;
|
782 |
+
var realAlpha = tinycolor(rgb).toRgbString();
|
783 |
+
var gradient = "linear-gradient(left, " + realAlpha + ", " + realHex + ")";
|
784 |
+
|
785 |
+
if (IE) {
|
786 |
+
alphaSliderInner.css("filter", tinycolor(realAlpha).toFilter({ gradientType: 1 }, realHex));
|
787 |
+
}
|
788 |
+
else {
|
789 |
+
alphaSliderInner.css("background", "-webkit-" + gradient);
|
790 |
+
alphaSliderInner.css("background", "-moz-" + gradient);
|
791 |
+
alphaSliderInner.css("background", "-ms-" + gradient);
|
792 |
+
// Use current syntax gradient on unprefixed property.
|
793 |
+
alphaSliderInner.css("background",
|
794 |
+
"linear-gradient(to right, " + realAlpha + ", " + realHex + ")");
|
795 |
+
}
|
796 |
+
}
|
797 |
+
|
798 |
+
displayColor = realColor.toString(format);
|
799 |
+
}
|
800 |
+
|
801 |
+
// Update the text entry input as it changes happen
|
802 |
+
if (opts.showInput) {
|
803 |
+
textInput.val(displayColor);
|
804 |
+
}
|
805 |
+
|
806 |
+
if (opts.showPalette) {
|
807 |
+
drawPalette();
|
808 |
+
}
|
809 |
+
|
810 |
+
drawInitial();
|
811 |
+
}
|
812 |
+
|
813 |
+
function updateHelperLocations() {
|
814 |
+
var s = currentSaturation;
|
815 |
+
var v = currentValue;
|
816 |
+
|
817 |
+
if(allowEmpty && isEmpty) {
|
818 |
+
//if selected color is empty, hide the helpers
|
819 |
+
alphaSlideHelper.hide();
|
820 |
+
slideHelper.hide();
|
821 |
+
dragHelper.hide();
|
822 |
+
}
|
823 |
+
else {
|
824 |
+
//make sure helpers are visible
|
825 |
+
alphaSlideHelper.show();
|
826 |
+
slideHelper.show();
|
827 |
+
dragHelper.show();
|
828 |
+
|
829 |
+
// Where to show the little circle in that displays your current selected color
|
830 |
+
var dragX = s * dragWidth;
|
831 |
+
var dragY = dragHeight - (v * dragHeight);
|
832 |
+
dragX = Math.max(
|
833 |
+
-dragHelperHeight,
|
834 |
+
Math.min(dragWidth - dragHelperHeight, dragX - dragHelperHeight)
|
835 |
+
);
|
836 |
+
dragY = Math.max(
|
837 |
+
-dragHelperHeight,
|
838 |
+
Math.min(dragHeight - dragHelperHeight, dragY - dragHelperHeight)
|
839 |
+
);
|
840 |
+
dragHelper.css({
|
841 |
+
"top": dragY + "px",
|
842 |
+
"left": dragX + "px"
|
843 |
+
});
|
844 |
+
|
845 |
+
var alphaX = currentAlpha * alphaWidth;
|
846 |
+
alphaSlideHelper.css({
|
847 |
+
"left": (alphaX - (alphaSlideHelperWidth / 2)) + "px"
|
848 |
+
});
|
849 |
+
|
850 |
+
// Where to show the bar that displays your current selected hue
|
851 |
+
var slideY = (currentHue) * slideHeight;
|
852 |
+
slideHelper.css({
|
853 |
+
"top": (slideY - slideHelperHeight) + "px"
|
854 |
+
});
|
855 |
+
}
|
856 |
+
}
|
857 |
+
|
858 |
+
function updateOriginalInput(fireCallback) {
|
859 |
+
var color = get(),
|
860 |
+
displayColor = '',
|
861 |
+
hasChanged = !tinycolor.equals(color, colorOnShow);
|
862 |
+
|
863 |
+
if (color) {
|
864 |
+
displayColor = color.toString(currentPreferredFormat);
|
865 |
+
// Update the selection palette with the current color
|
866 |
+
addColorToSelectionPalette(color);
|
867 |
+
}
|
868 |
+
|
869 |
+
if (isInput) {
|
870 |
+
boundElement.val(displayColor);
|
871 |
+
}
|
872 |
+
|
873 |
+
if (fireCallback && hasChanged) {
|
874 |
+
callbacks.change(color);
|
875 |
+
boundElement.trigger('change', [ color ]);
|
876 |
+
}
|
877 |
+
}
|
878 |
+
|
879 |
+
function reflow() {
|
880 |
+
if (!visible) {
|
881 |
+
return; // Calculations would be useless and wouldn't be reliable anyways
|
882 |
+
}
|
883 |
+
dragWidth = dragger.width();
|
884 |
+
dragHeight = dragger.height();
|
885 |
+
dragHelperHeight = dragHelper.height();
|
886 |
+
slideWidth = slider.width();
|
887 |
+
slideHeight = slider.height();
|
888 |
+
slideHelperHeight = slideHelper.height();
|
889 |
+
alphaWidth = alphaSlider.width();
|
890 |
+
alphaSlideHelperWidth = alphaSlideHelper.width();
|
891 |
+
|
892 |
+
if (!flat) {
|
893 |
+
container.css("position", "absolute");
|
894 |
+
if (opts.offset) {
|
895 |
+
container.offset(opts.offset);
|
896 |
+
} else {
|
897 |
+
container.offset(getOffset(container, offsetElement));
|
898 |
+
}
|
899 |
+
}
|
900 |
+
|
901 |
+
updateHelperLocations();
|
902 |
+
|
903 |
+
if (opts.showPalette) {
|
904 |
+
drawPalette();
|
905 |
+
}
|
906 |
+
|
907 |
+
boundElement.trigger('reflow.spectrum');
|
908 |
+
}
|
909 |
+
|
910 |
+
function destroy() {
|
911 |
+
boundElement.show();
|
912 |
+
offsetElement.unbind("click.spectrum touchstart.spectrum");
|
913 |
+
container.remove();
|
914 |
+
replacer.remove();
|
915 |
+
spectrums[spect.id] = null;
|
916 |
+
}
|
917 |
+
|
918 |
+
function option(optionName, optionValue) {
|
919 |
+
if (optionName === undefined) {
|
920 |
+
return $.extend({}, opts);
|
921 |
+
}
|
922 |
+
if (optionValue === undefined) {
|
923 |
+
return opts[optionName];
|
924 |
+
}
|
925 |
+
|
926 |
+
opts[optionName] = optionValue;
|
927 |
+
|
928 |
+
if (optionName === "preferredFormat") {
|
929 |
+
currentPreferredFormat = opts.preferredFormat;
|
930 |
+
}
|
931 |
+
applyOptions();
|
932 |
+
}
|
933 |
+
|
934 |
+
function enable() {
|
935 |
+
disabled = false;
|
936 |
+
boundElement.attr("disabled", false);
|
937 |
+
offsetElement.removeClass("sp-disabled");
|
938 |
+
}
|
939 |
+
|
940 |
+
function disable() {
|
941 |
+
hide();
|
942 |
+
disabled = true;
|
943 |
+
boundElement.attr("disabled", true);
|
944 |
+
offsetElement.addClass("sp-disabled");
|
945 |
+
}
|
946 |
+
|
947 |
+
function setOffset(coord) {
|
948 |
+
opts.offset = coord;
|
949 |
+
reflow();
|
950 |
+
}
|
951 |
+
|
952 |
+
initialize();
|
953 |
+
|
954 |
+
var spect = {
|
955 |
+
show: show,
|
956 |
+
hide: hide,
|
957 |
+
toggle: toggle,
|
958 |
+
reflow: reflow,
|
959 |
+
option: option,
|
960 |
+
enable: enable,
|
961 |
+
disable: disable,
|
962 |
+
offset: setOffset,
|
963 |
+
set: function (c) {
|
964 |
+
set(c);
|
965 |
+
updateOriginalInput();
|
966 |
+
},
|
967 |
+
get: get,
|
968 |
+
destroy: destroy,
|
969 |
+
container: container
|
970 |
+
};
|
971 |
+
|
972 |
+
spect.id = spectrums.push(spect) - 1;
|
973 |
+
|
974 |
+
return spect;
|
975 |
+
}
|
976 |
+
|
977 |
+
/**
|
978 |
+
* checkOffset - get the offset below/above and left/right element depending on screen position
|
979 |
+
* Thanks https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js
|
980 |
+
*/
|
981 |
+
function getOffset(picker, input) {
|
982 |
+
var extraY = 0;
|
983 |
+
var dpWidth = picker.outerWidth();
|
984 |
+
var dpHeight = picker.outerHeight();
|
985 |
+
var inputHeight = input.outerHeight();
|
986 |
+
var doc = picker[0].ownerDocument;
|
987 |
+
var docElem = doc.documentElement;
|
988 |
+
var viewWidth = docElem.clientWidth + $(doc).scrollLeft();
|
989 |
+
var viewHeight = docElem.clientHeight + $(doc).scrollTop();
|
990 |
+
var offset = input.offset();
|
991 |
+
offset.top += inputHeight;
|
992 |
+
|
993 |
+
offset.left -=
|
994 |
+
Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
|
995 |
+
Math.abs(offset.left + dpWidth - viewWidth) : 0);
|
996 |
+
|
997 |
+
offset.top -=
|
998 |
+
Math.min(offset.top, ((offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
|
999 |
+
Math.abs(dpHeight + inputHeight - extraY) : extraY));
|
1000 |
+
|
1001 |
+
return offset;
|
1002 |
+
}
|
1003 |
+
|
1004 |
+
/**
|
1005 |
+
* noop - do nothing
|
1006 |
+
*/
|
1007 |
+
function noop() {
|
1008 |
+
|
1009 |
+
}
|
1010 |
+
|
1011 |
+
/**
|
1012 |
+
* stopPropagation - makes the code only doing this a little easier to read in line
|
1013 |
+
*/
|
1014 |
+
function stopPropagation(e) {
|
1015 |
+
e.stopPropagation();
|
1016 |
+
}
|
1017 |
+
|
1018 |
+
/**
|
1019 |
+
* Create a function bound to a given object
|
1020 |
+
* Thanks to underscore.js
|
1021 |
+
*/
|
1022 |
+
function bind(func, obj) {
|
1023 |
+
var slice = Array.prototype.slice;
|
1024 |
+
var args = slice.call(arguments, 2);
|
1025 |
+
return function () {
|
1026 |
+
return func.apply(obj, args.concat(slice.call(arguments)));
|
1027 |
+
};
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
/**
|
1031 |
+
* Lightweight drag helper. Handles containment within the element, so that
|
1032 |
+
* when dragging, the x is within [0,element.width] and y is within [0,element.height]
|
1033 |
+
*/
|
1034 |
+
function draggable(element, onmove, onstart, onstop) {
|
1035 |
+
onmove = onmove || function () { };
|
1036 |
+
onstart = onstart || function () { };
|
1037 |
+
onstop = onstop || function () { };
|
1038 |
+
var doc = document;
|
1039 |
+
var dragging = false;
|
1040 |
+
var offset = {};
|
1041 |
+
var maxHeight = 0;
|
1042 |
+
var maxWidth = 0;
|
1043 |
+
var hasTouch = ('ontouchstart' in window);
|
1044 |
+
|
1045 |
+
var duringDragEvents = {};
|
1046 |
+
duringDragEvents["selectstart"] = prevent;
|
1047 |
+
duringDragEvents["dragstart"] = prevent;
|
1048 |
+
duringDragEvents["touchmove mousemove"] = move;
|
1049 |
+
duringDragEvents["touchend mouseup"] = stop;
|
1050 |
+
|
1051 |
+
function prevent(e) {
|
1052 |
+
if (e.stopPropagation) {
|
1053 |
+
e.stopPropagation();
|
1054 |
+
}
|
1055 |
+
if (e.preventDefault) {
|
1056 |
+
e.preventDefault();
|
1057 |
+
}
|
1058 |
+
e.returnValue = false;
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
function move(e) {
|
1062 |
+
if (dragging) {
|
1063 |
+
// Mouseup happened outside of window
|
1064 |
+
if (IE && doc.documentMode < 9 && !e.button) {
|
1065 |
+
return stop();
|
1066 |
+
}
|
1067 |
+
|
1068 |
+
var t0 = e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0];
|
1069 |
+
var pageX = t0 && t0.pageX || e.pageX;
|
1070 |
+
var pageY = t0 && t0.pageY || e.pageY;
|
1071 |
+
|
1072 |
+
var dragX = Math.max(0, Math.min(pageX - offset.left, maxWidth));
|
1073 |
+
var dragY = Math.max(0, Math.min(pageY - offset.top, maxHeight));
|
1074 |
+
|
1075 |
+
if (hasTouch) {
|
1076 |
+
// Stop scrolling in iOS
|
1077 |
+
prevent(e);
|
1078 |
+
}
|
1079 |
+
|
1080 |
+
onmove.apply(element, [dragX, dragY, e]);
|
1081 |
+
}
|
1082 |
+
}
|
1083 |
+
|
1084 |
+
function start(e) {
|
1085 |
+
var rightclick = (e.which) ? (e.which == 3) : (e.button == 2);
|
1086 |
+
|
1087 |
+
if (!rightclick && !dragging) {
|
1088 |
+
if (onstart.apply(element, arguments) !== false) {
|
1089 |
+
dragging = true;
|
1090 |
+
maxHeight = $(element).height();
|
1091 |
+
maxWidth = $(element).width();
|
1092 |
+
offset = $(element).offset();
|
1093 |
+
|
1094 |
+
$(doc).bind(duringDragEvents);
|
1095 |
+
$(doc.body).addClass("sp-dragging");
|
1096 |
+
|
1097 |
+
move(e);
|
1098 |
+
|
1099 |
+
prevent(e);
|
1100 |
+
}
|
1101 |
+
}
|
1102 |
+
}
|
1103 |
+
|
1104 |
+
function stop() {
|
1105 |
+
if (dragging) {
|
1106 |
+
$(doc).unbind(duringDragEvents);
|
1107 |
+
$(doc.body).removeClass("sp-dragging");
|
1108 |
+
|
1109 |
+
// Wait a tick before notifying observers to allow the click event
|
1110 |
+
// to fire in Chrome.
|
1111 |
+
setTimeout(function() {
|
1112 |
+
onstop.apply(element, arguments);
|
1113 |
+
}, 0);
|
1114 |
+
}
|
1115 |
+
dragging = false;
|
1116 |
+
}
|
1117 |
+
|
1118 |
+
$(element).bind("touchstart mousedown", start);
|
1119 |
+
}
|
1120 |
+
|
1121 |
+
function throttle(func, wait, debounce) {
|
1122 |
+
var timeout;
|
1123 |
+
return function () {
|
1124 |
+
var context = this, args = arguments;
|
1125 |
+
var throttler = function () {
|
1126 |
+
timeout = null;
|
1127 |
+
func.apply(context, args);
|
1128 |
+
};
|
1129 |
+
if (debounce) clearTimeout(timeout);
|
1130 |
+
if (debounce || !timeout) timeout = setTimeout(throttler, wait);
|
1131 |
+
};
|
1132 |
+
}
|
1133 |
+
|
1134 |
+
function inputTypeColorSupport() {
|
1135 |
+
return $.fn.spectrum.inputTypeColorSupport();
|
1136 |
+
}
|
1137 |
+
|
1138 |
+
/**
|
1139 |
+
* Define a jQuery plugin
|
1140 |
+
*/
|
1141 |
+
var dataID = "spectrum.id";
|
1142 |
+
$.fn.spectrum = function (opts, extra) {
|
1143 |
+
|
1144 |
+
if (typeof opts == "string") {
|
1145 |
+
|
1146 |
+
var returnValue = this;
|
1147 |
+
var args = Array.prototype.slice.call( arguments, 1 );
|
1148 |
+
|
1149 |
+
this.each(function () {
|
1150 |
+
var spect = spectrums[$(this).data(dataID)];
|
1151 |
+
if (spect) {
|
1152 |
+
var method = spect[opts];
|
1153 |
+
if (!method) {
|
1154 |
+
throw new Error( "Spectrum: no such method: '" + opts + "'" );
|
1155 |
+
}
|
1156 |
+
|
1157 |
+
if (opts == "get") {
|
1158 |
+
returnValue = spect.get();
|
1159 |
+
}
|
1160 |
+
else if (opts == "container") {
|
1161 |
+
returnValue = spect.container;
|
1162 |
+
}
|
1163 |
+
else if (opts == "option") {
|
1164 |
+
returnValue = spect.option.apply(spect, args);
|
1165 |
+
}
|
1166 |
+
else if (opts == "destroy") {
|
1167 |
+
spect.destroy();
|
1168 |
+
$(this).removeData(dataID);
|
1169 |
+
}
|
1170 |
+
else {
|
1171 |
+
method.apply(spect, args);
|
1172 |
+
}
|
1173 |
+
}
|
1174 |
+
});
|
1175 |
+
|
1176 |
+
return returnValue;
|
1177 |
+
}
|
1178 |
+
|
1179 |
+
// Initializing a new instance of spectrum
|
1180 |
+
return this.spectrum("destroy").each(function () {
|
1181 |
+
var options = $.extend({}, opts, $(this).data());
|
1182 |
+
var spect = spectrum(this, options);
|
1183 |
+
$(this).data(dataID, spect.id);
|
1184 |
+
});
|
1185 |
+
};
|
1186 |
+
|
1187 |
+
$.fn.spectrum.load = true;
|
1188 |
+
$.fn.spectrum.loadOpts = {};
|
1189 |
+
$.fn.spectrum.draggable = draggable;
|
1190 |
+
$.fn.spectrum.defaults = defaultOpts;
|
1191 |
+
$.fn.spectrum.inputTypeColorSupport = function inputTypeColorSupport() {
|
1192 |
+
if (typeof inputTypeColorSupport._cachedResult === "undefined") {
|
1193 |
+
var colorInput = $("<input type='color'/>")[0]; // if color element is supported, value will default to not null
|
1194 |
+
inputTypeColorSupport._cachedResult = colorInput.type === "color" && colorInput.value !== "";
|
1195 |
+
}
|
1196 |
+
return inputTypeColorSupport._cachedResult;
|
1197 |
+
};
|
1198 |
+
|
1199 |
+
$.spectrum = { };
|
1200 |
+
$.spectrum.localization = { };
|
1201 |
+
$.spectrum.palettes = { };
|
1202 |
+
|
1203 |
+
$.fn.spectrum.processNativeColorInputs = function () {
|
1204 |
+
var colorInputs = $("input[type=color]");
|
1205 |
+
if (colorInputs.length && !inputTypeColorSupport()) {
|
1206 |
+
colorInputs.spectrum({
|
1207 |
+
preferredFormat: "hex6"
|
1208 |
+
});
|
1209 |
+
}
|
1210 |
+
};
|
1211 |
+
|
1212 |
+
// TinyColor v1.1.2
|
1213 |
+
// https://github.com/bgrins/TinyColor
|
1214 |
+
// Brian Grinstead, MIT License
|
1215 |
+
|
1216 |
+
(function() {
|
1217 |
+
|
1218 |
+
var trimLeft = /^[\s,#]+/,
|
1219 |
+
trimRight = /\s+$/,
|
1220 |
+
tinyCounter = 0,
|
1221 |
+
math = Math,
|
1222 |
+
mathRound = math.round,
|
1223 |
+
mathMin = math.min,
|
1224 |
+
mathMax = math.max,
|
1225 |
+
mathRandom = math.random;
|
1226 |
+
|
1227 |
+
var tinycolor = function(color, opts) {
|
1228 |
+
|
1229 |
+
color = (color) ? color : '';
|
1230 |
+
opts = opts || { };
|
1231 |
+
|
1232 |
+
// If input is already a tinycolor, return itself
|
1233 |
+
if (color instanceof tinycolor) {
|
1234 |
+
return color;
|
1235 |
+
}
|
1236 |
+
// If we are called as a function, call using new instead
|
1237 |
+
if (!(this instanceof tinycolor)) {
|
1238 |
+
return new tinycolor(color, opts);
|
1239 |
+
}
|
1240 |
+
|
1241 |
+
var rgb = inputToRGB(color);
|
1242 |
+
this._originalInput = color,
|
1243 |
+
this._r = rgb.r,
|
1244 |
+
this._g = rgb.g,
|
1245 |
+
this._b = rgb.b,
|
1246 |
+
this._a = rgb.a,
|
1247 |
+
this._roundA = mathRound(100*this._a) / 100,
|
1248 |
+
this._format = opts.format || rgb.format;
|
1249 |
+
this._gradientType = opts.gradientType;
|
1250 |
+
|
1251 |
+
// Don't let the range of [0,255] come back in [0,1].
|
1252 |
+
// Potentially lose a little bit of precision here, but will fix issues where
|
1253 |
+
// .5 gets interpreted as half of the total, instead of half of 1
|
1254 |
+
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
|
1255 |
+
if (this._r < 1) { this._r = mathRound(this._r); }
|
1256 |
+
if (this._g < 1) { this._g = mathRound(this._g); }
|
1257 |
+
if (this._b < 1) { this._b = mathRound(this._b); }
|
1258 |
+
|
1259 |
+
this._ok = rgb.ok;
|
1260 |
+
this._tc_id = tinyCounter++;
|
1261 |
+
};
|
1262 |
+
|
1263 |
+
tinycolor.prototype = {
|
1264 |
+
isDark: function() {
|
1265 |
+
return this.getBrightness() < 128;
|
1266 |
+
},
|
1267 |
+
isLight: function() {
|
1268 |
+
return !this.isDark();
|
1269 |
+
},
|
1270 |
+
isValid: function() {
|
1271 |
+
return this._ok;
|
1272 |
+
},
|
1273 |
+
getOriginalInput: function() {
|
1274 |
+
return this._originalInput;
|
1275 |
+
},
|
1276 |
+
getFormat: function() {
|
1277 |
+
return this._format;
|
1278 |
+
},
|
1279 |
+
getAlpha: function() {
|
1280 |
+
return this._a;
|
1281 |
+
},
|
1282 |
+
getBrightness: function() {
|
1283 |
+
var rgb = this.toRgb();
|
1284 |
+
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
1285 |
+
},
|
1286 |
+
setAlpha: function(value) {
|
1287 |
+
this._a = boundAlpha(value);
|
1288 |
+
this._roundA = mathRound(100*this._a) / 100;
|
1289 |
+
return this;
|
1290 |
+
},
|
1291 |
+
toHsv: function() {
|
1292 |
+
var hsv = rgbToHsv(this._r, this._g, this._b);
|
1293 |
+
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
|
1294 |
+
},
|
1295 |
+
toHsvString: function() {
|
1296 |
+
var hsv = rgbToHsv(this._r, this._g, this._b);
|
1297 |
+
var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
|
1298 |
+
return (this._a == 1) ?
|
1299 |
+
"hsv(" + h + ", " + s + "%, " + v + "%)" :
|
1300 |
+
"hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")";
|
1301 |
+
},
|
1302 |
+
toHsl: function() {
|
1303 |
+
var hsl = rgbToHsl(this._r, this._g, this._b);
|
1304 |
+
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
|
1305 |
+
},
|
1306 |
+
toHslString: function() {
|
1307 |
+
var hsl = rgbToHsl(this._r, this._g, this._b);
|
1308 |
+
var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
|
1309 |
+
return (this._a == 1) ?
|
1310 |
+
"hsl(" + h + ", " + s + "%, " + l + "%)" :
|
1311 |
+
"hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")";
|
1312 |
+
},
|
1313 |
+
toHex: function(allow3Char) {
|
1314 |
+
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
1315 |
+
},
|
1316 |
+
toHexString: function(allow3Char) {
|
1317 |
+
return '#' + this.toHex(allow3Char);
|
1318 |
+
},
|
1319 |
+
toHex8: function() {
|
1320 |
+
return rgbaToHex(this._r, this._g, this._b, this._a);
|
1321 |
+
},
|
1322 |
+
toHex8String: function() {
|
1323 |
+
return '#' + this.toHex8();
|
1324 |
+
},
|
1325 |
+
toRgb: function() {
|
1326 |
+
return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
|
1327 |
+
},
|
1328 |
+
toRgbString: function() {
|
1329 |
+
return (this._a == 1) ?
|
1330 |
+
"rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
|
1331 |
+
"rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
|
1332 |
+
},
|
1333 |
+
toPercentageRgb: function() {
|
1334 |
+
return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
|
1335 |
+
},
|
1336 |
+
toPercentageRgbString: function() {
|
1337 |
+
return (this._a == 1) ?
|
1338 |
+
"rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
|
1339 |
+
"rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
1340 |
+
},
|
1341 |
+
toName: function() {
|
1342 |
+
if (this._a === 0) {
|
1343 |
+
return "transparent";
|
1344 |
+
}
|
1345 |
+
|
1346 |
+
if (this._a < 1) {
|
1347 |
+
return false;
|
1348 |
+
}
|
1349 |
+
|
1350 |
+
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
1351 |
+
},
|
1352 |
+
toFilter: function(secondColor) {
|
1353 |
+
var hex8String = '#' + rgbaToHex(this._r, this._g, this._b, this._a);
|
1354 |
+
var secondHex8String = hex8String;
|
1355 |
+
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
1356 |
+
|
1357 |
+
if (secondColor) {
|
1358 |
+
var s = tinycolor(secondColor);
|
1359 |
+
secondHex8String = s.toHex8String();
|
1360 |
+
}
|
1361 |
+
|
1362 |
+
return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")";
|
1363 |
+
},
|
1364 |
+
toString: function(format) {
|
1365 |
+
var formatSet = !!format;
|
1366 |
+
format = format || this._format;
|
1367 |
+
|
1368 |
+
var formattedString = false;
|
1369 |
+
var hasAlpha = this._a < 1 && this._a >= 0;
|
1370 |
+
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "name");
|
1371 |
+
|
1372 |
+
if (needsAlphaFormat) {
|
1373 |
+
// Special case for "transparent", all other non-alpha formats
|
1374 |
+
// will return rgba when there is transparency.
|
1375 |
+
if (format === "name" && this._a === 0) {
|
1376 |
+
return this.toName();
|
1377 |
+
}
|
1378 |
+
return this.toRgbString();
|
1379 |
+
}
|
1380 |
+
if (format === "rgb") {
|
1381 |
+
formattedString = this.toRgbString();
|
1382 |
+
}
|
1383 |
+
if (format === "prgb") {
|
1384 |
+
formattedString = this.toPercentageRgbString();
|
1385 |
+
}
|
1386 |
+
if (format === "hex" || format === "hex6") {
|
1387 |
+
formattedString = this.toHexString();
|
1388 |
+
}
|
1389 |
+
if (format === "hex3") {
|
1390 |
+
formattedString = this.toHexString(true);
|
1391 |
+
}
|
1392 |
+
if (format === "hex8") {
|
1393 |
+
formattedString = this.toHex8String();
|
1394 |
+
}
|
1395 |
+
if (format === "name") {
|
1396 |
+
formattedString = this.toName();
|
1397 |
+
}
|
1398 |
+
if (format === "hsl") {
|
1399 |
+
formattedString = this.toHslString();
|
1400 |
+
}
|
1401 |
+
if (format === "hsv") {
|
1402 |
+
formattedString = this.toHsvString();
|
1403 |
+
}
|
1404 |
+
|
1405 |
+
return formattedString || this.toHexString();
|
1406 |
+
},
|
1407 |
+
|
1408 |
+
_applyModification: function(fn, args) {
|
1409 |
+
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
1410 |
+
this._r = color._r;
|
1411 |
+
this._g = color._g;
|
1412 |
+
this._b = color._b;
|
1413 |
+
this.setAlpha(color._a);
|
1414 |
+
return this;
|
1415 |
+
},
|
1416 |
+
lighten: function() {
|
1417 |
+
return this._applyModification(lighten, arguments);
|
1418 |
+
},
|
1419 |
+
brighten: function() {
|
1420 |
+
return this._applyModification(brighten, arguments);
|
1421 |
+
},
|
1422 |
+
darken: function() {
|
1423 |
+
return this._applyModification(darken, arguments);
|
1424 |
+
},
|
1425 |
+
desaturate: function() {
|
1426 |
+
return this._applyModification(desaturate, arguments);
|
1427 |
+
},
|
1428 |
+
saturate: function() {
|
1429 |
+
return this._applyModification(saturate, arguments);
|
1430 |
+
},
|
1431 |
+
greyscale: function() {
|
1432 |
+
return this._applyModification(greyscale, arguments);
|
1433 |
+
},
|
1434 |
+
spin: function() {
|
1435 |
+
return this._applyModification(spin, arguments);
|
1436 |
+
},
|
1437 |
+
|
1438 |
+
_applyCombination: function(fn, args) {
|
1439 |
+
return fn.apply(null, [this].concat([].slice.call(args)));
|
1440 |
+
},
|
1441 |
+
analogous: function() {
|
1442 |
+
return this._applyCombination(analogous, arguments);
|
1443 |
+
},
|
1444 |
+
complement: function() {
|
1445 |
+
return this._applyCombination(complement, arguments);
|
1446 |
+
},
|
1447 |
+
monochromatic: function() {
|
1448 |
+
return this._applyCombination(monochromatic, arguments);
|
1449 |
+
},
|
1450 |
+
splitcomplement: function() {
|
1451 |
+
return this._applyCombination(splitcomplement, arguments);
|
1452 |
+
},
|
1453 |
+
triad: function() {
|
1454 |
+
return this._applyCombination(triad, arguments);
|
1455 |
+
},
|
1456 |
+
tetrad: function() {
|
1457 |
+
return this._applyCombination(tetrad, arguments);
|
1458 |
+
}
|
1459 |
+
};
|
1460 |
+
|
1461 |
+
// If input is an object, force 1 into "1.0" to handle ratios properly
|
1462 |
+
// String input requires "1.0" as input, so 1 will be treated as 1
|
1463 |
+
tinycolor.fromRatio = function(color, opts) {
|
1464 |
+
if (typeof color == "object") {
|
1465 |
+
var newColor = {};
|
1466 |
+
for (var i in color) {
|
1467 |
+
if (color.hasOwnProperty(i)) {
|
1468 |
+
if (i === "a") {
|
1469 |
+
newColor[i] = color[i];
|
1470 |
+
}
|
1471 |
+
else {
|
1472 |
+
newColor[i] = convertToPercentage(color[i]);
|
1473 |
+
}
|
1474 |
+
}
|
1475 |
+
}
|
1476 |
+
color = newColor;
|
1477 |
+
}
|
1478 |
+
|
1479 |
+
return tinycolor(color, opts);
|
1480 |
+
};
|
1481 |
+
|
1482 |
+
// Given a string or object, convert that input to RGB
|
1483 |
+
// Possible string inputs:
|
1484 |
+
//
|
1485 |
+
// "red"
|
1486 |
+
// "#f00" or "f00"
|
1487 |
+
// "#ff0000" or "ff0000"
|
1488 |
+
// "#ff000000" or "ff000000"
|
1489 |
+
// "rgb 255 0 0" or "rgb (255, 0, 0)"
|
1490 |
+
// "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
1491 |
+
// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
1492 |
+
// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
1493 |
+
// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
1494 |
+
// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
1495 |
+
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
1496 |
+
//
|
1497 |
+
function inputToRGB(color) {
|
1498 |
+
|
1499 |
+
var rgb = { r: 0, g: 0, b: 0 };
|
1500 |
+
var a = 1;
|
1501 |
+
var ok = false;
|
1502 |
+
var format = false;
|
1503 |
+
|
1504 |
+
if (typeof color == "string") {
|
1505 |
+
color = stringInputToObject(color);
|
1506 |
+
}
|
1507 |
+
|
1508 |
+
if (typeof color == "object") {
|
1509 |
+
if (color.hasOwnProperty("r") && color.hasOwnProperty("g") && color.hasOwnProperty("b")) {
|
1510 |
+
rgb = rgbToRgb(color.r, color.g, color.b);
|
1511 |
+
ok = true;
|
1512 |
+
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
1513 |
+
}
|
1514 |
+
else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("v")) {
|
1515 |
+
color.s = convertToPercentage(color.s);
|
1516 |
+
color.v = convertToPercentage(color.v);
|
1517 |
+
rgb = hsvToRgb(color.h, color.s, color.v);
|
1518 |
+
ok = true;
|
1519 |
+
format = "hsv";
|
1520 |
+
}
|
1521 |
+
else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("l")) {
|
1522 |
+
color.s = convertToPercentage(color.s);
|
1523 |
+
color.l = convertToPercentage(color.l);
|
1524 |
+
rgb = hslToRgb(color.h, color.s, color.l);
|
1525 |
+
ok = true;
|
1526 |
+
format = "hsl";
|
1527 |
+
}
|
1528 |
+
|
1529 |
+
if (color.hasOwnProperty("a")) {
|
1530 |
+
a = color.a;
|
1531 |
+
}
|
1532 |
+
}
|
1533 |
+
|
1534 |
+
a = boundAlpha(a);
|
1535 |
+
|
1536 |
+
return {
|
1537 |
+
ok: ok,
|
1538 |
+
format: color.format || format,
|
1539 |
+
r: mathMin(255, mathMax(rgb.r, 0)),
|
1540 |
+
g: mathMin(255, mathMax(rgb.g, 0)),
|
1541 |
+
b: mathMin(255, mathMax(rgb.b, 0)),
|
1542 |
+
a: a
|
1543 |
+
};
|
1544 |
+
}
|
1545 |
+
|
1546 |
+
|
1547 |
+
// Conversion Functions
|
1548 |
+
// --------------------
|
1549 |
+
|
1550 |
+
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
|
1551 |
+
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
1552 |
+
|
1553 |
+
// `rgbToRgb`
|
1554 |
+
// Handle bounds / percentage checking to conform to CSS color spec
|
1555 |
+
// <http://www.w3.org/TR/css3-color/>
|
1556 |
+
// *Assumes:* r, g, b in [0, 255] or [0, 1]
|
1557 |
+
// *Returns:* { r, g, b } in [0, 255]
|
1558 |
+
function rgbToRgb(r, g, b){
|
1559 |
+
return {
|
1560 |
+
r: bound01(r, 255) * 255,
|
1561 |
+
g: bound01(g, 255) * 255,
|
1562 |
+
b: bound01(b, 255) * 255
|
1563 |
+
};
|
1564 |
+
}
|
1565 |
+
|
1566 |
+
// `rgbToHsl`
|
1567 |
+
// Converts an RGB color value to HSL.
|
1568 |
+
// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
|
1569 |
+
// *Returns:* { h, s, l } in [0,1]
|
1570 |
+
function rgbToHsl(r, g, b) {
|
1571 |
+
|
1572 |
+
r = bound01(r, 255);
|
1573 |
+
g = bound01(g, 255);
|
1574 |
+
b = bound01(b, 255);
|
1575 |
+
|
1576 |
+
var max = mathMax(r, g, b), min = mathMin(r, g, b);
|
1577 |
+
var h, s, l = (max + min) / 2;
|
1578 |
+
|
1579 |
+
if(max == min) {
|
1580 |
+
h = s = 0; // achromatic
|
1581 |
+
}
|
1582 |
+
else {
|
1583 |
+
var d = max - min;
|
1584 |
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
1585 |
+
switch(max) {
|
1586 |
+
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
1587 |
+
case g: h = (b - r) / d + 2; break;
|
1588 |
+
case b: h = (r - g) / d + 4; break;
|
1589 |
+
}
|
1590 |
+
|
1591 |
+
h /= 6;
|
1592 |
+
}
|
1593 |
+
|
1594 |
+
return { h: h, s: s, l: l };
|
1595 |
+
}
|
1596 |
+
|
1597 |
+
// `hslToRgb`
|
1598 |
+
// Converts an HSL color value to RGB.
|
1599 |
+
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
|
1600 |
+
// *Returns:* { r, g, b } in the set [0, 255]
|
1601 |
+
function hslToRgb(h, s, l) {
|
1602 |
+
var r, g, b;
|
1603 |
+
|
1604 |
+
h = bound01(h, 360);
|
1605 |
+
s = bound01(s, 100);
|
1606 |
+
l = bound01(l, 100);
|
1607 |
+
|
1608 |
+
function hue2rgb(p, q, t) {
|
1609 |
+
if(t < 0) t += 1;
|
1610 |
+
if(t > 1) t -= 1;
|
1611 |
+
if(t < 1/6) return p + (q - p) * 6 * t;
|
1612 |
+
if(t < 1/2) return q;
|
1613 |
+
if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
|
1614 |
+
return p;
|
1615 |
+
}
|
1616 |
+
|
1617 |
+
if(s === 0) {
|
1618 |
+
r = g = b = l; // achromatic
|
1619 |
+
}
|
1620 |
+
else {
|
1621 |
+
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
1622 |
+
var p = 2 * l - q;
|
1623 |
+
r = hue2rgb(p, q, h + 1/3);
|
1624 |
+
g = hue2rgb(p, q, h);
|
1625 |
+
b = hue2rgb(p, q, h - 1/3);
|
1626 |
+
}
|
1627 |
+
|
1628 |
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
1629 |
+
}
|
1630 |
+
|
1631 |
+
// `rgbToHsv`
|
1632 |
+
// Converts an RGB color value to HSV
|
1633 |
+
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
|
1634 |
+
// *Returns:* { h, s, v } in [0,1]
|
1635 |
+
function rgbToHsv(r, g, b) {
|
1636 |
+
|
1637 |
+
r = bound01(r, 255);
|
1638 |
+
g = bound01(g, 255);
|
1639 |
+
b = bound01(b, 255);
|
1640 |
+
|
1641 |
+
var max = mathMax(r, g, b), min = mathMin(r, g, b);
|
1642 |
+
var h, s, v = max;
|
1643 |
+
|
1644 |
+
var d = max - min;
|
1645 |
+
s = max === 0 ? 0 : d / max;
|
1646 |
+
|
1647 |
+
if(max == min) {
|
1648 |
+
h = 0; // achromatic
|
1649 |
+
}
|
1650 |
+
else {
|
1651 |
+
switch(max) {
|
1652 |
+
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
1653 |
+
case g: h = (b - r) / d + 2; break;
|
1654 |
+
case b: h = (r - g) / d + 4; break;
|
1655 |
+
}
|
1656 |
+
h /= 6;
|
1657 |
+
}
|
1658 |
+
return { h: h, s: s, v: v };
|
1659 |
+
}
|
1660 |
+
|
1661 |
+
// `hsvToRgb`
|
1662 |
+
// Converts an HSV color value to RGB.
|
1663 |
+
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
|
1664 |
+
// *Returns:* { r, g, b } in the set [0, 255]
|
1665 |
+
function hsvToRgb(h, s, v) {
|
1666 |
+
|
1667 |
+
h = bound01(h, 360) * 6;
|
1668 |
+
s = bound01(s, 100);
|
1669 |
+
v = bound01(v, 100);
|
1670 |
+
|
1671 |
+
var i = math.floor(h),
|
1672 |
+
f = h - i,
|
1673 |
+
p = v * (1 - s),
|
1674 |
+
q = v * (1 - f * s),
|
1675 |
+
t = v * (1 - (1 - f) * s),
|
1676 |
+
mod = i % 6,
|
1677 |
+
r = [v, q, p, p, t, v][mod],
|
1678 |
+
g = [t, v, v, q, p, p][mod],
|
1679 |
+
b = [p, p, t, v, v, q][mod];
|
1680 |
+
|
1681 |
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
1682 |
+
}
|
1683 |
+
|
1684 |
+
// `rgbToHex`
|
1685 |
+
// Converts an RGB color to hex
|
1686 |
+
// Assumes r, g, and b are contained in the set [0, 255]
|
1687 |
+
// Returns a 3 or 6 character hex
|
1688 |
+
function rgbToHex(r, g, b, allow3Char) {
|
1689 |
+
|
1690 |
+
var hex = [
|
1691 |
+
pad2(mathRound(r).toString(16)),
|
1692 |
+
pad2(mathRound(g).toString(16)),
|
1693 |
+
pad2(mathRound(b).toString(16))
|
1694 |
+
];
|
1695 |
+
|
1696 |
+
// Return a 3 character hex if possible
|
1697 |
+
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
|
1698 |
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
1699 |
+
}
|
1700 |
+
|
1701 |
+
return hex.join("");
|
1702 |
+
}
|
1703 |
+
// `rgbaToHex`
|
1704 |
+
// Converts an RGBA color plus alpha transparency to hex
|
1705 |
+
// Assumes r, g, b and a are contained in the set [0, 255]
|
1706 |
+
// Returns an 8 character hex
|
1707 |
+
function rgbaToHex(r, g, b, a) {
|
1708 |
+
|
1709 |
+
var hex = [
|
1710 |
+
pad2(convertDecimalToHex(a)),
|
1711 |
+
pad2(mathRound(r).toString(16)),
|
1712 |
+
pad2(mathRound(g).toString(16)),
|
1713 |
+
pad2(mathRound(b).toString(16))
|
1714 |
+
];
|
1715 |
+
|
1716 |
+
return hex.join("");
|
1717 |
+
}
|
1718 |
+
|
1719 |
+
// `equals`
|
1720 |
+
// Can be called with any tinycolor input
|
1721 |
+
tinycolor.equals = function (color1, color2) {
|
1722 |
+
if (!color1 || !color2) { return false; }
|
1723 |
+
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
1724 |
+
};
|
1725 |
+
tinycolor.random = function() {
|
1726 |
+
return tinycolor.fromRatio({
|
1727 |
+
r: mathRandom(),
|
1728 |
+
g: mathRandom(),
|
1729 |
+
b: mathRandom()
|
1730 |
+
});
|
1731 |
+
};
|
1732 |
+
|
1733 |
+
|
1734 |
+
// Modification Functions
|
1735 |
+
// ----------------------
|
1736 |
+
// Thanks to less.js for some of the basics here
|
1737 |
+
// <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
|
1738 |
+
|
1739 |
+
function desaturate(color, amount) {
|
1740 |
+
amount = (amount === 0) ? 0 : (amount || 10);
|
1741 |
+
var hsl = tinycolor(color).toHsl();
|
1742 |
+
hsl.s -= amount / 100;
|
1743 |
+
hsl.s = clamp01(hsl.s);
|
1744 |
+
return tinycolor(hsl);
|
1745 |
+
}
|
1746 |
+
|
1747 |
+
function saturate(color, amount) {
|
1748 |
+
amount = (amount === 0) ? 0 : (amount || 10);
|
1749 |
+
var hsl = tinycolor(color).toHsl();
|
1750 |
+
hsl.s += amount / 100;
|
1751 |
+
hsl.s = clamp01(hsl.s);
|
1752 |
+
return tinycolor(hsl);
|
1753 |
+
}
|
1754 |
+
|
1755 |
+
function greyscale(color) {
|
1756 |
+
return tinycolor(color).desaturate(100);
|
1757 |
+
}
|
1758 |
+
|
1759 |
+
function lighten (color, amount) {
|
1760 |
+
amount = (amount === 0) ? 0 : (amount || 10);
|
1761 |
+
var hsl = tinycolor(color).toHsl();
|
1762 |
+
hsl.l += amount / 100;
|
1763 |
+
hsl.l = clamp01(hsl.l);
|
1764 |
+
return tinycolor(hsl);
|
1765 |
+
}
|
1766 |
+
|
1767 |
+
function brighten(color, amount) {
|
1768 |
+
amount = (amount === 0) ? 0 : (amount || 10);
|
1769 |
+
var rgb = tinycolor(color).toRgb();
|
1770 |
+
rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));
|
1771 |
+
rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));
|
1772 |
+
rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));
|
1773 |
+
return tinycolor(rgb);
|
1774 |
+
}
|
1775 |
+
|
1776 |
+
function darken (color, amount) {
|
1777 |
+
amount = (amount === 0) ? 0 : (amount || 10);
|
1778 |
+
var hsl = tinycolor(color).toHsl();
|
1779 |
+
hsl.l -= amount / 100;
|
1780 |
+
hsl.l = clamp01(hsl.l);
|
1781 |
+
return tinycolor(hsl);
|
1782 |
+
}
|
1783 |
+
|
1784 |
+
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
1785 |
+
// Values outside of this range will be wrapped into this range.
|
1786 |
+
function spin(color, amount) {
|
1787 |
+
var hsl = tinycolor(color).toHsl();
|
1788 |
+
var hue = (mathRound(hsl.h) + amount) % 360;
|
1789 |
+
hsl.h = hue < 0 ? 360 + hue : hue;
|
1790 |
+
return tinycolor(hsl);
|
1791 |
+
}
|
1792 |
+
|
1793 |
+
// Combination Functions
|
1794 |
+
// ---------------------
|
1795 |
+
// Thanks to jQuery xColor for some of the ideas behind these
|
1796 |
+
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
|
1797 |
+
|
1798 |
+
function complement(color) {
|
1799 |
+
var hsl = tinycolor(color).toHsl();
|
1800 |
+
hsl.h = (hsl.h + 180) % 360;
|
1801 |
+
return tinycolor(hsl);
|
1802 |
+
}
|
1803 |
+
|
1804 |
+
function triad(color) {
|
1805 |
+
var hsl = tinycolor(color).toHsl();
|
1806 |
+
var h = hsl.h;
|
1807 |
+
return [
|
1808 |
+
tinycolor(color),
|
1809 |
+
tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
|
1810 |
+
tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
|
1811 |
+
];
|
1812 |
+
}
|
1813 |
+
|
1814 |
+
function tetrad(color) {
|
1815 |
+
var hsl = tinycolor(color).toHsl();
|
1816 |
+
var h = hsl.h;
|
1817 |
+
return [
|
1818 |
+
tinycolor(color),
|
1819 |
+
tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
|
1820 |
+
tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
|
1821 |
+
tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
|
1822 |
+
];
|
1823 |
+
}
|
1824 |
+
|
1825 |
+
function splitcomplement(color) {
|
1826 |
+
var hsl = tinycolor(color).toHsl();
|
1827 |
+
var h = hsl.h;
|
1828 |
+
return [
|
1829 |
+
tinycolor(color),
|
1830 |
+
tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
|
1831 |
+
tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
|
1832 |
+
];
|
1833 |
+
}
|
1834 |
+
|
1835 |
+
function analogous(color, results, slices) {
|
1836 |
+
results = results || 6;
|
1837 |
+
slices = slices || 30;
|
1838 |
+
|
1839 |
+
var hsl = tinycolor(color).toHsl();
|
1840 |
+
var part = 360 / slices;
|
1841 |
+
var ret = [tinycolor(color)];
|
1842 |
+
|
1843 |
+
for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
|
1844 |
+
hsl.h = (hsl.h + part) % 360;
|
1845 |
+
ret.push(tinycolor(hsl));
|
1846 |
+
}
|
1847 |
+
return ret;
|
1848 |
+
}
|
1849 |
+
|
1850 |
+
function monochromatic(color, results) {
|
1851 |
+
results = results || 6;
|
1852 |
+
var hsv = tinycolor(color).toHsv();
|
1853 |
+
var h = hsv.h, s = hsv.s, v = hsv.v;
|
1854 |
+
var ret = [];
|
1855 |
+
var modification = 1 / results;
|
1856 |
+
|
1857 |
+
while (results--) {
|
1858 |
+
ret.push(tinycolor({ h: h, s: s, v: v}));
|
1859 |
+
v = (v + modification) % 1;
|
1860 |
+
}
|
1861 |
+
|
1862 |
+
return ret;
|
1863 |
+
}
|
1864 |
+
|
1865 |
+
// Utility Functions
|
1866 |
+
// ---------------------
|
1867 |
+
|
1868 |
+
tinycolor.mix = function(color1, color2, amount) {
|
1869 |
+
amount = (amount === 0) ? 0 : (amount || 50);
|
1870 |
+
|
1871 |
+
var rgb1 = tinycolor(color1).toRgb();
|
1872 |
+
var rgb2 = tinycolor(color2).toRgb();
|
1873 |
+
|
1874 |
+
var p = amount / 100;
|
1875 |
+
var w = p * 2 - 1;
|
1876 |
+
var a = rgb2.a - rgb1.a;
|
1877 |
+
|
1878 |
+
var w1;
|
1879 |
+
|
1880 |
+
if (w * a == -1) {
|
1881 |
+
w1 = w;
|
1882 |
+
} else {
|
1883 |
+
w1 = (w + a) / (1 + w * a);
|
1884 |
+
}
|
1885 |
+
|
1886 |
+
w1 = (w1 + 1) / 2;
|
1887 |
+
|
1888 |
+
var w2 = 1 - w1;
|
1889 |
+
|
1890 |
+
var rgba = {
|
1891 |
+
r: rgb2.r * w1 + rgb1.r * w2,
|
1892 |
+
g: rgb2.g * w1 + rgb1.g * w2,
|
1893 |
+
b: rgb2.b * w1 + rgb1.b * w2,
|
1894 |
+
a: rgb2.a * p + rgb1.a * (1 - p)
|
1895 |
+
};
|
1896 |
+
|
1897 |
+
return tinycolor(rgba);
|
1898 |
+
};
|
1899 |
+
|
1900 |
+
|
1901 |
+
// Readability Functions
|
1902 |
+
// ---------------------
|
1903 |
+
// <http://www.w3.org/TR/AERT#color-contrast>
|
1904 |
+
|
1905 |
+
// `readability`
|
1906 |
+
// Analyze the 2 colors and returns an object with the following properties:
|
1907 |
+
// `brightness`: difference in brightness between the two colors
|
1908 |
+
// `color`: difference in color/hue between the two colors
|
1909 |
+
tinycolor.readability = function(color1, color2) {
|
1910 |
+
var c1 = tinycolor(color1);
|
1911 |
+
var c2 = tinycolor(color2);
|
1912 |
+
var rgb1 = c1.toRgb();
|
1913 |
+
var rgb2 = c2.toRgb();
|
1914 |
+
var brightnessA = c1.getBrightness();
|
1915 |
+
var brightnessB = c2.getBrightness();
|
1916 |
+
var colorDiff = (
|
1917 |
+
Math.max(rgb1.r, rgb2.r) - Math.min(rgb1.r, rgb2.r) +
|
1918 |
+
Math.max(rgb1.g, rgb2.g) - Math.min(rgb1.g, rgb2.g) +
|
1919 |
+
Math.max(rgb1.b, rgb2.b) - Math.min(rgb1.b, rgb2.b)
|
1920 |
+
);
|
1921 |
+
|
1922 |
+
return {
|
1923 |
+
brightness: Math.abs(brightnessA - brightnessB),
|
1924 |
+
color: colorDiff
|
1925 |
+
};
|
1926 |
+
};
|
1927 |
+
|
1928 |
+
// `readable`
|
1929 |
+
// http://www.w3.org/TR/AERT#color-contrast
|
1930 |
+
// Ensure that foreground and background color combinations provide sufficient contrast.
|
1931 |
+
// *Example*
|
1932 |
+
// tinycolor.isReadable("#000", "#111") => false
|
1933 |
+
tinycolor.isReadable = function(color1, color2) {
|
1934 |
+
var readability = tinycolor.readability(color1, color2);
|
1935 |
+
return readability.brightness > 125 && readability.color > 500;
|
1936 |
+
};
|
1937 |
+
|
1938 |
+
// `mostReadable`
|
1939 |
+
// Given a base color and a list of possible foreground or background
|
1940 |
+
// colors for that base, returns the most readable color.
|
1941 |
+
// *Example*
|
1942 |
+
// tinycolor.mostReadable("#123", ["#fff", "#000"]) => "#000"
|
1943 |
+
tinycolor.mostReadable = function(baseColor, colorList) {
|
1944 |
+
var bestColor = null;
|
1945 |
+
var bestScore = 0;
|
1946 |
+
var bestIsReadable = false;
|
1947 |
+
for (var i=0; i < colorList.length; i++) {
|
1948 |
+
|
1949 |
+
// We normalize both around the "acceptable" breaking point,
|
1950 |
+
// but rank brightness constrast higher than hue.
|
1951 |
+
|
1952 |
+
var readability = tinycolor.readability(baseColor, colorList[i]);
|
1953 |
+
var readable = readability.brightness > 125 && readability.color > 500;
|
1954 |
+
var score = 3 * (readability.brightness / 125) + (readability.color / 500);
|
1955 |
+
|
1956 |
+
if ((readable && ! bestIsReadable) ||
|
1957 |
+
(readable && bestIsReadable && score > bestScore) ||
|
1958 |
+
((! readable) && (! bestIsReadable) && score > bestScore)) {
|
1959 |
+
bestIsReadable = readable;
|
1960 |
+
bestScore = score;
|
1961 |
+
bestColor = tinycolor(colorList[i]);
|
1962 |
+
}
|
1963 |
+
}
|
1964 |
+
return bestColor;
|
1965 |
+
};
|
1966 |
+
|
1967 |
+
|
1968 |
+
// Big List of Colors
|
1969 |
+
// ------------------
|
1970 |
+
// <http://www.w3.org/TR/css3-color/#svg-color>
|
1971 |
+
var names = tinycolor.names = {
|
1972 |
+
aliceblue: "f0f8ff",
|
1973 |
+
antiquewhite: "faebd7",
|
1974 |
+
aqua: "0ff",
|
1975 |
+
aquamarine: "7fffd4",
|
1976 |
+
azure: "f0ffff",
|
1977 |
+
beige: "f5f5dc",
|
1978 |
+
bisque: "ffe4c4",
|
1979 |
+
black: "000",
|
1980 |
+
blanchedalmond: "ffebcd",
|
1981 |
+
blue: "00f",
|
1982 |
+
blueviolet: "8a2be2",
|
1983 |
+
brown: "a52a2a",
|
1984 |
+
burlywood: "deb887",
|
1985 |
+
burntsienna: "ea7e5d",
|
1986 |
+
cadetblue: "5f9ea0",
|
1987 |
+
chartreuse: "7fff00",
|
1988 |
+
chocolate: "d2691e",
|
1989 |
+
coral: "ff7f50",
|
1990 |
+
cornflowerblue: "6495ed",
|
1991 |
+
cornsilk: "fff8dc",
|
1992 |
+
crimson: "dc143c",
|
1993 |
+
cyan: "0ff",
|
1994 |
+
darkblue: "00008b",
|
1995 |
+
darkcyan: "008b8b",
|
1996 |
+
darkgoldenrod: "b8860b",
|
1997 |
+
darkgray: "a9a9a9",
|
1998 |
+
darkgreen: "006400",
|
1999 |
+
darkgrey: "a9a9a9",
|
2000 |
+
darkkhaki: "bdb76b",
|
2001 |
+
darkmagenta: "8b008b",
|
2002 |
+
darkolivegreen: "556b2f",
|
2003 |
+
darkorange: "ff8c00",
|
2004 |
+
darkorchid: "9932cc",
|
2005 |
+
darkred: "8b0000",
|
2006 |
+
darksalmon: "e9967a",
|
2007 |
+
darkseagreen: "8fbc8f",
|
2008 |
+
darkslateblue: "483d8b",
|
2009 |
+
darkslategray: "2f4f4f",
|
2010 |
+
darkslategrey: "2f4f4f",
|
2011 |
+
darkturquoise: "00ced1",
|
2012 |
+
darkviolet: "9400d3",
|
2013 |
+
deeppink: "ff1493",
|
2014 |
+
deepskyblue: "00bfff",
|
2015 |
+
dimgray: "696969",
|
2016 |
+
dimgrey: "696969",
|
2017 |
+
dodgerblue: "1e90ff",
|
2018 |
+
firebrick: "b22222",
|
2019 |
+
floralwhite: "fffaf0",
|
2020 |
+
forestgreen: "228b22",
|
2021 |
+
fuchsia: "f0f",
|
2022 |
+
gainsboro: "dcdcdc",
|
2023 |
+
ghostwhite: "f8f8ff",
|
2024 |
+
gold: "ffd700",
|
2025 |
+
goldenrod: "daa520",
|
2026 |
+
gray: "808080",
|
2027 |
+
green: "008000",
|
2028 |
+
greenyellow: "adff2f",
|
2029 |
+
grey: "808080",
|
2030 |
+
honeydew: "f0fff0",
|
2031 |
+
hotpink: "ff69b4",
|
2032 |
+
indianred: "cd5c5c",
|
2033 |
+
indigo: "4b0082",
|
2034 |
+
ivory: "fffff0",
|
2035 |
+
khaki: "f0e68c",
|
2036 |
+
lavender: "e6e6fa",
|
2037 |
+
lavenderblush: "fff0f5",
|
2038 |
+
lawngreen: "7cfc00",
|
2039 |
+
lemonchiffon: "fffacd",
|
2040 |
+
lightblue: "add8e6",
|
2041 |
+
lightcoral: "f08080",
|
2042 |
+
lightcyan: "e0ffff",
|
2043 |
+
lightgoldenrodyellow: "fafad2",
|
2044 |
+
lightgray: "d3d3d3",
|
2045 |
+
lightgreen: "90ee90",
|
2046 |
+
lightgrey: "d3d3d3",
|
2047 |
+
lightpink: "ffb6c1",
|
2048 |
+
lightsalmon: "ffa07a",
|
2049 |
+
lightseagreen: "20b2aa",
|
2050 |
+
lightskyblue: "87cefa",
|
2051 |
+
lightslategray: "789",
|
2052 |
+
lightslategrey: "789",
|
2053 |
+
lightsteelblue: "b0c4de",
|
2054 |
+
lightyellow: "ffffe0",
|
2055 |
+
lime: "0f0",
|
2056 |
+
limegreen: "32cd32",
|
2057 |
+
linen: "faf0e6",
|
2058 |
+
magenta: "f0f",
|
2059 |
+
maroon: "800000",
|
2060 |
+
mediumaquamarine: "66cdaa",
|
2061 |
+
mediumblue: "0000cd",
|
2062 |
+
mediumorchid: "ba55d3",
|
2063 |
+
mediumpurple: "9370db",
|
2064 |
+
mediumseagreen: "3cb371",
|
2065 |
+
mediumslateblue: "7b68ee",
|
2066 |
+
mediumspringgreen: "00fa9a",
|
2067 |
+
mediumturquoise: "48d1cc",
|
2068 |
+
mediumvioletred: "c71585",
|
2069 |
+
midnightblue: "191970",
|
2070 |
+
mintcream: "f5fffa",
|
2071 |
+
mistyrose: "ffe4e1",
|
2072 |
+
moccasin: "ffe4b5",
|
2073 |
+
navajowhite: "ffdead",
|
2074 |
+
navy: "000080",
|
2075 |
+
oldlace: "fdf5e6",
|
2076 |
+
olive: "808000",
|
2077 |
+
olivedrab: "6b8e23",
|
2078 |
+
orange: "ffa500",
|
2079 |
+
orangered: "ff4500",
|
2080 |
+
orchid: "da70d6",
|
2081 |
+
palegoldenrod: "eee8aa",
|
2082 |
+
palegreen: "98fb98",
|
2083 |
+
paleturquoise: "afeeee",
|
2084 |
+
palevioletred: "db7093",
|
2085 |
+
papayawhip: "ffefd5",
|
2086 |
+
peachpuff: "ffdab9",
|
2087 |
+
peru: "cd853f",
|
2088 |
+
pink: "ffc0cb",
|
2089 |
+
plum: "dda0dd",
|
2090 |
+
powderblue: "b0e0e6",
|
2091 |
+
purple: "800080",
|
2092 |
+
rebeccapurple: "663399",
|
2093 |
+
red: "f00",
|
2094 |
+
rosybrown: "bc8f8f",
|
2095 |
+
royalblue: "4169e1",
|
2096 |
+
saddlebrown: "8b4513",
|
2097 |
+
salmon: "fa8072",
|
2098 |
+
sandybrown: "f4a460",
|
2099 |
+
seagreen: "2e8b57",
|
2100 |
+
seashell: "fff5ee",
|
2101 |
+
sienna: "a0522d",
|
2102 |
+
silver: "c0c0c0",
|
2103 |
+
skyblue: "87ceeb",
|
2104 |
+
slateblue: "6a5acd",
|
2105 |
+
slategray: "708090",
|
2106 |
+
slategrey: "708090",
|
2107 |
+
snow: "fffafa",
|
2108 |
+
springgreen: "00ff7f",
|
2109 |
+
steelblue: "4682b4",
|
2110 |
+
tan: "d2b48c",
|
2111 |
+
teal: "008080",
|
2112 |
+
thistle: "d8bfd8",
|
2113 |
+
tomato: "ff6347",
|
2114 |
+
turquoise: "40e0d0",
|
2115 |
+
violet: "ee82ee",
|
2116 |
+
wheat: "f5deb3",
|
2117 |
+
white: "fff",
|
2118 |
+
whitesmoke: "f5f5f5",
|
2119 |
+
yellow: "ff0",
|
2120 |
+
yellowgreen: "9acd32"
|
2121 |
+
};
|
2122 |
+
|
2123 |
+
// Make it easy to access colors via `hexNames[hex]`
|
2124 |
+
var hexNames = tinycolor.hexNames = flip(names);
|
2125 |
+
|
2126 |
+
|
2127 |
+
// Utilities
|
2128 |
+
// ---------
|
2129 |
+
|
2130 |
+
// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
|
2131 |
+
function flip(o) {
|
2132 |
+
var flipped = { };
|
2133 |
+
for (var i in o) {
|
2134 |
+
if (o.hasOwnProperty(i)) {
|
2135 |
+
flipped[o[i]] = i;
|
2136 |
+
}
|
2137 |
+
}
|
2138 |
+
return flipped;
|
2139 |
+
}
|
2140 |
+
|
2141 |
+
// Return a valid alpha value [0,1] with all invalid values being set to 1
|
2142 |
+
function boundAlpha(a) {
|
2143 |
+
a = parseFloat(a);
|
2144 |
+
|
2145 |
+
if (isNaN(a) || a < 0 || a > 1) {
|
2146 |
+
a = 1;
|
2147 |
+
}
|
2148 |
+
|
2149 |
+
return a;
|
2150 |
+
}
|
2151 |
+
|
2152 |
+
// Take input from [0, n] and return it as [0, 1]
|
2153 |
+
function bound01(n, max) {
|
2154 |
+
if (isOnePointZero(n)) { n = "100%"; }
|
2155 |
+
|
2156 |
+
var processPercent = isPercentage(n);
|
2157 |
+
n = mathMin(max, mathMax(0, parseFloat(n)));
|
2158 |
+
|
2159 |
+
// Automatically convert percentage into number
|
2160 |
+
if (processPercent) {
|
2161 |
+
n = parseInt(n * max, 10) / 100;
|
2162 |
+
}
|
2163 |
+
|
2164 |
+
// Handle floating point rounding errors
|
2165 |
+
if ((math.abs(n - max) < 0.000001)) {
|
2166 |
+
return 1;
|
2167 |
+
}
|
2168 |
+
|
2169 |
+
// Convert into [0, 1] range if it isn't already
|
2170 |
+
return (n % max) / parseFloat(max);
|
2171 |
+
}
|
2172 |
+
|
2173 |
+
// Force a number between 0 and 1
|
2174 |
+
function clamp01(val) {
|
2175 |
+
return mathMin(1, mathMax(0, val));
|
2176 |
+
}
|
2177 |
+
|
2178 |
+
// Parse a base-16 hex value into a base-10 integer
|
2179 |
+
function parseIntFromHex(val) {
|
2180 |
+
return parseInt(val, 16);
|
2181 |
+
}
|
2182 |
+
|
2183 |
+
// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
2184 |
+
// <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
2185 |
+
function isOnePointZero(n) {
|
2186 |
+
return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
|
2187 |
+
}
|
2188 |
+
|
2189 |
+
// Check to see if string passed in is a percentage
|
2190 |
+
function isPercentage(n) {
|
2191 |
+
return typeof n === "string" && n.indexOf('%') != -1;
|
2192 |
+
}
|
2193 |
+
|
2194 |
+
// Force a hex value to have 2 characters
|
2195 |
+
function pad2(c) {
|
2196 |
+
return c.length == 1 ? '0' + c : '' + c;
|
2197 |
+
}
|
2198 |
+
|
2199 |
+
// Replace a decimal with it's percentage value
|
2200 |
+
function convertToPercentage(n) {
|
2201 |
+
if (n <= 1) {
|
2202 |
+
n = (n * 100) + "%";
|
2203 |
+
}
|
2204 |
+
|
2205 |
+
return n;
|
2206 |
+
}
|
2207 |
+
|
2208 |
+
// Converts a decimal to a hex value
|
2209 |
+
function convertDecimalToHex(d) {
|
2210 |
+
return Math.round(parseFloat(d) * 255).toString(16);
|
2211 |
+
}
|
2212 |
+
// Converts a hex value to a decimal
|
2213 |
+
function convertHexToDecimal(h) {
|
2214 |
+
return (parseIntFromHex(h) / 255);
|
2215 |
+
}
|
2216 |
+
|
2217 |
+
var matchers = (function() {
|
2218 |
+
|
2219 |
+
// <http://www.w3.org/TR/css3-values/#integers>
|
2220 |
+
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
2221 |
+
|
2222 |
+
// <http://www.w3.org/TR/css3-values/#number-value>
|
2223 |
+
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
2224 |
+
|
2225 |
+
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
|
2226 |
+
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
2227 |
+
|
2228 |
+
// Actual matching.
|
2229 |
+
// Parentheses and commas are optional, but not required.
|
2230 |
+
// Whitespace can take the place of commas or opening paren
|
2231 |
+
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
2232 |
+
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
2233 |
+
|
2234 |
+
return {
|
2235 |
+
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
2236 |
+
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
2237 |
+
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
2238 |
+
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
2239 |
+
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
2240 |
+
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
2241 |
+
hex3: /^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
2242 |
+
hex6: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
2243 |
+
hex8: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
2244 |
+
};
|
2245 |
+
})();
|
2246 |
+
|
2247 |
+
// `stringInputToObject`
|
2248 |
+
// Permissive string parsing. Take in a number of formats, and output an object
|
2249 |
+
// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
|
2250 |
+
function stringInputToObject(color) {
|
2251 |
+
|
2252 |
+
color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
|
2253 |
+
var named = false;
|
2254 |
+
if (names[color]) {
|
2255 |
+
color = names[color];
|
2256 |
+
named = true;
|
2257 |
+
}
|
2258 |
+
else if (color == 'transparent') {
|
2259 |
+
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
2260 |
+
}
|
2261 |
+
|
2262 |
+
// Try to match string input using regular expressions.
|
2263 |
+
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
|
2264 |
+
// Just return an object and let the conversion functions handle that.
|
2265 |
+
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
2266 |
+
var match;
|
2267 |
+
if ((match = matchers.rgb.exec(color))) {
|
2268 |
+
return { r: match[1], g: match[2], b: match[3] };
|
2269 |
+
}
|
2270 |
+
if ((match = matchers.rgba.exec(color))) {
|
2271 |
+
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
2272 |
+
}
|
2273 |
+
if ((match = matchers.hsl.exec(color))) {
|
2274 |
+
return { h: match[1], s: match[2], l: match[3] };
|
2275 |
+
}
|
2276 |
+
if ((match = matchers.hsla.exec(color))) {
|
2277 |
+
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
2278 |
+
}
|
2279 |
+
if ((match = matchers.hsv.exec(color))) {
|
2280 |
+
return { h: match[1], s: match[2], v: match[3] };
|
2281 |
+
}
|
2282 |
+
if ((match = matchers.hsva.exec(color))) {
|
2283 |
+
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
2284 |
+
}
|
2285 |
+
if ((match = matchers.hex8.exec(color))) {
|
2286 |
+
return {
|
2287 |
+
a: convertHexToDecimal(match[1]),
|
2288 |
+
r: parseIntFromHex(match[2]),
|
2289 |
+
g: parseIntFromHex(match[3]),
|
2290 |
+
b: parseIntFromHex(match[4]),
|
2291 |
+
format: named ? "name" : "hex8"
|
2292 |
+
};
|
2293 |
+
}
|
2294 |
+
if ((match = matchers.hex6.exec(color))) {
|
2295 |
+
return {
|
2296 |
+
r: parseIntFromHex(match[1]),
|
2297 |
+
g: parseIntFromHex(match[2]),
|
2298 |
+
b: parseIntFromHex(match[3]),
|
2299 |
+
format: named ? "name" : "hex"
|
2300 |
+
};
|
2301 |
+
}
|
2302 |
+
if ((match = matchers.hex3.exec(color))) {
|
2303 |
+
return {
|
2304 |
+
r: parseIntFromHex(match[1] + '' + match[1]),
|
2305 |
+
g: parseIntFromHex(match[2] + '' + match[2]),
|
2306 |
+
b: parseIntFromHex(match[3] + '' + match[3]),
|
2307 |
+
format: named ? "name" : "hex"
|
2308 |
+
};
|
2309 |
+
}
|
2310 |
+
|
2311 |
+
return false;
|
2312 |
+
}
|
2313 |
+
|
2314 |
+
window.tinycolor = tinycolor;
|
2315 |
+
})();
|
2316 |
+
|
2317 |
+
$(function () {
|
2318 |
+
if ($.fn.spectrum.load) {
|
2319 |
+
$.fn.spectrum.processNativeColorInputs();
|
2320 |
+
}
|
2321 |
+
});
|
2322 |
+
|
2323 |
+
});
|
assets/spectrum/spectrum.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.sp-container{position:absolute;top:0;left:0;display:inline-block;*display:inline;*zoom:1;z-index:9999994;overflow:hidden}.sp-container.sp-flat{position:relative}.sp-container,.sp-container *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.sp-top{position:relative;width:100%;display:inline-block}.sp-top-inner{position:absolute;top:0;left:0;bottom:0;right:0}.sp-color{position:absolute;top:0;left:0;bottom:0;right:20%}.sp-hue{position:absolute;top:0;right:0;bottom:0;left:84%;height:100%}.sp-clear-enabled .sp-hue{top:33px;height:77.5%}.sp-fill{padding-top:80%}.sp-sat,.sp-val{position:absolute;top:0;left:0;right:0;bottom:0}.sp-alpha-enabled .sp-top{margin-bottom:18px}.sp-alpha-enabled .sp-alpha{display:block}.sp-alpha-handle{position:absolute;top:-4px;bottom:-4px;width:6px;left:50%;cursor:pointer;border:1px solid black;background:white;opacity:.8}.sp-alpha{display:none;position:absolute;bottom:-14px;right:0;left:0;height:8px}.sp-alpha-inner{border:solid 1px #333}.sp-clear{display:none}.sp-clear.sp-clear-display{background-position:center}.sp-clear-enabled .sp-clear{display:block;position:absolute;top:0px;right:0;bottom:0;left:84%;height:28px}.sp-container,.sp-replacer,.sp-preview,.sp-dragger,.sp-slider,.sp-alpha,.sp-clear,.sp-alpha-handle,.sp-container.sp-dragging .sp-input,.sp-container button{-webkit-user-select:none;-moz-user-select:-moz-none;-o-user-select:none;user-select:none}.sp-container.sp-input-disabled .sp-input-container{display:none}.sp-container.sp-buttons-disabled .sp-button-container{display:none}.sp-container.sp-palette-buttons-disabled .sp-palette-button-container{display:none}.sp-palette-only .sp-picker-container{display:none}.sp-palette-disabled .sp-palette-container{display:none}.sp-initial-disabled .sp-initial{display:none}.sp-sat{background-image:-webkit-gradient(linear, 0 0, 100% 0, from(#fff), to(rgba(204,154,129,0)));background-image:-webkit-linear-gradient(left, #fff, rgba(204,154,129,0));background-image:-moz-linear-gradient(left, #fff, rgba(204,154,129,0));background-image:-o-linear-gradient(left, #fff, rgba(204,154,129,0));background-image:-ms-linear-gradient(left, #fff, rgba(204,154,129,0));background-image:linear-gradient(to right, #fff, rgba(204,154,129,0));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";filter:progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81')}.sp-val{background-image:-webkit-gradient(linear, 0 100%, 0 0, from(#000), to(rgba(204,154,129,0)));background-image:-webkit-linear-gradient(bottom, #000, rgba(204,154,129,0));background-image:-moz-linear-gradient(bottom, #000, rgba(204,154,129,0));background-image:-o-linear-gradient(bottom, #000, rgba(204,154,129,0));background-image:-ms-linear-gradient(bottom, #000, rgba(204,154,129,0));background-image:linear-gradient(to top, #000, rgba(204,154,129,0));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000')}.sp-hue{background:-moz-linear-gradient(top, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%);background:-ms-linear-gradient(top, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%);background:-o-linear-gradient(top, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%);background:-webkit-gradient(linear, left top, left bottom, from(red), color-stop(0.17, #ff0), color-stop(0.33, lime), color-stop(0.5, cyan), color-stop(0.67, blue), color-stop(0.83, #f0f), to(red));background:-webkit-linear-gradient(top, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%);background:linear-gradient(to bottom, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%)}.sp-1{height:17%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00')}.sp-2{height:16%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00')}.sp-3{height:17%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff')}.sp-4{height:17%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff')}.sp-5{height:16%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff')}.sp-6{height:17%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000')}.sp-hidden{display:none !important}.sp-cf:before,.sp-cf:after{content:"";display:table}.sp-cf:after{clear:both}.sp-cf{*zoom:1}@media (max-device-width: 480px){.sp-color{right:40%}.sp-hue{left:63%}.sp-fill{padding-top:60%}}.sp-dragger{border-radius:5px;height:5px;width:5px;border:1px solid #fff;background:#000;cursor:pointer;position:absolute;top:0;left:0}.sp-slider{position:absolute;top:0;cursor:pointer;height:3px;left:-1px;right:-1px;border:1px solid #000;background:white;opacity:.8}.sp-container{border-radius:0;background-color:#ECECEC;border:solid 1px #f0c49B;padding:0}.sp-container,.sp-container button,.sp-container input,.sp-color,.sp-hue,.sp-clear{font:normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.sp-top{margin-bottom:3px}.sp-color,.sp-hue,.sp-clear{border:solid 1px #666}.sp-input-container{float:right;width:100px;margin-bottom:4px}.sp-initial-disabled .sp-input-container{width:100%}.sp-input{font-size:12px !important;border:1px inset;padding:4px 5px;margin:0;width:100%;background:transparent;border-radius:3px;color:#222}.sp-input:focus{border:1px solid orange}.sp-input.sp-validation-error{border:1px solid red;background:#fdd}.sp-picker-container,.sp-palette-container{float:left;position:relative;padding:10px;padding-bottom:300px;margin-bottom:-290px}.sp-picker-container{width:172px;border-left:solid 1px #fff}.sp-palette-container{border-right:solid 1px #ccc}.sp-palette-only .sp-palette-container{border:0}.sp-palette .sp-thumb-el{display:block;position:relative;float:left;width:24px;height:15px;margin:3px;cursor:pointer;border:solid 2px transparent}.sp-palette .sp-thumb-el:hover,.sp-palette .sp-thumb-el.sp-thumb-active{border-color:orange}.sp-thumb-el{position:relative}.sp-initial{float:left;border:solid 1px #333}.sp-initial span{width:30px;height:25px;border:none;display:block;float:left;margin:0}.sp-initial .sp-clear-display{background-position:center}.sp-palette-button-container,.sp-button-container{float:right}.sp-replacer{margin:0;overflow:hidden;cursor:pointer;padding:4px;display:inline-block;*zoom:1;*display:inline;border:solid 1px #91765d;background:#eee;color:#333;vertical-align:middle}.sp-replacer:hover,.sp-replacer.sp-active{border-color:#F0C49B;color:#111}.sp-replacer.sp-disabled{cursor:default;border-color:silver;color:silver}.sp-dd{padding:2px 0;height:16px;line-height:16px;float:left;font-size:10px}.sp-preview{position:relative;width:25px;height:20px;border:solid 1px #222;margin-right:5px;float:left;z-index:0}.sp-palette{*width:220px;max-width:220px}.sp-palette .sp-thumb-el{width:16px;height:16px;margin:2px 1px;border:solid 1px #d0d0d0}.sp-container{padding-bottom:0}.sp-container button{background-color:#eeeeee;background-image:-webkit-linear-gradient(top, #eee, #ccc);background-image:-moz-linear-gradient(top, #eee, #ccc);background-image:-ms-linear-gradient(top, #eee, #ccc);background-image:-o-linear-gradient(top, #eee, #ccc);background-image:linear-gradient(to bottom, #eee, #ccc);border:1px solid #ccc;border-bottom:1px solid #bbb;border-radius:3px;color:#333;font-size:14px;line-height:1;padding:5px 4px;text-align:center;text-shadow:0 1px 0 #eee;vertical-align:middle}.sp-container button:hover{background-color:#dddddd;background-image:-webkit-linear-gradient(top, #ddd, #bbb);background-image:-moz-linear-gradient(top, #ddd, #bbb);background-image:-ms-linear-gradient(top, #ddd, #bbb);background-image:-o-linear-gradient(top, #ddd, #bbb);background-image:linear-gradient(to bottom, #ddd, #bbb);border:1px solid #bbb;border-bottom:1px solid #999;cursor:pointer;text-shadow:0 1px 0 #ddd}.sp-container button:active{border:1px solid #aaa;border-bottom:1px solid #888;-webkit-box-shadow:inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;-moz-box-shadow:inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;-ms-box-shadow:inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;-o-box-shadow:inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;box-shadow:inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee}.sp-cancel{font-size:11px;color:#d93f3f !important;margin:0;padding:2px;margin-right:5px;vertical-align:middle;text-decoration:none}.sp-cancel:hover{color:#d93f3f !important;text-decoration:underline}.sp-palette span:hover,.sp-palette span.sp-thumb-active{border-color:#000}.sp-preview,.sp-alpha,.sp-thumb-el{position:relative;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.sp-preview-inner,.sp-alpha-inner,.sp-thumb-inner{display:block;position:absolute;top:0;left:0;bottom:0;right:0}.sp-palette .sp-thumb-inner{background-position:50% 50%;background-repeat:no-repeat}.sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=)}.sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=)}.sp-clear-display{background-repeat:no-repeat;background-position:center;background-image:url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==)}
|
assets/spectrum/spectrum.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports&&"object"==typeof module?module.exports=t(require("jquery")):t(jQuery)}(function($,t){"use strict";function e(t,e,r,n){for(var a=[],i=0;i<t.length;i++){var o=t[i];if(o){var s=tinycolor(o),l=s.toHsl().l<.5?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light";l+=tinycolor.equals(e,o)?" sp-thumb-active":"";var c=s.toString(n.preferredFormat||"rgb"),f=g?"background-color:"+s.toRgbString():"filter:"+s.toFilter();a.push('<span title="'+c+'" data-color="'+s.toRgbString()+'" class="'+l+'"><span class="sp-thumb-inner" style="'+f+';" /></span>')}else{a.push($("<div />").append($('<span data-color="" style="background-color:transparent;" class="'+"sp-clear-display"+'"></span>').attr("title",n.noColorSelectedText)).html())}}return"<div class='sp-cf "+r+"'>"+a.join("")+"</div>"}function r(){for(var t=0;t<d.length;t++)d[t]&&d[t].hide()}function n(t,e){var r=$.extend({},h,t);return r.callbacks={move:l(r.move,e),change:l(r.change,e),show:l(r.show,e),hide:l(r.hide,e),beforeShow:l(r.beforeShow,e)},r}function a(a,o){function l(){if(W.showPaletteOnly&&(W.showPalette=!0),It.text(W.showPaletteOnly?W.togglePaletteMoreText:W.togglePaletteLessText),W.palette){dt=W.palette.slice(0),pt=$.isArray(dt[0])?dt:[dt],gt={};for(var t=0;t<pt.length;t++)for(var e=0;e<pt[t].length;e++){var r=tinycolor(pt[t][e]).toRgbString();gt[r]=!0}}St.toggleClass("sp-flat",X),St.toggleClass("sp-input-disabled",!W.showInput),St.toggleClass("sp-alpha-enabled",W.showAlpha),St.toggleClass("sp-clear-enabled",Jt),St.toggleClass("sp-buttons-disabled",!W.showButtons),St.toggleClass("sp-palette-buttons-disabled",!W.togglePaletteOnly),St.toggleClass("sp-palette-disabled",!W.showPalette),St.toggleClass("sp-palette-only",W.showPaletteOnly),St.toggleClass("sp-initial-disabled",!W.showInitial),St.addClass(W.className).addClass(W.containerClassName),I()}function h(){function t(t){return t.data&&t.data.ignore?(T($(t.target).closest(".sp-thumb-el").data("color")),N()):(T($(t.target).closest(".sp-thumb-el").data("color")),N(),D(!0),W.hideAfterPaletteSelect&&H()),!1}if(p&&St.find("*:not(input)").attr("unselectable","on"),l(),Lt&&xt.after(Kt).hide(),Jt||Et.hide(),X)xt.after(St).hide();else{var e="parent"===W.appendTo?xt.parent():$(W.appendTo);1!==e.length&&(e=$("body")),e.append(St)}m(),Vt.bind("click.spectrum touchstart.spectrum",function(t){kt||P(),t.stopPropagation(),$(t.target).is("input")||t.preventDefault()}),(xt.is(":disabled")||!0===W.disabled)&&K(),St.click(s),Ot.change(C),Ot.bind("paste",function(){setTimeout(C,1)}),Ot.keydown(function(t){13==t.keyCode&&C()}),jt.text(W.cancelText),jt.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),F(),H()}),Et.attr("title",W.clearText),Et.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),Qt=!0,N(),X&&D(!0)}),Dt.text(W.chooseText),Dt.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),p&&Ot.is(":focus")&&Ot.trigger("change"),q()&&(D(!0),H())}),It.text(W.showPaletteOnly?W.togglePaletteMoreText:W.togglePaletteLessText),It.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),W.showPaletteOnly=!W.showPaletteOnly,W.showPaletteOnly||X||St.css("left","-="+(Ct.outerWidth(!0)+5)),l()}),c(Ft,function(t,e,r){ht=t/ot,Qt=!1,r.shiftKey&&(ht=Math.round(10*ht)/10),N()},k,S),c(Mt,function(t,e){ct=parseFloat(e/at),Qt=!1,W.showAlpha||(ht=1),N()},k,S),c(Pt,function(t,e,r){if(r.shiftKey){if(!yt){var n=ft*et,a=rt-ut*rt,i=Math.abs(t-n)>Math.abs(e-a);yt=i?"x":"y"}}else yt=null;var o=!yt||"x"===yt,s=!yt||"y"===yt;o&&(ft=parseFloat(t/et)),s&&(ut=parseFloat((rt-e)/rt)),Qt=!1,W.showAlpha||(ht=1),N()},k,S),Wt?(T(Wt),j(),Yt=W.preferredFormat||tinycolor(Wt).format,y(Wt)):j(),X&&A();var r=p?"mousedown.spectrum":"click.spectrum touchstart.spectrum";qt.delegate(".sp-thumb-el",r,t),Nt.delegate(".sp-thumb-el:nth-child(1)",r,{ignore:!0},t)}function m(){if(G&&window.localStorage){try{var t=window.localStorage[G].split(",#");t.length>1&&(delete window.localStorage[G],$.each(t,function(t,e){y(e)}))}catch(t){}try{bt=window.localStorage[G].split(";")}catch(t){}}}function y(t){if(Y){var e=tinycolor(t).toRgbString();if(!gt[e]&&-1===$.inArray(e,bt))for(bt.push(e);bt.length>vt;)bt.shift();if(G&&window.localStorage)try{window.localStorage[G]=bt.join(";")}catch(t){}}}function w(){var t=[];if(W.showPalette)for(var e=0;e<bt.length;e++){var r=tinycolor(bt[e]).toRgbString();gt[r]||t.push(bt[e])}return t.reverse().slice(0,W.maxSelectionSize)}function _(){var t=O(),r=$.map(pt,function(r,n){return e(r,t,"sp-palette-row sp-palette-row-"+n,W)});m(),bt&&r.push(e(w(),t,"sp-palette-row sp-palette-row-selection",W)),qt.html(r.join(""))}function x(){if(W.showInitial){var t=Xt,r=O();Nt.html(e([t,r],r,"sp-palette-row-initial",W))}}function k(){(rt<=0||et<=0||at<=0)&&I(),tt=!0,St.addClass(mt),yt=null,xt.trigger("dragstart.spectrum",[O()])}function S(){tt=!1,St.removeClass(mt),xt.trigger("dragstop.spectrum",[O()])}function C(){var t=Ot.val();if(null!==t&&""!==t||!Jt){var e=tinycolor(t);e.isValid()?(T(e),D(!0)):Ot.addClass("sp-validation-error")}else T(null),D(!0)}function P(){Z?H():A()}function A(){var t=$.Event("beforeShow.spectrum");if(Z)return void I();xt.trigger(t,[O()]),!1===J.beforeShow(O())||t.isDefaultPrevented()||(r(),Z=!0,$(wt).bind("keydown.spectrum",M),$(wt).bind("click.spectrum",R),$(window).bind("resize.spectrum",U),Kt.addClass("sp-active"),St.removeClass("sp-hidden"),I(),j(),Xt=O(),x(),J.show(Xt),xt.trigger("show.spectrum",[Xt]))}function M(t){27===t.keyCode&&H()}function R(t){2!=t.button&&(tt||(Gt?D(!0):F(),H()))}function H(){Z&&!X&&(Z=!1,$(wt).unbind("keydown.spectrum",M),$(wt).unbind("click.spectrum",R),$(window).unbind("resize.spectrum",U),Kt.removeClass("sp-active"),St.addClass("sp-hidden"),J.hide(O()),xt.trigger("hide.spectrum",[O()]))}function F(){T(Xt,!0)}function T(t,e){if(tinycolor.equals(t,O()))return void j();var r,n;!t&&Jt?Qt=!0:(Qt=!1,r=tinycolor(t),n=r.toHsv(),ct=n.h%360/360,ft=n.s,ut=n.v,ht=n.a),j(),r&&r.isValid()&&!e&&(Yt=W.preferredFormat||r.getFormat())}function O(t){return t=t||{},Jt&&Qt?null:tinycolor.fromRatio({h:ct,s:ft,v:ut,a:Math.round(100*ht)/100},{format:t.format||Yt})}function q(){return!Ot.hasClass("sp-validation-error")}function N(){j(),J.move(O()),xt.trigger("move.spectrum",[O()])}function j(){Ot.removeClass("sp-validation-error"),E();var t=tinycolor.fromRatio({h:ct,s:1,v:1});Pt.css("background-color",t.toHexString());var e=Yt;ht<1&&(0!==ht||"name"!==e)&&("hex"!==e&&"hex3"!==e&&"hex6"!==e&&"name"!==e||(e="rgb"));var r=O({format:e}),n="";if($t.removeClass("sp-clear-display"),$t.css("background-color","transparent"),!r&&Jt)$t.addClass("sp-clear-display");else{var a=r.toHexString(),i=r.toRgbString();if(g||1===r.alpha?$t.css("background-color",i):($t.css("background-color","transparent"),$t.css("filter",r.toFilter())),W.showAlpha){var o=r.toRgb();o.a=0;var s=tinycolor(o).toRgbString(),l="linear-gradient(left, "+s+", "+a+")";p?Ht.css("filter",tinycolor(s).toFilter({gradientType:1},a)):(Ht.css("background","-webkit-"+l),Ht.css("background","-moz-"+l),Ht.css("background","-ms-"+l),Ht.css("background","linear-gradient(to right, "+s+", "+a+")"))}n=r.toString(e)}W.showInput&&Ot.val(n),W.showPalette&&_(),x()}function E(){var t=ft,e=ut;if(Jt&&Qt)Tt.hide(),Rt.hide(),At.hide();else{Tt.show(),Rt.show(),At.show();var r=t*et,n=rt-e*rt;r=Math.max(-nt,Math.min(et-nt,r-nt)),n=Math.max(-nt,Math.min(rt-nt,n-nt)),At.css({top:n+"px",left:r+"px"});var a=ht*ot;Tt.css({left:a-st/2+"px"});var i=ct*at;Rt.css({top:i-lt+"px"})}}function D(t){var e=O(),r="",n=!tinycolor.equals(e,Xt);e&&(r=e.toString(Yt),y(e)),zt&&xt.val(r),t&&n&&(J.change(e),xt.trigger("change",[e]))}function I(){Z&&(et=Pt.width(),rt=Pt.height(),nt=At.height(),it=Mt.width(),at=Mt.height(),lt=Rt.height(),ot=Ft.width(),st=Tt.width(),X||(St.css("position","absolute"),W.offset?St.offset(W.offset):St.offset(i(St,Vt))),E(),W.showPalette&&_(),xt.trigger("reflow.spectrum"))}function z(){xt.show(),Vt.unbind("click.spectrum touchstart.spectrum"),St.remove(),Kt.remove(),d[Ut.id]=null}function B(e,r){return e===t?$.extend({},W):r===t?W[e]:(W[e]=r,"preferredFormat"===e&&(Yt=W.preferredFormat),void l())}function L(){kt=!1,xt.attr("disabled",!1),Vt.removeClass("sp-disabled")}function K(){H(),kt=!0,xt.attr("disabled",!0),Vt.addClass("sp-disabled")}function V(t){W.offset=t,I()}var W=n(o,a),X=W.flat,Y=W.showSelectionPalette,G=W.localStorageKey,Q=W.theme,J=W.callbacks,U=f(I,10),Z=!1,tt=!1,et=0,rt=0,nt=0,at=0,it=0,ot=0,st=0,lt=0,ct=0,ft=0,ut=0,ht=1,dt=[],pt=[],gt={},bt=W.selectionPalette.slice(0),vt=W.maxSelectionSize,mt="sp-dragging",yt=null,wt=a.ownerDocument,_t=wt.body,xt=$(a),kt=!1,St=$(v,wt).addClass(Q),Ct=St.find(".sp-picker-container"),Pt=St.find(".sp-color"),At=St.find(".sp-dragger"),Mt=St.find(".sp-hue"),Rt=St.find(".sp-slider"),Ht=St.find(".sp-alpha-inner"),Ft=St.find(".sp-alpha"),Tt=St.find(".sp-alpha-handle"),Ot=St.find(".sp-input"),qt=St.find(".sp-palette"),Nt=St.find(".sp-initial"),jt=St.find(".sp-cancel"),Et=St.find(".sp-clear"),Dt=St.find(".sp-choose"),It=St.find(".sp-palette-toggle"),zt=xt.is("input"),Bt=zt&&"color"===xt.attr("type")&&u(),Lt=zt&&!X,Kt=Lt?$(b).addClass(Q).addClass(W.className).addClass(W.replacerClassName):$([]),Vt=Lt?Kt:xt,$t=Kt.find(".sp-preview-inner"),Wt=W.color||zt&&xt.val(),Xt=!1,Yt=W.preferredFormat,Gt=!W.showButtons||W.clickoutFiresChange,Qt=!Wt,Jt=W.allowEmpty&&!Bt;h();var Ut={show:A,hide:H,toggle:P,reflow:I,option:B,enable:L,disable:K,offset:V,set:function(t){T(t),D()},get:O,destroy:z,container:St};return Ut.id=d.push(Ut)-1,Ut}function i(t,e){var r=0,n=t.outerWidth(),a=t.outerHeight(),i=e.outerHeight(),o=t[0].ownerDocument,s=o.documentElement,l=s.clientWidth+$(o).scrollLeft(),c=s.clientHeight+$(o).scrollTop(),f=e.offset();return f.top+=i,f.left-=Math.min(f.left,f.left+n>l&&l>n?Math.abs(f.left+n-l):0),f.top-=Math.min(f.top,f.top+a>c&&c>a?Math.abs(a+i-0):0),f}function o(){}function s(t){t.stopPropagation()}function l(t,e){var r=Array.prototype.slice,n=r.call(arguments,2);return function(){return t.apply(e,n.concat(r.call(arguments)))}}function c(t,e,r,n){function a(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1}function i(r){if(c){if(p&&l.documentMode<9&&!r.button)return s();var n=r.originalEvent&&r.originalEvent.touches&&r.originalEvent.touches[0],i=n&&n.pageX||r.pageX,o=n&&n.pageY||r.pageY,g=Math.max(0,Math.min(i-f.left,h)),b=Math.max(0,Math.min(o-f.top,u));d&&a(r),e.apply(t,[g,b,r])}}function o(e){(e.which?3==e.which:2==e.button)||c||!1!==r.apply(t,arguments)&&(c=!0,u=$(t).height(),h=$(t).width(),f=$(t).offset(),$(l).bind(g),$(l.body).addClass("sp-dragging"),i(e),a(e))}function s(){c&&($(l).unbind(g),$(l.body).removeClass("sp-dragging"),setTimeout(function(){n.apply(t,arguments)},0)),c=!1}e=e||function(){},r=r||function(){},n=n||function(){};var l=document,c=!1,f={},u=0,h=0,d="ontouchstart"in window,g={};g.selectstart=a,g.dragstart=a,g["touchmove mousemove"]=i,g["touchend mouseup"]=s,$(t).bind("touchstart mousedown",o)}function f(t,e,r){var n;return function(){var a=this,i=arguments,o=function(){n=null,t.apply(a,i)};r&&clearTimeout(n),!r&&n||(n=setTimeout(o,e))}}function u(){return $.fn.spectrum.inputTypeColorSupport()}var h={beforeShow:o,move:o,change:o,show:o,hide:o,color:!1,flat:!1,showInput:!1,allowEmpty:!1,showButtons:!0,clickoutFiresChange:!0,showInitial:!1,showPalette:!1,showPaletteOnly:!1,hideAfterPaletteSelect:!1,togglePaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:7,cancelText:"cancel",chooseText:"choose",togglePaletteMoreText:"more",togglePaletteLessText:"less",clearText:"Clear Color Selection",noColorSelectedText:"No Color Selected",preferredFormat:!1,className:"",containerClassName:"",replacerClassName:"",showAlpha:!1,theme:"sp-light",palette:[["#ffffff","#000000","#ff0000","#ff8000","#ffff00","#008000","#0000ff","#4b0082","#9400d3"]],selectionPalette:[],disabled:!1,offset:null},d=[],p=!!/msie/i.exec(window.navigator.userAgent),g=function(){function t(t,e){return!!~(""+t).indexOf(e)}var e=document.createElement("div"),r=e.style;return r.cssText="background-color:rgba(0,0,0,.5)",t(r.backgroundColor,"rgba")||t(r.backgroundColor,"hsla")}(),b=["<div class='sp-replacer'>","<div class='sp-preview'><div class='sp-preview-inner'></div></div>","<div class='sp-dd'>▼</div>","</div>"].join(""),v=function(){var t="";if(p)for(var e=1;e<=6;e++)t+="<div class='sp-"+e+"'></div>";return["<div class='sp-container sp-hidden'>","<div class='sp-palette-container'>","<div class='sp-palette sp-thumb sp-cf'></div>","<div class='sp-palette-button-container sp-cf'>","<button type='button' class='sp-palette-toggle'></button>","</div>","</div>","<div class='sp-picker-container'>","<div class='sp-top sp-cf'>","<div class='sp-fill'></div>","<div class='sp-top-inner'>","<div class='sp-color'>","<div class='sp-sat'>","<div class='sp-val'>","<div class='sp-dragger'></div>","</div>","</div>","</div>","<div class='sp-clear sp-clear-display'>","</div>","<div class='sp-hue'>","<div class='sp-slider'></div>",t,"</div>","</div>","<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>","</div>","<div class='sp-input-container sp-cf'>","<input class='sp-input' type='text' spellcheck='false' />","</div>","<div class='sp-initial sp-thumb sp-cf'></div>","<div class='sp-button-container sp-cf'>","<a class='sp-cancel' href='#'></a>","<button type='button' class='sp-choose'></button>","</div>","</div>","</div>"].join("")}(),m="spectrum.id";$.fn.spectrum=function(t,e){if("string"==typeof t){var r=this,n=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=d[$(this).data(m)];if(e){var a=e[t];if(!a)throw new Error("Spectrum: no such method: '"+t+"'");"get"==t?r=e.get():"container"==t?r=e.container:"option"==t?r=e.option.apply(e,n):"destroy"==t?(e.destroy(),$(this).removeData(m)):a.apply(e,n)}}),r}return this.spectrum("destroy").each(function(){var e=$.extend({},t,$(this).data()),r=a(this,e);$(this).data(m,r.id)})},$.fn.spectrum.load=!0,$.fn.spectrum.loadOpts={},$.fn.spectrum.draggable=c,$.fn.spectrum.defaults=h,$.fn.spectrum.inputTypeColorSupport=function t(){if(void 0===t._cachedResult){var e=$("<input type='color'/>")[0];t._cachedResult="color"===e.type&&""!==e.value}return t._cachedResult},$.spectrum={},$.spectrum.localization={},$.spectrum.palettes={},$.fn.spectrum.processNativeColorInputs=function(){var t=$("input[type=color]");t.length&&!u()&&t.spectrum({preferredFormat:"hex6"})},function(){function t(t){var r={r:0,g:0,b:0},a=1,o=!1,s=!1;return"string"==typeof t&&(t=T(t)),"object"==typeof t&&(t.hasOwnProperty("r")&&t.hasOwnProperty("g")&&t.hasOwnProperty("b")?(r=e(t.r,t.g,t.b),o=!0,s="%"===String(t.r).substr(-1)?"prgb":"rgb"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("v")?(t.s=R(t.s),t.v=R(t.v),r=i(t.h,t.s,t.v),o=!0,s="hsv"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("l")&&(t.s=R(t.s),t.l=R(t.l),r=n(t.h,t.s,t.l),o=!0,s="hsl"),t.hasOwnProperty("a")&&(a=t.a)),a=x(a),{ok:o,format:t.format||s,r:D(255,I(r.r,0)),g:D(255,I(r.g,0)),b:D(255,I(r.b,0)),a:a}}function e(t,e,r){return{r:255*k(t,255),g:255*k(e,255),b:255*k(r,255)}}function r(t,e,r){t=k(t,255),e=k(e,255),r=k(r,255);var n=I(t,e,r),a=D(t,e,r),i,o,s=(n+a)/2;if(n==a)i=o=0;else{var l=n-a;switch(o=s>.5?l/(2-n-a):l/(n+a),n){case t:i=(e-r)/l+(e<r?6:0);break;case e:i=(r-t)/l+2;break;case r:i=(t-e)/l+4;break}i/=6}return{h:i,s:o,l:s}}function n(t,e,r){function n(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var a,i,o;if(t=k(t,360),e=k(e,100),r=k(r,100),0===e)a=i=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;a=n(l,s,t+1/3),i=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*a,g:255*i,b:255*o}}function a(t,e,r){t=k(t,255),e=k(e,255),r=k(r,255);var n=I(t,e,r),a=D(t,e,r),i,o,s=n,l=n-a;if(o=0===n?0:l/n,n==a)i=0;else{switch(n){case t:i=(e-r)/l+(e<r?6:0);break;case e:i=(r-t)/l+2;break;case r:i=(t-e)/l+4;break}i/=6}return{h:i,s:o,v:s}}function i(t,e,r){t=6*k(t,360),e=k(e,100),r=k(r,100);var n=j.floor(t),a=t-n,i=r*(1-e),o=r*(1-a*e),s=r*(1-(1-a)*e),l=n%6;return{r:255*[r,o,i,i,s,r][l],g:255*[s,r,r,o,i,i][l],b:255*[i,i,s,r,r,o][l]}}function o(t,e,r,n){var a=[M(E(t).toString(16)),M(E(e).toString(16)),M(E(r).toString(16))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0):a.join("")}function s(t,e,r,n){return[M(H(n)),M(E(t).toString(16)),M(E(e).toString(16)),M(E(r).toString(16))].join("")}function l(t,e){e=0===e?0:e||10;var r=B(t).toHsl();return r.s-=e/100,r.s=S(r.s),B(r)}function c(t,e){e=0===e?0:e||10;var r=B(t).toHsl();return r.s+=e/100,r.s=S(r.s),B(r)}function f(t){return B(t).desaturate(100)}function u(t,e){e=0===e?0:e||10;var r=B(t).toHsl();return r.l+=e/100,r.l=S(r.l),B(r)}function h(t,e){e=0===e?0:e||10;var r=B(t).toRgb();return r.r=I(0,D(255,r.r-E(-e/100*255))),r.g=I(0,D(255,r.g-E(-e/100*255))),r.b=I(0,D(255,r.b-E(-e/100*255))),B(r)}function d(t,e){e=0===e?0:e||10;var r=B(t).toHsl();return r.l-=e/100,r.l=S(r.l),B(r)}function p(t,e){var r=B(t).toHsl(),n=(E(r.h)+e)%360;return r.h=n<0?360+n:n,B(r)}function g(t){var e=B(t).toHsl();return e.h=(e.h+180)%360,B(e)}function b(t){var e=B(t).toHsl(),r=e.h;return[B(t),B({h:(r+120)%360,s:e.s,l:e.l}),B({h:(r+240)%360,s:e.s,l:e.l})]}function v(t){var e=B(t).toHsl(),r=e.h;return[B(t),B({h:(r+90)%360,s:e.s,l:e.l}),B({h:(r+180)%360,s:e.s,l:e.l}),B({h:(r+270)%360,s:e.s,l:e.l})]}function m(t){var e=B(t).toHsl(),r=e.h;return[B(t),B({h:(r+72)%360,s:e.s,l:e.l}),B({h:(r+216)%360,s:e.s,l:e.l})]}function y(t,e,r){e=e||6,r=r||30;var n=B(t).toHsl(),a=360/r,i=[B(t)];for(n.h=(n.h-(a*e>>1)+720)%360;--e;)n.h=(n.h+a)%360,i.push(B(n));return i}function w(t,e){e=e||6;for(var r=B(t).toHsv(),n=r.h,a=r.s,i=r.v,o=[],s=1/e;e--;)o.push(B({h:n,s:a,v:i})),i=(i+s)%1;return o}function _(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function x(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function k(t,e){P(t)&&(t="100%");var r=A(t);return t=D(e,I(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),j.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function S(t){return D(1,I(0,t))}function C(t){return parseInt(t,16)}function P(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function A(t){return"string"==typeof t&&-1!=t.indexOf("%")}function M(t){return 1==t.length?"0"+t:""+t}function R(t){return t<=1&&(t=100*t+"%"),t}function H(t){return Math.round(255*parseFloat(t)).toString(16)}function F(t){return C(t)/255}function T(t){t=t.replace(O,"").replace(q,"").toLowerCase();var e=!1;if(L[t])t=L[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=V.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=V.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=V.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=V.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=V.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=V.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=V.hex8.exec(t))?{a:F(r[1]),r:C(r[2]),g:C(r[3]),b:C(r[4]),format:e?"name":"hex8"}:(r=V.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:!!(r=V.hex3.exec(t))&&{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),format:e?"name":"hex"}}var O=/^[\s,#]+/,q=/\s+$/,N=0,j=Math,E=j.round,D=j.min,I=j.max,z=j.random,B=function(e,r){if(e=e||"",r=r||{},e instanceof B)return e;if(!(this instanceof B))return new B(e,r);var n=t(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=E(100*this._a)/100,this._format=r.format||n.format,this._gradientType=r.gradientType,this._r<1&&(this._r=E(this._r)),this._g<1&&(this._g=E(this._g)),this._b<1&&(this._b=E(this._b)),this._ok=n.ok,this._tc_id=N++};B.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},setAlpha:function(t){return this._a=x(t),this._roundA=E(100*this._a)/100,this},toHsv:function(){var t=a(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=a(this._r,this._g,this._b),e=E(360*t.h),r=E(100*t.s),n=E(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=r(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=r(this._r,this._g,this._b),e=E(360*t.h),n=E(100*t.s),a=E(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+a+"%)":"hsla("+e+", "+n+"%, "+a+"%, "+this._roundA+")"},toHex:function(t){return o(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return s(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:E(this._r),g:E(this._g),b:E(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+E(this._r)+", "+E(this._g)+", "+E(this._b)+")":"rgba("+E(this._r)+", "+E(this._g)+", "+E(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:E(100*k(this._r,255))+"%",g:E(100*k(this._g,255))+"%",b:E(100*k(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+E(100*k(this._r,255))+"%, "+E(100*k(this._g,255))+"%, "+E(100*k(this._b,255))+"%)":"rgba("+E(100*k(this._r,255))+"%, "+E(100*k(this._g,255))+"%, "+E(100*k(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(K[o(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+s(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){r=B(t).toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(u,arguments)},brighten:function(){return this._applyModification(h,arguments)},darken:function(){return this._applyModification(d,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(c,arguments)},greyscale:function(){return this._applyModification(f,arguments)},spin:function(){return this._applyModification(p,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(y,arguments)},complement:function(){return this._applyCombination(g,arguments)},monochromatic:function(){return this._applyCombination(w,arguments)},splitcomplement:function(){return this._applyCombination(m,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(v,arguments)}},B.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]="a"===n?t[n]:R(t[n]));t=r}return B(t,e)},B.equals=function(t,e){return!(!t||!e)&&B(t).toRgbString()==B(e).toRgbString()},B.random=function(){return B.fromRatio({r:z(),g:z(),b:z()})},B.mix=function(t,e,r){r=0===r?0:r||50;var n=B(t).toRgb(),a=B(e).toRgb(),i=r/100,o=2*i-1,s=a.a-n.a,l;l=o*s==-1?o:(o+s)/(1+o*s),l=(l+1)/2;var c=1-l,f={r:a.r*l+n.r*c,g:a.g*l+n.g*c,b:a.b*l+n.b*c,a:a.a*i+n.a*(1-i)};return B(f)},B.readability=function(t,e){var r=B(t),n=B(e),a=r.toRgb(),i=n.toRgb(),o=r.getBrightness(),s=n.getBrightness(),l=Math.max(a.r,i.r)-Math.min(a.r,i.r)+Math.max(a.g,i.g)-Math.min(a.g,i.g)+Math.max(a.b,i.b)-Math.min(a.b,i.b);return{brightness:Math.abs(o-s),color:l}},B.isReadable=function(t,e){var r=B.readability(t,e);return r.brightness>125&&r.color>500},B.mostReadable=function(t,e){for(var r=null,n=0,a=!1,i=0;i<e.length;i++){var o=B.readability(t,e[i]),s=o.brightness>125&&o.color>500,l=o.brightness/125*3+o.color/500;(s&&!a||s&&a&&l>n||!s&&!a&&l>n)&&(a=s,n=l,r=B(e[i]))}return r};var L=B.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},K=B.hexNames=_(L),V=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",a="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+a),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();window.tinycolor=B}(),$(function(){$.fn.spectrum.load&&$.fn.spectrum.processNativeColorInputs()})});
|
config/setup.php
CHANGED
@@ -14,10 +14,7 @@ if( !defined('ABSPATH')){
|
|
14 |
*/
|
15 |
function gmedia_default_options(){
|
16 |
|
17 |
-
$gm['site_email'] = '';
|
18 |
$gm['site_ID'] = '';
|
19 |
-
$gm['site_title'] = '';
|
20 |
-
$gm['site_description'] = '';
|
21 |
$gm['mobile_app'] = 0;
|
22 |
|
23 |
$gm['modules_update'] = 0;
|
@@ -47,6 +44,7 @@ function gmedia_default_options(){
|
|
47 |
//$gm['default_gmedia_term_comment_status'] = 'closed'; // can be 'closed', 'open'
|
48 |
|
49 |
$gm['delete_originals'] = '0';
|
|
|
50 |
$gm['uninstall_dropdata'] = 'none'; // can be 'all', 'none', 'db'
|
51 |
|
52 |
$gm['name2title_capitalize'] = '1';
|
@@ -86,7 +84,8 @@ function gmedia_default_options(){
|
|
86 |
$gm['image'] = array('width' => 2200, 'height' => 2200, 'quality' => 85, 'crop' => 0);
|
87 |
|
88 |
//$gm['modules_xml'] = 'https://codeasily.com/gmedia_modules/modules_v1.xml';
|
89 |
-
|
|
|
90 |
$gm['license_name'] = '';
|
91 |
$gm['purchase_key'] = '';
|
92 |
$gm['license_key'] = '';
|
@@ -137,6 +136,10 @@ function gmedia_default_options(){
|
|
137 |
|
138 |
$gm['gm_screen_options']['library_edit_quicktags'] = 'true';
|
139 |
|
|
|
|
|
|
|
|
|
140 |
return $gm;
|
141 |
|
142 |
}
|
@@ -178,6 +181,54 @@ function gmedia_install(){
|
|
178 |
|
179 |
gmedia_capabilities();
|
180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
// upgrade function changed in WordPress 2.3
|
182 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
183 |
|
@@ -199,6 +250,7 @@ function gmedia_install(){
|
|
199 |
$gmedia_term = $wpdb->prefix . 'gmedia_term';
|
200 |
$gmedia_term_meta = $wpdb->prefix . 'gmedia_term_meta';
|
201 |
$gmedia_term_relationships = $wpdb->prefix . 'gmedia_term_relationships';
|
|
|
202 |
|
203 |
if($wpdb->get_var("show tables like '$gmedia'") != $gmedia){
|
204 |
$sql = "SET GLOBAL innodb_file_format = Barracuda, innodb_large_prefix = ON;";
|
@@ -282,44 +334,24 @@ function gmedia_install(){
|
|
282 |
dbDelta($sql);
|
283 |
}
|
284 |
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
if( !get_option('gmediaInstallDate')){
|
302 |
-
$installDate = time();
|
303 |
-
add_option('gmediaInstallDate', $installDate);
|
304 |
-
}
|
305 |
-
update_option('gmediaOptions', $gmGallery->options);
|
306 |
-
} else{
|
307 |
-
$default_options = gmedia_default_options();
|
308 |
-
unset($gmGallery->options['folder'], $gmGallery->options['taxonomies']);
|
309 |
-
$new_options = $gmCore->array_diff_key_recursive($default_options, $gmGallery->options);
|
310 |
-
$gmGallery->options = $gmCore->array_replace_recursive($gmGallery->options, $new_options);
|
311 |
-
update_option('gmediaOptions', $gmGallery->options);
|
312 |
-
}
|
313 |
-
|
314 |
-
// try to make gallery dirs if not exists
|
315 |
-
foreach($gmGallery->options['folder'] as $folder){
|
316 |
-
wp_mkdir_p($gmCore->upload['path'] . '/' . $folder);
|
317 |
}
|
318 |
|
319 |
-
wp_clear_scheduled_hook('gmedia_app_cronjob');
|
320 |
-
wp_schedule_event(time(), 'gmedia_app', 'gmedia_app_cronjob');
|
321 |
-
|
322 |
-
add_option('gmediaActivated', time());
|
323 |
}
|
324 |
|
325 |
/**
|
@@ -333,9 +365,10 @@ function gmedia_deactivate(){
|
|
333 |
flush_rewrite_rules(false);
|
334 |
|
335 |
wp_clear_scheduled_hook('gmedia_app_cronjob');
|
|
|
336 |
|
337 |
$options = get_option('gmediaOptions');
|
338 |
-
if((int) $options['mobile_app']){
|
339 |
$gmCore->app_service('app_deactivateplugin');
|
340 |
}
|
341 |
|
14 |
*/
|
15 |
function gmedia_default_options(){
|
16 |
|
|
|
17 |
$gm['site_ID'] = '';
|
|
|
|
|
18 |
$gm['mobile_app'] = 0;
|
19 |
|
20 |
$gm['modules_update'] = 0;
|
44 |
//$gm['default_gmedia_term_comment_status'] = 'closed'; // can be 'closed', 'open'
|
45 |
|
46 |
$gm['delete_originals'] = '0';
|
47 |
+
$gm['disable_logs'] = '0';
|
48 |
$gm['uninstall_dropdata'] = 'none'; // can be 'all', 'none', 'db'
|
49 |
|
50 |
$gm['name2title_capitalize'] = '1';
|
84 |
$gm['image'] = array('width' => 2200, 'height' => 2200, 'quality' => 85, 'crop' => 0);
|
85 |
|
86 |
//$gm['modules_xml'] = 'https://codeasily.com/gmedia_modules/modules_v1.xml';
|
87 |
+
//$gm['modules_xml'] = 'https://www.dropbox.com/s/t7oawbuxy1me5gk/modules_v1.xml?dl=1';
|
88 |
+
$gm['modules_xml'] = 'https://www.dropbox.com/s/ysmedfuxyy5ff3w/modules_v2.xml?dl=1';
|
89 |
$gm['license_name'] = '';
|
90 |
$gm['purchase_key'] = '';
|
91 |
$gm['license_key'] = '';
|
136 |
|
137 |
$gm['gm_screen_options']['library_edit_quicktags'] = 'true';
|
138 |
|
139 |
+
$gm['gm_screen_options']['per_page_gmedia_log'] = '100';
|
140 |
+
$gm['gm_screen_options']['orderby_gmedia_log'] = 'log_date';
|
141 |
+
$gm['gm_screen_options']['sortorder_gmedia_log'] = 'DESC';
|
142 |
+
|
143 |
return $gm;
|
144 |
|
145 |
}
|
181 |
|
182 |
gmedia_capabilities();
|
183 |
|
184 |
+
gmedia_db_tables();
|
185 |
+
|
186 |
+
// check one table again, to be sure
|
187 |
+
$gmedia = $wpdb->prefix . 'gmedia';
|
188 |
+
if($wpdb->get_var("show tables like '$gmedia'") != $gmedia){
|
189 |
+
update_option("gmediaInitCheck", __('GmediaGallery: Tables could not created, please check your database settings', 'grand-media'));
|
190 |
+
|
191 |
+
return;
|
192 |
+
}
|
193 |
+
|
194 |
+
if( !get_option('GmediaHashID_salt')){
|
195 |
+
$ustr = wp_generate_password(12, false);
|
196 |
+
add_option('GmediaHashID_salt', $ustr);
|
197 |
+
}
|
198 |
+
|
199 |
+
// set the default settings, if we didn't upgrade
|
200 |
+
if(empty($gmGallery->options)){
|
201 |
+
$gmGallery->options = gmedia_default_options();
|
202 |
+
// Set installation date
|
203 |
+
if( !get_option('gmediaInstallDate')){
|
204 |
+
$installDate = time();
|
205 |
+
add_option('gmediaInstallDate', $installDate);
|
206 |
+
}
|
207 |
+
update_option('gmediaOptions', $gmGallery->options);
|
208 |
+
} else{
|
209 |
+
$default_options = gmedia_default_options();
|
210 |
+
unset($gmGallery->options['folder'], $gmGallery->options['taxonomies']);
|
211 |
+
$new_options = $gmCore->array_diff_key_recursive($default_options, $gmGallery->options);
|
212 |
+
$gmGallery->options = $gmCore->array_replace_recursive($gmGallery->options, $new_options);
|
213 |
+
$gmGallery->options['gm_screen_options'] = $default_options['gm_screen_options'];
|
214 |
+
update_option('gmediaOptions', $gmGallery->options);
|
215 |
+
}
|
216 |
+
|
217 |
+
// try to make gallery dirs if not exists
|
218 |
+
foreach($gmGallery->options['folder'] as $folder){
|
219 |
+
wp_mkdir_p($gmCore->upload['path'] . '/' . $folder);
|
220 |
+
}
|
221 |
+
|
222 |
+
add_option('gmediaActivated', time());
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Create DB Tables
|
227 |
+
*/
|
228 |
+
function gmedia_db_tables(){
|
229 |
+
/** @var $wpdb wpdb */
|
230 |
+
global $wpdb;
|
231 |
+
|
232 |
// upgrade function changed in WordPress 2.3
|
233 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
234 |
|
250 |
$gmedia_term = $wpdb->prefix . 'gmedia_term';
|
251 |
$gmedia_term_meta = $wpdb->prefix . 'gmedia_term_meta';
|
252 |
$gmedia_term_relationships = $wpdb->prefix . 'gmedia_term_relationships';
|
253 |
+
$gmedia_log = $wpdb->prefix . 'gmedia_log';
|
254 |
|
255 |
if($wpdb->get_var("show tables like '$gmedia'") != $gmedia){
|
256 |
$sql = "SET GLOBAL innodb_file_format = Barracuda, innodb_large_prefix = ON;";
|
334 |
dbDelta($sql);
|
335 |
}
|
336 |
|
337 |
+
if($wpdb->get_var("show tables like '$gmedia_log'") != $gmedia_log){
|
338 |
+
$sql = "SET GLOBAL innodb_file_format = Barracuda, innodb_large_prefix = ON;";
|
339 |
+
$sql .= "CREATE TABLE {$gmedia_log} (
|
340 |
+
log VARCHAR(200) NOT NULL DEFAULT '',
|
341 |
+
ID BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
|
342 |
+
log_author BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
|
343 |
+
log_date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
344 |
+
log_data LONGTEXT,
|
345 |
+
ip_address VARCHAR(45) NOT NULL DEFAULT '',
|
346 |
+
KEY log (log),
|
347 |
+
KEY ID (ID),
|
348 |
+
KEY log_author (log_author),
|
349 |
+
KEY log_date (log_date),
|
350 |
+
KEY ip_address (ip_address)
|
351 |
+
) {$charset_collate}";
|
352 |
+
dbDelta($sql);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
}
|
354 |
|
|
|
|
|
|
|
|
|
355 |
}
|
356 |
|
357 |
/**
|
365 |
flush_rewrite_rules(false);
|
366 |
|
367 |
wp_clear_scheduled_hook('gmedia_app_cronjob');
|
368 |
+
wp_clear_scheduled_hook('gmedia_modules_update');
|
369 |
|
370 |
$options = get_option('gmediaOptions');
|
371 |
+
if((int) $options['mobile_app'] || (int) $options['site_ID']){
|
372 |
$gmCore->app_service('app_deactivateplugin');
|
373 |
}
|
374 |
|
config/update.php
CHANGED
@@ -865,12 +865,20 @@ function gmedia_quite_update(){
|
|
865 |
|
866 |
$new_options = $gmCore->array_diff_key_recursive($default_options, $options);
|
867 |
|
868 |
-
if(version_compare($current_version, '1.
|
869 |
-
|
870 |
-
|
871 |
}
|
872 |
|
|
|
|
|
|
|
|
|
|
|
|
|
873 |
$gmGallery->options = $gmCore->array_replace_recursive($options, $new_options);
|
|
|
|
|
874 |
update_option('gmediaOptions', $gmGallery->options);
|
875 |
update_option("gmediaVersion", GMEDIA_VERSION);
|
876 |
|
@@ -878,12 +886,12 @@ function gmedia_quite_update(){
|
|
878 |
$gmCore->app_service('app_updatecron');
|
879 |
}
|
880 |
|
881 |
-
$gmCore->delete_folder($gmCore->upload['path'] . '/module/afflux');
|
882 |
-
$gmCore->delete_folder($gmCore->upload['path'] . '/module/jq-mplayer');
|
883 |
-
$gmCore->delete_folder($gmCore->upload['path'] . '/module/minima');
|
884 |
$gmCore->delete_folder($gmCore->upload['path'] . '/module/phantom');
|
|
|
885 |
$gmCore->delete_folder($gmCore->upload['path'] . '/module/wp-videoplayer');
|
886 |
$gmCore->delete_folder($gmCore->upload['path'] . '/module/cubik-lite');
|
|
|
|
|
887 |
|
888 |
}
|
889 |
}
|
865 |
|
866 |
$new_options = $gmCore->array_diff_key_recursive($default_options, $options);
|
867 |
|
868 |
+
if(version_compare($current_version, '1.10.03', '<')){
|
869 |
+
$gmCore->delete_folder(WP_PLUGIN_DIR . '/grand-media-logger');
|
870 |
+
gmedia_db_tables();
|
871 |
}
|
872 |
|
873 |
+
if(version_compare($current_version, '1.10.05', '<')){
|
874 |
+
//$new_options['modules_xml'] = 'https://www.dropbox.com/s/t7oawbuxy1me5gk/modules_v1.xml?dl=1';
|
875 |
+
$new_options['modules_xml'] = 'https://www.dropbox.com/s/ysmedfuxyy5ff3w/modules_v2.xml?dl=1';
|
876 |
+
}
|
877 |
+
|
878 |
+
|
879 |
$gmGallery->options = $gmCore->array_replace_recursive($options, $new_options);
|
880 |
+
$gmGallery->options['gm_screen_options'] = $default_options['gm_screen_options'];
|
881 |
+
|
882 |
update_option('gmediaOptions', $gmGallery->options);
|
883 |
update_option("gmediaVersion", GMEDIA_VERSION);
|
884 |
|
886 |
$gmCore->app_service('app_updatecron');
|
887 |
}
|
888 |
|
|
|
|
|
|
|
889 |
$gmCore->delete_folder($gmCore->upload['path'] . '/module/phantom');
|
890 |
+
$gmCore->delete_folder($gmCore->upload['path'] . '/module/jq-mplayer');
|
891 |
$gmCore->delete_folder($gmCore->upload['path'] . '/module/wp-videoplayer');
|
892 |
$gmCore->delete_folder($gmCore->upload['path'] . '/module/cubik-lite');
|
893 |
+
$gmCore->delete_folder($gmCore->upload['path'] . '/module/afflux');
|
894 |
+
$gmCore->delete_folder($gmCore->upload['path'] . '/module/minima');
|
895 |
|
896 |
}
|
897 |
}
|
grand-media.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
* Plugin Name: Gmedia Gallery
|
4 |
* Plugin URI: http://wordpress.org/extend/plugins/grand-media/
|
5 |
* Description: Gmedia Gallery - powerful media library plugin for creating beautiful galleries and managing files.
|
6 |
-
* Version: 1.
|
7 |
* Author: Rattus
|
8 |
-
* Author URI:
|
9 |
* Requires at least: 3.7
|
10 |
-
* Tested up to: 4.
|
11 |
* Text Domain: grand-media
|
12 |
* Domain Path: /lang
|
13 |
*
|
@@ -36,13 +36,13 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])){
|
|
36 |
die('You are not allowed to call this page directly.');
|
37 |
}
|
38 |
|
39 |
-
if(!class_exists('Gmedia')){
|
40 |
/**
|
41 |
* Class Gmedia
|
42 |
*/
|
43 |
-
class Gmedia{
|
44 |
|
45 |
-
var $version = '1.
|
46 |
var $dbversion = '1.8.0';
|
47 |
var $minium_WP = '3.7';
|
48 |
var $options = '';
|
@@ -56,7 +56,7 @@ if(!class_exists('Gmedia')){
|
|
56 |
function __construct(){
|
57 |
|
58 |
// Stop the plugin if we missed the requirements
|
59 |
-
if(!$this->required_version()){
|
60 |
return;
|
61 |
}
|
62 |
|
@@ -102,7 +102,7 @@ if(!class_exists('Gmedia')){
|
|
102 |
add_action('deleted_user', array(&$this, 'reassign_media'), 10, 2);
|
103 |
|
104 |
add_action('init', array(&$this, 'gmedia_post_type'), 0);
|
105 |
-
add_action('init', array(&$this, 'gm_schedule_update_checks'), 0);
|
106 |
|
107 |
// register widget
|
108 |
add_action('widgets_init', array(&$this, 'register_gmedia_widget'));
|
@@ -114,6 +114,7 @@ if(!class_exists('Gmedia')){
|
|
114 |
//add_action( 'after_plugin_row', array(&$this, 'check_message_version') );
|
115 |
//Add some links on the plugins page
|
116 |
add_filter('plugin_row_meta', array(&$this, 'add_plugin_links'), 10, 2);
|
|
|
117 |
|
118 |
}
|
119 |
|
@@ -197,17 +198,15 @@ if(!class_exists('Gmedia')){
|
|
197 |
|
198 |
return false;
|
199 |
}
|
200 |
-
if(version_compare('5.2', phpversion(), '>')){
|
201 |
-
$note = sprintf(__('Attention! Your server php version is: %s. Gmedia Gallery requires php version 5.2+ in order to run properly. Please upgrade your server!', 'grand-media'), phpversion());
|
202 |
-
update_option('gmediaInitCheck', $note);
|
203 |
-
add_action('admin_notices', array(&$this, 'admin_notices'));
|
204 |
-
}
|
205 |
if(version_compare('5.3', phpversion(), '>')){
|
|
|
206 |
if(ini_get('safe_mode')){
|
207 |
-
$note
|
208 |
-
update_option('gmediaInitCheck', $note);
|
209 |
-
add_action('admin_notices', array(&$this, 'admin_notices'));
|
210 |
}
|
|
|
|
|
|
|
|
|
211 |
}
|
212 |
|
213 |
return true;
|
@@ -217,13 +216,23 @@ if(!class_exists('Gmedia')){
|
|
217 |
* Called via Setup and register_activate hook after gmedia_install() function
|
218 |
*/
|
219 |
function gmedia_after_activation(){
|
220 |
-
|
221 |
|
222 |
delete_option('gmediaActivated');
|
223 |
|
224 |
flush_rewrite_rules(false);
|
225 |
|
226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
}
|
228 |
|
229 |
function upgrade(){
|
@@ -254,8 +263,12 @@ if(!class_exists('Gmedia')){
|
|
254 |
gmedia_quite_update();
|
255 |
add_action('init', 'gmedia_flush_rewrite_rules', 1000);
|
256 |
|
257 |
-
if(
|
258 |
-
|
|
|
|
|
|
|
|
|
259 |
}
|
260 |
}
|
261 |
|
@@ -286,7 +299,7 @@ if(!class_exists('Gmedia')){
|
|
286 |
// Load the options
|
287 |
$default_options = gmedia_default_options();
|
288 |
$db_options = get_option('gmediaOptions');
|
289 |
-
if(!is_array($db_options)){
|
290 |
$db_options = array();
|
291 |
}
|
292 |
$this->options = array_merge($default_options, $db_options);
|
@@ -331,18 +344,20 @@ if(!class_exists('Gmedia')){
|
|
331 |
global $gmCore;
|
332 |
|
333 |
wp_register_script('gmedia-global-backend', $gmCore->gmedia_url . '/admin/assets/js/gmedia.global.js', array('jquery'), '1.8.26');
|
334 |
-
wp_localize_script('gmedia-global-backend', 'GmediaGallery', array(
|
335 |
-
|
336 |
-
|
337 |
-
|
|
|
338 |
));
|
339 |
|
340 |
-
wp_register_style('grand-media', $gmCore->gmedia_url . '/admin/assets/css/gmedia.admin.css', array(), '1.
|
341 |
-
wp_register_script('grand-media', $gmCore->gmedia_url . '/admin/assets/js/gmedia.admin.js', array('jquery', 'gmedia-global-backend'), '1.
|
342 |
-
wp_localize_script('grand-media', 'grandMedia', array(
|
343 |
-
|
344 |
-
|
345 |
-
|
|
|
346 |
));
|
347 |
|
348 |
wp_register_style('gmedia-bootstrap', $gmCore->gmedia_url . '/assets/bootstrap/css/bootstrap.min.css', array(), '3.3.4', 'all');
|
@@ -353,59 +368,60 @@ if(!class_exists('Gmedia')){
|
|
353 |
}
|
354 |
|
355 |
function register_scripts_frontend(){
|
356 |
-
global $gmCore, $wp_scripts;
|
357 |
|
358 |
wp_register_script('gmedia-global-frontend', $gmCore->gmedia_url . '/assets/gmedia.global.front.js', array('jquery'), '1.9.16');
|
359 |
-
wp_localize_script('gmedia-global-frontend', 'GmediaGallery', array(
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
|
|
365 |
));
|
366 |
|
367 |
|
368 |
-
if(!wp_script_is('velocity', 'registered') || version_compare($wp_scripts->registered['velocity']->ver, '1.4.1', '<')){
|
369 |
wp_deregister_script('velocity');
|
370 |
wp_register_script('velocity', $gmCore->gmedia_url . '/assets/velocity/velocity.min.js', array('jquery'), '1.4.1', true);
|
371 |
}
|
372 |
|
373 |
-
if(!wp_script_is('mediaelement', 'registered')){
|
374 |
-
wp_register_style('mediaelement', $gmCore->gmedia_url . '/assets/mediaelement/mediaelementplayer.min.css', array(), '2.
|
375 |
-
wp_register_script('mediaelement', $gmCore->gmedia_url . '/assets/mediaelement/mediaelement-and-player.min.js', array('jquery'), '2.
|
376 |
}
|
377 |
|
378 |
-
if(!wp_script_is('wavesurfer', 'registered')){
|
379 |
wp_register_script('wavesurfer', $gmCore->gmedia_url . '/assets/wavesurfer/wavesurfer.min.js', array('jquery'), '1.2.8', true);
|
380 |
}
|
381 |
|
382 |
-
if(!wp_script_is('swiper', 'registered') || version_compare($wp_scripts->registered['swiper']->ver, '3.4.0', '<')){
|
383 |
wp_deregister_style('swiper');
|
384 |
wp_deregister_script('swiper');
|
385 |
wp_register_style('swiper', $gmCore->gmedia_url . '/assets/swiper/swiper.min.css', array(), '3.4.0', 'screen');
|
386 |
wp_register_script('swiper', $gmCore->gmedia_url . '/assets/swiper/swiper.jquery.min.js', array('jquery'), '3.4.0', true);
|
387 |
}
|
388 |
|
389 |
-
if(!wp_script_is('magnific-popup', 'registered') || version_compare($wp_scripts->registered['magnific-popup']->ver, '1.1.0', '<')){
|
390 |
wp_deregister_style('magnific-popup');
|
391 |
wp_deregister_script('magnific-popup');
|
392 |
wp_register_style('magnific-popup', $gmCore->gmedia_url . '/assets/mag-popup/magnific-popup.css', array(), '1.1.0', 'screen');
|
393 |
wp_register_script('magnific-popup', $gmCore->gmedia_url . '/assets/mag-popup/jquery.magnific-popup.min.js', array('jquery'), '1.1.0', true);
|
394 |
}
|
395 |
|
396 |
-
if(!wp_script_is('photoswipe', 'registered') || version_compare($wp_scripts->registered['photoswipe']->ver, '3.0.5', '<=')){
|
397 |
wp_deregister_style('photoswipe');
|
398 |
wp_deregister_script('photoswipe');
|
399 |
wp_register_style('photoswipe', $gmCore->gmedia_url . '/assets/photoswipe/photoswipe.css', array(), '3.0.5', 'screen');
|
400 |
wp_register_script('photoswipe', $gmCore->gmedia_url . '/assets/photoswipe/photoswipe.jquery.min.js', array('jquery'), '3.0.5', true);
|
401 |
}
|
402 |
|
403 |
-
if(!wp_script_is('easing', 'registered') || ($wp_scripts->registered['easing']->ver !== false && version_compare($wp_scripts->registered['easing']->ver, '1.3.0', '<'))){
|
404 |
wp_deregister_script('easing');
|
405 |
wp_register_script('easing', $gmCore->gmedia_url . '/assets/jq-plugins/jquery.easing.js', array('jquery'), '1.3.0', true);
|
406 |
}
|
407 |
-
if(!wp_script_is('fancybox', 'registered') || ($wp_scripts->registered['fancybox']->ver !== false && version_compare($wp_scripts->registered['fancybox']->ver, '1.3.4', '<'))){
|
408 |
-
if(!defined('FANCYBOX_VERSION')){
|
409 |
wp_deregister_style('fancybox');
|
410 |
wp_register_style('fancybox', $gmCore->gmedia_url . '/assets/fancybox/jquery.fancybox-1.3.4.css', array(), '1.3.4');
|
411 |
}
|
@@ -414,11 +430,11 @@ if(!class_exists('Gmedia')){
|
|
414 |
}
|
415 |
|
416 |
|
417 |
-
if(!wp_script_is('jplayer', 'registered') || version_compare($wp_scripts->registered['jplayer']->ver, '2.6.4', '<')){
|
418 |
wp_deregister_script('jplayer');
|
419 |
wp_register_script('jplayer', $gmCore->gmedia_url . '/assets/jplayer/jquery.jplayer.min.js', array('jquery'), '2.6.4', true);
|
420 |
}
|
421 |
-
if(!wp_script_is('swfobject', 'registered') || version_compare($wp_scripts->registered['swfobject']->ver, '2.2', '<')){
|
422 |
wp_deregister_script('swfobject');
|
423 |
wp_register_script('swfobject', $gmCore->gmedia_url . '/assets/swf/swfobject.js', array(), '2.2', true);
|
424 |
wp_register_script('swfaddress', $gmCore->gmedia_url . '/assets/swf/swfaddress.js', array(), '2.4', true);
|
@@ -436,7 +452,7 @@ if(!class_exists('Gmedia')){
|
|
436 |
|
437 |
function load_module_scripts(){
|
438 |
global $wp_styles;
|
439 |
-
$deps
|
440 |
$xmlhttprequest = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
|
441 |
foreach($this->do_module as $m => $module){
|
442 |
$deps = array_merge($deps, explode(',', $module['info']['dependencies']));
|
@@ -461,10 +477,10 @@ if(!class_exists('Gmedia')){
|
|
461 |
// }
|
462 |
// }
|
463 |
$files = glob($module['path'] . '/js/*.js', GLOB_NOSORT);
|
464 |
-
if(!empty($files)){
|
465 |
$files = array_map('basename', $files);
|
466 |
foreach($files as $file){
|
467 |
-
$_ver
|
468 |
$handle = "{$module['name']}_{$file}";
|
469 |
wp_enqueue_script($handle, "{$module['url']}/js/{$file}", array('jquery'), $_ver, true);
|
470 |
if($xmlhttprequest){
|
@@ -474,7 +490,7 @@ if(!class_exists('Gmedia')){
|
|
474 |
}
|
475 |
}
|
476 |
$this->do_module = array();
|
477 |
-
if(!empty($this->import_styles)){
|
478 |
add_action('wp_print_head_scripts', array(&$this, 'print_import_styles'), 1);
|
479 |
add_action('wp_print_footer_scripts', array(&$this, 'print_import_styles'), 1);
|
480 |
}
|
@@ -492,7 +508,7 @@ if(!class_exists('Gmedia')){
|
|
492 |
function load_module_styles($module){
|
493 |
$module_styles = '';
|
494 |
$files = glob($module['path'] . '/css/*.css', GLOB_NOSORT);
|
495 |
-
if(!empty($files)){
|
496 |
$files = array_map('basename', $files);
|
497 |
foreach($files as $file){
|
498 |
$src = "{$module['url']}/css/{$file}";
|
@@ -507,7 +523,7 @@ if(!class_exists('Gmedia')){
|
|
507 |
}
|
508 |
|
509 |
function print_import_styles(){
|
510 |
-
if(!empty($this->import_styles)){
|
511 |
echo "\n<style type='text/css' class='gmedia_assets_style_import'>";
|
512 |
foreach($this->import_styles as $src){
|
513 |
if('http' !== substr($src, 0, 4)){
|
@@ -605,42 +621,43 @@ if(!class_exists('Gmedia')){
|
|
605 |
* Register Gmedia Post Types
|
606 |
*/
|
607 |
function gmedia_post_type(){
|
608 |
-
$args = array(
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
|
|
624 |
// 'edit_comment' => 'edit_gmedia_comment',
|
625 |
// 'moderate_comments' => 'moderate_gmedia_comments',
|
626 |
// 'edit_post' => 'edit_gmedia_post',
|
627 |
// 'edit_posts' => 'edit_gmedia_posts',
|
628 |
-
|
629 |
-
|
630 |
);
|
631 |
register_post_type('gmedia', $args);
|
632 |
|
633 |
$args['label'] = __('Gmedia Albums', 'grand-media');
|
634 |
$args['show_in_nav_menus'] = true;
|
635 |
$args['hierarchical'] = true;
|
636 |
-
$args['has_archive'] = (bool)((int)$this->options['gmedia_album_has_archive']);
|
637 |
-
$args['exclude_from_search'] = (bool)((int)$this->options['gmedia_album_exclude_from_search']);
|
638 |
$args['rewrite'] = array('slug' => $this->options['gmedia_album_post_slug']);
|
639 |
register_post_type('gmedia_album', $args);
|
640 |
|
641 |
$args['label'] = __('Gmedia Galleries', 'grand-media');
|
642 |
-
$args['has_archive'] = (bool)((int)$this->options['gmedia_gallery_has_archive']);
|
643 |
-
$args['exclude_from_search'] = (bool)((int)$this->options['gmedia_gallery_exclude_from_search']);
|
644 |
$args['rewrite'] = array('slug' => $this->options['gmedia_gallery_post_slug']);
|
645 |
register_post_type('gmedia_gallery', $args);
|
646 |
|
@@ -649,30 +666,33 @@ if(!class_exists('Gmedia')){
|
|
649 |
add_filter('get_edit_post_link', array($this, 'gmedia_post_type_edit_link'), 10, 3);
|
650 |
|
651 |
|
652 |
-
$args = array(
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
|
|
659 |
);
|
660 |
-
$args['labels'] = array(
|
661 |
-
|
662 |
-
|
|
|
663 |
);
|
664 |
register_taxonomy('gmedia_category', null, $args);
|
665 |
|
666 |
$args['rewrite'] = array('slug' => 'gmedia-tag');
|
667 |
-
$args['labels'] = array(
|
668 |
-
|
669 |
-
|
|
|
670 |
);
|
671 |
register_taxonomy('gmedia_tag', null, $args);
|
672 |
|
673 |
add_filter('wp_link_query_args', array($this, 'exclude_gmedia_from_link_query'));
|
674 |
|
675 |
-
if(!empty($this->options['flush_rewrite_rules'])){
|
676 |
unset($this->options['flush_rewrite_rules']);
|
677 |
update_option('gmediaOptions', $this->options);
|
678 |
flush_rewrite_rules(false);
|
@@ -787,14 +807,6 @@ if(!class_exists('Gmedia')){
|
|
787 |
return $shedules;
|
788 |
}
|
789 |
|
790 |
-
function gm_schedule_update_checks(){
|
791 |
-
$wp_installing = (bool)(defined('WP_INSTALLING') && WP_INSTALLING);
|
792 |
-
|
793 |
-
if(!wp_next_scheduled('gmedia_modules_update') && !$wp_installing){
|
794 |
-
wp_schedule_event(time(), 'daily', 'gmedia_modules_update');
|
795 |
-
}
|
796 |
-
}
|
797 |
-
|
798 |
function gmedia_app_cronjob(){
|
799 |
global $gmCore;
|
800 |
$gmCore->app_service('app_updatecron');
|
@@ -839,13 +851,140 @@ if(!class_exists('Gmedia')){
|
|
839 |
if($file == plugin_basename(__FILE__)){
|
840 |
$links[] = '<a href="admin.php?page=GrandMedia_Settings">' . __('Settings', 'grand-media') . '</a>';
|
841 |
$links[] = '<a href="admin.php?page=GrandMedia_Modules">' . __('Modules', 'grand-media') . '</a>';
|
842 |
-
$links[] = '<a href="
|
843 |
-
$links[] = '<a href="
|
844 |
}
|
845 |
|
846 |
return $links;
|
847 |
}
|
848 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
849 |
}
|
850 |
|
851 |
// Let's start the holy plugin
|
3 |
* Plugin Name: Gmedia Gallery
|
4 |
* Plugin URI: http://wordpress.org/extend/plugins/grand-media/
|
5 |
* Description: Gmedia Gallery - powerful media library plugin for creating beautiful galleries and managing files.
|
6 |
+
* Version: 1.12.1
|
7 |
* Author: Rattus
|
8 |
+
* Author URI: https://codeasily.com/
|
9 |
* Requires at least: 3.7
|
10 |
+
* Tested up to: 4.9.1
|
11 |
* Text Domain: grand-media
|
12 |
* Domain Path: /lang
|
13 |
*
|
36 |
die('You are not allowed to call this page directly.');
|
37 |
}
|
38 |
|
39 |
+
if( !class_exists('Gmedia')){
|
40 |
/**
|
41 |
* Class Gmedia
|
42 |
*/
|
43 |
+
class Gmedia {
|
44 |
|
45 |
+
var $version = '1.12.1';
|
46 |
var $dbversion = '1.8.0';
|
47 |
var $minium_WP = '3.7';
|
48 |
var $options = '';
|
56 |
function __construct(){
|
57 |
|
58 |
// Stop the plugin if we missed the requirements
|
59 |
+
if( !$this->required_version()){
|
60 |
return;
|
61 |
}
|
62 |
|
102 |
add_action('deleted_user', array(&$this, 'reassign_media'), 10, 2);
|
103 |
|
104 |
add_action('init', array(&$this, 'gmedia_post_type'), 0);
|
105 |
+
//add_action('init', array(&$this, 'gm_schedule_update_checks'), 0);
|
106 |
|
107 |
// register widget
|
108 |
add_action('widgets_init', array(&$this, 'register_gmedia_widget'));
|
114 |
//add_action( 'after_plugin_row', array(&$this, 'check_message_version') );
|
115 |
//Add some links on the plugins page
|
116 |
add_filter('plugin_row_meta', array(&$this, 'add_plugin_links'), 10, 2);
|
117 |
+
add_action('admin_footer', array(&$this, 'add_plugin_feedback'));
|
118 |
|
119 |
}
|
120 |
|
198 |
|
199 |
return false;
|
200 |
}
|
|
|
|
|
|
|
|
|
|
|
201 |
if(version_compare('5.3', phpversion(), '>')){
|
202 |
+
$note = sprintf(__('Attention! Your server php version is: %s. Gmedia Gallery requires php version 5.3+ in order to run properly. Please upgrade your server!', 'grand-media'), phpversion());
|
203 |
if(ini_get('safe_mode')){
|
204 |
+
$note .= '<br/>' . __('Attention! Your server safe mode is: ON. Gmedia Gallery requires safe mode to be OFF in order to run properly. Please set your server safe mode option!', 'grand-media');
|
|
|
|
|
205 |
}
|
206 |
+
update_option('gmediaInitCheck', $note);
|
207 |
+
add_action('admin_notices', array(&$this, 'admin_notices'));
|
208 |
+
|
209 |
+
return false;
|
210 |
}
|
211 |
|
212 |
return true;
|
216 |
* Called via Setup and register_activate hook after gmedia_install() function
|
217 |
*/
|
218 |
function gmedia_after_activation(){
|
219 |
+
global $gmCore;
|
220 |
|
221 |
delete_option('gmediaActivated');
|
222 |
|
223 |
flush_rewrite_rules(false);
|
224 |
|
225 |
+
if((int) $this->options['mobile_app']){
|
226 |
+
wp_clear_scheduled_hook('gmedia_app_cronjob');
|
227 |
+
wp_schedule_event(time(), 'gmedia_app', 'gmedia_app_cronjob');
|
228 |
+
|
229 |
+
$gmCore->app_service('app_activateplugin');
|
230 |
+
}
|
231 |
+
|
232 |
+
$wp_installing = (bool) (defined('WP_INSTALLING') && WP_INSTALLING);
|
233 |
+
if( !wp_next_scheduled('gmedia_modules_update') && !$wp_installing){
|
234 |
+
wp_schedule_event(time(), 'daily', 'gmedia_modules_update');
|
235 |
+
}
|
236 |
}
|
237 |
|
238 |
function upgrade(){
|
263 |
gmedia_quite_update();
|
264 |
add_action('init', 'gmedia_flush_rewrite_rules', 1000);
|
265 |
|
266 |
+
if((int) $this->options['mobile_app']){
|
267 |
+
if(!wp_get_schedule('gmedia_app_cronjob')){
|
268 |
+
wp_schedule_event(time(), 'gmedia_app', 'gmedia_app_cronjob');
|
269 |
+
}
|
270 |
+
global $gmCore;
|
271 |
+
$gmCore->app_service('app_updatecron');
|
272 |
}
|
273 |
}
|
274 |
|
299 |
// Load the options
|
300 |
$default_options = gmedia_default_options();
|
301 |
$db_options = get_option('gmediaOptions');
|
302 |
+
if( !is_array($db_options)){
|
303 |
$db_options = array();
|
304 |
}
|
305 |
$this->options = array_merge($default_options, $db_options);
|
344 |
global $gmCore;
|
345 |
|
346 |
wp_register_script('gmedia-global-backend', $gmCore->gmedia_url . '/admin/assets/js/gmedia.global.js', array('jquery'), '1.8.26');
|
347 |
+
wp_localize_script('gmedia-global-backend', 'GmediaGallery', array(
|
348 |
+
'ajaxurl' => admin_url('admin-ajax.php'),
|
349 |
+
'_wpnonce' => wp_create_nonce('GmediaGallery'),
|
350 |
+
'upload_dirurl' => $gmCore->upload['url'],
|
351 |
+
'plugin_dirurl' => $gmCore->gmedia_url
|
352 |
));
|
353 |
|
354 |
+
wp_register_style('grand-media', $gmCore->gmedia_url . '/admin/assets/css/gmedia.admin.css', array(), '1.12.0', 'all');
|
355 |
+
wp_register_script('grand-media', $gmCore->gmedia_url . '/admin/assets/js/gmedia.admin.js', array('jquery', 'gmedia-global-backend'), '1.12.0');
|
356 |
+
wp_localize_script('grand-media', 'grandMedia', array(
|
357 |
+
'error3' => __('Disable your Popup Blocker and try again.', 'grand-media'),
|
358 |
+
'download' => __('downloading...', 'grand-media'),
|
359 |
+
'wait' => __('Working. Wait please.', 'grand-media'),
|
360 |
+
'_wpnonce' => wp_create_nonce('GmediaGallery')
|
361 |
));
|
362 |
|
363 |
wp_register_style('gmedia-bootstrap', $gmCore->gmedia_url . '/assets/bootstrap/css/bootstrap.min.css', array(), '3.3.4', 'all');
|
368 |
}
|
369 |
|
370 |
function register_scripts_frontend(){
|
371 |
+
global $gmCore, $wp_scripts, $wp;
|
372 |
|
373 |
wp_register_script('gmedia-global-frontend', $gmCore->gmedia_url . '/assets/gmedia.global.front.js', array('jquery'), '1.9.16');
|
374 |
+
wp_localize_script('gmedia-global-frontend', 'GmediaGallery', array(
|
375 |
+
'ajaxurl' => admin_url('admin-ajax.php'),
|
376 |
+
'nonce' => wp_create_nonce('GmediaGallery'),
|
377 |
+
'upload_dirurl' => $gmCore->upload['url'],
|
378 |
+
'plugin_dirurl' => $gmCore->upload['url'],
|
379 |
+
'license' => strtolower($this->options['license_key']),
|
380 |
+
'license2' => $this->options['license_key2']
|
381 |
));
|
382 |
|
383 |
|
384 |
+
if( !wp_script_is('velocity', 'registered') || version_compare($wp_scripts->registered['velocity']->ver, '1.4.1', '<')){
|
385 |
wp_deregister_script('velocity');
|
386 |
wp_register_script('velocity', $gmCore->gmedia_url . '/assets/velocity/velocity.min.js', array('jquery'), '1.4.1', true);
|
387 |
}
|
388 |
|
389 |
+
if( !wp_script_is('mediaelement', 'registered')){
|
390 |
+
wp_register_style('mediaelement', $gmCore->gmedia_url . '/assets/mediaelement/mediaelementplayer.min.css', array(), '4.2.8', 'screen');
|
391 |
+
wp_register_script('mediaelement', $gmCore->gmedia_url . '/assets/mediaelement/mediaelement-and-player.min.js', array('jquery'), '4.2.8', true);
|
392 |
}
|
393 |
|
394 |
+
if( !wp_script_is('wavesurfer', 'registered')){
|
395 |
wp_register_script('wavesurfer', $gmCore->gmedia_url . '/assets/wavesurfer/wavesurfer.min.js', array('jquery'), '1.2.8', true);
|
396 |
}
|
397 |
|
398 |
+
if( !wp_script_is('swiper', 'registered') || version_compare($wp_scripts->registered['swiper']->ver, '3.4.0', '<')){
|
399 |
wp_deregister_style('swiper');
|
400 |
wp_deregister_script('swiper');
|
401 |
wp_register_style('swiper', $gmCore->gmedia_url . '/assets/swiper/swiper.min.css', array(), '3.4.0', 'screen');
|
402 |
wp_register_script('swiper', $gmCore->gmedia_url . '/assets/swiper/swiper.jquery.min.js', array('jquery'), '3.4.0', true);
|
403 |
}
|
404 |
|
405 |
+
if( !wp_script_is('magnific-popup', 'registered') || version_compare($wp_scripts->registered['magnific-popup']->ver, '1.1.0', '<')){
|
406 |
wp_deregister_style('magnific-popup');
|
407 |
wp_deregister_script('magnific-popup');
|
408 |
wp_register_style('magnific-popup', $gmCore->gmedia_url . '/assets/mag-popup/magnific-popup.css', array(), '1.1.0', 'screen');
|
409 |
wp_register_script('magnific-popup', $gmCore->gmedia_url . '/assets/mag-popup/jquery.magnific-popup.min.js', array('jquery'), '1.1.0', true);
|
410 |
}
|
411 |
|
412 |
+
if( !wp_script_is('photoswipe', 'registered') || version_compare($wp_scripts->registered['photoswipe']->ver, '3.0.5', '<=')){
|
413 |
wp_deregister_style('photoswipe');
|
414 |
wp_deregister_script('photoswipe');
|
415 |
wp_register_style('photoswipe', $gmCore->gmedia_url . '/assets/photoswipe/photoswipe.css', array(), '3.0.5', 'screen');
|
416 |
wp_register_script('photoswipe', $gmCore->gmedia_url . '/assets/photoswipe/photoswipe.jquery.min.js', array('jquery'), '3.0.5', true);
|
417 |
}
|
418 |
|
419 |
+
if( !wp_script_is('easing', 'registered') || ($wp_scripts->registered['easing']->ver !== false && version_compare($wp_scripts->registered['easing']->ver, '1.3.0', '<'))){
|
420 |
wp_deregister_script('easing');
|
421 |
wp_register_script('easing', $gmCore->gmedia_url . '/assets/jq-plugins/jquery.easing.js', array('jquery'), '1.3.0', true);
|
422 |
}
|
423 |
+
if( !wp_script_is('fancybox', 'registered') || ($wp_scripts->registered['fancybox']->ver !== false && version_compare($wp_scripts->registered['fancybox']->ver, '1.3.4', '<'))){
|
424 |
+
if( !defined('FANCYBOX_VERSION')){
|
425 |
wp_deregister_style('fancybox');
|
426 |
wp_register_style('fancybox', $gmCore->gmedia_url . '/assets/fancybox/jquery.fancybox-1.3.4.css', array(), '1.3.4');
|
427 |
}
|
430 |
}
|
431 |
|
432 |
|
433 |
+
if( !wp_script_is('jplayer', 'registered') || version_compare($wp_scripts->registered['jplayer']->ver, '2.6.4', '<')){
|
434 |
wp_deregister_script('jplayer');
|
435 |
wp_register_script('jplayer', $gmCore->gmedia_url . '/assets/jplayer/jquery.jplayer.min.js', array('jquery'), '2.6.4', true);
|
436 |
}
|
437 |
+
if( !wp_script_is('swfobject', 'registered') || version_compare($wp_scripts->registered['swfobject']->ver, '2.2', '<')){
|
438 |
wp_deregister_script('swfobject');
|
439 |
wp_register_script('swfobject', $gmCore->gmedia_url . '/assets/swf/swfobject.js', array(), '2.2', true);
|
440 |
wp_register_script('swfaddress', $gmCore->gmedia_url . '/assets/swf/swfaddress.js', array(), '2.4', true);
|
452 |
|
453 |
function load_module_scripts(){
|
454 |
global $wp_styles;
|
455 |
+
$deps = array();
|
456 |
$xmlhttprequest = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
|
457 |
foreach($this->do_module as $m => $module){
|
458 |
$deps = array_merge($deps, explode(',', $module['info']['dependencies']));
|
477 |
// }
|
478 |
// }
|
479 |
$files = glob($module['path'] . '/js/*.js', GLOB_NOSORT);
|
480 |
+
if( !empty($files)){
|
481 |
$files = array_map('basename', $files);
|
482 |
foreach($files as $file){
|
483 |
+
$_ver = isset($module['info']['version'])? $module['info']['version'] : false;
|
484 |
$handle = "{$module['name']}_{$file}";
|
485 |
wp_enqueue_script($handle, "{$module['url']}/js/{$file}", array('jquery'), $_ver, true);
|
486 |
if($xmlhttprequest){
|
490 |
}
|
491 |
}
|
492 |
$this->do_module = array();
|
493 |
+
if( !empty($this->import_styles)){
|
494 |
add_action('wp_print_head_scripts', array(&$this, 'print_import_styles'), 1);
|
495 |
add_action('wp_print_footer_scripts', array(&$this, 'print_import_styles'), 1);
|
496 |
}
|
508 |
function load_module_styles($module){
|
509 |
$module_styles = '';
|
510 |
$files = glob($module['path'] . '/css/*.css', GLOB_NOSORT);
|
511 |
+
if( !empty($files)){
|
512 |
$files = array_map('basename', $files);
|
513 |
foreach($files as $file){
|
514 |
$src = "{$module['url']}/css/{$file}";
|
523 |
}
|
524 |
|
525 |
function print_import_styles(){
|
526 |
+
if( !empty($this->import_styles)){
|
527 |
echo "\n<style type='text/css' class='gmedia_assets_style_import'>";
|
528 |
foreach($this->import_styles as $src){
|
529 |
if('http' !== substr($src, 0, 4)){
|
621 |
* Register Gmedia Post Types
|
622 |
*/
|
623 |
function gmedia_post_type(){
|
624 |
+
$args = array(
|
625 |
+
'label' => __('Gmedia Posts', 'grand-media'),
|
626 |
+
'supports' => array('comments'),
|
627 |
+
'hierarchical' => false,
|
628 |
+
'public' => true,
|
629 |
+
'show_ui' => false,
|
630 |
+
'show_in_menu' => false,
|
631 |
+
'show_in_admin_bar' => true,
|
632 |
+
'show_in_nav_menus' => false,
|
633 |
+
'can_export' => false,
|
634 |
+
'has_archive' => (bool) ((int) $this->options['gmedia_has_archive']), //'gmedia-library',
|
635 |
+
'publicly_queryable' => true,
|
636 |
+
'exclude_from_search' => (bool) ((int) $this->options['gmedia_exclude_from_search']),
|
637 |
+
'rewrite' => array('slug' => $this->options['gmedia_post_slug']),
|
638 |
+
'map_meta_cap' => true,
|
639 |
+
'capabilities' => array(
|
640 |
+
'read_private_posts' => 'read_private_gmedia_posts',
|
641 |
// 'edit_comment' => 'edit_gmedia_comment',
|
642 |
// 'moderate_comments' => 'moderate_gmedia_comments',
|
643 |
// 'edit_post' => 'edit_gmedia_post',
|
644 |
// 'edit_posts' => 'edit_gmedia_posts',
|
645 |
+
'create_posts' => false
|
646 |
+
)
|
647 |
);
|
648 |
register_post_type('gmedia', $args);
|
649 |
|
650 |
$args['label'] = __('Gmedia Albums', 'grand-media');
|
651 |
$args['show_in_nav_menus'] = true;
|
652 |
$args['hierarchical'] = true;
|
653 |
+
$args['has_archive'] = (bool) ((int) $this->options['gmedia_album_has_archive']);
|
654 |
+
$args['exclude_from_search'] = (bool) ((int) $this->options['gmedia_album_exclude_from_search']);
|
655 |
$args['rewrite'] = array('slug' => $this->options['gmedia_album_post_slug']);
|
656 |
register_post_type('gmedia_album', $args);
|
657 |
|
658 |
$args['label'] = __('Gmedia Galleries', 'grand-media');
|
659 |
+
$args['has_archive'] = (bool) ((int) $this->options['gmedia_gallery_has_archive']);
|
660 |
+
$args['exclude_from_search'] = (bool) ((int) $this->options['gmedia_gallery_exclude_from_search']);
|
661 |
$args['rewrite'] = array('slug' => $this->options['gmedia_gallery_post_slug']);
|
662 |
register_post_type('gmedia_gallery', $args);
|
663 |
|
666 |
add_filter('get_edit_post_link', array($this, 'gmedia_post_type_edit_link'), 10, 3);
|
667 |
|
668 |
|
669 |
+
$args = array(
|
670 |
+
'hierarchical' => false,
|
671 |
+
'public' => true,
|
672 |
+
'show_ui' => false,
|
673 |
+
'show_admin_column' => false,
|
674 |
+
'show_in_nav_menus' => false,
|
675 |
+
'show_tagcloud' => false,
|
676 |
+
'rewrite' => array('slug' => 'gmedia-category')
|
677 |
);
|
678 |
+
$args['labels'] = array(
|
679 |
+
'name' => _x('Gmedia Categories', 'Taxonomy General Name', 'grand-media'),
|
680 |
+
'singular_name' => _x('Gmedia Category', 'Taxonomy Singular Name', 'grand-media'),
|
681 |
+
'menu_name' => __('Gmedia Categories', 'grand-media')
|
682 |
);
|
683 |
register_taxonomy('gmedia_category', null, $args);
|
684 |
|
685 |
$args['rewrite'] = array('slug' => 'gmedia-tag');
|
686 |
+
$args['labels'] = array(
|
687 |
+
'name' => _x('Gmedia Tags', 'Taxonomy General Name', 'grand-media'),
|
688 |
+
'singular_name' => _x('Gmedia Tag', 'Taxonomy Singular Name', 'grand-media'),
|
689 |
+
'menu_name' => __('Gmedia Tags', 'grand-media')
|
690 |
);
|
691 |
register_taxonomy('gmedia_tag', null, $args);
|
692 |
|
693 |
add_filter('wp_link_query_args', array($this, 'exclude_gmedia_from_link_query'));
|
694 |
|
695 |
+
if( !empty($this->options['flush_rewrite_rules'])){
|
696 |
unset($this->options['flush_rewrite_rules']);
|
697 |
update_option('gmediaOptions', $this->options);
|
698 |
flush_rewrite_rules(false);
|
807 |
return $shedules;
|
808 |
}
|
809 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
810 |
function gmedia_app_cronjob(){
|
811 |
global $gmCore;
|
812 |
$gmCore->app_service('app_updatecron');
|
851 |
if($file == plugin_basename(__FILE__)){
|
852 |
$links[] = '<a href="admin.php?page=GrandMedia_Settings">' . __('Settings', 'grand-media') . '</a>';
|
853 |
$links[] = '<a href="admin.php?page=GrandMedia_Modules">' . __('Modules', 'grand-media') . '</a>';
|
854 |
+
$links[] = '<a href="https://codeasily.com/product/one-site-license/">' . __('Get Premium', 'grand-media') . '</a>';
|
855 |
+
$links[] = '<a href="https://codeasily.com/donate/">' . __('Donate', 'grand-media') . '</a>';
|
856 |
}
|
857 |
|
858 |
return $links;
|
859 |
}
|
860 |
|
861 |
+
function add_plugin_feedback(){
|
862 |
+
global $pagenow;
|
863 |
+
if('plugins.php' !== $pagenow){
|
864 |
+
return;
|
865 |
+
}
|
866 |
+
?>
|
867 |
+
<script type="text/javascript">
|
868 |
+
jQuery(function($){
|
869 |
+
function gm_parse_query(s){
|
870 |
+
var j = {}, res = s.split(/&/gm).map(function(e){
|
871 |
+
var o = e.split(/=/), pt = j;
|
872 |
+
if(typeof o[1] == 'undefined'){
|
873 |
+
o[1] = '';
|
874 |
+
}
|
875 |
+
o[0].replace(/^(\w+)\[([^&]*)\]/, '$1][$2').split(/\]\[/).map(function(e, i, a){
|
876 |
+
if(e === ''){
|
877 |
+
e = Object.keys(pt).length;
|
878 |
+
}
|
879 |
+
pt = (pt[e] = pt[e] || (i == a.length - 1? decodeURIComponent(o[1].replace(/\+/, ' ')) : {}));
|
880 |
+
});
|
881 |
+
});
|
882 |
+
return j;
|
883 |
+
}
|
884 |
+
|
885 |
+
$('tr[data-slug="grand-media"] .deactivate a').on('click', function(e){
|
886 |
+
e.preventDefault();
|
887 |
+
e.stopPropagation();
|
888 |
+
|
889 |
+
$('body').append($('#tmpl-gmedia-feedback').html());
|
890 |
+
var deactivate_link = $(this).attr('href');
|
891 |
+
$('.gm-button-submit-deactivate, .gm-button-skip-deactivate').attr('href', deactivate_link);
|
892 |
+
$('#gmedia-feedback [name="reason"]').on('change', function(){
|
893 |
+
var parent = $(this).closest('.reason');
|
894 |
+
parent.siblings('.has-input').find('.reason-input').hide().find('input').prop('disabled', true);
|
895 |
+
if(parent.hasClass('has-input')){
|
896 |
+
if($(this).is(':checked')){
|
897 |
+
$('.reason-input', parent).show().find('input').prop('disabled', false);
|
898 |
+
}
|
899 |
+
}
|
900 |
+
});
|
901 |
+
$('#gmedia-feedback .gm-button-submit-deactivate').on('click', function(e){
|
902 |
+
e.preventDefault();
|
903 |
+
|
904 |
+
var feedback = $('#gmedia-feedback input').serialize();
|
905 |
+
feedback = gm_parse_query(feedback);
|
906 |
+
|
907 |
+
if(feedback.reason === ''){
|
908 |
+
window.location = deactivate_link;
|
909 |
+
return;
|
910 |
+
}
|
911 |
+
|
912 |
+
$('#gmedia-feedback .spinner').addClass('is-active');
|
913 |
+
var post_data = {
|
914 |
+
action: 'gmedia_feedback',
|
915 |
+
data: feedback,
|
916 |
+
_wpnonce_gmedia_feedback: '<?php echo wp_create_nonce('gmedia_feedback'); ?>'
|
917 |
+
};
|
918 |
+
$.post(ajaxurl, post_data).always(function(data){
|
919 |
+
$('#gmedia-feedback .spinner').removeClass('is-active');
|
920 |
+
window.location = deactivate_link;
|
921 |
+
});
|
922 |
+
return false;
|
923 |
+
});
|
924 |
+
$('#gmedia-feedback .gm-button-close').on('click', function(){
|
925 |
+
$('#gmedia-feedback').remove();
|
926 |
+
return false;
|
927 |
+
});
|
928 |
+
|
929 |
+
return false;
|
930 |
+
});
|
931 |
+
});
|
932 |
+
</script>
|
933 |
+
<script id="tmpl-gmedia-feedback" type="text/template">
|
934 |
+
<div class="gm-modal gm-modal-deactivation-feedback" id="gmedia-feedback">
|
935 |
+
<style>
|
936 |
+
.gm-modal { position: fixed; overflow: auto; height: 100%; width: 100%; top: 0; z-index: 100000; background: rgba(0, 0, 0, 0.6); }
|
937 |
+
.gm-modal-dialog { position: absolute; left: 50%; padding-bottom: 30px; top: 10%; z-index: 100001; max-width: 600px; min-width: 220px; transform: translateX(-50%); }
|
938 |
+
.gm-modal-header { border-bottom: #eeeeee solid 1px; background: #fbfbfb; padding: 15px 20px; position: relative; margin-bottom: -10px; }
|
939 |
+
.gm-modal-header h4 { margin: 0; padding: 0; text-transform: uppercase; font-size: 1.2em; font-weight: bold; color: #cacaca; text-shadow: 1px 1px 1px #fff; letter-spacing: 0.6px; -webkit-font-smoothing: antialiased; }
|
940 |
+
.gm-modal-body,
|
941 |
+
.gm-modal-footer { border: 0; background: #fefefe; padding: 20px; }
|
942 |
+
.gm-modal-footer { border-top: #eeeeee solid 1px; text-align: right; }
|
943 |
+
.gm-modal-body h3 { margin-top: 0; line-height: 1.5em; }
|
944 |
+
.gm-modal-body .reason { margin: 7px 0; }
|
945 |
+
.gm-modal-body .reason-input { margin: 3px 0 3px 22px; display: none; }
|
946 |
+
.gm-modal-body .reason-input input { width: 100%; }
|
947 |
+
.gm-modal-footer a.button { margin-right: 7px; }
|
948 |
+
</style>
|
949 |
+
<div class="gm-modal-dialog">
|
950 |
+
<div class="gm-modal-header"><h4><?php _e('Quick feedback', 'grand-media'); ?></h4></div>
|
951 |
+
<div class="gm-modal-body">
|
952 |
+
<h3><strong><?php _e('If you have a moment, please let us know why you are deactivating:', 'grand-media'); ?></strong></h3>
|
953 |
+
<div id="reasons-list">
|
954 |
+
<div class="reason">
|
955 |
+
<label><input type="radio" name="reason" value="" checked/> <span><?php _e('It\'s a temporary deactivation. I\'m just debugging an issue.', 'grand-media'); ?></span></label>
|
956 |
+
</div>
|
957 |
+
<div class="reason">
|
958 |
+
<label><input type="radio" name="reason" value="I no longer need the gallery plugin"/> <span><?php _e('I no longer need the gallery plugin', 'grand-media'); ?></span></label>
|
959 |
+
</div>
|
960 |
+
<div class="reason has-input">
|
961 |
+
<label><input type="radio" name="reason" value="I found a better gallery plugin"/> <span><?php _e('I found a better gallery plugin', 'grand-media'); ?></span></label>
|
962 |
+
<div class="reason-input"><input type="text" name="better_plugin" disabled placeholder="<?php _e('What\'s the plugin\'s name?', 'grand-media'); ?>"/></div>
|
963 |
+
</div>
|
964 |
+
<div class="reason">
|
965 |
+
<label><input type="radio" name="reason" value="The plugin is too coomplicated for me"/> <span><?php _e('The plugin is too coomplicated for me', 'grand-media'); ?></span></label>
|
966 |
+
</div>
|
967 |
+
<div class="reason">
|
968 |
+
<label><input type="radio" name="reason" value="The plugin broke my life"/> <span><?php _e('The plugin broke my life', 'grand-media'); ?></span></label>
|
969 |
+
</div>
|
970 |
+
<div class="reason has-input">
|
971 |
+
<label><input type="radio" name="reason" value="Other"/> <span><?php _e('Other', 'grand-media'); ?></span></label>
|
972 |
+
<div class="reason-input"><input type="text" name="other_reason" value="" disabled/></div>
|
973 |
+
</div>
|
974 |
+
</div>
|
975 |
+
</div>
|
976 |
+
<div class="gm-modal-footer">
|
977 |
+
<span class="spinner" style="float: none;"></span>
|
978 |
+
<a href="#" class="button button-secondary gm-button-submit-deactivate"><?php _e('Submit & Deactivate', 'grand-media'); ?></a>
|
979 |
+
<a href="#" class="button button-secondary gm-button-skip-deactivate"><?php _e('Skip', 'grand-media'); ?></a>
|
980 |
+
<a href="#" class="button button-primary gm-button-close"><?php _e('Cancel', 'grand-media'); ?></a>
|
981 |
+
</div>
|
982 |
+
</div>
|
983 |
+
</div>
|
984 |
+
</script>
|
985 |
+
<?php
|
986 |
+
}
|
987 |
+
|
988 |
}
|
989 |
|
990 |
// Let's start the holy plugin
|
inc/compatibility.php
CHANGED
@@ -26,8 +26,7 @@ function jetpack_photon_skip_gmedia($skip, $src){
|
|
26 |
* @return bool
|
27 |
*/
|
28 |
function wpss_gmedia_check_bypass($pass){
|
29 |
-
|
30 |
-
$is_app = (isset($wp->query_vars['gmedia-app']) && !empty($wp->query_vars['gmedia-app']));
|
31 |
if($is_app) {
|
32 |
return true;
|
33 |
}
|
26 |
* @return bool
|
27 |
*/
|
28 |
function wpss_gmedia_check_bypass($pass){
|
29 |
+
$is_app = (isset($_GET['gmedia-app']) && !empty($_GET['gmedia-app']));
|
|
|
30 |
if($is_app) {
|
31 |
return true;
|
32 |
}
|
inc/core.php
CHANGED
@@ -6,7 +6,7 @@ if(preg_match('#' . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . '#'
|
|
6 |
/**
|
7 |
* Main PHP class for the WordPress plugin GRAND Media
|
8 |
*/
|
9 |
-
class GmediaCore{
|
10 |
|
11 |
var $upload;
|
12 |
var $gmedia_url;
|
@@ -17,10 +17,13 @@ class GmediaCore{
|
|
17 |
*
|
18 |
*/
|
19 |
function __construct(){
|
|
|
|
|
20 |
$this->upload = $this->gm_upload_dir();
|
21 |
$this->gmedia_url = plugins_url(GMEDIA_FOLDER);
|
22 |
|
23 |
add_action('init', array(&$this, 'user_capabilities'), 8);
|
|
|
24 |
|
25 |
add_action('clean_gmedia_cache', array(&$this, 'clear_cache'));
|
26 |
// add_action( 'deleted_gmedia_term_relationships', array( &$this, 'clear_cache' ) );
|
@@ -57,12 +60,21 @@ class GmediaCore{
|
|
57 |
}
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
/**
|
61 |
* Check GET data
|
62 |
*
|
63 |
* @param string $var
|
64 |
-
* @param mixed
|
65 |
-
* @param bool
|
66 |
*
|
67 |
* @return mixed
|
68 |
*/
|
@@ -78,13 +90,13 @@ class GmediaCore{
|
|
78 |
* @return bool
|
79 |
*/
|
80 |
function is_empty($var){
|
81 |
-
return !(!empty($var) && !in_array(strtolower($var), array('null', 'false')));
|
82 |
}
|
83 |
|
84 |
/**
|
85 |
* Check POST data
|
86 |
*
|
87 |
-
* @param string
|
88 |
* @param bool|mixed $def
|
89 |
*
|
90 |
* @return mixed
|
@@ -98,7 +110,7 @@ class GmediaCore{
|
|
98 |
* Check REQUEST data
|
99 |
*
|
100 |
* @param string $var
|
101 |
-
* @param mixed
|
102 |
*
|
103 |
* @return mixed
|
104 |
*/
|
@@ -110,8 +122,8 @@ class GmediaCore{
|
|
110 |
* tooltip()
|
111 |
*
|
112 |
* @param string $style 'tooltip', 'popover'
|
113 |
-
* @param array
|
114 |
-
* @param bool
|
115 |
*
|
116 |
* @return string
|
117 |
*/
|
@@ -137,7 +149,7 @@ class GmediaCore{
|
|
137 |
/**
|
138 |
* @param array $add_args
|
139 |
* @param array $remove_args
|
140 |
-
* @param bool
|
141 |
* @param array $preserve_args
|
142 |
*
|
143 |
* @return string
|
@@ -146,16 +158,16 @@ class GmediaCore{
|
|
146 |
if(true === $uri){
|
147 |
$uri = admin_url('admin.php');
|
148 |
}
|
149 |
-
$remove_args = empty($remove_args)? array() : (array)$remove_args;
|
150 |
-
$_wpnonce
|
151 |
-
foreach
|
152 |
-
if
|
153 |
-
$_wpnonce[$key] = $value;
|
154 |
}
|
155 |
}
|
156 |
$remove_args = array_unique(array_merge(array('doing_wp_cron', '_wpnonce', 'do_gmedia', 'did_gmedia', 'do_gmedia_terms', 'did_gmedia_terms', 'ids'), $_wpnonce, $remove_args, array_keys($add_args)));
|
157 |
$new_uri = remove_query_arg($remove_args, $uri);
|
158 |
-
if(!empty($preserve_args)){
|
159 |
$_add_args = array();
|
160 |
foreach($preserve_args as $key){
|
161 |
if(($value = $this->_get($key)) !== false){
|
@@ -164,7 +176,7 @@ class GmediaCore{
|
|
164 |
}
|
165 |
$new_uri = add_query_arg($_add_args, $new_uri);
|
166 |
}
|
167 |
-
if(!empty($add_args)){
|
168 |
$new_uri = add_query_arg($add_args, $new_uri);
|
169 |
}
|
170 |
|
@@ -227,11 +239,11 @@ class GmediaCore{
|
|
227 |
|
228 |
if($create){
|
229 |
// Make sure we have an uploads dir
|
230 |
-
if(!wp_mkdir_p($uploads['path'])){
|
231 |
$message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), $uploads['path']);
|
232 |
$uploads['error'] = $message;
|
233 |
}
|
234 |
-
} elseif(!is_dir($uploads['path'])){
|
235 |
$uploads['error'] = true;
|
236 |
}
|
237 |
|
@@ -249,7 +261,7 @@ class GmediaCore{
|
|
249 |
return @unlink($path);
|
250 |
} elseif(is_dir($path)){
|
251 |
$files = glob($path . '/*', GLOB_NOSORT);
|
252 |
-
if(!empty($files) && is_array($files)){
|
253 |
array_map(array($this, 'delete_folder'), $files);
|
254 |
}
|
255 |
|
@@ -265,9 +277,9 @@ class GmediaCore{
|
|
265 |
* @see wp_get_attachment_image()
|
266 |
* @uses apply_filters() Calls 'gm_get_attachment_image_attributes' hook on attributes array
|
267 |
*
|
268 |
-
* @param int|object
|
269 |
-
* @param string
|
270 |
-
* @param bool
|
271 |
* @param bool|string $default Optional, return if no cover and if $size != 'all'
|
272 |
*
|
273 |
* @return string|array img url for chosen size
|
@@ -275,17 +287,18 @@ class GmediaCore{
|
|
275 |
function gm_get_media_image($item, $size = '', $cover = true, $default = false){
|
276 |
global $gmDB, $gmGallery;
|
277 |
|
278 |
-
if(!is_object($item)){
|
279 |
$item = $gmDB->get_gmedia($item);
|
280 |
}
|
281 |
-
if(!$size){
|
282 |
$size = 'web';
|
283 |
}
|
284 |
if(empty($item)){
|
285 |
$image = $default? $default : $this->gmedia_url . '/admin/assets/img/default.png';
|
286 |
-
$images = apply_filters('gm_get_media_image', array(
|
287 |
-
|
288 |
-
|
|
|
289 |
));
|
290 |
if('all' == $size){
|
291 |
return $images;
|
@@ -293,12 +306,13 @@ class GmediaCore{
|
|
293 |
return $images[ $size ];
|
294 |
}
|
295 |
}
|
296 |
-
$type
|
297 |
$img_cover = false;
|
298 |
if('image' == $type[0]){
|
299 |
-
$images
|
300 |
-
|
301 |
-
|
|
|
302 |
);
|
303 |
if('original' !== $size){
|
304 |
$thumb_path = "{$this->upload['path']}/{$gmGallery->options['folder']['image_thumb']}/{$item->gmuid}";
|
@@ -308,39 +322,40 @@ class GmediaCore{
|
|
308 |
}
|
309 |
if('all' == $size || 'original' == $size){
|
310 |
$original_path = "{$this->upload['path']}/{$gmGallery->options['folder']['image_original']}/{$item->gmuid}";
|
311 |
-
if(!is_file($original_path)){
|
312 |
$images['original'] = $images['web'];
|
313 |
}
|
314 |
}
|
315 |
}
|
316 |
if('image' != $type[0] || $img_cover){
|
317 |
$ext = ltrim(strrchr($item->gmuid, '.'), '.');
|
318 |
-
if(!$type = wp_ext2type($ext)){
|
319 |
$type = 'application';
|
320 |
}
|
321 |
$image = "{$this->gmedia_url}/admin/assets/img/{$type}.png";
|
322 |
-
$images = array(
|
323 |
-
|
324 |
-
|
325 |
-
|
|
|
326 |
);
|
327 |
|
328 |
if($cover){
|
329 |
$cover = $gmDB->get_metadata('gmedia', $item->ID, '_cover', true);
|
330 |
-
if(!empty($cover)){
|
331 |
if($this->is_digit($cover)){
|
332 |
-
$images
|
333 |
$images['icon'] = $image;
|
334 |
}
|
335 |
} elseif($default !== false){
|
336 |
return $default;
|
337 |
-
} else
|
338 |
$alb = $gmDB->get_gmedia_terms(array($item->ID), array('gmedia_album'), array('fields' => 'ids'));
|
339 |
-
if(!empty($alb)){
|
340 |
$cover = $gmDB->get_metadata('gmedia_term', $alb[0], '_cover', true);
|
341 |
-
if(!empty($cover)){
|
342 |
if($this->is_digit($cover)){
|
343 |
-
$images
|
344 |
$images['icon'] = $image;
|
345 |
}
|
346 |
}
|
@@ -368,18 +383,22 @@ class GmediaCore{
|
|
368 |
if(empty($module_name)){
|
369 |
return false;
|
370 |
}
|
371 |
-
$module_dirs = array(
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
|
|
|
|
|
|
|
|
383 |
);
|
384 |
foreach($module_dirs as $dir){
|
385 |
if(is_dir($dir['path'])){
|
@@ -399,7 +418,7 @@ class GmediaCore{
|
|
399 |
/** Automatic choose upload directory based on media type
|
400 |
*
|
401 |
* @param string $file
|
402 |
-
* @param int
|
403 |
*
|
404 |
* @return array|bool
|
405 |
*/
|
@@ -420,7 +439,7 @@ class GmediaCore{
|
|
420 |
$allowed_ext = array_keys($allowed_ext);
|
421 |
$allowed_ext = implode('|', $allowed_ext);
|
422 |
$allowed_ext = explode('|', $allowed_ext);
|
423 |
-
if(!in_array($fileinfo['extension'], $allowed_ext)){
|
424 |
return false;
|
425 |
}
|
426 |
|
@@ -428,7 +447,7 @@ class GmediaCore{
|
|
428 |
$fileinfo['filename'] = $pathinfo['filename'] . $suffix;
|
429 |
$fileinfo['basename'] = $fileinfo['filename'] . '.' . $fileinfo['extension'];
|
430 |
$fileinfo['title'] = str_replace('_', ' ', esc_sql($title));
|
431 |
-
if((int)$gmGallery->options['name2title_capitalize']){
|
432 |
$fileinfo['title'] = $this->mb_ucwords_utf8($fileinfo['title']);
|
433 |
}
|
434 |
$fileinfo['mime_type'] = (empty($filetype['type']))? 'application/' . $fileinfo['extension'] : $filetype['type'];
|
@@ -547,10 +566,10 @@ class GmediaCore{
|
|
547 |
*/
|
548 |
function clean_input($input){
|
549 |
$search = array(/*'@<[\/\!]*?[^<>]*?>@si'*/ /* Strip out HTML tags */
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
);
|
555 |
|
556 |
$output = preg_replace($search, '', $input);
|
@@ -607,7 +626,7 @@ class GmediaCore{
|
|
607 |
*/
|
608 |
function get_editable_user_ids(){
|
609 |
if(current_user_can('gmedia_show_others_media') || current_user_can('gmedia_edit_others_media')){
|
610 |
-
return get_users(array('
|
611 |
}
|
612 |
|
613 |
return get_current_user_id();
|
@@ -626,14 +645,15 @@ class GmediaCore{
|
|
626 |
$options = get_option('gmediaOptions');
|
627 |
$endpoint = $options['endpoint'];
|
628 |
$hashid = gmedia_hash_id_encode($id, $type);
|
629 |
-
$t = array(
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
|
|
635 |
);
|
636 |
-
if(!$default && get_option('permalink_structure')){
|
637 |
$cloud_link = home_url(urlencode($endpoint) . "/{$t[$type]}/{$hashid}");
|
638 |
} else{
|
639 |
$cloud_link = add_query_arg(array("$endpoint" => $hashid, 't' => $t[ $type ]), home_url('index.php'));
|
@@ -653,7 +673,7 @@ class GmediaCore{
|
|
653 |
function filesize($file, $decimals = 2){
|
654 |
$bytes = filesize($file);
|
655 |
$sz = array('b', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb');
|
656 |
-
$factor = (int)floor((strlen($bytes) - 1) / 3);
|
657 |
|
658 |
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . $sz[ $factor ];
|
659 |
}
|
@@ -675,7 +695,7 @@ class GmediaCore{
|
|
675 |
if(is_array($arr1[ $k ]) && is_array($arr2[ $k ])){
|
676 |
$d = $this->array_diff_key_recursive($arr1[ $k ], $arr2[ $k ]);
|
677 |
|
678 |
-
if(!empty($d)){
|
679 |
$diff[ $k ] = $d;
|
680 |
}
|
681 |
}
|
@@ -687,7 +707,7 @@ class GmediaCore{
|
|
687 |
/**
|
688 |
* @param array $arr1
|
689 |
* @param array $arr2
|
690 |
-
* @param bool
|
691 |
*
|
692 |
* @return array
|
693 |
*/
|
@@ -699,7 +719,7 @@ class GmediaCore{
|
|
699 |
if(is_array($arr1[ $k ]) && is_array($arr2[ $k ])){
|
700 |
$d = $this->array_diff_keyval_recursive($arr1[ $k ], $arr2[ $k ], $update);
|
701 |
|
702 |
-
if(!empty($d)){
|
703 |
$diff[ $k ] = $d;
|
704 |
}
|
705 |
} elseif($arr1[ $k ] !== $arr2[ $k ]){
|
@@ -729,7 +749,7 @@ class GmediaCore{
|
|
729 |
$bref_stack = array(&$base);
|
730 |
$head_stack = array($replacements);
|
731 |
|
732 |
-
do{
|
733 |
end($bref_stack);
|
734 |
|
735 |
$bref = &$bref_stack[ key($bref_stack) ];
|
@@ -807,12 +827,13 @@ class GmediaCore{
|
|
807 |
// Use strict mode to prevent characters from outside the base64 range
|
808 |
$image = base64_decode($data, true);
|
809 |
|
810 |
-
if(!$image){
|
811 |
return false;
|
812 |
}
|
813 |
|
814 |
-
return array(
|
815 |
-
|
|
|
816 |
);
|
817 |
}
|
818 |
|
@@ -824,390 +845,391 @@ class GmediaCore{
|
|
824 |
return false;
|
825 |
}
|
826 |
|
827 |
-
$spiders = array(
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
|
|
1211 |
);
|
1212 |
|
1213 |
foreach($spiders as $spider){
|
@@ -1227,13 +1249,13 @@ class GmediaCore{
|
|
1227 |
* @since 3.6.0
|
1228 |
*
|
1229 |
* @param array $metadata An existing array with data
|
1230 |
-
* @param array $data
|
1231 |
*/
|
1232 |
function wp_add_id3_tag_data(&$metadata, $data){
|
1233 |
foreach(array('id3v2', 'id3v1') as $version){
|
1234 |
-
if(!empty($data[ $version ]['comments'])){
|
1235 |
foreach($data[ $version ]['comments'] as $key => $list){
|
1236 |
-
if(!empty($list)){
|
1237 |
$metadata[ $key ] = reset($list);
|
1238 |
// fix bug in byte stream analysis
|
1239 |
if('terms_of_use' === $key && 0 === strpos($metadata[ $key ], 'yright notice.')){
|
@@ -1245,20 +1267,22 @@ class GmediaCore{
|
|
1245 |
}
|
1246 |
}
|
1247 |
|
1248 |
-
if(!empty($data['id3v2']['APIC'])){
|
1249 |
$image = reset($data['id3v2']['APIC']);
|
1250 |
-
if(!empty($image['data'])){
|
1251 |
-
$metadata['image'] = array(
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
|
|
1255 |
);
|
1256 |
}
|
1257 |
-
} elseif(!empty($data['comments']['picture'])){
|
1258 |
$image = reset($data['comments']['picture']);
|
1259 |
-
if(!empty($image['data'])){
|
1260 |
-
$metadata['image'] = array(
|
1261 |
-
|
|
|
1262 |
);
|
1263 |
}
|
1264 |
}
|
@@ -1279,7 +1303,7 @@ class GmediaCore{
|
|
1279 |
* @return bool|array False on failure. Image metadata array on success.
|
1280 |
*/
|
1281 |
function wp_read_image_metadata($file){
|
1282 |
-
if(!is_file($file)){
|
1283 |
return false;
|
1284 |
}
|
1285 |
|
@@ -1294,21 +1318,21 @@ class GmediaCore{
|
|
1294 |
if(is_callable('iptcparse')){
|
1295 |
getimagesize($file, $info);
|
1296 |
|
1297 |
-
if(!empty($info['APP13'])){
|
1298 |
$iptc = iptcparse($info['APP13']);
|
1299 |
|
1300 |
// Headline, "A brief synopsis of the caption."
|
1301 |
-
if(!empty($iptc['2#105'][0])){
|
1302 |
$meta['title'] = trim($iptc['2#105'][0]);
|
1303 |
/*
|
1304 |
* Title, "Many use the Title field to store the filename of the image,
|
1305 |
* though the field may be used in many ways."
|
1306 |
*/
|
1307 |
-
} elseif(!empty($iptc['2#005'][0])){
|
1308 |
$meta['title'] = trim($iptc['2#005'][0]);
|
1309 |
}
|
1310 |
|
1311 |
-
if(!empty($iptc['2#120'][0])){ // description / legacy caption
|
1312 |
$caption = trim($iptc['2#120'][0]);
|
1313 |
if(empty($meta['title'])){
|
1314 |
mbstring_binary_safe_encoding();
|
@@ -1326,25 +1350,25 @@ class GmediaCore{
|
|
1326 |
}
|
1327 |
}
|
1328 |
|
1329 |
-
if(!empty($iptc['2#110'][0])) // credit
|
1330 |
{
|
1331 |
$meta['credit'] = trim($iptc['2#110'][0]);
|
1332 |
-
} elseif(!empty($iptc['2#080'][0])) // creator / legacy byline
|
1333 |
{
|
1334 |
$meta['credit'] = trim($iptc['2#080'][0]);
|
1335 |
}
|
1336 |
|
1337 |
-
if(!empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0])) // created date and time
|
1338 |
{
|
1339 |
$meta['created_timestamp'] = strtotime($iptc['2#055'][0] . ' ' . $iptc['2#060'][0]);
|
1340 |
}
|
1341 |
|
1342 |
-
if(!empty($iptc['2#116'][0])) // copyright
|
1343 |
{
|
1344 |
$meta['copyright'] = trim($iptc['2#116'][0]);
|
1345 |
}
|
1346 |
|
1347 |
-
if(!empty($iptc['2#025'])) // keywords
|
1348 |
{
|
1349 |
$meta['keywords'] = $iptc['2#025'];
|
1350 |
}
|
@@ -1357,10 +1381,11 @@ class GmediaCore{
|
|
1357 |
*
|
1358 |
* @param array $image_types Image types to check for exif data.
|
1359 |
*/
|
1360 |
-
if(is_callable('exif_read_data') && in_array($sourceImageType, apply_filters('wp_read_image_metadata_types', array(
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
|
|
1364 |
){
|
1365 |
$exif = @exif_read_data($file);
|
1366 |
unset($exif['MakerNote']);
|
@@ -1370,7 +1395,7 @@ class GmediaCore{
|
|
1370 |
$meta['title'] = trim($exif['Title']);
|
1371 |
}
|
1372 |
// Descrioption
|
1373 |
-
if(!empty($exif['ImageDescription'])){
|
1374 |
mbstring_binary_safe_encoding();
|
1375 |
$description_length = strlen($exif['ImageDescription']);
|
1376 |
reset_mbstring_encoding();
|
@@ -1389,9 +1414,9 @@ class GmediaCore{
|
|
1389 |
}
|
1390 |
// Credit
|
1391 |
if(empty($meta['credit'])){
|
1392 |
-
if(!empty($exif['Artist'])){
|
1393 |
$meta['credit'] = trim($exif['Artist']);
|
1394 |
-
} elseif(!empty($exif['Author'])){
|
1395 |
$meta['credit'] = trim($exif['Author']);
|
1396 |
}
|
1397 |
}
|
@@ -1400,31 +1425,31 @@ class GmediaCore{
|
|
1400 |
$meta['copyright'] = trim($exif['Copyright']);
|
1401 |
}
|
1402 |
// Camera Make
|
1403 |
-
if(!empty($exif['Make'])){
|
1404 |
$meta['make'] = $exif['Make'];
|
1405 |
}
|
1406 |
// Camera Model
|
1407 |
-
if(!empty($exif['Model'])){
|
1408 |
$meta['model'] = trim($exif['Model']);
|
1409 |
}
|
1410 |
// Exposure Time (shutter speed)
|
1411 |
-
if(!empty($exif['ExposureTime'])){
|
1412 |
$meta['exposure'] = $exif['ExposureTime'] . 's';
|
1413 |
-
$meta['shutter_speed'] = (string)wp_exif_frac2dec($exif['ExposureTime']) . 's';
|
1414 |
}
|
1415 |
// Aperture
|
1416 |
-
if(!empty($exif['COMPUTED']['ApertureFNumber'])){
|
1417 |
$meta['aperture'] = $exif['COMPUTED']['ApertureFNumber'];
|
1418 |
-
} elseif(!empty($exif['FNumber'])){
|
1419 |
-
$meta['aperture'] = 'f/' . (string)round(wp_exif_frac2dec($exif['FNumber']), 2);
|
1420 |
}
|
1421 |
// ISO
|
1422 |
-
if(!empty($exif['ISOSpeedRatings'])){
|
1423 |
$meta['iso'] = is_array($exif['ISOSpeedRatings'])? reset($exif['ISOSpeedRatings']) : $exif['ISOSpeedRatings'];
|
1424 |
$meta['iso'] = trim($meta['iso']);
|
1425 |
}
|
1426 |
// Date
|
1427 |
-
if(!empty($exif['DateTime'])){
|
1428 |
$meta['date'] = $exif['DateTime'];
|
1429 |
}
|
1430 |
// Created TimeStamp
|
@@ -1432,109 +1457,109 @@ class GmediaCore{
|
|
1432 |
$meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized']);
|
1433 |
}
|
1434 |
// Lens
|
1435 |
-
if(!empty($exif['UndefinedTag:0xA434'])){
|
1436 |
$meta['lens'] = $exif['UndefinedTag:0xA434'];
|
1437 |
}
|
1438 |
// Focus Distance
|
1439 |
-
if(!empty($exif['COMPUTED']['FocusDistance'])){
|
1440 |
$meta['distance'] = $exif['COMPUTED']['FocusDistance'];
|
1441 |
}
|
1442 |
// Focal Length
|
1443 |
-
if(!empty($exif['FocalLength'])){
|
1444 |
-
$meta['focallength'] = (string)round(wp_exif_frac2dec($exif['FocalLength'])) . 'mm';
|
1445 |
}
|
1446 |
// Focal Length 35mm
|
1447 |
-
if(!empty($exif['FocalLengthIn35mmFilm'])){
|
1448 |
$meta['focallength35'] = $exif['FocalLengthIn35mmFilm'] . 'mm';
|
1449 |
}
|
1450 |
// Flash data
|
1451 |
-
if(!empty($exif['Flash'])){
|
1452 |
// we need to interpret the result - it's given as a number and we want a human-readable description.
|
1453 |
$fdata = $exif['Flash'];
|
1454 |
|
1455 |
switch($fdata){
|
1456 |
case 0 :
|
1457 |
$fdata = 'No Flash';
|
1458 |
-
|
1459 |
case 1 :
|
1460 |
$fdata = 'Flash';
|
1461 |
-
|
1462 |
case 5 :
|
1463 |
$fdata = 'Flash, strobe return light not detected';
|
1464 |
-
|
1465 |
case 7 :
|
1466 |
$fdata = 'Flash, strob return light detected';
|
1467 |
-
|
1468 |
case 9 :
|
1469 |
$fdata = 'Compulsory Flash';
|
1470 |
-
|
1471 |
case 13:
|
1472 |
$fdata = 'Compulsory Flash, Return light not detected';
|
1473 |
-
|
1474 |
case 15:
|
1475 |
$fdata = 'Compulsory Flash, Return light detected';
|
1476 |
-
|
1477 |
case 16:
|
1478 |
$fdata = 'No Flash';
|
1479 |
-
|
1480 |
case 24:
|
1481 |
$fdata = 'No Flash';
|
1482 |
-
|
1483 |
case 25:
|
1484 |
$fdata = 'Flash, Auto-Mode';
|
1485 |
-
|
1486 |
case 29:
|
1487 |
$fdata = 'Flash, Auto-Mode, Return light not detected';
|
1488 |
-
|
1489 |
case 31:
|
1490 |
$fdata = 'Flash, Auto-Mode, Return light detected';
|
1491 |
-
|
1492 |
case 32:
|
1493 |
$fdata = 'No Flash';
|
1494 |
-
|
1495 |
case 65:
|
1496 |
$fdata = 'Red Eye';
|
1497 |
-
|
1498 |
case 69:
|
1499 |
$fdata = 'Red Eye, Return light not detected';
|
1500 |
-
|
1501 |
case 71:
|
1502 |
$fdata = 'Red Eye, Return light detected';
|
1503 |
-
|
1504 |
case 73:
|
1505 |
$fdata = 'Red Eye, Compulsory Flash';
|
1506 |
-
|
1507 |
case 77:
|
1508 |
$fdata = 'Red Eye, Compulsory Flash, Return light not detected';
|
1509 |
-
|
1510 |
case 79:
|
1511 |
$fdata = 'Red Eye, Compulsory Flash, Return light detected';
|
1512 |
-
|
1513 |
case 89:
|
1514 |
$fdata = 'Red Eye, Auto-Mode';
|
1515 |
-
|
1516 |
case 93:
|
1517 |
$fdata = 'Red Eye, Auto-Mode, Return light not detected';
|
1518 |
-
|
1519 |
case 95:
|
1520 |
$fdata = 'Red Eye, Auto-Mode, Return light detected';
|
1521 |
-
|
1522 |
default:
|
1523 |
$fdata = 'Unknown: ' . $fdata;
|
1524 |
-
|
1525 |
}
|
1526 |
$meta['flashdata'] = $fdata;
|
1527 |
}
|
1528 |
// Lens Make
|
1529 |
-
if(!empty($exif['UndefinedTag:0xA433'])){
|
1530 |
$meta['lensmake'] = $exif['UndefinedTag:0xA433'];
|
1531 |
}
|
1532 |
// Software
|
1533 |
-
if(!empty($exif['Software'])){
|
1534 |
$meta['software'] = $exif['Software'];
|
1535 |
}
|
1536 |
// Orientation
|
1537 |
-
if(!empty($exif['Orientation'])){
|
1538 |
$meta['orientation'] = $exif['Orientation'];
|
1539 |
}
|
1540 |
|
@@ -1547,13 +1572,13 @@ class GmediaCore{
|
|
1547 |
}
|
1548 |
|
1549 |
foreach(array('title', 'caption', 'credit', 'copyright', 'model', 'iso', 'software') as $key){
|
1550 |
-
if(!empty($meta[ $key ]) && !seems_utf8($meta[ $key ])){
|
1551 |
$meta[ $key ] = utf8_encode($meta[ $key ]);
|
1552 |
}
|
1553 |
}
|
1554 |
-
if(!empty($meta['keywords'])){
|
1555 |
foreach($meta['keywords'] as $i => $key){
|
1556 |
-
if(!seems_utf8($key)){
|
1557 |
$meta['keywords'][ $i ] = utf8_encode($key);
|
1558 |
}
|
1559 |
}
|
@@ -1569,9 +1594,9 @@ class GmediaCore{
|
|
1569 |
* Filter the array of meta data read from an image's exif data.
|
1570 |
* @since 2.5.0
|
1571 |
*
|
1572 |
-
* @param array
|
1573 |
-
* @param string $file
|
1574 |
-
* @param int
|
1575 |
*/
|
1576 |
return apply_filters('wp_read_image_metadata', $meta, $file, $sourceImageType);
|
1577 |
|
@@ -1586,13 +1611,13 @@ class GmediaCore{
|
|
1586 |
* @return array|boolean Returns array of metadata, if found.
|
1587 |
*/
|
1588 |
function wp_read_video_metadata($file){
|
1589 |
-
if(!is_file($file)){
|
1590 |
return false;
|
1591 |
}
|
1592 |
|
1593 |
$metadata = array();
|
1594 |
|
1595 |
-
if(!class_exists('getID3')){
|
1596 |
require(ABSPATH . WPINC . '/ID3/getid3.php');
|
1597 |
}
|
1598 |
$id3 = new getID3();
|
@@ -1601,44 +1626,44 @@ class GmediaCore{
|
|
1601 |
if(isset($data['video']['lossless'])){
|
1602 |
$metadata['lossless'] = $data['video']['lossless'];
|
1603 |
}
|
1604 |
-
if(!empty($data['video']['bitrate'])){
|
1605 |
-
$metadata['bitrate'] = (int)$data['video']['bitrate'];
|
1606 |
}
|
1607 |
-
if(!empty($data['video']['bitrate_mode'])){
|
1608 |
$metadata['bitrate_mode'] = $data['video']['bitrate_mode'];
|
1609 |
}
|
1610 |
-
if(!empty($data['filesize'])){
|
1611 |
-
$metadata['filesize'] = (int)$data['filesize'];
|
1612 |
}
|
1613 |
-
if(!empty($data['mime_type'])){
|
1614 |
$metadata['mime_type'] = $data['mime_type'];
|
1615 |
}
|
1616 |
-
if(!empty($data['playtime_seconds'])){
|
1617 |
-
$metadata['length'] = (int)ceil($data['playtime_seconds']);
|
1618 |
}
|
1619 |
-
if(!empty($data['playtime_string'])){
|
1620 |
$metadata['length_formatted'] = $data['playtime_string'];
|
1621 |
}
|
1622 |
-
if(!empty($data['video']['resolution_x'])){
|
1623 |
-
$metadata['width'] = (int)$data['video']['resolution_x'];
|
1624 |
}
|
1625 |
-
if(!empty($data['video']['resolution_y'])){
|
1626 |
-
$metadata['height'] = (int)$data['video']['resolution_y'];
|
1627 |
}
|
1628 |
-
if(!empty($data['fileformat'])){
|
1629 |
$metadata['fileformat'] = $data['fileformat'];
|
1630 |
}
|
1631 |
-
if(!empty($data['video']['dataformat'])){
|
1632 |
$metadata['dataformat'] = $data['video']['dataformat'];
|
1633 |
}
|
1634 |
-
if(!empty($data['video']['encoder'])){
|
1635 |
$metadata['encoder'] = $data['video']['encoder'];
|
1636 |
}
|
1637 |
-
if(!empty($data['video']['codec'])){
|
1638 |
$metadata['codec'] = $data['video']['codec'];
|
1639 |
}
|
1640 |
|
1641 |
-
if(!empty($data['audio'])){
|
1642 |
unset($data['audio']['streams']);
|
1643 |
$metadata['audio'] = $data['audio'];
|
1644 |
}
|
@@ -1657,35 +1682,35 @@ class GmediaCore{
|
|
1657 |
* @return array|boolean Returns array of metadata, if found.
|
1658 |
*/
|
1659 |
function wp_read_audio_metadata($file){
|
1660 |
-
if(!is_file($file)){
|
1661 |
return false;
|
1662 |
}
|
1663 |
$metadata = array();
|
1664 |
|
1665 |
-
if(!class_exists('getID3')){
|
1666 |
require(ABSPATH . WPINC . '/ID3/getid3.php');
|
1667 |
}
|
1668 |
$id3 = new getID3();
|
1669 |
$data = $id3->analyze($file);
|
1670 |
|
1671 |
-
if(!empty($data['audio'])){
|
1672 |
unset($data['audio']['streams']);
|
1673 |
$metadata = $data['audio'];
|
1674 |
}
|
1675 |
|
1676 |
-
if(!empty($data['fileformat'])){
|
1677 |
$metadata['fileformat'] = $data['fileformat'];
|
1678 |
}
|
1679 |
-
if(!empty($data['filesize'])){
|
1680 |
-
$metadata['filesize'] = (int)$data['filesize'];
|
1681 |
}
|
1682 |
-
if(!empty($data['mime_type'])){
|
1683 |
$metadata['mime_type'] = $data['mime_type'];
|
1684 |
}
|
1685 |
-
if(!empty($data['playtime_seconds'])){
|
1686 |
-
$metadata['length'] = (int)ceil($data['playtime_seconds']);
|
1687 |
}
|
1688 |
-
if(!empty($data['playtime_string'])){
|
1689 |
$metadata['length_formatted'] = $data['playtime_string'];
|
1690 |
}
|
1691 |
|
@@ -1703,9 +1728,9 @@ class GmediaCore{
|
|
1703 |
/** Write the file
|
1704 |
*
|
1705 |
* @param string $file_tmp
|
1706 |
-
* @param array
|
1707 |
* @param string $content_type
|
1708 |
-
* @param array
|
1709 |
*
|
1710 |
* @return array
|
1711 |
*/
|
@@ -1714,27 +1739,31 @@ class GmediaCore{
|
|
1714 |
|
1715 |
$cleanup_dir = true; // Remove old files
|
1716 |
$file_age = 5 * 3600; // Temp file age in seconds
|
1717 |
-
$chunk = (int)$this->_req('chunk', 0);
|
1718 |
-
$chunks = (int)$this->_req('chunks', 0);
|
1719 |
|
1720 |
// try to make grand-media dir if not exists
|
1721 |
-
if(!wp_mkdir_p($fileinfo['dirpath'])){
|
1722 |
-
$return = array(
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
|
|
|
|
1726 |
);
|
1727 |
|
1728 |
return $return;
|
1729 |
}
|
1730 |
// Check if grand-media dir is writable
|
1731 |
-
if(!is_writable($fileinfo['dirpath'])){
|
1732 |
@chmod($fileinfo['dirpath'], 0755);
|
1733 |
-
if(!is_writable($fileinfo['dirpath'])){
|
1734 |
-
$return = array(
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
|
|
|
|
1738 |
);
|
1739 |
|
1740 |
return $return;
|
@@ -1753,8 +1782,9 @@ class GmediaCore{
|
|
1753 |
|
1754 |
closedir($_dir);
|
1755 |
} else{
|
1756 |
-
$return = array(
|
1757 |
-
|
|
|
1758 |
);
|
1759 |
|
1760 |
return $return;
|
@@ -1780,7 +1810,7 @@ class GmediaCore{
|
|
1780 |
if(strpos($content_type, "multipart") !== false){
|
1781 |
@unlink($file_tmp);
|
1782 |
}
|
1783 |
-
if(!$chunks || $chunk == ($chunks - 1)){
|
1784 |
sleep(1);
|
1785 |
// Strip the temp .part suffix off
|
1786 |
rename($fileinfo['filepath'] . '.part', $fileinfo['filepath']);
|
@@ -1800,17 +1830,17 @@ class GmediaCore{
|
|
1800 |
switch($extensions[ $size[2] ]){
|
1801 |
case 'GIF':
|
1802 |
$CHANNEL = 1;
|
1803 |
-
|
1804 |
case 'JPG':
|
1805 |
$CHANNEL = $size['channels'];
|
1806 |
-
|
1807 |
case 'PNG':
|
1808 |
$CHANNEL = 3;
|
1809 |
-
|
1810 |
case 'BMP':
|
1811 |
default:
|
1812 |
$CHANNEL = 6;
|
1813 |
-
|
1814 |
}
|
1815 |
$MB = 1048576; // number of bytes in 1M
|
1816 |
$K64 = 65536; // number of bytes in 64K
|
@@ -1835,45 +1865,53 @@ class GmediaCore{
|
|
1835 |
}
|
1836 |
}
|
1837 |
|
1838 |
-
if(!wp_mkdir_p($fileinfo['dirpath_thumb'])){
|
1839 |
-
$return = array(
|
1840 |
-
|
1841 |
-
|
1842 |
-
|
|
|
|
|
1843 |
);
|
1844 |
|
1845 |
return $return;
|
1846 |
}
|
1847 |
-
if(!is_writable($fileinfo['dirpath_thumb'])){
|
1848 |
@chmod($fileinfo['dirpath_thumb'], 0755);
|
1849 |
-
if(!is_writable($fileinfo['dirpath_thumb'])){
|
1850 |
@unlink($fileinfo['filepath']);
|
1851 |
-
$return = array(
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
|
|
|
|
1855 |
);
|
1856 |
|
1857 |
return $return;
|
1858 |
}
|
1859 |
}
|
1860 |
-
if(!wp_mkdir_p($fileinfo['dirpath_original'])){
|
1861 |
-
$return = array(
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
|
|
|
|
1865 |
);
|
1866 |
|
1867 |
return $return;
|
1868 |
}
|
1869 |
-
if(!is_writable($fileinfo['dirpath_original'])){
|
1870 |
@chmod($fileinfo['dirpath_original'], 0755);
|
1871 |
-
if(!is_writable($fileinfo['dirpath_original'])){
|
1872 |
@unlink($fileinfo['filepath']);
|
1873 |
-
$return = array(
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
|
|
|
|
1877 |
);
|
1878 |
|
1879 |
return $return;
|
@@ -1896,19 +1934,19 @@ class GmediaCore{
|
|
1896 |
|
1897 |
$angle = 0;
|
1898 |
$image_meta = @$this->wp_read_image_metadata($fileinfo['filepath_original']);
|
1899 |
-
if(!empty($image_meta['orientation'])){
|
1900 |
switch($image_meta['orientation']){
|
1901 |
case 3:
|
1902 |
$angle = 180;
|
1903 |
-
|
1904 |
case 6:
|
1905 |
$angle = 270;
|
1906 |
$size_ratio = $size[1] / $size[0];
|
1907 |
-
|
1908 |
case 8:
|
1909 |
$angle = 90;
|
1910 |
$size_ratio = $size[1] / $size[0];
|
1911 |
-
|
1912 |
}
|
1913 |
}
|
1914 |
|
@@ -1919,9 +1957,10 @@ class GmediaCore{
|
|
1919 |
if(is_wp_error($editor)){
|
1920 |
@unlink($fileinfo['filepath']);
|
1921 |
@unlink($fileinfo['filepath_original']);
|
1922 |
-
$return = array(
|
1923 |
-
|
1924 |
-
|
|
|
1925 |
);
|
1926 |
|
1927 |
return $return;
|
@@ -1939,9 +1978,10 @@ class GmediaCore{
|
|
1939 |
if(is_wp_error($resized)){
|
1940 |
@unlink($fileinfo['filepath']);
|
1941 |
@unlink($fileinfo['filepath_original']);
|
1942 |
-
$return = array(
|
1943 |
-
|
1944 |
-
|
|
|
1945 |
);
|
1946 |
|
1947 |
return $return;
|
@@ -1952,9 +1992,10 @@ class GmediaCore{
|
|
1952 |
if(is_wp_error($saved)){
|
1953 |
@unlink($fileinfo['filepath']);
|
1954 |
@unlink($fileinfo['filepath_original']);
|
1955 |
-
$return = array(
|
1956 |
-
|
1957 |
-
|
|
|
1958 |
);
|
1959 |
|
1960 |
return $return;
|
@@ -1978,9 +2019,10 @@ class GmediaCore{
|
|
1978 |
if(is_wp_error($resized)){
|
1979 |
@unlink($fileinfo['filepath']);
|
1980 |
@unlink($fileinfo['filepath_original']);
|
1981 |
-
$return = array(
|
1982 |
-
|
1983 |
-
|
|
|
1984 |
);
|
1985 |
|
1986 |
return $return;
|
@@ -1991,9 +2033,10 @@ class GmediaCore{
|
|
1991 |
if(is_wp_error($saved)){
|
1992 |
@unlink($fileinfo['filepath']);
|
1993 |
@unlink($fileinfo['filepath_original']);
|
1994 |
-
$return = array(
|
1995 |
-
|
1996 |
-
|
|
|
1997 |
);
|
1998 |
|
1999 |
return $return;
|
@@ -2019,41 +2062,41 @@ class GmediaCore{
|
|
2019 |
$description = '';
|
2020 |
$link = '';
|
2021 |
$date = null;
|
2022 |
-
if(!isset($post_data['set_title'])){
|
2023 |
$post_data['set_title'] = 'filename';
|
2024 |
}
|
2025 |
-
if(!isset($post_data['set_status'])){
|
2026 |
$post_data['set_status'] = isset($post_data['status'])? $post_data['status'] : 'inherit';
|
2027 |
}
|
2028 |
|
2029 |
$keywords = array();
|
2030 |
// use image exif/iptc data for title and caption defaults if possible
|
2031 |
if($size){
|
2032 |
-
if(!empty($image_meta)){
|
2033 |
if('exif' == $post_data['set_title']){
|
2034 |
-
if(!empty($image_meta['title']) && trim($image_meta['title'])){
|
2035 |
$title = $image_meta['title'];
|
2036 |
}
|
2037 |
}
|
2038 |
-
if(!empty($image_meta['caption']) && trim($image_meta['caption'])){
|
2039 |
$description = $image_meta['caption'];
|
2040 |
}
|
2041 |
-
if(!empty($image_meta['keywords'])){
|
2042 |
$keywords = $image_meta['keywords'];
|
2043 |
}
|
2044 |
}
|
2045 |
} else{
|
2046 |
$file_meta = $this->get_file_metadata($fileinfo['filepath_original'], $fileinfo);
|
2047 |
-
if(!empty($file_meta)){
|
2048 |
if('exif' == $post_data['set_title']){
|
2049 |
-
if(!empty($file_meta['title']) && trim($file_meta['title'])){
|
2050 |
$title = $file_meta['title'];
|
2051 |
}
|
2052 |
}
|
2053 |
-
if(!empty($file_meta['comment']) && trim($file_meta['comment'])){
|
2054 |
$description = $file_meta['comment'];
|
2055 |
}
|
2056 |
-
if(!empty($file_meta['album']) && (!isset($post_data['terms']['gmedia_album']) || empty($post_data['terms']['gmedia_album']))){
|
2057 |
$post_data['terms']['gmedia_album'] = array($file_meta['album']);
|
2058 |
}
|
2059 |
}
|
@@ -2084,7 +2127,7 @@ class GmediaCore{
|
|
2084 |
unset($post_data['gmuid'], $post_data['mime_type'], $post_data['set_title'], $post_data['set_status']);
|
2085 |
|
2086 |
if(isset($post_data['terms']['gmedia_category']) && !empty($post_data['terms']['gmedia_category'])){
|
2087 |
-
if(!is_array($post_data['terms']['gmedia_category'])){
|
2088 |
$post_data['terms']['gmedia_category'] = explode(',', $post_data['terms']['gmedia_category']);
|
2089 |
}
|
2090 |
} else{
|
@@ -2092,29 +2135,30 @@ class GmediaCore{
|
|
2092 |
}
|
2093 |
|
2094 |
if(isset($post_data['terms']['gmedia_tag']) && !empty($post_data['terms']['gmedia_tag'])){
|
2095 |
-
if(!is_array($post_data['terms']['gmedia_tag'])){
|
2096 |
$post_data['terms']['gmedia_tag'] = explode(',', $post_data['terms']['gmedia_tag']);
|
2097 |
}
|
2098 |
} else{
|
2099 |
$post_data['terms']['gmedia_tag'] = array();
|
2100 |
}
|
2101 |
-
if(!empty($keywords)){
|
2102 |
$post_data['terms']['gmedia_tag'] = array_unique(array_merge($post_data['terms']['gmedia_tag'], $keywords));
|
2103 |
}
|
2104 |
|
2105 |
// Construct the media array
|
2106 |
-
$media_data = array(
|
2107 |
-
|
2108 |
-
|
2109 |
-
|
2110 |
-
|
2111 |
-
|
2112 |
-
|
|
|
2113 |
);
|
2114 |
|
2115 |
$media_data = $this->array_replace_recursive($media_data, $post_data);
|
2116 |
|
2117 |
-
if(!current_user_can('gmedia_delete_others_media')){
|
2118 |
$media_data['author'] = get_current_user_id();
|
2119 |
}
|
2120 |
|
@@ -2126,10 +2170,10 @@ class GmediaCore{
|
|
2126 |
if(empty($media_metadata['image_meta'])){
|
2127 |
$media_metadata['image_meta'] = $image_meta;
|
2128 |
}
|
2129 |
-
if(!empty($image_meta['created_timestamp'])){
|
2130 |
$gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_created_timestamp', $image_meta['created_timestamp']);
|
2131 |
}
|
2132 |
-
if(!empty($image_meta['GPS'])){
|
2133 |
$gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_gps', $image_meta['GPS']);
|
2134 |
}
|
2135 |
}
|
@@ -2138,11 +2182,12 @@ class GmediaCore{
|
|
2138 |
$gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_hash', $hash_file);
|
2139 |
$file_size = filesize($fileinfo['filepath_original']);
|
2140 |
$gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_size', $file_size);
|
2141 |
-
$return = array(
|
2142 |
-
|
|
|
2143 |
);
|
2144 |
|
2145 |
-
if((int)$gmGallery->options['delete_originals']){
|
2146 |
@unlink($fileinfo['filepath_original']);
|
2147 |
}
|
2148 |
|
@@ -2169,7 +2214,7 @@ class GmediaCore{
|
|
2169 |
|
2170 |
if($size){
|
2171 |
require_once(dirname(__FILE__) . '/pel/autoload.php');
|
2172 |
-
try{
|
2173 |
Pel::setJPEGQuality(100);
|
2174 |
/*
|
2175 |
* We want the raw JPEG data from $scaled. Luckily, one can create a
|
@@ -2198,7 +2243,7 @@ class GmediaCore{
|
|
2198 |
$orientation->setValue(1);
|
2199 |
}
|
2200 |
|
2201 |
-
if(!empty($input_ifd0)){
|
2202 |
/*$x_resolution = $input_ifd0->getEntry( PelTag::X_RESOLUTION );
|
2203 |
$y_resolution = $input_ifd0->getEntry( PelTag::Y_RESOLUTION );
|
2204 |
if ( $x_resolution != null && $y_resolution != null ) {
|
@@ -2215,7 +2260,7 @@ class GmediaCore{
|
|
2215 |
$image_length->setValue($size[1]);
|
2216 |
}
|
2217 |
}
|
2218 |
-
if(!empty($input_exif_ifd)){
|
2219 |
$x_dimention = $input_exif_ifd->getEntry(PelTag::PIXEL_X_DIMENSION);
|
2220 |
$y_dimention = $input_exif_ifd->getEntry(PelTag::PIXEL_Y_DIMENSION);
|
2221 |
if($x_dimention != null && $y_dimention != null){
|
@@ -2223,7 +2268,7 @@ class GmediaCore{
|
|
2223 |
$y_dimention->setValue($size[1]);
|
2224 |
}
|
2225 |
}
|
2226 |
-
if(!empty($input_inter_ifd)){
|
2227 |
$rel_image_width = $input_inter_ifd->getEntry(PelTag::RELATED_IMAGE_WIDTH);
|
2228 |
$rel_image_length = $input_inter_ifd->getEntry(PelTag::RELATED_IMAGE_LENGTH);
|
2229 |
if($rel_image_width != null && $rel_image_length != null){
|
@@ -2279,14 +2324,14 @@ class GmediaCore{
|
|
2279 |
$_terms['gmedia_album'] = '';
|
2280 |
}
|
2281 |
if(isset($_terms['gmedia_category']) && !empty($_terms['gmedia_category'])){
|
2282 |
-
if(!is_array($_terms['gmedia_category'])){
|
2283 |
$_terms['gmedia_category'] = array_filter(array_map('trim', explode(',', $_terms['gmedia_category'])));
|
2284 |
}
|
2285 |
} else{
|
2286 |
$_terms['gmedia_category'] = array();
|
2287 |
}
|
2288 |
if(isset($_terms['gmedia_tag']) && !empty($_terms['gmedia_tag'])){
|
2289 |
-
if(!is_array($_terms['gmedia_tag'])){
|
2290 |
$_terms['gmedia_tag'] = array_filter(array_map('trim', explode(',', $_terms['gmedia_tag'])));
|
2291 |
}
|
2292 |
} else{
|
@@ -2319,7 +2364,7 @@ class GmediaCore{
|
|
2319 |
$prefix = "\n<pre>$i/$c - ";
|
2320 |
$prefix_ko = "\n<pre class='ko'>$i/$c - ";
|
2321 |
|
2322 |
-
if(!is_file($file)){
|
2323 |
echo $prefix_ko . sprintf(__('File not exists: %s', 'grand-media'), $file) . $eol;
|
2324 |
continue;
|
2325 |
}
|
@@ -2338,14 +2383,14 @@ class GmediaCore{
|
|
2338 |
|
2339 |
|
2340 |
// try to make grand-media dir if not exists
|
2341 |
-
if(!wp_mkdir_p($fileinfo['dirpath'])){
|
2342 |
echo $prefix_ko . sprintf(__('Unable to create directory `%s`. Is its parent directory writable by the server?', 'grand-media'), $fileinfo['dirpath']) . $eol;
|
2343 |
continue;
|
2344 |
}
|
2345 |
// Check if grand-media dir is writable
|
2346 |
-
if(!is_writable($fileinfo['dirpath'])){
|
2347 |
@chmod($fileinfo['dirpath'], 0755);
|
2348 |
-
if(!is_writable($fileinfo['dirpath'])){
|
2349 |
echo $prefix_ko . sprintf(__('Directory `%s` or its subfolders are not writable by the server.', 'grand-media'), dirname($fileinfo['dirpath'])) . $eol;
|
2350 |
continue;
|
2351 |
}
|
@@ -2379,17 +2424,17 @@ class GmediaCore{
|
|
2379 |
switch($extensions[ $size[2] ]){
|
2380 |
case 'GIF':
|
2381 |
$CHANNEL = 1;
|
2382 |
-
|
2383 |
case 'JPG':
|
2384 |
$CHANNEL = $size['channels'];
|
2385 |
-
|
2386 |
case 'PNG':
|
2387 |
$CHANNEL = 3;
|
2388 |
-
|
2389 |
case 'BMP':
|
2390 |
default:
|
2391 |
$CHANNEL = 6;
|
2392 |
-
|
2393 |
}
|
2394 |
$MB = 1048576; // number of bytes in 1M
|
2395 |
$K64 = 65536; // number of bytes in 64K
|
@@ -2414,25 +2459,25 @@ class GmediaCore{
|
|
2414 |
}
|
2415 |
}
|
2416 |
|
2417 |
-
if(!wp_mkdir_p($fileinfo['dirpath_thumb'])){
|
2418 |
echo $prefix_ko . sprintf(__('Unable to create directory `%s`. Is its parent directory writable by the server?', 'grand-media'), $fileinfo['dirpath_thumb']) . $eol;
|
2419 |
continue;
|
2420 |
}
|
2421 |
-
if(!is_writable($fileinfo['dirpath_thumb'])){
|
2422 |
@chmod($fileinfo['dirpath_thumb'], 0755);
|
2423 |
-
if(!is_writable($fileinfo['dirpath_thumb'])){
|
2424 |
@unlink($fileinfo['filepath']);
|
2425 |
echo $prefix_ko . sprintf(__('Directory `%s` is not writable by the server.', 'grand-media'), $fileinfo['dirpath_thumb']) . $eol;
|
2426 |
continue;
|
2427 |
}
|
2428 |
}
|
2429 |
-
if(!wp_mkdir_p($fileinfo['dirpath_original'])){
|
2430 |
echo $prefix_ko . sprintf(__('Unable to create directory `%s`. Is its parent directory writable by the server?', 'grand-media'), $fileinfo['dirpath_original']) . $eol;
|
2431 |
continue;
|
2432 |
}
|
2433 |
-
if(!is_writable($fileinfo['dirpath_original'])){
|
2434 |
@chmod($fileinfo['dirpath_original'], 0755);
|
2435 |
-
if(!is_writable($fileinfo['dirpath_original'])){
|
2436 |
@unlink($fileinfo['filepath']);
|
2437 |
echo $prefix_ko . sprintf(__('Directory `%s` is not writable by the server.', 'grand-media'), $fileinfo['dirpath_original']) . $eol;
|
2438 |
continue;
|
@@ -2455,19 +2500,19 @@ class GmediaCore{
|
|
2455 |
|
2456 |
$angle = 0;
|
2457 |
$image_meta = @$this->wp_read_image_metadata($fileinfo['filepath_original']);
|
2458 |
-
if(!empty($image_meta['orientation'])){
|
2459 |
switch($image_meta['orientation']){
|
2460 |
case 3:
|
2461 |
$angle = 180;
|
2462 |
-
|
2463 |
case 6:
|
2464 |
$angle = 270;
|
2465 |
$size_ratio = $size[1] / $size[0];
|
2466 |
-
|
2467 |
case 8:
|
2468 |
$angle = 90;
|
2469 |
$size_ratio = $size[1] / $size[0];
|
2470 |
-
|
2471 |
}
|
2472 |
}
|
2473 |
|
@@ -2551,20 +2596,20 @@ class GmediaCore{
|
|
2551 |
|
2552 |
// Write media data to DB
|
2553 |
if($size){
|
2554 |
-
if(!empty($image_meta)){
|
2555 |
if(empty($title) && !empty($image_meta['title']) && trim($image_meta['title']) && !is_numeric(sanitize_title($image_meta['title']))){
|
2556 |
$title = $image_meta['title'];
|
2557 |
}
|
2558 |
if(empty($description) && !empty($image_meta['caption']) && trim($image_meta['caption'])){
|
2559 |
$description = $image_meta['caption'];
|
2560 |
}
|
2561 |
-
if(!empty($image_meta['keywords'])){
|
2562 |
-
$terms['gmedia_tag'] = array_unique(array_merge((array)$_terms['gmedia_tag'], $image_meta['keywords']));
|
2563 |
}
|
2564 |
}
|
2565 |
} else{
|
2566 |
$file_meta = $this->get_file_metadata($fileinfo['filepath_original'], $fileinfo);
|
2567 |
-
if(!empty($file_meta)){
|
2568 |
if(empty($title) && !empty($file_meta['title']) && trim($file_meta['title']) && !is_numeric(sanitize_title($file_meta['title']))){
|
2569 |
$title = $file_meta['title'];
|
2570 |
}
|
@@ -2582,16 +2627,17 @@ class GmediaCore{
|
|
2582 |
}
|
2583 |
|
2584 |
// Construct the media_data array
|
2585 |
-
$media_data = array(
|
2586 |
-
|
2587 |
-
|
2588 |
-
|
2589 |
-
|
2590 |
-
|
2591 |
-
|
|
|
2592 |
);
|
2593 |
|
2594 |
-
if(!current_user_can('gmedia_delete_others_media')){
|
2595 |
$media_data['author'] = get_current_user_id();
|
2596 |
}
|
2597 |
|
@@ -2603,10 +2649,10 @@ class GmediaCore{
|
|
2603 |
if(empty($media_metadata['image_meta'])){
|
2604 |
$media_metadata['image_meta'] = $image_meta;
|
2605 |
}
|
2606 |
-
if(!empty($image_meta['created_timestamp'])){
|
2607 |
$gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_created_timestamp', $image_meta['created_timestamp']);
|
2608 |
}
|
2609 |
-
if(!empty($image_meta['GPS'])){
|
2610 |
$gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_gps', $image_meta['GPS']);
|
2611 |
}
|
2612 |
}
|
@@ -2617,7 +2663,7 @@ class GmediaCore{
|
|
2617 |
|
2618 |
echo $prefix . $fileinfo['basename'] . ': <span class="ok">' . sprintf(__('success (ID #%s)', 'grand-media'), $id) . '</span>' . $eol;
|
2619 |
|
2620 |
-
if((int)$gmGallery->options['delete_originals']){
|
2621 |
@unlink($fileinfo['filepath_original']);
|
2622 |
}
|
2623 |
if($move){
|
@@ -2641,7 +2687,7 @@ class GmediaCore{
|
|
2641 |
global $gmDB;
|
2642 |
|
2643 |
$gmedia = $gmDB->get_gmedia($gmid);
|
2644 |
-
if(!$gmedia || is_wp_error($gmedia)){
|
2645 |
return;
|
2646 |
}
|
2647 |
|
@@ -2658,17 +2704,18 @@ class GmediaCore{
|
|
2658 |
}
|
2659 |
|
2660 |
// Construct the media_data array
|
2661 |
-
$media_data = array(
|
2662 |
-
|
2663 |
-
|
2664 |
-
|
2665 |
-
|
2666 |
-
|
2667 |
-
|
2668 |
-
|
2669 |
-
|
2670 |
-
|
2671 |
-
|
|
|
2672 |
);
|
2673 |
|
2674 |
$media_data['author'] = get_current_user_id();
|
@@ -2679,9 +2726,9 @@ class GmediaCore{
|
|
2679 |
$media_metadata = $gmDB->get_metadata('gmedia', $gmedia->ID);
|
2680 |
foreach($media_metadata as $key => $values){
|
2681 |
//if($this->is_protected_meta($key, 'gmedia')){
|
2682 |
-
|
2683 |
-
|
2684 |
-
|
2685 |
//}
|
2686 |
}
|
2687 |
|
@@ -2696,7 +2743,7 @@ class GmediaCore{
|
|
2696 |
global $gmDB, $gmGallery;
|
2697 |
|
2698 |
$item = $gmDB->get_gmedia($gmid);
|
2699 |
-
if(!empty($item)){
|
2700 |
|
2701 |
$type = explode('/', $item->mime_type);
|
2702 |
$type = $type[0];
|
@@ -2710,8 +2757,8 @@ class GmediaCore{
|
|
2710 |
$fail = '';
|
2711 |
$success = '';
|
2712 |
|
2713 |
-
if((int)$item->author != get_current_user_id()){
|
2714 |
-
if(!current_user_can('gmedia_edit_others_media')){
|
2715 |
$out = array('error' => $this->alert('danger', __('You are not allowed to edit others media', 'grand-media')));
|
2716 |
|
2717 |
return $out;
|
@@ -2730,30 +2777,30 @@ class GmediaCore{
|
|
2730 |
$fileinfo = $this->fileinfo($item->gmuid, false);
|
2731 |
$is_file_original = is_file($fileinfo['filepath_original']);
|
2732 |
$filepath_original = $is_file_original? $fileinfo['filepath_original'] : (is_file($fileinfo['filepath'])? $fileinfo['filepath'] : null);
|
2733 |
-
if(!$filepath_original){
|
2734 |
$out = array('error' => $this->alert('danger', __('Original file does not exists', 'grand-media')));
|
2735 |
|
2736 |
return $out;
|
2737 |
}
|
2738 |
$size = @getimagesize($filepath_original);
|
2739 |
|
2740 |
-
do{
|
2741 |
$extensions = array('1' => 'GIF', '2' => 'JPG', '3' => 'PNG', '6' => 'BMP');
|
2742 |
if(function_exists('memory_get_usage')){
|
2743 |
switch($extensions[ $size[2] ]){
|
2744 |
case 'GIF':
|
2745 |
$CHANNEL = 1;
|
2746 |
-
|
2747 |
case 'JPG':
|
2748 |
$CHANNEL = $size['channels'];
|
2749 |
-
|
2750 |
case 'PNG':
|
2751 |
$CHANNEL = 3;
|
2752 |
-
|
2753 |
case 'BMP':
|
2754 |
default:
|
2755 |
$CHANNEL = 6;
|
2756 |
-
|
2757 |
}
|
2758 |
$MB = 1048576; // number of bytes in 1M
|
2759 |
$K64 = 65536; // number of bytes in 64K
|
@@ -2783,19 +2830,19 @@ class GmediaCore{
|
|
2783 |
$angle = 0;
|
2784 |
if($is_file_original){
|
2785 |
$image_meta = @$this->wp_read_image_metadata($filepath_original);
|
2786 |
-
if(!empty($image_meta['orientation'])){
|
2787 |
switch($image_meta['orientation']){
|
2788 |
case 3:
|
2789 |
$angle = 180;
|
2790 |
-
|
2791 |
case 6:
|
2792 |
$angle = 270;
|
2793 |
$size_ratio = $size[1] / $size[0];
|
2794 |
-
|
2795 |
case 8:
|
2796 |
$angle = 90;
|
2797 |
$size_ratio = $size[1] / $size[0];
|
2798 |
-
|
2799 |
}
|
2800 |
}
|
2801 |
$webimg['resize'] = (($webimg['width'] < $size[0]) || ($webimg['height'] < $size[1]))? true : false;
|
@@ -2901,18 +2948,18 @@ class GmediaCore{
|
|
2901 |
/**
|
2902 |
* @param string $service
|
2903 |
*
|
2904 |
-
* @return array json
|
2905 |
*/
|
2906 |
function app_service($service){
|
2907 |
-
global $gmGallery, $gmDB;
|
2908 |
|
2909 |
-
|
2910 |
return false;
|
2911 |
}
|
2912 |
-
if(!current_user_can('manage_options')){
|
2913 |
die('-1');
|
2914 |
}
|
2915 |
-
if(!$service){
|
2916 |
die('0');
|
2917 |
}
|
2918 |
|
@@ -2924,27 +2971,31 @@ class GmediaCore{
|
|
2924 |
$options['mobile_app'] = 0;
|
2925 |
}
|
2926 |
|
2927 |
-
$data['site_email'] =
|
2928 |
if(in_array($service, array('app_updateinfo')) && !is_email($data['site_email'])){
|
2929 |
-
$result['error'][] = __('
|
2930 |
} else{
|
2931 |
|
2932 |
$url = home_url();
|
2933 |
$post_data = array('url' => $url);
|
2934 |
|
2935 |
-
if('app_uninstallplugin'
|
2936 |
-
if(!empty($options['site_ID'])){
|
2937 |
$post_data['site_id'] = $options['site_ID'];
|
2938 |
-
wp_remote_post('
|
2939 |
-
|
2940 |
-
|
|
|
|
|
|
|
|
|
2941 |
));
|
2942 |
}
|
2943 |
|
2944 |
return false;
|
2945 |
}
|
2946 |
|
2947 |
-
$hash = wp_generate_password('6', false);
|
2948 |
|
2949 |
if(in_array($service, array('app_activate', 'app_updateinfo'))){
|
2950 |
$status = 1;
|
@@ -2953,49 +3004,88 @@ class GmediaCore{
|
|
2953 |
}
|
2954 |
$install_date = get_option('gmediaInstallDate');
|
2955 |
|
2956 |
-
$data['service']
|
2957 |
-
$data['site_hash']
|
2958 |
-
$data['site_ID']
|
2959 |
-
$data['title']
|
2960 |
-
$data['description']
|
2961 |
-
$data['url']
|
2962 |
-
$data['license']
|
2963 |
-
$data['status']
|
2964 |
-
$data['install_date']
|
2965 |
-
|
2966 |
-
$
|
2967 |
-
|
2968 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2969 |
));
|
2970 |
-
|
2971 |
-
|
2972 |
-
|
2973 |
-
|
|
|
|
|
|
|
|
|
2974 |
}
|
2975 |
|
2976 |
set_transient($hash, $data, 45);
|
2977 |
|
2978 |
$post_data['hash'] = $hash;
|
2979 |
-
$gms_post = wp_remote_post('
|
2980 |
-
|
2981 |
-
|
|
|
|
|
|
|
2982 |
));
|
2983 |
if(is_wp_error($gms_post)){
|
2984 |
$result['error'][] = $gms_post->get_error_message();
|
2985 |
}
|
2986 |
$gms_post_body = wp_remote_retrieve_body($gms_post);
|
2987 |
-
$_result = (array)json_decode($gms_post_body);
|
2988 |
if(isset($_result['error'])){
|
2989 |
-
if(!isset($result['error'])){
|
2990 |
$result['error'] = array();
|
2991 |
}
|
2992 |
-
$_result['error'] = (array)$_result['error'];
|
2993 |
$_result['error'] = array_filter($_result['error'], 'is_string');
|
2994 |
$result['error'] = array_merge($result['error'], $_result['error']);
|
2995 |
} else{
|
2996 |
$result = array_merge($_result, $result);
|
2997 |
-
|
2998 |
-
|
|
|
2999 |
if(isset($result['message'])){
|
3000 |
$result['message'] = $this->alert('info', $result['message']);
|
3001 |
}
|
@@ -3025,12 +3115,12 @@ class GmediaCore{
|
|
3025 |
* @param null $modules
|
3026 |
*/
|
3027 |
function modules_update($modules = null){
|
3028 |
-
$wp_installing = (bool)(defined('WP_INSTALLING') && WP_INSTALLING);
|
3029 |
if($wp_installing){
|
3030 |
return;
|
3031 |
}
|
3032 |
|
3033 |
-
if(!is_array($modules)){
|
3034 |
$modules = get_gmedia_modules();
|
3035 |
}
|
3036 |
if(isset($modules['error'])){
|
@@ -3041,7 +3131,7 @@ class GmediaCore{
|
|
3041 |
$modules_update_count = 0;
|
3042 |
|
3043 |
foreach($modules['in'] as $module){
|
3044 |
-
if(!empty($module['update']) && 'remote' != $module['place']){
|
3045 |
$modules_update_count ++;
|
3046 |
}
|
3047 |
}
|
@@ -3059,52 +3149,53 @@ class GmediaCore{
|
|
3059 |
*/
|
3060 |
function i18n_exif_name($key){
|
3061 |
$_key = strtolower($key);
|
3062 |
-
$tagnames = array(
|
3063 |
-
|
3064 |
-
|
3065 |
-
|
3066 |
-
|
3067 |
-
|
3068 |
-
|
3069 |
-
|
3070 |
-
|
3071 |
-
|
3072 |
-
|
3073 |
-
|
3074 |
-
|
3075 |
-
|
3076 |
-
|
3077 |
-
|
3078 |
-
|
3079 |
-
|
3080 |
-
|
3081 |
-
|
3082 |
-
|
3083 |
-
|
3084 |
-
|
3085 |
-
|
3086 |
-
|
3087 |
-
|
3088 |
-
|
3089 |
-
|
3090 |
-
|
3091 |
-
|
3092 |
-
|
3093 |
-
|
3094 |
-
|
3095 |
-
|
3096 |
-
|
3097 |
-
|
3098 |
-
|
3099 |
-
|
3100 |
-
|
3101 |
-
|
3102 |
-
|
3103 |
-
|
3104 |
-
|
3105 |
-
|
3106 |
-
|
3107 |
-
|
|
|
3108 |
);
|
3109 |
|
3110 |
if(isset($tagnames[ $_key ])){
|
@@ -3117,7 +3208,7 @@ class GmediaCore{
|
|
3117 |
/**
|
3118 |
* Determine whether a meta key is protected.
|
3119 |
*
|
3120 |
-
* @param string
|
3121 |
* @param string|null $meta_type
|
3122 |
*
|
3123 |
* @return bool True if the key is protected, false otherwise.
|
@@ -3132,7 +3223,7 @@ class GmediaCore{
|
|
3132 |
* Display custom fields form fields.
|
3133 |
* @since 1.6.3
|
3134 |
*
|
3135 |
-
* @param int
|
3136 |
* @param string $meta_type
|
3137 |
*/
|
3138 |
function gmedia_custom_meta_box($gmedia_id, $meta_type = 'gmedia'){
|
@@ -3142,7 +3233,7 @@ class GmediaCore{
|
|
3142 |
return;
|
3143 |
}
|
3144 |
|
3145 |
-
if(!in_array($meta_type, array('gmedia', 'gmedia_term'))){
|
3146 |
$meta_type = 'gmedia';
|
3147 |
}
|
3148 |
?>
|
@@ -3156,7 +3247,7 @@ class GmediaCore{
|
|
3156 |
}
|
3157 |
} ?>
|
3158 |
<div class="row">
|
3159 |
-
<?php if(!empty($metadata)){
|
3160 |
//$count = 0;
|
3161 |
foreach($metadata as $entry){
|
3162 |
echo $this->_list_meta_item($entry, $meta_type);
|
@@ -3190,7 +3281,7 @@ class GmediaCore{
|
|
3190 |
|
3191 |
$entry['meta_key'] = esc_attr($entry['meta_key']);
|
3192 |
$entry['meta_value'] = esc_textarea($entry['meta_value']); // using a <textarea />
|
3193 |
-
$entry['meta_id'] = (int)$entry['meta_id'];
|
3194 |
|
3195 |
$colsm = ('gmedia' == $meta_type)? 6 : 4;
|
3196 |
//$delete_nonce = wp_create_nonce( 'gmedia_custom_field', '_wpnonce_custom_field' );
|
@@ -3216,7 +3307,7 @@ class GmediaCore{
|
|
3216 |
function meta_form($meta_type = 'gmedia'){
|
3217 |
global $wpdb;
|
3218 |
|
3219 |
-
if(!in_array($meta_type, array('gmedia', 'gmedia_term'))){
|
3220 |
$meta_type = 'gmedia';
|
3221 |
}
|
3222 |
|
@@ -3278,7 +3369,7 @@ class GmediaCore{
|
|
3278 |
/**
|
3279 |
* @since 1.6.3
|
3280 |
*
|
3281 |
-
* @param int
|
3282 |
* @param string $meta_type
|
3283 |
*
|
3284 |
* @return bool|int
|
@@ -3286,11 +3377,11 @@ class GmediaCore{
|
|
3286 |
function add_meta($gmedia_ID, $meta_type = 'gmedia'){
|
3287 |
global $gmDB;
|
3288 |
|
3289 |
-
if(!in_array($meta_type, array('gmedia', 'gmedia_term'))){
|
3290 |
$meta_type = 'gmedia';
|
3291 |
}
|
3292 |
|
3293 |
-
$gmedia_ID = (int)$gmedia_ID;
|
3294 |
|
3295 |
$metakeyselect = isset($_POST['metakeyselect'])? wp_unslash(trim($_POST['metakeyselect'])) : '';
|
3296 |
$metakeyinput = isset($_POST['metakeyinput'])? wp_unslash(trim($_POST['metakeyinput'])) : '';
|
@@ -3299,7 +3390,7 @@ class GmediaCore{
|
|
3299 |
$metavalue = trim($metavalue);
|
3300 |
}
|
3301 |
|
3302 |
-
if(('0' === $metavalue || !empty ($metavalue)) && ((!empty($metakeyselect) && !empty($metakeyselect)) || !empty ($metakeyinput))){
|
3303 |
/*
|
3304 |
* We have a key/value pair. If both the select and the input
|
3305 |
* for the key have data, the input takes precedence.
|
@@ -3334,7 +3425,7 @@ class GmediaCore{
|
|
3334 |
if(is_object($item)){
|
3335 |
$item_id = $item->ID;
|
3336 |
} elseif($this->is_digit($item)){
|
3337 |
-
$item_id = (int)$item;
|
3338 |
} else{
|
3339 |
return null;
|
3340 |
}
|
@@ -3352,7 +3443,7 @@ class GmediaCore{
|
|
3352 |
}
|
3353 |
}
|
3354 |
|
3355 |
-
if(!empty($metainfo)){
|
3356 |
foreach($metainfo as $key => $value){
|
3357 |
if(empty($value)){
|
3358 |
continue;
|
@@ -3374,7 +3465,7 @@ class GmediaCore{
|
|
3374 |
* @return array
|
3375 |
*/
|
3376 |
function sanitize_meta_value($value){
|
3377 |
-
if(is_array($value) && (bool)count(array_filter(array_keys($value), 'is_string'))){
|
3378 |
$value_return = array();
|
3379 |
foreach($value as $key => $val){
|
3380 |
if(empty($value)){
|
@@ -3408,7 +3499,7 @@ class GmediaCore{
|
|
3408 |
continue;
|
3409 |
}
|
3410 |
$metatext .= "<b>{$meta['name']}:</b>";
|
3411 |
-
if(!is_array($meta['value'])){
|
3412 |
$metatext .= " {$meta['value']}\n";
|
3413 |
} else{
|
3414 |
$value = $meta['value'];
|
@@ -3426,7 +3517,7 @@ class GmediaCore{
|
|
3426 |
* @param int $pad
|
3427 |
*/
|
3428 |
function meta_value_array_show(&$metatext, $value, $pad = 0){
|
3429 |
-
if((bool)count(array_filter(array_keys($value), 'is_string'))){
|
3430 |
$pad ++;
|
3431 |
foreach($value as $val){
|
3432 |
$metatext .= "\n" . str_pad(' ', $pad) . "- <b>{$val['name']}:</b> ";
|
@@ -3484,7 +3575,7 @@ class GmediaCore{
|
|
3484 |
* @param $gmID
|
3485 |
* @param $meta
|
3486 |
*
|
3487 |
-
* @return
|
3488 |
*/
|
3489 |
function gm_hitcounter($gmID, $meta){
|
3490 |
/** @var wpdb $wpdb */
|
@@ -3492,7 +3583,7 @@ class GmediaCore{
|
|
3492 |
|
3493 |
$like = $this->_post('vote');
|
3494 |
$like = $this->_post('like', $like);
|
3495 |
-
if((int)$like == 1){
|
3496 |
$meta['likes'] += 1;
|
3497 |
$gmDB->update_metadata('gmedia', $gmID, 'likes', $meta['likes']);
|
3498 |
do_action('gmedia_like', $gmID);
|
@@ -3517,11 +3608,11 @@ class GmediaCore{
|
|
3517 |
function replace_array_keys(&$array, $keymap){
|
3518 |
$replaced_keys = array();
|
3519 |
$skipped = $keymap;
|
3520 |
-
do{
|
3521 |
$keymap = $skipped;
|
3522 |
foreach($keymap as $new_key => $original_key){
|
3523 |
if(isset($array[ $original_key ])){
|
3524 |
-
if(!isset($array[ $new_key ]) || (isset($replaced_keys[ $new_key ]) && !isset($replaced_keys[ $original_key ]))){
|
3525 |
$array[ $new_key ] = $array[ $original_key ];
|
3526 |
unset($array[ $original_key ]);
|
3527 |
$replaced_keys[ $original_key ] = $new_key;
|
@@ -3542,7 +3633,7 @@ class GmediaCore{
|
|
3542 |
unset($skipped[ $new_key ]);
|
3543 |
}
|
3544 |
}
|
3545 |
-
} while(!empty($skipped));
|
3546 |
|
3547 |
return $replaced_keys;
|
3548 |
}
|
@@ -3551,22 +3642,23 @@ class GmediaCore{
|
|
3551 |
* @return array Gmedia Capabilities
|
3552 |
*/
|
3553 |
function plugin_capabilities(){
|
3554 |
-
return array(
|
3555 |
-
|
3556 |
-
|
3557 |
-
|
3558 |
-
|
3559 |
-
|
3560 |
-
|
3561 |
-
|
3562 |
-
|
3563 |
-
|
3564 |
-
|
3565 |
-
|
3566 |
-
|
3567 |
-
|
3568 |
-
|
3569 |
-
|
|
|
3570 |
);
|
3571 |
}
|
3572 |
|
@@ -3575,48 +3667,48 @@ class GmediaCore{
|
|
3575 |
*/
|
3576 |
function modules_order(){
|
3577 |
return array(
|
3578 |
-
|
3579 |
-
|
3580 |
-
|
3581 |
-
|
3582 |
-
|
3583 |
-
|
3584 |
-
|
3585 |
-
|
3586 |
-
|
3587 |
-
|
3588 |
-
|
3589 |
-
|
3590 |
-
|
3591 |
-
|
3592 |
-
|
3593 |
-
|
3594 |
-
|
3595 |
-
|
3596 |
-
|
3597 |
-
|
3598 |
-
|
3599 |
-
|
3600 |
-
|
3601 |
-
|
3602 |
-
|
3603 |
-
|
3604 |
);
|
3605 |
}
|
3606 |
|
3607 |
/**
|
3608 |
* @param int|string $module
|
3609 |
-
* @param string
|
3610 |
*
|
3611 |
* @return array [module, settings]
|
3612 |
*/
|
3613 |
function getModulePreset($module = '', $set_module_callback = ''){
|
3614 |
global $gmDB, $gmGallery;
|
3615 |
|
3616 |
-
if(!$set_module_callback){
|
3617 |
$set_module_callback = 'phantom';
|
3618 |
}
|
3619 |
-
if(!$module){
|
3620 |
return $this->getModulePreset($gmGallery->options['default_gmedia_module'], $set_module_callback);
|
3621 |
}
|
3622 |
|
@@ -3624,8 +3716,8 @@ class GmediaCore{
|
|
3624 |
$preset = $gmDB->get_term($module);
|
3625 |
if($preset && !is_wp_error($preset)){
|
3626 |
$module = $preset->status;
|
3627 |
-
$module_settings = array($module => (array)maybe_unserialize($preset->description));
|
3628 |
-
$name
|
3629 |
} else{
|
3630 |
return $this->getModulePreset($set_module_callback);
|
3631 |
}
|
@@ -3633,11 +3725,11 @@ class GmediaCore{
|
|
3633 |
$preset = $gmDB->get_term('[' . $module . ']', array('taxonomy' => 'gmedia_module', 'global' => '0'));
|
3634 |
if($preset && !is_wp_error($preset)){
|
3635 |
$module = $preset->status;
|
3636 |
-
$module_settings = array($module => (array)maybe_unserialize($preset->description));
|
3637 |
-
$name
|
3638 |
} else{
|
3639 |
$module_settings = array($module => array());
|
3640 |
-
$name
|
3641 |
}
|
3642 |
}
|
3643 |
|
@@ -3683,10 +3775,12 @@ class GmediaCore{
|
|
3683 |
* @param $terms
|
3684 |
* @param $gmedia_id
|
3685 |
* @param $taxonomy
|
|
|
|
|
3686 |
*/
|
3687 |
function get_the_gmedia_terms($terms, $gmedia_id, $taxonomy){
|
3688 |
if('gmedia_album' === $taxonomy){
|
3689 |
-
if(!is_user_logged_in()){
|
3690 |
foreach($terms as $key => $term){
|
3691 |
if('publish' !== $term->status){
|
3692 |
unset($terms[ $key ]);
|
@@ -3696,7 +3790,7 @@ class GmediaCore{
|
|
3696 |
global $user_ID;
|
3697 |
foreach($terms as $key => $term){
|
3698 |
if('draft' === $term->status){
|
3699 |
-
if(!is_admin() || ($user_ID != $term->global && !gm_user_can('edit_others_media'))){
|
3700 |
unset($terms[ $key ]);
|
3701 |
}
|
3702 |
} elseif('private' === $term->status){
|
@@ -3757,7 +3851,7 @@ class GmediaCore{
|
|
3757 |
public function punyencode($url){
|
3758 |
$url_host = parse_url($url, PHP_URL_HOST);
|
3759 |
|
3760 |
-
if((boolean)preg_match('/[\x80-\xFF]/', $url_host)){
|
3761 |
$host = $this->mb_convert_encoding_utf8($url_host);
|
3762 |
if(function_exists('idn_to_ascii')){
|
3763 |
$options = 0;
|
@@ -3831,6 +3925,89 @@ class GmediaCore{
|
|
3831 |
return new gmColor($hex);
|
3832 |
}
|
3833 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3834 |
}
|
3835 |
|
3836 |
global $gmCore;
|
6 |
/**
|
7 |
* Main PHP class for the WordPress plugin GRAND Media
|
8 |
*/
|
9 |
+
class GmediaCore {
|
10 |
|
11 |
var $upload;
|
12 |
var $gmedia_url;
|
17 |
*
|
18 |
*/
|
19 |
function __construct(){
|
20 |
+
global $gmGallery;
|
21 |
+
|
22 |
$this->upload = $this->gm_upload_dir();
|
23 |
$this->gmedia_url = plugins_url(GMEDIA_FOLDER);
|
24 |
|
25 |
add_action('init', array(&$this, 'user_capabilities'), 8);
|
26 |
+
add_action('init', array(&$this, 'init_actions'), 20);
|
27 |
|
28 |
add_action('clean_gmedia_cache', array(&$this, 'clear_cache'));
|
29 |
// add_action( 'deleted_gmedia_term_relationships', array( &$this, 'clear_cache' ) );
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
function init_actions(){
|
64 |
+
global $gmGallery;
|
65 |
+
if( !empty($gmGallery->options['license_key']) && empty($gmGallery->options['disable_logs'])){
|
66 |
+
add_action('gmedia_view', array(&$this, 'log_views_handler'));
|
67 |
+
add_action('gmedia_like', array(&$this, 'log_likes_handler'));
|
68 |
+
add_action('gmedia_rate', array(&$this, 'log_rates_handler'), 10, 2);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
/**
|
73 |
* Check GET data
|
74 |
*
|
75 |
* @param string $var
|
76 |
+
* @param mixed $def
|
77 |
+
* @param bool $empty2false
|
78 |
*
|
79 |
* @return mixed
|
80 |
*/
|
90 |
* @return bool
|
91 |
*/
|
92 |
function is_empty($var){
|
93 |
+
return !( !empty($var) && !in_array(strtolower($var), array('null', 'false')));
|
94 |
}
|
95 |
|
96 |
/**
|
97 |
* Check POST data
|
98 |
*
|
99 |
+
* @param string $var
|
100 |
* @param bool|mixed $def
|
101 |
*
|
102 |
* @return mixed
|
110 |
* Check REQUEST data
|
111 |
*
|
112 |
* @param string $var
|
113 |
+
* @param mixed $def
|
114 |
*
|
115 |
* @return mixed
|
116 |
*/
|
122 |
* tooltip()
|
123 |
*
|
124 |
* @param string $style 'tooltip', 'popover'
|
125 |
+
* @param array $params
|
126 |
+
* @param bool $print
|
127 |
*
|
128 |
* @return string
|
129 |
*/
|
149 |
/**
|
150 |
* @param array $add_args
|
151 |
* @param array $remove_args
|
152 |
+
* @param bool $uri
|
153 |
* @param array $preserve_args
|
154 |
*
|
155 |
* @return string
|
158 |
if(true === $uri){
|
159 |
$uri = admin_url('admin.php');
|
160 |
}
|
161 |
+
$remove_args = empty($remove_args)? array() : (array) $remove_args;
|
162 |
+
$_wpnonce = array();
|
163 |
+
foreach($_GET as $key => $value){
|
164 |
+
if(strpos($key, '_wpnonce') !== false){
|
165 |
+
$_wpnonce[ $key ] = $value;
|
166 |
}
|
167 |
}
|
168 |
$remove_args = array_unique(array_merge(array('doing_wp_cron', '_wpnonce', 'do_gmedia', 'did_gmedia', 'do_gmedia_terms', 'did_gmedia_terms', 'ids'), $_wpnonce, $remove_args, array_keys($add_args)));
|
169 |
$new_uri = remove_query_arg($remove_args, $uri);
|
170 |
+
if( !empty($preserve_args)){
|
171 |
$_add_args = array();
|
172 |
foreach($preserve_args as $key){
|
173 |
if(($value = $this->_get($key)) !== false){
|
176 |
}
|
177 |
$new_uri = add_query_arg($_add_args, $new_uri);
|
178 |
}
|
179 |
+
if( !empty($add_args)){
|
180 |
$new_uri = add_query_arg($add_args, $new_uri);
|
181 |
}
|
182 |
|
239 |
|
240 |
if($create){
|
241 |
// Make sure we have an uploads dir
|
242 |
+
if( !wp_mkdir_p($uploads['path'])){
|
243 |
$message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), $uploads['path']);
|
244 |
$uploads['error'] = $message;
|
245 |
}
|
246 |
+
} elseif( !is_dir($uploads['path'])){
|
247 |
$uploads['error'] = true;
|
248 |
}
|
249 |
|
261 |
return @unlink($path);
|
262 |
} elseif(is_dir($path)){
|
263 |
$files = glob($path . '/*', GLOB_NOSORT);
|
264 |
+
if( !empty($files) && is_array($files)){
|
265 |
array_map(array($this, 'delete_folder'), $files);
|
266 |
}
|
267 |
|
277 |
* @see wp_get_attachment_image()
|
278 |
* @uses apply_filters() Calls 'gm_get_attachment_image_attributes' hook on attributes array
|
279 |
*
|
280 |
+
* @param int|object $item Image object.
|
281 |
+
* @param string $size Optional, default is empty string, could be 'thumb', 'web', 'original'
|
282 |
+
* @param bool $cover Optional, try to get cover url
|
283 |
* @param bool|string $default Optional, return if no cover and if $size != 'all'
|
284 |
*
|
285 |
* @return string|array img url for chosen size
|
287 |
function gm_get_media_image($item, $size = '', $cover = true, $default = false){
|
288 |
global $gmDB, $gmGallery;
|
289 |
|
290 |
+
if( !is_object($item)){
|
291 |
$item = $gmDB->get_gmedia($item);
|
292 |
}
|
293 |
+
if( !$size){
|
294 |
$size = 'web';
|
295 |
}
|
296 |
if(empty($item)){
|
297 |
$image = $default? $default : $this->gmedia_url . '/admin/assets/img/default.png';
|
298 |
+
$images = apply_filters('gm_get_media_image', array(
|
299 |
+
'thumb' => $image,
|
300 |
+
'web' => $image,
|
301 |
+
'original' => $image
|
302 |
));
|
303 |
if('all' == $size){
|
304 |
return $images;
|
306 |
return $images[ $size ];
|
307 |
}
|
308 |
}
|
309 |
+
$type = explode('/', $item->mime_type);
|
310 |
$img_cover = false;
|
311 |
if('image' == $type[0]){
|
312 |
+
$images = array(
|
313 |
+
'thumb' => "{$this->upload['url']}/{$gmGallery->options['folder']['image_thumb']}/{$item->gmuid}",
|
314 |
+
'web' => "{$this->upload['url']}/{$gmGallery->options['folder']['image']}/{$item->gmuid}",
|
315 |
+
'original' => "{$this->upload['url']}/{$gmGallery->options['folder']['image_original']}/{$item->gmuid}"
|
316 |
);
|
317 |
if('original' !== $size){
|
318 |
$thumb_path = "{$this->upload['path']}/{$gmGallery->options['folder']['image_thumb']}/{$item->gmuid}";
|
322 |
}
|
323 |
if('all' == $size || 'original' == $size){
|
324 |
$original_path = "{$this->upload['path']}/{$gmGallery->options['folder']['image_original']}/{$item->gmuid}";
|
325 |
+
if( !is_file($original_path)){
|
326 |
$images['original'] = $images['web'];
|
327 |
}
|
328 |
}
|
329 |
}
|
330 |
if('image' != $type[0] || $img_cover){
|
331 |
$ext = ltrim(strrchr($item->gmuid, '.'), '.');
|
332 |
+
if( !$type = wp_ext2type($ext)){
|
333 |
$type = 'application';
|
334 |
}
|
335 |
$image = "{$this->gmedia_url}/admin/assets/img/{$type}.png";
|
336 |
+
$images = array(
|
337 |
+
'thumb' => $image,
|
338 |
+
'web' => $image,
|
339 |
+
'original' => $image,
|
340 |
+
'icon' => false
|
341 |
);
|
342 |
|
343 |
if($cover){
|
344 |
$cover = $gmDB->get_metadata('gmedia', $item->ID, '_cover', true);
|
345 |
+
if( !empty($cover)){
|
346 |
if($this->is_digit($cover)){
|
347 |
+
$images = $this->gm_get_media_image((int) $cover, 'all', false);
|
348 |
$images['icon'] = $image;
|
349 |
}
|
350 |
} elseif($default !== false){
|
351 |
return $default;
|
352 |
+
} else{
|
353 |
$alb = $gmDB->get_gmedia_terms(array($item->ID), array('gmedia_album'), array('fields' => 'ids'));
|
354 |
+
if( !empty($alb)){
|
355 |
$cover = $gmDB->get_metadata('gmedia_term', $alb[0], '_cover', true);
|
356 |
+
if( !empty($cover)){
|
357 |
if($this->is_digit($cover)){
|
358 |
+
$images = $this->gm_get_media_image((int) $cover, 'all', false);
|
359 |
$images['icon'] = $image;
|
360 |
}
|
361 |
}
|
383 |
if(empty($module_name)){
|
384 |
return false;
|
385 |
}
|
386 |
+
$module_dirs = array(
|
387 |
+
'upload' => array(
|
388 |
+
'name' => $module_name,
|
389 |
+
'path' => $this->upload['path'] . '/' . $gmGallery->options['folder']['module'] . '/' . $module_name,
|
390 |
+
'url' => $this->upload['url'] . '/' . $gmGallery->options['folder']['module'] . '/' . $module_name
|
391 |
+
),
|
392 |
+
'plugin' => array(
|
393 |
+
'name' => $module_name,
|
394 |
+
'path' => GMEDIA_ABSPATH . 'module/' . $module_name,
|
395 |
+
'url' => plugins_url(GMEDIA_FOLDER) . '/module/' . $module_name
|
396 |
+
),
|
397 |
+
'theme' => array(
|
398 |
+
'name' => $module_name,
|
399 |
+
'path' => get_template_directory() . '/gmedia-module/' . $module_name,
|
400 |
+
'url' => get_template_directory_uri() . '/gmedia-module/' . $module_name
|
401 |
+
)
|
402 |
);
|
403 |
foreach($module_dirs as $dir){
|
404 |
if(is_dir($dir['path'])){
|
418 |
/** Automatic choose upload directory based on media type
|
419 |
*
|
420 |
* @param string $file
|
421 |
+
* @param int $exists
|
422 |
*
|
423 |
* @return array|bool
|
424 |
*/
|
439 |
$allowed_ext = array_keys($allowed_ext);
|
440 |
$allowed_ext = implode('|', $allowed_ext);
|
441 |
$allowed_ext = explode('|', $allowed_ext);
|
442 |
+
if( !in_array($fileinfo['extension'], $allowed_ext)){
|
443 |
return false;
|
444 |
}
|
445 |
|
447 |
$fileinfo['filename'] = $pathinfo['filename'] . $suffix;
|
448 |
$fileinfo['basename'] = $fileinfo['filename'] . '.' . $fileinfo['extension'];
|
449 |
$fileinfo['title'] = str_replace('_', ' ', esc_sql($title));
|
450 |
+
if((int) $gmGallery->options['name2title_capitalize']){
|
451 |
$fileinfo['title'] = $this->mb_ucwords_utf8($fileinfo['title']);
|
452 |
}
|
453 |
$fileinfo['mime_type'] = (empty($filetype['type']))? 'application/' . $fileinfo['extension'] : $filetype['type'];
|
566 |
*/
|
567 |
function clean_input($input){
|
568 |
$search = array(/*'@<[\/\!]*?[^<>]*?>@si'*/ /* Strip out HTML tags */
|
569 |
+
'@<script' . '[^>]*?>.*?</script>@si' /* Strip out javascript */,
|
570 |
+
'@<style' . '[^>]*?>.*?</style>@siU' /* Strip style tags properly */,
|
571 |
+
'@<![\s\S]*?--[ \t\n\r]*>@' /* Strip multi-line comments */
|
572 |
+
//,'/\s{3,}/'
|
573 |
);
|
574 |
|
575 |
$output = preg_replace($search, '', $input);
|
626 |
*/
|
627 |
function get_editable_user_ids(){
|
628 |
if(current_user_can('gmedia_show_others_media') || current_user_can('gmedia_edit_others_media')){
|
629 |
+
return get_users(array('fields' => 'ID'));
|
630 |
}
|
631 |
|
632 |
return get_current_user_id();
|
645 |
$options = get_option('gmediaOptions');
|
646 |
$endpoint = $options['endpoint'];
|
647 |
$hashid = gmedia_hash_id_encode($id, $type);
|
648 |
+
$t = array(
|
649 |
+
'gallery' => 'g',
|
650 |
+
'album' => 'a',
|
651 |
+
'tag' => 't',
|
652 |
+
'single' => 's',
|
653 |
+
'category' => 'k',
|
654 |
+
'author' => 'u'
|
655 |
);
|
656 |
+
if( !$default && get_option('permalink_structure')){
|
657 |
$cloud_link = home_url(urlencode($endpoint) . "/{$t[$type]}/{$hashid}");
|
658 |
} else{
|
659 |
$cloud_link = add_query_arg(array("$endpoint" => $hashid, 't' => $t[ $type ]), home_url('index.php'));
|
673 |
function filesize($file, $decimals = 2){
|
674 |
$bytes = filesize($file);
|
675 |
$sz = array('b', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb');
|
676 |
+
$factor = (int) floor((strlen($bytes) - 1) / 3);
|
677 |
|
678 |
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . $sz[ $factor ];
|
679 |
}
|
695 |
if(is_array($arr1[ $k ]) && is_array($arr2[ $k ])){
|
696 |
$d = $this->array_diff_key_recursive($arr1[ $k ], $arr2[ $k ]);
|
697 |
|
698 |
+
if( !empty($d)){
|
699 |
$diff[ $k ] = $d;
|
700 |
}
|
701 |
}
|
707 |
/**
|
708 |
* @param array $arr1
|
709 |
* @param array $arr2
|
710 |
+
* @param bool $update
|
711 |
*
|
712 |
* @return array
|
713 |
*/
|
719 |
if(is_array($arr1[ $k ]) && is_array($arr2[ $k ])){
|
720 |
$d = $this->array_diff_keyval_recursive($arr1[ $k ], $arr2[ $k ], $update);
|
721 |
|
722 |
+
if( !empty($d)){
|
723 |
$diff[ $k ] = $d;
|
724 |
}
|
725 |
} elseif($arr1[ $k ] !== $arr2[ $k ]){
|
749 |
$bref_stack = array(&$base);
|
750 |
$head_stack = array($replacements);
|
751 |
|
752 |
+
do {
|
753 |
end($bref_stack);
|
754 |
|
755 |
$bref = &$bref_stack[ key($bref_stack) ];
|
827 |
// Use strict mode to prevent characters from outside the base64 range
|
828 |
$image = base64_decode($data, true);
|
829 |
|
830 |
+
if( !$image){
|
831 |
return false;
|
832 |
}
|
833 |
|
834 |
+
return array(
|
835 |
+
'data' => $image,
|
836 |
+
'type' => $type
|
837 |
);
|
838 |
}
|
839 |
|
845 |
return false;
|
846 |
}
|
847 |
|
848 |
+
$spiders = array(
|
849 |
+
"abot",
|
850 |
+
"dbot",
|
851 |
+
"ebot",
|
852 |
+
"hbot",
|
853 |
+
"kbot",
|
854 |
+
"lbot",
|
855 |
+
"mbot",
|
856 |
+
"nbot",
|
857 |
+
"obot",
|
858 |
+
"pbot",
|
859 |
+
"rbot",
|
860 |
+
"sbot",
|
861 |
+
"tbot",
|
862 |
+
"vbot",
|
863 |
+
"ybot",
|
864 |
+
"zbot",
|
865 |
+
"bot.",
|
866 |
+
"bot/",
|
867 |
+
"_bot",
|
868 |
+
".bot",
|
869 |
+
"/bot",
|
870 |
+
"-bot",
|
871 |
+
":bot",
|
872 |
+
"(bot",
|
873 |
+
"crawl",
|
874 |
+
"slurp",
|
875 |
+
"spider",
|
876 |
+
"seek",
|
877 |
+
"accoona",
|
878 |
+
"acoon",
|
879 |
+
"adressendeutschland",
|
880 |
+
"ah-ha.com",
|
881 |
+
"ahoy",
|
882 |
+
"altavista",
|
883 |
+
"ananzi",
|
884 |
+
"anthill",
|
885 |
+
"appie",
|
886 |
+
"arachnophilia",
|
887 |
+
"arale",
|
888 |
+
"araneo",
|
889 |
+
"aranha",
|
890 |
+
"architext",
|
891 |
+
"aretha",
|
892 |
+
"arks",
|
893 |
+
"asterias",
|
894 |
+
"atlocal",
|
895 |
+
"atn",
|
896 |
+
"atomz",
|
897 |
+
"augurfind",
|
898 |
+
"backrub",
|
899 |
+
"bannana_bot",
|
900 |
+
"baypup",
|
901 |
+
"bdfetch",
|
902 |
+
"big brother",
|
903 |
+
"biglotron",
|
904 |
+
"bjaaland",
|
905 |
+
"blackwidow",
|
906 |
+
"blaiz",
|
907 |
+
"blog",
|
908 |
+
"blo.",
|
909 |
+
"bloodhound",
|
910 |
+
"boitho",
|
911 |
+
"booch",
|
912 |
+
"bradley",
|
913 |
+
"butterfly",
|
914 |
+
"calif",
|
915 |
+
"cassandra",
|
916 |
+
"ccubee",
|
917 |
+
"cfetch",
|
918 |
+
"charlotte",
|
919 |
+
"churl",
|
920 |
+
"cienciaficcion",
|
921 |
+
"cmc",
|
922 |
+
"collective",
|
923 |
+
"comagent",
|
924 |
+
"combine",
|
925 |
+
"computingsite",
|
926 |
+
"csci",
|
927 |
+
"curl",
|
928 |
+
"cusco",
|
929 |
+
"daumoa",
|
930 |
+
"deepindex",
|
931 |
+
"delorie",
|
932 |
+
"depspid",
|
933 |
+
"deweb",
|
934 |
+
"die blinde kuh",
|
935 |
+
"digger",
|
936 |
+
"ditto",
|
937 |
+
"dmoz",
|
938 |
+
"docomo",
|
939 |
+
"download express",
|
940 |
+
"dtaagent",
|
941 |
+
"dwcp",
|
942 |
+
"ebiness",
|
943 |
+
"ebingbong",
|
944 |
+
"e-collector",
|
945 |
+
"ejupiter",
|
946 |
+
"emacs-w3 search engine",
|
947 |
+
"esther",
|
948 |
+
"evliya celebi",
|
949 |
+
"ezresult",
|
950 |
+
"falcon",
|
951 |
+
"felix ide",
|
952 |
+
"ferret",
|
953 |
+
"fetchrover",
|
954 |
+
"fido",
|
955 |
+
"findlinks",
|
956 |
+
"fireball",
|
957 |
+
"fish search",
|
958 |
+
"fouineur",
|
959 |
+
"funnelweb",
|
960 |
+
"gazz",
|
961 |
+
"gcreep",
|
962 |
+
"genieknows",
|
963 |
+
"getterroboplus",
|
964 |
+
"geturl",
|
965 |
+
"glx",
|
966 |
+
"goforit",
|
967 |
+
"golem",
|
968 |
+
"grabber",
|
969 |
+
"grapnel",
|
970 |
+
"gralon",
|
971 |
+
"griffon",
|
972 |
+
"gromit",
|
973 |
+
"grub",
|
974 |
+
"gulliver",
|
975 |
+
"hamahakki",
|
976 |
+
"harvest",
|
977 |
+
"havindex",
|
978 |
+
"helix",
|
979 |
+
"heritrix",
|
980 |
+
"hku www octopus",
|
981 |
+
"homerweb",
|
982 |
+
"htdig",
|
983 |
+
"html index",
|
984 |
+
"html_analyzer",
|
985 |
+
"htmlgobble",
|
986 |
+
"hubater",
|
987 |
+
"hyper-decontextualizer",
|
988 |
+
"ia_archiver",
|
989 |
+
"ibm_planetwide",
|
990 |
+
"ichiro",
|
991 |
+
"iconsurf",
|
992 |
+
"iltrovatore",
|
993 |
+
"image.kapsi.net",
|
994 |
+
"imagelock",
|
995 |
+
"incywincy",
|
996 |
+
"indexer",
|
997 |
+
"infobee",
|
998 |
+
"informant",
|
999 |
+
"ingrid",
|
1000 |
+
"inktomisearch.com",
|
1001 |
+
"inspector web",
|
1002 |
+
"intelliagent",
|
1003 |
+
"internet shinchakubin",
|
1004 |
+
"ip3000",
|
1005 |
+
"iron33",
|
1006 |
+
"israeli-search",
|
1007 |
+
"ivia",
|
1008 |
+
"jack",
|
1009 |
+
"jakarta",
|
1010 |
+
"javabee",
|
1011 |
+
"jetbot",
|
1012 |
+
"jumpstation",
|
1013 |
+
"katipo",
|
1014 |
+
"kdd-explorer",
|
1015 |
+
"kilroy",
|
1016 |
+
"knowledge",
|
1017 |
+
"kototoi",
|
1018 |
+
"kretrieve",
|
1019 |
+
"labelgrabber",
|
1020 |
+
"lachesis",
|
1021 |
+
"larbin",
|
1022 |
+
"legs",
|
1023 |
+
"libwww",
|
1024 |
+
"linkalarm",
|
1025 |
+
"link validator",
|
1026 |
+
"linkscan",
|
1027 |
+
"lockon",
|
1028 |
+
"lwp",
|
1029 |
+
"lycos",
|
1030 |
+
"magpie",
|
1031 |
+
"mantraagent",
|
1032 |
+
"mapoftheinternet",
|
1033 |
+
"marvin/",
|
1034 |
+
"mattie",
|
1035 |
+
"mediafox",
|
1036 |
+
"mediapartners",
|
1037 |
+
"mercator",
|
1038 |
+
"merzscope",
|
1039 |
+
"microsoft url control",
|
1040 |
+
"minirank",
|
1041 |
+
"miva",
|
1042 |
+
"mj12",
|
1043 |
+
"mnogosearch",
|
1044 |
+
"moget",
|
1045 |
+
"monster",
|
1046 |
+
"moose",
|
1047 |
+
"motor",
|
1048 |
+
"multitext",
|
1049 |
+
"muncher",
|
1050 |
+
"muscatferret",
|
1051 |
+
"mwd.search",
|
1052 |
+
"myweb",
|
1053 |
+
"najdi",
|
1054 |
+
"nameprotect",
|
1055 |
+
"nationaldirectory",
|
1056 |
+
"nazilla",
|
1057 |
+
"ncsa beta",
|
1058 |
+
"nec-meshexplorer",
|
1059 |
+
"nederland.zoek",
|
1060 |
+
"netcarta webmap engine",
|
1061 |
+
"netmechanic",
|
1062 |
+
"netresearchserver",
|
1063 |
+
"netscoop",
|
1064 |
+
"newscan-online",
|
1065 |
+
"nhse",
|
1066 |
+
"nokia6682/",
|
1067 |
+
"nomad",
|
1068 |
+
"noyona",
|
1069 |
+
"nutch",
|
1070 |
+
"nzexplorer",
|
1071 |
+
"objectssearch",
|
1072 |
+
"occam",
|
1073 |
+
"omni",
|
1074 |
+
"open text",
|
1075 |
+
"openfind",
|
1076 |
+
"openintelligencedata",
|
1077 |
+
"orb search",
|
1078 |
+
"osis-project",
|
1079 |
+
"pack rat",
|
1080 |
+
"pageboy",
|
1081 |
+
"pagebull",
|
1082 |
+
"page_verifier",
|
1083 |
+
"panscient",
|
1084 |
+
"parasite",
|
1085 |
+
"partnersite",
|
1086 |
+
"patric",
|
1087 |
+
"pear.",
|
1088 |
+
"pegasus",
|
1089 |
+
"peregrinator",
|
1090 |
+
"pgp key agent",
|
1091 |
+
"phantom",
|
1092 |
+
"phpdig",
|
1093 |
+
"picosearch",
|
1094 |
+
"piltdownman",
|
1095 |
+
"pimptrain",
|
1096 |
+
"pinpoint",
|
1097 |
+
"pioneer",
|
1098 |
+
"piranha",
|
1099 |
+
"plumtreewebaccessor",
|
1100 |
+
"pogodak",
|
1101 |
+
"poirot",
|
1102 |
+
"pompos",
|
1103 |
+
"poppelsdorf",
|
1104 |
+
"poppi",
|
1105 |
+
"popular iconoclast",
|
1106 |
+
"psycheclone",
|
1107 |
+
"publisher",
|
1108 |
+
"python",
|
1109 |
+
"rambler",
|
1110 |
+
"raven search",
|
1111 |
+
"roach",
|
1112 |
+
"road runner",
|
1113 |
+
"roadhouse",
|
1114 |
+
"robbie",
|
1115 |
+
"robofox",
|
1116 |
+
"robozilla",
|
1117 |
+
"rules",
|
1118 |
+
"salty",
|
1119 |
+
"sbider",
|
1120 |
+
"scooter",
|
1121 |
+
"scoutjet",
|
1122 |
+
"scrubby",
|
1123 |
+
"search.",
|
1124 |
+
"searchprocess",
|
1125 |
+
"semanticdiscovery",
|
1126 |
+
"senrigan",
|
1127 |
+
"sg-scout",
|
1128 |
+
"shai'hulud",
|
1129 |
+
"shark",
|
1130 |
+
"shopwiki",
|
1131 |
+
"sidewinder",
|
1132 |
+
"sift",
|
1133 |
+
"silk",
|
1134 |
+
"simmany",
|
1135 |
+
"site searcher",
|
1136 |
+
"site valet",
|
1137 |
+
"sitetech-rover",
|
1138 |
+
"skymob.com",
|
1139 |
+
"sleek",
|
1140 |
+
"smartwit",
|
1141 |
+
"sna-",
|
1142 |
+
"snappy",
|
1143 |
+
"snooper",
|
1144 |
+
"sohu",
|
1145 |
+
"speedfind",
|
1146 |
+
"sphere",
|
1147 |
+
"sphider",
|
1148 |
+
"spinner",
|
1149 |
+
"spyder",
|
1150 |
+
"steeler/",
|
1151 |
+
"suke",
|
1152 |
+
"suntek",
|
1153 |
+
"supersnooper",
|
1154 |
+
"surfnomore",
|
1155 |
+
"sven",
|
1156 |
+
"sygol",
|
1157 |
+
"szukacz",
|
1158 |
+
"tach black widow",
|
1159 |
+
"tarantula",
|
1160 |
+
"templeton",
|
1161 |
+
"/teoma",
|
1162 |
+
"t-h-u-n-d-e-r-s-t-o-n-e",
|
1163 |
+
"theophrastus",
|
1164 |
+
"titan",
|
1165 |
+
"titin",
|
1166 |
+
"tkwww",
|
1167 |
+
"toutatis",
|
1168 |
+
"t-rex",
|
1169 |
+
"tutorgig",
|
1170 |
+
"twiceler",
|
1171 |
+
"twisted",
|
1172 |
+
"ucsd",
|
1173 |
+
"udmsearch",
|
1174 |
+
"url check",
|
1175 |
+
"updated",
|
1176 |
+
"vagabondo",
|
1177 |
+
"valkyrie",
|
1178 |
+
"verticrawl",
|
1179 |
+
"victoria",
|
1180 |
+
"vision-search",
|
1181 |
+
"volcano",
|
1182 |
+
"voyager/",
|
1183 |
+
"voyager-hc",
|
1184 |
+
"w3c_validator",
|
1185 |
+
"w3m2",
|
1186 |
+
"w3mir",
|
1187 |
+
"walker",
|
1188 |
+
"wallpaper",
|
1189 |
+
"wanderer",
|
1190 |
+
"wauuu",
|
1191 |
+
"wavefire",
|
1192 |
+
"web core",
|
1193 |
+
"web hopper",
|
1194 |
+
"web wombat",
|
1195 |
+
"webbandit",
|
1196 |
+
"webcatcher",
|
1197 |
+
"webcopy",
|
1198 |
+
"webfoot",
|
1199 |
+
"weblayers",
|
1200 |
+
"weblinker",
|
1201 |
+
"weblog monitor",
|
1202 |
+
"webmirror",
|
1203 |
+
"webmonkey",
|
1204 |
+
"webquest",
|
1205 |
+
"webreaper",
|
1206 |
+
"websitepulse",
|
1207 |
+
"websnarf",
|
1208 |
+
"webstolperer",
|
1209 |
+
"webvac",
|
1210 |
+
"webwalk",
|
1211 |
+
"webwatch",
|
1212 |
+
"webwombat",
|
1213 |
+
"webzinger",
|
1214 |
+
"wget",
|
1215 |
+
"whizbang",
|
1216 |
+
"whowhere",
|
1217 |
+
"wild ferret",
|
1218 |
+
"worldlight",
|
1219 |
+
"wwwc",
|
1220 |
+
"wwwster",
|
1221 |
+
"xenu",
|
1222 |
+
"xget",
|
1223 |
+
"xift",
|
1224 |
+
"xirq",
|
1225 |
+
"yandex",
|
1226 |
+
"yanga",
|
1227 |
+
"yeti",
|
1228 |
+
"yodao",
|
1229 |
+
"zao/",
|
1230 |
+
"zippp",
|
1231 |
+
"zyborg",
|
1232 |
+
"...."
|
1233 |
);
|
1234 |
|
1235 |
foreach($spiders as $spider){
|
1249 |
* @since 3.6.0
|
1250 |
*
|
1251 |
* @param array $metadata An existing array with data
|
1252 |
+
* @param array $data Data supplied by ID3 tags
|
1253 |
*/
|
1254 |
function wp_add_id3_tag_data(&$metadata, $data){
|
1255 |
foreach(array('id3v2', 'id3v1') as $version){
|
1256 |
+
if( !empty($data[ $version ]['comments'])){
|
1257 |
foreach($data[ $version ]['comments'] as $key => $list){
|
1258 |
+
if( !empty($list)){
|
1259 |
$metadata[ $key ] = reset($list);
|
1260 |
// fix bug in byte stream analysis
|
1261 |
if('terms_of_use' === $key && 0 === strpos($metadata[ $key ], 'yright notice.')){
|
1267 |
}
|
1268 |
}
|
1269 |
|
1270 |
+
if( !empty($data['id3v2']['APIC'])){
|
1271 |
$image = reset($data['id3v2']['APIC']);
|
1272 |
+
if( !empty($image['data'])){
|
1273 |
+
$metadata['image'] = array(
|
1274 |
+
'data' => $image['data'],
|
1275 |
+
'mime' => $image['image_mime'],
|
1276 |
+
'width' => $image['image_width'],
|
1277 |
+
'height' => $image['image_height']
|
1278 |
);
|
1279 |
}
|
1280 |
+
} elseif( !empty($data['comments']['picture'])){
|
1281 |
$image = reset($data['comments']['picture']);
|
1282 |
+
if( !empty($image['data'])){
|
1283 |
+
$metadata['image'] = array(
|
1284 |
+
'data' => $image['data'],
|
1285 |
+
'mime' => $image['image_mime']
|
1286 |
);
|
1287 |
}
|
1288 |
}
|
1303 |
* @return bool|array False on failure. Image metadata array on success.
|
1304 |
*/
|
1305 |
function wp_read_image_metadata($file){
|
1306 |
+
if( !is_file($file)){
|
1307 |
return false;
|
1308 |
}
|
1309 |
|
1318 |
if(is_callable('iptcparse')){
|
1319 |
getimagesize($file, $info);
|
1320 |
|
1321 |
+
if( !empty($info['APP13'])){
|
1322 |
$iptc = iptcparse($info['APP13']);
|
1323 |
|
1324 |
// Headline, "A brief synopsis of the caption."
|
1325 |
+
if( !empty($iptc['2#105'][0])){
|
1326 |
$meta['title'] = trim($iptc['2#105'][0]);
|
1327 |
/*
|
1328 |
* Title, "Many use the Title field to store the filename of the image,
|
1329 |
* though the field may be used in many ways."
|
1330 |
*/
|
1331 |
+
} elseif( !empty($iptc['2#005'][0])){
|
1332 |
$meta['title'] = trim($iptc['2#005'][0]);
|
1333 |
}
|
1334 |
|
1335 |
+
if( !empty($iptc['2#120'][0])){ // description / legacy caption
|
1336 |
$caption = trim($iptc['2#120'][0]);
|
1337 |
if(empty($meta['title'])){
|
1338 |
mbstring_binary_safe_encoding();
|
1350 |
}
|
1351 |
}
|
1352 |
|
1353 |
+
if( !empty($iptc['2#110'][0])) // credit
|
1354 |
{
|
1355 |
$meta['credit'] = trim($iptc['2#110'][0]);
|
1356 |
+
} elseif( !empty($iptc['2#080'][0])) // creator / legacy byline
|
1357 |
{
|
1358 |
$meta['credit'] = trim($iptc['2#080'][0]);
|
1359 |
}
|
1360 |
|
1361 |
+
if( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0])) // created date and time
|
1362 |
{
|
1363 |
$meta['created_timestamp'] = strtotime($iptc['2#055'][0] . ' ' . $iptc['2#060'][0]);
|
1364 |
}
|
1365 |
|
1366 |
+
if( !empty($iptc['2#116'][0])) // copyright
|
1367 |
{
|
1368 |
$meta['copyright'] = trim($iptc['2#116'][0]);
|
1369 |
}
|
1370 |
|
1371 |
+
if( !empty($iptc['2#025'])) // keywords
|
1372 |
{
|
1373 |
$meta['keywords'] = $iptc['2#025'];
|
1374 |
}
|
1381 |
*
|
1382 |
* @param array $image_types Image types to check for exif data.
|
1383 |
*/
|
1384 |
+
if(is_callable('exif_read_data') && in_array($sourceImageType, apply_filters('wp_read_image_metadata_types', array(
|
1385 |
+
IMAGETYPE_JPEG,
|
1386 |
+
IMAGETYPE_TIFF_II,
|
1387 |
+
IMAGETYPE_TIFF_MM
|
1388 |
+
)))
|
1389 |
){
|
1390 |
$exif = @exif_read_data($file);
|
1391 |
unset($exif['MakerNote']);
|
1395 |
$meta['title'] = trim($exif['Title']);
|
1396 |
}
|
1397 |
// Descrioption
|
1398 |
+
if( !empty($exif['ImageDescription'])){
|
1399 |
mbstring_binary_safe_encoding();
|
1400 |
$description_length = strlen($exif['ImageDescription']);
|
1401 |
reset_mbstring_encoding();
|
1414 |
}
|
1415 |
// Credit
|
1416 |
if(empty($meta['credit'])){
|
1417 |
+
if( !empty($exif['Artist'])){
|
1418 |
$meta['credit'] = trim($exif['Artist']);
|
1419 |
+
} elseif( !empty($exif['Author'])){
|
1420 |
$meta['credit'] = trim($exif['Author']);
|
1421 |
}
|
1422 |
}
|
1425 |
$meta['copyright'] = trim($exif['Copyright']);
|
1426 |
}
|
1427 |
// Camera Make
|
1428 |
+
if( !empty($exif['Make'])){
|
1429 |
$meta['make'] = $exif['Make'];
|
1430 |
}
|
1431 |
// Camera Model
|
1432 |
+
if( !empty($exif['Model'])){
|
1433 |
$meta['model'] = trim($exif['Model']);
|
1434 |
}
|
1435 |
// Exposure Time (shutter speed)
|
1436 |
+
if( !empty($exif['ExposureTime'])){
|
1437 |
$meta['exposure'] = $exif['ExposureTime'] . 's';
|
1438 |
+
$meta['shutter_speed'] = (string) wp_exif_frac2dec($exif['ExposureTime']) . 's';
|
1439 |
}
|
1440 |
// Aperture
|
1441 |
+
if( !empty($exif['COMPUTED']['ApertureFNumber'])){
|
1442 |
$meta['aperture'] = $exif['COMPUTED']['ApertureFNumber'];
|
1443 |
+
} elseif( !empty($exif['FNumber'])){
|
1444 |
+
$meta['aperture'] = 'f/' . (string) round(wp_exif_frac2dec($exif['FNumber']), 2);
|
1445 |
}
|
1446 |
// ISO
|
1447 |
+
if( !empty($exif['ISOSpeedRatings'])){
|
1448 |
$meta['iso'] = is_array($exif['ISOSpeedRatings'])? reset($exif['ISOSpeedRatings']) : $exif['ISOSpeedRatings'];
|
1449 |
$meta['iso'] = trim($meta['iso']);
|
1450 |
}
|
1451 |
// Date
|
1452 |
+
if( !empty($exif['DateTime'])){
|
1453 |
$meta['date'] = $exif['DateTime'];
|
1454 |
}
|
1455 |
// Created TimeStamp
|
1457 |
$meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized']);
|
1458 |
}
|
1459 |
// Lens
|
1460 |
+
if( !empty($exif['UndefinedTag:0xA434'])){
|
1461 |
$meta['lens'] = $exif['UndefinedTag:0xA434'];
|
1462 |
}
|
1463 |
// Focus Distance
|
1464 |
+
if( !empty($exif['COMPUTED']['FocusDistance'])){
|
1465 |
$meta['distance'] = $exif['COMPUTED']['FocusDistance'];
|
1466 |
}
|
1467 |
// Focal Length
|
1468 |
+
if( !empty($exif['FocalLength'])){
|
1469 |
+
$meta['focallength'] = (string) round(wp_exif_frac2dec($exif['FocalLength'])) . 'mm';
|
1470 |
}
|
1471 |
// Focal Length 35mm
|
1472 |
+
if( !empty($exif['FocalLengthIn35mmFilm'])){
|
1473 |
$meta['focallength35'] = $exif['FocalLengthIn35mmFilm'] . 'mm';
|
1474 |
}
|
1475 |
// Flash data
|
1476 |
+
if( !empty($exif['Flash'])){
|
1477 |
// we need to interpret the result - it's given as a number and we want a human-readable description.
|
1478 |
$fdata = $exif['Flash'];
|
1479 |
|
1480 |
switch($fdata){
|
1481 |
case 0 :
|
1482 |
$fdata = 'No Flash';
|
1483 |
+
break;
|
1484 |
case 1 :
|
1485 |
$fdata = 'Flash';
|
1486 |
+
break;
|
1487 |
case 5 :
|
1488 |
$fdata = 'Flash, strobe return light not detected';
|
1489 |
+
break;
|
1490 |
case 7 :
|
1491 |
$fdata = 'Flash, strob return light detected';
|
1492 |
+
break;
|
1493 |
case 9 :
|
1494 |
$fdata = 'Compulsory Flash';
|
1495 |
+
break;
|
1496 |
case 13:
|
1497 |
$fdata = 'Compulsory Flash, Return light not detected';
|
1498 |
+
break;
|
1499 |
case 15:
|
1500 |
$fdata = 'Compulsory Flash, Return light detected';
|
1501 |
+
break;
|
1502 |
case 16:
|
1503 |
$fdata = 'No Flash';
|
1504 |
+
break;
|
1505 |
case 24:
|
1506 |
$fdata = 'No Flash';
|
1507 |
+
break;
|
1508 |
case 25:
|
1509 |
$fdata = 'Flash, Auto-Mode';
|
1510 |
+
break;
|
1511 |
case 29:
|
1512 |
$fdata = 'Flash, Auto-Mode, Return light not detected';
|
1513 |
+
break;
|
1514 |
case 31:
|
1515 |
$fdata = 'Flash, Auto-Mode, Return light detected';
|
1516 |
+
break;
|
1517 |
case 32:
|
1518 |
$fdata = 'No Flash';
|
1519 |
+
break;
|
1520 |
case 65:
|
1521 |
$fdata = 'Red Eye';
|
1522 |
+
break;
|
1523 |
case 69:
|
1524 |
$fdata = 'Red Eye, Return light not detected';
|
1525 |
+
break;
|
1526 |
case 71:
|
1527 |
$fdata = 'Red Eye, Return light detected';
|
1528 |
+
break;
|
1529 |
case 73:
|
1530 |
$fdata = 'Red Eye, Compulsory Flash';
|
1531 |
+
break;
|
1532 |
case 77:
|
1533 |
$fdata = 'Red Eye, Compulsory Flash, Return light not detected';
|
1534 |
+
break;
|
1535 |
case 79:
|
1536 |
$fdata = 'Red Eye, Compulsory Flash, Return light detected';
|
1537 |
+
break;
|
1538 |
case 89:
|
1539 |
$fdata = 'Red Eye, Auto-Mode';
|
1540 |
+
break;
|
1541 |
case 93:
|
1542 |
$fdata = 'Red Eye, Auto-Mode, Return light not detected';
|
1543 |
+
break;
|
1544 |
case 95:
|
1545 |
$fdata = 'Red Eye, Auto-Mode, Return light detected';
|
1546 |
+
break;
|
1547 |
default:
|
1548 |
$fdata = 'Unknown: ' . $fdata;
|
1549 |
+
break;
|
1550 |
}
|
1551 |
$meta['flashdata'] = $fdata;
|
1552 |
}
|
1553 |
// Lens Make
|
1554 |
+
if( !empty($exif['UndefinedTag:0xA433'])){
|
1555 |
$meta['lensmake'] = $exif['UndefinedTag:0xA433'];
|
1556 |
}
|
1557 |
// Software
|
1558 |
+
if( !empty($exif['Software'])){
|
1559 |
$meta['software'] = $exif['Software'];
|
1560 |
}
|
1561 |
// Orientation
|
1562 |
+
if( !empty($exif['Orientation'])){
|
1563 |
$meta['orientation'] = $exif['Orientation'];
|
1564 |
}
|
1565 |
|
1572 |
}
|
1573 |
|
1574 |
foreach(array('title', 'caption', 'credit', 'copyright', 'model', 'iso', 'software') as $key){
|
1575 |
+
if( !empty($meta[ $key ]) && !seems_utf8($meta[ $key ])){
|
1576 |
$meta[ $key ] = utf8_encode($meta[ $key ]);
|
1577 |
}
|
1578 |
}
|
1579 |
+
if( !empty($meta['keywords'])){
|
1580 |
foreach($meta['keywords'] as $i => $key){
|
1581 |
+
if( !seems_utf8($key)){
|
1582 |
$meta['keywords'][ $i ] = utf8_encode($key);
|
1583 |
}
|
1584 |
}
|
1594 |
* Filter the array of meta data read from an image's exif data.
|
1595 |
* @since 2.5.0
|
1596 |
*
|
1597 |
+
* @param array $meta Image meta data.
|
1598 |
+
* @param string $file Path to image file.
|
1599 |
+
* @param int $sourceImageType Type of image.
|
1600 |
*/
|
1601 |
return apply_filters('wp_read_image_metadata', $meta, $file, $sourceImageType);
|
1602 |
|
1611 |
* @return array|boolean Returns array of metadata, if found.
|
1612 |
*/
|
1613 |
function wp_read_video_metadata($file){
|
1614 |
+
if( !is_file($file)){
|
1615 |
return false;
|
1616 |
}
|
1617 |
|
1618 |
$metadata = array();
|
1619 |
|
1620 |
+
if( !class_exists('getID3')){
|
1621 |
require(ABSPATH . WPINC . '/ID3/getid3.php');
|
1622 |
}
|
1623 |
$id3 = new getID3();
|
1626 |
if(isset($data['video']['lossless'])){
|
1627 |
$metadata['lossless'] = $data['video']['lossless'];
|
1628 |
}
|
1629 |
+
if( !empty($data['video']['bitrate'])){
|
1630 |
+
$metadata['bitrate'] = (int) $data['video']['bitrate'];
|
1631 |
}
|
1632 |
+
if( !empty($data['video']['bitrate_mode'])){
|
1633 |
$metadata['bitrate_mode'] = $data['video']['bitrate_mode'];
|
1634 |
}
|
1635 |
+
if( !empty($data['filesize'])){
|
1636 |
+
$metadata['filesize'] = (int) $data['filesize'];
|
1637 |
}
|
1638 |
+
if( !empty($data['mime_type'])){
|
1639 |
$metadata['mime_type'] = $data['mime_type'];
|
1640 |
}
|
1641 |
+
if( !empty($data['playtime_seconds'])){
|
1642 |
+
$metadata['length'] = (int) ceil($data['playtime_seconds']);
|
1643 |
}
|
1644 |
+
if( !empty($data['playtime_string'])){
|
1645 |
$metadata['length_formatted'] = $data['playtime_string'];
|
1646 |
}
|
1647 |
+
if( !empty($data['video']['resolution_x'])){
|
1648 |
+
$metadata['width'] = (int) $data['video']['resolution_x'];
|
1649 |
}
|
1650 |
+
if( !empty($data['video']['resolution_y'])){
|
1651 |
+
$metadata['height'] = (int) $data['video']['resolution_y'];
|
1652 |
}
|
1653 |
+
if( !empty($data['fileformat'])){
|
1654 |
$metadata['fileformat'] = $data['fileformat'];
|
1655 |
}
|
1656 |
+
if( !empty($data['video']['dataformat'])){
|
1657 |
$metadata['dataformat'] = $data['video']['dataformat'];
|
1658 |
}
|
1659 |
+
if( !empty($data['video']['encoder'])){
|
1660 |
$metadata['encoder'] = $data['video']['encoder'];
|
1661 |
}
|
1662 |
+
if( !empty($data['video']['codec'])){
|
1663 |
$metadata['codec'] = $data['video']['codec'];
|
1664 |
}
|
1665 |
|
1666 |
+
if( !empty($data['audio'])){
|
1667 |
unset($data['audio']['streams']);
|
1668 |
$metadata['audio'] = $data['audio'];
|
1669 |
}
|
1682 |
* @return array|boolean Returns array of metadata, if found.
|
1683 |
*/
|
1684 |
function wp_read_audio_metadata($file){
|
1685 |
+
if( !is_file($file)){
|
1686 |
return false;
|
1687 |
}
|
1688 |
$metadata = array();
|
1689 |
|
1690 |
+
if( !class_exists('getID3')){
|
1691 |
require(ABSPATH . WPINC . '/ID3/getid3.php');
|
1692 |
}
|
1693 |
$id3 = new getID3();
|
1694 |
$data = $id3->analyze($file);
|
1695 |
|
1696 |
+
if( !empty($data['audio'])){
|
1697 |
unset($data['audio']['streams']);
|
1698 |
$metadata = $data['audio'];
|
1699 |
}
|
1700 |
|
1701 |
+
if( !empty($data['fileformat'])){
|
1702 |
$metadata['fileformat'] = $data['fileformat'];
|
1703 |
}
|
1704 |
+
if( !empty($data['filesize'])){
|
1705 |
+
$metadata['filesize'] = (int) $data['filesize'];
|
1706 |
}
|
1707 |
+
if( !empty($data['mime_type'])){
|
1708 |
$metadata['mime_type'] = $data['mime_type'];
|
1709 |
}
|
1710 |
+
if( !empty($data['playtime_seconds'])){
|
1711 |
+
$metadata['length'] = (int) ceil($data['playtime_seconds']);
|
1712 |
}
|
1713 |
+
if( !empty($data['playtime_string'])){
|
1714 |
$metadata['length_formatted'] = $data['playtime_string'];
|
1715 |
}
|
1716 |
|
1728 |
/** Write the file
|
1729 |
*
|
1730 |
* @param string $file_tmp
|
1731 |
+
* @param array $fileinfo
|
1732 |
* @param string $content_type
|
1733 |
+
* @param array $post_data
|
1734 |
*
|
1735 |
* @return array
|
1736 |
*/
|
1739 |
|
1740 |
$cleanup_dir = true; // Remove old files
|
1741 |
$file_age = 5 * 3600; // Temp file age in seconds
|
1742 |
+
$chunk = (int) $this->_req('chunk', 0);
|
1743 |
+
$chunks = (int) $this->_req('chunks', 0);
|
1744 |
|
1745 |
// try to make grand-media dir if not exists
|
1746 |
+
if( !wp_mkdir_p($fileinfo['dirpath'])){
|
1747 |
+
$return = array(
|
1748 |
+
"error" => array(
|
1749 |
+
"code" => 100,
|
1750 |
+
"message" => sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?', 'grand-media'), $fileinfo['dirpath'])
|
1751 |
+
),
|
1752 |
+
"id" => $fileinfo['basename_original']
|
1753 |
);
|
1754 |
|
1755 |
return $return;
|
1756 |
}
|
1757 |
// Check if grand-media dir is writable
|
1758 |
+
if( !is_writable($fileinfo['dirpath'])){
|
1759 |
@chmod($fileinfo['dirpath'], 0755);
|
1760 |
+
if( !is_writable($fileinfo['dirpath'])){
|
1761 |
+
$return = array(
|
1762 |
+
"error" => array(
|
1763 |
+
"code" => 100,
|
1764 |
+
"message" => sprintf(__('Directory %s or its subfolders are not writable by the server.', 'grand-media'), dirname($fileinfo['dirpath']))
|
1765 |
+
),
|
1766 |
+
"id" => $fileinfo['basename_original']
|
1767 |
);
|
1768 |
|
1769 |
return $return;
|
1782 |
|
1783 |
closedir($_dir);
|
1784 |
} else{
|
1785 |
+
$return = array(
|
1786 |
+
"error" => array("code" => 100, "message" => sprintf(__('Failed to open directory: %s', 'grand-media'), $fileinfo['dirpath'])),
|
1787 |
+
"id" => $fileinfo['basename_original']
|
1788 |
);
|
1789 |
|
1790 |
return $return;
|
1810 |
if(strpos($content_type, "multipart") !== false){
|
1811 |
@unlink($file_tmp);
|
1812 |
}
|
1813 |
+
if( !$chunks || $chunk == ($chunks - 1)){
|
1814 |
sleep(1);
|
1815 |
// Strip the temp .part suffix off
|
1816 |
rename($fileinfo['filepath'] . '.part', $fileinfo['filepath']);
|
1830 |
switch($extensions[ $size[2] ]){
|
1831 |
case 'GIF':
|
1832 |
$CHANNEL = 1;
|
1833 |
+
break;
|
1834 |
case 'JPG':
|
1835 |
$CHANNEL = $size['channels'];
|
1836 |
+
break;
|
1837 |
case 'PNG':
|
1838 |
$CHANNEL = 3;
|
1839 |
+
break;
|
1840 |
case 'BMP':
|
1841 |
default:
|
1842 |
$CHANNEL = 6;
|
1843 |
+
break;
|
1844 |
}
|
1845 |
$MB = 1048576; // number of bytes in 1M
|
1846 |
$K64 = 65536; // number of bytes in 64K
|
1865 |
}
|
1866 |
}
|
1867 |
|
1868 |
+
if( !wp_mkdir_p($fileinfo['dirpath_thumb'])){
|
1869 |
+
$return = array(
|
1870 |
+
"error" => array(
|
1871 |
+
"code" => 100,
|
1872 |
+
"message" => sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?', 'grand-media'), $fileinfo['dirpath_thumb'])
|
1873 |
+
),
|
1874 |
+
"id" => $fileinfo['basename']
|
1875 |
);
|
1876 |
|
1877 |
return $return;
|
1878 |
}
|
1879 |
+
if( !is_writable($fileinfo['dirpath_thumb'])){
|
1880 |
@chmod($fileinfo['dirpath_thumb'], 0755);
|
1881 |
+
if( !is_writable($fileinfo['dirpath_thumb'])){
|
1882 |
@unlink($fileinfo['filepath']);
|
1883 |
+
$return = array(
|
1884 |
+
"error" => array(
|
1885 |
+
"code" => 100,
|
1886 |
+
"message" => sprintf(__('Directory %s is not writable by the server.', 'grand-media'), $fileinfo['dirpath_thumb'])
|
1887 |
+
),
|
1888 |
+
"id" => $fileinfo['basename']
|
1889 |
);
|
1890 |
|
1891 |
return $return;
|
1892 |
}
|
1893 |
}
|
1894 |
+
if( !wp_mkdir_p($fileinfo['dirpath_original'])){
|
1895 |
+
$return = array(
|
1896 |
+
"error" => array(
|
1897 |
+
"code" => 100,
|
1898 |
+
"message" => sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?', 'grand-media'), $fileinfo['dirpath_original'])
|
1899 |
+
),
|
1900 |
+
"id" => $fileinfo['basename']
|
1901 |
);
|
1902 |
|
1903 |
return $return;
|
1904 |
}
|
1905 |
+
if( !is_writable($fileinfo['dirpath_original'])){
|
1906 |
@chmod($fileinfo['dirpath_original'], 0755);
|
1907 |
+
if( !is_writable($fileinfo['dirpath_original'])){
|
1908 |
@unlink($fileinfo['filepath']);
|
1909 |
+
$return = array(
|
1910 |
+
"error" => array(
|
1911 |
+
"code" => 100,
|
1912 |
+
"message" => sprintf(__('Directory %s is not writable by the server.', 'grand-media'), $fileinfo['dirpath_original'])
|
1913 |
+
),
|
1914 |
+
"id" => $fileinfo['basename']
|
1915 |
);
|
1916 |
|
1917 |
return $return;
|
1934 |
|
1935 |
$angle = 0;
|
1936 |
$image_meta = @$this->wp_read_image_metadata($fileinfo['filepath_original']);
|
1937 |
+
if( !empty($image_meta['orientation'])){
|
1938 |
switch($image_meta['orientation']){
|
1939 |
case 3:
|
1940 |
$angle = 180;
|
1941 |
+
break;
|
1942 |
case 6:
|
1943 |
$angle = 270;
|
1944 |
$size_ratio = $size[1] / $size[0];
|
1945 |
+
break;
|
1946 |
case 8:
|
1947 |
$angle = 90;
|
1948 |
$size_ratio = $size[1] / $size[0];
|
1949 |
+
break;
|
1950 |
}
|
1951 |
}
|
1952 |
|
1957 |
if(is_wp_error($editor)){
|
1958 |
@unlink($fileinfo['filepath']);
|
1959 |
@unlink($fileinfo['filepath_original']);
|
1960 |
+
$return = array(
|
1961 |
+
"error" => array("code" => $editor->get_error_code(), "message" => $editor->get_error_message()),
|
1962 |
+
"id" => $fileinfo['basename'],
|
1963 |
+
"tip" => 'wp_get_image_editor'
|
1964 |
);
|
1965 |
|
1966 |
return $return;
|
1978 |
if(is_wp_error($resized)){
|
1979 |
@unlink($fileinfo['filepath']);
|
1980 |
@unlink($fileinfo['filepath_original']);
|
1981 |
+
$return = array(
|
1982 |
+
"error" => array("code" => $resized->get_error_code(), "message" => $resized->get_error_message()),
|
1983 |
+
"id" => $fileinfo['basename'],
|
1984 |
+
"tip" => "editor->resize->webimage({$webimg['width']}, {$webimg['height']}, {$webimg['crop']})"
|
1985 |
);
|
1986 |
|
1987 |
return $return;
|
1992 |
if(is_wp_error($saved)){
|
1993 |
@unlink($fileinfo['filepath']);
|
1994 |
@unlink($fileinfo['filepath_original']);
|
1995 |
+
$return = array(
|
1996 |
+
"error" => array("code" => $saved->get_error_code(), "message" => $saved->get_error_message()),
|
1997 |
+
"id" => $fileinfo['basename'],
|
1998 |
+
"tip" => 'editor->save->webimage'
|
1999 |
);
|
2000 |
|
2001 |
return $return;
|
2019 |
if(is_wp_error($resized)){
|
2020 |
@unlink($fileinfo['filepath']);
|
2021 |
@unlink($fileinfo['filepath_original']);
|
2022 |
+
$return = array(
|
2023 |
+
"error" => array("code" => $resized->get_error_code(), "message" => $resized->get_error_message()),
|
2024 |
+
"id" => $fileinfo['basename'],
|
2025 |
+
"tip" => "editor->resize->thumb({$thumbimg['width']}, {$thumbimg['height']}, {$thumbimg['crop']})"
|
2026 |
);
|
2027 |
|
2028 |
return $return;
|
2033 |
if(is_wp_error($saved)){
|
2034 |
@unlink($fileinfo['filepath']);
|
2035 |
@unlink($fileinfo['filepath_original']);
|
2036 |
+
$return = array(
|
2037 |
+
"error" => array("code" => $saved->get_error_code(), "message" => $saved->get_error_message()),
|
2038 |
+
"id" => $fileinfo['basename'],
|
2039 |
+
"tip" => 'editor->save->thumb'
|
2040 |
);
|
2041 |
|
2042 |
return $return;
|
2062 |
$description = '';
|
2063 |
$link = '';
|
2064 |
$date = null;
|
2065 |
+
if( !isset($post_data['set_title'])){
|
2066 |
$post_data['set_title'] = 'filename';
|
2067 |
}
|
2068 |
+
if( !isset($post_data['set_status'])){
|
2069 |
$post_data['set_status'] = isset($post_data['status'])? $post_data['status'] : 'inherit';
|
2070 |
}
|
2071 |
|
2072 |
$keywords = array();
|
2073 |
// use image exif/iptc data for title and caption defaults if possible
|
2074 |
if($size){
|
2075 |
+
if( !empty($image_meta)){
|
2076 |
if('exif' == $post_data['set_title']){
|
2077 |
+
if( !empty($image_meta['title']) && trim($image_meta['title'])){
|
2078 |
$title = $image_meta['title'];
|
2079 |
}
|
2080 |
}
|
2081 |
+
if( !empty($image_meta['caption']) && trim($image_meta['caption'])){
|
2082 |
$description = $image_meta['caption'];
|
2083 |
}
|
2084 |
+
if( !empty($image_meta['keywords'])){
|
2085 |
$keywords = $image_meta['keywords'];
|
2086 |
}
|
2087 |
}
|
2088 |
} else{
|
2089 |
$file_meta = $this->get_file_metadata($fileinfo['filepath_original'], $fileinfo);
|
2090 |
+
if( !empty($file_meta)){
|
2091 |
if('exif' == $post_data['set_title']){
|
2092 |
+
if( !empty($file_meta['title']) && trim($file_meta['title'])){
|
2093 |
$title = $file_meta['title'];
|
2094 |
}
|
2095 |
}
|
2096 |
+
if( !empty($file_meta['comment']) && trim($file_meta['comment'])){
|
2097 |
$description = $file_meta['comment'];
|
2098 |
}
|
2099 |
+
if( !empty($file_meta['album']) && ( !isset($post_data['terms']['gmedia_album']) || empty($post_data['terms']['gmedia_album']))){
|
2100 |
$post_data['terms']['gmedia_album'] = array($file_meta['album']);
|
2101 |
}
|
2102 |
}
|
2127 |
unset($post_data['gmuid'], $post_data['mime_type'], $post_data['set_title'], $post_data['set_status']);
|
2128 |
|
2129 |
if(isset($post_data['terms']['gmedia_category']) && !empty($post_data['terms']['gmedia_category'])){
|
2130 |
+
if( !is_array($post_data['terms']['gmedia_category'])){
|
2131 |
$post_data['terms']['gmedia_category'] = explode(',', $post_data['terms']['gmedia_category']);
|
2132 |
}
|
2133 |
} else{
|
2135 |
}
|
2136 |
|
2137 |
if(isset($post_data['terms']['gmedia_tag']) && !empty($post_data['terms']['gmedia_tag'])){
|
2138 |
+
if( !is_array($post_data['terms']['gmedia_tag'])){
|
2139 |
$post_data['terms']['gmedia_tag'] = explode(',', $post_data['terms']['gmedia_tag']);
|
2140 |
}
|
2141 |
} else{
|
2142 |
$post_data['terms']['gmedia_tag'] = array();
|
2143 |
}
|
2144 |
+
if( !empty($keywords)){
|
2145 |
$post_data['terms']['gmedia_tag'] = array_unique(array_merge($post_data['terms']['gmedia_tag'], $keywords));
|
2146 |
}
|
2147 |
|
2148 |
// Construct the media array
|
2149 |
+
$media_data = array(
|
2150 |
+
'mime_type' => $fileinfo['mime_type'],
|
2151 |
+
'gmuid' => $fileinfo['basename'],
|
2152 |
+
'title' => $title,
|
2153 |
+
'link' => $link,
|
2154 |
+
'description' => $description,
|
2155 |
+
'status' => $status,
|
2156 |
+
'date' => $date
|
2157 |
);
|
2158 |
|
2159 |
$media_data = $this->array_replace_recursive($media_data, $post_data);
|
2160 |
|
2161 |
+
if( !current_user_can('gmedia_delete_others_media')){
|
2162 |
$media_data['author'] = get_current_user_id();
|
2163 |
}
|
2164 |
|
2170 |
if(empty($media_metadata['image_meta'])){
|
2171 |
$media_metadata['image_meta'] = $image_meta;
|
2172 |
}
|
2173 |
+
if( !empty($image_meta['created_timestamp'])){
|
2174 |
$gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_created_timestamp', $image_meta['created_timestamp']);
|
2175 |
}
|
2176 |
+
if( !empty($image_meta['GPS'])){
|
2177 |
$gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_gps', $image_meta['GPS']);
|
2178 |
}
|
2179 |
}
|
2182 |
$gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_hash', $hash_file);
|
2183 |
$file_size = filesize($fileinfo['filepath_original']);
|
2184 |
$gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_size', $file_size);
|
2185 |
+
$return = array(
|
2186 |
+
"success" => array("code" => 200, "message" => sprintf(__('File uploaded successful. Assigned ID: %s', 'grand-media'), $id)),
|
2187 |
+
"id" => $fileinfo['basename']
|
2188 |
);
|
2189 |
|
2190 |
+
if((int) $gmGallery->options['delete_originals']){
|
2191 |
@unlink($fileinfo['filepath_original']);
|
2192 |
}
|
2193 |
|
2214 |
|
2215 |
if($size){
|
2216 |
require_once(dirname(__FILE__) . '/pel/autoload.php');
|
2217 |
+
try {
|
2218 |
Pel::setJPEGQuality(100);
|
2219 |
/*
|
2220 |
* We want the raw JPEG data from $scaled. Luckily, one can create a
|
2243 |
$orientation->setValue(1);
|
2244 |
}
|
2245 |
|
2246 |
+
if( !empty($input_ifd0)){
|
2247 |
/*$x_resolution = $input_ifd0->getEntry( PelTag::X_RESOLUTION );
|
2248 |
$y_resolution = $input_ifd0->getEntry( PelTag::Y_RESOLUTION );
|
2249 |
if ( $x_resolution != null && $y_resolution != null ) {
|
2260 |
$image_length->setValue($size[1]);
|
2261 |
}
|
2262 |
}
|
2263 |
+
if( !empty($input_exif_ifd)){
|
2264 |
$x_dimention = $input_exif_ifd->getEntry(PelTag::PIXEL_X_DIMENSION);
|
2265 |
$y_dimention = $input_exif_ifd->getEntry(PelTag::PIXEL_Y_DIMENSION);
|
2266 |
if($x_dimention != null && $y_dimention != null){
|
2268 |
$y_dimention->setValue($size[1]);
|
2269 |
}
|
2270 |
}
|
2271 |
+
if( !empty($input_inter_ifd)){
|
2272 |
$rel_image_width = $input_inter_ifd->getEntry(PelTag::RELATED_IMAGE_WIDTH);
|
2273 |
$rel_image_length = $input_inter_ifd->getEntry(PelTag::RELATED_IMAGE_LENGTH);
|
2274 |
if($rel_image_width != null && $rel_image_length != null){
|
2324 |
$_terms['gmedia_album'] = '';
|
2325 |
}
|
2326 |
if(isset($_terms['gmedia_category']) && !empty($_terms['gmedia_category'])){
|
2327 |
+
if( !is_array($_terms['gmedia_category'])){
|
2328 |
$_terms['gmedia_category'] = array_filter(array_map('trim', explode(',', $_terms['gmedia_category'])));
|
2329 |
}
|
2330 |
} else{
|
2331 |
$_terms['gmedia_category'] = array();
|
2332 |
}
|
2333 |
if(isset($_terms['gmedia_tag']) && !empty($_terms['gmedia_tag'])){
|
2334 |
+
if( !is_array($_terms['gmedia_tag'])){
|
2335 |
$_terms['gmedia_tag'] = array_filter(array_map('trim', explode(',', $_terms['gmedia_tag'])));
|
2336 |
}
|
2337 |
} else{
|
2364 |
$prefix = "\n<pre>$i/$c - ";
|
2365 |
$prefix_ko = "\n<pre class='ko'>$i/$c - ";
|
2366 |
|
2367 |
+
if( !is_file($file)){
|
2368 |
echo $prefix_ko . sprintf(__('File not exists: %s', 'grand-media'), $file) . $eol;
|
2369 |
continue;
|
2370 |
}
|
2383 |
|
2384 |
|
2385 |
// try to make grand-media dir if not exists
|
2386 |
+
if( !wp_mkdir_p($fileinfo['dirpath'])){
|
2387 |
echo $prefix_ko . sprintf(__('Unable to create directory `%s`. Is its parent directory writable by the server?', 'grand-media'), $fileinfo['dirpath']) . $eol;
|
2388 |
continue;
|
2389 |
}
|
2390 |
// Check if grand-media dir is writable
|
2391 |
+
if( !is_writable($fileinfo['dirpath'])){
|
2392 |
@chmod($fileinfo['dirpath'], 0755);
|
2393 |
+
if( !is_writable($fileinfo['dirpath'])){
|
2394 |
echo $prefix_ko . sprintf(__('Directory `%s` or its subfolders are not writable by the server.', 'grand-media'), dirname($fileinfo['dirpath'])) . $eol;
|
2395 |
continue;
|
2396 |
}
|
2424 |
switch($extensions[ $size[2] ]){
|
2425 |
case 'GIF':
|
2426 |
$CHANNEL = 1;
|
2427 |
+
break;
|
2428 |
case 'JPG':
|
2429 |
$CHANNEL = $size['channels'];
|
2430 |
+
break;
|
2431 |
case 'PNG':
|
2432 |
$CHANNEL = 3;
|
2433 |
+
break;
|
2434 |
case 'BMP':
|
2435 |
default:
|
2436 |
$CHANNEL = 6;
|
2437 |
+
break;
|
2438 |
}
|
2439 |
$MB = 1048576; // number of bytes in 1M
|
2440 |
$K64 = 65536; // number of bytes in 64K
|
2459 |
}
|
2460 |
}
|
2461 |
|
2462 |
+
if( !wp_mkdir_p($fileinfo['dirpath_thumb'])){
|
2463 |
echo $prefix_ko . sprintf(__('Unable to create directory `%s`. Is its parent directory writable by the server?', 'grand-media'), $fileinfo['dirpath_thumb']) . $eol;
|
2464 |
continue;
|
2465 |
}
|
2466 |
+
if( !is_writable($fileinfo['dirpath_thumb'])){
|
2467 |
@chmod($fileinfo['dirpath_thumb'], 0755);
|
2468 |
+
if( !is_writable($fileinfo['dirpath_thumb'])){
|
2469 |
@unlink($fileinfo['filepath']);
|
2470 |
echo $prefix_ko . sprintf(__('Directory `%s` is not writable by the server.', 'grand-media'), $fileinfo['dirpath_thumb']) . $eol;
|
2471 |
continue;
|
2472 |
}
|
2473 |
}
|
2474 |
+
if( !wp_mkdir_p($fileinfo['dirpath_original'])){
|
2475 |
echo $prefix_ko . sprintf(__('Unable to create directory `%s`. Is its parent directory writable by the server?', 'grand-media'), $fileinfo['dirpath_original']) . $eol;
|
2476 |
continue;
|
2477 |
}
|
2478 |
+
if( !is_writable($fileinfo['dirpath_original'])){
|
2479 |
@chmod($fileinfo['dirpath_original'], 0755);
|
2480 |
+
if( !is_writable($fileinfo['dirpath_original'])){
|
2481 |
@unlink($fileinfo['filepath']);
|
2482 |
echo $prefix_ko . sprintf(__('Directory `%s` is not writable by the server.', 'grand-media'), $fileinfo['dirpath_original']) . $eol;
|
2483 |
continue;
|
2500 |
|
2501 |
$angle = 0;
|
2502 |
$image_meta = @$this->wp_read_image_metadata($fileinfo['filepath_original']);
|
2503 |
+
if( !empty($image_meta['orientation'])){
|
2504 |
switch($image_meta['orientation']){
|
2505 |
case 3:
|
2506 |
$angle = 180;
|
2507 |
+
break;
|
2508 |
case 6:
|
2509 |
$angle = 270;
|
2510 |
$size_ratio = $size[1] / $size[0];
|
2511 |
+
break;
|
2512 |
case 8:
|
2513 |
$angle = 90;
|
2514 |
$size_ratio = $size[1] / $size[0];
|
2515 |
+
break;
|
2516 |
}
|
2517 |
}
|
2518 |
|
2596 |
|
2597 |
// Write media data to DB
|
2598 |
if($size){
|
2599 |
+
if( !empty($image_meta)){
|
2600 |
if(empty($title) && !empty($image_meta['title']) && trim($image_meta['title']) && !is_numeric(sanitize_title($image_meta['title']))){
|
2601 |
$title = $image_meta['title'];
|
2602 |
}
|
2603 |
if(empty($description) && !empty($image_meta['caption']) && trim($image_meta['caption'])){
|
2604 |
$description = $image_meta['caption'];
|
2605 |
}
|
2606 |
+
if( !empty($image_meta['keywords'])){
|
2607 |
+
$terms['gmedia_tag'] = array_unique(array_merge((array) $_terms['gmedia_tag'], $image_meta['keywords']));
|
2608 |
}
|
2609 |
}
|
2610 |
} else{
|
2611 |
$file_meta = $this->get_file_metadata($fileinfo['filepath_original'], $fileinfo);
|
2612 |
+
if( !empty($file_meta)){
|
2613 |
if(empty($title) && !empty($file_meta['title']) && trim($file_meta['title']) && !is_numeric(sanitize_title($file_meta['title']))){
|
2614 |
$title = $file_meta['title'];
|
2615 |
}
|
2627 |
}
|
2628 |
|
2629 |
// Construct the media_data array
|
2630 |
+
$media_data = array(
|
2631 |
+
'mime_type' => $fileinfo['mime_type'],
|
2632 |
+
'gmuid' => $fileinfo['basename'],
|
2633 |
+
'title' => $title,
|
2634 |
+
'link' => $link,
|
2635 |
+
'description' => $description,
|
2636 |
+
'status' => $status,
|
2637 |
+
'terms' => $terms
|
2638 |
);
|
2639 |
|
2640 |
+
if( !current_user_can('gmedia_delete_others_media')){
|
2641 |
$media_data['author'] = get_current_user_id();
|
2642 |
}
|
2643 |
|
2649 |
if(empty($media_metadata['image_meta'])){
|
2650 |
$media_metadata['image_meta'] = $image_meta;
|
2651 |
}
|
2652 |
+
if( !empty($image_meta['created_timestamp'])){
|
2653 |
$gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_created_timestamp', $image_meta['created_timestamp']);
|
2654 |
}
|
2655 |
+
if( !empty($image_meta['GPS'])){
|
2656 |
$gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_gps', $image_meta['GPS']);
|
2657 |
}
|
2658 |
}
|
2663 |
|
2664 |
echo $prefix . $fileinfo['basename'] . ': <span class="ok">' . sprintf(__('success (ID #%s)', 'grand-media'), $id) . '</span>' . $eol;
|
2665 |
|
2666 |
+
if((int) $gmGallery->options['delete_originals']){
|
2667 |
@unlink($fileinfo['filepath_original']);
|
2668 |
}
|
2669 |
if($move){
|
2687 |
global $gmDB;
|
2688 |
|
2689 |
$gmedia = $gmDB->get_gmedia($gmid);
|
2690 |
+
if( !$gmedia || is_wp_error($gmedia)){
|
2691 |
return;
|
2692 |
}
|
2693 |
|
2704 |
}
|
2705 |
|
2706 |
// Construct the media_data array
|
2707 |
+
$media_data = array(
|
2708 |
+
'mime_type' => $fileinfo['mime_type'],
|
2709 |
+
'gmuid' => $fileinfo['basename'],
|
2710 |
+
'title' => $gmedia->title,
|
2711 |
+
'link' => $gmedia->link,
|
2712 |
+
'description' => $gmedia->description,
|
2713 |
+
'status' => $gmedia->status,
|
2714 |
+
'terms' => array(
|
2715 |
+
'gmedia_album' => $gmDB->get_gmedia_terms($gmedia->ID, array('gmedia_album'), array('fields' => 'ids')),
|
2716 |
+
'gmedia_category' => $gmDB->get_gmedia_terms($gmedia->ID, array('gmedia_category'), array('fields' => 'ids')),
|
2717 |
+
'gmedia_tag' => $gmDB->get_gmedia_terms($gmedia->ID, array('gmedia_tag'), array('fields' => 'ids', 'order' => 'term_order'))
|
2718 |
+
)
|
2719 |
);
|
2720 |
|
2721 |
$media_data['author'] = get_current_user_id();
|
2726 |
$media_metadata = $gmDB->get_metadata('gmedia', $gmedia->ID);
|
2727 |
foreach($media_metadata as $key => $values){
|
2728 |
//if($this->is_protected_meta($key, 'gmedia')){
|
2729 |
+
foreach($values as $val){
|
2730 |
+
$gmDB->add_metadata($meta_type = 'gmedia', $id, $key, $val);
|
2731 |
+
}
|
2732 |
//}
|
2733 |
}
|
2734 |
|
2743 |
global $gmDB, $gmGallery;
|
2744 |
|
2745 |
$item = $gmDB->get_gmedia($gmid);
|
2746 |
+
if( !empty($item)){
|
2747 |
|
2748 |
$type = explode('/', $item->mime_type);
|
2749 |
$type = $type[0];
|
2757 |
$fail = '';
|
2758 |
$success = '';
|
2759 |
|
2760 |
+
if((int) $item->author != get_current_user_id()){
|
2761 |
+
if( !current_user_can('gmedia_edit_others_media')){
|
2762 |
$out = array('error' => $this->alert('danger', __('You are not allowed to edit others media', 'grand-media')));
|
2763 |
|
2764 |
return $out;
|
2777 |
$fileinfo = $this->fileinfo($item->gmuid, false);
|
2778 |
$is_file_original = is_file($fileinfo['filepath_original']);
|
2779 |
$filepath_original = $is_file_original? $fileinfo['filepath_original'] : (is_file($fileinfo['filepath'])? $fileinfo['filepath'] : null);
|
2780 |
+
if( !$filepath_original){
|
2781 |
$out = array('error' => $this->alert('danger', __('Original file does not exists', 'grand-media')));
|
2782 |
|
2783 |
return $out;
|
2784 |
}
|
2785 |
$size = @getimagesize($filepath_original);
|
2786 |
|
2787 |
+
do {
|
2788 |
$extensions = array('1' => 'GIF', '2' => 'JPG', '3' => 'PNG', '6' => 'BMP');
|
2789 |
if(function_exists('memory_get_usage')){
|
2790 |
switch($extensions[ $size[2] ]){
|
2791 |
case 'GIF':
|
2792 |
$CHANNEL = 1;
|
2793 |
+
break;
|
2794 |
case 'JPG':
|
2795 |
$CHANNEL = $size['channels'];
|
2796 |
+
break;
|
2797 |
case 'PNG':
|
2798 |
$CHANNEL = 3;
|
2799 |
+
break;
|
2800 |
case 'BMP':
|
2801 |
default:
|
2802 |
$CHANNEL = 6;
|
2803 |
+
break;
|
2804 |
}
|
2805 |
$MB = 1048576; // number of bytes in 1M
|
2806 |
$K64 = 65536; // number of bytes in 64K
|
2830 |
$angle = 0;
|
2831 |
if($is_file_original){
|
2832 |
$image_meta = @$this->wp_read_image_metadata($filepath_original);
|
2833 |
+
if( !empty($image_meta['orientation'])){
|
2834 |
switch($image_meta['orientation']){
|
2835 |
case 3:
|
2836 |
$angle = 180;
|
2837 |
+
break;
|
2838 |
case 6:
|
2839 |
$angle = 270;
|
2840 |
$size_ratio = $size[1] / $size[0];
|
2841 |
+
break;
|
2842 |
case 8:
|
2843 |
$angle = 90;
|
2844 |
$size_ratio = $size[1] / $size[0];
|
2845 |
+
break;
|
2846 |
}
|
2847 |
}
|
2848 |
$webimg['resize'] = (($webimg['width'] < $size[0]) || ($webimg['height'] < $size[1]))? true : false;
|
2948 |
/**
|
2949 |
* @param string $service
|
2950 |
*
|
2951 |
+
* @return array|bool json
|
2952 |
*/
|
2953 |
function app_service($service){
|
2954 |
+
global $gmGallery, $gmDB, $wp_version;
|
2955 |
|
2956 |
+
if(empty($_SERVER['HTTP_X_REAL_IP']) && ('127.0.0.1' == $_SERVER['REMOTE_ADDR'] || '::1' == $_SERVER['REMOTE_ADDR'])){
|
2957 |
return false;
|
2958 |
}
|
2959 |
+
if( !current_user_can('manage_options')){
|
2960 |
die('-1');
|
2961 |
}
|
2962 |
+
if( !$service){
|
2963 |
die('0');
|
2964 |
}
|
2965 |
|
2971 |
$options['mobile_app'] = 0;
|
2972 |
}
|
2973 |
|
2974 |
+
$data['site_email'] = get_option('admin_email');
|
2975 |
if(in_array($service, array('app_updateinfo')) && !is_email($data['site_email'])){
|
2976 |
+
$result['error'][] = __('Invalid email', 'grand-media');
|
2977 |
} else{
|
2978 |
|
2979 |
$url = home_url();
|
2980 |
$post_data = array('url' => $url);
|
2981 |
|
2982 |
+
if(in_array($service, array('app_deactivateplugin', 'app_uninstallplugin'))){
|
2983 |
+
if( !empty($options['site_ID'])){
|
2984 |
$post_data['site_id'] = $options['site_ID'];
|
2985 |
+
wp_remote_post('https://gmediaservice.codeasily.com/?gmService=' . $service, array(
|
2986 |
+
'method' => 'POST',
|
2987 |
+
'timeout' => 5,
|
2988 |
+
'blocking' => false,
|
2989 |
+
'sslverify' => false,
|
2990 |
+
'body' => $post_data,
|
2991 |
+
|
2992 |
));
|
2993 |
}
|
2994 |
|
2995 |
return false;
|
2996 |
}
|
2997 |
|
2998 |
+
$hash = 'gmedia_' . wp_generate_password('6', false);
|
2999 |
|
3000 |
if(in_array($service, array('app_activate', 'app_updateinfo'))){
|
3001 |
$status = 1;
|
3004 |
}
|
3005 |
$install_date = get_option('gmediaInstallDate');
|
3006 |
|
3007 |
+
$data['service'] = $service;
|
3008 |
+
$data['site_hash'] = $hash;
|
3009 |
+
$data['site_ID'] = $options['site_ID'];
|
3010 |
+
$data['title'] = get_bloginfo('name');
|
3011 |
+
$data['description'] = get_bloginfo('description');
|
3012 |
+
$data['url'] = $url;
|
3013 |
+
$data['license'] = $options['license_key'];
|
3014 |
+
$data['status'] = $status;
|
3015 |
+
$data['install_date'] = (int)$install_date;
|
3016 |
+
$data['counters'] = $gmDB->count_gmedia();
|
3017 |
+
$data['php_version'] = phpversion();
|
3018 |
+
$data['wp_version'] = $wp_version;
|
3019 |
+
$data['gmedia_version'] = GMEDIA_VERSION;
|
3020 |
+
$data['locale'] = get_locale();
|
3021 |
+
|
3022 |
+
$theme = wp_get_theme();
|
3023 |
+
$data['theme'] = array(
|
3024 |
+
'name' => $theme->get('Name'),
|
3025 |
+
'version' => $theme->get('Version'),
|
3026 |
+
'theme_uri' => $theme->get('ThemeURI')
|
3027 |
+
);
|
3028 |
+
|
3029 |
+
if ( ! function_exists( 'get_plugins' ) ) {
|
3030 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
3031 |
+
}
|
3032 |
+
$active_plugins = get_option('active_plugins');
|
3033 |
+
$plugins = get_plugins();
|
3034 |
+
$data['plugins'] = array();
|
3035 |
+
foreach($active_plugins as $p){
|
3036 |
+
if(isset($plugins[ $p ])){
|
3037 |
+
$data['plugins'][ $p ] = array(
|
3038 |
+
'name' => $plugins[ $p ]['Name'],
|
3039 |
+
'version' => $plugins[ $p ]['Version'],
|
3040 |
+
'plugin_uri' => $plugins[ $p ]['PluginURI']
|
3041 |
+
);
|
3042 |
+
}
|
3043 |
+
}
|
3044 |
+
|
3045 |
+
$tagslist = $gmDB->get_terms('gmedia_tag', array(
|
3046 |
+
'hide_empty' => true,
|
3047 |
+
'fields' => 'names_count',
|
3048 |
+
'orderby' => 'count',
|
3049 |
+
'order' => 'DESC',
|
3050 |
+
'no_found_rows' => true
|
3051 |
));
|
3052 |
+
$data['tags'] = array();
|
3053 |
+
if( !is_wp_error($tagslist)){
|
3054 |
+
foreach($tagslist as $tag){
|
3055 |
+
if($tag['count'] < 10){
|
3056 |
+
break;
|
3057 |
+
}
|
3058 |
+
$data['tags'][] = $tag['name'];
|
3059 |
+
}
|
3060 |
}
|
3061 |
|
3062 |
set_transient($hash, $data, 45);
|
3063 |
|
3064 |
$post_data['hash'] = $hash;
|
3065 |
+
$gms_post = wp_remote_post('https://gmediaservice.codeasily.com/?gmService=' . $service, array(
|
3066 |
+
'method' => 'POST',
|
3067 |
+
'timeout' => 45,
|
3068 |
+
//'blocking' => false,
|
3069 |
+
'sslverify' => false,
|
3070 |
+
'body' => $post_data
|
3071 |
));
|
3072 |
if(is_wp_error($gms_post)){
|
3073 |
$result['error'][] = $gms_post->get_error_message();
|
3074 |
}
|
3075 |
$gms_post_body = wp_remote_retrieve_body($gms_post);
|
3076 |
+
$_result = (array) json_decode($gms_post_body);
|
3077 |
if(isset($_result['error'])){
|
3078 |
+
if( !isset($result['error'])){
|
3079 |
$result['error'] = array();
|
3080 |
}
|
3081 |
+
$_result['error'] = (array) $_result['error'];
|
3082 |
$_result['error'] = array_filter($_result['error'], 'is_string');
|
3083 |
$result['error'] = array_merge($result['error'], $_result['error']);
|
3084 |
} else{
|
3085 |
$result = array_merge($_result, $result);
|
3086 |
+
// $result['gms_the_data'] = $data;
|
3087 |
+
// $result['gms_post'] = $gms_post;
|
3088 |
+
// $result['gms_post_body'] = $gms_post_body;
|
3089 |
if(isset($result['message'])){
|
3090 |
$result['message'] = $this->alert('info', $result['message']);
|
3091 |
}
|
3115 |
* @param null $modules
|
3116 |
*/
|
3117 |
function modules_update($modules = null){
|
3118 |
+
$wp_installing = (bool) (defined('WP_INSTALLING') && WP_INSTALLING);
|
3119 |
if($wp_installing){
|
3120 |
return;
|
3121 |
}
|
3122 |
|
3123 |
+
if( !is_array($modules)){
|
3124 |
$modules = get_gmedia_modules();
|
3125 |
}
|
3126 |
if(isset($modules['error'])){
|
3131 |
$modules_update_count = 0;
|
3132 |
|
3133 |
foreach($modules['in'] as $module){
|
3134 |
+
if( !empty($module['update']) && 'remote' != $module['place']){
|
3135 |
$modules_update_count ++;
|
3136 |
}
|
3137 |
}
|
3149 |
*/
|
3150 |
function i18n_exif_name($key){
|
3151 |
$_key = strtolower($key);
|
3152 |
+
$tagnames = array(
|
3153 |
+
'aperture' => __('Aperture', 'grand-media'),
|
3154 |
+
'credit' => __('Credit', 'grand-media'),
|
3155 |
+
'camera' => __('Camera', 'grand-media'),
|
3156 |
+
'model' => __('Camera', 'grand-media'),
|
3157 |
+
'lens' => __('Lens', 'grand-media'),
|
3158 |
+
'lensmake' => __('Lens Make', 'grand-media'),
|
3159 |
+
'caption' => __('Caption', 'grand-media'),
|
3160 |
+
'date' => __('Date/Time', 'grand-media'),
|
3161 |
+
'created_timestamp' => __('Timestamp', 'grand-media'),
|
3162 |
+
'created_date' => __('Date Created', 'grand-media'),
|
3163 |
+
'created_time' => __('Time Created', 'grand-media'),
|
3164 |
+
'copyright' => __('Copyright', 'grand-media'),
|
3165 |
+
'focallength' => __('Focal length', 'grand-media'),
|
3166 |
+
'focallength35' => __('Focal length in 35mm Film', 'grand-media'),
|
3167 |
+
'iso' => __('ISO', 'grand-media'),
|
3168 |
+
'exposure' => __('Exposure Time', 'grand-media'),
|
3169 |
+
'shutter_speed' => __('Shutter speed', 'grand-media'),
|
3170 |
+
'title' => __('Title', 'grand-media'),
|
3171 |
+
'author' => __('Author', 'grand-media'),
|
3172 |
+
'tags' => __('Tags', 'grand-media'),
|
3173 |
+
'subject' => __('Subject', 'grand-media'),
|
3174 |
+
'make' => __('Make', 'grand-media'),
|
3175 |
+
'status' => __('Edit Status', 'grand-media'),
|
3176 |
+
'category' => __('Category', 'grand-media'),
|
3177 |
+
'keywords' => __('Keywords', 'grand-media'),
|
3178 |
+
'position' => __('Author Position', 'grand-media'),
|
3179 |
+
'GPS' => __('GPS', 'grand-media'),
|
3180 |
+
'lat' => __('Latitude', 'grand-media'),
|
3181 |
+
'lng' => __('Longtitude', 'grand-media'),
|
3182 |
+
'city' => __('City', 'grand-media'),
|
3183 |
+
'location' => __('Location', 'grand-media'),
|
3184 |
+
'state' => __('Province/State', 'grand-media'),
|
3185 |
+
'country_code' => __('Country code', 'grand-media'),
|
3186 |
+
'country' => __('Country', 'grand-media'),
|
3187 |
+
'headline' => __('Headline', 'grand-media'),
|
3188 |
+
'source' => __('Source', 'grand-media'),
|
3189 |
+
'contact' => __('Contact', 'grand-media'),
|
3190 |
+
'last_modfied' => __('Last modified', 'grand-media'),
|
3191 |
+
'tool' => __('Program tool', 'grand-media'),
|
3192 |
+
'software' => __('Software', 'grand-media'),
|
3193 |
+
'format' => __('Format', 'grand-media'),
|
3194 |
+
'width' => __('Width', 'grand-media'),
|
3195 |
+
'height' => __('Height', 'grand-media'),
|
3196 |
+
'flash' => __('Flash', 'grand-media'),
|
3197 |
+
'flashdata' => __('Flash', 'grand-media'),
|
3198 |
+
'orientation' => __('Orientation', 'grand-media')
|
3199 |
);
|
3200 |
|
3201 |
if(isset($tagnames[ $_key ])){
|
3208 |
/**
|
3209 |
* Determine whether a meta key is protected.
|
3210 |
*
|
3211 |
+
* @param string $meta_key Meta key
|
3212 |
* @param string|null $meta_type
|
3213 |
*
|
3214 |
* @return bool True if the key is protected, false otherwise.
|
3223 |
* Display custom fields form fields.
|
3224 |
* @since 1.6.3
|
3225 |
*
|
3226 |
+
* @param int $gmedia_id
|
3227 |
* @param string $meta_type
|
3228 |
*/
|
3229 |
function gmedia_custom_meta_box($gmedia_id, $meta_type = 'gmedia'){
|
3233 |
return;
|
3234 |
}
|
3235 |
|
3236 |
+
if( !in_array($meta_type, array('gmedia', 'gmedia_term'))){
|
3237 |
$meta_type = 'gmedia';
|
3238 |
}
|
3239 |
?>
|
3247 |
}
|
3248 |
} ?>
|
3249 |
<div class="row">
|
3250 |
+
<?php if( !empty($metadata)){
|
3251 |
//$count = 0;
|
3252 |
foreach($metadata as $entry){
|
3253 |
echo $this->_list_meta_item($entry, $meta_type);
|
3281 |
|
3282 |
$entry['meta_key'] = esc_attr($entry['meta_key']);
|
3283 |
$entry['meta_value'] = esc_textarea($entry['meta_value']); // using a <textarea />
|
3284 |
+
$entry['meta_id'] = (int) $entry['meta_id'];
|
3285 |
|
3286 |
$colsm = ('gmedia' == $meta_type)? 6 : 4;
|
3287 |
//$delete_nonce = wp_create_nonce( 'gmedia_custom_field', '_wpnonce_custom_field' );
|
3307 |
function meta_form($meta_type = 'gmedia'){
|
3308 |
global $wpdb;
|
3309 |
|
3310 |
+
if( !in_array($meta_type, array('gmedia', 'gmedia_term'))){
|
3311 |
$meta_type = 'gmedia';
|
3312 |
}
|
3313 |
|
3369 |
/**
|
3370 |
* @since 1.6.3
|
3371 |
*
|
3372 |
+
* @param int $gmedia_ID
|
3373 |
* @param string $meta_type
|
3374 |
*
|
3375 |
* @return bool|int
|
3377 |
function add_meta($gmedia_ID, $meta_type = 'gmedia'){
|
3378 |
global $gmDB;
|
3379 |
|
3380 |
+
if( !in_array($meta_type, array('gmedia', 'gmedia_term'))){
|
3381 |
$meta_type = 'gmedia';
|
3382 |
}
|
3383 |
|
3384 |
+
$gmedia_ID = (int) $gmedia_ID;
|
3385 |
|
3386 |
$metakeyselect = isset($_POST['metakeyselect'])? wp_unslash(trim($_POST['metakeyselect'])) : '';
|
3387 |
$metakeyinput = isset($_POST['metakeyinput'])? wp_unslash(trim($_POST['metakeyinput'])) : '';
|
3390 |
$metavalue = trim($metavalue);
|
3391 |
}
|
3392 |
|
3393 |
+
if(('0' === $metavalue || !empty ($metavalue)) && (( !empty($metakeyselect) && !empty($metakeyselect)) || !empty ($metakeyinput))){
|
3394 |
/*
|
3395 |
* We have a key/value pair. If both the select and the input
|
3396 |
* for the key have data, the input takes precedence.
|
3425 |
if(is_object($item)){
|
3426 |
$item_id = $item->ID;
|
3427 |
} elseif($this->is_digit($item)){
|
3428 |
+
$item_id = (int) $item;
|
3429 |
} else{
|
3430 |
return null;
|
3431 |
}
|
3443 |
}
|
3444 |
}
|
3445 |
|
3446 |
+
if( !empty($metainfo)){
|
3447 |
foreach($metainfo as $key => $value){
|
3448 |
if(empty($value)){
|
3449 |
continue;
|
3465 |
* @return array
|
3466 |
*/
|
3467 |
function sanitize_meta_value($value){
|
3468 |
+
if(is_array($value) && (bool) count(array_filter(array_keys($value), 'is_string'))){
|
3469 |
$value_return = array();
|
3470 |
foreach($value as $key => $val){
|
3471 |
if(empty($value)){
|
3499 |
continue;
|
3500 |
}
|
3501 |
$metatext .= "<b>{$meta['name']}:</b>";
|
3502 |
+
if( !is_array($meta['value'])){
|
3503 |
$metatext .= " {$meta['value']}\n";
|
3504 |
} else{
|
3505 |
$value = $meta['value'];
|
3517 |
* @param int $pad
|
3518 |
*/
|
3519 |
function meta_value_array_show(&$metatext, $value, $pad = 0){
|
3520 |
+
if((bool) count(array_filter(array_keys($value), 'is_string'))){
|
3521 |
$pad ++;
|
3522 |
foreach($value as $val){
|
3523 |
$metatext .= "\n" . str_pad(' ', $pad) . "- <b>{$val['name']}:</b> ";
|
3575 |
* @param $gmID
|
3576 |
* @param $meta
|
3577 |
*
|
3578 |
+
* @return mixed
|
3579 |
*/
|
3580 |
function gm_hitcounter($gmID, $meta){
|
3581 |
/** @var wpdb $wpdb */
|
3583 |
|
3584 |
$like = $this->_post('vote');
|
3585 |
$like = $this->_post('like', $like);
|
3586 |
+
if((int) $like == 1){
|
3587 |
$meta['likes'] += 1;
|
3588 |
$gmDB->update_metadata('gmedia', $gmID, 'likes', $meta['likes']);
|
3589 |
do_action('gmedia_like', $gmID);
|
3608 |
function replace_array_keys(&$array, $keymap){
|
3609 |
$replaced_keys = array();
|
3610 |
$skipped = $keymap;
|
3611 |
+
do {
|
3612 |
$keymap = $skipped;
|
3613 |
foreach($keymap as $new_key => $original_key){
|
3614 |
if(isset($array[ $original_key ])){
|
3615 |
+
if( !isset($array[ $new_key ]) || (isset($replaced_keys[ $new_key ]) && !isset($replaced_keys[ $original_key ]))){
|
3616 |
$array[ $new_key ] = $array[ $original_key ];
|
3617 |
unset($array[ $original_key ]);
|
3618 |
$replaced_keys[ $original_key ] = $new_key;
|
3633 |
unset($skipped[ $new_key ]);
|
3634 |
}
|
3635 |
}
|
3636 |
+
} while( !empty($skipped));
|
3637 |
|
3638 |
return $replaced_keys;
|
3639 |
}
|
3642 |
* @return array Gmedia Capabilities
|
3643 |
*/
|
3644 |
function plugin_capabilities(){
|
3645 |
+
return array(
|
3646 |
+
'gmedia_library',
|
3647 |
+
'gmedia_show_others_media',
|
3648 |
+
'gmedia_edit_media',
|
3649 |
+
'gmedia_edit_others_media',
|
3650 |
+
'gmedia_delete_media',
|
3651 |
+
'gmedia_delete_others_media',
|
3652 |
+
'gmedia_upload',
|
3653 |
+
'gmedia_import',
|
3654 |
+
'gmedia_terms',
|
3655 |
+
'gmedia_album_manage',
|
3656 |
+
'gmedia_category_manage',
|
3657 |
+
'gmedia_tag_manage',
|
3658 |
+
'gmedia_terms_delete',
|
3659 |
+
'gmedia_gallery_manage',
|
3660 |
+
'gmedia_module_manage',
|
3661 |
+
'gmedia_settings'
|
3662 |
);
|
3663 |
}
|
3664 |
|
3667 |
*/
|
3668 |
function modules_order(){
|
3669 |
return array(
|
3670 |
+
'albumsgrid' => '',
|
3671 |
+
'phantom-pro' => '',
|
3672 |
+
'albums-stripes' => '',
|
3673 |
+
'cubik' => '',
|
3674 |
+
'desire' => '',
|
3675 |
+
'phototravlr' => '',
|
3676 |
+
'realslider' => '',
|
3677 |
+
'mosaic' => '',
|
3678 |
+
'photobox' => '',
|
3679 |
+
'wavesurfer' => '',
|
3680 |
+
'phantom' => '',
|
3681 |
+
'flipgrid' => '',
|
3682 |
+
'cubik-lite' => '',
|
3683 |
+
'photomania' => '',
|
3684 |
+
'jq-mplayer' => '',
|
3685 |
+
'wp-videoplayer' => '',
|
3686 |
+
'photo-pro' => '',
|
3687 |
+
'optima' => '',
|
3688 |
+
'afflux' => '',
|
3689 |
+
'slider' => '',
|
3690 |
+
'green-style' => '',
|
3691 |
+
'photo-blog' => '',
|
3692 |
+
'minima' => '',
|
3693 |
+
'sphere' => '',
|
3694 |
+
'cube' => '',
|
3695 |
+
'flatwall' => ''
|
3696 |
);
|
3697 |
}
|
3698 |
|
3699 |
/**
|
3700 |
* @param int|string $module
|
3701 |
+
* @param string $set_module_callback
|
3702 |
*
|
3703 |
* @return array [module, settings]
|
3704 |
*/
|
3705 |
function getModulePreset($module = '', $set_module_callback = ''){
|
3706 |
global $gmDB, $gmGallery;
|
3707 |
|
3708 |
+
if( !$set_module_callback){
|
3709 |
$set_module_callback = 'phantom';
|
3710 |
}
|
3711 |
+
if( !$module){
|
3712 |
return $this->getModulePreset($gmGallery->options['default_gmedia_module'], $set_module_callback);
|
3713 |
}
|
3714 |
|
3716 |
$preset = $gmDB->get_term($module);
|
3717 |
if($preset && !is_wp_error($preset)){
|
3718 |
$module = $preset->status;
|
3719 |
+
$module_settings = array($module => (array) maybe_unserialize($preset->description));
|
3720 |
+
$name = trim(str_replace('[' . $module . ']', '', $preset->name));
|
3721 |
} else{
|
3722 |
return $this->getModulePreset($set_module_callback);
|
3723 |
}
|
3725 |
$preset = $gmDB->get_term('[' . $module . ']', array('taxonomy' => 'gmedia_module', 'global' => '0'));
|
3726 |
if($preset && !is_wp_error($preset)){
|
3727 |
$module = $preset->status;
|
3728 |
+
$module_settings = array($module => (array) maybe_unserialize($preset->description));
|
3729 |
+
$name = __('Default Settings', 'grand-media');
|
3730 |
} else{
|
3731 |
$module_settings = array($module => array());
|
3732 |
+
$name = $module;
|
3733 |
}
|
3734 |
}
|
3735 |
|
3775 |
* @param $terms
|
3776 |
* @param $gmedia_id
|
3777 |
* @param $taxonomy
|
3778 |
+
*
|
3779 |
+
* @return mixed
|
3780 |
*/
|
3781 |
function get_the_gmedia_terms($terms, $gmedia_id, $taxonomy){
|
3782 |
if('gmedia_album' === $taxonomy){
|
3783 |
+
if( !is_user_logged_in()){
|
3784 |
foreach($terms as $key => $term){
|
3785 |
if('publish' !== $term->status){
|
3786 |
unset($terms[ $key ]);
|
3790 |
global $user_ID;
|
3791 |
foreach($terms as $key => $term){
|
3792 |
if('draft' === $term->status){
|
3793 |
+
if( !is_admin() || ($user_ID != $term->global && !gm_user_can('edit_others_media'))){
|
3794 |
unset($terms[ $key ]);
|
3795 |
}
|
3796 |
} elseif('private' === $term->status){
|
3851 |
public function punyencode($url){
|
3852 |
$url_host = parse_url($url, PHP_URL_HOST);
|
3853 |
|
3854 |
+
if((boolean) preg_match('/[\x80-\xFF]/', $url_host)){
|
3855 |
$host = $this->mb_convert_encoding_utf8($url_host);
|
3856 |
if(function_exists('idn_to_ascii')){
|
3857 |
$options = 0;
|
3925 |
return new gmColor($hex);
|
3926 |
}
|
3927 |
|
3928 |
+
/**
|
3929 |
+
* Log Views
|
3930 |
+
*
|
3931 |
+
* @param $id
|
3932 |
+
*/
|
3933 |
+
function log_views_handler($id){
|
3934 |
+
global $wpdb, $user_ID, $gmDB;
|
3935 |
+
|
3936 |
+
$gmedia = $gmDB->get_gmedia($id);
|
3937 |
+
if( !empty($gmedia->ID)){
|
3938 |
+
$data = array(
|
3939 |
+
'log' => 'view',
|
3940 |
+
'ID' => $gmedia->ID,
|
3941 |
+
'log_author' => (int) $user_ID,
|
3942 |
+
'log_date' => current_time('mysql'),
|
3943 |
+
'log_data' => '1',
|
3944 |
+
'ip_address' => $this->ip()
|
3945 |
+
);
|
3946 |
+
$id = $wpdb->insert($wpdb->prefix . 'gmedia_log', $data);
|
3947 |
+
}
|
3948 |
+
}
|
3949 |
+
|
3950 |
+
/**
|
3951 |
+
* Log Likes
|
3952 |
+
*
|
3953 |
+
* @param $id
|
3954 |
+
*/
|
3955 |
+
function log_likes_handler($id){
|
3956 |
+
global $wpdb, $user_ID, $gmDB;
|
3957 |
+
|
3958 |
+
$gmedia = $gmDB->get_gmedia($id);
|
3959 |
+
if( !empty($gmedia->ID)){
|
3960 |
+
$data = array(
|
3961 |
+
'log' => 'like',
|
3962 |
+
'ID' => $gmedia->ID,
|
3963 |
+
'log_author' => (int) $user_ID,
|
3964 |
+
'log_date' => current_time('mysql'),
|
3965 |
+
'log_data' => '1',
|
3966 |
+
'ip_address' => $this->ip()
|
3967 |
+
);
|
3968 |
+
$wpdb->insert($wpdb->prefix . 'gmedia_log', $data);
|
3969 |
+
}
|
3970 |
+
}
|
3971 |
+
|
3972 |
+
/**
|
3973 |
+
* Log Rating
|
3974 |
+
*
|
3975 |
+
* @param $id
|
3976 |
+
* @param $val
|
3977 |
+
*/
|
3978 |
+
function log_rates_handler($id, $val){
|
3979 |
+
global $wpdb, $user_ID, $gmDB;
|
3980 |
+
|
3981 |
+
$gmedia = $gmDB->get_gmedia($id);
|
3982 |
+
if( !empty($gmedia->ID)){
|
3983 |
+
$data = array(
|
3984 |
+
'log' => 'rate',
|
3985 |
+
'ID' => $gmedia->ID,
|
3986 |
+
'log_author' => (int) $user_ID,
|
3987 |
+
'log_date' => current_time('mysql'),
|
3988 |
+
'log_data' => $val,
|
3989 |
+
'ip_address' => $this->ip()
|
3990 |
+
);
|
3991 |
+
$wpdb->insert($wpdb->prefix . 'gmedia_log', $data);
|
3992 |
+
}
|
3993 |
+
}
|
3994 |
+
|
3995 |
+
/**
|
3996 |
+
* Get IP address
|
3997 |
+
*/
|
3998 |
+
function ip(){
|
3999 |
+
//Test if it is a shared client
|
4000 |
+
if( !empty($_SERVER['HTTP_CLIENT_IP'])){
|
4001 |
+
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
4002 |
+
//Is it a proxy address
|
4003 |
+
} elseif( !empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
|
4004 |
+
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
4005 |
+
} else{
|
4006 |
+
$ip = $_SERVER['REMOTE_ADDR'];
|
4007 |
+
}
|
4008 |
+
|
4009 |
+
return $ip;
|
4010 |
+
}
|
4011 |
}
|
4012 |
|
4013 |
global $gmCore;
|
inc/db.connect.php
CHANGED
@@ -338,7 +338,7 @@ class GmediaDB{
|
|
338 |
foreach($params as $key => $value){
|
339 |
$result .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />';
|
340 |
}
|
341 |
-
$result .= '<input class="form-control pager_current_page" name="pager" type="text" value="' . $this->openPage . '" /><span class="input-group-addon">' . __("of", "grand-media") . ' ' . $this->pages . '</span>';
|
342 |
$result .= '</form>';
|
343 |
|
344 |
$result .= '<div class="btn-group btn-group-xs">';
|
@@ -1492,7 +1492,8 @@ class GmediaDB{
|
|
1492 |
|
1493 |
$where .= $whichstatus . $search;
|
1494 |
|
1495 |
-
|
|
|
1496 |
$q['order'] = 'DESC';
|
1497 |
}
|
1498 |
|
@@ -1545,7 +1546,10 @@ class GmediaDB{
|
|
1545 |
} else{
|
1546 |
$orderby = "{$wpdb->prefix}gmedia.ID";
|
1547 |
}
|
1548 |
-
|
|
|
|
|
|
|
1549 |
case 'filename':
|
1550 |
$orderby = "{$wpdb->prefix}gmedia.gmuid";
|
1551 |
break;
|
@@ -3331,11 +3335,11 @@ class GmediaDB{
|
|
3331 |
}
|
3332 |
|
3333 |
if(in_array($taxonomy, array('gmedia_album', 'gmedia_gallery'))){
|
3334 |
-
$post_data = array('post_author'
|
3335 |
-
'post_content'
|
3336 |
-
'post_title'
|
3337 |
-
'post_status'
|
3338 |
-
'post_type'
|
3339 |
);
|
3340 |
if(!empty($slug)){
|
3341 |
$post_data['post_name'] = $slug;
|
@@ -3348,7 +3352,13 @@ class GmediaDB{
|
|
3348 |
$_post_ID = $this->get_metadata('gmedia_term', $term_id, '_post_ID', true);
|
3349 |
if($_post_ID){
|
3350 |
$post_data['ID'] = $_post_ID;
|
3351 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3352 |
unset($post_data['ID']);
|
3353 |
$_post_ID = wp_insert_post($post_data);
|
3354 |
if($_post_ID){
|
338 |
foreach($params as $key => $value){
|
339 |
$result .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />';
|
340 |
}
|
341 |
+
$result .= '<input class="form-control pager_current_page allow-key-enter" name="pager" type="text" value="' . $this->openPage . '" /><span class="input-group-addon">' . __("of", "grand-media") . ' ' . $this->pages . '</span>';
|
342 |
$result .= '</form>';
|
343 |
|
344 |
$result .= '<div class="btn-group btn-group-xs">';
|
1492 |
|
1493 |
$where .= $whichstatus . $search;
|
1494 |
|
1495 |
+
$empty_order = empty($q['order']);
|
1496 |
+
if($empty_order || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC'))){
|
1497 |
$q['order'] = 'DESC';
|
1498 |
}
|
1499 |
|
1546 |
} else{
|
1547 |
$orderby = "{$wpdb->prefix}gmedia.ID";
|
1548 |
}
|
1549 |
+
if($empty_order) {
|
1550 |
+
$q['order'] = 'ASC';
|
1551 |
+
}
|
1552 |
+
break;
|
1553 |
case 'filename':
|
1554 |
$orderby = "{$wpdb->prefix}gmedia.gmuid";
|
1555 |
break;
|
3335 |
}
|
3336 |
|
3337 |
if(in_array($taxonomy, array('gmedia_album', 'gmedia_gallery'))){
|
3338 |
+
$post_data = array('post_author' => $global,
|
3339 |
+
'post_content' => $description,
|
3340 |
+
'post_title' => $name,
|
3341 |
+
'post_status' => $status,
|
3342 |
+
'post_type' => $taxonomy
|
3343 |
);
|
3344 |
if(!empty($slug)){
|
3345 |
$post_data['post_name'] = $slug;
|
3352 |
$_post_ID = $this->get_metadata('gmedia_term', $term_id, '_post_ID', true);
|
3353 |
if($_post_ID){
|
3354 |
$post_data['ID'] = $_post_ID;
|
3355 |
+
|
3356 |
+
if ( ! empty( $post_date ) ) {
|
3357 |
+
$post_data['post_date'] = $post_date;
|
3358 |
+
$post_data['post_date_gmt'] = get_gmt_from_date( $post_date );
|
3359 |
+
}
|
3360 |
+
|
3361 |
+
if(!wp_update_post($post_data)){
|
3362 |
unset($post_data['ID']);
|
3363 |
$_post_ID = wp_insert_post($post_data);
|
3364 |
if($_post_ID){
|
inc/frontend.filters.php
CHANGED
@@ -756,7 +756,11 @@ function gmedia_post_type__the_content($content){
|
|
756 |
$ext2 = wp_get_video_extensions();
|
757 |
$ext = array_merge($ext1, $ext2);
|
758 |
if(in_array($gmedia->ext, $ext)){
|
759 |
-
|
|
|
|
|
|
|
|
|
760 |
echo $embed;
|
761 |
} else{
|
762 |
$cover_url = $gmCore->gm_get_media_image($gmedia, 'web');
|
756 |
$ext2 = wp_get_video_extensions();
|
757 |
$ext = array_merge($ext1, $ext2);
|
758 |
if(in_array($gmedia->ext, $ext)){
|
759 |
+
global $wp_embed;
|
760 |
+
$embed = $wp_embed->run_shortcode("[embed]$gmedia->url[/embed]");
|
761 |
+
if('[' == substr($embed, 0, 1)){
|
762 |
+
$embed = do_shortcode($embed);
|
763 |
+
}
|
764 |
echo $embed;
|
765 |
} else{
|
766 |
$cover_url = $gmCore->gm_get_media_image($gmedia, 'web');
|
inc/functions.php
CHANGED
@@ -20,6 +20,9 @@ function get_gmedia_modules($including_remote = true){
|
|
20 |
if(($plugin_modules = glob(GMEDIA_ABSPATH . 'module/*', GLOB_ONLYDIR | GLOB_NOSORT))){
|
21 |
foreach($plugin_modules as $path){
|
22 |
$mfold = basename($path);
|
|
|
|
|
|
|
23 |
$modules['in'][ $mfold ] = array('place' => 'plugin',
|
24 |
'module_name' => $mfold,
|
25 |
'module_url' => $gmCore->gmedia_url . "/module/{$mfold}",
|
@@ -53,7 +56,7 @@ function get_gmedia_modules($including_remote = true){
|
|
53 |
unset($modules['in'][ $mfold ]);
|
54 |
continue;
|
55 |
}
|
56 |
-
$modules['in'][ $mfold ] = array_merge($module, (array)$module_info);
|
57 |
$modules['in'][ $mfold ]['update'] = false;
|
58 |
}
|
59 |
}
|
@@ -66,17 +69,50 @@ function get_gmedia_modules($including_remote = true){
|
|
66 |
foreach($xml as $m){
|
67 |
$name = (string)$m->name;
|
68 |
$modules['xml'][ $name ] = get_object_vars($m);
|
69 |
-
$modules['xml'][ $name ]['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
if(isset($modules['in'][ $name ]) && !empty($modules['in'][ $name ])){
|
71 |
-
$
|
|
|
|
|
72 |
if(version_compare($modules['xml'][ $name ]['version'], $modules['in'][ $name ]['version'], '>')){
|
73 |
$modules['in'][ $name ]['update'] = $modules['xml'][ $name ]['version'];
|
|
|
|
|
74 |
$modules['out'][ $name ] = $modules['xml'][ $name ];
|
75 |
}
|
76 |
} else{
|
|
|
|
|
77 |
$modules['out'][ $name ] = $modules['xml'][ $name ];
|
78 |
}
|
79 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
} else{
|
82 |
$modules['error'] = array(__('Error loading remote xml...', 'grand-media'));
|
@@ -86,6 +122,7 @@ function get_gmedia_modules($including_remote = true){
|
|
86 |
}
|
87 |
}
|
88 |
|
|
|
89 |
return $modules;
|
90 |
}
|
91 |
|
@@ -120,7 +157,7 @@ function gmedia_item_more_data(&$item){
|
|
120 |
$item->url_web = $gmCore->upload['url'] . '/' . $gmGallery->options['folder']['image'] . '/' . $item->gmuid;
|
121 |
$item->url_original = $gmCore->upload['url'] . '/' . $gmGallery->options['folder']['image_original'] . '/' . $item->gmuid;
|
122 |
if(!is_file($item->path_original)){
|
123 |
-
$item->path_original =
|
124 |
$item->url_original = $item->url_web;
|
125 |
}
|
126 |
if(!empty($metadata['image_meta']['GPS'])){
|
@@ -201,6 +238,7 @@ function gmedia_term_item_more_data(&$item){
|
|
201 |
if($post_id){
|
202 |
$post_item = get_post($post_id);
|
203 |
if($post_item){
|
|
|
204 |
$item->slug = $post_item->post_name;
|
205 |
$item->post_password = $post_item->post_password;
|
206 |
$item->comment_count = $post_item->comment_count;
|
20 |
if(($plugin_modules = glob(GMEDIA_ABSPATH . 'module/*', GLOB_ONLYDIR | GLOB_NOSORT))){
|
21 |
foreach($plugin_modules as $path){
|
22 |
$mfold = basename($path);
|
23 |
+
if(in_array($mfold, array('minima', 'afflux'))){
|
24 |
+
continue;
|
25 |
+
}
|
26 |
$modules['in'][ $mfold ] = array('place' => 'plugin',
|
27 |
'module_name' => $mfold,
|
28 |
'module_url' => $gmCore->gmedia_url . "/module/{$mfold}",
|
56 |
unset($modules['in'][ $mfold ]);
|
57 |
continue;
|
58 |
}
|
59 |
+
$modules['in'][ $mfold ] = array_merge(array('id' => 0, 'tags' => array(), 'screenshots' => array()), $module, (array)$module_info);
|
60 |
$modules['in'][ $mfold ]['update'] = false;
|
61 |
}
|
62 |
}
|
69 |
foreach($xml as $m){
|
70 |
$name = (string)$m->name;
|
71 |
$modules['xml'][ $name ] = get_object_vars($m);
|
72 |
+
if(isset($modules['xml'][ $name ]['@attributes']['id'])){
|
73 |
+
$modules['xml'][ $name ]['id'] = $modules['xml'][ $name ]['@attributes']['id'];
|
74 |
+
unset($modules['xml'][ $name ]['@attributes']);
|
75 |
+
} else{
|
76 |
+
$modules['xml'][ $name ]['id'] = 0;
|
77 |
+
}
|
78 |
+
if(isset($modules['xml'][ $name ]['tags']->tag)){
|
79 |
+
$modules['xml'][ $name ]['tags'] = (array)$modules['xml'][ $name ]['tags']->tag;
|
80 |
+
} else{
|
81 |
+
$modules['xml'][ $name ]['tags'] = array();
|
82 |
+
}
|
83 |
+
if(isset($modules['xml'][ $name ]['screenshot']->screen)){
|
84 |
+
foreach($modules['xml'][ $name ]['screenshot'] as $screen){
|
85 |
+
$modules['xml'][ $name ]['screenshots'][] = (array)$screen;
|
86 |
+
}
|
87 |
+
} else{
|
88 |
+
$modules['xml'][ $name ]['screenshots'] = array();
|
89 |
+
}
|
90 |
+
unset($modules['xml'][ $name ]['screenshot']);
|
91 |
+
$modules['xml'][ $name ]['description'] = (string)$modules['xml'][ $name ]['description'];
|
92 |
if(isset($modules['in'][ $name ]) && !empty($modules['in'][ $name ])){
|
93 |
+
$xml_module = $modules['xml'][ $name ];
|
94 |
+
unset($xml_module['version']);
|
95 |
+
$modules['in'][ $name ] = array_merge($modules['in'][ $name ], $xml_module);
|
96 |
if(version_compare($modules['xml'][ $name ]['version'], $modules['in'][ $name ]['version'], '>')){
|
97 |
$modules['in'][ $name ]['update'] = $modules['xml'][ $name ]['version'];
|
98 |
+
$modules['xml'][ $name ]['place'] = 'remote';
|
99 |
+
$modules['xml'][ $name ]['update'] = true;
|
100 |
$modules['out'][ $name ] = $modules['xml'][ $name ];
|
101 |
}
|
102 |
} else{
|
103 |
+
$modules['xml'][ $name ]['place'] = 'remote';
|
104 |
+
$modules['xml'][ $name ]['update'] = false;
|
105 |
$modules['out'][ $name ] = $modules['xml'][ $name ];
|
106 |
}
|
107 |
}
|
108 |
+
array_multisort(array_map(function($element) {
|
109 |
+
return $element['id'];
|
110 |
+
}, $modules['in']), SORT_DESC, $modules['in']);
|
111 |
+
if(!empty($modules['out'])){
|
112 |
+
array_multisort(array_map(function($element){
|
113 |
+
return $element['id'];
|
114 |
+
}, $modules['out']), SORT_DESC, $modules['out']);
|
115 |
+
}
|
116 |
}
|
117 |
} else{
|
118 |
$modules['error'] = array(__('Error loading remote xml...', 'grand-media'));
|
122 |
}
|
123 |
}
|
124 |
|
125 |
+
|
126 |
return $modules;
|
127 |
}
|
128 |
|
157 |
$item->url_web = $gmCore->upload['url'] . '/' . $gmGallery->options['folder']['image'] . '/' . $item->gmuid;
|
158 |
$item->url_original = $gmCore->upload['url'] . '/' . $gmGallery->options['folder']['image_original'] . '/' . $item->gmuid;
|
159 |
if(!is_file($item->path_original)){
|
160 |
+
$item->path_original = false;
|
161 |
$item->url_original = $item->url_web;
|
162 |
}
|
163 |
if(!empty($metadata['image_meta']['GPS'])){
|
238 |
if($post_id){
|
239 |
$post_item = get_post($post_id);
|
240 |
if($post_item){
|
241 |
+
$item->post_date = $post_item->post_date;
|
242 |
$item->slug = $post_item->post_name;
|
243 |
$item->post_password = $post_item->post_password;
|
244 |
$item->comment_count = $post_item->comment_count;
|
inc/module.options.php
CHANGED
@@ -144,7 +144,7 @@ if(!function_exists('gm_recognized_font_styles')) {
|
|
144 |
/**
|
145 |
* @param string $field_id
|
146 |
*
|
147 |
-
* @return
|
148 |
*/
|
149 |
function gm_recognized_font_styles($field_id = '') {
|
150 |
|
@@ -172,7 +172,7 @@ if(!function_exists('gm_recognized_font_weights')) {
|
|
172 |
/**
|
173 |
* @param string $field_id
|
174 |
*
|
175 |
-
* @return
|
176 |
*/
|
177 |
function gm_recognized_font_weights($field_id = '') {
|
178 |
|
@@ -210,7 +210,7 @@ if(!function_exists('gm_recognized_font_variants')) {
|
|
210 |
/**
|
211 |
* @param string $field_id
|
212 |
*
|
213 |
-
* @return
|
214 |
*/
|
215 |
function gm_recognized_font_variants($field_id = '') {
|
216 |
|
@@ -239,7 +239,7 @@ if(!function_exists('gm_recognized_font_families')) {
|
|
239 |
/**
|
240 |
* @param string $field_id
|
241 |
*
|
242 |
-
* @return
|
243 |
*/
|
244 |
function gm_recognized_font_families($field_id = '') {
|
245 |
|
144 |
/**
|
145 |
* @param string $field_id
|
146 |
*
|
147 |
+
* @return array
|
148 |
*/
|
149 |
function gm_recognized_font_styles($field_id = '') {
|
150 |
|
172 |
/**
|
173 |
* @param string $field_id
|
174 |
*
|
175 |
+
* @return array
|
176 |
*/
|
177 |
function gm_recognized_font_weights($field_id = '') {
|
178 |
|
210 |
/**
|
211 |
* @param string $field_id
|
212 |
*
|
213 |
+
* @return array
|
214 |
*/
|
215 |
function gm_recognized_font_variants($field_id = '') {
|
216 |
|
239 |
/**
|
240 |
* @param string $field_id
|
241 |
*
|
242 |
+
* @return array
|
243 |
*/
|
244 |
function gm_recognized_font_families($field_id = '') {
|
245 |
|
inc/permalinks.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
-
if(!defined('ABSPATH')) {
|
3 |
-
|
4 |
} // Exit if accessed directly
|
5 |
|
6 |
/**
|
@@ -8,295 +8,304 @@ if(!defined('ABSPATH')) {
|
|
8 |
*/
|
9 |
class gmediaPermalinks {
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
|
301 |
}
|
302 |
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
} // Exit if accessed directly
|
5 |
|
6 |
/**
|
8 |
*/
|
9 |
class gmediaPermalinks {
|
10 |
|
11 |
+
private $endpoint = 'gmedia';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* __construct function.
|
15 |
+
*
|
16 |
+
* @access public
|
17 |
+
* @return \gmediaPermalinks
|
18 |
+
*/
|
19 |
+
public function __construct() {
|
20 |
+
add_filter( 'rewrite_rules_array', array( $this, 'add_rewrite_rules' ) );
|
21 |
+
add_filter( 'query_vars', array( $this, 'add_query_vars' ) );
|
22 |
+
add_action( 'parse_request', array( $this, 'handler' ) );
|
23 |
+
add_action( 'parse_query', array( $this, 'bridge' ) );
|
24 |
+
|
25 |
+
add_filter( 'post_thumbnail_html', array( $this, 'gmedia_post_thumbnail' ), 10, 5 );
|
26 |
+
add_filter( 'gmedia_shortcode_query', array( $this, 'gmedia_shortcode_query' ), 10, 2 );
|
27 |
+
|
28 |
+
add_filter( 'show_admin_bar', array( $this, 'comments_admin_bar_hide' ) );
|
29 |
+
add_action( 'single_template', array( $this, 'comments_gmedia_template_redirect' ) );
|
30 |
+
add_filter( 'comment_post_redirect', array( $this, 'redirect_after_comment' ), 10, 2 );
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Change the template used when the gmedia post permalink has ?comments
|
36 |
+
*
|
37 |
+
* @param string $templates
|
38 |
+
*
|
39 |
+
* @return string
|
40 |
+
*/
|
41 |
+
function comments_gmedia_template_redirect( $templates = "" ) {
|
42 |
+
if ( ! ( isset( $_GET['comments'] ) && is_singular( array( 'gmedia', 'gmedia_album', 'gmedia_gallery' ) ) ) ) {
|
43 |
+
return $templates;
|
44 |
+
}
|
45 |
+
|
46 |
+
$templates = locate_template( "gmedia_comments-popup.php", false );
|
47 |
+
if ( empty( $templates ) ) {
|
48 |
+
$templates = GMEDIA_ABSPATH . 'template/comments-popup.php';
|
49 |
+
}
|
50 |
+
|
51 |
+
return $templates;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* @param $show_admin_bar
|
56 |
+
*
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
function comments_admin_bar_hide( $show_admin_bar ) {
|
60 |
+
if ( ! ( isset( $_GET['comments'] ) && is_singular( array( 'gmedia', 'gmedia_album', 'gmedia_gallery' ) ) ) ) {
|
61 |
+
return $show_admin_bar;
|
62 |
+
}
|
63 |
+
|
64 |
+
return false;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @param $location
|
69 |
+
*
|
70 |
+
* @param $comment
|
71 |
+
*
|
72 |
+
* @return string
|
73 |
+
*/
|
74 |
+
function redirect_after_comment( $location, $comment ) {
|
75 |
+
global $wpdb;
|
76 |
+
|
77 |
+
$queryParts = explode( '#', $_SERVER["HTTP_REFERER"], 2 );
|
78 |
+
$queryParts = explode( '?', $queryParts[0], 2 );
|
79 |
+
if ( ! ( isset( $queryParts[1] ) && ! empty( $queryParts[1] ) ) ) {
|
80 |
+
return $location;
|
81 |
+
}
|
82 |
+
$queryParts = explode( '&', $queryParts[1] );
|
83 |
+
$params = array();
|
84 |
+
foreach ( $queryParts as $param ) {
|
85 |
+
$item = explode( '=', $param );
|
86 |
+
$params[ $item[0] ] = isset( $item[1] ) ? $item[1] : '';
|
87 |
+
}
|
88 |
+
if ( ! isset( $params['comments'] ) ) {
|
89 |
+
return $location;
|
90 |
+
}
|
91 |
+
|
92 |
+
$post = get_post( $comment->comment_post_ID );
|
93 |
+
|
94 |
+
if ( ! in_array( $post->post_type, array( 'gmedia', 'gmedia_album', 'gmedia_gallery' ) ) ) {
|
95 |
+
return $location;
|
96 |
+
}
|
97 |
+
|
98 |
+
return $_SERVER["HTTP_REFERER"] . "#comment-" . $wpdb->insert_id;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* @param $rules
|
103 |
+
*
|
104 |
+
* @return array
|
105 |
+
*/
|
106 |
+
function add_rewrite_rules( $rules ) {
|
107 |
+
global $wp_rewrite, $gmGallery;
|
108 |
+
$this->endpoint = ! empty( $gmGallery->options['endpoint'] ) ? $gmGallery->options['endpoint'] : 'gmedia';
|
109 |
+
|
110 |
+
$this->add_endpoint();
|
111 |
+
|
112 |
+
$new_rules = array(
|
113 |
+
$this->endpoint . '/(g|s|a|t|k|u)/(.+?)/?$' => 'index.php?' . $this->endpoint . '=' . $wp_rewrite->preg_index( 2 ) . '&t=' . $wp_rewrite->preg_index( 1 ),
|
114 |
+
'gmedia-app/?$' => 'index.php?gmedia-app=1'
|
115 |
+
);
|
116 |
+
|
117 |
+
$new_rules = $new_rules + $rules;
|
118 |
+
|
119 |
+
return $new_rules;
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* add_endpoint function.
|
124 |
+
*
|
125 |
+
* @access public
|
126 |
+
* @return void
|
127 |
+
*/
|
128 |
+
public function add_endpoint() {
|
129 |
+
add_rewrite_endpoint( $this->endpoint, EP_NONE );
|
130 |
+
add_rewrite_endpoint( 'gmedia-app', EP_NONE );
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* add_query_vars function.
|
135 |
+
*
|
136 |
+
* @access public
|
137 |
+
*
|
138 |
+
* @param $vars
|
139 |
+
*
|
140 |
+
* @return array
|
141 |
+
*/
|
142 |
+
public function add_query_vars( $vars ) {
|
143 |
+
global $gmGallery;
|
144 |
+
$endpoint = ! empty( $gmGallery->options['endpoint'] ) ? $gmGallery->options['endpoint'] : 'gmedia';
|
145 |
+
|
146 |
+
$vars[] = $endpoint;
|
147 |
+
$vars[] = 't';
|
148 |
+
|
149 |
+
$vars[] = 'gmedia-app';
|
150 |
+
|
151 |
+
return $vars;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Listen for gmedia requets and show gallery template.
|
156 |
+
*
|
157 |
+
* @access public
|
158 |
+
*
|
159 |
+
* @param $wp - global variable
|
160 |
+
*/
|
161 |
+
public function handler( $wp ) {
|
162 |
+
global $gmGallery;
|
163 |
+
$endpoint = ! empty( $gmGallery->options['endpoint'] ) ? $gmGallery->options['endpoint'] : 'gmedia';
|
164 |
+
if ( isset( $wp->query_vars[ $endpoint ] ) && isset( $wp->query_vars['t'] ) && in_array( $wp->query_vars['t'], array( 'g', 'a', 't', 's', 'k', 'u' ) ) ) {
|
165 |
+
|
166 |
+
global $wp_query;
|
167 |
+
$wp_query->is_single = false;
|
168 |
+
$wp_query->is_page = false;
|
169 |
+
$wp_query->is_archive = false;
|
170 |
+
$wp_query->is_search = false;
|
171 |
+
$wp_query->is_home = false;
|
172 |
+
|
173 |
+
/*
|
174 |
+
$template = get_query_template( 'gmedia-gallery' );
|
175 |
+
// Get default slug-name.php
|
176 |
+
if ( ! $template ) {
|
177 |
+
$template = GMEDIA_ABSPATH . "/load-template.php";
|
178 |
+
}
|
179 |
+
|
180 |
+
load_template( $template, false );
|
181 |
+
*/
|
182 |
+
|
183 |
+
define( 'GMEDIACLOUD_PAGE', true );
|
184 |
+
|
185 |
+
/** @noinspection PhpIncludeInspection */
|
186 |
+
require_once( GMEDIA_ABSPATH . "load-template.php" );
|
187 |
+
|
188 |
+
exit();
|
189 |
+
|
190 |
+
}
|
191 |
+
|
192 |
+
/* Application only template */
|
193 |
+
$is_app = ( isset( $wp->query_vars['gmedia-app'] ) && ! empty( $wp->query_vars['gmedia-app'] ) );
|
194 |
+
if ( $is_app ) {
|
195 |
+
|
196 |
+
global $wp_query;
|
197 |
+
$wp_query->is_single = false;
|
198 |
+
$wp_query->is_page = false;
|
199 |
+
$wp_query->is_archive = false;
|
200 |
+
$wp_query->is_search = false;
|
201 |
+
$wp_query->is_home = false;
|
202 |
+
|
203 |
+
$template = GMEDIA_ABSPATH . "app/access.php";
|
204 |
+
|
205 |
+
load_template( $template, false );
|
206 |
+
exit();
|
207 |
+
|
208 |
+
}
|
209 |
+
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Listen for gmServiceLink query
|
214 |
+
*
|
215 |
+
* @access public
|
216 |
+
*
|
217 |
+
* @param $wp - global variable
|
218 |
+
*/
|
219 |
+
public function bridge( $wp ) {
|
220 |
+
if ( isset( $_GET['gmServiceLink'] ) ) {
|
221 |
+
$transient_key = preg_replace( '/[^A-Za-z0-9_]/', '', $_GET['gmServiceLink'] );
|
222 |
+
if ( false !== ( $result = get_transient( $transient_key ) ) ) {
|
223 |
+
delete_transient( $transient_key );
|
224 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ), true );
|
225 |
+
echo json_encode( $result );
|
226 |
+
die();
|
227 |
+
}
|
228 |
+
}
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Filter for the post content
|
233 |
+
*
|
234 |
+
* @param string $html
|
235 |
+
* @param int $post_id
|
236 |
+
* @param int $post_thumbnail_id
|
237 |
+
* @param string|array $size Optional. Image size. Defaults to 'thumbnail'.
|
238 |
+
* @param string|array $attr Optional. Query string or array of attributes.
|
239 |
+
*
|
240 |
+
* @return string html output
|
241 |
+
*/
|
242 |
+
function gmedia_post_thumbnail( $html, $post_id, $post_thumbnail_id, $size = 'post-thumbnail', $attr = '' ) {
|
243 |
+
|
244 |
+
$gmedia_id = get_post_meta( $post_thumbnail_id, '_gmedia_image_id', true );
|
245 |
+
if ( ! empty( $gmedia_id ) ) {
|
246 |
+
$html = str_replace( 'wp-post-image', 'wp-post-image gmedia-post-thumbnail-' . $gmedia_id, $html );
|
247 |
+
}
|
248 |
+
|
249 |
+
return $html;
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Filter for the shortcode gallery data
|
254 |
+
*
|
255 |
+
* @param array $query
|
256 |
+
* @param string $id
|
257 |
+
*
|
258 |
+
* @return array $query
|
259 |
+
*/
|
260 |
+
function gmedia_shortcode_query( $query, $id = '' ) {
|
261 |
+
global $gmCore, $gmDB, $gmGallery;
|
262 |
+
|
263 |
+
//$gmCore->replace_array_keys($query, array('album__in' => 'gmedia_album', 'tag__in' => 'gmedia_tag', 'category__in' => 'gmedia_category'));
|
264 |
+
if ( ( $new_query = $gmCore->_get( "gm{$id}" ) ) ) {
|
265 |
+
//$query = array_merge($query, $new_query);
|
266 |
+
$query = $new_query;
|
267 |
+
}
|
268 |
+
if ( empty( $query['orderby'] ) && empty( $query['order'] ) ) {
|
269 |
+
if ( isset( $query['gmedia__in'] ) ) {
|
270 |
+
$query_order = array(
|
271 |
+
'orderby' => 'gmedia__in',
|
272 |
+
'order' => 'ASC'
|
273 |
+
);
|
274 |
+
$query = array_merge( $query_order, $query );
|
275 |
+
}
|
276 |
+
if ( isset( $query['tag__in'] ) && ( ! isset( $query['category__in'] ) && ! isset( $query['album__in'] ) ) ) {
|
277 |
+
$term_query_order = array(
|
278 |
+
'orderby' => $gmGallery->options['in_tag_orderby'],
|
279 |
+
'order' => $gmGallery->options['in_tag_order']
|
280 |
+
);
|
281 |
+
$query = array_merge( $term_query_order, $query );
|
282 |
+
}
|
283 |
+
if ( isset( $query['category__in'] ) && ! isset( $query['album__in'] ) ) {
|
284 |
+
$cat_ids = wp_parse_id_list( $query['category__in'] );
|
285 |
+
if ( 1 == count( $cat_ids ) ) {
|
286 |
+
$cat_meta = $gmDB->get_metadata( 'gmedia_term', $cat_ids[0] );
|
287 |
+
$term_query_order = array(
|
288 |
+
'orderby' => ! empty( $cat_meta['_orderby'][0] ) ? $cat_meta['_orderby'][0] : $gmGallery->options['in_category_orderby'],
|
289 |
+
'order' => ! empty( $cat_meta['_order'][0] ) ? $cat_meta['_order'][0] : $gmGallery->options['in_category_order']
|
290 |
+
);
|
291 |
+
$query = array_merge( $term_query_order, $query );
|
292 |
+
}
|
293 |
+
}
|
294 |
+
if ( isset( $query['album__in'] ) ) {
|
295 |
+
$alb_ids = wp_parse_id_list( $query['album__in'] );
|
296 |
+
if ( 1 == count( $alb_ids ) ) {
|
297 |
+
$album_meta = $gmDB->get_metadata( 'gmedia_term', $alb_ids[0] );
|
298 |
+
$term_query_order = array(
|
299 |
+
'orderby' => ! empty( $album_meta['_orderby'][0] ) ? $album_meta['_orderby'][0] : $gmGallery->options['in_album_orderby'],
|
300 |
+
'order' => ! empty( $album_meta['_order'][0] ) ? $album_meta['_order'][0] : $gmGallery->options['in_album_order']
|
301 |
+
);
|
302 |
+
$query = array_merge( $term_query_order, $query );
|
303 |
+
}
|
304 |
+
}
|
305 |
+
}
|
306 |
+
|
307 |
+
return $query;
|
308 |
+
}
|
309 |
|
310 |
}
|
311 |
|
module/jq-mplayer/index.php
CHANGED
@@ -3,7 +3,7 @@ $module_info = array(
|
|
3 |
'base' => 'jq-mplayer',
|
4 |
'name' => 'jq-mplayer',
|
5 |
'title' => 'jQ Music Player',
|
6 |
-
'version' => '2.
|
7 |
'author' => 'CodEasily.com',
|
8 |
'description' => __('This beautiful audio player is totally written in JQuery and HTML5 + visitors can set rating for each track', 'grand-media'),
|
9 |
'type' => 'music',
|
3 |
'base' => 'jq-mplayer',
|
4 |
'name' => 'jq-mplayer',
|
5 |
'title' => 'jQ Music Player',
|
6 |
+
'version' => '2.12',
|
7 |
'author' => 'CodEasily.com',
|
8 |
'description' => __('This beautiful audio player is totally written in JQuery and HTML5 + visitors can set rating for each track', 'grand-media'),
|
9 |
'type' => 'music',
|
module/jq-mplayer/js/gm-music-player.js
CHANGED
@@ -438,10 +438,10 @@
|
|
438 |
' <div class="gmmp-track-title"></div>' +
|
439 |
' <div class="gmmp-player-controls">' +
|
440 |
' <div class="gmmp-main">' +
|
441 |
-
' <div class="gmmp-previous
|
442 |
-
' <div class="gmmp-play
|
443 |
-
' <div class="gmmp-pause
|
444 |
-
' <div class="gmmp-next
|
445 |
'<!-- These controls aren\'t used by this plugin, but jPlayer seems to require that they exist -->' +
|
446 |
' <span class="gmmp-unused-controls">' +
|
447 |
' <span class="jp-video-play"></span>' +
|
438 |
' <div class="gmmp-track-title"></div>' +
|
439 |
' <div class="gmmp-player-controls">' +
|
440 |
' <div class="gmmp-main">' +
|
441 |
+
' <div class="gmmp-previous"></div>' +
|
442 |
+
' <div class="gmmp-play"></div>' +
|
443 |
+
' <div class="gmmp-pause"></div>' +
|
444 |
+
' <div class="gmmp-next"></div>' +
|
445 |
'<!-- These controls aren\'t used by this plugin, but jPlayer seems to require that they exist -->' +
|
446 |
' <span class="gmmp-unused-controls">' +
|
447 |
' <span class="jp-video-play"></span>' +
|
readme.txt
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
=== Gallery - Gmedia Photo Gallery. Music Player, Video Gallery, Media Library ===
|
2 |
Contributors: pasyuk
|
3 |
Donate link: https://codeasily.com/donate/
|
4 |
-
Tags: gallery,
|
5 |
Requires at least: 3.7
|
6 |
-
Tested up to: 4.
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
-
Gallery Gmedia - photo gallery with comments, EXIF & Metadata, map geolocation (GPS), private galleries, music & video
|
12 |
|
13 |
== Description ==
|
14 |
|
@@ -24,6 +24,23 @@ Manage files, show image galleries and photo slideshows, play music on your site
|
|
24 |
With Gmedia Gallery plugin you can upload an unlimited number of photo and audio files, create dozens of galleries and playlists, group pictures and other files in albums, andadd tags for each file.
|
25 |
Handle any file format and link any files with images in few clicks. You can import images with captions from Worpress Media Library, Flagallery plugin and from NextGen Gallery plugin right to Gmedia Library.
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
= Gallery Links =
|
28 |
|
29 |
**[Gallery Home Page](https://codeasily.com/)**, **[Gallery Skins Portfolio](https://codeasily.com/portfolio/gmedia-gallery-modules/)**, **[Gmedia Gallery Support Forum](https://codeasily.com/community/forum/gmedia-gallery-wordpress-plugin/)**
|
@@ -32,22 +49,9 @@ Handle any file format and link any files with images in few clicks. You can imp
|
|
32 |
|
33 |
**[Create responsive photo gallery in few clicks. Various customization options and awesome features.](https://codeasily.com/how-to-create-an-image-gallery-in-wordpress/)**
|
34 |
|
35 |
-
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
* [AlbumsGrid - Splash Gallery for your Albums, Categories, Tags](https://codeasily.com/portfolio/gmedia-gallery-modules/albumsgrid/).
|
40 |
-
* [AlbumsStripes - Slider for your Albums](https://codeasily.com/portfolio/gmedia-gallery-modules/stripes/).
|
41 |
-
* [Cubik 3D - Mixed 3D Gallery Module](https://codeasily.com/portfolio/gmedia-gallery-modules/cubik-3d-photo-gallery-for-wordpress/) is the 3D Cube Gallery with social sharing - highly customizible grid and Magnific Popup lightbox with additional information for each photo.
|
42 |
-
* [Phantom Pro - Mixed Gallery Module](https://codeasily.com/portfolio/gmedia-gallery-modules/phantom-pro/) is the Wall/Grid Gallery with social sharing - you can easily change thumbnail sizes, colors, navigation, borders, add stylish labels to thumbnails ... and much more.
|
43 |
-
* [WaveSurfer - Music Module](https://codeasily.com/portfolio/gmedia-gallery-modules/wavesurfer/) superior responsive SoundCloud like music player with terms support (tags, albums, categories) and ability to show track covers, download button, custom link button, like button, share button, plays & comments counter.
|
44 |
-
* [PhotoTravlr - Gallery Module](https://codeasily.com/portfolio/gmedia-gallery-modules/gmedia-phototravlr/) is amazing responsive gallery with terms support (tags, albums, categories) and details for each image like author, caption, download button, link button, like button, EXIF info, location map. Can be in full window and full screen mode.
|
45 |
-
* [PhotoMania - Gallery Module (GmediaCloud demo)](https://codeasily.com/portfolio/gmedia-gallery-modules/photomania/) - free responsive gallery with thumbs panel and other details for each image like author, caption, download button, link button, like button. Can be in full window and full screen mode.
|
46 |
-
* [Mosaic - Gallery Module](https://codeasily.com/portfolio/gmedia-gallery-modules/mosaic/) is an image gallery with masonry layout built on jQuery. Responsive gallery with built in prettyPhoto lightbox for big images.
|
47 |
-
* [RealSlider - Gallery Module](https://codeasily.com/portfolio/gmedia-gallery-modules/realslider/) is an image/video gallery slider module built on jQuery. RealSlider module is responsive and touch friendly gallery with 50+ options for customization.
|
48 |
-
* [PhotoBox - Gallery Module](https://codeasily.com/portfolio/gmedia-gallery-modules/photobox/) - a lightweight image gallery which uses only CSS3 for silky-smooth animations and transitions.
|
49 |
-
* [Music Player Module](https://codeasily.com/portfolio/gmedia-gallery-modules/music-player/) - beautiful audio player with playlist is totally written in jQuery and HTML5.
|
50 |
-
* [More Galleries...](https://codeasily.com/portfolio/gmedia-gallery-modules/)
|
51 |
|
52 |
Help me make it **best gallery** plugin: test it and [write suggestions](https://codeasily.com/community/forum/gmedia-gallery-wordpress-plugin/) how it could be improved in feature versions.
|
53 |
|
@@ -148,14 +152,77 @@ Gmedia Gallery - is Grand Media Gallery (photo gallery, image gallery, music gal
|
|
148 |
|
149 |
= Minimum requirements for Gmedia Gallery =
|
150 |
|
151 |
-
WordPress 3.
|
152 |
-
PHP 5.
|
153 |
|
154 |
== Changelog ==
|
155 |
|
156 |
= Modules Updated =
|
157 |
* Go to Gmedia Gallery Modules page and update installed premium modules to latest versions
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
= Gmedia Gallery v1.9.20 =
|
160 |
* Added few action hooks for developers
|
161 |
|
1 |
=== Gallery - Gmedia Photo Gallery. Music Player, Video Gallery, Media Library ===
|
2 |
Contributors: pasyuk
|
3 |
Donate link: https://codeasily.com/donate/
|
4 |
+
Tags: gallery, albums, photo gallery, gallery lightbox, gallery comments
|
5 |
Requires at least: 3.7
|
6 |
+
Tested up to: 4.9.1
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
+
Gallery Gmedia - photo gallery with comments, gallery with EXIF & Metadata, gallery with map geolocation (GPS), private galleries, music gallery & video gallery.
|
12 |
|
13 |
== Description ==
|
14 |
|
24 |
With Gmedia Gallery plugin you can upload an unlimited number of photo and audio files, create dozens of galleries and playlists, group pictures and other files in albums, andadd tags for each file.
|
25 |
Handle any file format and link any files with images in few clicks. You can import images with captions from Worpress Media Library, Flagallery plugin and from NextGen Gallery plugin right to Gmedia Library.
|
26 |
|
27 |
+
#### Demos:
|
28 |
+
|
29 |
+
* [AlbumsList](https://codeasily.com/portfolio/gmedia-gallery-modules/albumslist/) - Splash Slider Gallery with custom lightbox.
|
30 |
+
* [WoowSlider](https://codeasily.com/portfolio/gmedia-gallery-modules/woowslider/) - unique responsive Slider.
|
31 |
+
* [AlbumsGrid](https://codeasily.com/portfolio/gmedia-gallery-modules/albumsgrid/) - Splash Gallery for your Albums (terms).
|
32 |
+
* [PhotoCluster](https://codeasily.com/portfolio/gmedia-gallery-modules/photocluster/) - Accordeon Splash Slider for your Albums.
|
33 |
+
* [Cubik 3D](https://codeasily.com/portfolio/gmedia-gallery-modules/cubik-3d-photo-gallery-for-wordpress/) - 3D Cube Gallery with social sharing.
|
34 |
+
* [Phantom Pro](https://codeasily.com/portfolio/gmedia-gallery-modules/phantom-pro/) - Wall/Grid Gallery.
|
35 |
+
* [WaveSurfer](https://codeasily.com/portfolio/gmedia-gallery-modules/wavesurfer/) - responsive SoundCloud like music player with terms support (tags, albums, categories) and ability to show track covers.
|
36 |
+
* [PhotoTravlr](https://codeasily.com/portfolio/gmedia-gallery-modules/gmedia-phototravlr/) - responsive gallery with terms support (tags, albums, categories) and extended details for each image.
|
37 |
+
* [PhotoMania (GmediaCloud demo)](https://codeasily.com/portfolio/gmedia-gallery-modules/photomania/) - free responsive gallery.
|
38 |
+
* [Mosaic](https://codeasily.com/portfolio/gmedia-gallery-modules/mosaic/) - gallery with masonry layout.
|
39 |
+
* [RealSlider](https://codeasily.com/portfolio/gmedia-gallery-modules/realslider/) - image/video gallery slider, responsive and touch friendly gallery with 50+ options for customization.
|
40 |
+
* [PhotoBox](https://codeasily.com/portfolio/gmedia-gallery-modules/photobox/) - silky-smooth animations and transitions.
|
41 |
+
* [Music Player](https://codeasily.com/portfolio/gmedia-gallery-modules/music-player/) - audio player with playlist.
|
42 |
+
* [More Galleries...](https://codeasily.com/portfolio/gmedia-gallery-modules/)
|
43 |
+
|
44 |
= Gallery Links =
|
45 |
|
46 |
**[Gallery Home Page](https://codeasily.com/)**, **[Gallery Skins Portfolio](https://codeasily.com/portfolio/gmedia-gallery-modules/)**, **[Gmedia Gallery Support Forum](https://codeasily.com/community/forum/gmedia-gallery-wordpress-plugin/)**
|
49 |
|
50 |
**[Create responsive photo gallery in few clicks. Various customization options and awesome features.](https://codeasily.com/how-to-create-an-image-gallery-in-wordpress/)**
|
51 |
|
52 |
+
https://www.youtube.com/watch?v=0ZBb9H4CG8U
|
53 |
|
54 |
+
Friendly for iPad and iPhone. Doesn’t slow down your website. **Unlimited galleries** on your website with **unlimited customizations** for each gallery.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
Help me make it **best gallery** plugin: test it and [write suggestions](https://codeasily.com/community/forum/gmedia-gallery-wordpress-plugin/) how it could be improved in feature versions.
|
57 |
|
152 |
|
153 |
= Minimum requirements for Gmedia Gallery =
|
154 |
|
155 |
+
WordPress 3.7+
|
156 |
+
PHP 5.3+
|
157 |
|
158 |
== Changelog ==
|
159 |
|
160 |
= Modules Updated =
|
161 |
* Go to Gmedia Gallery Modules page and update installed premium modules to latest versions
|
162 |
|
163 |
+
= Gmedia Gallery v1.12.1 =
|
164 |
+
* Added related media for Gmedia Items (support in modules will be added in the future).
|
165 |
+
* Updated mediaelements.js library to the latest version.
|
166 |
+
* Added Update button for CodeCanyon's modules.
|
167 |
+
* Fixed default order for gmedia__in query.
|
168 |
+
|
169 |
+
= Gmedia Gallery v1.11.7 =
|
170 |
+
* Added new color picker with rgba support.
|
171 |
+
* Fixed JS error on edit album page.
|
172 |
+
|
173 |
+
= Gmedia Gallery v1.11.6 =
|
174 |
+
* Added functionality for the future module.
|
175 |
+
|
176 |
+
= Gmedia Gallery v1.11.5 =
|
177 |
+
* Removed debug info on admin page
|
178 |
+
* Added "Date" field on Edit Album page
|
179 |
+
|
180 |
+
= Gmedia Gallery v1.11.4 =
|
181 |
+
* Compatible with WP v4.9
|
182 |
+
* Fixed CSS for JQ Music Player module.
|
183 |
+
|
184 |
+
= Gmedia Gallery v1.11.3 =
|
185 |
+
* Small fixes and improvements
|
186 |
+
|
187 |
+
= Gmedia Gallery v1.11.2 =
|
188 |
+
* Fixed iOS app service activation on some servers
|
189 |
+
* Added premium gallery module
|
190 |
+
|
191 |
+
= Gmedia Gallery v1.11.1 =
|
192 |
+
* Fixed Modules update
|
193 |
+
* Fixed PHP Notice
|
194 |
+
|
195 |
+
= Gmedia Gallery v1.11.0 =
|
196 |
+
* Added Support page
|
197 |
+
* Added user permission to enable GmediaService
|
198 |
+
* Added user feedback form before deactivate plugin
|
199 |
+
* Fixed links to home website
|
200 |
+
* Hide flash modules from the list of available modules
|
201 |
+
* Small fixes and improvements
|
202 |
+
|
203 |
+
= Gmedia Gallery v1.10.07 =
|
204 |
+
* Added files in the import tree view
|
205 |
+
* Added logging of views and likes from iOS app
|
206 |
+
* Fixed links to home website
|
207 |
+
* Fixed PHP Notice when original image is not available on the server
|
208 |
+
|
209 |
+
= Gmedia Gallery v1.10.06 =
|
210 |
+
* Fixed iOS app service activation on some servers
|
211 |
+
* Fixed non-images single posts was empty
|
212 |
+
|
213 |
+
= Gmedia Gallery v1.10.05 =
|
214 |
+
* Fixed compatibility with WP-SpamShield
|
215 |
+
* Modules admin page new layout with filters by feature
|
216 |
+
|
217 |
+
= Gmedia Gallery v1.10.04 =
|
218 |
+
* Added option to disable Gmedia Logger
|
219 |
+
* Added compatibility with the future gallery module
|
220 |
+
|
221 |
+
= Gmedia Gallery v1.10.03 =
|
222 |
+
* Added Gmedia Logger as a premium option
|
223 |
+
* Fixed ENTER key on pagination
|
224 |
+
* Other small improvements
|
225 |
+
|
226 |
= Gmedia Gallery v1.9.20 =
|
227 |
* Added few action hooks for developers
|
228 |
|
template/functions.php
CHANGED
@@ -32,7 +32,7 @@ function gmediacloud_meta_generator(){
|
|
32 |
<link href="<?php echo $icon_url; ?>/icon_gmedia_180.png" rel="apple-touch-icon" sizes="180x180"/>
|
33 |
|
34 |
<meta property="og:title" content="<?php esc_attr_e(the_gmedia_title(true)); ?>"/>
|
35 |
-
<meta property="og:description" content="<?php esc_attr_e($gmedia->description
|
36 |
<?php
|
37 |
if($gmedia_type != 'single'){
|
38 |
if(did_action('gmedia_shortcode') && count($gmGallery->shortcode)){
|
@@ -256,12 +256,14 @@ function gmediacloud_social_sharing(){
|
|
256 |
return;
|
257 |
}
|
258 |
|
259 |
-
global $wp, $gmedia_share_img;
|
260 |
|
261 |
$url = urlencode(esc_url_raw(home_url(add_query_arg(array(), $wp->request))));
|
262 |
-
$text =
|
263 |
-
$title =
|
264 |
$image = urlencode($gmedia_share_img[0]);
|
|
|
|
|
265 |
?>
|
266 |
<style>
|
267 |
/*@import url('//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css') all;*/
|
@@ -326,11 +328,11 @@ function gmediacloud_social_sharing(){
|
|
326 |
</style>
|
327 |
<div class="gmedia-socialsharebuttons">
|
328 |
<!-- Facebook -->
|
329 |
-
<a href="http://www.facebook.com/sharer/sharer.php?u=<?php echo $url; ?>&t=<?php echo $
|
330 |
<i class="fa fa-facebook"><span>Facebook</span></i>
|
331 |
</a>
|
332 |
<!-- Twitter -->
|
333 |
-
<a href="http://twitter.com/share?url=<?php echo $url; ?>&text=<?php echo $
|
334 |
<i class="fa fa-twitter"><span>Twitter</span></i>
|
335 |
</a>
|
336 |
<!-- Google Plus -->
|
@@ -338,7 +340,7 @@ function gmediacloud_social_sharing(){
|
|
338 |
<i class="fa fa-google-plus"><span>Google+</span></i>
|
339 |
</a>
|
340 |
<!-- Pinterest -->
|
341 |
-
<a href="http://pinterest.com/pin/create/button/?url=<?php echo $url; ?>&description=<?php echo $
|
342 |
class="share-btn pinterest-p">
|
343 |
<i class="fa fa-pinterest-p"><span>Pinterest</span></i>
|
344 |
</a>
|
@@ -347,7 +349,7 @@ function gmediacloud_social_sharing(){
|
|
347 |
<i class="fa fa-vk"><span>VK</span></i>
|
348 |
</a>
|
349 |
<!-- Email -->
|
350 |
-
<a href="mailto:?subject=<?php echo $title; ?>&body=<?php echo $
|
351 |
<i class="fa fa-envelope"><span>Email</span></i>
|
352 |
</a>
|
353 |
</div>
|
32 |
<link href="<?php echo $icon_url; ?>/icon_gmedia_180.png" rel="apple-touch-icon" sizes="180x180"/>
|
33 |
|
34 |
<meta property="og:title" content="<?php esc_attr_e(the_gmedia_title(true)); ?>"/>
|
35 |
+
<meta property="og:description" content="<?php esc_attr_e($gmedia->description); ?>"/>
|
36 |
<?php
|
37 |
if($gmedia_type != 'single'){
|
38 |
if(did_action('gmedia_shortcode') && count($gmGallery->shortcode)){
|
256 |
return;
|
257 |
}
|
258 |
|
259 |
+
global $wp, $gmedia, $gmedia_share_img;
|
260 |
|
261 |
$url = urlencode(esc_url_raw(home_url(add_query_arg(array(), $wp->request))));
|
262 |
+
$text = $gmedia->description;
|
263 |
+
$title = the_gmedia_title(true);
|
264 |
$image = urlencode($gmedia_share_img[0]);
|
265 |
+
$title_text = urldecode($title . ' ' . $text);
|
266 |
+
$mailbody = urlencode($text . ' ' . $url);
|
267 |
?>
|
268 |
<style>
|
269 |
/*@import url('//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css') all;*/
|
328 |
</style>
|
329 |
<div class="gmedia-socialsharebuttons">
|
330 |
<!-- Facebook -->
|
331 |
+
<a href="http://www.facebook.com/sharer/sharer.php?u=<?php echo $url; ?>&t=<?php echo $title_text; ?>" target="_blank" class="share-btn facebook">
|
332 |
<i class="fa fa-facebook"><span>Facebook</span></i>
|
333 |
</a>
|
334 |
<!-- Twitter -->
|
335 |
+
<a href="http://twitter.com/share?url=<?php echo $url; ?>&text=<?php echo $title_text; ?>" target="_blank" class="share-btn twitter">
|
336 |
<i class="fa fa-twitter"><span>Twitter</span></i>
|
337 |
</a>
|
338 |
<!-- Google Plus -->
|
340 |
<i class="fa fa-google-plus"><span>Google+</span></i>
|
341 |
</a>
|
342 |
<!-- Pinterest -->
|
343 |
+
<a href="http://pinterest.com/pin/create/button/?url=<?php echo $url; ?>&description=<?php echo $title_text; ?>&media=<?php echo $image; ?>" target="_blank"
|
344 |
class="share-btn pinterest-p">
|
345 |
<i class="fa fa-pinterest-p"><span>Pinterest</span></i>
|
346 |
</a>
|
349 |
<i class="fa fa-vk"><span>VK</span></i>
|
350 |
</a>
|
351 |
<!-- Email -->
|
352 |
+
<a href="mailto:?subject=<?php echo $title; ?>&body=<?php echo $mailbody; ?>" target="_blank" class="share-btn email">
|
353 |
<i class="fa fa-envelope"><span>Email</span></i>
|
354 |
</a>
|
355 |
</div>
|
template/single.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
* @var $gmGallery
|
15 |
*/
|
16 |
$type = explode('/', $gmedia->mime_type, 2);
|
17 |
-
if
|
18 |
<div class="single-view type-image">
|
19 |
<img class="gmedia-image" src="<?php echo $gmCore->gm_get_media_image($gmedia->ID); ?>">
|
20 |
|
@@ -24,7 +24,7 @@
|
|
24 |
<div class="image-description"><?php echo wpautop($gmedia->description); ?></div>
|
25 |
</div>
|
26 |
</div>
|
27 |
-
<?php } else
|
28 |
<div class="single-view type-download type-<?php echo $type[0]; ?>">
|
29 |
<img class="gmedia-image" src="<?php echo $gmCore->gm_get_media_image($gmedia->ID); ?>">
|
30 |
|
14 |
* @var $gmGallery
|
15 |
*/
|
16 |
$type = explode('/', $gmedia->mime_type, 2);
|
17 |
+
if('image' == $type[0]){ ?>
|
18 |
<div class="single-view type-image">
|
19 |
<img class="gmedia-image" src="<?php echo $gmCore->gm_get_media_image($gmedia->ID); ?>">
|
20 |
|
24 |
<div class="image-description"><?php echo wpautop($gmedia->description); ?></div>
|
25 |
</div>
|
26 |
</div>
|
27 |
+
<?php } else{ ?>
|
28 |
<div class="single-view type-download type-<?php echo $type[0]; ?>">
|
29 |
<img class="gmedia-image" src="<?php echo $gmCore->gm_get_media_image($gmedia->ID); ?>">
|
30 |
|
uninstall.php
CHANGED
@@ -26,7 +26,7 @@ if(function_exists('is_multisite') && is_multisite()) {
|
|
26 |
|
27 |
/**
|
28 |
* Uninstall all settings and tables
|
29 |
-
* Called via Setup
|
30 |
*
|
31 |
* @access internal
|
32 |
* @return void
|
@@ -68,6 +68,7 @@ function gmedia_uninstall() {
|
|
68 |
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}gmedia_term");
|
69 |
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}gmedia_term_meta");
|
70 |
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}gmedia_term_relationships");
|
|
|
71 |
|
72 |
delete_metadata('post', 0, '_gmedia_image_id', '', true);
|
73 |
}
|
@@ -100,6 +101,7 @@ function gmedia_uninstall() {
|
|
100 |
delete_option('GmediaHashID_salt');
|
101 |
delete_metadata('user', 0, 'gm_screen_options', '', true);
|
102 |
wp_clear_scheduled_hook('gmedia_app_cronjob');
|
|
|
103 |
|
104 |
if(empty($upload['error'])) {
|
105 |
if('all' == $options['uninstall_dropdata']) {
|
26 |
|
27 |
/**
|
28 |
* Uninstall all settings and tables
|
29 |
+
* Called via Setup hook
|
30 |
*
|
31 |
* @access internal
|
32 |
* @return void
|
68 |
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}gmedia_term");
|
69 |
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}gmedia_term_meta");
|
70 |
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}gmedia_term_relationships");
|
71 |
+
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}gmedia_log");
|
72 |
|
73 |
delete_metadata('post', 0, '_gmedia_image_id', '', true);
|
74 |
}
|
101 |
delete_option('GmediaHashID_salt');
|
102 |
delete_metadata('user', 0, 'gm_screen_options', '', true);
|
103 |
wp_clear_scheduled_hook('gmedia_app_cronjob');
|
104 |
+
wp_clear_scheduled_hook('gmedia_modules_update');
|
105 |
|
106 |
if(empty($upload['error'])) {
|
107 |
if('all' == $options['uninstall_dropdata']) {
|