first commit

This commit is contained in:
2024-07-15 11:28:08 +02:00
commit f52d538ea5
21891 changed files with 6161164 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<?php
/*
* Name: Giphy
* Section: content
* Description: Add a Giphy image
*
*/
/* @var $options array */
/* @var $wpdb wpdb */
$default_options = array(
'view'=>'View online',
'text'=>'Few words summary',
'block_background'=>'#ffffff',
'font_family'=>$font_family,
'font_size'=>13,
'color'=>'#999999',
'block_padding_top'=>15,
'block_padding_bottom'=>15,
'block_padding_left'=>0,
'block_padding_right'=>0
);
$options = array_merge($default_options, $options);
?>
<table width="100%" border="0" cellpadding="0" align="center" cellspacing="0">
<tr>
<td width="100%" valign="top" align="center">
<img src="<?php echo $options['giphy_url'] ?>" style="max-width: 100%!important; height: auto!important;" />
</td>
</tr>
</table>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -0,0 +1,50 @@
<?php
/*
* @var $options array contains all the options the current block we're ediging contains
* @var $controls NewsletterControls
*/
?>
<?php $fields->text('q', __('Search')) ?>
<div style="clear: both; max-height: 300px; overflow: scroll; margin-bottom: 15px" id="tnp-giphy-results"></div>
<?php $controls->hidden('giphy_url') ?>
<div id="giphy-preview">
<?php if (!empty($controls->data['giphy_url'])) { ?>
<img src="<?php echo esc_attr($controls->data['giphy_url'])?>" style="max-width: 300px">
<?php } ?>
</div>
<?php $fields->block_commons() ?>
<script type="text/javascript">
function choose_gif(url) {
//jQuery("#tnp-giphy-results").html("");
jQuery("#options-giphy_url").val(url);
jQuery("#giphy-preview").html('<img src="' + url + '" style="max-width: 300px">');
jQuery("#options-giphy_url").trigger("change");
}
jQuery("#options-q").keyup(
function () {
if (typeof(tid) != "undefined") {
window.clearTimeout(tid);
}
tid = window.setTimeout(function () {
var rating = "r";
var limit = 20;
var offset = 0;
jQuery.get("https://api.giphy.com/v1/gifs/search", {limit: limit, rating: rating, api_key: "57FLbVJJd7oQBZ0fEiRnzhM2VtZp5OP1", q: jQuery("#options-q").val()}, function (data) {
jQuery("#tnp-giphy-results").html("");
jQuery.each(data.data, function (index, value) {
jQuery("#tnp-giphy-results").append('<div style="overflow: hidden; width: 120px; height: 120px; float: left; margin: 5px"><img src="' + value.images.fixed_width_small.url + '" onclick="choose_gif(\'' + value.images.fixed_height.url + '\')" style="float:left; max-width: 100%"></div>');
});
}, "json");
}, 500);
});
jQuery("#options-q").trigger('keyup');
</script>