public static function _action_get_oembed_response()
 {
     if (wp_verify_nonce(FW_Request::POST('_nonce'), '_action_get_oembed_response')) {
         $url = FW_Request::POST('url');
         $width = FW_Request::POST('preview/width');
         $height = FW_Request::POST('preview/height');
         $keep_ratio = FW_Request::POST('preview/keep_ratio') === 'true';
         $iframe = empty($keep_ratio) ? fw_oembed_get($url, compact('width', 'height')) : wp_oembed_get($url, compact('width', 'height'));
         wp_send_json_success(array('response' => $iframe));
     }
     wp_send_json_error(array('message' => 'Invalid nonce'));
 }
示例#2
0
    ?>
	<script type="text/javascript">
		jQuery('document').ready(function () {
			jQuery('.bxslider').bxSlider();
		});
	</script>
	<ul class="bxslider">
		<?php 
    foreach ($data['slides'] as $slide) {
        ?>
			<li>
				<?php 
        if ($slide['multimedia_type'] === 'video') {
            ?>
					<?php 
            echo fw_oembed_get($slide['src'], $dimensions);
            ?>
				<?php 
        } else {
            ?>
					<img src="<?php 
            echo fw_resize($slide['src'], $dimensions['width'], $dimensions['height'], true);
            ?>
"
					     alt="<?php 
            echo $slide['title'];
            ?>
" width="<?php 
            echo $dimensions['width'];
            ?>
"
示例#3
0
<?php

if (!defined('FW')) {
    die('Forbidden');
}
$wrapper_attr = $option['attr'];
$wrapper_attr['data-nonce'] = wp_create_nonce('_action_get_oembed_response');
$wrapper_attr['data-preview'] = json_encode($option['preview']);
unset($wrapper_attr['value'], $wrapper_attr['name'], $wrapper_attr['placeholder']);
$input_attr['value'] = $data['value'];
$input_attr['name'] = $option['attr']['name'];
$input_attr['placeholder'] = $option['attr']['placeholder'];
?>
<div <?php 
echo fw_attr_to_html($wrapper_attr);
?>
>

	<div class="fw-oembed-input">
		<input type="text" <?php 
echo fw_attr_to_html($input_attr);
?>
/>
	</div>
	<div class="fw-oembed-preview">
		<?php 
$iframe = empty($option['preview']['keep_ratio']) ? fw_oembed_get($data['value'], array('height' => $option['preview']['height'], 'width' => $option['preview']['width'])) : wp_oembed_get($data['value'], array('height' => $option['preview']['height'], 'width' => $option['preview']['width']));
echo $iframe;
?>
	</div>
</div>