This commit is contained in:
2026-04-26 23:47:49 +02:00
parent 1b95f03d1e
commit b073e009d8
5288 changed files with 1112699 additions and 55536 deletions

View File

@@ -0,0 +1,39 @@
<?php
if (!defined('ABSPATH')) exit;
function elfsight_youtube_gallery_get_api_key(){
return get_option('elfsight_youtube_gallery_api_key', '');
}
if (is_array($elfsight_youtube_gallery_config['settings']) && is_array($elfsight_youtube_gallery_config['preferences'])) {
array_push($elfsight_youtube_gallery_config['settings']['properties'], array(
'id' => 'key',
'name' => esc_html__('API key'),
'type' => 'hidden',
'defaultValue' => elfsight_youtube_gallery_get_api_key()
));
}
function elfsight_youtube_gallery_shortcode_options_filter($options) {
$apiKey = get_option('elfsight_youtube_gallery_api_key', '');
if (is_array($options)) {
$options['key'] = $apiKey;
}
return $options;
}
add_filter('elfsight_youtube_gallery_shortcode_options', 'elfsight_youtube_gallery_shortcode_options_filter');
function elfsight_youtube_gallery_widget_options_filter($options_json) {
$options = json_decode($options_json, true);
if (is_array($options)) {
unset($options['key']);
}
return json_encode($options);
}
add_filter('elfsight_youtube_gallery_widget_options', 'elfsight_youtube_gallery_widget_options_filter');

View File

@@ -0,0 +1,5 @@
<?php
// Silence is golden ;)
?>

View File

@@ -0,0 +1,15 @@
<?php
function elfsight_youtube_gallery_db_migrate() {
global $wpdb;
$youtube_gallery_table_name = $wpdb->prefix . 'elfsight_youtube_gallery_widgets';
$yottie_table_name = $wpdb->prefix . 'elfsight_yottie_widgets';
$youtube_gallery_table_exist = !!$wpdb->get_var('SHOW TABLES LIKE "' . $youtube_gallery_table_name . '"');
$yottie_table_exist = !!$wpdb->get_var('SHOW TABLES LIKE "' . $yottie_table_name . '"');
if (!$youtube_gallery_table_exist && $yottie_table_exist) {
$wpdb->query('RENAME TABLE ' . $yottie_table_name . ' TO ' . $youtube_gallery_table_name . ';');
}
}

View File

@@ -0,0 +1,29 @@
<article class="elfsight-admin-page-api-key elfsight-admin-page" data-elfsight-admin-page-id="api-key">
<div class="elfsight-admin-page-api-key-container">
<form class="elfsight-admin-page-api-key-form">
<h4 class="elfsight-admin-page-api-key-form-title-connect elfsight-admin-page-api-key-form-title"><?php esc_html_e('Set your YouTube API Key', $this->textDomain); ?></h4>
<h4 class="elfsight-admin-page-api-key-form-title-success elfsight-admin-page-api-key-form-title"><?php esc_html_e('Your YouTube API Key', $this->textDomain); ?></h4>
<div class="elfsight-admin-page-api-key-form-description-wrapper">
<p class="elfsight-admin-page-api-key-form-description elfsight-admin-page-api-key-form-description-connect">
<?php esc_html_e('You have to create your own YouTube API key to use YouTube Gallery widget.', $this->textDomain); ?>
<br><br>
<?php esc_html_e('The following tutorial explains the easy steps to get your YouTube API key: ', $this->textDomain); ?>
<br><br>
<a target="_blank" href="<?php echo esc_url('https://codecanyon.elfsight.com/article/562-how-to-get-youtube-api-key') ?>">
<?php esc_html_e('How to get YouTube API key', $this->textDomain); ?>
</a>
</p>
<span class="elfsight-admin-page-api-key-form-description elfsight-admin-page-api-key-form-description-success">
<?php esc_html_e('You have set a YouTube API Key and your plugin is working correctly now.', $this->textDomain); ?>
</span>
</div>
<input class="elfsight-admin-page-api-key-form-input" value="<?php echo elfsight_youtube_gallery_get_api_key(); ?>" data-nonce="<?php echo wp_create_nonce('elfsight_youtube_gallery_update_api_key_nonce'); ?>" type="text" placeholder="<?php esc_html_e('YouTube API Key', $this->textDomain); ?>">
<a class="elfsight-admin-button elfsight-admin-button-large elfsight-admin-button-green elfsight-admin-page-api-key-form-button elfsight-admin-page-api-key-form-button-connect" href="javascript:void(0)"><?php esc_html_e('Save API key', $this->textDomain); ?></a>
<div class="elfsight-admin-page-api-key-form-reload"><?php esc_html_e('This page will be reload at few seconds..', $this->textDomain); ?></div>
</form>
</div>
</article>

View File

@@ -0,0 +1,5 @@
<?php
// Silence is golden ;)
?>