/**
  * @param $output
  *
  * @since 4.3
  *
  * @return mixed|string
  */
 public function renderShortcodes($output)
 {
     $output = str_replace('][jwplayer', '] [jwplayer', $output);
     // fixes jwplayer shortcode regex..
     $data = JWP6_Shortcode::the_content_filter($output);
     preg_match_all('/(jwplayer-\\d+)/', $data, $matches);
     $pairs = array_unique($matches[0]);
     if (count($pairs) > 0) {
         $id_zero = time();
         foreach ($pairs as $pair) {
             $data = str_replace($pair, 'jwplayer-' . $id_zero++, $data);
         }
     }
     return $data;
 }
 public static function register_actions()
 {
     register_activation_hook(JWP6_PLUGIN_FILE, array("JWP6_Plugin", "activate_plugin"));
     register_deactivation_hook(JWP6_PLUGIN_FILE, array("JWP6_Plugin", "deactivate_plugin"));
     if (!is_admin()) {
         JWP6_Shortcode::add_filters();
         add_filter('query_vars', array('JWP6_Plugin', 'register_query_vars'));
         add_action('parse_request', array('JWP6_Plugin', 'parse_request'), 9);
         add_action('wp_enqueue_scripts', array('JWP6_Plugin', 'insert_javascript'));
         add_action('wp_head', array('JWP6_Plugin', 'insert_license_key'));
         add_action('wp_head', array('JWP6_Plugin', 'insert_jwp6_load_event'));
     }
 }
 /**
  * Parses the attributes of the [jwplayer] tag.
  * @param array $matches The match array
  * @return string The code that should replace the tag.
  */
 public static function tag_parser($matches)
 {
     if ($matches[1] == "[" && $matches[6] == "]") {
         return substr($matches[0], 1, -1);
     }
     $param_regex = '/([\\w.]+)\\s*=\\s*"([^"]*)"(?:\\s|$)|([\\w.]+)\\s*=\\s*\'([^\']*)\'(?:\\s|$)|([\\w.]+)\\s*=\\s*([^\\s\'"]+)(?:\\s|$)|"([^"]*)"(?:\\s|$)|(\\S+)(?:\\s|$)/';
     $text = preg_replace("/[\\x{00a0}\\x{200b}]+/u", " ", $matches[3]);
     $text = preg_replace("/”|″/", "\"", preg_replace("/’|′/", "'", $text));
     $atts = array();
     if (preg_match_all($param_regex, $text, $match, PREG_SET_ORDER)) {
         foreach ($match as $p_match) {
             if (!empty($p_match[1])) {
                 $atts[$p_match[1]] = stripcslashes($p_match[2]);
             } elseif (!empty($p_match[3])) {
                 $atts[$p_match[3]] = stripcslashes($p_match[4]);
             } elseif (!empty($p_match[5])) {
                 $atts[$p_match[5]] = stripcslashes($p_match[6]);
             } elseif (isset($p_match[7]) and strlen($p_match[7])) {
                 $atts[] = stripcslashes($p_match[7]);
             } elseif (isset($p_match[8])) {
                 $atts[] = stripcslashes($p_match[8]);
             }
         }
     } else {
         $atts = ltrim($text);
     }
     $shortcode = new JWP6_Shortcode($atts);
     return $matches[1] . $shortcode->embedcode() . $matches[6];
 }
Esempio n. 4
0
function get_html5_video($video)
{
    if (class_exists('JWP6_Shortcode')) {
        echo JWP6_Shortcode::the_content_filter($video);
    }
}
// Include the necessary admin stuff.
require_once '../../../../wp-load.php';
require_once '../../../../wp-admin/includes/admin.php';
if (!current_user_can('administrator') && !current_user_can('editor') && !current_user_can('contributor')) {
    exit;
}
//global $wp_version;
define('MEDIA_MANAGER_35', version_compare($wp_version, '3.5', '>='));
require_once JWP6_PLUGIN_DIR . '/jwp6-class-plugin.php';
require_once JWP6_PLUGIN_DIR . '/jwp6-class-media.php';
require_once JWP6_PLUGIN_DIR . '/jwp6-class-shortcode.php';
$jwp6m = new JWP6_Media();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if ($_POST[JWP6 . 'mediaid'] || $_POST[JWP6 . 'file'] || $_POST[JWP6 . 'playlistid']) {
        $shortcode = new JWP6_Shortcode();
        media_send_to_editor($shortcode->shortcode());
        exit;
    } else {
        $no_video_error = true;
    }
}
?>
<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" href="<?php 
echo JWP6_PLUGIN_URL;
?>
Esempio n. 6
0
<?php

// Include the necessary admin stuff.
require_once '../../../../wp-load.php';
require_once '../../../../wp-admin/includes/admin.php';
// Only for logged in users.
if (!current_user_can('administrator') && !current_user_can('editor') && !current_user_can('contributor')) {
    exit;
}
// Call parameter is compulsory
if (!($call = $_GET['call'])) {
    exit;
}
require_once JWP6_PLUGIN_DIR . '/jwp6-class-plugin.php';
require_once JWP6_PLUGIN_DIR . '/jwp6-class-media.php';
require_once JWP6_PLUGIN_DIR . '/jwp6-class-shortcode.php';
if ('embedcode' == $call) {
    $sc = new JWP6_Shortcode();
    echo $sc->embedcode();
    exit;
}
 public static function media_send_to_editor($html, $send_id, $attachment)
 {
     if (isset($_POST['attachment']) && isset($_POST['action']) && $_POST['action'] == 'send-attachment-to-editor' && isset($_POST['attachment'][JWP6 . 'insert_jwplayer'])) {
         $shortcode = new JWP6_Shortcode(null, $_POST['attachment']);
     } else {
         if (isset($_POST['send'][$send_id]) && isset($_POST['attachments'][$send_id][JWP6 . 'insert_with_player'])) {
             $player_name = $_POST['attachments'][$send_id][JWP6 . 'insert_with_player'] ? $_POST['attachments'][$send_id][JWP6 . 'insert_with_player'] : 0;
             $shortcode = new JWP6_Shortcode(null, array('player_name' => $player_name, 'mediaid' => $send_id));
         }
     }
     if (isset($shortcode)) {
         return $shortcode->shortcode();
     }
     return $html;
 }