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,271 @@
<?php
if (!defined('ABSPATH')) exit;
require_once(plugin_dir_path(__FILE__) . '/includes/update.php');
require_once(plugin_dir_path(__FILE__) . '/includes/widgets-api.php');
require_once(plugin_dir_path(__FILE__) . '/includes/admin.php');
require_once(plugin_dir_path(__FILE__) . '/includes/widget.php');
require_once(plugin_dir_path(__FILE__) . '/includes/vc-element.php');
if (!class_exists('ElfsightYoutubeGalleryPlugin')) {
class ElfsightYoutubeGalleryPlugin {
private $name;
private $slug;
private $version;
private $textDomain;
private $editorSettings;
private $scriptUrl;
private $pluginFile;
private $pluginSlug;
private $updateUrl;
private $purchaseCode;
private $update;
private $widgetsApi;
private $admin;
private $widget;
private $vcElement;
private $isShortcodePresent;
public function __construct($config) {
$this->name = $config['name'];
$this->slug = $config['slug'];
$this->version = $config['version'];
$this->textDomain = $config['text_domain'];
$this->editorSettings = $config['editor_settings'];
$this->pluginFile = $config['plugin_file'];
$this->pluginSlug = $config['plugin_slug'];
$this->scriptUrl = plugins_url("assets/{$this->slug}.js", $this->pluginFile);
$this->updateUrl = $config['update_url'];
$this->purchaseCode = get_option($this->getOptionName('purchase_code'), '');
$this->update = new ElfsightYoutubeGalleryPluginUpdate($this->updateUrl, $this->version, $this->pluginSlug, $this->purchaseCode);
$this->widgetsApi = new ElfsightYoutubeGalleryWidgetsApi($this->slug, $this->pluginFile, $this->textDomain);
$this->admin = new ElfsightYoutubeGalleryPluginAdmin($config, $this->widgetsApi);
$this->widget = new ElfsightYoutubeGalleryWidget($config, $this->widgetsApi);
$this->vcElement = new ElfsightYoutubeGalleryVCElement($config, $this->widgetsApi);
add_action('wp_footer', array($this, 'printAssets'));
add_shortcode(str_replace('-', '_', $this->slug), array($this, 'addShortcode'));
add_action('plugin_action_links_' . $this->pluginSlug, array($this, 'addPluginActionLinks'));
add_action('widgets_init', array($this, 'registerWidget'));
add_action('init', array($this, 'initBlock'));
add_action('enqueue_block_editor_assets', array($this, 'enqueueBlockAssets'));
add_action('plugins_loaded', array($this, 'loadTextDomain'));
}
public function loadTextDomain() {
load_plugin_textdomain($this->textDomain, false, dirname(plugin_basename($this->pluginFile)) . '/languages/');
}
public function initBlock() {
if (function_exists('register_block_type')) {
register_block_type($this->slug.'/block', array(
'attributes' => array(
'id' => array(
'type' => 'number'
)
),
'render_callback' => array($this, 'addShortcode')
));
}
}
public function enqueueBlockAssets() {
if (function_exists('register_block_type')) {
wp_enqueue_script($this->slug . '-block-editor', plugins_url('assets/elfsight-block.js', $this->pluginFile), array(), $this->version, true);
wp_enqueue_style($this->slug . '-block-editor', plugins_url('assets/elfsight-block.css', $this->pluginFile), array(), $this->version);
wp_enqueue_script($this->slug, $this->scriptUrl, array($this->slug . '-block-editor'), $this->version, true);
}
}
public function printAssets() {
$force_script_add = get_option($this->getOptionName('force_script_add'));
if ($this->isShortcodePresent || $force_script_add === 'on') {
$uploads_dir_params = wp_upload_dir();
$uploads_dir = $uploads_dir_params['basedir'] . '/' . $this->slug;
$uploads_url = $this->checkUrlSertificate($uploads_dir_params['baseurl'] . '/' . $this->slug);
$custom_css_path = $uploads_dir . '/' . $this->slug . '-custom.css';
$custom_js_path = $uploads_dir . '/' . $this->slug . '-custom.js';
wp_enqueue_script($this->slug, $this->checkUrlSertificate($this->scriptUrl), array(), $this->version);
if (is_readable($custom_js_path) && filesize($custom_js_path) > 0) {
wp_enqueue_script($this->slug . '-custom', $uploads_url . '/' . $this->slug . '-custom.js', array(), $this->version);
}
if (is_readable($custom_css_path) && filesize($custom_css_path) > 0) {
wp_enqueue_style($this->slug . '-custom', $uploads_url . '/' . $this->slug . '-custom.css', array(), $this->version);
}
}
}
public function checkUrlSertificate($url) {
return is_ssl() ? str_replace('http://', 'https://', $url) : $url;
}
public function recursiveDefaults($properties, $defaults){
foreach($properties as $property) {
if (isset($property['type']) && $property['type'] == 'subgroup') {
$defaults = $this->recursiveDefaults($property['subgroup']['properties'], $defaults);
} else {
$defaultValue = null;
if (isset($property['defaultValue'])) {
$defaultValue = $property['defaultValue'];
}
if (isset($property['id'])) {
$defaults[$property['id']] = $defaultValue;
}
}
}
return $defaults;
}
public function addShortcode($atts) {
$this->isShortcodePresent = true;
$atts = $atts ? $this->formatAtts($atts) : $atts;
$widget_id = !empty($atts['id']) ? $atts['id'] : null;
$defaults = $this->recursiveDefaults($this->editorSettings['properties'], array());
if (!empty($widget_id)) {
$widget_options = $this->getWidgetOptions($widget_id);
if (!$widget_options) {
return '';
}
$atts = array_combine(
array_merge(array_keys($widget_options), array_keys($atts)),
array_merge(array_values($widget_options), array_values($atts))
);
}
$options = shortcode_atts($defaults, $atts, str_replace('-', '_', $this->slug));
$options = apply_filters($this->getOptionName('shortcode_options'), $options, $widget_id);
$options['widgetId'] = $widget_id;
$options_string = rawurlencode(json_encode($options));
$version = $this->version;
$result = '
<div
class="elfsight-widget-' . esc_html(str_replace('elfsight-', '', $this->slug)) . ' elfsight-widget"
data-' . esc_html($this->slug) . '-options="' . esc_html($options_string) . '"
data-' . esc_html($this->slug) . '-version="' . esc_html($version) . '"
data-elfsight-widget-id="' . esc_html($this->slug . '-' . $widget_id) . '">
</div>
';
return $result;
}
public function formatAtts($atts) {
$attsKey['true'] = array_keys($atts, 'true', true);
$attsKey['false'] = array_keys($atts, 'false', true);
if (!empty($attsKey['true']) || !empty($attsKey['false'])) {
foreach ($attsKey as $bool => $arKey) {
foreach ($arKey as $key) {
if ($bool == 'false') {
$atts[$key] = false;
} else {
$atts[$key] = true;
}
}
}
unset($attsKey);
}
if (!function_exists('dashesToCamelCase')) {
function dashesToCamelCase($string, $capitalizeFirstCharacter = false) {
$string = preg_replace_callback('/_[a-zA-Z]/', 'capitalize', $string);
$string = preg_replace_callback('/-[a-zA-Z]/', 'capitalize', $string);
return $string;
}
}
if (!function_exists('capitalize')) {
function capitalize($matches) {
return strtoupper($matches[0][1]);
}
}
foreach ($atts as $key => $value) {
$atts[dashesToCamelCase($key)] = $value;
}
return $atts;
}
function registerWidget() {
if (!empty($this->widget)) {
if (!get_option($this->getOptionName('widget_hash'))) {
register_widget($this->widget);
add_option($this->getOptionName('widget_hash'), spl_object_hash($this->widget));
} else {
global $wp_widget_factory;
$wp_widget_factory->widgets[get_option($this->getOptionName('widget_hash'))] = $this->widget;
}
}
}
public function addPluginActionLinks($links) {
$links[] = '<a href="' . esc_url(admin_url('admin.php?page=' . $this->slug)) . '">Settings</a>';
$links[] = '<a href="http://codecanyon.net/user/elfsight/portfolio?ref=Elfsight" target="_blank">More plugins by Elfsight</a>';
return $links;
}
private function getWidgetOptions($id) {
global $wpdb;
$id = intval($id);
$widgets_table_name = $this->widgetsApi->getTableName();
$item = $wpdb->get_row($wpdb->prepare(
"SELECT options FROM $widgets_table_name WHERE `id` = %d AND `active` = %d",
esc_sql($id),
esc_sql(1)
), ARRAY_A);
if (!empty($item) && !empty($item['options'])) {
$options = json_decode($item['options'], true);
}
else {
$options = null;
}
return $options;
}
private function getOptionName($name) {
return str_replace('-', '_', $this->slug) . '_' . $name;
}
}
}
?>

View File

