Skip to content

Instantly share code, notes, and snippets.

Created Mar 13, 2016
What would you like to do?
【WordPress】WordPressのビジュアルエディタにフリッカーの画像検索ができるボタンを追加するプラグイン Raw
require '../../../wp-admin/admin.php';
if (!is_admin())
$tags = ($_POST["tags"]) ? $_POST["tags"] : "";
$url = sprintf("", urlencode($tags));
$options = array(
"http" => array(
"method" => "GET",
"header" => "User-Agent: wordpress-tinymce-flickr"
$context = stream_context_create($options);
$feed = file_get_contents($url, false, $context);
$feed = simplexml_load_string($feed);
<link rel="stylesheet" href="">
<body id="hatebu">
<div class="container-fluid" style="padding:15px;">
<form class="form-inline" method="post" action="dialog.php">
<div class="form-group">
<input class="form-control" type="text" name="tags" value="<?php echo esc_html($tags); ?>" />
<?php foreach ($feed->entry as $entry): ?>
<div class="well">
<?php echo $entry->content;?>
<div class="text-right"><button class="btn btn-primary" data-url="<?php echo $url; ?>" onClick="insert('<?php echo $entry->link['href'];?>')">挿入</button></div>
<?php endforeach; ?>
<script type="text/javascript">
function insert(url) {
top.tinymce.activeEditor.execCommand('mceInsertContent', false, url);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment