settings = require($config_path); } $this->settings['view_path'] = realpath(AOPP_AOPLAYER_DIR) . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR; } /** * getAdmin() */ public function wpPlayer() { for ($i=1; $i<=10; $i++){ add_shortcode('aopp-player-'.$i, [$this, 'aopp_player']); } } /** * aopp_player() */ public function aopp_player($player, $source = null, $tag) { self::resourceRegistration(); $player = shortcode_atts([ 'showplaylist' => $this->settings['player']['showplaylist'], 'width' => $this->settings['player']['width'], 'height' => $this->settings['player']['height'], 'controls' => $this->settings['player']['controls'], 'preload' => $this->settings['player']['preload'], 'contenttype' => $this->settings['player']['contenttype'], 'playlistposition' => $this->settings['player']['playlistposition'], 'autoplay' => $this->settings['player']['autoplay'], 'orderbutton' => $this->settings['player']['orderbutton'], 'orderbuttonposition' => $this->settings['player']['orderbuttonposition'], 'orderbuttonlink' => $this->settings['player']['orderbuttonlink'], 'orderbuttontitle' => $this->settings['player']['orderbuttontitle'], 'orderbuttoncolor' => $this->settings['player']['orderbuttoncolor'], 'orderbuttontime' => $this->settings['player']['orderbuttontime'], 'autoplaysound' => $this->settings['player']['autoplaysound'], 'orderbuttonfontsize' => $this->settings['player']['orderbuttonfontsize'], 'orderbuttonleft' => $this->settings['player']['orderbuttonleft'], 'orderbuttonright' => $this->settings['player']['orderbuttonright'], 'positionplayer' => $this->settings['player']['positionplayer'], ], $player); $source = self::parseSource($source); wp_enqueue_style('aopp_plugin_css'); wp_enqueue_style('aopp_plugin_playlist_css'); wp_enqueue_style('aopp_plugin_speed_css'); wp_enqueue_style('aopp_css'); $css = ''; if ($player['width']=='100%') { $css .= ' position: relative; width:100%; max-width:'.$player['width'].'; '; } else { $player['width'] = (int) $player['width']; $css .= ' position: relative; width:100%; max-width:'.$player['width'].'px; '; } if ($player['positionplayer']=='center') { $css .= ' margin:0 auto 0 auto; '; } elseif ($player['positionplayer']=='left') { $css .= ' margin:0 auto 0 0; '; } elseif ($player['positionplayer']=='right') { $css .= ' margin:0 0 0 auto; '; } $css = ' .aopp_wrap_video{ '.$css.' } .'.$tag.' iframe{ position: absolute; top: 0; left: 0; width: 100%; height: 100%; } '; $css .= ' @media (max-width: 767px) { .aopp_wrap_video{ min-width:280px; } .'.$tag.' iframe{ min-width:280px; } } '; if ($player['width']>768 || $player['width']=='100%') { $css .= ' @media (min-width: 768px) and (max-width: 1024px) { .aopp_wrap_video{ min-width:640px; } .'.$tag.' iframe{ min-width:640px; } } '; } wp_register_style('responsive-player', false); wp_enqueue_style('responsive-player'); wp_add_inline_style('responsive-player', $css); wp_enqueue_script('aopp_plugin_js'); wp_enqueue_script('aopp_plugin_localize_js'); wp_enqueue_script('aopp_plugin_playlist_js'); wp_enqueue_script('aopp_plugin_speed_js'); $showplaylist = 'data-showplaylist="false"'; $class_playlist = ''; $class_pl_position = ''; if ($player['showplaylist']=='true') { $class_playlist = 'mep-playlist'; $showplaylist = 'data-showplaylist="true"'; if ($player['playlistposition']=='top') { $class_pl_position = ''; } elseif ($player['playlistposition']=='left') { $class_pl_position = ''; } elseif ($player['playlistposition']=='right') { $class_pl_position = ''; } elseif ($player['playlistposition']=='bottom') { $class_pl_position = 'video_bottom'; } } /* $width = ' width="'.$this->settings['player']['width'].'" '; if (!empty($player['width'])) { $width = 'width="'.$player['width'].'"'; } $height = ''; if (!empty($player['height'])) { $height = 'height="'.$player['height'].'"'; } */ $controls = 'controls="'.$this->settings['player']['controls'].'"'; if ($player['controls']=='controls') { $controls = 'controls="controls"'; } $autoplay = ''; if ($player['autoplay']=='true') { $autoplay = ' autoplay muted '; } $preload = 'preload="'.$this->settings['player']['preload'].'"'; if (!empty($player['preload'])) { $preload = 'preload="'.$player['preload'].'"'; } $poster = ''; if (!empty($player['poster'])) { $poster = 'poster="'.$player['poster'].'"'; } if (empty($player['autoplaysound'])) { $player['autoplaysound'] = $this->settings['player']['autoplaysound']; } if (empty($player['orderbutton'])) { $player['orderbutton'] = $this->settings['player']['orderbutton']; } if (empty($player['orderbuttonposition'])) { $player['orderbuttonposition'] = $this->settings['player']['orderbuttonposition']; } if (empty($player['orderbuttonlink'])) { $player['orderbuttonlink'] = $this->settings['player']['orderbuttonlink']; } if (empty($player['orderbuttontitle'])) { $player['orderbuttontitle'] = $this->settings['player']['orderbuttontitle']; } if (empty($player['orderbuttoncolor'])) { $player['orderbuttoncolor'] = $this->settings['player']['orderbuttoncolor']; } if (empty($player['orderbuttontime'])) { $player['orderbuttontime'] = $this->settings['player']['orderbuttontime']; } if (empty($player['orderbuttonfontsize'])) { $player['orderbuttonfontsize'] = $this->settings['player']['orderbuttonfontsize']; } if (empty($player['orderbuttonleft'])) { $player['orderbuttonleft'] = $this->settings['player']['orderbuttonleft']; } if (empty($player['orderbuttonright'])) { $player['orderbuttonright'] = $this->settings['player']['orderbuttonright']; } add_action('print_footer_scripts', function() use ($player, $tag) { self::aoplayer_script($player, $tag); } ); if ($player['contenttype'] == 'video') { $html = ''; } elseif ($player['contenttype'] == 'audio') { $html = ''; } else { $html = ''; } return '