@@ -0,0 +1,463 @@
<?php
if (!defined('ABSPATH')) exit;
if (!class_exists('ElfsightYoutubeGalleryPluginAdmin')) {
class ElfsightYoutubeGalleryPluginAdmin {
private $name;
private $description;
private $slug;
private $version;
private $textDomain;
private $editorSettings;
private $editorPreferences;
private $menuIcon;
private $menuId;
private $pluginName;
private $pluginFile;
private $updateUrl;
private $previewUrl;
private $observerUrl;
private $productUrl;
private $productReviewUrl;
private $productFacebookReviewUrl;
private $helpscoutId;
private $widgetsApi;
private $user;
private $capability;
private $roleCapabitily = array(
'admin' => 'manage_options',
'editor' => 'edit_pages',
'author' => 'publish_posts'
);
private $pages;
private $customPages;
private $menu;
public function __construct($config, $widgetsApi) {
$this->name = $config['name'];
$this->description = $config['description'];
$this->slug = $config['slug'];
$this->version = $config['version'];
$this->textDomain = $config['text_domain'];
$this->editorSettings = $config['editor_settings'];
$this->editorPreferences = $config['editor_preferences'];
$this->menuIcon = $config['menu_icon'];
$this->pluginName = $config['plugin_name'];
$this->pluginFile = $config['plugin_file'];
$this->updateUrl = $config['update_url'];
$this->previewUrl = (isset($config['preview_url']) ? $config['preview_url'] : plugins_url('preview/preview.html', $this->pluginFile)) . "?v={$this->version}";
$this->observerUrl = (isset($config['observer_url']) ? $config['observer_url'] : plugins_url('preview/observer.js', $this->pluginFile)) . "?v={$this->version}";
$this->customScriptUrl = !empty($config['admin_custom_script_url']) ? $config['admin_custom_script_url'] : null;
$this->customStyleUrl = !empty($config['admin_custom_style_url']) ? $config['admin_custom_style_url'] : null;
$this->productUrl = $config['product_url'];
$this->productReviewUrl = 'https://codecanyon.net/downloads';
$this->productFacebookReviewUrl = 'https://www.facebook.com/pg/elfsight/reviews/';
$this->helpscoutSubmitUrl = 'https://elfsight.com/service/helpscout-codecanyon/api/submit/';
$this->helpscoutPluginId = $config['helpscout_plugin_id'];
$this->checkSupportExpiredUrl = 'https://elfsight.com/service/helpscout-codecanyon/api/check-support/';
$this->capability = apply_filters('elfsight_admin_capability', $this->roleCapabitily[get_option($this->getOptionName('access_role'), 'admin')]);
$this->customPages = !empty($config['admin_custom_pages']) ? $config['admin_custom_pages'] : array();
$this->pages = $this->generatePages();
$this->menu = $this->generateMenu();
$this->widgetsApi = $widgetsApi;
add_action('admin_menu', array($this, 'addMenuPage'));
add_action('admin_init', array($this, 'getUser'));
add_action('admin_init', array($this, 'registerAssets'));
add_action('admin_enqueue_scripts', array($this, 'enqueueAssets'));
add_action('rest_api_init', array($this, 'registerRoutes'));
}
public function registerRoutes() {
register_rest_route($this->slug, '/admin/(?P<endpoint>[\w-]+)', array(
'methods' => 'GET, POST',
'callback' => array($this, 'restApi'),
'permission_callback' => '__return_true',
'args' => array(
'endpoint' => array(
'required' => true
)
)
));
}
public function restApi(WP_REST_Request $request) {
$result = array();
$endpoint = $request->get_param('endpoint');
$endpoint_handler_name = lcfirst(str_replace('-', '', ucwords($endpoint, '-')));
if (!wp_verify_nonce($request->get_header('X-WP-Nonce'), 'wp_rest')) {
$this->response(array(
'status' => false,
'error' => __('Scrape nonce check failed. Please try again.')
));
}
if (!method_exists($this, $endpoint_handler_name)) {
$this->apiResponse(array(
'status' => false,
'error' => sprintf('Unknown endpoint "%s"', $endpoint_handler_name)
));
}
call_user_func_array(array($this, $endpoint_handler_name), array(&$result));
$this->apiResponse($result);
}
public function apiResponse($result) {
if (ob_get_length()) {
ob_end_clean();
ob_start();
}
header('Content-type: application/json; charset=utf-8');
echo json_encode($result);
exit;
}
public function addMenuPage() {
$this->menuId = add_menu_page($this->name, $this->name, $this->capability, $this->slug, array($this, 'getPage'), $this->menuIcon);
}
public function getUser() {
$user = wp_get_current_user();
$domain = str_replace('www.', '', parse_url(site_url(), PHP_URL_HOST));
$domain_id = str_replace('.', '-', $domain);
$this->domainId = $domain_id;
$this->user = array(
'id' => $user->ID,
'public_id' => $domain_id . '-' . $user->ID,
'email' => $user->user_email,
'display_name' => $user->display_name,
);
}
public function registerAssets() {
wp_register_style($this->slug . '-admin', plugins_url('assets/elfsight-admin.css', $this->pluginFile), array(), $this->version);
wp_register_script($this->slug . '-admin', plugins_url('assets/elfsight-admin.js', $this->pluginFile), array('jquery', 'wp-api'), $this->version, true);
wp_register_script($this->slug . '-editor', plugins_url('assets/elfsight-editor.js', $this->pluginFile), array($this->slug . '-angular', $this->slug . '-angular-slider'), $this->version, true);
wp_register_script($this->slug . '-signals', plugins_url('assets/vendors/signals.min.js', $this->pluginFile), array(), null, true);
wp_register_script($this->slug . '-crossroads', plugins_url('assets/vendors/crossroads.min.js', $this->pluginFile), array(), null, true);
wp_register_script($this->slug . '-jquery-tablesorter', plugins_url('assets/vendors/jquery.tablesorter.min.js', $this->pluginFile), array(), null, true);
wp_register_script($this->slug . '-clipboard', plugins_url('assets/vendors/clipboard.min.js', $this->pluginFile), array(), null, true);
wp_register_script($this->slug . '-hasher', plugins_url('assets/vendors/hasher.min.js', $this->pluginFile), array(), null, true);
wp_register_script($this->slug . '-ace', plugins_url('assets/vendors/ace/ace.js', $this->pluginFile), array(), null, true);
wp_register_script($this->slug . '-angular', plugins_url('assets/vendors/angular.min.js', $this->pluginFile), array(), null, true);
wp_register_script($this->slug . '-angular-slider', plugins_url('assets/vendors/rzslider.min.js', $this->pluginFile), array(), null, true);
if ($this->customStyleUrl) {
wp_register_style($this->slug . '-admin-custom', $this->customStyleUrl, array($this->slug . '-admin'), $this->version);
}
if ($this->customScriptUrl) {
wp_register_script($this->slug . '-admin-custom', $this->customScriptUrl, array($this->slug . '-admin'), $this->version, true);
}
}
public function enqueueAssets($hook) {
if ($hook && $hook == $this->menuId) {
wp_enqueue_style($this->slug . '-admin');
if ($this->customStyleUrl) {
wp_enqueue_style($this->slug . '-admin-custom');
}
wp_enqueue_script($this->slug . '-angular');
wp_enqueue_script($this->slug . '-angular-slider');
wp_enqueue_script($this->slug . '-signals');
wp_enqueue_script($this->slug . '-crossroads');
wp_enqueue_script($this->slug . '-jquery-tablesorter');
wp_enqueue_script($this->slug . '-clipboard');
wp_enqueue_script($this->slug . '-hasher');
wp_enqueue_script($this->slug . '-ace');
wp_enqueue_script($this->slug . '-editor');
wp_enqueue_script($this->slug . '-admin');
if ($this->customScriptUrl) {
wp_enqueue_script($this->slug . '-admin-custom');
}
wp_enqueue_media();
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action('admin_print_scripts', 'print_emoji_detection_script');
remove_action('admin_print_styles', 'print_emoji_styles');
}
}
public function getPage() {
$this->widgetsApi->upgrade();
$widgets_clogged = get_option($this->getOptionName('widgets_clogged'), '');
$uploads_dir_params = wp_upload_dir();
$uploads_dir = $uploads_dir_params['basedir'] . '/' . $this->slug;
$custom_css_path = $uploads_dir . '/' . $this->slug . '-custom.css';
$custom_js_path = $uploads_dir . '/' . $this->slug . '-custom.js';
$preferences_custom_css = is_readable($custom_css_path) ? file_get_contents($custom_css_path) : '';
$preferences_custom_js = is_readable($custom_js_path) ? file_get_contents($custom_js_path) : '';
$preferences_force_script_add = get_option($this->getOptionName('force_script_add'));
$preferences_access_role = get_option($this->getOptionName('access_role'), 'admin');
$preferences_auto_upgrade = get_option($this->getOptionName('auto_upgrade'), 'on');
$purchase_code = get_option($this->getOptionName('purchase_code'), '');
$activated = get_option($this->getOptionName('activated'), '') === 'true';
$supported_until = get_option($this->getOptionName('supported_until'), 0);
$latest_version = get_option($this->getOptionName('latest_version'), '');
$last_check_datetime = get_option($this->getOptionName('last_check_datetime'), '');
$has_new_version = !empty($latest_version) && version_compare($this->version, $latest_version, '<');
$host = parse_url(site_url(), PHP_URL_HOST);
$last_upgraded_at = get_option($this->getOptionName('last_upgraded_at'));
$activation_css_classes = array();
if ($activated) {
array_push($activation_css_classes, 'elfsight-admin-activation-activated');
} else if (!empty($purchase_code)) {
array_push($activation_css_classes, 'elfsight-admin-activation-invalid');
}
if ($has_new_version) {
array_push($activation_css_classes, 'elfsight-admin-activation-has-new-version');
}
?>
<div class="<?= implode(' ', $activation_css_classes); ?> elfsight-admin wrap">
<h2 class="elfsight-admin-wp-notifications-hack"></h2>
<script>
window.pluginParams = {
restApiUrl: '<?= rest_url($this->slug . '/admin') ?>',
slug: '<?= esc_html($this->slug); ?>',
user: '<?= json_encode($this->user, JSON_HEX_QUOT); ?>',
domainId: '<?= esc_html($this->domainId) ?>',
widgetsClogged: '<?= esc_html($widgets_clogged); ?>',
}
</script>
<div class="elfsight-admin-wrapper">
<?php require_once(plugin_dir_path(__FILE__) . implode(DIRECTORY_SEPARATOR, array('templates', 'header.php'))); ?>
<main class="elfsight-admin-main elfsight-admin-loading">
<div class="elfsight-admin-loader"></div>
<div class="elfsight-admin-menu-container">
<?php require_once(plugin_dir_path(__FILE__) . implode(DIRECTORY_SEPARATOR, array('templates', 'menu.php'))); ?>
<?php require_once(plugin_dir_path(__FILE__) . implode(DIRECTORY_SEPARATOR, array('templates', 'menu-actions.php'))); ?>
</div>
<div class="elfsight-admin-pages-container">
<?php
foreach ($this->pages as $page) {
require_once($page['template']);
}
?>
</div>
</main>
<?php
if (!get_option($this->getOptionName('rating_sent'))) {
require_once(plugin_dir_path(__FILE__) . implode(DIRECTORY_SEPARATOR, array('templates', 'popup-rating.php')));
}
?>
</div>
</div>
<?php }
public function updatePreferences(&$result) {
// options
if (isset($_REQUEST['option'])) {
$option = $_REQUEST['option'];
update_option($this->getOptionName($option['name']), $option['value']);
$result['success'] = true;
}
// custom css
if (isset($_REQUEST['preferences_custom_css'])) {
$file_type = 'css';
$file_content = $_REQUEST['preferences_custom_css'];
}
// custom js
if (isset($_REQUEST['preferences_custom_js'])) {
$file_type = 'js';
$file_content = $_REQUEST['preferences_custom_js'];
}
if (isset($file_content) && isset($file_type)) {
$uploads_dir_params = wp_upload_dir();
$uploads_dir = $uploads_dir_params['basedir'] . '/' . $this->slug;
if (!is_dir($uploads_dir)) {
wp_mkdir_p($uploads_dir);
}
$path = $uploads_dir . '/' . $this->slug . '-custom.' . $file_type;
if (file_exists($path) && !is_writable($path)) {
$result['success'] = false;
$result['error'] = esc_html__('The file can not be overwritten. Please check the file permissions.', $this->textDomain);
} else {
file_put_contents($path, stripslashes($file_content));
$result['success'] = true;
}
}
}
public function updateActivationData(&$result) {
update_option($this->getOptionName('purchase_code'), !empty($_REQUEST['purchase_code']) ? $_REQUEST['purchase_code'] : '');
update_option($this->getOptionName('activated'), !empty($_REQUEST['activated']) ? $_REQUEST['activated'] : '');
update_option($this->getOptionName('supported_until'), !empty($_REQUEST['supported_until']) ? $_REQUEST['supported_until'] : '');
$result['success'] = true;
}
public function ratingSend(&$result) {
$support_email = 'support@elfsight.com';
$subject = esc_html__('New rating for CodeCanyon', $this->textDomain);
$headers = 'From: ' . $_SERVER['SERVER_NAME'] . ' <' . get_option('admin_email') .'>' . "\r\n";
$headers .= 'Reply-To: ' . get_option('admin_email') . "\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
$value = $_REQUEST['value'];
$comment = $_REQUEST['comment'];
$productReviewsListUrl = preg_replace('/^(.*)\/(\d*)\?(.*)$/', '$1/reviews/$2', $this->productUrl);
$text = sprintf(
'<h1 style="color: %s;">%s</h1>',
$value === '5' ? 'green' : 'red',
$value === '5' ? esc_html__('Hooray!', $this->textDomain) : esc_html__('Warning!', $this->textDomain)
);
$text .= sprintf(
'<p>%s %s %s</p>',
esc_html__('New', $this->textDomain),
sprintf(
'<b style="font-size: 24px; color: %s;">%s %s</b>',
$value === '5' ? 'green' : 'red',
$value,
esc_html__('stars', $this->textDomain)
),
sprintf(
esc_html__('rating for %s on CodeCanyon', $this->textDomain),
$this->pluginName
)
);
if (!empty($comment)) {
$text .= sprintf(
'<p>%s: </p><blockquote><p>%s</p></blockquote>',
esc_html__('With comment', $this->textDomain),
$comment
);
}
if ($value === '5') {
$text .= '<hr>'. sprintf(
'<p>%s: %s</p>',
esc_html__('Check rating on Code Canyon', $this->textDomain),
sprintf(
'<a href="%s" target="_blank" rel="nofollow">%s</a>',
esc_url($productReviewsListUrl),
esc_url($productReviewsListUrl)
)
);
}
add_option($this->getOptionName('rating_sent'), 'true');
$status = wp_mail($support_email, $subject, $text, $headers);
$result['success'] = $status;
}
private function getOptionName($name) {
return str_replace('-', '_', $this->slug) . '_' . $name;
}
private function generatePages() {
$plugin_dir = plugin_dir_path(__FILE__);
$default_pages = array(
array(
'id' => 'welcome',
'template' => $plugin_dir . implode(DIRECTORY_SEPARATOR, array('templates', 'page-welcome.php'))
),
array(
'id' => 'widgets',
'menu_title' => translate('Widgets', $this->textDomain),
'template' => $plugin_dir . implode(DIRECTORY_SEPARATOR, array('templates', 'page-widgets.php'))
),
array(
'id' => 'edit-widget',
'template' => $plugin_dir . implode(DIRECTORY_SEPARATOR, array('templates', 'page-edit-widget.php'))
),
array(
'id' => 'preferences',
'menu_title' => translate('Preferences', $this->textDomain),
'template' => $plugin_dir . implode(DIRECTORY_SEPARATOR, array('templates', 'page-preferences.php'))
),
array(
'id' => 'support',
'menu_title' => translate('Support', $this->textDomain),
'template' => $plugin_dir . implode(DIRECTORY_SEPARATOR, array('templates', 'page-support.php'))
),
array(
'id' => 'activation',
'menu_title' => translate('Activation', $this->textDomain),
'template' => $plugin_dir . implode(DIRECTORY_SEPARATOR, array('templates', 'page-activation.php')),
'notification' => translate('The plugin is not activated', $this->textDomain)
),
array(
'id' => 'error',
'template' => $plugin_dir . implode(DIRECTORY_SEPARATOR, array('templates', 'page-error.php'))
)
);
return array_merge($default_pages, $this->customPages);
}
private function generateMenu() {
$menu = array();
foreach ($this->pages as $page) {
if (!empty($page['menu_title'])) {
array_splice($menu, isset($page['menu_index']) ? $page['menu_index'] : count($this->pages), 0, array($page));
}
}
return $menu;
}
}
}
?>

View File

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

View File

@@ -0,0 +1,58 @@
<?php
if (!defined('ABSPATH')) exit;
?><header class="elfsight-admin-header">
<?php if (!get_option($this->getOptionName('rating_sent'))): ?>
<div class="elfsight-admin-header-rating" style="display: none;">
<div class="elfsight-admin-header-rating-title"><?php esc_html_e('Would you share what you think about the plugin?', $this->textDomain); ?> <span class="elfsight-admin-header-rating-title-emoji">🙏</span></div>
<fieldset class="elfsight-admin-header-rating-stars">
<input type="radio" id="elfsight-admin-header-rating-stars-star5" name="rating-header" value="5"/>
<label for="elfsight-admin-header-rating-stars-star5" title="5 <?php esc_html_e('stars', $this->textDomain); ?>"></label>
<input type="radio" id="elfsight-admin-header-rating-stars-star4" name="rating-header" value="4"/>
<label for="elfsight-admin-header-rating-stars-star4" title="4 <?php esc_html_e('stars', $this->textDomain); ?>"></label>
<input type="radio" id="elfsight-admin-header-rating-stars-star3" name="rating-header" value="3"/>
<label for="elfsight-admin-header-rating-stars-star3" title="3 <?php esc_html_e('stars', $this->textDomain); ?>"></label>
<input type="radio" id="elfsight-admin-header-rating-stars-star2" name="rating-header" value="2"/>
<label for="elfsight-admin-header-rating-stars-star2" title="2 <?php esc_html_e('stars', $this->textDomain); ?>"></label>
<input type="radio" id="elfsight-admin-header-rating-stars-star1" name="rating-header" value="1"/>
<label for="elfsight-admin-header-rating-stars-star1" title="1 <?php esc_html_e('star', $this->textDomain); ?> "></label>
</fieldset>
</div>
<?php endif ?>
<div class="elfsight-admin-header-main">
<div class="elfsight-admin-header-main-title"><?php esc_html_e($this->pluginName . ' Plugin', $this->textDomain); ?></div>
<a class="elfsight-admin-header-main-logo" href="<?php echo admin_url('admin.php?page=' . $this->slug); ?>" title="<?php esc_html_e($this->pluginName . ' Plugin', $this->textDomain); ?>">
<img src="<?php echo plugins_url('assets/img/logo.svg', $this->pluginFile); ?>" width="48" height="48" alt="<?php esc_html_e($this->pluginName . ' Plugin', $this->textDomain); ?>">
</a>
<div class="elfsight-admin-header-main-version">
<span class="elfsight-admin-tooltip-trigger">
<span class="elfsight-admin-header-main-version-text"><?php /* translators: %s: version */ printf(esc_html__('Version %s', $this->textDomain), $this->version); ?></span>
<?php if ($activated && !empty($last_check_datetime)): ?>
<span class="elfsight-admin-tooltip-content">
<span class="elfsight-admin-tooltip-content-inner">
<?php esc_html__(printf('Last update check on %1$s at %2$s', date_i18n(get_option('date_format'), $last_check_datetime), date_i18n(get_option('time_format'), $last_check_datetime)), $this->textDomain); ?>
<?php if (!empty($last_upgraded_at)) {?>
<br>
<?php /* translators: %s: date */ printf(esc_html__('Last updated on %1$s', $this->textDomain), date_i18n(get_option('date_format'), $last_upgraded_at)); ?>
<?php } ?>
</span>
</span>
<?php endif ?>
</span>
</div>
<div class="elfsight-admin-header-main-support">
<a class="elfsight-admin-button-transparent elfsight-admin-button-small elfsight-admin-button" href="#/support/" data-elfsight-admin-page="support"><?php esc_html_e('Need help?', $this->textDomain); ?></a>
</div>
</div>
</header>

View File

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

View File

@@ -0,0 +1,20 @@
<?php
if (!defined('ABSPATH')) exit;
?><div class="elfsight-admin-menu-actions">
<div class="elfsight-admin-menu-actions-activation-container">
<span class="elfsight-admin-menu-actions-activation-label"><?php esc_html_e('CodeCanyon License:', $this->textDomain); ?></span>
<a class="elfsight-admin-menu-actions-activation-status" href="#/activation/" data-elfsight-admin-page="activation"><?php esc_html_e('Not Activated', $this->textDomain); ?></span>
<a class="elfsight-admin-menu-actions-activation-button elfsight-admin-button-black elfsight-admin-button-border elfsight-admin-button" href="#/activation/" data-elfsight-admin-page="activation"><?php esc_html_e('Activate License', $this->textDomain); ?></a>
</div>
<?php if ($has_new_version) {?>
<span class="elfsight-admin-menu-actions-update-container">
<span class="elfsight-admin-menu-actions-update-label"><?php esc_html_e('A new version is available', $this->textDomain); ?></span>
<a class="elfsight-admin-menu-actions-update elfsight-admin-button-green elfsight-admin-button" href="<?php echo is_multisite() ? network_admin_url('update-core.php') : admin_url('update-core.php'); ?>"><?php esc_html_e('Update to', $this->textDomain); ?> <?php echo esc_html($latest_version); ?></a>
</span>
<?php }?>
</div>

View File

@@ -0,0 +1,27 @@
<?php
if (!defined('ABSPATH')) exit;
?><nav class="elfsight-admin-menu">
<ul class="elfsight-admin-menu-list">
<?php foreach ($this->menu as $menu_item) { ?>
<?php if (!empty($menu_item['menu_title'])) {?>
<li class="elfsight-admin-menu-list-item-<?php echo esc_html($menu_item['id']); ?> elfsight-admin-menu-list-item">
<a href="#/<?php echo esc_html($menu_item['id']); ?>/" data-elfsight-admin-page="<?php echo esc_html($menu_item['id']); ?>"<?php echo !empty($menu_item['notification']) ? ' class="elfsight-admin-tooltip-trigger"' : ''?>>
<?php esc_html_e($menu_item['menu_title'], $this->textDomain); ?>
<?php if (!empty($menu_item['notification'])) {?>
<span class="elfsight-admin-menu-list-item-notification"></span>
<span class="elfsight-admin-tooltip-content">
<span class="elfsight-admin-tooltip-content-inner">
<?php esc_html_e($menu_item['notification'], $this->textDomain); ?>
</span>
</span>
<?php } ?>
</a>
</li>
<?php } ?>
<?php } ?>
</ul>
</nav>

View File

@@ -0,0 +1,153 @@
<?php
if (!defined('ABSPATH')) exit;
?><article class="elfsight-admin-page-activation elfsight-admin-page" data-elfsight-admin-page-id="activation">
<div class="elfsight-admin-page-heading">
<h2><?php esc_html_e('Activation', $this->textDomain); ?></h2>
</div>
<div class="elfsight-admin-page-activation-content">
<div class="elfsight-admin-page-activation-form-container">
<form class="elfsight-admin-page-activation-form" data-nonce="<?php echo wp_create_nonce($this->getOptionName('update_activation_data_nonce')); ?>" data-activation-url="<?php echo esc_html($this->updateUrl); ?>" data-activation-version="<?php echo esc_html($this->version); ?>">
<div class="elfsight-admin-page-activation-form-header">
<h4><?php esc_html_e('CodeCanyon License', $this->textDomain); ?></h4>
<div class="elfsight-admin-page-activation-status">
<span class="elfsight-admin-page-activation-status-activated"></span>
<span class="elfsight-admin-page-activation-status-not-activated"></span>
</div>
</div>
<div class="elfsight-admin-page-activation-form-field">
<label>
<span class="elfsight-admin-page-activation-form-field-label"><?php esc_html_e('Please, enter your plugin\'s CodeCanyon purchase code', $this->textDomain); ?></span>
<input class="elfsight-admin-page-activation-form-activated-input" type="hidden" name="activated" value="<?php echo esc_html($activated); ?>">
<input class="elfsight-admin-page-activation-form-supported-until-input" type="hidden" name="supported_until" value="<?php echo esc_html($supported_until); ?>">
<input class="elfsight-admin-page-activation-form-host-input" type="hidden" name="host" value="<?php echo esc_html($host); ?>">
<input class="elfsight-admin-page-activation-form-purchase-code-input" type="text" placeholder="<?php esc_html_e('Purchase code', $this->textDomain); ?>" name="purchase_code" value="<?php echo esc_html($purchase_code); ?>" class="regular-text" spellcheck="false" autocomplete="off"<?php echo
($activated ? ' readonly="readonly"' : ''); ?>>
</label>
</div>
<div class="elfsight-admin-page-activation-form-action elfsight-admin-page-activation-form-field">
<div class="elfsight-admin-page-activation-form-activation">
<div class="elfsight-admin-page-activation-form-activation-button elfsight-admin-button-green elfsight-admin-button-large elfsight-admin-button"><?php esc_html_e('Activate License', $this->textDomain); ?></div>
<div class="elfsight-admin-page-activation-form-activation-confirm">
<div class="elfsight-admin-page-activation-form-activation-confirm-caption">
<div class="elfsight-admin-page-activation-form-activation-confirm-caption-message"></div>
<?php esc_html_e('This action will deactivate plugin on registered domain, proceed? ', $this->textDomain); ?>
</div>
<div class="elfsight-admin-page-activation-form-activation-confirm-no elfsight-admin-button-gray elfsight-admin-button-large elfsight-admin-button"><?php esc_html_e('No', $this->textDomain); ?></div>
<div class="elfsight-admin-page-activation-form-activation-confirm-yes elfsight-admin-button-red elfsight-admin-button-large elfsight-admin-button"><?php esc_html_e('Yes', $this->textDomain); ?></div>
</div>
</div>
<div class="elfsight-admin-page-activation-form-deactivation">
<div class="elfsight-admin-page-activation-form-deactivation-button elfsight-admin-button-gray elfsight-admin-button-large elfsight-admin-button"><?php esc_html_e('Deactivate License', $this->textDomain); ?></div>
<div class="elfsight-admin-page-activation-form-deactivation-confirm">
<div class="elfsight-admin-page-activation-form-deactivation-confirm-caption"><?php esc_html_e('Are you sure you want to deactivate the plugin?', $this->textDomain); ?></div>
<div class="elfsight-admin-page-activation-form-deactivation-confirm-no elfsight-admin-button-gray elfsight-admin-button-large elfsight-admin-button"><?php esc_html_e('No', $this->textDomain); ?></div>
<div class="elfsight-admin-page-activation-form-deactivation-confirm-yes elfsight-admin-button-red elfsight-admin-button-large elfsight-admin-button"><?php esc_html_e('Yes', $this->textDomain); ?></div>
</div>
</div>
<div class="elfsight-admin-page-activation-form-message-container">
<div class="elfsight-admin-page-activation-form-message-success elfsight-admin-page-activation-form-message"><?php esc_html_e('The plugin is successfuly activated', $this->textDomain); ?></div>
<div class="elfsight-admin-page-activation-form-message-error elfsight-admin-page-activation-form-message"><?php esc_html_e('Your purchase code is not valid', $this->textDomain); ?></div>
<div class="elfsight-admin-page-activation-form-message-fail elfsight-admin-page-activation-form-message"><?php esc_html_e('Error occurred while checking your purchase code. Please, contact our support team. We apologize for inconveniences.', $this->textDomain); ?></div>
</div>
</div>
</form>
</div>
<div class="elfsight-admin-page-activation-faq">
<h4><?php esc_html_e('FAQ', $this->textDomain); ?></h4>
<div class="elfsight-admin-page-activation-faq-list">
<div class="elfsight-admin-page-activation-faq-list-item">
<div class="elfsight-admin-page-activation-faq-list-item-question"><?php esc_html_e('How do I benefit from activating the license in the plugin?', $this->textDomain); ?></div>
<div class="elfsight-admin-page-activation-faq-list-item-answer">
<?php
printf(
/* translators: %1$s: link */
esc_html__('Activating the %1$s will give you access to the in-plugin support and automatic plugin updates. Now bug fixes and new features will be automatically implemented in your plugin.', $this->textDomain),
sprintf(
'<a href="%s" target="_blank">%s</a>',
esc_url($this->productUrl),
/* translators: Activating the [plugin] will give .. */
esc_html__('plugin', $this->textDomain)
)
);
?>
</div>
</div>
<div class="elfsight-admin-page-activation-faq-list-item">
<div class="elfsight-admin-page-activation-faq-list-item-question"><?php esc_html_e('What is CodeCanyon purchase code?', $this->textDomain); ?></div>
<div class="elfsight-admin-page-activation-faq-list-item-answer">
<?php
printf(
/* translators: %1$s: link */
esc_html__('Purchase code is a license key, that you get after buying the plugin on %1$s. It looks like this: 13fc2617-5d1d-4127-873a-feb85d27a012.', $this->textDomain),
sprintf(
'<a href="%s" target="_blank">%s</a>',
$this->productUrl, 'CodeCanyon'
)
);
?>
<div class="elfsight-admin-page-activation-faq-list-item-answer-image">
<img src="<?php echo plugins_url('assets/img/faq-what-is-purchase-code.jpg', $this->pluginFile); ?>">
</div>
</div>
</div>
<div class="elfsight-admin-page-activation-faq-list-item">
<div class="elfsight-admin-page-activation-faq-list-item-question"><?php esc_html_e('How do I get my purchase code?', $this->textDomain); ?></div>
<div class="elfsight-admin-page-activation-faq-list-item-answer">
<?php
printf(
/* translators: %1$s: product link, %2$s: download link, %3$s: help link */
esc_html__('After purchasing the %1$s, go to %2$s, click "Download" and select “License Certificate & Purchase Code”. Youll find your purchase code in the downloaded file. To find out more, read: %3$s', $this->textDomain),
sprintf(
'<a href="%s" target="_blank">%s</a>',
$this->productUrl,
/* translators: After purchasing the [item], go to .. */
esc_html__('item', $this->textDomain)
),
'<a href="http://codecanyon.net/downloads" target="_blank">http://codecanyon.net/downloads</a>',
sprintf(
'<a href="%s" target="_blank">%s</a>',
'https://elfsight.com/blog/2016/04/where-to-find-your-envato-purchase-code/',
esc_html__('Where to find your Envato purchase code?', $this->textDomain)
)
);
?>
<div class="elfsight-admin-page-activation-faq-list-item-answer-image">
<img src="<?php echo plugins_url('assets/img/faq-how-to-get.jpg', $this->pluginFile); ?>">
</div>
</div>
</div>
<div class="elfsight-admin-page-activation-faq-list-item">
<div class="elfsight-admin-page-activation-faq-list-item-question"><?php esc_html_e('How do I activate a CodeCanyon license?', $this->textDomain); ?></div>
<div class="elfsight-admin-page-activation-faq-list-item-answer">
<?php esc_html_e('To activate your license in the plugin insert you purchase code into the CodeCanyon License form above and press “Activate License” button. After the successful activation, you will see the corresponding notification.', $this->textDomain); ?>
<div class="elfsight-admin-page-activation-faq-list-item-answer-image">
<img src="<?php echo plugins_url('assets/img/faq-how-to-activate.jpg', $this->pluginFile); ?>">
</div>
</div>
</div>
</div>
</div>
</div>
</article>

View File

@@ -0,0 +1,65 @@
<?php
if (!defined('ABSPATH')) exit;
?><article class="elfsight-admin-page-edit-widget elfsight-admin-page" data-elfsight-admin-page-id="edit-widget">
<div class="elfsight-admin-page-heading">
<a class="elfsight-admin-page-back-button" href="#/widgets/" data-elfsight-admin-page="widgets">
<svg class="elfsight-admin-svg-arrow-back">
<line x1="0.5" y1="4.5" x2="4.5" y2="0"></line>
<line x1="0.5" y1="4.5" x2="4.5" y2="8.5"></line>
</svg>
<?php esc_html_e('Back to list', $this->textDomain); ?>
</a>
<h2 class="elfsight-admin-page-edit-widget-title-add"><?php esc_html_e('Create Widget', $this->textDomain); ?></h2>
<h2 class="elfsight-admin-page-edit-widget-title-edit"><?php esc_html_e('Edit Widget', $this->textDomain); ?></h2>
<div class="elfsight-admin-page-heading-subheading"><?php esc_html_e('Name your widget, adjust settings and save it. You will see the shortcode of your new widget in the widgets list. You can copy-paste it to the required place of your website.', $this->textDomain); ?></div>
</div>
<div class="elfsight-admin-divider"></div>
<div class="elfsight-admin-page-edit-widget-form">
<div class="elfsight-admin-page-edit-widget-form-field">
<label>
<span class="elfsight-admin-page-edit-widget-form-field-label"><?php esc_html_e('Widget name', $this->textDomain); ?></span>
<input class="elfsight-admin-page-edit-widget-name-input" type="text" name="widgetName">
</label>
<div class="elfsight-admin-page-edit-widget-form-field-hint">
<?php esc_html_e('Name your widget. The name will be displayed only in your admin panel.', $this->textDomain); ?>
</div>
</div>
<div class="elfsight-admin-divider"></div>
<div class="elfsight-admin-page-edit-widget-form-field">
<div class="elfsight-admin-page-edit-widget-form-field-row">
<div class="elfsight-admin-page-edit-widget-form-field-label"><?php esc_html_e('Adjust settings', $this->textDomain); ?></div>
<div class="elfsight-admin-page-edit-widget-unsaved">
<span class="elfsight-admin-page-edit-widget-unsaved-label">Unsaved changes</span>
<div class="elfsight-admin-page-edit-widget-form-apply elfsight-admin-button-small elfsight-admin-button-green elfsight-admin-button"><?php esc_html_e('Save', $this->textDomain); ?></div>
</div>
</div>
<div class="elfsight-admin-page-edit-widget-form-editor-clone"
data-elfsight-admin-editor-settings="<?php echo htmlspecialchars(json_encode(apply_filters($this->getOptionName('editor_settings'), $this->editorSettings)), ENT_QUOTES, 'UTF-8'); ?>"
data-elfsight-admin-editor-preferences="<?php echo htmlspecialchars(json_encode($this->editorPreferences), ENT_QUOTES, 'UTF-8'); ?>"
data-elfsight-admin-editor-preview-url="<?php echo htmlspecialchars(json_encode($this->previewUrl), ENT_QUOTES, 'UTF-8'); ?>"
<?php if (!empty($this->observerUrl)) { ?>
data-elfsight-admin-editor-observer-url="<?php echo htmlspecialchars(json_encode($this->observerUrl), ENT_QUOTES, 'UTF-8'); ?>"
<?php } ?>
></div>
</div>
<div class="elfsight-admin-page-edit-widget-form-actions elfsight-admin-page-edit-widget-form-field">
<div class="elfsight-admin-page-edit-widget-form-submit elfsight-admin-button-large elfsight-admin-button-green elfsight-admin-button"><?php esc_html_e('Save and Exit', $this->textDomain); ?></div>
<div class="elfsight-admin-page-edit-widget-form-cancel elfsight-admin-button-large elfsight-admin-button-black elfsight-admin-button-border elfsight-admin-button"><?php esc_html_e('Cancel', $this->textDomain); ?></div>
</div>
</div>
</article>

View File

@@ -0,0 +1,13 @@
<?php
if (!defined('ABSPATH')) exit;
?><article class="elfsight-admin-page-error elfsight-admin-page" data-elfsight-admin-page-id="error">
<h1><?php esc_html_e('Oops, something went wrong', $this->textDomain); ?></h1>
<p class="elfsight-admin-page-error-message">
<?php esc_html_e('Unfortunately, there is no such page.', $this->textDomain); ?>
</p>
<a class="elfsight-admin-page-error-button elfsight-admin-button-large elfsight-admin-button-green elfsight-admin-button" href="#/widgets/" data-elfsight-admin-page="widgets"><?php esc_html_e('Back to Home', $this->textDomain); ?></a>
</article>

View File

@@ -0,0 +1,147 @@
<?php
if (!defined('ABSPATH')) exit;
?><article class="elfsight-admin-page-preferences elfsight-admin-page" data-elfsight-admin-page-id="preferences">
<div class="elfsight-admin-page-heading">
<h2><?php esc_html_e('Preferences', $this->textDomain); ?></h2>
<div class="elfsight-admin-page-heading-subheading">
<?php esc_html_e('These settings will be applied to each widget of the plugin.', $this->textDomain); ?>
</div>
</div>
<div class="elfsight-admin-divider"></div>
<div class="elfsight-admin-page-preferences-form" data-nonce="<?php echo wp_create_nonce($this->getOptionName('update_preferences_nonce')); ?>">
<div class="elfsight-admin-page-preferences-option-css elfsight-admin-page-preferences-option">
<div class="elfsight-admin-page-preferences-option-info">
<h4 class="elfsight-admin-page-preferences-option-info-name">
<?php esc_html_e('Custom CSS', $this->textDomain); ?>
</h4>
<div class="elfsight-admin-caption">
<?php esc_html_e('Here you can set the plugin\'s custom styles. The code will be added to each page with the widget.', $this->textDomain); ?>
</div>
</div>
<div class="elfsight-admin-page-preferences-option-input-container">
<div class="elfsight-admin-page-preferences-option-editor">
<div class="elfsight-admin-page-preferences-option-editor-code" id="elfsightPreferencesSnippetCSS"><?php echo htmlspecialchars($preferences_custom_css)?></div>
</div>
<div class="elfsight-admin-page-preferences-option-save-container">
<a href="#" class="elfsight-admin-page-preferences-option-css-save elfsight-admin-page-preferences-option-save elfsight-admin-button-green elfsight-admin-button">
<span class="elfsight-admin-page-preferences-option-save-label"><?php esc_html_e('Save', $this->textDomain); ?></span>
<span class="elfsight-admin-page-preferences-option-save-loader"></span>
</a>
<span class="elfsight-admin-page-preferences-option-save-success">
<span class="elfsight-admin-icon-check-green-small elfsight-admin-icon"></span><span class="elfsight-admin-page-preferences-option-save-success-label"><?php esc_html_e('Done!', $this->textDomain); ?></span>
</span>
<span class="elfsight-admin-page-preferences-option-save-error"></span>
</div>
</div>
</div>
<div class="elfsight-admin-divider"></div>
<div class="elfsight-admin-page-preferences-option-js elfsight-admin-page-preferences-option">
<div class="elfsight-admin-page-preferences-option-info">
<h4 class="elfsight-admin-page-preferences-option-info-name">
<?php esc_html_e('Custom JavaScript', $this->textDomain); ?>
</h4>
<div class="elfsight-admin-caption">
<?php esc_html_e('Here you can set the plugin\'s custom javascript code. The code will be added to each page with the widget.', $this->textDomain); ?>
</div>
</div>
<div class="elfsight-admin-page-preferences-option-input-container">
<div class="elfsight-admin-page-preferences-option-editor">
<div class="elfsight-admin-page-preferences-option-editor-code" id="elfsightPreferencesSnippetJS"><?php echo htmlspecialchars($preferences_custom_js) ?></div>
</div>
<div class="elfsight-admin-page-preferences-option-save-container">
<a href="#" class="elfsight-admin-page-preferences-option-js-save elfsight-admin-page-preferences-option-save elfsight-admin-button-green elfsight-admin-button">
<span class="elfsight-admin-page-preferences-option-save-label"><?php esc_html_e('Save', $this->textDomain); ?></span>
<span class="elfsight-admin-page-preferences-option-save-loader"></span>
</a>
<span class="elfsight-admin-page-preferences-option-save-success">
<span class="elfsight-admin-icon-check-green-small elfsight-admin-icon"></span><span class="elfsight-admin-page-preferences-option-save-success-label"><?php esc_html_e('Done!', $this->textDomain); ?></span>
</span>
<span class="elfsight-admin-page-preferences-option-save-error"></span>
</div>
</div>
</div>
<?php if(current_user_can('manage_options')) { ?>
<div class="elfsight-admin-divider"></div>
<div class="elfsight-admin-page-preferences-option-roles elfsight-admin-page-preferences-option">
<div class="elfsight-admin-page-preferences-option-info">
<h4 class="elfsight-admin-page-preferences-option-info-name">
<?php esc_html_e('Who can access the plugin', $this->textDomain); ?>
</h4>
<div class="elfsight-admin-caption">
<?php esc_html_e('Here you can set the minimal permissions role that can access the plugin.', $this->textDomain); ?>
</div>
</div>
<div class="elfsight-admin-page-preferences-option-input-container">
<div class="elfsight-admin-page-preferences-option-input-select-container">
<select class="elfsight-admin-page-preferences-option-input-select" name="preferences_access_role">
<option value="admin" <?php echo ($preferences_access_role === 'admin') ? 'selected' : ''?>><?php esc_html_e('Admin', $this->textDomain); ?></option>
<option value="editor" <?php echo ($preferences_access_role === 'editor') ? 'selected' : ''?>><?php esc_html_e('Editor', $this->textDomain); ?></option>
<option value="author" <?php echo ($preferences_access_role === 'author') ? 'selected' : ''?>><?php esc_html_e('Author', $this->textDomain); ?></option>
</select>
</div>
</div>
</div>
<?php } ?>
<div class="elfsight-admin-divider"></div>
<div class="elfsight-admin-page-preferences-option-force-script elfsight-admin-page-preferences-option">
<div class="elfsight-admin-page-preferences-option-info">
<h4 class="elfsight-admin-page-preferences-option-info-name">
<label for="autoUpgrade"><?php esc_html_e('Automatic updates', $this->textDomain); ?></label>
</h4>
<div class="elfsight-admin-caption">
<?php esc_html_e('When this option is on (recommended), this plugin\'s released updates with the new features and bug fixes will be installed to your website automatically. When it is off, you\'ll only have the option of updating manually.', $this->textDomain); ?>
</div>
</div>
<div class="elfsight-admin-page-preferences-option-input-container">
<input type="checkbox" name="preferences_auto_upgrade" value="true" id="autoUpgrade" class="elfsight-admin-page-preferences-option-input-toggle"<?php echo ($preferences_auto_upgrade === 'on') ? ' checked' : ''?>>
<label for="autoUpgrade"><i></i></label>
</div>
</div>
<div class="elfsight-admin-divider"></div>
<div class="elfsight-admin-page-preferences-option-force-script elfsight-admin-page-preferences-option">
<div class="elfsight-admin-page-preferences-option-info">
<h4 class="elfsight-admin-page-preferences-option-info-name">
<label for="forceScriptAdd"><?php esc_html_e('Ajax Loading (activate for AJAX-powered themes)', $this->textDomain); ?></label>
</h4>
<div class="elfsight-admin-caption">
<?php esc_html_e('By default the plugin script loads only on pages you\'ve added its shortcode to. In case of AJAX-powered themes, you need to activate this option to load the plugin script at the initial site load.', $this->textDomain); ?>
</div>
</div>
<div class="elfsight-admin-page-preferences-option-input-container">
<input type="checkbox" name="preferences_force_script_add" value="true" id="forceScriptAdd" class="elfsight-admin-page-preferences-option-input-toggle"<?php echo ($preferences_force_script_add === 'on') ? ' checked' : ''?>>
<label for="forceScriptAdd"><i></i></label>
</div>
</div>
</div>
</article>

View File

@@ -0,0 +1,193 @@
<?php
if (!defined('ABSPATH')) exit;
?>
<article class="elfsight-admin-page-support elfsight-admin-page" data-elfsight-admin-page-id="support">
<div class="elfsight-admin-page-support-blocked">
<div class="elfsight-admin-page-heading elfsight-admin-page-support-heading">
<h2><?php esc_html_e('Support', $this->textDomain); ?></h2>
<svg class="elfsight-admin-page-support-blocked-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="12" height="15" viewBox="0 0 12 15"><defs><path id="bikla" d="M7.55 8.73h.63v-.91a3.82 3.82 0 1 1 7.63 0v.9h.65c1.05 0 1.9 1.07 1.9 2.38v5.53c0 1.3-.85 2.37-1.9 2.37H7.55c-1.06 0-1.91-1.06-1.91-2.37V11.1c0-1.31.85-2.37 1.9-2.37zm7-.91a2.54 2.54 0 1 0-5.1 0v.9h5.1zM12 14.86a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/></defs><g><g transform="translate(-5.64 -4)"><use xlink:href="#bikla"/></g></g></svg>
</div>
<div class="elfsight-admin-page-support-blocked-message">
<div class="elfsight-admin-page-support-blocked-message-content">
<div class="elfsight-admin-page-support-blocked-message-badge"><?php esc_html_e('Unlock', $this->textDomain); ?></div>
<h3 class="elfsight-admin-page-support-blocked-message-title"><?php esc_html_e('Support section is only available for CodeCanyon clients with activated license', $this->textDomain); ?></h3>
<div class="elfsight-admin-page-support-blocked-message-text">
<?php
printf(
/* translators: %1$s: link */
esc_html__('To unlock the in-plugin support, please, activate your license by entering CodeCanyon purchase code of the %1$s.', $this->textDomain),
sprintf(
'<a href="%s" target="_blank">%s</a>',
esc_url($this->productUrl),
esc_html__('plugin', $this->textDomain)
)
);
?>
</div>
<div class="elfsight-admin-page-support-blocked-message-action">
<a class="elfsight-admin-button-large elfsight-admin-button-black elfsight-admin-button" href="#/activation/" data-elfsight-admin-page="activation"><?php esc_html_e('Activate License', $this->textDomain); ?></a>
</div>
</div>
<div class="elfsight-admin-page-support-blocked-message-image">
<img src="<?php echo plugins_url('assets/img/support-blocked.jpg', $this->pluginFile); ?>">
</div>
</div>
</div>
<div class="elfsight-admin-page-support-unblocked">
<div class="elfsight-admin-page-heading">
<h2><?php esc_html_e('Support', $this->textDomain); ?></h2>
<div class="elfsight-admin-page-heading-subheading">
<?php esc_html_e('We understand all the importance of product support for our customers. Thats why we are ready to solve all your issues and answer any questions related to our plugin.', $this->textDomain); ?>
</div>
</div>
<div class="elfsight-admin-divider"></div>
<div class="elfsight-admin-page-support-ticket-container">
<div class="elfsight-admin-page-support-ticket">
<h4><?php esc_html_e('Before submitting a ticket, make sure that', $this->textDomain); ?></h4>
<ul class="elfsight-admin-page-support-ticket-steps">
<li class="elfsight-admin-page-support-ticket-steps-item-latest-version elfsight-admin-page-support-ticket-steps-item">
<span class="elfsight-admin-page-support-ticket-steps-item-icon">
<span class="elfsight-admin-icon-support-latest-version elfsight-admin-icon"></span>
</span>
<span class="elfsight-admin-page-support-ticket-steps-item-label"><?php esc_html_e('You use the latest version.', $this->textDomain); ?></span>
</li>
<li class="elfsight-admin-page-support-ticket-steps-item-javascript-errors elfsight-admin-page-support-ticket-steps-item">
<span class="elfsight-admin-page-support-ticket-steps-item-icon">
<span class="elfsight-admin-icon-support-javascript-errors elfsight-admin-icon"></span>
</span>
<span class="elfsight-admin-page-support-ticket-steps-item-label"><?php esc_html_e('There are no javascript errors on your website.', $this->textDomain); ?></span>
</li>
<li class="elfsight-admin-page-support-ticket-steps-item-documentation elfsight-admin-page-support-ticket-steps-item">
<span class="elfsight-admin-page-support-ticket-steps-item-icon">
<span class="elfsight-admin-icon-support-documentation elfsight-admin-icon"></span>
</span>
<span class="elfsight-admin-page-support-ticket-steps-item-label"><?php esc_html_e('The documentation doesn\'t help.', $this->textDomain); ?></span>
</li>
</ul>
<div class="elfsight-admin-page-support-ticket-form-container">
<form class="elfsight-admin-page-support-ticket-form" action="<?php echo $this->helpscoutSubmitUrl; ?>" data-cs="<?php echo $this->checkSupportExpiredUrl; ?>">
<h4 class="elfsight-admin-page-support-ticket-form-title"><?php esc_html_e('Submit a Ticket', $this->textDomain); ?></h4>
<input class="elfsight-admin-page-support-ticket-form-purchase-code" type="hidden" name="purchaseCode" value="<?php echo $purchase_code; ?>">
<input class="elfsight-admin-page-support-ticket-form-plugin-id" type="hidden" name="pluginId" value="<?php echo $this->helpscoutPluginId; ?>">
<input class="elfsight-admin-page-support-ticket-form-website" type="hidden" name="website" value="<?php echo get_site_url(); ?>">
<label class="elfsight-admin-page-support-ticket-form-field">
<span class="elfsight-admin-page-support-ticket-form-field-label"><?php esc_html_e('Name', $this->textDomain); ?></span>
<input class="elfsight-admin-page-support-ticket-form-first-name" type="text" name="name">
</label>
<label class="elfsight-admin-page-support-ticket-form-field">
<span class="elfsight-admin-page-support-ticket-form-field-label"><?php esc_html_e('Email', $this->textDomain); ?></span>
<input class="elfsight-admin-page-support-ticket-form-email" type="email" name="email" required>
</label>
<label class="elfsight-admin-page-support-ticket-form-field">
<span class="elfsight-admin-page-support-ticket-form-field-label"><?php esc_html_e('Subject', $this->textDomain); ?></span>
<input class="elfsight-admin-page-support-ticket-form-subject" type="text" name="subject" required>
</label>
<label class="elfsight-admin-page-support-ticket-form-field">
<span class="elfsight-admin-page-support-ticket-form-field-label"><?php esc_html_e('Message', $this->textDomain); ?></span>
<textarea class="elfsight-admin-page-support-ticket-form-message" name="message" required></textarea>
</label>
<label class="elfsight-admin-page-support-ticket-form-field">
<span class="elfsight-admin-page-support-ticket-form-field-label"><?php esc_html_e('Upload file', $this->textDomain); ?></span>
<input class="elfsight-admin-page-support-ticket-form-files" type="file" name="files[]" multiple="multiple">
</label>
<input class="elfsight-admin-page-support-ticket-form-submit elfsight-admin-button-green elfsight-admin-button-large elfsight-admin-button" type="submit" value="<?php esc_html_e('Send Message', $this->textDomain); ?>">
</form>
<div class="elfsight-admin-page-support-ticket-form-result-success elfsight-admin-page-support-ticket-form-result">
<h4 class="elfsight-admin-page-support-ticket-form-result-title"><?php esc_html_e('Your message has been sent', $this->textDomain); ?></h4>
<div class="elfsight-admin-page-support-ticket-form-result-text"><?php esc_html_e('Our Support Team will reply to you shortly. Expect a response from 10am to 7pm CET Monday-Friday.', $this->textDomain); ?></div>
</div>
<div class="elfsight-admin-page-support-ticket-form-result-error elfsight-admin-page-support-ticket-form-result">
<h4 class="elfsight-admin-page-support-ticket-form-result-title"><?php esc_html_e('Your message could not be sent', $this->textDomain); ?></h4>
<div class="elfsight-admin-page-support-ticket-form-result-text"><?php esc_html_e('There was an error sending the message. Please, contact our Support Team via private message at https://codecanyon.net/user/elfsight', $this->textDomain); ?></div>
</div>
<div class="elfsight-admin-page-support-ticket-form-expired">
<div class="elfsight-admin-page-support-ticket-form-expired-message">Your support has expired on <span class="elfsight-admin-page-support-ticket-form-expired-date"></span>. Please renew support to get help.</div>
<a class="elfsight-admin-page-support-ticket-form-expired-button elfsight-admin-button-large elfsight-admin-button-green elfsight-admin-button" href="<?php echo $this->productUrl;?>" target="_blank">Renew Support</a>
</div>
</div>
</div>
<div class="elfsight-admin-page-support-includes-container">
<div class="elfsight-admin-page-support-includes">
<h4><?php esc_html_e('Our Support Includes', $this->textDomain); ?></h4>
<ul class="elfsight-admin-page-support-includes-list">
<li class="elfsight-admin-page-support-includes-list-item">
<div class="elfsight-admin-page-support-includes-list-item-title"><?php esc_html_e('Fixing product bugs', $this->textDomain); ?></div>
<p class="elfsight-admin-page-support-includes-list-item-description"><?php esc_html_e('Our product doesnt work properly on your website? Report your issue or bug by describing it in detail and providing us with a link to your website. We will do our best to find a solution.', $this->textDomain); ?></p>
</li>
<li class="elfsight-admin-page-support-includes-list-item">
<div class="elfsight-admin-page-support-includes-list-item-title"><?php esc_html_e('Life-time updates', $this->textDomain); ?></div>
<p class="elfsight-admin-page-support-includes-list-item-description"><?php esc_html_e('We release new updates and features on a regular basis. Just dont forget to check for the latest version in your WordPress admin panel.', $this->textDomain); ?></p>
</li>
<li class="elfsight-admin-page-support-includes-list-item">
<div class="elfsight-admin-page-support-includes-list-item-title"><?php esc_html_e('Customer-friendly development', $this->textDomain); ?></div>
<p class="elfsight-admin-page-support-includes-list-item-description"><?php esc_html_e('We are open to your ideas. If you need some specific features, that might also improve our products, then just drop us a line. We will consider implementing them in our future updates.', $this->textDomain); ?></p>
</li>
</ul>
</div>
<div class="elfsight-admin-page-support-not-includes">
<h4><?php esc_html_e('Our Support Doesnt Include', $this->textDomain); ?></h4>
<ul class="elfsight-admin-page-support-not-includes-list">
<li class="elfsight-admin-page-support-not-includes-list-item">
<div class="elfsight-admin-page-support-not-includes-list-item-title"><?php esc_html_e('Plugin installation', $this->textDomain); ?></div>
<p class="elfsight-admin-page-support-not-includes-list-item-description"><?php esc_html_e('We dont provide installation services for our plugins. However, we\'re happy to provide you with installation tutorials. And if any errors come up during installation, feel free to contact us.', $this->textDomain); ?></p>
</li>
<li class="elfsight-admin-page-support-not-includes-list-item">
<div class="elfsight-admin-page-support-not-includes-list-item-title"><?php esc_html_e('Plugin customization', $this->textDomain); ?></div>
<p class="elfsight-admin-page-support-not-includes-list-item-description"><?php esc_html_e('We dont provide plugin customization services. If you need to modify the way some features work, share your ideas with us, and we will consider them for future updates.', $this->textDomain); ?></p>
</li>
<li class="elfsight-admin-page-support-not-includes-list-item">
<div class="elfsight-admin-page-support-not-includes-list-item-title"><?php esc_html_e('3rd-party issues', $this->textDomain); ?></div>
<p class="elfsight-admin-page-support-not-includes-list-item-description"><?php esc_html_e('We dont fix bugs or issues related to other plugins and themes, created by 3rd-party developers. Also we dont provide integration services for 3rd-party plugins and themes.', $this->textDomain); ?></p>
</li>
</ul>
</div>
</div>
</div>
</div>
</article>

View File

@@ -0,0 +1,14 @@
<?php
if (!defined('ABSPATH')) exit;
?><article class="elfsight-admin-page-welcome elfsight-admin-page" data-elfsight-admin-page-id="welcome">
<h1><?php /* translators: %s: Plugin Name */ printf(esc_html__('Welcome to %s', $this->textDomain), $this->pluginName); ?></h1>
<p class="elfsight-admin-page-welcome-subheading">
<?php esc_html_e($this->description); ?><br>
<strong><?php esc_html_e('Lets create your first widget!', $this->textDomain); ?></strong>
</p>
<a class="elfsight-admin-page-welcome-button elfsight-admin-button-large elfsight-admin-button-green elfsight-admin-button" href="#/add-widget/" data-elfsight-admin-page="add-widget"><?php esc_html_e('Create widget', $this->textDomain); ?></a>
</article>

View File

@@ -0,0 +1,96 @@
<?php
if (!defined('ABSPATH')) exit;
?><article class="elfsight-admin-page-widgets elfsight-admin-page" data-elfsight-admin-page-id="widgets">
<div class="elfsight-admin-page-heading">
<h2><?php esc_html_e('Widgets', $this->textDomain); ?></h2>
<a class="elfsight-admin-page-widgets-add-new elfsight-admin-button-green elfsight-admin-button" href="#/add-widget/" data-elfsight-admin-page="add-widget"><?php esc_html_e('Create widget', $this->textDomain); ?></a>
<div class="elfsight-admin-page-heading-subheading"><?php esc_html_e('Create, edit or remove your widgets. Use their shortcodes to insert them into the required place.', $this->textDomain); ?></div>
</div>
<table class="elfsight-admin-page-widgets-list">
<thead>
<tr>
<th><span><?php esc_html_e('Name', $this->textDomain); ?></span></th>
<th><span><?php esc_html_e('Shortcode', $this->textDomain); ?></span></th>
<th><span><?php esc_html_e('Last updated', $this->textDomain); ?></span></th>
<th><span><?php esc_html_e('Actions', $this->textDomain); ?></span></th>
</tr>
</thead>
<tbody></tbody>
</table>
<template class="elfsight-admin-template-widgets-list-item elfsight-admin-template">
<tr class="elfsight-admin-page-widgets-list-item">
<td class="elfsight-admin-page-widgets-list-item-name"><a href="#" data-elfsight-admin-page="edit-widget"></a></td>
<td class="elfsight-admin-page-widgets-list-item-shortcode">
<span class="elfsight-admin-page-widgets-list-item-shortcode-hidden"></span>
<input type="text" class="elfsight-admin-page-widgets-list-item-shortcode-input" readonly></input>
<span type="text" class="elfsight-admin-page-widgets-list-item-shortcode-value"></span>
<div class="elfsight-admin-page-widgets-list-item-shortcode-copy">
<span class="elfsight-admin-page-widgets-list-item-shortcode-copy-trigger"><span>Copy</span></span>
<div class="elfsight-admin-page-widgets-list-item-shortcode-copy-error">Press Cmd+C to copy</div>
</div>
</td>
<td class="elfsight-admin-page-widgets-list-item-date"></td>
<td class="elfsight-admin-page-widgets-list-item-actions">
<a href="#" class="elfsight-admin-page-widgets-list-item-actions-edit">
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg">
<g id="edit">
<path d="M16.4931524,2.4765175 L16.6763274,2.53218654 C17.5787808,2.83961227 18.2745737,3.5779071 18.5234825,4.5068476 C18.7889853,5.49771747 18.5056972,6.55496302 17.7803301,7.28033009 L7.65533009,17.4053301 C7.56303836,17.4976218 7.44825923,17.5642307 7.32233805,17.5985729 L3.19733805,18.7235729 C2.63746387,18.8762658 2.12373417,18.3625361 2.27642713,17.8026619 L3.40142713,13.6776619 C3.43576927,13.5517408 3.50237819,13.4369616 3.59466991,13.3446699 L13.7196699,3.21966992 C14.3966792,2.54266063 15.3627915,2.25075127 16.2942114,2.43070254 L16.4931524,2.4765175 Z M6.73550672,16.2038331 L16.7196699,6.21966991 C17.0660996,5.87324021 17.2013958,5.36830793 17.0745938,4.89507616 C16.9477917,4.42184439 16.5781556,4.05220831 16.1049238,3.92540624 C15.6316921,3.79860417 15.1267598,3.93390038 14.7803301,4.28033009 L4.7961669,14.2644933 L4.06891446,16.9310855 L6.73550672,16.2038331 Z"></path>
</g>
</svg>
<span><?php esc_html_e('Edit', $this->textDomain); ?></span>
</a>
<a href="#" class="elfsight-admin-page-widgets-list-item-actions-duplicate">
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg">
<g id="duplicate">
<path d="M15.890625,7.40625 C17.081489,7.40625 18.046875,8.37163601 18.046875,9.5625 L18.046875,15.890625 C18.046875,17.081489 17.081489,18.046875 15.890625,18.046875 L9.5625,18.046875 C8.37163601,18.046875 7.40625,17.081489 7.40625,15.890625 L7.40625,9.5625 C7.40625,8.37163601 8.37163601,7.40625 9.5625,7.40625 L15.890625,7.40625 Z M15.890625,8.90625 L9.5625,8.90625 C9.20006313,8.90625 8.90625,9.20006313 8.90625,9.5625 L8.90625,15.890625 C8.90625,16.2530619 9.20006313,16.546875 9.5625,16.546875 L15.890625,16.546875 C16.2530619,16.546875 16.546875,16.2530619 16.546875,15.890625 L16.546875,9.5625 C16.546875,9.20006313 16.2530619,8.90625 15.890625,8.90625 Z"></path>
<path d="M5.109375,11.390625 L4.40625,11.390625 C4.04381313,11.390625 3.75,11.0968119 3.75,10.734375 L3.75,4.40625 C3.75,4.04381313 4.04381313,3.75 4.40625,3.75 L10.734375,3.75 C11.0968119,3.75 11.390625,4.04381313 11.390625,4.40625 L11.390625,5.109375 C11.390625,5.52358856 11.7264114,5.859375 12.140625,5.859375 C12.5548386,5.859375 12.890625,5.52358856 12.890625,5.109375 L12.890625,4.40625 C12.890625,3.21538601 11.925239,2.25 10.734375,2.25 L4.40625,2.25 C3.21538601,2.25 2.25,3.21538601 2.25,4.40625 L2.25,10.734375 C2.25,11.925239 3.21538601,12.890625 4.40625,12.890625 L5.109375,12.890625 C5.52358856,12.890625 5.859375,12.5548386 5.859375,12.140625 C5.859375,11.7264114 5.52358856,11.390625 5.109375,11.390625 Z"></path>
</g>
</svg>
<span><?php esc_html_e('Duplicate', $this->textDomain); ?></span>
</a>
<a href="#" class="elfsight-admin-page-widgets-list-item-actions-remove">
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg">
<g id="trash">
<path d="M3,5.75 L16.5,5.75 C16.9142136,5.75 17.25,5.41421356 17.25,5 C17.25,4.58578644 16.9142136,4.25 16.5,4.25 L3,4.25 C2.58578644,4.25 2.25,4.58578644 2.25,5 C2.25,5.41421356 2.58578644,5.75 3,5.75 Z"></path>
<path d="M15,4.25 C15.3796958,4.25 15.693491,4.53215388 15.7431534,4.89822944 L15.75,5 L15.75,15.5 C15.75,16.690864 14.8248384,17.6656449 13.6540488,17.7448092 L13.5,17.75 L6,17.75 C4.80913601,17.75 3.83435508,16.8248384 3.75519081,15.6540488 L3.75,15.5 L3.75,5 C3.75,4.58578644 4.08578644,4.25 4.5,4.25 C4.87969577,4.25 5.19349096,4.53215388 5.24315338,4.89822944 L5.25,5 L5.25,15.5 C5.25,15.8796958 5.53215388,16.193491 5.89822944,16.2431534 L6,16.25 L13.5,16.25 C13.8796958,16.25 14.193491,15.9678461 14.2431534,15.6017706 L14.25,15.5 L14.25,5 C14.25,4.58578644 14.5857864,4.25 15,4.25 Z M8.25,1.25 L11.25,1.25 C12.440864,1.25 13.4156449,2.17516159 13.4948092,3.34595119 L13.5,3.5 L13.5,5 C13.5,5.41421356 13.1642136,5.75 12.75,5.75 C12.3703042,5.75 12.056509,5.46784612 12.0068466,5.10177056 L12,5 L12,3.5 C12,3.12030423 11.7178461,2.80650904 11.3517706,2.75684662 L11.25,2.75 L8.25,2.75 C7.87030423,2.75 7.55650904,3.03215388 7.50684662,3.39822944 L7.5,3.5 L7.5,5 C7.5,5.41421356 7.16421356,5.75 6.75,5.75 C6.37030423,5.75 6.05650904,5.46784612 6.00684662,5.10177056 L6,5 L6,3.5 C6,2.30913601 6.92516159,1.33435508 8.09595119,1.25519081 L8.25,1.25 L11.25,1.25 L8.25,1.25 Z"></path>
<path d="M7.5,8.75 L7.5,13.25 C7.5,13.6642136 7.83578644,14 8.25,14 C8.66421356,14 9,13.6642136 9,13.25 L9,8.75 C9,8.33578644 8.66421356,8 8.25,8 C7.83578644,8 7.5,8.33578644 7.5,8.75 Z"></path>
<path d="M10.5,8.75 L10.5,13.25 C10.5,13.6642136 10.8357864,14 11.25,14 C11.6642136,14 12,13.6642136 12,13.25 L12,8.75 C12,8.33578644 11.6642136,8 11.25,8 C10.8357864,8 10.5,8.33578644 10.5,8.75 Z"></path>
</g>
</svg>
<span><?php esc_html_e('Remove', $this->textDomain); ?></span>
</a>
<span class="elfsight-admin-page-widgets-list-item-actions-restore">
<span class="elfsight-admin-page-widgets-list-item-actions-restore-label"><?php esc_html_e('The widget has been removed.', $this->textDomain); ?></span>
<a href="#"><?php esc_html_e('Restore it', $this->textDomain); ?></a>
</span>
</td>
</tr>
</template>
<template class="elfsight-admin-template-widgets-list-empty elfsight-admin-template">
<tr class="elfsight-admin-page-widgets-list-empty-item">
<td class="elfsight-admin-page-widgets-list-empty-item-text" colspan="3">
<?php esc_html_e('There is no any widget yet.', $this->textDomain); ?>
<a href="#/add-widget/" data-elfsight-admin-page="add-widget"><?php esc_html_e('Create the first one.', $this->textDomain); ?></a>
</td>
</tr>
</template>
</article>

View File

@@ -0,0 +1,72 @@
<?php
if (!defined('ABSPATH')) exit;
$productReviewLink = '<a href="'.esc_url($this->productReviewUrl).'" target="_blank" rel="nofollow">CodeCanyon</a>';
$facebookReviewLink = '<a href="'.esc_url($this->productFacebookReviewUrl).'" target="_blank" rel="nofollow">Facebook</a>';
?><div class="elfsight-admin-popup elfsight-admin-popup-rating" data-elfsight-admin-popup-id="rating">
<div class="elfsight-admin-popup-inner">
<form class="elfsight-admin-popup-form" data-nonce="<?php echo wp_create_nonce($this->getOptionName('rating_send')); ?>">
<div class="elfsight-admin-popup-body">
<div class="elfsight-admin-popup-title"><?php /* translators: %s: Plugin Name */ printf(esc_html__('Enjoying %s Plugin?', $this->textDomain), $this->pluginName); ?></div>
<div class="elfsight-admin-popup-subtitle"><?php esc_html_e('Click a star to rate us', $this->textDomain); ?></div>
<fieldset class="elfsight-admin-popup-stars">
<input type="radio" id="elfsight-admin-popup-rating-stars-star5" name="rating-popup" value="5"/>
<label for="elfsight-admin-popup-rating-stars-star5" title="5 <?php esc_html_e('stars', $this->textDomain); ?>"></label>
<input type="radio" id="elfsight-admin-popup-rating-stars-star4" name="rating-popup" value="4"/>
<label for="elfsight-admin-popup-rating-stars-star4" title="4 <?php esc_html_e('stars', $this->textDomain); ?>"></label>
<input type="radio" id="elfsight-admin-popup-rating-stars-star3" name="rating-popup" value="3"/>
<label for="elfsight-admin-popup-rating-stars-star3" title="3 <?php esc_html_e('stars', $this->textDomain); ?>"></label>
<input type="radio" id="elfsight-admin-popup-rating-stars-star2" name="rating-popup" value="2"/>
<label for="elfsight-admin-popup-rating-stars-star2" title="2 <?php esc_html_e('stars', $this->textDomain); ?>"></label>
<input type="radio" id="elfsight-admin-popup-rating-stars-star1" name="rating-popup" value="1"/>
<label for="elfsight-admin-popup-rating-stars-star1" title="1 <?php esc_html_e('star', $this->textDomain); ?> "></label>
</fieldset>
<div class="elfsight-admin-popup-textarea elfsight-admin-popup-textarea-hide">
<label for="elfsight-admin-popup-rating-textarea"><?php esc_html_e('Please, let us know how we can improve our plugin', $this->textDomain); ?></label>
<textarea id="elfsight-admin-popup-rating-textarea" name="message"></textarea>
</div>
<div class="elfsight-admin-popup-text elfsight-admin-popup-text-hide">
<span class="elfsight-admin-popup-activated"><?php /* translators: %s: product review link */ printf(esc_html__('Please, share this rating on %s', $this->textDomain), $productReviewLink); ?></span>
<span class="elfsight-admin-popup-deactivated"><?php /* translators: %s: facebook review link */ printf(esc_html__('Please, share this recommendation on %s', $this->textDomain), $facebookReviewLink); ?></span>
</div>
</div>
<div class="elfsight-admin-popup-thanks">
<div class="elfsight-admin-popup-title"><?php esc_html_e('Thanks for helping us improve!', $this->textDomain); ?></div>
<div class="elfsight-admin-popup-subtitle"><?php esc_html_e('Your feedback is very important for us!', $this->textDomain); ?> ❤</div>
<div class="elfsight-admin-popup-text elfsight-admin-popup-text-hide">
<span class="elfsight-admin-popup-activated"><?php
printf(
/* translators: %1$s: br, %2$s: product review link */
esc_html__('We are very grateful %1$s for your awesome review on %2$s', $this->textDomain),
'<br>', $productReviewLink
);
?></span>
<span class="elfsight-admin-popup-deactivated"><?php
printf(
/* translators: %1$s: br, %2$s: facebook review link */
esc_html__('We are very grateful %1$s for your awesome recommendation on %2$s', $this->textDomain),
'<br>', $facebookReviewLink
);
?></span>
</div>
</div>
<div class="elfsight-admin-popup-footer">
<a class="elfsight-admin-popup-footer-button elfsight-admin-popup-footer-button-close"><?php esc_html_e('No, thanks', $this->textDomain); ?></a>
<a class="elfsight-admin-popup-activated elfsight-admin-popup-footer-button elfsight-admin-popup-footer-button-ok elfsight-admin-popup-footer-button-hide" href="<?php echo esc_url($this->productReviewUrl); ?>" target="_blank" rel="nofollow"><?php esc_html_e('Rate us', $this->textDomain); ?></a>
<a class="elfsight-admin-popup-deactivated elfsight-admin-popup-footer-button elfsight-admin-popup-footer-button-ok elfsight-admin-popup-footer-button-hide" href="<?php echo esc_url($this->productFacebookReviewUrl); ?>" target="_blank" rel="nofollow"><?php esc_html_e('Rate us', $this->textDomain); ?></a>
</div>
</form>
</div>
<div class="elfsight-admin-popup-loader elfsight-admin-loader"></div>
<div class="elfsight-admin-popup-overlay"></div>
</div>

View File

@@ -0,0 +1,148 @@
<?php
if (!defined('ABSPATH')) exit;
if (!class_exists('ElfsightYoutubeGalleryPluginUpdate')) {
class ElfsightYoutubeGalleryPluginUpdate {
public $currentVersion;
public $updateUrl;
public $pluginSlug;
public $slug;
public $purchaseCode;
public $wpAutoUpgradeEnabled;
public $host;
function __construct($update_url, $current_version, $plugin_slug, $purchase_code) {
$this->updateUrl = $update_url;
$this->currentVersion = $current_version;
$this->pluginSlug = $plugin_slug;
$this->purchaseCode = $purchase_code;
list($t1, $t2) = explode('/', $this->pluginSlug);
$this->slug = str_replace('.php', '', $t2);
$this->optionSlug = preg_replace('/-cc$/', '', $this->slug);
$this->host = parse_url(site_url(), PHP_URL_HOST);
add_filter('pre_set_site_transient_update_plugins', array($this, 'checkUpdate'));
add_filter('plugins_api', array($this, 'checkInfo'), 10, 3);
add_filter('auto_update_plugin', array($this, 'enrollUpgrade'), 10, 2);
add_action('upgrader_process_complete', array($this, 'completeUpgrade'), 10, 2);
}
public function checkUpdate($transient) {
$result = $this->getInfo('version');
update_option($this->getOptionName('last_check_datetime'), time());
if (!$transient) {
return false;
}
if (empty($transient->response)) {
$transient->response = array();
}
if (!$result || !$result->verification) {
return false;
}
if ($result->verification && !$result->verification->valid) {
delete_option($this->getOptionName('purchase_code'));
delete_option($this->getOptionName('activated'));
}
if (
$result &&
empty($result->error)
&& !empty($result->data)
&& version_compare($this->currentVersion, $result->data->version, '<')
) {
update_option($this->getOptionName('latest_version'), $result->data->version);
$result->data->plugin = $this->pluginSlug;
$transient->response[$this->pluginSlug] = $result->data;
}
return $transient;
}
public function checkInfo($result, $action, $args) {
$result = false;
if (isset($args->slug) && $args->slug === $this->slug) {
$info = $this->getInfo('info');
if (is_object($info) && empty($info->error) && !empty($info->data)) {
if (!empty($info->data->sections)) {
$info->data->sections = (array)$info->data->sections;
}
$result = $info->data;
}
}
return $result;
}
public function getInfo($action) {
$request_string = array(
'body' => array(
'action' => urlencode($action),
'slug' => urlencode($this->slug),
'purchase_code' => urlencode($this->purchaseCode),
'version' => urlencode($this->currentVersion),
'host' => $this->host
)
);
$result = false;
$response = wp_remote_post($this->updateUrl, $request_string);
if (!is_wp_error($response) || wp_remote_retrieve_response_code($response) === 200) {
if ($response_body = json_decode(wp_remote_retrieve_body($response))) {
$result = $response_body;
}
}
return $result;
}
public function sheduleAutoUpgrade() {
$event = 'elfsight_plugin_auto_upgrade_' . md5($this->pluginSlug);
add_action($event, array($this, 'upgrade'));
if (wp_next_scheduled($event)) {
return;
}
wp_schedule_event(time(), 'hourly', $event);
}
public function enrollUpgrade($default_state, $plugin) {
if ($plugin->slug !== $this->slug) {
return $default_state;
}
return get_option($this->getOptionName('auto_upgrade'), 'on') === 'on' ? true : false;
}
public function completeUpgrade($upgrader, $options) {
if (
$options['action'] !== 'update' ||
$options['type'] !== 'plugin' ||
($options['plugins'] && !in_array($this->pluginSlug, $options['plugins']))
) {
return;
}
update_option($this->getOptionName('last_upgraded_at'), time());
}
protected function getOptionName($name) {
return str_replace('-', '_', $this->optionSlug) . '_' . $name;
}
}
}

View File

@@ -0,0 +1,61 @@
<?php
if (!defined('ABSPATH')) exit;
if (!class_exists('ElfsightYoutubeGalleryVCElement')) {
class ElfsightYoutubeGalleryVCElement {
private $pluginName;
private $slug;
private $textDomain;
private $vcIcon;
private $widgetsApi;
public function __construct($config, $widgetsApi) {
$this->pluginName = $config['plugin_name'];
$this->slug = $config['slug'];
$this->textDomain = $config['text_domain'];
$this->vcIcon = $config['vc_icon'];
$this->widgetsApi = $widgetsApi;
add_action('vc_before_init', array($this, 'registerElement'));
}
public function registerElement() {
$widgets = array();
$widgetsList = array();
$this->widgetsApi->getList($widgets);
if (!empty($widgets['data'])) {
foreach ($widgets['data'] as $widget) {
$widgetsList[$widget['name'] .' ' ] = $widget['id'];
}
}
vc_map(array(
'name' => $this->pluginName,
'base' => str_replace('-', '_', $this->slug),
'class' => '',
'category' => 'Elfsight',
'icon' => $this->vcIcon,
'params' => array(
array(
'type' => 'dropdown',
'heading' => esc_html__('Select a widget ', $this->textDomain),
'param_name' => 'id',
'value' => $widgetsList,
'save_always' => true,
'description' => esc_html__(sprintf('You can manage the widgets on the <a href="%1$s" target="_blank">plugin\'s settings page</a>.', esc_url(admin_url('admin.php?page=' . $this->slug))), $this->textDomain)
)
)
));
}
}
}
?>

View File

@@ -0,0 +1,71 @@
<?php
if (!defined('ABSPATH')) exit;
if (!class_exists('ElfsightYoutubeGalleryWidget')) {
class ElfsightYoutubeGalleryWidget extends WP_Widget {
private $configSlug;
private $configPluginName;
private $configDescription;
private $configTextDomain;
private $widgetsApi;
public function __construct($config, $widgetsApi) {
$this->configSlug = $config['slug'];
$this->configPluginName = $config['plugin_name'];
$this->configDescription = $config['description'];
$this->configTextDomain = $config['text_domain'];
$this->widgetsApi = $widgetsApi;
parent::__construct(
$this->configSlug,
esc_html__($this->configPluginName, $this->configTextDomain),
array('description' => esc_html__($this->configDescription, $this->configTextDomain))
);
}
public function widget($args, $instance) {
extract($instance, EXTR_SKIP);
if (!empty($instance['id'])) {
echo do_shortcode('[' . str_replace('-', '_', $this->configSlug) . ' id="' . $instance['id'] . '"]');
}
}
public function form($instance) {
$widgets = array();
$widgetsList = array();
$this->widgetsApi->getList($widgets);
if (!empty($widgets['data'])) {?>
<p>
<label for="<?php echo esc_html($this->get_field_id('id')); ?>"><?php esc_html_e('Select a widget:', $this->configTextDomain); ?></label>
<select class='widefat' id="<?php echo esc_html($this->get_field_id('id')); ?>" name="<?php echo esc_html($this->get_field_name('id')); ?>">
<option value="0"><?php esc_html_e('— Select —', $this->configTextDomain); ?></option>
<?php foreach ($widgets['data'] as $widget) { ?>
<option value="<?php echo esc_html($widget['id']); ?>"<?php echo (!empty($instance['id']) && $instance['id'] == $widget['id']) ? ' selected' : ''; ?>><?php echo esc_html($widget['name']); ?></option>
<?php } ?>
</select>
</p>
<?php } else { ?>
<p>
<?php esc_html_e('No widgets yet.', $this->configTextDomain); ?>
<a href="<?php echo esc_url(admin_url('admin.php?page=' . $this->configSlug)); ?>#/add-widget/"><?php esc_html_e('Create the first one.', $this->configTextDomain); ?></a>
</p>
<?php }
}
public function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['id'] = !empty($new_instance['id']) ? $new_instance['id'] : '';
return $instance;
}
}
}
?>

View File

@@ -0,0 +1,363 @@
<?php
if (!defined('ABSPATH')) exit;
if (!class_exists('ElfsightYoutubeGalleryWidgetsApi')) {
class ElfsightYoutubeGalleryWidgetsApi {
private $slug;
private $file;
private $textDomain;
public static $ERROR_DOESNT_EXIST;
public static $ERROR_PARAM_ID_REQUIRED;
public static $ERROR_DATA_INVALID;
public static $ERROR_SQL;
public function __construct($slug, $file, $text_domain) {
self::$ERROR_DOESNT_EXIST = esc_html__('Widget with the specified id doesnt exist.', $text_domain);
self::$ERROR_PARAM_ID_REQUIRED = esc_html__('Parameter "id" is required.', $text_domain);
self::$ERROR_DATA_INVALID = esc_html__('Incoming data is invalid.', $text_domain);
self::$ERROR_SQL = esc_html__('An MySQL error occurred while adding new widget.', $this->textDomain);
$this->slug = $slug;
$this->file = $file;
$this->textDomain = $text_domain;
register_activation_hook($this->file, array($this, 'upgrade'));
add_action('rest_api_init', array($this, 'registerRoutes'));
}
public function registerRoutes() {
register_rest_route($this->slug, '/admin/widgets/(?P<endpoint>[\w-]+)/', array(
'methods' => 'GET, POST',
'callback' => array($this, 'restApi'),
'permission_callback' => '__return_true',
'args' => array(
'endpoint' => array(
'required' => true
)
)
));
}
public function restApi(\WP_REST_Request $request) {
$result = array();
$method = $request->get_method();
$endpoint = $request->get_param('endpoint');
$endpoint_handler_name = strtolower($method) . ucfirst($endpoint);
if (!wp_verify_nonce($request->get_header('X-WP-Nonce'), 'wp_rest')) {
return new \WP_REST_Response(array(
'status' => false,
'error' => __('Scrape nonce check failed. Please try again.')
), 400);
}
if (!method_exists($this, $endpoint_handler_name)) {
return new \WP_REST_Response(array(
'status' => false,
'error' => sprintf('Unknown endpoint "%s/%s"', $method, $endpoint)
), 400);
}
call_user_func_array(array($this, $endpoint_handler_name), array(&$result));
return new \WP_REST_Response($result, 200);
}
public function upgrade() {
if ($this->tableExists()) {
$this->alterTable();
} else {
$this->createTable();
}
}
public function alterTable() {
global $wpdb;
$is_old_sql = version_compare($wpdb->db_version(), '5.5.3', '<=');
$table_collate = $is_old_sql ? 'utf8_general_ci' : 'utf8mb4_general_ci';
$table_name = $this->getTableName();
$wpdb->query("ALTER TABLE $table_name MODIFY `options` longtext COLLATE $table_collate NOT NULL;");
}
public function tableExists() {
global $wpdb;
return !!$wpdb->get_var($wpdb->prepare(
"SHOW TABLES LIKE %s",
$this->getTableName()
));
}
public function createTable() {
global $wpdb;
$is_old_sql = version_compare($wpdb->db_version(), '5.5.3', '<=');
$table_collate = $is_old_sql ? 'utf8_general_ci' : 'utf8mb4_general_ci';
$table_name = $this->getTableName();
$wpdb->query(
"CREATE TABLE $table_name (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`time_created` varchar(10) NOT NULL,
`time_updated` varchar(10) NOT NULL,
`active` int(1) NOT NULL DEFAULT 1,
`options` longtext COLLATE $table_collate NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;"
);
}
public function getTableName() {
global $wpdb;
return esc_sql($wpdb->prefix . str_replace('-', '_', $this->slug) . '_widgets');
}
public function getList(&$result) {
global $wpdb;
$table_name = $this->getTableName();
$id = $this->input('id', null);
$id = $id ? esc_sql(intval($id)) : null;
$query = "SELECT * FROM $table_name WHERE `active` = 1";
if ($id) {
$query .= " AND `id` = $id";
}
$query .= " ORDER BY `id` DESC";
$list = $wpdb->get_results($query, ARRAY_A);
$result['status'] = is_null($list) ? false : true;
foreach ($list as &$widget) {
$options_raw_json = $widget['options'];
$widget['options'] = json_decode($options_raw_json);
}
$result['data'] = $list;
}
public function getPrepare(&$result) {
global $wpdb;
$table_name = $this->getTableName();
$query = "SELECT * FROM $table_name ORDER BY `id` DESC";
$list = $wpdb->get_results($query, ARRAY_A);
$result['status'] = true;
$result['data'] = array(
'test' => $list,
'widget_id' => count($list) + 1
);
}
public function postAdd(&$result) {
global $wpdb;
$table_name = $this->getTableName();
$data = $this->getPayloadData();
$options_json = null;
$invalid_fields = array();
if (empty($data['name']) || strlen($data['name']) > 255) {
$invalid_fields[] = 'name';
}
if (empty($data['options'])) {
$invalid_fields[] = 'options';
} else {
$options_json = $this->formatInputOptions($data['options']);
$options_json = apply_filters(str_replace('-', '_', $this->slug) . '_widget_options', $options_json);
if (!json_decode($options_json)) {
$invalid_fields[] = 'options';
}
}
if ($invalid_fields) {
$result['status'] = false;
$result['error'] = self::$ERROR_DATA_INVALID;
$result['invalid_fields'] = $invalid_fields;
} else {
$status = !!$wpdb->insert($table_name, array(
'name' => $data['name'],
'time_created' => time(),
'time_updated' => time(),
'active' => 1,
'options' => $options_json
));
$result['status'] = $status;
$result['id'] = $wpdb->insert_id;
if (!$status) {
$result['error'] = self::$ERROR_SQL;
} else if (get_option(str_replace('-', '_', $this->slug) . '_widgets_clogged') !== 'true') {
update_option(str_replace('-', '_', $this->slug) . '_widgets_clogged', 'true');
}
}
}
public function postRemove(&$result) {
global $wpdb;
$table_name = $this->getTableName();
$data = $this->getPayloadData();
$id = !empty($data['id']) ? intval($data['id']) : null;
if (!$id) {
$result['status'] = false;
$result['error'] = self::$ERROR_PARAM_ID_REQUIRED;
return;
}
$status = !!$wpdb->update(
$table_name,
array(
'active' => 0,
'time_updated' => time()
),
array('id' => $id)
);
$result['status'] = $status;
if (!$status) {
$result['error'] = self::$ERROR_DOESNT_EXIST;
}
}
public function postRestore(&$result) {
global $wpdb;
$table_name = $this->getTableName();
$data = $this->getPayloadData();
$id = !empty($data['id']) ? intval($data['id']) : null;
if (!$id) {
$result['status'] = false;
$result['error'] = self::$ERROR_PARAM_ID_REQUIRED;
return;
}
$status = !!$wpdb->update(
$table_name,
array(
'active' => 1,
'time_updated' => time()
),
array('id' => $id)
);
$result['status'] = $status;
if (!$status) {
$result['error'] = self::$ERROR_DOESNT_EXIST;
}
}
public function postUpdate(&$result) {
global $wpdb;
$table_name = $this->getTableName();
$data = $this->getPayloadData();
$id = !empty($data['id']) ? intval($data['id']) : null;
$name = !empty($data['name']) ? $data['name'] : null;
$options_json = !empty($data['options']) ? $this->formatInputOptions($data['options']) : null;
$options_json = apply_filters(str_replace('-', '_', $this->slug) . '_widget_options', $options_json);
if (!$id) {
$result['status'] = false;
$result['error'] = self::$ERROR_PARAM_ID_REQUIRED;
return;
}
$invalid_fields = array();
$fields = array('time_updated' => time());
if ($name) {
if (strlen($name) > 255) {
$invalid_fields[] = 'name';
} else {
$fields['name'] = $name;
}
}
if ($options_json) {
if (!json_decode($options_json)) {
$invalid_fields[] = 'options';
} else {
$fields['options'] = $options_json;
}
}
if ($invalid_fields) {
$result['status'] = false;
$result['error'] = self::$ERROR_DATA_INVALID;
$result['invalid_fields'] = $invalid_fields;
} else {
$status = !!$wpdb->update(
$table_name,
$fields,
array('id' => $id)
);
$result['status'] = $status;
if (!$status) {
$result['error'] = self::$ERROR_DOESNT_EXIST;
}
}
}
protected function getPayloadData() {
$json = file_get_contents('php://input');
return json_decode($json, true);
}
public function formatInputOptions($options) {
$options = rawurldecode($options);
$options = str_replace("\'", "\u0027", $options); // JSON_HEX_APOS
return $options;
}
protected function input($name, $default = null) {
$query = array();
if (empty($_REQUEST)) {
$parsed_url = parse_url($_SERVER['REQUEST_URI']);
if (isset($parsed_url['query'])) {
parse_str($parsed_url['query'], $query);
}
} else {
$query = $_REQUEST;
}
$value = isset($query[$name]) ? $query[$name] : $default;
return urldecode($value);
}
}
}

View File

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