File manager - Edit - /home/aresglob/public_html/wp/wp-includes/images/smilies/main.tar
Back
settings.php 0000644 00000311152 15100073403 0007111 0 ustar 00 <?php namespace SpeedyCache; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Settings{ static function base(){ global $speedycache; if(!file_exists(SPEEDYCACHE_CACHE_DIR) || !is_writable(WP_CONTENT_DIR)){ echo '<div class="notice notice-error"> <p><strong>Error:</strong> '.esc_html__('SpeedyCache was not able to create the cache directory, there might be a permission issue with the '.(defined('SITEPAD') ? 'sitepad-data' : 'wp-content').' directory.', 'speedycache').'</p> </div>'; } echo '<div id="speedycache-admin"> <div id="speedycache-navigation"> <div class="speedycache-logo"> <img src="'.esc_url(SPEEDYCACHE_URL . '/assets/images/speedycache.png').'" alt="SpeedyCache Logo" width="200" height="35"> <span>version '.esc_html(SPEEDYCACHE_VERSION).'</span> </div> <ul> <li><a href="#"><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/dashboard.svg"/>Dashboard</a></li> <li><a href="#cache"><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/cache.svg"/>Cache</a></li> <li><a href="#file"><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/file.svg"/>File Optimization</a></li> <li><a href="#excludes"><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/excludes.svg"/>Excludes</a></li> <li><a href="#preload"><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/preload.svg"/>Preloading</a></li> <li><a href="#media"><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/media.svg"/>Media</a></li> <li><a href="#cdn"><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/cdn.svg"/>CDN</a></li>'; if(!defined('SITEPAD')){ echo '<li><a href="#object"><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/object.svg"/>Object Cache</a></li>'; } echo' <li><a href="#image"><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/image.svg"/>Image Optimization</a></li>'; if(!defined('SITEPAD')){ echo '<li><a href="#bloat"><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/broom.svg"/>Bloat</a></li>'; } echo' <li><a href="#db"><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/db.svg"/>Database</a></li> <li><a href="#settings"><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/settings.svg"/>Settings</a></li>'; if(!defined('SITEPAD') && defined('SPEEDYCACHE_PRO')){ echo '<li><a href="#license"><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/license.svg"/> License</a></li>'; } echo '<ul> </div> <div class="speedycache-tabs"> <div class="speedycache-tab" id="speedycache-dashboard">'; self::dashboard_tab(); echo '</div> <div class="speedycache-tab" id="speedycache-cache">'; self::cache_tab(); echo '</div> <div class="speedycache-tab" id="speedycache-file">'; self::file_tab(); echo '</div> <div class="speedycache-tab" id="speedycache-preload">'; self::preload_tab(); echo '</div> <div class="speedycache-tab" id="speedycache-media">'; self::media_tab(); echo '</div> <div class="speedycache-tab" id="speedycache-excludes">'; self::excludes_tab(); echo '</div> <div class="speedycache-tab" id="speedycache-cdn">'; self::cdn_tab(); echo '</div> <div class="speedycache-tab" id="speedycache-image">'; do_action('speedycache_image_optm_tmpl'); if(!defined('SPEEDYCACHE_PRO') || (defined('SPEEDYCACHE_PRO_VERSION') && version_compare(SPEEDYCACHE_PRO_VERSION, '1.2.0', '<'))){ self::pro_notice('Image Optimization'); } echo '</div> <div class="speedycache-tab" id="speedycache-object">'; do_action('speedycache_object_cache_tmpl'); if(!defined('SPEEDYCACHE_PRO') || (defined('SPEEDYCACHE_PRO_VERSION') && version_compare(SPEEDYCACHE_PRO_VERSION, '1.2.0', '<'))){ self::pro_notice('Object Cache'); } echo '</div> <div class="speedycache-tab" id="speedycache-bloat">'; do_action('speedycache_bloat_tmpl'); if(!defined('SPEEDYCACHE_PRO') || (defined('SPEEDYCACHE_PRO_VERSION') && version_compare(SPEEDYCACHE_PRO_VERSION, '1.2.0', '<'))){ self::pro_notice('Bloat Settings'); } echo '</div> <div class="speedycache-tab" id="speedycache-db">'; do_action('speedycache_db_tmpl'); if(!defined('SPEEDYCACHE_PRO') || (defined('SPEEDYCACHE_PRO_VERSION') && version_compare(SPEEDYCACHE_PRO_VERSION, '1.2.0', '<'))){ self::pro_notice('DB Optimization'); } echo '</div> <div class="speedycache-tab" id="speedycache-settings">'; self::settings_tab(); echo '</div>'; if(!defined('SITEPAD')) { do_action('speedycache_license_tmpl'); } echo '</div>'; if(!defined('SITEPAD')) { echo '<div class="speedycache-sidebar"> <div class="speedycache-need-help"> <p>Quick Access</p> <div class="speedycache-quick-links"> <div class="speedycache-quick-access-item"> <span class="dashicons dashicons-format-status"></span> <a href="https://softaculous.deskuss.com/open.php?topicId=19" target="_blank">Support</a> </div> <div class="speedycache-quick-access-item"> <span class="dashicons dashicons-media-document"></span> <a href="https://speedycache.com/docs/" target="_blank">Documentation</a> </div> <div class="speedycache-quick-access-item"> <span class="dashicons dashicons-feedback"></span> <a href="https://softaculous.deskuss.com/open.php?topicId=19" target="_blank">Feedback</a> </div> <div class="speedycache-quick-access-item"> <span class="dashicons dashicons-star-filled"></span><a href="https://wordpress.org/support/plugin/speedycache/reviews/?rate=5#new-post" target="_blank">Rate Us</a> </div> </div> </div> </div>'; } echo '</div>'; } static function dashboard_tab(){ global $speedycache; $speed_results = get_option('speedycache_pagespeed_test', []); $speed_score = 0; $speed_colors = ['#0c6', '#00cc663b', '#080']; if(!empty($speed_results)){ $speed_colors = Util::pagespeed_color($speed_results['score']); $speed_score = $speed_results['score']; } $speedycache->object_memory = 'None'; if(!empty($speedycache->object['enable']) && class_exists('Redis') && class_exists('\SpeedyCache\ObjectCache')){ try{ $speedycache->object_memory = \SpeedyCache\ObjectCache::get_memory(); } catch(\Exception $e) { $memory = 'None'; } } $license_expires = ''; if(defined('SPEEDYCACHE_PRO') && !empty($speedycache->license['expires'])){ $license_expires = $speedycache->license['expires']; $license_expires = substr($license_expires, 0, 4).'/'.substr($license_expires, 4, 2).'/'.substr($license_expires, 6); } echo '<h2><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/dashboard.svg" height="32" width="32"/> Dashboard</h2> <div class="speedycache-admin-row"> <div class="speedycache-perf-score speedycache-is-block"> <div class="speedycache-perf-score-meter-heading"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" width="24" height="24"><path d="M349.4 44.6c5.9-13.7 1.5-29.7-10.6-38.5s-28.6-8-39.9 1.8l-256 224c-10 8.8-13.6 22.9-8.9 35.3S50.7 288 64 288H175.5L98.6 467.4c-5.9 13.7-1.5 29.7 10.6 38.5s28.6 8 39.9-1.8l256-224c10-8.8 13.6-22.9 8.9-35.3s-16.6-20.7-30-20.7H272.5L349.4 44.6z"/></svg> <h4>Performance Score <span id="speedycache-analyze">[Analyze]<span class="speedycache-spinner"></span></span></h4> </div> <div class="speedycache-perf-score-meter"> <div class="speedycache-perf-score-donut"> <svg width="80%" height="80%" viewBox="0 0 40 40"> <circle cx="20" cy="20" r="15.91549430918954" fill="'.esc_attr($speed_colors[1]).'"></circle> <circle cx="20" cy="20" r="15.91549430918954" fill="transparent" stroke-width="2" stroke-linecap="round" stroke-dasharray="'.esc_html($speed_score).' '.esc_html(100 - $speed_score).'" stroke-dashoffset="25" style="stroke:'.esc_attr($speed_colors[0]).';"></circle> <g class="speedycache-donut-text speedycache-donut-text-1"> <text y="56%" transform="translate(0, 2)"> <tspan x="50%" text-anchor="middle" style="fill:'.esc_attr($speed_colors[2]).'">'.esc_html($speed_score).'</tspan> </text> </g> </svg> </div> <div class="speedycache-perf-score-guide"> <div> <span style="background-color:#f33;"></span> 0-49 </div> <div> <span style="background-color:#fa3;"></span> 50-89 </div> <div> <span style="background-color:#0c6;"></span> 90-100 </div> </div> </div> </div> <div class="speedycache-dashboard-info">'; if(!defined('SITEPAD')){ echo' <div class="speedycache-licence-brief speedycache-is-block"> <h4>License</h4> <span>Version: '.esc_html(SPEEDYCACHE_VERSION).'</span> <span>Status: '.(!defined('SPEEDYCACHE_PRO') ? 'Free' : (!empty($speedycache->license) && defined('SPEEDYCACHE_PRO') ? 'Pro' : 'License not Linked')).'</span> <span>Expires on: '.(!defined('SPEEDYCACHE_PRO') ? 'Never' : (!empty($speedycache->license) && !empty($license_expires) ? esc_html($license_expires) : '')).'</span> </div>'; } echo' <div class="speedycache-is-block"> <h4>Cache Info</h4> <span>File Cache: '.(!empty($speedycache->options['status']) ? esc_html__('Enabled', 'speedycache') : esc_html__('Disabled', 'speedycache')).'</span>'; if(!defined('SITEPAD')){ echo'<span>Object Cache: '.(!empty($speedycache->object['enable']) ? esc_html__('Enabled', 'speedycache') : esc_html__('Disabled', 'speedycache')).'</span>'; } echo' <span>CDN: '.(!empty($speedycache->cdn) && !empty($speedycache->cdn['cdn_type']) ? esc_html(ucfirst($speedycache->cdn['cdn_type'])) : 'OFF').'</span> </div> </div> </div>'; // TODO: Need to add this stats code in the Pro version. if(defined('SPEEDYCACHE_PRO')){ do_action('speedycache_pro_stats_tmpl'); } echo '<h3>Manage Cache</h3> <form method="POST" action="'.esc_url(admin_url('admin-post.php')).'">'; wp_nonce_field('speedycache_post_nonce'); echo '<input type="hidden" value="speedycache_delete_cache" name="action"/> <div class="speedycache-option-wrap"> <label for="speedycache_delete_minified" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_delete_minified" name="minified"/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Delete Minified', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Deletes Minfied/ Combined CSS/JS files', 'speedycache').'</span> </div> </div>'; if(defined('SPEEDYCACHE_PRO')){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_delete_fonts" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_delete_fonts" name="fonts"/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Delete Fonts', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Deletes Local Google Fonts', 'speedycache').'</span> </div> </div>'; } echo '<div class="speedycache-option-wrap"> <label for="speedycache_delete_gravatars" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_delete_gravatars" name="gravatars"/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Delete Gravatars', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Delete locally hosted Gravatars.', 'speedycache').'</span> </div> </div> <div class="speedycache-option-wrap"> <label for="speedycache_preload_cache" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_preload_cache" name="preload_cache"/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Preload Cache', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('After cache gets deleted, it restarts auto cache generation.', 'speedycache').'</span> </div> </div> <div class="speedycache-option-wrap"> <div class="submit"> <input type="submit" value="'.esc_html__('Clear all cache and the selections', 'speedycache').'" class="speedycache-button speedycache-btn-black"/> </div> </div> </form>'; if(defined('SPEEDYCACHE_PRO')){ do_action('speedycache_pro_logs_tmpl'); } } static function cache_tab(){ global $speedycache; echo '<h2><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/cache.svg" height="32" width="32"/> Cache Settings</h2> <form method="post">'; wp_nonce_field('speedycache_ajax_nonce'); echo '<input type="hidden" value="speedycache_save_cache_settings" name="action"/> <div class="speedycache-option-wrap"> <label for="speedycache_enable_cache" class="speedycache-custom-checkbox"> <input type="checkbox" '.(!empty($speedycache->options['status']) ? ' checked' : '').' id="speedycache_enable_cache" name="status"/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Enable Cache', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Enables caching', 'speedycache').'</span> </div> </div> <div class="speedycache-option-wrap"> <label for="speedycache_mobile" class="speedycache-custom-checkbox"> <input type="checkbox" '.(!empty($speedycache->options['mobile']) ? ' checked' : '').' id="speedycache_mobile" name="mobile"/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Mobile Override', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Disable desktop cache display on mobile devices.', 'speedycache').'</span> </div> </div>'; if(defined('SPEEDYCACHE_PRO')){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_mobile_theme" class="speedycache-custom-checkbox"> <input type="checkbox" '.(!empty($speedycache->options['mobile_theme']) ? ' checked' : '').' id="speedycache_mobile_theme" name="mobile_theme"/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Mobile Cache', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Separate cache for Mobile version of your website, modern themes don\'t require this', 'speedycache').'</span> </div> </div>'; } else { echo '<div class="speedycache-option-wrap speedycache-disabled"> <label for="speedycache_mobile_theme" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_mobile_theme" disabled/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Mobile Cache', 'speedycache').'<span class="speedycache-premium-tag">'.esc_html__('Premium', 'speedycache').'</span></span> <span class="speedycache-option-desc">'.esc_html__('Separate cache for Mobile version of your website, modern themes don\'t require this', 'speedycache').'</span> </div> </div>'; } echo '<div class="speedycache-option-wrap"> <label for="speedycache_preload" class="speedycache-custom-checkbox"> <input type="checkbox" '.(!empty($speedycache->options['preload']) ? ' checked' : '').' id="speedycache_preload" name="preload"/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Preload', 'speedycache').' <span class="speedycache-modal-settings-link" setting-id="speedycache_preload" style="display:'.(!empty($speedycache->options['preload']) ? 'inline-block' : 'none').';">- Settings</span></span> <span class="speedycache-option-desc">'.esc_html__('Create the cache of all the site automatically', 'speedycache').'</span> </div> </div> <!--SpeedyCache Update Post Modal Starts Here--> <div modal-id="speedycache_preload" class="speedycache-modal"> <div class="speedycache-modal-wrap"> <div class="speedycache-modal-header"> <div>'.esc_html__('Preload Settings', 'speedycache').'</div> <div title="Close Modal" class="speedycache-close-modal"> <span class="dashicons dashicons-no"></span> </div> </div> <div class="speedycache-modal-content"> <p style="color:#666;margin-top:0 !important;">'.esc_html__('Select the interval after which you want the preload to run', 'speedycache').'</p> <div class="speedycache-form-input"> <label style="width:100%;"> <span style="font-weight:500; margin-bottom:5px">'.esc_html__('Select Preload interval', 'speedycache').'</span> <select name="preload_interval" value="'.(!empty($speedycache->options['preload_interval']) ? esc_attr($speedycache->options['preload_interval']) : '').'"> <option value="2" '.(isset($speedycache->options['preload_interval']) ? selected($speedycache->options['preload_interval'], '2', false) : '').'>'.esc_html__('Every 2 hours', 'speedycache').'</option> <option value="6" '.(isset($speedycache->options['preload_interval']) ? selected($speedycache->options['preload_interval'], '6', false) : '').'>'.esc_html__('Every 6 hours', 'speedycache').'</option> <option value="12" '.(isset($speedycache->options['preload_interval']) ? selected($speedycache->options['preload_interval'], '12', false) : '').'>'.esc_html__('Every 12 hours', 'speedycache').'</option> <option value="24" '.(isset($speedycache->options['preload_interval']) ? selected($speedycache->options['preload_interval'], '24', false) : '').'>'.esc_html__('Once a day', 'speedycache').'</option> <option value="168" '.(isset($speedycache->options['preload_interval']) ? selected($speedycache->options['preload_interval'], '168', false) : '').'>'.esc_html__('Once a week', 'speedycache').'</option> </select> </label> </div> </div> <div class="speedycache-modal-footer"> <button type="button" action="close"> <span>'.esc_html__('Submit', 'speedycache').'</span> </button> </div> </div> </div> <div class="speedycache-option-wrap"> <label for="speedycache_lbc" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_lbc" name="lbc" '.(!empty($speedycache->options['lbc']) ? ' checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Browser Caching', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Stores web data locally for faster loading.', 'speedycache').'</span> </div> </div> <div class="speedycache-option-wrap"> <label for="speedycache_logged_in_user" class="speedycache-custom-checkbox"> <input type="checkbox" '.(!empty($speedycache->options['logged_in_user']) ? ' checked' : '').' id="speedycache_logged_in_user" name="logged_in_user"/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Logged-in Users', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Serve cached version to logged in user.', 'speedycache').'</span> </div> </div> <div class="speedycache-option-wrap"> <label for="speedycache_gzip_compression" class="speedycache-custom-checkbox"> <input type="checkbox" '.(!empty($speedycache->options['gzip']) ? ' checked' : '').' id="speedycache_gzip_compression" name="gzip"/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('GZIP Compressions', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Compresses the text files to reduce the size to be sent on the network.', 'speedycache').'</span> </div> </div> <div class="speedycache-option-wrap"> <label for="speedycache_purge_varnish" class="speedycache-custom-checkbox"> <input type="checkbox" '.(!empty($speedycache->options['purge_varnish']) ? ' checked' : '').' id="speedycache_purge_varnish" name="purge_varnish" /> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Purge Varnish', 'speedycache').' <span class="speedycache-modal-settings-link" setting-id="speedycache_purge_varnish" style="display:'.(!empty($speedycache->options['purge_varnish']) ? 'inline-block' : 'none').';">- Settings</span> </span> <span class="speedycache-option-desc">'.esc_html__('Deletes cache created by Varnish on Deletion of cache from SpeedyCache', 'speedycache').'</span> </div> </div> <!--SpeedyCache Update Post Modal Starts Here--> <div modal-id="speedycache_purge_varnish" class="speedycache-modal"> <div class="speedycache-modal-wrap"> <div class="speedycache-modal-header"> <div>'.esc_html__('Varnish Settings', 'speedycache').'</div> <div title="Close Modal" class="speedycache-close-modal"> <span class="dashicons dashicons-no"></span> </div> </div> <div class="speedycache-modal-content"> <p style="color:#666;margin-top:0 !important;">'.esc_html__('If you use any different IP for Varnish than the default then set it here.', 'speedycache').'</p> <div class="speedycache-form-input"> <label style="width:100%;"> <span style="font-weight:500; margin-bottom:5px">'.esc_html__('Set your Varnish IP', 'speedycache').'</span> <input type="text" name="varniship" style="width:100%;" value="'. (!empty($speedycache->options['varniship']) ? esc_attr($speedycache->options['varniship']) : '127.0.0.1').'"/><br/> </label> </div> </div> <div class="speedycache-modal-footer"> <button type="button" action="close"> <span>'.esc_html__('Submit', 'speedycache').'</span> </button> </div> </div> </div> <h3>'.esc_html__('Cache Lifespan', 'speedycache').'</h3> <p>'.esc_html__('This defines the time after which the cache will be automatically deleted. Set to 0 to disable automatic cache deletion.', 'speedycache').'</p> <input type="number" min="0" name="purge_interval" value="'.(isset($speedycache->options['purge_interval']) ? esc_html($speedycache->options['purge_interval']) : 24).'"/> <select name="purge_interval_unit"> <option value="hours" '.(!empty($speedycache->options['purge_interval_unit']) ? selected($speedycache->options['purge_interval_unit'], 'hours', false) : ' selected').'>'.esc_html__('Hours', 'speedycache').'</option> <option value="days" '.(!empty($speedycache->options['purge_interval_unit']) ? selected($speedycache->options['purge_interval_unit'], 'days', false) : '').'>'.esc_html__('Days', 'speedycache').'</option> </select> <div> <input type="checkbox" id="speedycache-run-exact-time" name="purge_enable_exact_time" value="1" '.(!empty($speedycache->options['purge_enable_exact_time']) ? checked($speedycache->options['purge_enable_exact_time'], true, false) : '').'/>'.esc_html__('Run at exact time', 'speedycache').' <div id="speedycache-exact-time-selector" style="'.(empty($speedycache->options['purge_enable_exact_time']) ? 'display:none;' : '').'"> <label> <input type="time" name="purge_exact_time" value="'.(!empty($speedycache->options['purge_exact_time']) ? esc_attr($speedycache->options['purge_exact_time']) : '').'"/>'.esc_html__('Select exact time', 'speedycache').' </label> <p class="description">'.esc_html__('This is dependent on WP Cron, which does not guarantee execution at an exact time. For more details, ', 'speedycache').'<a href="https://speedycache.com/docs/caching/running-cache-lifespan-at-specific-time/" target="_blank">click here</a> </div> <div> <input type="checkbox" name="auto_purge_fonts" value="1" '.(!empty($speedycache->options['auto_purge_fonts']) ? checked($speedycache->options['auto_purge_fonts'], true, false) : '').'/>'.esc_html__('Delete Fonts', 'speedycache').' <input type="checkbox" name="auto_purge_gravatar" value="1" '.(!empty($speedycache->options['auto_purge_gravatar']) ? checked($speedycache->options['auto_purge_gravatar'], true, false) : '').'/>'.esc_html__( 'Delete Gravatar', 'speedycache').' <p class="description">'.esc_html__('Deletion of these options only takes effect if the lifespan is more than 10 hours.', 'speedycache').'</p> </div> </div> '; self::save_btn(); echo '</form>'; } static function file_tab(){ global $speedycache; echo '<h2><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/file.svg" height="32" width="32"/> File Optimization</h2> <form method="post">'; wp_nonce_field('speedycache_ajax_nonce'); echo '<input type="hidden" name="action" value="speedycache_save_file_settings"/>'; if(defined('SPEEDYCACHE_PRO')){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_minify_html" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_minify_html" name="minify_html" '.(!empty($speedycache->options['minify_html']) ? ' checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Minify HTML', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Removes comments, extra spaces', 'speedycache').'</span> </div> </div>'; } else { echo '<div class="speedycache-option-wrap speedycache-disabled"> <label class="speedycache-custom-checkbox"> <input type="checkbox" disabled/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Minify HTML', 'speedycache').'<span class="speedycache-premium-tag">'.esc_html__('Premium', 'speedycache').'</span></span> <span class="speedycache-option-desc">'.esc_html__('Removes comments, extra spaces', 'speedycache').'</span> </div> </div>'; } echo '<div class="speedycache-option-wrap"> <label for="speedycache_minify_css" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_minify_css" name="minify_css" '.(!empty($speedycache->options['minify_css']) ? ' checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Minify CSS', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('You can decrease the size of CSS files', 'speedycache').'</span> </div> </div> <div class="speedycache-option-wrap"> <label for="speedycache_combine_css" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_combine_css" name="combine_css" '.(!empty($speedycache->options['combine_css']) ? ' checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Combine CSS', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Combines CSS files to reduce HTTP requests', 'speedycache').'</span> </div> </div>'; // Critical CSS Option if(!defined('SITEPAD')){ if(defined('SPEEDYCACHE_PRO') && !empty($speedycache->license) && !empty($speedycache->license['active'])){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_critical_css" class="speedycache-custom-checkbox" style="margin-top:0;"> <input type="checkbox" id="speedycache_critical_css" name="critical_css" '.(!empty($speedycache->options['critical_css']) ? ' checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Critical CSS', 'speedycache'); if(!empty($speedycache->options['critical_css'])){ echo ' - <span class="speedycache-action-link" action-name="speedycache_critical_css">'.esc_html__('Create Now', 'speedycache').'</span> | <span class="speedycache-modal-settings-link" setting-id="speedycache_critical_css">'.esc_html__('Logs', 'speedycache').'</span>'; } echo '</span><span class="speedycache-option-desc">'.esc_html__('It extracts the necessary CSS of the viewport on load to improve load speed.', 'speedycache').'</span> </div> </div>'; echo wp_kses(\SpeedyCache\CriticalCss::status_modal(), array_merge(wp_kses_allowed_html('post'), [ 'div' => [ 'modal-id' => true, 'class' => true, 'title' => true, 'style' => true, ] ])); } else { if(empty($speedycache->license) || empty($speedycache->license['active'])){ $need_key = true; } echo '<div class="speedycache-option-wrap speedycache-disabled"> <label class="speedycache-custom-checkbox"> <input type="checkbox" disabled/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Critical CSS', 'speedycache').' <span class="speedycache-premium-tag">'.(!empty($need_key) ? 'Link License Key' : 'Premium').'</span></span> <span class="speedycache-option-desc">'.esc_html__('It extracts the necessary CSS of the viewport on load to improve load speed.', 'speedycache').'</span> </div> </div>'; } } // Unused CSS if(!defined('SITEPAD')){ if(defined('SPEEDYCACHE_PRO') && !empty($speedycache->license) && !empty($speedycache->license['active'])){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_unused_css" class="speedycache-custom-checkbox" style="margin-top:0;"> <input type="checkbox" id="speedycache_unused_css" name="unused_css" '.(!empty($speedycache->options['unused_css']) ? ' checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name" title="Unused CSS"><span>'.esc_html__('Unused CSS', 'speedycache').'</span><a href="https://speedycache.com/docs/file-optimization/how-to-remove-unused-css/" target="_blank"><span class="dashicons dashicons-info" style="font-size:14px"></span></a> <span class="speedycache-modal-settings-link" setting-id="speedycache_unused_css" style="display:'.(!empty($speedycache->options['unused_css']) ? 'inline-block' : 'none').';">- Settings</span> </span><span class="speedycache-option-desc">'.esc_html__('It removes the unused CSS.', 'speedycache').'</span> </div> </div> <div modal-id="speedycache_unused_css" class="speedycache-modal"> <div class="speedycache-modal-wrap"> <div class="speedycache-modal-header"> <div>'.esc_html__('Unused CSS Settings', 'speedycache').'</div> <div title="Close Modal" class="speedycache-close-modal"> <span class="dashicons dashicons-no"></span> </div> </div> <div class="speedycache-modal-content speedycache-info-modal"> <p>'.esc_html__('Extracts the CSS being used on the page.', 'speedycache').'</p> <div> <label> <span style="font-weight:500; margin:20px 0 3px 0; display:block;">'.esc_html__('Load Unused CSS', 'speedycache').'</span> <span class="speedycache-model-label-description" style="margin-bottom:5px;">'.esc_html__('Select the way you want the Unused CSS to load.', 'speedycache').'</span> </label> <input type="radio" id="speedycache_unusedcss_async" name="unusedcss_load" value="async" '.(empty($speedycache->options['unusedcss_load']) || (!empty($speedycache->options['unusedcss_load']) && $speedycache->options['unusedcss_load'] == 'async') ? 'checked' : '').'/> <input type="radio" id="speedycache_unusedcss_interaction" name="unusedcss_load" value="interaction" '.(!empty($speedycache->options['unusedcss_load']) && $speedycache->options['unusedcss_load'] == 'interaction' ? 'checked' : '').'/> <input type="radio" id="speedycache_unusedcss_remove" name="unusedcss_load" value="remove" '.(!empty($speedycache->options['unusedcss_load']) && $speedycache->options['unusedcss_load'] == 'remove' ? 'checked' : '').'/> <div class="speedycache-radio-input"> <label for="speedycache_unusedcss_async">'.esc_html__('Asynchronously', 'speedycache').'</label> <label for="speedycache_unusedcss_interaction">'.esc_html__('On User Interaction', 'speedycache').'</label> <label for="speedycache_unusedcss_remove">'.esc_html__('Remove', 'speedycache').'</label> </div> </div> <div class="speedycache-unusedcss-excludes"> <label for="speedycache_unused_css_exclude_stylesheets" style="width:100%;"> <span style="font-weight:500; margin:20px 0 3px 0; display:block;">'.esc_html__('Exclude Stylesheets', 'speedycache').'</span> <span class="speedycache-model-label-description">'.esc_html__('Enter the URL, name or the stylesheet to be excluded from removing unused CSS.', 'speedycache').'</span> <textarea name="unused_css_exclude_stylesheets" id="speedycache_unused_css_exclude_stylesheets" rows="4" placeholder="Enter URL, CSS file name one per line">'.(!empty($speedycache->options['unused_css_exclude_stylesheets']) ? esc_html(implode("\n", $speedycache->options['unused_css_exclude_stylesheets'])) : '').'</textarea> </label> <br><br> <label for="speedycache_unusedcss_include_selector" style="width:100%;"> <span style="font-weight:500; margin:20px 0 3px 0; dispaly:block;">'.esc_html__('Include Selectors', 'speedycache').'</span> <span class="speedycache-model-label-description">'.esc_html__('Enter Selectors you want to be included in used CSS', 'speedycache').'</span> <textarea name="unusedcss_include_selector" id="speedycache_unusedcss_include_selector" rows="4" placeholder="Enter selector one per line">'.(!empty($speedycache->options['unusedcss_include_selector']) ? esc_html(implode("\n", $speedycache->options['unusedcss_include_selector'])) : '').'</textarea> </label> </div> <div class="speedycache-modal-footer"> <button type="button" action="close"> <span>'.esc_html__('Submit', 'speedycache').'</span> </button> </div> </div> </div> </div>'; } else { echo '<div class="speedycache-option-wrap speedycache-disabled"> <label class="speedycache-custom-checkbox"> <input type="checkbox" disabled/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Unused CSS', 'speedycache').'<span class="speedycache-premium-tag">'.(!empty($need_key) ? 'Link License Key' : 'Premium').'</span></span> <span class="speedycache-option-desc">'.esc_html__('It removes the unused CSS from the page.', 'speedycache').'</span> </div> </div>'; } } if(defined('SPEEDYCACHE_PRO')){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_minify_js" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_minify_js" name="minify_js" '.(!empty($speedycache->options['minify_js']) ? ' checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Minify JS', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('You can decrease the size of JS files', 'speedycache').'</span> </div> </div>'; } else { echo '<div class="speedycache-option-wrap speedycache-disabled"> <div class="speedycache-form-input"> <label class="speedycache-custom-checkbox"> <input type="checkbox"disabled/> <div class="speedycache-input-slider"></div> </label> </div> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Minify JS', 'speedycache').'<span class="speedycache-premium-tag">Premium</span></span> <span class="speedycache-option-desc">'.esc_html__('You can decrease the size of JS files', 'speedycache').'</span> </div> </div>'; } echo '<div class="speedycache-option-wrap"> <label for="speedycache_combine_js" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_combine_js" name="combine_js" '.(!empty($speedycache->options['combine_js']) ? ' checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Combine JS', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Reduce HTTP requests by Combining JS files', 'speedycache').'</span> </div> </div>'; // Delay JS option if(defined('SPEEDYCACHE_PRO')){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_delay_js" class="speedycache-custom-checkbox" style="margin-top:0;"> <input type="checkbox" id="speedycache_delay_js" name="delay_js" '.(!empty($speedycache->options['delay_js']) ? ' checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name"><span>'.esc_html__('Delay JS', 'speedycache').'</span><a href="https://speedycache.com/docs/file-optimization/how-to-delay-js-until-user-interaction/" target="_blank"><span class="dashicons dashicons-info" style="font-size:14px"></span></a> <span class="speedycache-modal-settings-link" setting-id="speedycache_delay_js" style="display:'.(!empty($speedycache->options['delay_js']) ? 'inline-block' : 'none').';">- Settings</span> </span><span class="speedycache-option-desc">'.esc_html__('Delays JS until user interaction(like scroll, click etc) to improve performance', 'speedycache').'</span> </div> </div> <div modal-id="speedycache_delay_js" class="speedycache-modal"> <div class="speedycache-modal-wrap"> <div class="speedycache-modal-header"> <div>'.esc_html__('Delay JS', 'speedycache').'</div> <div title="Close Modal" class="speedycache-close-modal"> <span class="dashicons dashicons-no"></span> </div> </div> <div class="speedycache-modal-content speedycache-info-modal"> <p>'.esc_html__('Delay All is a more aggressive option which can increase the chances of breaking the site too.', 'speedycache').'</p> <input type="radio" id="speedycache_delayjs_selected" name="delay_js_mode" value="selected" '.(empty($speedycache->options['delay_js_mode']) || (!empty($speedycache->options['delay_js_mode']) && $speedycache->options['delay_js_mode'] == 'selected') ? 'checked' : '').'/> <input type="radio" id="speedycache_delayjs_all" name="delay_js_mode" value="all" '.(!empty($speedycache->options['delay_js_mode']) && $speedycache->options['delay_js_mode'] == 'all' ? 'checked' : '').'/> <div class="speedycache-radio-input"> <label for="speedycache_delayjs_selected">'.esc_html__('Delay Selected', 'speedycache').'</label> <label for="speedycache_delayjs_all">'.esc_html__('Delay All', 'speedycache').'</label> </div> <div class="speedycache-delay_js_list"> <label for="speedycache_delay_js_excludes" style="width:100%;"> <span style="font-weight:500; margin:20px 0 3px 0; display:block;">Scripts to exclude</span> <span style="display:block; font-weight:400; font-size:12px; color: #2c2a2a;">Enter Below The Scipts that you no not want to be delayed.</span> <textarea name="delay_js_excludes" id="speedycache_delay_js_excludes" rows="4" placeholder="jquery.min">'.(!empty($speedycache->options['delay_js_excludes']) && is_array($speedycache->options['delay_js_excludes']) ? esc_html(implode("\n", $speedycache->options['delay_js_excludes'])) : '').'</textarea> </label> <label for="speedycache_delay_js_scripts" style="width:100%;"> <span style="font-weight:500; margin:20px 0 3px 0; dispaly:block;">Scripts to Delay</span> <span style="display:block; font-weight:400; font-size:12px; color: #2c2a2a;">Enter the scripts that you want to be delayed like googletagmanager.com</span> <textarea name="delay_js_scripts" id="speedycache_delay_js_scripts" rows="4" placeholder="googletagmanager.com">'.(!empty($speedycache->options['delay_js_scripts']) && is_array($speedycache->options['delay_js_scripts']) ? esc_html(implode("\n", $speedycache->options['delay_js_scripts'])) : '').'</textarea> <h5>Suggestions</h5> <p style="position: relative;"> <button class="speedycache-delay-suggestions"> <span>Use These</span> <svg xmlns="http://www.w3.org/2000/svg" height="18px" viewBox="0 -960 960 960" width="18px" fill="#e3e3e3"><path d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"/></svg> </button> <span class="speedycache-modal-scripts"> fbevents.js<br> google-analytics.com<br> adsbygoogle.js<br> googletagmanager.com<br> fbq(<br> ga( \' <br> ga(\'<br> /gtm.js<br> /gtag/js<br> gtag(<br> /gtm-<br> /gtm.<br> </span> </p> </label> </div> <div class="speedycache-modal-footer"> <button type="button" action="close"> <span>'.esc_html__('Submit', 'speedycache').'</span> </button> </div> </div> </div> </div>'; }else{ echo '<div class="speedycache-option-wrap speedycache-disabled"> <label class="speedycache-custom-checkbox" style="margin-top:0;"> <input type="checkbox" disabled/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Delay JS', 'speedycache').'<span class="speedycache-premium-tag">Premium</span></span> </span><span class="speedycache-option-desc">'.esc_html__('Delays JS until user interaction(like scroll, click etc) to improve performance', 'speedycache').'</span> </div> </div>'; } if(defined('SPEEDYCACHE_PRO')){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_render_blocking" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_render_blocking" name="render_blocking" '.(!empty($speedycache->options['render_blocking']) ? ' checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name" setting-id="speedycache_render_blocking">'.esc_html__('Defer JS', 'speedycache').' <span class="speedycache-modal-settings-link" setting-id="speedycache_render_blocking" style="display:'.(!empty($speedycache->options['render_blocking']) ? 'inline-block' : 'none').';">- Settings</span> </span><span class="speedycache-option-desc">'.esc_html__('Defers render-blocking JavaScript resources', 'speedycache').'</span> </div> </div> <div modal-id="speedycache_render_blocking" class="speedycache-modal"> <div class="speedycache-modal-wrap"> <div class="speedycache-modal-header"> <div>'.esc_html__('Defer JS', 'speedycache').'</div> <div title="Close Modal" class="speedycache-close-modal"> <span class="dashicons dashicons-no"></span> </div> </div> <div class="speedycache-modal-content speedycache-info-modal"> <div> <label for="speedycache_render_blocking_excludes" style="width:100%;"> <span style="font-weight:500; margin:20px 0 3px 0; display:block;">'.esc_html__('Exclude script from Render Blocking JS', 'speedycache').'</span> <span style="display:block; font-weight:400; font-size:12px; color: #2c2a2a;">'.esc_html__('Add one script per line ,Enter the script URL or script ID', 'speedycache').'</span> <textarea name="render_blocking_excludes" id="speedycache_render_blocking_excludes" rows="4" style="width:100%">'.(!empty($speedycache->options['render_blocking_excludes']) && is_array($speedycache->options['render_blocking_excludes']) ? esc_html(implode("\n", $speedycache->options['render_blocking_excludes'])) : '').'</textarea> </label> </div> <div class="speedycache-modal-footer"> <button type="button" action="close"> <span>'.esc_html__('Submit', 'speedycache').'</span> </button> </div> </div> </div> </div>'; } else { echo '<div class="speedycache-option-wrap speedycache-disabled"> <label class="speedycache-custom-checkbox"> <input type="checkbox" disabled/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Defer JS', 'speedycache').'<span class="speedycache-premium-tag">'.esc_html__('Premium', 'speedycache').'</span></span> <span class="speedycache-option-desc">'.esc_html__('Defers render-blocking JavaScript resources', 'speedycache').'</span> </div> </div>'; } echo '<div class="speedycache-option-wrap"> <label for="speedycache_disable_emojis" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_disable_emojis" name="disable_emojis" '. (!empty($speedycache->options['disable_emojis']) ? ' checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Disable Emojis', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('You can remove the emoji inline css and wp-emoji-release.min.js', 'speedycache').'</span> </div> </div>'; // Lazy Render HTML element if(defined('SPEEDYCACHE_PRO')){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_lazy_load_html" class="speedycache-custom-checkbox" style="margin-top:0;"> <input type="checkbox" id="speedycache_lazy_load_html" name="lazy_load_html" '.(!empty($speedycache->options['lazy_load_html']) ? ' checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name"><span>'.esc_html__('Lazy Render HTML Element', 'speedycache').'</span><a href="https://speedycache.com/docs/file-optimization/how-to-lazy-render-html-elements/" target="_blank"><span class="dashicons dashicons-info" style="font-size:14px"></span></a> <span class="speedycache-modal-settings-link" setting-id="speedycache_lazy_load_html" style="display:'.(!empty($speedycache->options['lazy_load_html']) ? 'inline-block' : 'none').';">- Settings</span> </span><span class="speedycache-option-desc">'.esc_html__('Lazy Render a HTML element(class or id) if not in view-port.', 'speedycache').'</span> </div> </div> <div modal-id="speedycache_lazy_load_html" class="speedycache-modal"> <div class="speedycache-modal-wrap"> <div class="speedycache-modal-header"> <div>'.esc_html__('Lazy Render HTML Elements', 'speedycache').'</div> <div title="Close Modal" class="speedycache-close-modal"> <span class="dashicons dashicons-no"></span> </div> </div> <div class="speedycache-modal-content speedycache-info-modal"> <p>'.esc_html__('Lazy Rendering HTML is usually good for Comments.', 'speedycache').'</p> <div> <label for="speedycache_lazy_load_html_elements" style="width:100%;"> <span style="font-weight:500; margin:20px 0 3px 0; display:block;">'.esc_html__('Elements to Lazy Render', 'speedycache').'</span> <span style="display:block; font-weight:400; font-size:12px; color: #2c2a2a;">'.esc_html__('Add one element per line, use # as prefix for ID and . as prefix for class.', 'speedycache').'</span> <textarea name="lazy_load_html_elements"id="lazy_load_html_elements" rows="4" style="width:100%">'.(!empty($speedycache->options['lazy_load_html_elements']) ? esc_html(implode("\n", $speedycache->options['lazy_load_html_elements'])) : '').'</textarea> </label> </div> <div class="speedycache-modal-footer"> <button type="button" action="close"> <span>'.esc_html__('Submit', 'speedycache').'</span> </button> </div> </div> </div> </div>'; }else{ echo '<div class="speedycache-option-wrap speedycache-disabled"> <label for="speedycache_lazy_load_html" class="speedycache-custom-checkbox" style="margin-top:0;"> <input type="checkbox" disabled/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Lazy Render HTML Element', 'speedycache').'<span class="speedycache-premium-tag">'.esc_html__('Premium', 'speedycache').'</span></span> </span><span class="speedycache-option-desc">'.esc_html__('Lazy Render a HTML element(class or id) if not in view-port.', 'speedycache').'</span> </div> </div>'; } self::save_btn(); echo '</form>'; } static function preload_tab(){ global $speedycache; echo '<h2><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/preload.svg" height="32" width="32"/> Preload Settings</h2> <form method="post">'; wp_nonce_field('speedycache_ajax_nonce'); echo '<input type="hidden" value="speedycache_save_preload_settings" name="action"/>'; if(defined('SPEEDYCACHE_PRO')){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_critical_images" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_critical_images" name="critical_images" '.(!empty($speedycache->options['critical_images']) ? 'checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Preload Critical Images', 'speedycache').' <span class="speedycache-modal-settings-link" setting-id="speedycache_critical_images" style="display:'.(!empty($speedycache->options['critical_images']) ? 'inline-block' : 'none').';">- Settings</span></span> <span class="speedycache-option-desc">'.esc_html__('Preloads critical Images to improve LCP', 'speedycache').'</span> </div> </div> <!--SpeedyCache Lazy Load Modal Starts here--> <div modal-id="speedycache_critical_images" class="speedycache-modal"> <div class="speedycache-modal-wrap"> <div class="speedycache-modal-header"> <div>'.esc_html__('Preload Critical Images', 'speedycache').'</div> <div title="Close Modal" class="speedycache-close-modal"> <span class="dashicons dashicons-no"></span> </div> </div> <div class="speedycache-modal-content speedycache-info-modal"> <div class="speedycache-modal-block"> <p>'.esc_html__('Select the number of images you want to be preloaded.', 'speedycache').'</p> <table> <tr> <th>'.esc_html__('Critical Image Count', 'speedycache').'</th> <td> <div class="speedycache-form-input"> <select name="critical_image_count" value="'.(!isset($speedycache->options['critical_image_count']) ? '' : esc_attr($speedycache->options['critical_image_count'])).'">'; $image_count = array('1','2','3','4','5'); foreach($image_count as $count){ echo '<option value="'.esc_attr($count).'" '. ((!empty($speedycache->options['critical_image_count']) && $speedycache->options['critical_image_count'] == $count ) ? ' selected' : '') .'>'.esc_html($count).'</option>'; } echo '</select> </div> </td> </tr> </table> </div> </div> <div class="speedycache-modal-footer"> <button type="button" action="close"> <span>'.esc_html__('Submit', 'speedycache').'</span> </button> </div> </div> </div>'; } else { echo '<div class="speedycache-option-wrap speedycache-disabled"> <label class="speedycache-custom-checkbox"> <input type="checkbox" disabled/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Preload Critical Images', 'speedycache').'<span class="speedycache-premium-tag">'.esc_html__('Premium', 'speedycache').'</span></span> <span class="speedycache-option-desc">'.esc_html__('Preloads critical Images to improve LCP', 'speedycache').'</span> </div> </div>'; } if(defined('SPEEDYCACHE_PRO')){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_instant_page" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_instant_page" name="instant_page" '.(!empty($speedycache->options['instant_page']) ? 'checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Instant Page', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Improves page load speed', 'speedycache').'</span> </div> </div>'; } else { echo '<div class="speedycache-option-wrap speedycache-disabled"> <label class="speedycache-custom-checkbox"> <input type="checkbox" disabled/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Instant Page', 'speedycache').'<span class="speedycache-premium-tag">'.esc_html__('Premium', 'speedycache').'</span></span> <span class="speedycache-option-desc">'.esc_html__('Improves page load speed', 'speedycache').'</span> </div> </div>'; } if ( !defined('SITEPAD') && (version_compare( get_bloginfo( 'version' ), '6.8', '>=' )) ) { echo '<div class="speedycache-option-wrap"> <label for="speedycache_speculative_loading" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_speculative_loading" name="speculation_loading" '.(!empty($speedycache->options['speculation_loading']) ? 'checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Edit Speculative Loading', 'speedycache').' <span class="speedycache-modal-settings-link" setting-id="speedycache_speculative_loading" style="display:'.(!empty($speedycache->options['speculation_loading']) ? 'inline-block' : 'none').';">- Settings</span></span> <span class="speedycache-option-desc">'.esc_html__('Change how aggresive you want preloading/prefetching to happen.','speedycache').'</span> </div> </div> <div modal-id="speedycache_speculative_loading" class="speedycache-modal"> <div class="speedycache-modal-wrap"> <div class="speedycache-modal-header"> <div>'.esc_html__('Speculation Settings', 'speedycache').'</div> <div title="Close Modal" class="speedycache-close-modal"> <span class="dashicons dashicons-no"></span> </div> </div> <div class="speedycache-modal-content"> <p style="color:#666;margin-top:0 !important;"></p> <div class="speedycache-form-input"> <label style="width:100%;"> <span style="font-weight:500; margin-bottom:5px">'.esc_html__('Select the Speculation Mode', 'speedycache').'</span> <select name="speculation_mode" value="'.(!empty($speedycache->options['speculation_mode']) ? esc_attr($speedycache->options['speculation_mode']) : '').'"> <option value="auto" '.(isset($speedycache->options['speculation_mode']) ? selected($speedycache->options['speculation_mode'], 'auto', false) : '').'>'.esc_html__('Auto', 'speedycache').'</option> <option value="prefetch" '.(isset($speedycache->options['speculation_mode']) ? selected($speedycache->options['speculation_mode'], 'prefetch', false) : '').'>'.esc_html__('Prefetch', 'speedycache').'</option> <option value="prerender" '.(isset($speedycache->options['speculation_mode']) ? selected($speedycache->options['speculation_mode'], 'prerender', false) : '').'>'.esc_html__('Prerender', 'speedycache').'</option> <option value="disabled" '.(isset($speedycache->options['speculation_mode']) ? selected($speedycache->options['speculation_mode'], 'disabled', false) : '').'>'.esc_html__('Disabled', 'speedycache').'</option> </select> </label> </div> <div class="speedycache-form-input"> <label style="width:100%;"> <span style="font-weight:500; margin-bottom:5px">'.esc_html__('Select Eagerness', 'speedycache').'</span> <select name="speculation_eagerness" value="'.(!empty($speedycache->options['speculation_eagerness']) ? esc_attr($speedycache->options['speculation_eagerness']) : '').'"> <option value="auto" '.(isset($speedycache->options['speculation_eagerness']) ? selected($speedycache->options['speculation_eagerness'], 'auto', false) : '').'>'.esc_html__('Auto', 'speedycache').'</option> <option value="eager" '.(isset($speedycache->options['speculation_eagerness']) ? selected($speedycache->options['speculation_eagerness'], 'eager', false) : '').'>'.esc_html__('Eager', 'speedycache').'</option> <option value="moderate" '.(isset($speedycache->options['speculation_eagerness']) ? selected($speedycache->options['speculation_eagerness'], 'moderate', false) : '').'>'.esc_html__('Moderate', 'speedycache').'</option> <option value="conservative" '.(isset($speedycache->options['speculation_eagerness']) ? selected($speedycache->options['speculation_eagerness'], 'conservative', false) : '').'>'.esc_html__('Conservative', 'speedycache').'</option> </select> </label> </div> </div> <div class="speedycache-modal-footer"> <button type="button" action="close"> <span>'.esc_html__('Submit', 'speedycache').'</span> </button> </div> </div> </div>'; } if(!defined('SITEPAD')){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_dns_prefetch" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_dns_prefetch" name="dns_prefetch" '.(!empty($speedycache->options['dns_prefetch']) ? 'checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('DNS Prefetch', 'speedycache').' <span class="speedycache-modal-settings-link" setting-id="speedycache_dns_prefetch" style="display:'.(!empty($speedycache->options['dns_prefetch']) ? 'inline-block' : 'none').';">- Settings</span></span> <span class="speedycache-option-desc">'.esc_html__('DNS prefetching can make external files load faster.', 'speedycache').'</span> </div> </div> <div modal-id="speedycache_dns_prefetch" class="speedycache-modal"> <div class="speedycache-modal-wrap"> <div class="speedycache-modal-header"> <div>'.esc_html__('Prefetch DNS Requests', 'speedycache').'</div> <div title="Close Modal" class="speedycache-close-modal"> <span class="dashicons dashicons-no"></span> </div> </div> <div class="speedycache-modal-content speedycache-info-modal"> <h3>'.esc_html__('How DNS Prefetch can help?', 'speedycache').'</h3> <p>'.esc_html__('DNS prefetch can improve page load performance by resolving domain names in advance, so that the browser can start loading resources from those domains as soon as possible.', 'speedycache').'</p> <label><strong>'.esc_html__('URLs to prefetch', 'speedycache').'</strong> <span style="display:block;">'.esc_html__('Specify external hosts to be prefetched (no http:, one per line)', 'speedycache').'</span> <textarea name="dns_urls" style="width:100%" rows="4" placeholder="//example.com">'.(!empty($speedycache->options['dns_urls']) ? esc_html(implode("\n", $speedycache->options['dns_urls'])) : '').'</textarea> </label> </div> <div class="speedycache-modal-footer"> <button type="button" action="close"> <span>'.esc_html__('Submit', 'speedycache').'</span> </button> </div> </div> </div>'; } if(defined('SPEEDYCACHE_PRO')){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_preload_resources" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_preload_resources" name="preload_resources" '.(!empty($speedycache->options['preload_resources']) ? 'checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Preload Resources', 'speedycache').' <span class="speedycache-modal-settings-link" setting-id="speedycache_preload_resources" style="display:'.(!empty($speedycache->options['preload_resources']) ? 'inline-block' : 'none').';">- Settings</span></span> <span class="speedycache-option-desc">'.esc_html__('Hints browser to load resources early.', 'speedycache').'</span> </div> </div>'; } else { echo '<div class="speedycache-option-wrap speedycache-disabled"> <label class="speedycache-custom-checkbox"> <input type="checkbox" disabled/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'. esc_html__('Preload Resources', 'speedycache').'<span class="speedycache-premium-tag">'.esc_html__('Premium', 'speedycache').'</span></span> <span class="speedycache-option-desc">'. esc_html__('Hints browser to load resources early.', 'speedycache').'</span> </div> </div>'; } if(!defined('SITEPAD')){ if(defined('SPEEDYCACHE_PRO')){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_pre_connect" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_pre_connect" name="pre_connect" '. (!empty($speedycache->options['pre_connect']) ? 'checked' : '') .'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'. esc_html__('PreConnect', 'speedycache').' <span class="speedycache-modal-settings-link" setting-id="speedycache_pre_connect" style="display:'. (!empty($speedycache->options['pre_connect']) ? 'inline-block' : 'none').';">- Settings</span></span> <span class="speedycache-option-desc">'.esc_html__('Establish early connections to speed up page load.', 'speedycache').'</span> </div> </div>'; } else { echo '<div class="speedycache-option-wrap speedycache-disabled"> <label class="speedycache-custom-checkbox"> <input type="checkbox" disabled/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'. esc_html__('Preconnect', 'speedycache') .'<span class="speedycache-premium-tag">'.esc_html__('Premium', 'speedycache').'</span></span> <span class="speedycache-option-desc">'. esc_html__('Establish early connections to speed up page load.', 'speedycache').'</span> </div> </div>'; } } self::save_btn(); echo '</form>'; if(defined('SPEEDYCACHE_PRO')){ echo '<div modal-id="speedycache_preload_resources" class="speedycache-modal"> <div class="speedycache-modal-wrap"> <div class="speedycache-modal-header"> <div>'.esc_html__('Preload Resource', 'speedycache').'</div> <div title="Close Modal" class="speedycache-close-modal"> <span class="dashicons dashicons-no"></span> </div> </div> <div class="speedycache-modal-content speedycache-info-modal"> <form class="speedycache-pseudo-form" data-type="preload_resource_list">'. wp_kses(self::preload_modal_options('preload_resource', ['type' => true, 'crossorigin' => true, 'priority' => true, 'device' => true]), [ 'input' => ['type' => true, 'value' => true, 'style' => true, 'name' => true, 'placeholder' => true], 'option' => ['value' => true], 'select' => ['name' => true, 'required' => true], 'label' => ['for' => true, 'style' => true], 'div' => ['class' => true, 'style' => true], 'span' => ['class' => true, 'title' => true, 'spdf-hover-tooltip' => true, 'spdf-tooltip-position' => true], ]).' <div style="display:flex; justify-content:center;"> <button type="submit" class="speedycache-button speedycache-btn-black speedycache-preloading-add">Add<span class="speedycache-spinner"></span></button> </div> </form>'; echo '<p><strong>Note:</strong> Preloading too many resources can actually slow down your website, so it\'s important to only preload the resources that are absolutely necessary for the initial load. These might include fonts, image, CSS or JS files.</p>'; echo '<div style="width:100%; overflow-x:scroll;"><table class="speedycache-table speedycache-preloading-table" data-type="preload_resource_list"> <thead> <tr> <th class="speedycache-table-hitem" scope="col" width="70%">'.esc_html__('Resource', 'speedycache').'</th> <th class="speedycache-table-hitem" scope="col" width="15%">'. esc_html__('Type', 'speedycache').'</th> <th class="speedycache-table-hitem" scope="col" width="10%"><abbr title="Crossorigin">'. esc_html__('CS', 'speedycache').'</abbr></th> <th class="speedycache-table-hitem" scope="col" width="10%">'. esc_html__('Device', 'speedycache').'</th> <th class="speedycache-table-hitem" scope="col" width="10%">'. esc_html__('Fetch Priority', 'speedycache').'</th> <th class="speedycache-table-hitem" scope="col" width="5%"></th> </tr> </thead> <tbody>'; if(empty($speedycache->options['preload_resource_list']) || !is_array($speedycache->options['preload_resource_list'])){ echo '<tr><td colspan="6" align="center" class="speedycache-preloading-empty">No Resource Preload added yet</td></tr>'; } else { foreach($speedycache->options['preload_resource_list'] as $pkey => $preload_resource){ echo '<tr> <td>'.esc_url($preload_resource['resource']).'</td> <td>'.esc_html($preload_resource['type']).'</td> <td>'.(!empty($preload_resource['crossorigin']) ? 'Yes' : 'No').'</td> <td>'.(!empty($preload_resource['device']) ? esc_html($preload_resource['device']) : 'All').'</td> <td>'.(!empty($preload_resource['fetch_priority']) ? esc_html(ucfirst($preload_resource['fetch_priority'])) : 'Auto').'</td> <td data-key="'.esc_attr($pkey).'"><span class="dashicons dashicons-trash"></span></td> </tr>'; } } echo '</tbody> </table> </div> </div> </div> </div>'; if(!defined('SITEPAD')){ echo' <div modal-id="speedycache_pre_connect" class="speedycache-modal"> <div class="speedycache-modal-wrap"> <div class="speedycache-modal-header"> <div>'. esc_html__('Preconnect', 'speedycache').'</div> <div title="Close Modal" class="speedycache-close-modal"> <span class="dashicons dashicons-no"></span> </div> </div> <div class="speedycache-modal-content speedycache-info-modal"> <form class="speedycache-pseudo-form" data-type="pre_connect_list"> '.wp_kses(self::preload_modal_options('pre_connect', ['crossorigin' => true]), [ 'input' => ['type' => true, 'value' => true, 'style' => true, 'name' => true, 'placeholder' => true], 'option' => ['value' => true], 'select' => ['name' => true, 'required' => true], 'label' => ['for' => true, 'style' => true], 'div' => ['class' => true, 'style' => true], 'span' => ['aria-label' => true, 'data-microtip-position' => true, 'role' => true], ]).' <div style="display:flex; justify-content:center;"> <button tabindex="" type="submit" class="speedycache-button speedycache-btn-black speedycache-preloading-add">Add<span class="speedycache-spinner"></span><span class="dashicons dashicons-yes speedycache-spinner-done"></span></button> </div> </form>'; if(!empty($speedycache->options['pre_connect_list']) && count($speedycache->options['pre_connect_list']) > 6){ echo '<p><strong>Note:</strong> A good rule of thumb is to limit the number of preconnects to 6-8. However, the exact number will vary depending on the specific website and the resources that are being loaded.</p>'; } echo '<table class="speedycache-table speedycache-preloading-table" data-type="pre_connect_list"> <thead> <tr> <th class="speedycache-table-hitem" scope="col" width="80%">'.esc_html__('Resource', 'speedycache').'</th> <th class="speedycache-table-hitem" scope="col" width="15%">'. esc_html__('Crossorigin', 'speedycache').'</th> <th class="speedycache-table-hitem" scope="col" width="5%"></th> </tr> </thead> <tbody>'; if(empty($speedycache->options['pre_connect_list']) || !is_array($speedycache->options['pre_connect_list'])){ echo '<tr><td colspan="4" align="center" class="speedycache-preloading-empty">'.esc_html__('No PreConnect added yet', 'speedycache').'</td></tr>'; } else { foreach($speedycache->options['pre_connect_list'] as $pkey => $pre_connect){ echo '<tr> <td>'.esc_html($pre_connect['resource']).'</td> <td>'.(!empty($pre_connect['crossorigin']) ? 'Yes' : 'No').'</td> <td data-key="'.esc_html($pkey).'"><span class="dashicons dashicons-trash"></span></td> </tr>'; } } echo '</tbody> </table> </div> </div> </div>'; } } } static function cdn_tab(){ global $speedycache; $default_file_types = ['aac', 'css', 'eot', 'gif', 'jpeg', 'js', 'jpg', 'less', 'mp3', 'mp4', 'ogg', 'otf', 'pdf', 'png', 'svg', 'swf', 'ttf', 'webm', 'webp', 'woff', 'woff2']; echo '<h2><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/cdn.svg" height="32" width="32"/> CDN Settings</h2> <form method="POST">'; wp_nonce_field('speedycache_ajax_nonce'); echo '<input type="hidden" value="speedycache_save_cdn_settings" name="action"/> <div class="speedycache-option-wrap"> <label for="speedycache_enable_cdn" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_enable_cdn" name="enable_cdn" '.(!empty($speedycache->cdn['enabled']) ? ' checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Enable CDN', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('This will start rewriting asset URL\'s to the CDN URL', 'speedycache').'</span> </div> </div> <div class="speedycache-stacked-option-wrap"> <div class="speedycache-option-info"> <label class="speedycache-option-name">'.esc_html__('Select CDN Provider', 'speedycache').'</label> </div> <div> <select id="speedycache-cdn-type" name="cdn_type" value="'.(!empty($speedycache->cdn['cdn_type']) ? esc_attr($speedycache->cdn['cdn_type']) : '').'"> <option value="cloudflare" '. (!empty($speedycache->cdn['cdn_type']) ? selected($speedycache->cdn['cdn_type'], 'cloudflare', false) : '').'>Cloudflare</option> <option value="bunny" '. (!empty($speedycache->cdn['cdn_type']) ? selected($speedycache->cdn['cdn_type'], 'bunny', false) : '').'>Bunny</option> <option value="other" '. (!empty($speedycache->cdn['cdn_type']) ? selected($speedycache->cdn['cdn_type'], 'other', false) : '').'>Others</option> </select> </div> </div> <div class="speedycache-stacked-option-wrap"> <div class="speedycache-option-info"> <label class="speedycache-option-name">'.esc_html__('CDN URL', 'speedycache').'</label> <span class="speedycache-option-desc">'.esc_html__('It is the URL that CDN Provider provides you.', 'speedycache').'</span> </div> <div> <input type="url" name="cdn_url" style="width:50%;" value="'.(!empty($speedycache->cdn['cdn_url']) ? esc_url($speedycache->cdn['cdn_url']) : '').'" id="speedycache-cdn-url" placeholder="https://cdn-url.com"/> </div> </div> <div class="speedycache-stacked-option-wrap"> <div class="speedycache-option-info"> <label class="speedycache-option-name">'.esc_html__('API Key', 'speedycache').'</label> <span class="speedycache-option-desc">'.esc_html__('API keys/ tokens are not required but used to purge cache on CDN when cache from SpeedyCache gets purged.', 'speedycache').'</span> </div> <div> <input type="text" name="cdn_key" style="width:50%;" id="speedycache-cdn-key" value="'.(!empty($speedycache->cdn['cdn_key']) ? esc_html($speedycache->cdn['cdn_key']) : '').'"/> </div> </div> <div class="speedycache-stacked-option-wrap"> <div class="speedycache-option-info"> <label class="speedycache-option-name">'.esc_html__('File Types', 'speedycache').'</label> <span class="speedycache-option-desc">'.esc_html__('Types of files you want to be served through the CDN(one file per line)', 'speedycache').'</span> </div> <div> <textarea name="file_types" style="width:50%;" rows="5">'.(!empty($speedycache->cdn['file_types']) ? esc_html(implode("\n", $speedycache->cdn['file_types'])) : esc_html(implode("\n", $default_file_types))).'</textarea> </div> </div> <div class="speedycache-stacked-option-wrap"> <div class="speedycache-option-info"> <label class="speedycache-option-name">'.esc_html__('Exclude Sources', 'speedycache').'</label> <span class="speedycache-option-desc">'.esc_html__('Files you do not want to be rewritten to a CDN url(one file per line).', 'speedycache').'</span> </div> <div> <textarea name="excludekeywords" style="width:50%;" rows="5">'.(!empty($speedycache->cdn['excludekeywords']) ? esc_html(implode("\n", $speedycache->cdn['excludekeywords'])) : '').'</textarea> </div> </div> <div class="speedycache-stacked-option-wrap"> <div class="speedycache-option-info"> <label class="speedycache-option-name">'.esc_html__('Specific Sources', 'speedycache').'</label> <span class="speedycache-option-desc">'.esc_html__('Specific files which you want to be rewritten using CDN URL(one file per line).', 'speedycache').'</span> </div> <div> <textarea name="keywords" style="width:50%;" rows="5">'.(!empty($speedycache->cdn['keywords']) ? esc_html(implode("\n", $speedycache->cdn['keywords'])) : '').'</textarea> </div> </div>'; self::save_btn(); echo '</form>'; } static function excludes_tab(){ $excludes = get_option('speedycache_exclude', []); echo '<h2><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/excludes.svg" height="32" width="32"/> Exclude Settings</h2> <div class="speedycache-table-actions"> <div class="speedycache-table-filter"> <select id="speedycache-type-filter"> <option value="">All</option> <option value="cookie">Cookies</option> <option value="js">JS</option> <option value="css">CSS</option> <option value="useragent">User Agent</option> <option value="page">Page</option> </select> </div> <div class="speedycach-table-add-new"><button class="speedycache-button speedycache-btn-black" id="speedycache_add_excludes">'.esc_html__('Add New Rule', 'speedycache').'</button></div> </div> <div class="speedycache-table speedycache-exclude-list" id="speedycache-exclude-list"> <table> <thead> <tr role="row"> <th>Type</th> <th>Prefix</th> <th>Content</th> <th>Actions</th> </tr> </thead> <tbody>'; if(empty($excludes)){ echo '<tr role="row"> <td colspan="4">'.esc_html__('No exclude rule added yet','speedycache').'</td> </tr>'; } else { foreach($excludes as $id => $exclude){ echo '<tr role="row" data-id='.esc_attr($id).'> <td>'.esc_html($exclude['type']).'</td> <td>'.esc_html($exclude['prefix']).'</td>'; if($exclude['prefix'] == 'post_id'){ if(!is_array($exclude['content'])){ $exclude['content'] = explode(',', $exclude['content']); } echo '<td>'.'#ID:'; foreach($exclude['content'] as $exclude){ $post = get_post($exclude); if(empty($post)){ continue; } $post_link = get_permalink($post->ID); echo '<a href="'.esc_url($post_link).'" class="speedycache-tooltip-link" target="_blank">'.esc_html($exclude); // We show a tool tip with the excluded page URL and title echo '<div class="speedycache-link-tooltip"> <h4>'.esc_html($post->post_title).'</h4> <p>'.esc_url($post_link).'</p> </div></a>'; } echo '</td>'; } else{ echo'<td>'.esc_html($exclude['content']).'</td>'; } echo'<td><button class="speedycache-button speedycache-delete-rule">Delete<span class="speedycache-spinner"></span></button> </tr>'; } } echo '</tbody> </table> </div> <div modal-id="speedycache_add_excludes" class="speedycache-modal"> <div class="speedycache-modal-wrap"> <div class="speedycache-modal-header"> <div>'.esc_html__('Add Exclude Rule', 'speedycache').'</div> <div title="Close Modal" class="speedycache-close-modal"> <span class="dashicons dashicons-no"></span> </div> </div> <div class="speedycache-modal-content speedycache-info-modal"> <form method="POST"> <input type="hidden" name="action" value="speedycache_save_excludes"/>'; wp_nonce_field('speedycache_ajax_nonce'); echo '<div class="speedycache-input-wrap"> <label for="speedycache-exclude-type">Exclude Type</label> <select name="type" id="speedycache-exclude-type" class="speedycache-100" required> <option value="page"/>Page</option> <option value="useragent"/>User-Agent</option> <option value="cookie"/>Cookie</option> <option value="css"/>CSS</option> <option value="js"/>JS</option> </select> </div> <div class="speedycache-input-wrap"> <label for="speedycache-exclude-rule-prefix">Exclude</label> <select name="prefix" id="speedycache-exclude-rule-prefix" class="speedycache-100" required> <option selected="" value="" selected data-partof="page">Select a Value</option> <option value="homepage" data-partof="page">Home Page</option> <option value="category" data-partof="page">Categories</option> <option value="tag" data-partof="page">Tags</option> <option value="post" data-partof="page">Posts</option> <option value="page" data-partof="page">Pages</option> <option value="post_id" data-partof="page">Post ID</option> <option value="shortcode" data-partof="page">Shortcode</option> <option value="archive" data-partof="page">Archives</option> <option value="attachment" data-partof="page">Attachments</option> <option value="startwith" data-partof="page">Starts With</option> <option value="contain" data-partof="page,useragent,cookie,css,js">Contains</option> <option value="exact" data-partof="page">URI Is Equal To</option>'; if (!defined('SITEPAD')){ echo '<option value="woocommerce_items_in_cart" data-partof="cookie">has Woocommerce Items in Cart</option>'; } echo' </select> </div> <div class="speedycache-input-wrap" style="display:none;"> <label for="speedycache-exclude-rule-content">Content</label> </div> <div class="speedycache-exclude-btn-wrap"> <button class="speedycache-button speedycache-btn-black">'.esc_html__('Save Rule', 'speedycache').'<span class="speedycache-spinner"></button> </div> </form> </div> </div> </div>'; } static function media_tab(){ global $speedycache; // Backward compatibility if(!empty($speedycache->options['lazy_load_keywords']) && is_string($speedycache->options['lazy_load_keywords'])){ $speedycache->options['lazy_load_keywords'] = explode(',', $speedycache->options['lazy_load_keywords']); } echo '<h2><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/media.svg" height="32" width="32"/> Media Settings</h2> <form method="POST">'; wp_nonce_field('speedycache_ajax_nonce'); echo '<input type="hidden" name="action" value="speedycache_save_media_settings"/>'; if(!defined('SITEPAD')){ echo' <div class="speedycache-option-wrap"> <label for="speedycache_gravatar_cache" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_gravatar_cache" name="gravatar_cache" '.(!empty($speedycache->options['gravatar_cache']) ? 'checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Gravatar Cache', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Locally host Gravatar', 'speedycache').'</span> </div> </div>'; } if(defined('SPEEDYCACHE_PRO')){ echo '<div class="speedycache-option-wrap"> <input type="hidden" value="'.(isset($speedycache->options['lazy_load_placeholder']) ? esc_attr($speedycache->options['lazy_load_placeholder']) : '').'" id="speedycache_lazy_load_placeholder" name="lazy_load_placeholder"/> <input style="display: none;" type="checkbox" '.(isset($speedycache->options['lazy_load_exclude_full_size_img']) ? esc_attr($speedycache->options['lazy_load_exclude_full_size_img']) : '').' id="speedycache_lazy_load_exclude_full_size_img" name="lazy_load_exclude_full_size_img"> <label for="speedycache_lazy_load" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_lazy_load" name="lazy_load" '.(!empty($speedycache->options['lazy_load']) ? ' checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Lazy Load', 'speedycache').' <span class="speedycache-modal-settings-link" setting-id="speedycache_lazy_load" style="display:'.(!empty($speedycache->options['lazy_load']) ? 'inline-block' : 'none').';">- Settings</span></span> <span class="speedycache-option-desc">'.esc_html__('Load images and iframes when they enter the browsers viewport', 'speedycache').'</span> </div> </div> <!--SpeedyCache Lazy Load Modal Starts here--> <div modal-id="speedycache_lazy_load" class="speedycache-modal"> <div class="speedycache-modal-wrap"> <div class="speedycache-modal-header"> <div>'.esc_html__('Lazy Load Settings', 'speedycache').'</div> <div title="Close Modal" class="speedycache-close-modal"> <span class="dashicons dashicons-no"></span> </div> </div> <div class="speedycache-modal-content speedycache-info-modal"> <div class="speedycache-modal-block"> <h4>'.esc_html__('Image Placeholder', 'speedycache').'</h4> <p>'.esc_html__('Specify an image to be used as a placeholder while other images finish loading.', 'speedycache').' <a target="_blank" href="https://speedycache.com/docs/miscellaneous/lazy-load-images-and-iframes/"> <span class="dashicons dashicons-info"></span> </a> </p> <div class="speedycache-form-input"> <select name="lazy_load_placeholder" id="speedycache-ll-type" class="speedycache_lazy_load_placeholder speedycache-100" value="'.(!isset($speedycache->options['lazy_load_placeholder']) ? '' : esc_attr($speedycache->options['lazy_load_placeholder'])).'"> <option value="default" '.((isset($speedycache->options['lazy_load_placeholder']) && $speedycache->options['lazy_load_placeholder'] == 'default') ? 'selected' : '').'>'.esc_html(preg_replace("/https?\:\/\//", '', esc_url(SPEEDYCACHE_URL))).'/assets/images/image-palceholder.png'.'</option> <option value="custom" '.((isset($speedycache->options['lazy_load_placeholder']) && $speedycache->options['lazy_load_placeholder'] == 'custom') ? 'selected' : '').'>'.esc_html__('Custom Placeholder', 'speedycache').'</option> </select> </div>'; $hide_css_class = ''; if(isset($speedycache->options['lazy_load_placeholder']) && $speedycache->options['lazy_load_placeholder'] != 'custom'){ $hide_css_class = 'speedycache-hidden '; } echo '<div class="speedycache-form-input"> <input type="text" id="speedycache-custom-ll-url" class="'.esc_attr($hide_css_class).'speedycache-100" placeholder="https://example.com/sample.jpg" name="lazy_load_placeholder_custom_url" value="'.(!isset($speedycache->options['lazy_load_placeholder_custom_url']) ? '' : esc_url($speedycache->options['lazy_load_placeholder_custom_url'])).'"/> </div> <div class="speedycache-modal-block"> <h4>'.esc_html__('Exclude above fold images', 'speedycache').'</h4> <p>'.esc_html__('Number of images you want to exclude from getting lazyloaded from top of the screen', 'speedycache').'</p> <select name="exclude_above_fold">'; foreach([0,1,2,3,4,5] as $exclude_no){ $selected = ''; if(isset($speedycache->options['exclude_above_fold']) && $exclude_no == $speedycache->options['exclude_above_fold']){ $selected = 'selected'; }elseif(!isset($speedycache->options['exclude_above_fold']) && $exclude_no == 2){ $selected = 'selected'; } echo '<option value="'.esc_attr($exclude_no).'" '.esc_attr($selected).'>'.esc_html($exclude_no).'</option>'; } echo '</select> </div> <div class="speedycache-modal-block"> <h4>'.esc_html__('Exclude Sources', 'speedycache').'</h4> <p>'.esc_html__('It is enough to write a keyword such as', 'speedycache').' <strong>home.jpg or iframe or .gif</strong> instead of full url.</p> <div class="speedycache-form-input"> <label for="speedycache-full-width"> '.esc_html__('Add Keyword', 'speedycache').' <span class="speedycache-input-desc">('.esc_html__('one keyword per line', 'speedycache').')</span> <textarea name="lazy_load_keywords" class="speedycache-100" rows="5">'.(empty($speedycache->options['lazy_load_keywords']) ? '' : esc_attr(implode("\n", $speedycache->options['lazy_load_keywords']))).'</textarea> </label> </div>'; echo '</div> </div></div> <div class="speedycache-modal-footer"> <button type="button" action="close"> <span>'.esc_html__('Submit', 'speedycache').'</span> </button> </div> </div> </div>'; } else { echo '<div class="speedycache-option-wrap speedycache-disabled"> <label class="speedycache-custom-checkbox"> <input type="checkbox" disabled/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Lazy Load', 'speedycache').'<span class="speedycache-premium-tag">'.esc_html__('Premium', 'speedycache').'</span></span> <span class="speedycache-option-desc">'.esc_html__('Load images and iframes when they enter the browsers viewport', 'speedycache').'</span> </div> </div>'; } if(defined('SPEEDYCACHE_PRO')){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_image_dimensions" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_image_dimensions" name="image_dimensions" '.(!empty($speedycache->options['image_dimensions']) ? 'checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Image Dimensions', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Adds dimensions to the image, to reduce CLS', 'speedycache').'</span> </div> </div>'; } else { echo '<div class="speedycache-option-wrap speedycache-disabled"> <label class="speedycache-custom-checkbox"> <input type="checkbox" disabled/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Image Dimensions', 'speedycache').'<span class="speedycache-premium-tag">'. esc_html__('Premium', 'speedycache').'</span></span> <span class="speedycache-option-desc">'.esc_html__('Adds dimensions to the image, to reduce CLS', 'speedycache').'</span> </div> </div>'; } if(defined('SPEEDYCACHE_PRO')){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_local_gfonts" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_local_gfonts" name="local_gfonts" '. (!empty($speedycache->options['local_gfonts']) ? 'checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Local Google Fonts', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Loads google fonts from your local server', 'speedycache').'</span> </div> </div>'; } else { echo '<div class="speedycache-option-wrap speedycache-disabled"> <label class="speedycache-custom-checkbox"> <input type="checkbox"disabled/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Local Google Fonts', 'speedycache').'<span class="speedycache-premium-tag">'.esc_html__('Premium', 'speedycache').'</span></span> <span class="speedycache-option-desc">'.esc_html__('Loads google fonts from your local server', 'speedycache').'</span> </div> </div>'; } if(defined('SPEEDYCACHE_PRO')){ echo '<div class="speedycache-option-wrap"> <label for="speedycache_google_fonts" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_google_fonts" name="google_fonts" '.(!empty($speedycache->options['google_fonts']) ? ' checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Google Fonts', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Load Google Fonts asynchronously', 'speedycache').'</span> </div> </div>'; } else { echo '<div class="speedycache-option-wrap speedycache-disabled"> <label class="speedycache-custom-checkbox"> <input type="checkbox" disabled/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Google Fonts', 'speedycache').'<span class="speedycache-premium-tag">'.esc_html__('Premium', 'speedycache').'</span></span> <span class="speedycache-option-desc">'.esc_html__('Load Google Fonts asynchronously', 'speedycache').'</span> </div> </div>'; } echo '<div class="speedycache-option-wrap"> <label for="speedycache_font_rendering" class="speedycache-custom-checkbox"> <input type="checkbox" id="speedycache_font_rendering" name="font_rendering" '. (!empty($speedycache->options['font_rendering']) ? 'checked' : '').'/> <div class="speedycache-input-slider"></div> </label> <div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Improve Font Rendering', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Improved Font rendeing by adding text-rendring CSS.', 'speedycache').'</span> </div> </div>'; self::save_btn(); echo '</form>'; } static function settings_tab(){ echo '<h2><img src="'.esc_url(SPEEDYCACHE_URL).'/assets/images/icons/settings.svg" height="32" width="32"/> '.esc_html__('General Settings', 'speedycache').'</h2>'; $roles = get_editable_roles(); if(!empty($roles)){ $saved_roles = get_option('speedycache_deletion_roles', []); echo '<div class="speedycache-option-info"> <span class="speedycache-option-name">'.esc_html__('Can Delete Cache', 'speedycache').'</span> <span class="speedycache-option-desc">'.esc_html__('Allows roles to delete cache using Admin bar and post links, Admin is included by default', 'speedycache').'</span> <form method="POST">'; wp_nonce_field('speedycache_ajax_nonce'); echo '<input type="hidden" name="action" value="speedycache_save_deletion_role_settings"/> <div class="speedycache-deletion-roles">'; foreach($roles as $key => $role){ // Admin will always have access to everything, so no need to give option to be able to enable it. if($key == 'administrator'){ continue; } // We need to make sure the user has capability to publish_posts // Giving access to anyone other than this capability does not makes sense // As giving option to enable subscriber could cause issue becuase of human error. if(empty($role['capabilities']) || !is_array($role['capabilities']) || !array_key_exists('publish_posts', $role['capabilities'])){ continue; } $checked = false; if(in_array($key, $saved_roles)){ $checked = 'checked'; } echo '<label for="speedycache-admin-bar-cap-'.esc_attr($key).'"><input type="checkbox" id="speedycache-admin-bar-cap-'.esc_attr($key).'"name="cache_deletion_roles[]" value="'.esc_attr($key).'" '.esc_attr($checked).'/>'.esc_html($role['name']).'</label>'; } echo '</div> <div class="speedycache-btn-spl-wrapper"><button class="speedycache-button speedycache-btn-black" style="margin-top:10px;">Save<span class="speedycache-spinner"></span></button></div></form></div>'; } echo '<div class="speedycache-option-info" style="margin-top:20px;"> <label class="speedycache-option-name">'.esc_html__('Import / Export Settings', 'speedycache').'</label> <span class="speedycache-option-desc" style="margin-bottom:10px;">'.esc_html__('Imports SpeedyCache Settings from another site or Exports your current SpeedyCache Settings as a JSON file', 'speedycache').'</span> </div> <div> <select id="speedycache-import-export" name="img-exp"> <option value="import">Import</option> <option value="export">Export</option> </select> </div>'; echo '<!-- Import Section --> <form method="POST" enctype="multipart/form-data"> <input type="hidden" name="action" value="speedycache_import_settings"/> <div class="speedycache-option-info speedycache-import-block" style="display:block;"> <span class="speedycache-option-desc">'.esc_html__('Select a JSON file containing SpeedyCache Settings. This will overwrite your current SpeedyCache Settings', 'speedycache').'</span> <input type="file" name="speedycache_import_file" id="speedycache_import_file" accept=".json" required /> <button class="speedycache-button speedycache-btn-black speedycache-import-settings" style="margin-top:10px;">Import Settings<span class="speedycache-spinner"></span></button> </div> </form>'; echo '<!-- Export Section --> <form method="POST" enctype="multipart/form-data"> <input type="hidden" name="action" value="speedycache_export_settings"/> <div class="speedycache-option-info speedycache-export-block" style="display:none;"> <span class="speedycache-option-desc">'.esc_html__('Click the button below to download the current SpeedyCache settings as a JSON file', 'speedycache').'</span> <button class="speedycache-button speedycache-btn-black speedycache-export-settings" style="margin-top:10px;">Download Export File<span class="speedycache-spinner"></span></button> </div> </form>'; } static function preload_modal_options($field_name, $fields){ if(empty($fields)){ return ''; } switch($field_name){ case 'pre_connect': $placeholder = 'https://fonts.google.com'; break; default: $placeholder = site_url() . '/' . (defined('SITEPAD') ? 'sitepad-data' : 'wp-content') . '/uploads/image.jpg'; } $html = '<div class="speedycache-preloading-options"> <div class="speedycache-stacked-label" style="width:100%;"> <label style="width:100%;"> <span>Resource URL <span spdf-hover-tooltip="Required field" spdf-tooltip-position="bottom">*</span></span> <input type="text" name="resource" style="width:100%;" placeholder="'.esc_html($placeholder).'" required/> </label> </div>'; $html .= '<div class="speedycache-preload-checkboxes">'; if(isset($fields['parent_selector'])){ $html .= '<label><input type="checkbox" name="parent_selector" value="true"/>Use Parent Selector</label>'; } if(isset($fields['crossorigin'])){ $html .= '<label><input type="checkbox" name="crossorigin" value="true"/>Crossorigin</label>'; } $html .= '</div>'; if(isset($fields['type'])){ $html .= '<div class="speedycache-stacked-label"><label><span>Resource Type <span spdf-hover-tooltip="Required field" spdf-tooltip-position="top">*</span></span><select name="type" required> <option value="">Select Type</option> <option value="image">Image</option> <option value="font">Font</option> <option value="script">Script</option> <option value="style">Style</option> <option value="audio">Audio</option>" <option value="document">Document</option> <option value="video">Video</option> </select></label></div>'; } if(isset($fields['priority'])){ $html .= '<div class="speedycache-stacked-label"><label> <span>Fetch Priority</span> <select name="fetch_priority"> <option value="" selected>Auto</option> <option value="high">High</option> <option value="low">Low</option> </select></label> </div>'; } if(isset($fields['device'])){ $html .= '<div class="speedycache-stacked-label"><label> <span>Device <span class="dashicons dashicons-editor-help" spdf-hover-tooltip="For this to work, you will need to enable Mobile Override and Mobile Cache options, this is not a required field" spdf-tooltip-position="top"></span></span> <select name="device"> <option value="" selected>All</option> <option value="desktop">Desktop</option> <option value="mobile">Mobile</option> </select></label> </div>'; } $html .= '</div>'; return $html; } static function pro_notice($tab_name){ echo '<h2>'.esc_html($tab_name).'</h2> <div class="notice notice-warning"> <p>'.esc_html__('This is a part of SpeedyCache Pro, so update/upgrade to pro to utilize this feature', 'speedycache').'</p> </div>'; } static function save_btn(){ echo '<div class="speedycache-save-settings-wrapper"><button class="speedycache-button speedycache-btn-black">'.esc_html__('Save Settings', 'speedycache').'<span class="speedycache-spinner"></span><svg class="speedycache-spinner-done" xmlns="http://www.w3.org/2000/svg" height="15px" viewBox="0 -960 960 960" width="15px" fill="#FFF"><path d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"/></svg></button></div>'; } } gosmtp-init.php 0000644 00000012167 15100073403 0007527 0 ustar 00 <?php /* * GoSMTP * https://gosmtp.net * (c) Softaculous Team */ // Are we being accessed directly ? if(!defined('GOSMTP_PRO_VERSION')) { exit('Hacking Attempt !'); } // Prevent update of gosmtp free // This also work for auto update add_filter('site_transient_update_plugins', 'gosmtp_pro_disable_manual_update_for_plugin'); add_filter('pre_site_transient_update_plugins', 'gosmtp_pro_disable_manual_update_for_plugin'); // Auto update free version after update pro version add_action('upgrader_process_complete', 'gosmtp_pro_update_free_after_pro', 10, 2); add_action('plugins_loaded', 'gosmtp_pro_load_plugin'); function gosmtp_pro_load_plugin(){ global $gosmtp; if(empty($gosmtp)){ $gosmtp = new stdClass(); } // Load license gosmtp_pro_load_license(); gosmtp_pro_update_checker(); // Check for updates include_once(GOSMTP_PRO_DIR.'/main/plugin-update-checker.php'); $gosmtp_updater = Gosmtp_PucFactory::buildUpdateChecker(gosmtp_pro_api_url().'updates.php?version='.GOSMTP_PRO_VERSION, GOSMTP_PRO_FILE); // Add the license key to query arguments $gosmtp_updater->addQueryArgFilter('gosmtp_pro_updater_filter_args'); // Show the text to install the license key add_filter('puc_manual_final_check_link-gosmtp-pro', 'gosmtp_pro_updater_check_link', 10, 1); // Nag informing the user to install the free version. if(current_user_can('activate_plugins')){ add_action('admin_notices', 'gosmtp_pro_free_version_nag', 9); add_action('admin_menu', 'gosmtp_pro_add_menu', 9); } $is_network_wide = gosmtp_pro_is_network_active('gosmtp-pro'); $_do_version = get_option('gosmtp_version'); $req_free_update = !empty($_do_version) && version_compare($_do_version, '1.0.7', '<'); if($is_network_wide){ $free_installed = get_site_option('gosmtp_free_installed'); }else{ $free_installed = get_option('gosmtp_free_installed'); } if(!empty($free_installed)){ return; } // Include the necessary stuff include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); include_once(ABSPATH . 'wp-admin/includes/plugin.php'); include_once(ABSPATH . 'wp-admin/includes/file.php'); if(file_exists(WP_PLUGIN_DIR . '/gosmtp/gosmtp.php') && is_plugin_inactive('/gosmtp/gosmtp.php') && empty($req_free_update)) { if($is_network_wide){ update_site_option('gosmtp_free_installed', time()); }else{ update_option('gosmtp_free_installed', time()); } activate_plugin('/gosmtp/gosmtp.php', '', $is_network_wide); remove_action('admin_notices', 'gosmtp_pro_free_version_nag', 9); remove_action('admin_menu', 'gosmtp_pro_add_menu', 9); return; } // Includes necessary for Plugin_Upgrader and Plugin_Installer_Skin include_once(ABSPATH . 'wp-admin/includes/misc.php'); include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'); // Filter to prevent the activate text add_filter('install_plugin_complete_actions', 'gosmtp_pro_prevent_activation_text', 10, 3); $upgrader = new Plugin_Upgrader(new WP_Ajax_Upgrader_Skin()); // Upgrade the plugin to the latest version of free already installed. if(!empty($req_free_update)){ $installed = $upgrader->upgrade('gosmtp/gosmtp.php'); }else{ $installed = $upgrader->install('https://downloads.wordpress.org/plugin/gosmtp.zip'); } if(!is_wp_error($installed) && $installed){ if($is_network_wide){ update_site_option('gosmtp_free_installed', time()); }else{ update_option('gosmtp_free_installed', time()); } activate_plugin('gosmtp/gosmtp.php', '', $is_network_wide); remove_action('admin_notices', 'gosmtp_pro_free_version_nag', 9); remove_action('admin_menu', 'gosmtp_pro_add_menu', 9); } } // Do not shows the activation text if function gosmtp_pro_prevent_activation_text($install_actions, $api, $plugin_file){ if($plugin_file == 'gosmtp/gosmtp.php'){ return array(); } return $install_actions; } function gosmtp_pro_free_version_nag(){ $go_version = get_option('gosmtp_version'); $lower_version = __('You have not installed the free version of GoSMTP. GoSMTP Pro depends on the free version, so you must install it first in order to use GoSMTP Pro.'); if(!empty($go_version) && version_compare($go_version, '1.0.7', '<')){ $lower_version = __('You are using an older version of the free version of GoSMTP, please update GoSMTP to work without any issues'); } echo '<div class="notice notice-error"> <p style="font-size:16px;">'.esc_html($lower_version).' <a href="'.admin_url('plugin-install.php?s=gosmtp&tab=search').'" class="button button-primary">Install/Update Now</a></p> </div>'; } function gosmtp_pro_add_menu(){ add_menu_page('GoSMTP Settings', 'GoSMTP', 'activate_plugins', 'gosmtp', 'gosmtp_pro_menu_page'); } function gosmtp_pro_menu_page(){ echo '<div style="color: #333;padding: 50px;text-align: center;"> <h1 style="font-size: 2em;margin-bottom: 10px;">GoSMTP Free version is not installed / outdated!</h> <p style=" font-size: 16px;margin-bottom: 20px; font-weight:400;">GoSMTP Pro depends on the free version of GoSMTP, so you need to install / update the free version first.</p> <a href="'.admin_url('plugin-install.php?s=gosmtp&tab=search').'" style="text-decoration: none;font-size:16px;">Install/Update Now</a> </div>'; } logger.php 0000644 00000011173 15100073403 0006530 0 ustar 00 <?php namespace GOSMTP; /** * Class Logger. * * @since 1.0.0 */ class Logger{ public $table; public function __construct(){ global $wpdb; $this->table = $wpdb->prefix . GOSMTP_DB_PREFIX .'email_logs'; } public function create_table(){ global $wpdb; $charsetCollate = $wpdb->get_charset_collate(); if($wpdb->get_var("SHOW TABLES LIKE '$this->table'") == $this->table){ return; } $sql = "CREATE TABLE $this->table ( `id` INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, `site_id` INT UNSIGNED NULL, `message_id` VARCHAR(255) NULL, `to` VARCHAR(255), `from` VARCHAR(255), `subject` VARCHAR(255), `body` LONGTEXT NULL, `headers` LONGTEXT NULL, `attachments` LONGTEXT NULL, `status` VARCHAR(20) DEFAULT 'pending', `response` TEXT NULL, `extra` TEXT NULL, `retries` INT UNSIGNED NULL DEFAULT 0, `resent_count` INT UNSIGNED NULL DEFAULT 0, `provider` TEXT NULL, `source` VARCHAR(255) NULL, `created_at` TIMESTAMP NULL, `updated_at` TIMESTAMP NULL, `parent_id` INT UNSIGNED NULL DEFAULT 0 ) $charsetCollate;"; // Make Sitepad compatible $upgrade = ABSPATH . 'site-admin/includes/upgrade.php'; $upgrade = file_exists($upgrade) ? $upgrade : ABSPATH . 'wp-admin/includes/upgrade.php'; require_once( $upgrade ); dbDelta($sql); } public function add_logs($data){ global $wpdb; if(empty($data)){ return false; } $result = $wpdb->insert($this->table, $data); if($result){ return $wpdb->insert_id; } return false; } public function update_logs($data, $id){ global $wpdb; if(empty($data) || empty($id)){ return false; } $result = $wpdb->update( $this->table, $data, array( 'id' => $id ) ); if($result){ return true; } return false; } public function delete_log($id){ global $wpdb; $data['id'] = $id; $result = $wpdb->delete($this->table, $data); if(!empty($result)){ return true; } return false; } public function get_logs($for = 'records', $id = '', $args = array()){ global $wpdb; $defaults = array( 'interval' => array(), 'limit' => 10, 'offset' => 0, 'pagination' => true, 'multiselect' => array(), ); $args = wp_parse_args( $args, $defaults ); $query = ''; $start = ''; $end = date('y-m-d').' 23:59:59'; if(!empty($args['filter'])){ $query .= 'status="'.$args['filter'].'"'; } if(!empty($args['interval']) && !empty($args['interval']['start'])){ $start = $args['interval']['start'].' 00:00:00'; if(!empty($args['interval']['end'])){ $end = $args['interval']['end'].' 23:59:59'; } $query .= (!empty($query) ? ' and (' : '').'`created_at` between "'.$start.'" and "'.$end.'" '.(!empty($query) ? ') ' : ' '); } if(!empty($args['search']) && empty($args['multiselect'])){ $query .= (!empty($query) ? ' and ' : '').' ( `from` like "%'. $args['search'] .'%" or `subject` like "%'. $args['search'] .'%" or `to` like "%'. $args['search'] .'%" or `body` like "%'. $args['search'] .'%" )'; }else if(!empty($args['search'])){ $search_qry =''; foreach($args['multiselect'] as $key => $value){ $search_qry .= '`'.$value.'` like "%'.$args['search'].'%"'; if(count($args['multiselect']) - 1 > $key){ $search_qry .= ' or '; } } $query .= (!empty($query) ? ' and ' : '').' ('.$search_qry.')'; } if(!empty($query)){ $query = ' where '.$query; } if(!empty($id)){ $query = ' where id='.$id; }else if(!empty($args['pagination'])){ $query .= $for != 'count' ? ' order by id desc LIMIT '.$args['limit'].' OFFSET '.$args['offset'] : ' '; } // echo "SELECT * FROM ".$this->table. $query; try{ if($for == 'count'){ $result = $wpdb->get_results("SELECT count(*) as records FROM ".$this->table. $query)[0]; }else{ $result = $wpdb->get_results("SELECT * FROM ".$this->table. $query); if( count($result) == 0 ){ return false; } } return $result; }catch(\Exception $e){} return false; } public function clear_records( $period = 0 ){ if( empty($period) || $period == 0 ) return; global $wpdb; $date = ( new \DateTime( '-'.$period.' seconds' ))->format('Y-m-d H:i:s'); $query = 'DELETE FROM `'.$this->table.'` WHERE created_at < %s'; if( $period == -1 ){ $query = 'TRUNCATE TABLE '.$this->table; $date = ''; } $wpdb->query( $wpdb->prepare( $query , $date) ); } public static function retention_logs(){ global $gosmtp; if(empty($gosmtp->options['logs']['retention_period'])){ return; } $logger = new Logger(); // Clear logs $logger->clear_records($gosmtp->options['logs']['retention_period']); } } export.php 0000644 00000025120 15100073403 0006567 0 ustar 00 <?php /* * GoSMTP Export Logs * https://gosmtp.net * (c) Softaculous Team */ if(!defined('ABSPATH')){ die('Hacking Attempt!'); } // Filter HTML data function gosmtp_filterData(&$str){ $str = preg_replace("/\t/", "\\t", $str); $str = preg_replace("/\r?\n/", "\\n", $str); if(strstr($str, '"')){ $str = '"' . str_replace('"', '""', $str) . '"'; } } // Export CSV files function gosmtp_export_csv($data){ $fileName = "gosmtp_export_".date('Y_m_d') . ".csv"; header('Content-Type: text/csv; charset=utf-8'); header("Content-Disposition: attachment; filename=$fileName"); header("Content-Description: File Transfer"); $file = fopen('php://output', 'w'); // We have all the field sequences in the first line // Get the key of attachments form the sequences $attachment_key = array_search('attachments', $data[0], true); foreach($data as $kk => $val){ // Skip attachment explode for first row if( $kk != 0 && $attachment_key !== false && !empty($val[$attachment_key]) ){ $attachment = explode(',', $val[$attachment_key]); $attach = ''; foreach($attachment as $attach_val){ $attach .= explode('*', $attach_val)[2].', '; } $val[$attachment_key] = rtrim($attach, ', '); } fputcsv($file, array_values($val)); } fclose($file); wp_die(); } // Export XML files function gosmtp_export_xls($data){ $filename = "gosmtp_export_".date('Ymd') . ".xls"; header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=\"$filename\""); // We have all the field sequences in the first line // Get the key of attachments form the sequences $attachment_key = array_search('attachments', $data[0], true); foreach($data as $kk => $val) { array_walk($val, 'gosmtp_filterData'); // Skip attachment explode for first row if( $kk != 0 && $attachment_key !== false && !empty($val[$attachment_key]) ){ $attachment = explode(',', $val[$attachment_key]); $attach =""; foreach($attachment as $attach_val){ $attach .= explode('*', $attach_val)[2].', '; } $val[$attachment_key] = rtrim($attach, ", "); } echo esc_html(implode("\t", array_values($val)) . "\n"); } wp_die(); } // Export EML files function gosmtp_export_eml($data){ $files = array(); $first_row = $data[0]; // Replace key with value $fields = array_flip($data[0]); $attachment_key = $fields['attachments']; foreach($data as $key => $value){ // Skip for first row if($key == 0){ continue; } $files[$key] = "gosmtp_export_".$key."_".date('Ymd') . ".eml"; header("Content-Type: application/application/eml"); header("Content-Disposition: attachment; filename=\"$files[$key]\""); $output_buffer = fopen('php://output', 'w'); $boundary = md5(uniqid(mt_rand())); $output_buffer = 'MIME-Version: 1.0 Date: '.date_format( date_create( $value[$fields['created_at']] ), 'd-m-y H:i:s').' +0100 From: '.$value[$fields['from']].' To: '.$value[$fields['to']].' Cc: '.$value[$fields['cc']].' Ccc: '.$value[$fields['bcc']].' Subject: '.$value[$fields['subject']].' Content-Type: multipart/mixed; boundary="'.$boundary.'" This is a message with multiple parts in MIME format. --'.$boundary.' Content-Type: '.$value[$fields['content-type']].' '.$value[$fields['body']]; // Added attachment if any if(isset($value[$attachment_key]) && !empty($value[$attachment_key])){ $attachment = explode(',', $value[$attachment_key]); foreach($attachment as $attach){ $all_attach = explode('*', $attach); $attachment_file = file_get_contents(trim($all_attach[0])); if(empty($attachment_file)){ continue; } $encoded_attach = base64_encode($attachment_file); $type = $all_attach[4]; $base_name = $all_attach[2]; $output_buffer .= ' --'.$boundary.' Content-Type: '.$type.';name="'.$base_name.'" Content-Transfer-Encoding: base64 Content-Disposition: attachment;filename="'.$base_name.'" '.$encoded_attach; } } file_put_contents($files[$key], $output_buffer); } $zipname = "gosmtp_export_".date('Ymd') . ".zip"; $zip = new ZipArchive; $zip->open($zipname, ZipArchive::CREATE); foreach($files as $file){ $zip->addFile($file); } $zip->close(); header('Content-Type: application/zip'); header('Content-disposition: attachment; filename='.$zipname); header('Content-Length: ' . filesize($zipname)); readfile($zipname); unlink($zipname); wp_die(); } // Export page HTML function gosmtp_export_page(){ // Styles and Scripts wp_enqueue_style( 'gosmtp-admin' ); wp_enqueue_script( 'gosmtp-admin' ); $common_field = array( 'to' => __('To Address'), 'from' => __('From Address'), 'subject' => __('Subject'), 'body' => __('Body'), 'created_at' => __('Created At'), 'attachments' => __('Attachments'), ); $addtition_field = array( 'status' => __('Status'), 'reply-to' => __('Reply To'), 'cc' => __('Carbon Copy (CC)'), 'bcc' => __('Blind Carbon Copy (BCC)'), 'provider' => __('Provider'), 'response' => __('Response'), 'source' => __('Source'), 'content-type' => __('Content Type') ); $search_field = array( 'from' => __('from'), 'to' => __('To'), 'subject' => __('Subject'), 'body' => __('Body'), ); $all_field = array_merge(array_keys($common_field), array_keys($addtition_field)); ?> <div class="gosmtp-row gosmtp-export-container"> <form action="" method="post" id="gosmtp_export"> <input type="hidden" name="page" value="export"> <input type="hidden" name="all_field" value="<?php echo implode(',', $all_field)?>"> <div class="gosmtp-row"> <div class="gosmtp-col-12"> <h1> <span class="dashicons dashicons-media-archive"></span><?php _e('Export Settings'); ?></h1> </div> </div> <hr> <div class="gosmtp-row"> <div class="gosmtp-col-3"> <h3><?php _e('Format'); ?></h3> </div> <div class="gosmtp-col-6"> <div class="gosmtp-radio-list"> <input type="radio" name="format" value="csv" id="csv" checked> <label for="csv" class="active_radio_tab"><?php echo __('CSV').'(.csv)'; ?></label> <input type="radio" name="format" value="xls" id ="xls"> <label for="xls"><?php echo __('Microsoft Excel').'(.xls)'; ?></label> <input type="radio" name="format" value="eml" id="eml"> <label for="eml"><?php echo __('EML').'(.eml)'; ?> </label> </div> </div> </div> <div class="gosmtp-row "> <div class="gosmtp-col-3"> <h3><?php _e('Export Custom Field'); ?></h3> </div> <div class="gosmtp-col-9"> <label class="gosmtp-switch"> <input type="checkbox" name="custom-field" id="custom-field" checked> <span class="gosmtp-slider gosmtp-round"></span> </label> </div> </div> <div class="gosmtp-row can-hidden"> <div class="gosmtp-col-3"> <h3><?php _e('Common Information'); ?></h3> </div> <div class="gosmtp-col-6"> <div class="gosmtp-fiter-container"> <span class="multiselect"><?php _e('Select common field'); ?></span> <ul class="multiselect-options"> <li><input type="checkbox" class="multiselect-checkbox" id="all" value="all" checked><label for="all"><?php _e('All'); ?></label></li> <?php foreach($common_field as $key => $val){ echo"<li><input type='checkbox' checked class='multiselect-checkbox' name ='common_information[]' id='$key' value='$key'><label for='$key'>$val</label></li>"; } ?> </ul> <span class="dropdown dashicons dashicons-arrow-down-alt2"></span> </div> </div> </div> <div class="gosmtp-row can-hidden"> <div class="gosmtp-col-3"> <h3><?php _e('Additional Information'); ?></h3> </div> <div class="gosmtp-col-6"> <div class="gosmtp-fiter-container"> <span class="multiselect"><?php _e('Select common field'); ?></span> <ul class="multiselect-options"> <li><input type="checkbox" class="multiselect-checkbox" id="all" value="all"><label for="all"><?php _e('All'); ?></label></li> <?php foreach($addtition_field as $key => $val){ echo "<li><input type='checkbox' name='addtional_information[]' class='multiselect-checkbox' id='$key' value='$key'><label for='$key' checked>$val</label></li>"; } ?> </ul> <span class="dropdown dashicons dashicons-arrow-down-alt2"></span> </div> </div> </div> <div class="gosmtp-row "> <div class="gosmtp-col-3"> <h3><?php _e('Custom Date Range'); ?></h3> </div> <div class="gosmtp-col-6"> <div class="gosmtp-date-container"> <input type="date" name="start-date" id="gosmtp-start-date" placeholder="Start date" /> <input type="date" name="end-date" id="gosmtp-end-date" placeholder="End date" /> </div> </div> </div> <div class="gosmtp-row "> <div class="gosmtp-col-3"> <h3><?php _e('Search In'); ?></h3> </div> <div class="gosmtp-col-6"> <div class="gosmtp-inner-row "> <div class="gosmtp-col-8"> <div class="gosmtp-fiter-container "> <span class="multiselect"><?php _e('Select addtitional field'); ?></span> <ul class="multiselect-options"> <li><input type="checkbox" class="multiselect-checkbox" id="all" value="all" ><label for="all"><?php _e('All'); ?></label></li> <?php foreach($search_field as $key => $val){ echo "<li><input type='checkbox' name='search_type[]' class='multiselect-checkbox' id='$key' value='$key'><label for='$key'>$val</label></li>"; } ?> </ul> <span class="dropdown dashicons dashicons-arrow-down-alt2"></span> </div> </div> <div class="gosmtp-col-4"> <div class="gosmtp-search-report-list-icon"> <span class="dashicons dashicons-search"></span> <input type="search" id="gosmtp-search_email" placeholder="Search" name="search"> </div> </div> </div> </div> </div> <div class="gosmtp-row "> <div class="gosmtp-col-3"> <button class="button button-primary gosmtp-loading-button"> <span class="dashicons dashicons-image-rotate"></span> <input type="submit" name="export" value="Export" > </button> </div> </div> </form> </div> <script> var gosmtp_ajaxurl="<?php echo admin_url( 'admin-ajax.php' ) ?>?"; var gosmtp_ajax_nonce="<?php echo wp_create_nonce('gosmtp_ajax') ?>"; </script> <?php } license.php 0000644 00000014543 15100073403 0006677 0 ustar 00 <?php if(!defined('ABSPATH')) { die('HACKING ATTEMPT!'); } include_once BACKUPLY_DIR . '/main/settings.php'; // Handles submission of license function backuply_license(){ global $backuply, $lic_resp; check_admin_referer('backuply_license_form', 'backuply_license_nonce'); $license = sanitize_key(backuply_optpost('backuply_license')); if(empty($license)) { add_settings_error('backuply-notice', esc_attr( 'settings_updated' ), esc_html__('The license key was not submitted', 'backuply'), 'error'); return; } if(!function_exists('backuply_load_license')){ $lic_resp = wp_remote_get(BACKUPLY_API.'/license.php?license='.$license.'&url='.rawurlencode(esc_url_raw(site_url())), array('timeout' => 30, 'sslverify' => false)); }else{ backuply_load_license($license); } if(is_array($lic_resp)){ $json = json_decode($lic_resp['body'], true); }else{ add_settings_error('backuply-notice', esc_attr( 'settings_updated' ), esc_html__('The response was malformed', 'backuply').'<br>'.var_export($lic_resp, true), 'error'); return; } // Save the License if(empty($json['license'])){ add_settings_error('backuply-notice', esc_attr( 'settings_updated' ), esc_html__('The license key is invalid', 'backuply'), 'error'); return; } if(!function_exists('backuply_load_license')){ if(get_option('backuply_license')) { update_option('backuply_license', $json); } else{ add_option('backuply_license', $json); } $backuply['license'] = $json; } } function backuply_license_page() { global $backuply; if(!empty($_POST['save_backuply_license'])) { backuply_license(); } // Update Cloud key and URL if(!empty($_POST['save_backuply_cloud_key'])){ backuply_cloud_update(); } backuply_page_header('License'); settings_errors('backuply-notice'); ?> <table class="wp-list-table fixed striped users backuply-license-table" cellspacing="1" border="0" width="95%" cellpadding="10" align="center"> <tbody> <tr> <th align="left" width="25%">Backuply Version</th> <td><?php echo BACKUPLY_VERSION.(defined('BACKUPLY_PRO') ? ' (Pro Version)' : ''); ?> </td> </tr> <tr> <th align="left" valign="top">Backuply License</th> <td align="left"> <form method="post"> <span style="color:red"><?php echo (defined('BACKUPLY_PRO') && empty($backuply['license']) ? '<span style="color:red">Unlicensed</span> ' : '')?></span> <input type="text" name="backuply_license" value="<?php echo (empty($backuply['license']) || empty($backuply['license']['license']) ? '' : esc_html($backuply['license']['license']))?>" size="30" placeholder="e.g. BAKLY-11111-22222-33333-44444" style="width:300px;"> <?php wp_nonce_field( 'backuply_license_form','backuply_license_nonce' ); ?> <input name="save_backuply_license" class="button button-primary" value="Update License" type="submit"> </form> <?php if(!empty($backuply['license']) && !empty($backuply['license']['expires'])){ $expires = $backuply['license']['expires']; $expires = substr($expires, 0, 4).'/'.substr($expires, 4, 2).'/'.substr($expires, 6); echo '<div style="margin-top:10px;">License Status : '.(empty($backuply['license']['status_txt']) ? 'N.A.' : wp_kses_post($backuply['license']['status_txt'])).' '; if(empty($backuply['license']['has_plid']) || $backuply['license']['expires'] <= date('Ymd')){ echo 'License Expires : '.($backuply['license']['expires'] <= date('Ymd') ? '<span style="color:red">'.esc_html($expires).'</span>' : esc_html($expires)); } echo '</div>'; } if(!empty($backuply['license']['quota']) && !empty($backuply['license']['quota'])){ echo '<div style="margin-top:3px;">Cloud Storage: '.size_format(esc_html($backuply['license']['quota'])).'</div>'; } ?> </td> </tr> <tr> <th align="left" valign="top">Backuply Cloud</th> <?php echo '<td align="left"> <div style="display:flex; flex-direction:column;"> <form method="post"> <label> <input type="text" name="bcloud_key" value="'.(!empty($backuply['bcloud_key']) ? esc_attr($backuply['bcloud_key']) : '').'" size="30" placeholder="Your Backuply Cloud Key" style="width:300px;"> '.wp_nonce_field('backuply_cloud_form', 'backuply_cloud_nonce').' <input name="save_backuply_cloud_key" class="button button-primary" value="Update Cloud Key" type="submit"> <p class="description">'.__('Backuply Cloud Key works in combination with Backuply License which you get when you buy a plan', 'backuply').'<br>'.__('The key is generated automatically, when you add Backuply Cloud location to a new site, for more info read this', 'backuply').' <a href="https://backuply.com/docs/backuply-cloud/how-to-get-backuply-cloud-key/#lost-backuply-clou-key" target="_blank">docs</a></p> </label> </form> <label> <input type="text" value="'.site_url().'" size="30" placeholder="Backuply Cloud Linked Site URL" style="width:300px;" readonly> <p class="description">Site URL</p> </label> </div> </td>'; ?> </tr> <tr> <th align="left">URL</th> <td><?php echo esc_url(get_site_url()); ?></td> </tr> <tr> <th align="left">Path</th> <td><?php echo ABSPATH; ?></td> </tr> <tr> <th align="left">Server's IP Address</th> <td><?php echo !empty($_SERVER['SERVER_ADDR']) ? wp_kses_post(wp_unslash($_SERVER['SERVER_ADDR'])) : '-'; ?></td> </tr> <tr> <th align="left">.htaccess is writable</th> <td><?php echo (is_writable(ABSPATH.'/.htaccess') ? '<span style="color:red">Yes</span>' : '<span style="color:green">No</span>');?></td> </tr> </tbody> </table> </td> <td> <?php backuply_promotion_tmpl(); ?> </td> </tr> </table> </div> </div> </div> </div> <?php } function backuply_cloud_update(){ global $backuply; if(!wp_verify_nonce($_POST['backuply_cloud_nonce'], 'backuply_cloud_form')){ echo 'Security Check Failed'; return false; } $backuply['bcloud_key'] = sanitize_text_field($_POST['bcloud_key']); update_option('bcloud_key', $backuply['bcloud_key']); } plugin-update-checker.php 0000644 00000151114 15100073403 0011431 0 ustar 00 <?php /** * Plugin Update Checker Library 3.2 * http://w-shadow.com/ * * Copyright 2016 Janis Elsts * Released under the MIT license. See license.txt for details. */ if ( !class_exists('SiteSEOUpdateChecker_3_2', false) ): /** * A custom plugin update checker. * * @author Janis Elsts * @copyright 2016 * @version 3.2 * @access public */ #[\AllowDynamicProperties] class SiteSEOUpdateChecker_3_2 { public $metadataUrl = ''; //The URL of the plugin's metadata file. public $pluginAbsolutePath = ''; //Full path of the main plugin file. public $pluginFile = ''; //Plugin filename relative to the plugins directory. Many WP APIs use this to identify plugins. public $slug = ''; //Plugin slug. public $optionName = ''; //Where to store the update info. public $muPluginFile = ''; //For MU plugins, the plugin filename relative to the mu-plugins directory. public $debugMode = false; //Set to TRUE to enable error reporting. Errors are raised using trigger_error() //and should be logged to the standard PHP error log. public $scheduler; protected $upgraderStatus; private $debugBarPlugin = null; private $cachedInstalledVersion = null; private $metadataHost = ''; //The host component of $metadataUrl. /** * Class constructor. * * @param string $metadataUrl The URL of the plugin's metadata file. * @param string $pluginFile Fully qualified path to the main plugin file. * @param string $slug The plugin's 'slug'. If not specified, the filename part of $pluginFile sans '.php' will be used as the slug. * @param integer $checkPeriod How often to check for updates (in hours). Defaults to checking every 12 hours. Set to 0 to disable automatic update checks. * @param string $optionName Where to store book-keeping info about update checks. Defaults to 'external_updates-$slug'. * @param string $muPluginFile Optional. The plugin filename relative to the mu-plugins directory. */ public function __construct($metadataUrl, $pluginFile, $slug = '', $checkPeriod = 12, $optionName = '', $muPluginFile = ''){ $this->metadataUrl = $metadataUrl; $this->pluginAbsolutePath = $pluginFile; $this->pluginFile = plugin_basename($this->pluginAbsolutePath); $this->muPluginFile = $muPluginFile; $this->slug = $slug; $this->optionName = $optionName; $this->debugMode = (bool)(constant('WP_DEBUG')); //If no slug is specified, use the name of the main plugin file as the slug. //For example, 'my-cool-plugin/cool-plugin.php' becomes 'cool-plugin'. if ( empty($this->slug) ){ $this->slug = basename($this->pluginFile, '.php'); } //Plugin slugs must be unique. $slugCheckFilter = 'puc_is_slug_in_use-' . $this->slug; $slugUsedBy = apply_filters($slugCheckFilter, false); if ( $slugUsedBy ) { $this->triggerError(sprintf( 'Plugin slug "%s" is already in use by %s. Slugs must be unique.', htmlentities($this->slug), htmlentities($slugUsedBy) ), E_USER_ERROR); } add_filter($slugCheckFilter, array($this, 'getAbsolutePath')); if ( empty($this->optionName) ){ $this->optionName = 'external_updates-' . $this->slug; } //Backwards compatibility: If the plugin is a mu-plugin but no $muPluginFile is specified, assume //it's the same as $pluginFile given that it's not in a subdirectory (WP only looks in the base dir). if ( (strpbrk($this->pluginFile, '/\\') === false) && $this->isUnknownMuPlugin() ) { $this->muPluginFile = $this->pluginFile; } $this->scheduler = $this->createScheduler($checkPeriod); $this->upgraderStatus = new SiteSEO_PucUpgraderStatus_3_2(); $this->installHooks(); } /** * Create an instance of the scheduler. * * This is implemented as a method to make it possible for plugins to subclass the update checker * and substitute their own scheduler. * * @param int $checkPeriod * @return SiteSEO_PucScheduler_3_2 */ protected function createScheduler($checkPeriod) { return new SiteSEO_PucScheduler_3_2($this, $checkPeriod); } /** * Install the hooks required to run periodic update checks and inject update info * into WP data structures. * * @return void */ protected function installHooks(){ //Override requests for plugin information add_filter('plugins_api', array($this, 'injectInfo'), 20, 3); //Insert our update info into the update array maintained by WP. add_filter('site_transient_update_plugins', array($this,'injectUpdate')); //WP 3.0+ add_filter('transient_update_plugins', array($this,'injectUpdate')); //WP 2.8+ add_filter('site_transient_update_plugins', array($this, 'injectTranslationUpdates')); add_filter('plugin_row_meta', array($this, 'addCheckForUpdatesLink'), 10, 2); add_action('admin_init', array($this, 'handleManualCheck')); add_action('all_admin_notices', array($this, 'displayManualCheckResult')); //Clear the version number cache when something - anything - is upgraded or WP clears the update cache. add_filter('upgrader_post_install', array($this, 'clearCachedVersion')); add_action('delete_site_transient_update_plugins', array($this, 'clearCachedVersion')); //Clear translation updates when WP clears the update cache. //This needs to be done directly because the library doesn't actually remove obsolete plugin updates, //it just hides them (see getUpdate()). We can't do that with translations - too much disk I/O. add_action('delete_site_transient_update_plugins', array($this, 'clearCachedTranslationUpdates')); if ( did_action('plugins_loaded') ) { $this->initDebugBarPanel(); } else { add_action('plugins_loaded', array($this, 'initDebugBarPanel')); } //Rename the update directory to be the same as the existing directory. add_filter('upgrader_source_selection', array($this, 'fixDirectoryName'), 10, 3); //Enable language support (i18n). load_plugin_textdomain('plugin-update-checker', false, plugin_basename(dirname(__FILE__)) . '/languages'); //Allow HTTP requests to the metadata URL even if it's on a local host. $this->metadataHost = @parse_url($this->metadataUrl, PHP_URL_HOST); add_filter('http_request_host_is_external', array($this, 'allowMetadataHost'), 10, 2); } /** * Explicitly allow HTTP requests to the metadata URL. * * WordPress has a security feature where the HTTP API will reject all requests that are sent to * another site hosted on the same server as the current site (IP match), a local host, or a local * IP, unless the host exactly matches the current site. * * This feature is opt-in (at least in WP 4.4). Apparently some people enable it. * * That can be a problem when you're developing your plugin and you decide to host the update information * on the same server as your test site. Update requests will mysteriously fail. * * We fix that by adding an exception for the metadata host. * * @param bool $allow * @param string $host * @return bool */ public function allowMetadataHost($allow, $host) { if ( strtolower($host) === strtolower($this->metadataHost) ) { return true; } return $allow; } /** * Retrieve plugin info from the configured API endpoint. * * @uses wp_remote_get() * * @param array $queryArgs Additional query arguments to append to the request. Optional. * @return SiteSEOInfo_3_2 */ public function requestInfo($queryArgs = array()){ //Query args to append to the URL. Plugins can add their own by using a filter callback (see addQueryArgFilter()). $installedVersion = $this->getInstalledVersion(); $queryArgs['installed_version'] = ($installedVersion !== null) ? $installedVersion : ''; $queryArgs = apply_filters('puc_request_info_query_args-'.$this->slug, $queryArgs); //Various options for the wp_remote_get() call. Plugins can filter these, too. $options = array( 'timeout' => 10, //seconds 'headers' => array( 'Accept' => 'application/json' ), ); $options = apply_filters('puc_request_info_options-'.$this->slug, $options); //The plugin info should be at 'http://your-api.com/url/here/$slug/info.json' $url = $this->metadataUrl; if ( !empty($queryArgs) ){ $url = add_query_arg($queryArgs, $url); } $result = wp_remote_get( $url, $options ); //Try to parse the response $status = $this->validateApiResponse($result); $pluginInfo = null; if ( !is_wp_error($status) ){ $pluginInfo = SiteSEOInfo_3_2::fromJson($result['body']); if ( $pluginInfo !== null ) { $pluginInfo->filename = $this->pluginFile; $pluginInfo->slug = $this->slug; } } else { $this->triggerError( sprintf('The URL %s does not point to a valid plugin metadata file. ', $url) . $status->get_error_message(), E_USER_WARNING ); } $pluginInfo = apply_filters('puc_request_info_result-'.$this->slug, $pluginInfo, $result); return $pluginInfo; } /** * Check if $result is a successful update API response. * * @param array|WP_Error $result * @return true|WP_Error */ private function validateApiResponse($result) { if ( is_wp_error($result) ) { /** @var WP_Error $result */ return new WP_Error($result->get_error_code(), 'WP HTTP Error: ' . $result->get_error_message()); } if ( !isset($result['response']['code']) ) { return new WP_Error('puc_no_response_code', 'wp_remote_get() returned an unexpected result.'); } if ( $result['response']['code'] !== 200 ) { return new WP_Error( 'puc_unexpected_response_code', 'HTTP response code is ' . $result['response']['code'] . ' (expected: 200)' ); } if ( empty($result['body']) ) { return new WP_Error('puc_empty_response', 'The metadata file appears to be empty.'); } return true; } /** * Retrieve the latest update (if any) from the configured API endpoint. * * @uses SiteSEOUpdateChecker::requestInfo() * * @return SiteSEOUpdate_3_2 An instance of SiteSEOUpdate, or NULL when no updates are available. */ public function requestUpdate(){ //For the sake of simplicity, this function just calls requestInfo() //and transforms the result accordingly. $pluginInfo = $this->requestInfo(array('checking_for_updates' => '1')); if ( $pluginInfo == null ){ return null; } $update = SiteSEOUpdate_3_2::fromSiteSEOInfo($pluginInfo); //Keep only those translation updates that apply to this site. $update->translations = $this->filterApplicableTranslations($update->translations); return $update; } /** * Filter a list of translation updates and return a new list that contains only updates * that apply to the current site. * * @param array $translations * @return array */ private function filterApplicableTranslations($translations) { $languages = array_flip(array_values(get_available_languages())); $installedTranslations = wp_get_installed_translations('plugins'); if ( isset($installedTranslations[$this->slug]) ) { $installedTranslations = $installedTranslations[$this->slug]; } else { $installedTranslations = array(); } $applicableTranslations = array(); foreach($translations as $translation) { //Does it match one of the available core languages? $isApplicable = array_key_exists($translation->language, $languages); //Is it more recent than an already-installed translation? if ( isset($installedTranslations[$translation->language]) ) { $updateTimestamp = strtotime($translation->updated); $installedTimestamp = strtotime($installedTranslations[$translation->language]['PO-Revision-Date']); $isApplicable = $updateTimestamp > $installedTimestamp; } if ( $isApplicable ) { $applicableTranslations[] = $translation; } } return $applicableTranslations; } /** * Get the currently installed version of the plugin. * * @return string Version number. */ public function getInstalledVersion(){ if ( isset($this->cachedInstalledVersion) ) { return $this->cachedInstalledVersion; } $pluginHeader = $this->getPluginHeader(); if ( isset($pluginHeader['Version']) ) { $this->cachedInstalledVersion = $pluginHeader['Version']; return $pluginHeader['Version']; } else { //This can happen if the filename points to something that is not a plugin. $this->triggerError( sprintf( "Can't to read the Version header for '%s'. The filename is incorrect or is not a plugin.", $this->pluginFile ), E_USER_WARNING ); return null; } } /** * Get plugin's metadata from its file header. * * @return array */ protected function getPluginHeader() { if ( !is_file($this->pluginAbsolutePath) ) { //This can happen if the plugin filename is wrong. $this->triggerError( sprintf( "Can't to read the plugin header for '%s'. The file does not exist.", $this->pluginFile ), E_USER_WARNING ); return array(); } if ( !function_exists('get_plugin_data') ){ /** @noinspection PhpIncludeInspection */ require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); } return get_plugin_data($this->pluginAbsolutePath, false, false); } /** * Check for plugin updates. * The results are stored in the DB option specified in $optionName. * * @return SiteSEOUpdate_3_2|null */ public function checkForUpdates(){ $installedVersion = $this->getInstalledVersion(); //Fail silently if we can't find the plugin or read its header. if ( $installedVersion === null ) { $this->triggerError( sprintf('Skipping update check for %s - installed version unknown.', $this->pluginFile), E_USER_WARNING ); return null; } $state = $this->getUpdateState(); if ( empty($state) ){ $state = new stdClass; $state->lastCheck = 0; $state->checkedVersion = ''; $state->update = null; } $state->lastCheck = time(); $state->checkedVersion = $installedVersion; $this->setUpdateState($state); //Save before checking in case something goes wrong $state->update = $this->requestUpdate(); $this->setUpdateState($state); return $this->getUpdate(); } /** * Load the update checker state from the DB. * * @return stdClass|null */ public function getUpdateState() { $state = get_site_option($this->optionName, null); if ( empty($state) || !is_object($state)) { $state = null; } if ( isset($state, $state->update) && is_object($state->update) ) { $state->update = SiteSEOUpdate_3_2::fromObject($state->update); } return $state; } /** * Persist the update checker state to the DB. * * @param StdClass $state * @return void */ private function setUpdateState($state) { if ( isset($state->update) && is_object($state->update) && method_exists($state->update, 'toStdClass') ) { $update = $state->update; /** @var SiteSEOUpdate_3_2 $update */ $state->update = $update->toStdClass(); } update_site_option($this->optionName, $state); } /** * Reset update checker state - i.e. last check time, cached update data and so on. * * Call this when your plugin is being uninstalled, or if you want to * clear the update cache. */ public function resetUpdateState() { delete_site_option($this->optionName); } /** * Intercept plugins_api() calls that request information about our plugin and * use the configured API endpoint to satisfy them. * * @see plugins_api() * * @param mixed $result * @param string $action * @param array|object $args * @return mixed */ public function injectInfo($result, $action = null, $args = null){ $relevant = ($action == 'plugin_information') && isset($args->slug) && ( ($args->slug == $this->slug) || ($args->slug == dirname($this->pluginFile)) ); if ( !$relevant ) { return $result; } $pluginInfo = $this->requestInfo(); $pluginInfo = apply_filters('puc_pre_inject_info-' . $this->slug, $pluginInfo); if ( $pluginInfo ) { return $pluginInfo->toWpFormat(); } return $result; } /** * Insert the latest update (if any) into the update list maintained by WP. * * @param StdClass $updates Update list. * @return StdClass Modified update list. */ public function injectUpdate($updates){ //Is there an update to insert? $update = $this->getUpdate(); //No update notifications for mu-plugins unless explicitly enabled. The MU plugin file //is usually different from the main plugin file so the update wouldn't show up properly anyway. if ( $this->isUnknownMuPlugin() ) { $update = null; } if ( !empty($update) ) { //Let plugins filter the update info before it's passed on to WordPress. $update = apply_filters('puc_pre_inject_update-' . $this->slug, $update); $updates = $this->addUpdateToList($updates, $update); } else { //Clean up any stale update info. $updates = $this->removeUpdateFromList($updates); } return $updates; } /** * @param StdClass|null $updates * @param SiteSEOUpdate_3_2 $updateToAdd * @return StdClass */ private function addUpdateToList($updates, $updateToAdd) { if ( !is_object($updates) ) { $updates = new stdClass(); $updates->response = array(); } $wpUpdate = $updateToAdd->toWpFormat(); $pluginFile = $this->pluginFile; if ( $this->isMuPlugin() ) { //WP does not support automatic update installation for mu-plugins, but we can still display a notice. $wpUpdate->package = null; $pluginFile = $this->muPluginFile; } $updates->response[$pluginFile] = $wpUpdate; return $updates; } /** * @param stdClass|null $updates * @return stdClass|null */ private function removeUpdateFromList($updates) { if ( isset($updates, $updates->response) ) { unset($updates->response[$this->pluginFile]); if ( !empty($this->muPluginFile) ) { unset($updates->response[$this->muPluginFile]); } } return $updates; } /** * Insert translation updates into the list maintained by WordPress. * * @param stdClass $updates * @return stdClass */ public function injectTranslationUpdates($updates) { $translationUpdates = $this->getTranslationUpdates(); if ( empty($translationUpdates) ) { return $updates; } //Being defensive. if ( !is_object($updates) ) { $updates = new stdClass(); } if ( !isset($updates->translations) ) { $updates->translations = array(); } //In case there's a name collision with a plugin hosted on wordpress.org, //remove any preexisting updates that match our plugin. $translationType = 'plugin'; $filteredTranslations = array(); foreach($updates->translations as $translation) { if ( ($translation['type'] === $translationType) && ($translation['slug'] === $this->slug) ) { continue; } $filteredTranslations[] = $translation; } $updates->translations = $filteredTranslations; //Add our updates to the list. foreach($translationUpdates as $update) { $convertedUpdate = array_merge( array( 'type' => $translationType, 'slug' => $this->slug, 'autoupdate' => 0, //AFAICT, WordPress doesn't actually use the "version" field for anything. //But lets make sure it's there, just in case. 'version' => isset($update->version) ? $update->version : ('1.' . strtotime($update->updated)), ), (array)$update ); $updates->translations[] = $convertedUpdate; } return $updates; } /** * Rename the update directory to match the existing plugin directory. * * When WordPress installs a plugin or theme update, it assumes that the ZIP file will contain * exactly one directory, and that the directory name will be the same as the directory where * the plugin/theme is currently installed. * * GitHub and other repositories provide ZIP downloads, but they often use directory names like * "project-branch" or "project-tag-hash". We need to change the name to the actual plugin folder. * * This is a hook callback. Don't call it from a plugin. * * @param string $source The directory to copy to /wp-content/plugins. Usually a subdirectory of $remoteSource. * @param string $remoteSource WordPress has extracted the update to this directory. * @param WP_Upgrader $upgrader * @return string|WP_Error */ public function fixDirectoryName($source, $remoteSource, $upgrader) { global $wp_filesystem; /** @var WP_Filesystem_Base $wp_filesystem */ //Basic sanity checks. if ( !isset($source, $remoteSource, $upgrader, $upgrader->skin, $wp_filesystem) ) { return $source; } //If WordPress is upgrading anything other than our plugin, leave the directory name unchanged. if ( !$this->isPluginBeingUpgraded($upgrader) ) { return $source; } //Rename the source to match the existing plugin directory. $pluginDirectoryName = dirname($this->pluginFile); if ( $pluginDirectoryName === '.' ) { return $source; } $correctedSource = trailingslashit($remoteSource) . $pluginDirectoryName . '/'; if ( $source !== $correctedSource ) { //The update archive should contain a single directory that contains the rest of plugin files. Otherwise, //WordPress will try to copy the entire working directory ($source == $remoteSource). We can't rename //$remoteSource because that would break WordPress code that cleans up temporary files after update. if ( $this->isBadDirectoryStructure($remoteSource) ) { return new WP_Error( 'puc-incorrect-directory-structure', sprintf( 'The directory structure of the update is incorrect. All plugin files should be inside ' . 'a directory named <span class="code">%s</span>, not at the root of the ZIP file.', htmlentities($this->slug) ) ); } /** @var WP_Upgrader_Skin $upgrader->skin */ $upgrader->skin->feedback(sprintf( 'Renaming %s to %s…', '<span class="code">' . basename($source) . '</span>', '<span class="code">' . $pluginDirectoryName . '</span>' )); if ( $wp_filesystem->move($source, $correctedSource, true) ) { $upgrader->skin->feedback('Plugin directory successfully renamed.'); return $correctedSource; } else { return new WP_Error( 'puc-rename-failed', 'Unable to rename the update to match the existing plugin directory.' ); } } return $source; } /** * Check for incorrect update directory structure. An update must contain a single directory, * all other files should be inside that directory. * * @param string $remoteSource Directory path. * @return bool */ private function isBadDirectoryStructure($remoteSource) { global $wp_filesystem; /** @var WP_Filesystem_Base $wp_filesystem */ $sourceFiles = $wp_filesystem->dirlist($remoteSource); if ( is_array($sourceFiles) ) { $sourceFiles = array_keys($sourceFiles); $firstFilePath = trailingslashit($remoteSource) . $sourceFiles[0]; return (count($sourceFiles) > 1) || (!$wp_filesystem->is_dir($firstFilePath)); } //Assume it's fine. return false; } /** * Is there and update being installed RIGHT NOW, for this specific plugin? * * @param WP_Upgrader|null $upgrader The upgrader that's performing the current update. * @return bool */ public function isPluginBeingUpgraded($upgrader = null) { return $this->upgraderStatus->isPluginBeingUpgraded($this->pluginFile, $upgrader); } /** * Get the details of the currently available update, if any. * * If no updates are available, or if the last known update version is below or equal * to the currently installed version, this method will return NULL. * * Uses cached update data. To retrieve update information straight from * the metadata URL, call requestUpdate() instead. * * @return SiteSEOUpdate_3_2|null */ public function getUpdate() { $state = $this->getUpdateState(); /** @var StdClass $state */ //Is there an update available? if ( isset($state, $state->update) ) { $update = $state->update; //Check if the update is actually newer than the currently installed version. $installedVersion = $this->getInstalledVersion(); if ( ($installedVersion !== null) && version_compare($update->version, $installedVersion, '>') ){ $update->filename = $this->pluginFile; return $update; } } return null; } /** * Get a list of available translation updates. * * This method will return an empty array if there are no updates. * Uses cached update data. * * @return array */ public function getTranslationUpdates() { $state = $this->getUpdateState(); if ( isset($state, $state->update, $state->update->translations) ) { return $state->update->translations; } return array(); } /** * Remove all cached translation updates. * * @see wp_clean_update_cache */ public function clearCachedTranslationUpdates() { $state = $this->getUpdateState(); if ( isset($state, $state->update, $state->update->translations) ) { $state->update->translations = array(); $this->setUpdateState($state); } } /** * Add a "Check for updates" link to the plugin row in the "Plugins" page. By default, * the new link will appear after the "Visit plugin site" link. * * You can change the link text by using the "puc_manual_check_link-$slug" filter. * Returning an empty string from the filter will disable the link. * * @param array $pluginMeta Array of meta links. * @param string $pluginFile * @return array */ public function addCheckForUpdatesLink($pluginMeta, $pluginFile) { $isRelevant = ($pluginFile == $this->pluginFile) || (!empty($this->muPluginFile) && $pluginFile == $this->muPluginFile); if ( $isRelevant && current_user_can('update_plugins') ) { $linkUrl = wp_nonce_url( add_query_arg( array( 'puc_check_for_updates' => 1, 'puc_slug' => $this->slug, ), self_admin_url('plugins.php') ), 'puc_check_for_updates' ); $linkText = apply_filters('puc_manual_check_link-' . $this->slug, __('Check for updates', 'siteseo-pro')); if ( !empty($linkText) ) { $final_link = sprintf('<a href="%s">%s</a>', esc_attr($linkUrl), $linkText); $pluginMeta[] = apply_filters('puc_manual_final_check_link-' . $this->slug, $final_link); } } return $pluginMeta; } /** * Check for updates when the user clicks the "Check for updates" link. * @see self::addCheckForUpdatesLink() * * @return void */ public function handleManualCheck() { $shouldCheck = isset($_GET['puc_check_for_updates'], $_GET['puc_slug']) && $_GET['puc_slug'] == $this->slug && current_user_can('update_plugins') && check_admin_referer('puc_check_for_updates'); if ( $shouldCheck ) { $update = $this->checkForUpdates(); $status = ($update === null) ? 'no_update' : 'update_available'; wp_redirect(add_query_arg( array( 'puc_update_check_result' => $status, 'puc_slug' => $this->slug, ), self_admin_url('plugins.php') )); } } /** * Display the results of a manual update check. * @see self::handleManualCheck() * * You can change the result message by using the "puc_manual_check_message-$slug" filter. */ public function displayManualCheckResult() { if ( isset($_GET['puc_update_check_result'], $_GET['puc_slug']) && ($_GET['puc_slug'] == $this->slug) ) { $status = strval($_GET['puc_update_check_result']); if ( $status == 'no_update' ) { $message = __('This plugin is up to date.', 'siteseo-pro'); } else if ( $status == 'update_available' ) { $message = __('A new version of this plugin is available.', 'siteseo-pro'); } else { // Translators: %s is the status of the update checker. $message = sprintf(__('Unknown update checker status "%s"', 'siteseo-pro'), htmlentities($status)); } printf( '<div class="updated notice is-dismissible"><p>%s</p></div>', apply_filters('puc_manual_check_message-' . $this->slug, $message, $status) ); } } /** * Check if the plugin file is inside the mu-plugins directory. * * @return bool */ protected function isMuPlugin() { static $cachedResult = null; if ( $cachedResult === null ) { //Convert both paths to the canonical form before comparison. $muPluginDir = realpath(WPMU_PLUGIN_DIR); $pluginPath = realpath($this->pluginAbsolutePath); if(!empty($muPluginDir)){ $cachedResult = (strpos($pluginPath, $muPluginDir) === 0); }else{ $cachedResult = false; } } return $cachedResult; } /** * MU plugins are partially supported, but only when we know which file in mu-plugins * corresponds to this plugin. * * @return bool */ protected function isUnknownMuPlugin() { return empty($this->muPluginFile) && $this->isMuPlugin(); } /** * Clear the cached plugin version. This method can be set up as a filter (hook) and will * return the filter argument unmodified. * * @param mixed $filterArgument * @return mixed */ public function clearCachedVersion($filterArgument = null) { $this->cachedInstalledVersion = null; return $filterArgument; } /** * Get absolute path to the main plugin file. * * @return string */ public function getAbsolutePath() { return $this->pluginAbsolutePath; } /** * Register a callback for filtering query arguments. * * The callback function should take one argument - an associative array of query arguments. * It should return a modified array of query arguments. * * @uses add_filter() This method is a convenience wrapper for add_filter(). * * @param callable $callback * @return void */ public function addQueryArgFilter($callback){ add_filter('puc_request_info_query_args-'.$this->slug, $callback); } /** * Register a callback for filtering arguments passed to wp_remote_get(). * * The callback function should take one argument - an associative array of arguments - * and return a modified array or arguments. See the WP documentation on wp_remote_get() * for details on what arguments are available and how they work. * * @uses add_filter() This method is a convenience wrapper for add_filter(). * * @param callable $callback * @return void */ public function addHttpRequestArgFilter($callback){ add_filter('puc_request_info_options-'.$this->slug, $callback); } /** * Register a callback for filtering the plugin info retrieved from the external API. * * The callback function should take two arguments. If the plugin info was retrieved * successfully, the first argument passed will be an instance of SiteSEOInfo. Otherwise, * it will be NULL. The second argument will be the corresponding return value of * wp_remote_get (see WP docs for details). * * The callback function should return a new or modified instance of SiteSEOInfo or NULL. * * @uses add_filter() This method is a convenience wrapper for add_filter(). * * @param callable $callback * @return void */ public function addResultFilter($callback){ add_filter('puc_request_info_result-'.$this->slug, $callback, 10, 2); } /** * Register a callback for one of the update checker filters. * * Identical to add_filter(), except it automatically adds the "puc_" prefix * and the "-$plugin_slug" suffix to the filter name. For example, "request_info_result" * becomes "puc_request_info_result-your_plugin_slug". * * @param string $tag * @param callable $callback * @param int $priority * @param int $acceptedArgs */ public function addFilter($tag, $callback, $priority = 10, $acceptedArgs = 1) { add_filter('puc_' . $tag . '-' . $this->slug, $callback, $priority, $acceptedArgs); } /** * Initialize the update checker Debug Bar plugin/add-on thingy. */ public function initDebugBarPanel() { $debugBarPlugin = dirname(__FILE__) . '/debug-bar-plugin.php'; if ( class_exists('Debug_Bar', false) && file_exists($debugBarPlugin) ) { /** @noinspection PhpIncludeInspection */ require_once $debugBarPlugin; $this->debugBarPlugin = new SiteSEO_PucDebugBarPlugin_3_2($this); } } /** * Trigger a PHP error, but only when $debugMode is enabled. * * @param string $message * @param int $errorType */ protected function triggerError($message, $errorType) { if ( $this->debugMode ) { trigger_error($message, $errorType); } } } endif; if ( !class_exists('SiteSEOInfo_3_2', false) ): /** * A container class for holding and transforming various plugin metadata. * * @author Janis Elsts * @copyright 2016 * @version 3.2 * @access public */ #[\AllowDynamicProperties] class SiteSEOInfo_3_2 { //Most fields map directly to the contents of the plugin's info.json file. //See the relevant docs for a description of their meaning. public $name; public $slug; public $version; public $homepage; public $sections = array(); public $banners; public $translations = array(); public $download_url; public $author; public $author_homepage; public $requires; public $tested; public $upgrade_notice; public $rating; public $num_ratings; public $downloaded; public $active_installs; public $last_updated; public $id = 0; //The native WP.org API returns numeric plugin IDs, but they're not used for anything. public $filename; //Plugin filename relative to the plugins directory. /** * Create a new instance of SiteSEOInfo from JSON-encoded plugin info * returned by an external update API. * * @param string $json Valid JSON string representing plugin info. * @return SiteSEOInfo_3_2|null New instance of SiteSEOInfo, or NULL on error. */ public static function fromJson($json){ /** @var StdClass $apiResponse */ $apiResponse = json_decode($json); if ( empty($apiResponse) || !is_object($apiResponse) ){ trigger_error( "Failed to parse plugin metadata. Try validating your .json file with http://jsonlint.com/", E_USER_NOTICE ); return null; } $valid = self::validateMetadata($apiResponse); if ( is_wp_error($valid) ){ trigger_error($valid->get_error_message(), E_USER_NOTICE); return null; } $info = new self(); foreach(get_object_vars($apiResponse) as $key => $value){ $info->$key = $value; } //json_decode decodes assoc. arrays as objects. We want it as an array. $info->sections = (array)$info->sections; return $info; } /** * Very, very basic validation. * * @param StdClass $apiResponse * @return bool|WP_Error */ protected static function validateMetadata($apiResponse) { if ( !isset($apiResponse->name, $apiResponse->version) || empty($apiResponse->name) || empty($apiResponse->version) ) { return new WP_Error( 'puc-invalid-metadata', "The plugin metadata file does not contain the required 'name' and/or 'version' keys." ); } return true; } /** * Transform plugin info into the format used by the native WordPress.org API * * @return object */ public function toWpFormat(){ $info = new stdClass; //The custom update API is built so that many fields have the same name and format //as those returned by the native WordPress.org API. These can be assigned directly. $sameFormat = array( 'name', 'slug', 'version', 'requires', 'tested', 'rating', 'upgrade_notice', 'num_ratings', 'downloaded', 'active_installs', 'homepage', 'last_updated', ); foreach($sameFormat as $field){ if ( isset($this->$field) ) { $info->$field = $this->$field; } else { $info->$field = null; } } //Other fields need to be renamed and/or transformed. $info->download_link = $this->download_url; $info->author = $this->getFormattedAuthor(); $info->sections = array_merge(array('description' => ''), $this->sections); if ( !empty($this->banners) ) { //WP expects an array with two keys: "high" and "low". Both are optional. //Docs: https://wordpress.org/plugins/about/faq/#banners $info->banners = is_object($this->banners) ? get_object_vars($this->banners) : $this->banners; $info->banners = array_intersect_key($info->banners, array('high' => true, 'low' => true)); } return $info; } protected function getFormattedAuthor() { if ( !empty($this->author_homepage) ){ return sprintf('<a href="%s">%s</a>', $this->author_homepage, $this->author); } return $this->author; } } endif; if ( !class_exists('SiteSEOUpdate_3_2', false) ): /** * A simple container class for holding information about an available update. * * @author Janis Elsts * @copyright 2016 * @version 3.2 * @access public */ #[\AllowDynamicProperties] class SiteSEOUpdate_3_2 { public $id = 0; public $slug; public $version; public $homepage; public $download_url; public $upgrade_notice; public $tested; public $translations = array(); public $filename; //Plugin filename relative to the plugins directory. private static $fields = array( 'id', 'slug', 'version', 'homepage', 'tested', 'download_url', 'upgrade_notice', 'filename', 'translations' ); /** * Create a new instance of SiteSEOUpdate from its JSON-encoded representation. * * @param string $json * @return SiteSEOUpdate_3_2|null */ public static function fromJson($json){ //Since update-related information is simply a subset of the full plugin info, //we can parse the update JSON as if it was a plugin info string, then copy over //the parts that we care about. $pluginInfo = SiteSEOInfo_3_2::fromJson($json); if ( $pluginInfo != null ) { return self::fromSiteSEOInfo($pluginInfo); } else { return null; } } /** * Create a new instance of SiteSEOUpdate based on an instance of SiteSEOInfo. * Basically, this just copies a subset of fields from one object to another. * * @param SiteSEOInfo_3_2 $info * @return SiteSEOUpdate_3_2 */ public static function fromSiteSEOInfo($info){ return self::fromObject($info); } /** * Create a new instance of SiteSEOUpdate by copying the necessary fields from * another object. * * @param StdClass|SiteSEOInfo_3_2|SiteSEOUpdate_3_2 $object The source object. * @return SiteSEOUpdate_3_2 The new copy. */ public static function fromObject($object) { $update = new self(); $fields = self::$fields; if ( !empty($object->slug) ) { $fields = apply_filters('puc_retain_fields-' . $object->slug, $fields); } foreach($fields as $field){ if (property_exists($object, $field)) { $update->$field = $object->$field; } } return $update; } /** * Create an instance of StdClass that can later be converted back to * a SiteSEOUpdate. Useful for serialization and caching, as it avoids * the "incomplete object" problem if the cached value is loaded before * this class. * * @return StdClass */ public function toStdClass() { $object = new stdClass(); $fields = self::$fields; if ( !empty($this->slug) ) { $fields = apply_filters('puc_retain_fields-' . $this->slug, $fields); } foreach($fields as $field){ if (property_exists($this, $field)) { $object->$field = $this->$field; } } return $object; } /** * Transform the update into the format used by WordPress native plugin API. * * @return object */ public function toWpFormat(){ $update = new stdClass; $update->id = $this->id; $update->slug = $this->slug; $update->new_version = $this->version; $update->url = $this->homepage; $update->package = $this->download_url; $update->tested = $this->tested; $update->plugin = $this->filename; if ( !empty($this->upgrade_notice) ){ $update->upgrade_notice = $this->upgrade_notice; } return $update; } } endif; if ( !class_exists('SiteSEO_PucScheduler_3_2', false) ): /** * The scheduler decides when and how often to check for updates. * It calls @see SiteSEOUpdateChecker::checkForUpdates() to perform the actual checks. * * @version 3.2 */ class SiteSEO_PucScheduler_3_2 { public $checkPeriod = 12; //How often to check for updates (in hours). public $throttleRedundantChecks = false; //Check less often if we already know that an update is available. public $throttledCheckPeriod = 72; /** * @var SiteSEOUpdateChecker_3_2 */ protected $updateChecker; private $cronHook = null; /** * Scheduler constructor. * * @param SiteSEOUpdateChecker_3_2 $updateChecker * @param int $checkPeriod How often to check for updates (in hours). */ public function __construct($updateChecker, $checkPeriod) { $this->updateChecker = $updateChecker; $this->checkPeriod = $checkPeriod; //Set up the periodic update checks $this->cronHook = 'check_plugin_updates-' . $this->updateChecker->slug; if ( $this->checkPeriod > 0 ){ //Trigger the check via Cron. //Try to use one of the default schedules if possible as it's less likely to conflict //with other plugins and their custom schedules. $defaultSchedules = array( 1 => 'hourly', 12 => 'twicedaily', 24 => 'daily', ); if ( array_key_exists($this->checkPeriod, $defaultSchedules) ) { $scheduleName = $defaultSchedules[$this->checkPeriod]; } else { //Use a custom cron schedule. $scheduleName = 'every' . $this->checkPeriod . 'hours'; add_filter('cron_schedules', array($this, '_addCustomSchedule')); } if ( !wp_next_scheduled($this->cronHook) && !defined('WP_INSTALLING') ) { wp_schedule_event(time(), $scheduleName, $this->cronHook); } add_action($this->cronHook, array($this, 'maybeCheckForUpdates')); register_deactivation_hook($this->updateChecker->pluginFile, array($this, '_removeUpdaterCron')); //In case Cron is disabled or unreliable, we also manually trigger //the periodic checks while the user is browsing the Dashboard. add_action( 'admin_init', array($this, 'maybeCheckForUpdates') ); //Like WordPress itself, we check more often on certain pages. /** @see wp_update_plugins */ add_action('load-update-core.php', array($this, 'maybeCheckForUpdates')); add_action('load-plugins.php', array($this, 'maybeCheckForUpdates')); add_action('load-update.php', array($this, 'maybeCheckForUpdates')); //This hook fires after a bulk update is complete. add_action('upgrader_process_complete', array($this, 'maybeCheckForUpdates'), 11, 0); } else { //Periodic checks are disabled. wp_clear_scheduled_hook($this->cronHook); } } /** * Check for updates if the configured check interval has already elapsed. * Will use a shorter check interval on certain admin pages like "Dashboard -> Updates" or when doing cron. * * You can override the default behaviour by using the "puc_check_now-$slug" filter. * The filter callback will be passed three parameters: * - Current decision. TRUE = check updates now, FALSE = don't check now. * - Last check time as a Unix timestamp. * - Configured check period in hours. * Return TRUE to check for updates immediately, or FALSE to cancel. * * This method is declared public because it's a hook callback. Calling it directly is not recommended. */ public function maybeCheckForUpdates(){ if ( empty($this->checkPeriod) ){ return; } $state = $this->updateChecker->getUpdateState(); $shouldCheck = empty($state) || !isset($state->lastCheck) || ( (time() - $state->lastCheck) >= $this->getEffectiveCheckPeriod() ); //Let plugin authors substitute their own algorithm. $shouldCheck = apply_filters( 'puc_check_now-' . $this->updateChecker->slug, $shouldCheck, (!empty($state) && isset($state->lastCheck)) ? $state->lastCheck : 0, $this->checkPeriod ); if ( $shouldCheck ) { $this->updateChecker->checkForUpdates(); } } /** * Calculate the actual check period based on the current status and environment. * * @return int Check period in seconds. */ protected function getEffectiveCheckPeriod() { $currentFilter = current_filter(); if ( in_array($currentFilter, array('load-update-core.php', 'upgrader_process_complete')) ) { //Check more often when the user visits "Dashboard -> Updates" or does a bulk update. $period = 60; } else if ( in_array($currentFilter, array('load-plugins.php', 'load-update.php')) ) { //Also check more often on the "Plugins" page and /wp-admin/update.php. $period = 3600; } else if ( $this->throttleRedundantChecks && ($this->updateChecker->getUpdate() !== null) ) { //Check less frequently if it's already known that an update is available. $period = $this->throttledCheckPeriod * 3600; } else if ( defined('DOING_CRON') && constant('DOING_CRON') ) { //WordPress cron schedules are not exact, so lets do an update check even //if slightly less than $checkPeriod hours have elapsed since the last check. $cronFuzziness = 20 * 60; $period = $this->checkPeriod * 3600 - $cronFuzziness; } else { $period = $this->checkPeriod * 3600; } return $period; } /** * Add our custom schedule to the array of Cron schedules used by WP. * * @param array $schedules * @return array */ public function _addCustomSchedule($schedules){ if ( $this->checkPeriod && ($this->checkPeriod > 0) ){ $scheduleName = 'every' . $this->checkPeriod . 'hours'; $schedules[$scheduleName] = array( 'interval' => $this->checkPeriod * 3600, 'display' => sprintf('Every %d hours', $this->checkPeriod), ); } return $schedules; } /** * Remove the scheduled cron event that the library uses to check for updates. * * @return void */ public function _removeUpdaterCron(){ wp_clear_scheduled_hook($this->cronHook); } /** * Get the name of the update checker's WP-cron hook. Mostly useful for debugging. * * @return string */ public function getCronHookName() { return $this->cronHook; } } endif; if ( !class_exists('SiteSEO_PucUpgraderStatus_3_2', false) ): /** * A utility class that helps figure out which plugin WordPress is upgrading. * * It may seem strange to have an separate class just for that, but the task is surprisingly complicated. * Core classes like Plugin_Upgrader don't expose the plugin file name during an in-progress update (AFAICT). * This class uses a few workarounds and heuristics to get the file name. */ #[\AllowDynamicProperties] class SiteSEO_PucUpgraderStatus_3_2 { private $upgradedPluginFile = null; //The plugin that is currently being upgraded by WordPress. public function __construct() { //Keep track of which plugin WordPress is currently upgrading. add_filter('upgrader_pre_install', array($this, 'setUpgradedPlugin'), 10, 2); add_filter('upgrader_package_options', array($this, 'setUpgradedPluginFromOptions'), 10, 1); add_filter('upgrader_post_install', array($this, 'clearUpgradedPlugin'), 10, 1); add_action('upgrader_process_complete', array($this, 'clearUpgradedPlugin'), 10, 1); } /** * Is there and update being installed RIGHT NOW, for a specific plugin? * * Caution: This method is unreliable. WordPress doesn't make it easy to figure out what it is upgrading, * and upgrader implementations are liable to change without notice. * * @param string $pluginFile The plugin to check. * @param WP_Upgrader|null $upgrader The upgrader that's performing the current update. * @return bool True if the plugin identified by $pluginFile is being upgraded. */ public function isPluginBeingUpgraded($pluginFile, $upgrader = null) { if ( isset($upgrader) ) { $upgradedPluginFile = $this->getPluginBeingUpgradedBy($upgrader); if ( !empty($upgradedPluginFile) ) { $this->upgradedPluginFile = $upgradedPluginFile; } } return ( !empty($this->upgradedPluginFile) && ($this->upgradedPluginFile === $pluginFile) ); } /** * Get the file name of the plugin that's currently being upgraded. * * @param Plugin_Upgrader|WP_Upgrader $upgrader * @return string|null */ private function getPluginBeingUpgradedBy($upgrader) { if ( !isset($upgrader, $upgrader->skin) ) { return null; } //Figure out which plugin is being upgraded. $pluginFile = null; $skin = $upgrader->skin; if ( $skin instanceof Plugin_Upgrader_Skin ) { if ( isset($skin->plugin) && is_string($skin->plugin) && ($skin->plugin !== '') ) { $pluginFile = $skin->plugin; } } elseif ( isset($skin->plugin_info) && is_array($skin->plugin_info) ) { //This case is tricky because Bulk_Plugin_Upgrader_Skin (etc) doesn't actually store the plugin //filename anywhere. Instead, it has the plugin headers in $plugin_info. So the best we can //do is compare those headers to the headers of installed plugins. $pluginFile = $this->identifyPluginByHeaders($skin->plugin_info); } return $pluginFile; } /** * Identify an installed plugin based on its headers. * * @param array $searchHeaders The plugin file header to look for. * @return string|null Plugin basename ("foo/bar.php"), or NULL if we can't identify the plugin. */ private function identifyPluginByHeaders($searchHeaders) { if ( !function_exists('get_plugins') ){ /** @noinspection PhpIncludeInspection */ require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); } $installedPlugins = get_plugins(); $matches = array(); foreach($installedPlugins as $pluginBasename => $headers) { $diff1 = array_diff_assoc($headers, $searchHeaders); $diff2 = array_diff_assoc($searchHeaders, $headers); if ( empty($diff1) && empty($diff2) ) { $matches[] = $pluginBasename; } } //It's possible (though very unlikely) that there could be two plugins with identical //headers. In that case, we can't unambiguously identify the plugin that's being upgraded. if ( count($matches) !== 1 ) { return null; } return reset($matches); } /** * @access private * * @param mixed $input * @param array $hookExtra * @return mixed Returns $input unaltered. */ public function setUpgradedPlugin($input, $hookExtra) { if (!empty($hookExtra['plugin']) && is_string($hookExtra['plugin'])) { $this->upgradedPluginFile = $hookExtra['plugin']; } else { $this->upgradedPluginFile = null; } return $input; } /** * @access private * * @param array $options * @return array */ public function setUpgradedPluginFromOptions($options) { if (isset($options['hook_extra']['plugin']) && is_string($options['hook_extra']['plugin'])) { $this->upgradedPluginFile = $options['hook_extra']['plugin']; } else { $this->upgradedPluginFile = null; } return $options; } /** * @access private * * @param mixed $input * @return mixed Returns $input unaltered. */ public function clearUpgradedPlugin($input = null) { $this->upgradedPluginFile = null; return $input; } } endif; if ( !class_exists('SiteSEO_PucFactory', false) ): /** * A factory that builds instances of other classes from this library. * * When multiple versions of the same class have been loaded (e.g. SiteSEOUpdateChecker 1.2 * and 1.3), this factory will always use the latest available version. Register class * versions by calling {@link SiteSEO_PucFactory::addVersion()}. * * At the moment it can only build instances of the SiteSEOUpdateChecker class. Other classes * are intended mainly for internal use and refer directly to specific implementations. If you * want to instantiate one of them anyway, you can use {@link SiteSEO_PucFactory::getLatestClassVersion()} * to get the class name and then create it with <code>new $class(...)</code>. */ #[\AllowDynamicProperties] class SiteSEO_PucFactory { protected static $classVersions = array(); protected static $sorted = false; /** * Create a new instance of SiteSEOUpdateChecker. * * @see SiteSEOUpdateChecker::__construct() * * @param $metadataUrl * @param $pluginFile * @param string $slug * @param int $checkPeriod * @param string $optionName * @param string $muPluginFile * @return SiteSEOUpdateChecker_3_2 */ public static function buildUpdateChecker($metadataUrl, $pluginFile, $slug = '', $checkPeriod = 12, $optionName = '', $muPluginFile = '') { $class = self::getLatestClassVersion('SiteSEOUpdateChecker'); return new $class($metadataUrl, $pluginFile, $slug, $checkPeriod, $optionName, $muPluginFile); } /** * Get the specific class name for the latest available version of a class. * * @param string $class * @return string|null */ public static function getLatestClassVersion($class) { if ( !self::$sorted ) { self::sortVersions(); } if ( isset(self::$classVersions[$class]) ) { return reset(self::$classVersions[$class]); } else { return null; } } /** * Sort available class versions in descending order (i.e. newest first). */ protected static function sortVersions() { foreach ( self::$classVersions as $class => $versions ) { uksort($versions, array(__CLASS__, 'compareVersions')); self::$classVersions[$class] = $versions; } self::$sorted = true; } protected static function compareVersions($a, $b) { return -version_compare($a, $b); } /** * Register a version of a class. * * @access private This method is only for internal use by the library. * * @param string $generalClass Class name without version numbers, e.g. 'SiteSEOUpdateChecker'. * @param string $versionedClass Actual class name, e.g. 'SiteSEOUpdateChecker_1_2'. * @param string $version Version number, e.g. '1.2'. */ public static function addVersion($generalClass, $versionedClass, $version) { if ( !isset(self::$classVersions[$generalClass]) ) { self::$classVersions[$generalClass] = array(); } self::$classVersions[$generalClass][$version] = $versionedClass; self::$sorted = false; } } endif; //Register classes defined in this file with the factory. SiteSEO_PucFactory::addVersion('SiteSEOUpdateChecker', 'SiteSEOUpdateChecker_3_2', '3.2'); SiteSEO_PucFactory::addVersion('SiteSEOUpdate', 'SiteSEOUpdate_3_2', '3.2'); SiteSEO_PucFactory::addVersion('SiteSEOInfo', 'SiteSEOInfo_3_2', '3.2'); SiteSEO_PucFactory::addVersion('SiteSEO_PucGitHubChecker', 'SiteSEO_PucGitHubChecker_3_2', '3.2'); smtp-logs.php 0000644 00000035147 15100073403 0007205 0 ustar 00 <?php // We need the ABSPATH if (!defined('ABSPATH')) exit; global $gosmtp; if(empty($gosmtp->options['logs']['enable_logs']) ){ echo '<h1>'.__('Email logs is disabled').'</h1> <div class="error notice"> <p >'.__('To store and view email logs, please enable email logs from GoSMTP').' <a href="'.admin_url('admin.php?page=gosmtp#logs-settings').'">'.__('settings').'</a>.</p> </div>'; return; } // Styles and Scripts wp_enqueue_style( 'gosmtp-admin' ); wp_enqueue_script( 'gosmtp-admin' ); $filter = gosmtp_optget('filter'); $start = gosmtp_optget('from'); $end = gosmtp_optget('to'); $search = gosmtp_optget('search'); $default = array( 'subject' => 'on', 'date_send' => 'on', 'action' => 'on' ); $columns = !empty( $gosmtp->options['logs']['log_columns'] ) ? maybe_unserialize($gosmtp->options['logs']['log_columns']) : array(); $columns = array_merge($default, $columns); ?> <div class="wrap"> <div class="wrap_header gosmtp-relative"> <h1><?php _e('SMTP LOGS') ?></h1> <button id="gosmtp-testmail-btn" class="button button-primary"> <i class="dashicons-before dashicons-email-alt" aria-hidden="true"></i> <span><?php _e('Test Mail') ?></span> </button> </div> <div style="width:100%;margin-top:20px;"> <form action="<?php echo admin_url('admin.php') ?>"> <input type="hidden" name="page" value="gosmtp-logs"> <div class="gosmtp-search-wrap"> <div class="gosmtp-search-container"> <h3><?php _e('What are you searching for') ?></h3> <div class="gosmtp-search-list-icon"> <span class="dashicons dashicons-search"></span> <input type="text" id="gosmtp-search-box" name="search" value="<?php echo esc_attr($search); ?>" placeholder="Search" /> </div> </div> <div class="gosmtp-date-container"> <h3><?php _e('Select date') ?></h3> <div class='gosmtp-flex gosmtp-margin-auto'> <input type="date" name="from" id="gosmtp-filter-start" min="2023-01-01" value="<?php echo esc_attr($start); ?>" max="<?php echo date('Y-m-d') ?>" /> <input type="date" name="to" id="gosmtp-filter-end" min="2023-01-01" value="<?php echo esc_attr($end); ?>" max="<?php echo date('Y-m-d') ?>" /> </div> </div> <div class="gosmtp-filter-container"> <h3><?php _e('Status') ?></h3> <select id="gosmtp-search-filter" name="filter"> <option value="all" <?php selected( $filter , 'all'); ?> ><?php _e('All') ?></option> <option value="success" <?php selected( $filter , 'success'); ?> ><?php _e('Success') ?></option> <option value="failed" <?php selected( $filter , 'failed'); ?> ><?php _e('Failed') ?></option> </select> </div> <input type="submit" class="gosmtp-search-trigger" id="gosmtp-search" value="Search" /> </div> <table cellspacing="0" cellpadding="8" border="0" width="100%" class="wp-list-table widefat striped gosmtp-log-table" id="gosmtp-logs-table"> <tr class="gomtp-logs_tr"> <th width="10"><input type="checkbox" class="gosmtp-multi-check"></th> <?php $logs_th = array( 'subject' => '<th class="subject_th">'.__('Subject').'</th>', 'from' => '<th class="from_th">'.__('From').'</th>', 'to' => '<th class="to_th">'.__('To').'</th>', 'source' => '<th class="source_th">'.__('Source').'</th>', 'provider' => '<th class="provider_th">'.__('Provider').'</th>', 'date_send' => '<th>'.__('Date Send').'</th>', 'action' => '<th>'.__('Actions').'</th>', ); foreach($logs_th as $key => $col ){ if(!empty($columns) && array_key_exists($key,$columns)){ echo $col; } } ?> </tr> <?php $logger = new GOSMTP\Logger(); $curpage = (int) gosmtp_optget('paged', 1); $options = array( 'filter' => !empty($filter) && $filter != 'all' ? ($filter == 'success' ? 'sent' : 'failed') : '', 'interval' => array( 'start' => $start, 'end' => $end ), 'search' => $search, ); // Pagination $perpage = 10; $records_ct = (int) $logger->get_logs('count', '', $options)->records; $tpages = ceil($records_ct / $perpage); $offset = ($curpage - 1) * $perpage; $options['limit'] = $perpage; $options['offset'] = $offset; $args = array( 'base' => '%_%', 'format' => '?paged=%#%', 'total' => $tpages, 'current' => $curpage, 'show_all' => false, 'end_size' => 1, 'mid_size' => 2, 'prev_next' => true, 'type' => 'array', 'add_args' => false ); $pagination = null; $pages = paginate_links( $args ); if( is_array( $pages ) ){ $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged'); $pagination .= '<div class="gosmtp-pagination"><ul class="gosmtp-pagination-wrap">'; foreach ( $pages as $page ) { $pagination .= '<li class="gosmtp-pagination-links">'.$page.'</li>'; } $pagination .= '</ul></div>'; } $mails = $logger->get_logs('records', 0, $options); if(!empty($mails)){ foreach($mails as $key => $mail){ $id = $mail->id; $tos = maybe_unserialize($mail->to); $to_list = []; if(is_array($tos)){ foreach($tos as $key => $to){ $to_list[] = $to[0]; } $to_list = implode(',',$to_list); }else{ $to_list = $tos; } $created_at = date("M d, Y", strtotime($mail->created_at)).' at '. date('h:i A', strtotime($mail->created_at)); $status = $mail->status == 'sent' ? __('Sent') : __('Failed'); $resend_retry = $mail->status == 'sent' ? __('Resend') : __('Retry'); $backup_text = !empty($mail->parent_id) ? __('(Backup)') : ''; $logs_td = array( 'subject' => '<td class="gosmtp-flex"> <span class="dashicons '.( $status == 'Sent' ? 'dashicons-yes-alt' : 'dashicons-warning').' gosmtp-mail-status '.esc_attr(strtolower($status)).'"></span> <span>'. (!empty($mail->subject) ? esc_attr($mail->subject) : __('[No Subject]')) .'</span> </td>', 'from' => '<td>'.(!empty($mail->from) ? esc_html($mail->from) : __('NA')).'</td>', 'to' => '<td>'.esc_html($to_list).'</td>', 'source' => '<td>'.(!empty($mail->source) ? esc_html($mail->source) : __('NA')).'</td>', 'provider' => '<td>'.(!empty($mail->provider) ? ucwords(esc_html($mail->provider)).' '.$backup_text : __('NA')).'</td>', 'date_send' => '<td>'.esc_html($created_at).'</td>', 'action' => '<td class="gosmtp-mail-actions"> <button type="button" data-id="'. esc_attr($id).'" class="gosmtp-'. esc_attr(strtolower($resend_retry)).'"> <i class="dashicons '.($resend_retry == 'Retry' ? 'dashicons-update-alt' : 'dashicons-image-rotate' ).'"></i> <span>'.esc_html($resend_retry).'</span> </button> <button type="button" data-id="'. esc_attr($id).'" class="gosmtp-forward"> <i class="dashicons dashicons-share-alt2"></i> </button> <button class="gosmtp-mail-delete" type="button" data-id="'.esc_attr($id).'"> <i class="dashicons dashicons-trash"></i> </button> </td>' ); ?> <tr data-id="<?php echo esc_attr($id); ?>" class="gosmtp-mail-details"> <td> <input type="checkbox" value="<?php echo esc_attr($id); ?>" class="gosmtp-checkbox" /> </td> <?php foreach($logs_td as $key => $col ){ if(!empty($columns) && array_key_exists($key,$columns)){ echo $col; } } ?> </tr> <?php } }else{ ?> <tr> <td colspan="8" class="gosmtp-empty-row"><?php _e('Logs not found!'); ?></td> </tr> <?php } ?> </table> <div class="gosmtp-table-footer"> <div class="gosmtp-log-options-wrap"> <div class="gosmtp-log-options"> <select id="gosmtp-table-options"> <option value="delete"><?php _e('Delete'); ?></option> </select> <button id="gosmtp-table-opt-btn" type="button" class="button button-primary"><?php _e('Go'); ?></button> </div> </div> <?php echo $pagination; ?> </div> </div> </form> </div> <div class="gosmtp-dialog" id="gosmtp-logs-dialog"> <div class="gosmtp-dialog-wrap"> <div class="gosmtp-dialog-container"> <div class="gosmtp-dialog-header"> <div class="gosmtp-dialog-header-content"> <div class="gosmtp-dialog-title"><div class="gosmtp-status-icon"></div><span><?php _e('GOSMTP LOGS') ?></span></div> <div class="gosmtp-dialog-actions"></div> <div class="gosmtp-forward-dialog"></div> <button type="button" class="gosmtp-dialog-close"><span class="dashicons dashicons-no-alt"></span></button> </div> </div> <div class="gosmtp-dialog-content"> <div class="gosmtp-log-details"> <div class="gosmtp-row"> <div class="gosmtp-col gosmtp-col-6"> <label><?php _e('Mailer / Source') ?>:</label><span class="gosmtp-message-mailer"></span> </div> <div class="gosmtp-col gosmtp-col-6"> <label><?php _e('Created') ?>:</label> <span class="gosmtp-message-created"></span> </div> </div> <div class="gosmtp-row"> <div class="gosmtp-col gosmtp-col-6"> <label><?php _e('From') ?>:</label> <span class="gosmtp-message-from"></span> </div> <div class="gosmtp-col gosmtp-col-6"> <label><?php _e('To') ?>:</label> <span class="gosmtp-message-tos"></span> </div> </div> <div class="gosmtp-row"> <div class="gosmtp-col gosmtp-col-12"> <label><?php _e('Subject') ?>:</label><span class="gosmtp-message-subject"></span> </div> </div> <div class="gosmtp-row"> <div class="gosmtp-col gosmtp-col-12"> <label><?php _e('Body') ?>:</label> </div> <div class="gosmtp-col gosmtp-col-12 gosmtp-message-body"></div> </div> </div> </div> <div class="gosmtp-accordion"> <div class="gosmtp-accordion-item"> <div class="gosmtp-accordion-header"> <strong><?php _e('Headers') ?></strong> <i class="dashicons dashicons-arrow-down-alt2"></i> </div> <div class="gosmtp-accordion-content"> <div class="gosmtp-log-headers"></div> </div> </div> <div class="gosmtp-accordion-item"> <div class="gosmtp-accordion-header"> <strong><?php _e('Attachments') ?> <span class="gosmtp-attachment-count"></span></strong> <i class="dashicons dashicons-arrow-down-alt2"></i> </div> <div class="gosmtp-accordion-content"> <div class="gosmtp-log-attachments"></div> </div> </div> <div class="gosmtp-accordion-item"> <div class="gosmtp-accordion-header"> <strong><?php _e('Response') ?></strong> <i class="dashicons dashicons-arrow-down-alt2"></i> </div> <div class="gosmtp-accordion-content"> <div class="gosmtp-log-response"></div> </div> </div> </div> </div> </div> </div> <div class="gosmtp-dialog" id="gosmtp-testmail-dialog"> <div class="gosmtp-dialog-wrap"> <div class="gosmtp-dialog-container"> <div class="gosmtp-dialog-header"> <div class="gosmtp-dialog-header-content"> <div class="gosmtp-dialog-title"><div class="gosmtp-status-icon"></div><span><?php _e('GOSMTP Test Mail') ?></span></div> <button type="button" class="gosmtp-dialog-close"><span class="dashicons dashicons-no-alt"></span></button> </div> </div> <div class="gosmtp-dialog-content"> <!--start --> <form class="gosmtp-smtp-mail" id="smtp-test-mail" name="test-mail" method="post" action=""> <div class="gosmtp-row"> <div class="gosmtp-col gosmtp-col-12 gosmtp-borderless"> <label><?php _e('Recipient Email') ?>:</label> </div> <div class="gosmtp-col gosmtp-col-12 gosmtp-borderless"> <input type="email" name="reciever_test_email" class="regular-text gosmtp-full-width" placeholder="<?php _e('example@example.com') ?>" required /> </div> </div> <div class="gosmtp-row"> <div class="gosmtp-col gosmtp-col-12 gosmtp-borderless"> <label><?php _e('Subject') ?>:</label> </div> <div class="gosmtp-col gosmtp-col-12 gosmtp-borderless"> <input type="text" name="smtp_test_subject" class="regular-text gosmtp-full-width" placeholder="<?php _e('Enter Subject') ?>" value="Test Mail" required /> </div> </div> <div class="gosmtp-row"> <div class="gosmtp-col gosmtp-col-12 gosmtp-borderless"> <label><?php _e('Message') ?>:</label> </div> <div class="gosmtp-col gosmtp-col-12 gosmtp-borderless"> <textarea name="smtp_test_message" placeholder="Enter Message" class="regular-text gosmtp-full-width" rows="10"required >This is a test mail!</textarea> </div> </div> <div class="gosmtp-row"> <div class="gosmtp-col gosmtp-col-12 gosmtp-borderless gosmtp-text-right"> <button type="submit" name="send_mail" id="send_mail" class="button button-primary"><?php _e("Send Mail") ?></button> </div> </div> </form> <!--end --> </div> </div> </div> </div> <div class="gosmtp-dialog" id="gosmtp-forward-dialog"> <div class="gosmtp-dialog-wrap"> <div class="gosmtp-dialog-container"> <div class="gosmtp-dialog-header"> <div class="gosmtp-dialog-header-content"> <div class="gosmtp-dialog-title"><div class="gosmtp-status-icon"></div><span><?php _e('GOSMTP FORWARD EMAIL') ?></span></div> <button type="button" class="gosmtp-dialog-close"><span class="dashicons dashicons-no-alt"></span></button> </div> </div> <div class="gosmtp-dialog-content"> <div class="gosmtp-log-details"> <div class="gosmtp-row"> <div class="gosmtp-col gosmtp-col-12"> <form class = "gosmtp-forward-form" id= "gosmtp-forward-form"> <h2><?php _e('Enter Recipient Email') ?>:</h2> <b><?php _e('Note: Use coma(,) for separate two emails') ?></b> <div class='gosmtp-forward-email'> <span class="dashicons dashicons-email"></span> <input type='email' required class="gosmtp-recipient-email" placeholder = "example@example.com" multiple> </div> <input type='submit' name='forward-mail' value = "Send" class="button forward-mail"> <input type='button' name='cancel' value = "Cancel" class="button cancel-button"> </form> </div> </div> </div> </div> </div> </div> </div> <div class="gosmtp-loader"> <div class="gosmtp-loader-circle"></div> </div> <script> var gosmtp_ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ) ?>?"; var gosmtp_ajax_nonce = "<?php echo wp_create_nonce('gosmtp_ajax') ?>"; </script> email-reports.php 0000644 00000022520 15100073403 0010032 0 ustar 00 <?php // We need the ABSPATH if (!defined('ABSPATH')) exit; // Styles and Scripts wp_enqueue_style( 'gosmtp-admin' ); wp_enqueue_script( 'gosmtp-admin' ); function gosmtp_reports_table(){ global $gosmtp; if(empty($gosmtp->options['logs']['enable_logs']) ){ echo '<h1>Email report is disabled</h1> <div class="error is-dismissiable notice"> <p>'.__('To view email reports, please enable email logs from GoSMTP').' <a href="'.admin_url('admin.php?page=gosmtp#logs-settings').'">'.__('settings').'</a>.</p> </div>'; return; } $date = gosmtp_optget('date'); $custom_start = gosmtp_optget('start-date'); $custom_end = gosmtp_optget('end-date'); $search = gosmtp_optget('search_email_reports'); $multiselect = gosmtp_optget('multiselect'); $all_data = array(); $logger = new GOSMTP\Logger(); // Appropriate date setup if($date == 'custom_date'){ $start = $custom_start; $end = $custom_end; if($start != '' && $end == ''){ $end = date("Y-m-d"); } }else if($date == 'all' || $date == ''){ $start = ''; $end = ''; }else{ $start = date('Y-m-d', strtotime('-'.$date.' days')); $end = date("Y-m-d"); } // Assign all data in option array $options = array( 'interval' => array( 'start' => $start, 'end' => $end ), 'search' => $search, 'multiselect' => $multiselect, 'pagination' => false, ); $email_logs = $logger->get_logs('records', 0, $options); // TODO: Get only records as paged $mails = gosmtp_group_by($email_logs); // Pagination $perpage = 10; $curpage = (int) gosmtp_optget('paged', 1); $records_ct = count($mails); $tpages = ceil($records_ct / $perpage); $offset = ($curpage - 1) * $perpage; $args = array( 'base' => '%_%', 'format' => '?paged=%#%', 'total' => $tpages, 'current' => $curpage, 'show_all' => false, 'end_size' => 1, 'mid_size' => 2, 'prev_next' => true, 'type' => 'array', 'add_args' => false ); // Set limit value $limit = array( 'perpage' => $perpage, 'offset' => $offset, ); $pages = paginate_links( $args ); $table_cols = array( 'subject' => __('Subject'), 'from' => __('From'), 'to' => __('To'), 'resent_count' => __('Resent'), 'retries' => __('Retry'), 'sent' => __('Sent'), 'failed' => __('Failed'), 'total' => __('Total') ); ?> <div class="wrap"> <div class="wrap_header gosmtp-relative"> <h1><?php _e('Email Reports') ?></h1> </div> <div class="gosmtp-upper-elements-container"> <form action="<?php echo admin_url('admin.php'); ?>" method="get"> <input type="hidden" name="page" value="email_reports"> <div class="gosmtp-element-container"> <div class=" gosmtp-report-search-container"> <div class="gosmtp-search-report-list-icon"> <span class="dashicons dashicons-search"></span> <input type="search" id="gosmtp-search_email" placeholder="Search" name="search_email_reports"/> </div> </div> <div class="gosmtp-fiter-main-container"> <div class="gosmtp-fiter-container"> <span class="multiselect"><?php _e('Select Filter') ?></span> <ul class="multiselect-options"> <li><input type='checkbox' class="multiselect-checkbox" id="all" value='all'><label for="all"><?php _e('Select all') ?></label></li> <li><input type='checkbox' class="multiselect-checkbox" id="subject" value='subject' name="multiselect[]"><label for="subject"><?php _e('Subject') ?></label></li> <li><input type='checkbox' class="multiselect-checkbox" id="from" value='from' name="multiselect[]"><label for="from"><?php _e('From') ?></label></li> <li><input type='checkbox' class="multiselect-checkbox" id="to" value='to' name="multiselect[]"><label for="to"><?php _e('To') ?></label></li> </ul> <span class="dropdown dashicons dashicons-arrow-down-alt2"></span> </div> </div> <div class="gosmtp-date-option-container"> <select id="gosmtp-date-option-filter" name='date'> <option value="all" selected disabled><?php _e('Select date') ?></option> <option value="7"><?php _e('Last 7 days') ?></option> <option value="14"><?php _e('Last 14 days') ?></option> <option value="30"><?php _e('Last 30 days') ?></option> <option value="custom_date"><?php _e('Custom date') ?></option> </select> <div class='gosmtp-report-date-container'> <input type="date" name="start-date" id="gosmtp-start-date" placeholder="Start date" /> <input type="date" name="end-date" id="gosmtp-end-date" placeholder="End date" /> </div> </div> <div class=" gosmtp-report-submit-container"> <input type="submit" class="button button-primary submit-email-reports" id="submit-email-reports" name="submit-email-reports" value="Search"/> </div> </div> </form> <!-- <div class="graph-container"> <canvas id="myChart"></canvas> </div> --> </div> <table cellspacing="0" cellpadding="8" border="0" width="100%" class="gosmtp-email-report" id="gosmtp-email-reports"> <tr> <td colspan="9"> <h2><?php _e('Email Reports') ?></h2> </td> </tr> <tr> <?php foreach($table_cols as $col){ echo '<th>'.$col.'</th>'; } ?> <!-- <th><?php _e('Graph') ?></th> --> </tr> <?php // Mail list array $mail_list = gosmtp_group_by($email_logs, $limit); // Append HTML value if(!empty($mail_list)){ $all_data = array(); foreach($mail_list as $main_key => $mail){ $mail_array = $mail['total']; echo "<tr>"; foreach($table_cols as $ck => $col){ echo '<td>'.$mail_array[$ck].'</td>'; } echo '<!-- <td> <span class ="dashicons dashicons-chart-area email_report_icon" data-data="'.$main_key.'" onclick="gosmtp_load_graph([\"'.$main_key.'\"])"></span> </td> --> </tr>'; // Add by date data in all data array_push($all_data, $mail['by_dates']); } }else{ // Empty all data when no result found $all_data = array(); ?> <tr> <td colspan="9" class="gosmtp-empty-row"><?php _e('Records not found!'); ?></td> </tr> <?php } ?> </table> <?php // Render pagination HTML if( is_array( $pages ) ){ echo '<div class="gosmtp-pagination"><ul class="gosmtp-pagination-wrap">'; foreach ( $pages as $page ) { echo '<li class="gosmtp-pagination-links">'.$page.'</li>'; } echo '</ul></div>'; } ?> </div> <script> var gosmtp_ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>?"; var gosmtp_ajax_nonce = "<?php echo wp_create_nonce('gosmtp_ajax'); ?>"; </script> <?php } // Set Custom array function gosmtp_set_custom_array($val){ $return = array(); foreach($val as $kk => $vv){ switch($kk){ case 'to': $tos = maybe_unserialize($vv); $to_list = []; foreach($tos as $keys => $to){ $to_list[] = $to[0]; } $return['total']['to'] = implode(',', $to_list); break; case 'status': if($vv == 'sent'){ $return['total']['sent'] = 1; $return['total']['failed'] = 0; }elseif($vv == 'failed'){ $return['total']['sent'] = 0; $return['total']['failed'] = 1; } break; case 'subject': $return['total'][$kk] = empty($vv) ? '[No Subject]' : $vv; break; default: $return['total'][$kk] = $vv; } } $return['total']['total'] = $return['total']['sent'] + $return['total']['failed']; $return['by_dates'][$val->created_at] = array( 'sent' => $return['total']['sent'], 'failed' => $return['total']['failed'], 'retries' => $return['total']['retries'], 'resent_count' => $return['total']['resent_count'], 'total' => $return['total']['total'], ); return $return; } // Generate Array with group by function gosmtp_group_by($logs, $limit = array(), $multiselect = array('subject', 'from', 'to')){ $groups = array(); $i = 0; $key_array = array(); if(empty($logs)){ return array(); } foreach($logs as $val){ $val = gosmtp_set_custom_array($val); $total = $val['total']; $groups_val = array(); foreach($multiselect as $multi_val){ array_push($groups_val, $total[$multi_val]); } // Add new group if(!in_array($groups_val, $key_array)){ $key_array[$i] = $groups_val; $groups[$i]['total'] = $val['total']; $groups[$i]['by_dates'] = $val['by_dates']; $i++; }else{ foreach($key_array as $kk => $vv){ if($groups_val != $vv){ continue; } $group_total = $groups[$kk]['total']; $total['sent'] = $group_total['sent'] + $total['sent']; $total['failed'] = $group_total['failed'] + $total['failed']; $total['retries'] = $group_total['retries'] + $total['retries']; $total['resent_count'] = $group_total['resent_count'] + $total['resent_count']; $total['total'] = $group_total['total'] + $total['total']; $groups[$kk]['total'] = $total; $groups[$kk]['by_dates'][array_keys($val['by_dates'])[0]] = $val['by_dates'][array_keys($val['by_dates'])[0]]; } } } // Set limit for Pagination if(!empty($limit)){ $limit_res = array(); for($i = 0; $i< $limit['perpage']; $i++){ $j = $i+$limit['offset']; if(isset($groups[$j])){ array_push($limit_res, $groups[$j] ); } } $groups = $limit_res; } return $groups; } weekly_email_reports.php 0000644 00000020445 15100073403 0011500 0 ustar 00 <?php if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } // defining function function gosmtp_cal_percentage($num_amount, $num_total) { if($num_total == 0){ return '0%'; } $count = ($num_amount / $num_total) * 100; $count = number_format($count, 0); return $count.'%'; } // Weekly Report HTML function gosmtp_send_email_reports($send_email = false){ global $gosmtp; if(!($gosmtp->options['weekly_reports']['timestamp'] <= time()) && $send_email){ return; } if(!function_exists('gosmtp_group_by')){ include_once GOSMTP_PRO_DIR .'/main/email-reports.php'; } $logger = new GOSMTP\Logger(); $week = $gosmtp->options['weekly_reports']['weekday']; $last_week = date("Y-m-d", strtotime('last '.$week, strtotime('tomorrow'))); $start = date('Y-m-d', strtotime($last_week. ' -7 days')); $end = $last_week; $multiselect = array('subject'); $options = array( 'interval' => array( 'start' => $start, 'end' => $end ), 'pagination' => false, ); $email_logs = $logger->get_logs('records', '', $options); $mails = gosmtp_group_by($email_logs, array(), $multiselect); $sent = $failed = $total = 0; foreach($mails as $key =>$val){ $sent = $sent + $val['total']['sent']; $failed = $failed + $val['total']['failed']; $total = $total + $val['total']['total']; } echo'<div style="padding:0px 180px">"'; $email = '<html> <head> <meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8""/> <meta name=""viewport"" content=""width=device-width, initial-scale=1.0""/> <!--[if !mso]><!--> <meta http-equiv=""X-UA-Compatible"" content=""IE=edge""/> <!--<![endif]--> <meta name=""color-scheme"" content=""light dark""> <meta name=""supported-color-schemes"" content=""light dark""> <title>GOSMTP Weekly Email Summary</title> <style type=""text/css""> /* General styles. */ *{ box-sizing: border-box; } @media only screen and (max-width: 600px) { .total-container div h4{ font-size:13px; } .total-container div h1{ font-size:15px; } .total-container div h1{ font-size:15px; } .total-container{ border:1px solid #bdbdbd; } .total-container div{ border: none !important; padding: 5px 3px !important; margin:0px !important; border-radius:5px } .total-container div .mail-icon *{ width:25px !important; } .inner-table{ padding:10px !important; width:100% !important; } .outer-table{ padding:20px; } .list_mail div{ padding:5px 3px !important; } .inner-table{ border-spacing:10px !important; } td{ padding:5px!important; } } } </style> </head> <body> <table style="width:100%; background:#f1f1f1; padding:50px 0px" class="outer-table"> <tr style="text-align: center;"><td><img src="https://gosmtp.net/sitepad-data/uploads/2023/02/gosmtp-text.png" style="width:250px;text-align: center;"></td></tr> <tr><td> <table class="inner-table" style="background:white;border-radius:5px;width:70%; padding:30px; table-layout: fixed !important;border-spacing:20px;border: 1px solid #dcdcdc; margin: 20px auto;border:1px solid #bdbdbd;" > <tr> <td colspan="3"> <h3>Hi there,</h3> </td> </tr> <tr> <td colspan="3"> <b>Let\'s take a look at how your emails performed over the last week.</b> </td> </tr> <tr > <td colspan="3" style="text-align:center"> <div class="total-container"> <div style="box-sizing: border-box; padding:20px; height:100%; width:30%; text-align: center; border-radius:5px; display:inline-block; margin:2% 1%;border:1px solid #bdbdbd;"> <div class="mail-icon" style=" font-size:40px; color:#454545; width:100%; margin:5px 0px;">✉</div> <h4 style="color:#454545;margin:5px 0px;">Total Emails</h4> <h1 style="margin:5px 0px;">'.$total.'</h1> <h2 style="color:#454545;margin:5px 0px;" > ▲'.gosmtp_cal_percentage($total, $total).'</h2> </div> <div style="box-sizing: border-box; padding:20px; height:100%; width:30%; text-align: center; border-radius:5px;display:inline-block;margin:2% 1%;border:1px solid #bdbdbd;"> <div class="mail-icon" style="font-size:40px; color:#228b22 !important; width:100%;margin:5px 0px;">✔</div> <h4 style="color:#228b22 ;margin:5px 0px;">Sent</h4> <h1 style="margin:5px 0px;">'.$sent.'</h1> <h2 style="color:#228b22 ;margin:5px 0px;"> ▲'.gosmtp_cal_percentage($sent, $total).'</h2> </div> <div style="box-sizing: border-box; padding:20px; height:100%; width:30%; text-align: center; border-radius:5px; display:inline-block;margin:2% 1%;border:1px solid #bdbdbd;"> <div class="mail-icon" style="font-size:40px; color:red; width:100%;margin:5px 0px;">✖</div> <h4 style="color:red;margin:5px 0px;">Failed</h4> <h1 style="margin:5px 0px;">'.$failed.'</h1> <h2 style="color:red;margin:5px 0px;"> ▼'.gosmtp_cal_percentage($failed, $total).'</h2> </div> </div> </td> </tr> <tr> <td colspan="2"> <h2>Last Weeks Emails</h2> </td> <td colspan="1" style="text-align:right"> <a href="'.admin_url().'/admin.php?page=email_reports&date=custom_date&start-date='.$start.'&end-date='.$end.'">View all Emails</a> </td> </tr> <tr> <td colspan="3"> <hr> </td> </tr>'; if(!empty($mails)){ foreach($mails as $key => $val){ $email .= "<tr><td colspan='3' ><b>".$val['total']['subject']."</b></td></tr> <tr style='background:#f1f1f1;'> <td colspan='3'class='list_mail'> <div style='padding:7px; display:inline-block; width:32%; box-sizing:border-box;'><span style='color:#454545;font-weight:bold;font-size:16px;margin-right:5px;'>✉</span>".$val['total']['total']."</div> <div style='padding:7px; display:inline-block; width:32%; box-sizing:border-box;'><span style='color:#228b22; font-weight:bold;font: size 16px;margin-right:5px;'>✔</span>".$val['total']['sent']."(".gosmtp_cal_percentage($val['total']['sent'], $val['total']['total']).")"."</div> <div style='padding:7px; display:inline-block; width:32%; box-sizing:border-box;'><span style='color:red;font-weight:bold;font-size:16px;margin-right:5px;'>✖</span>".$val['total']['failed']."(".gosmtp_cal_percentage($val['total']['failed'], $val['total']['total']).")"."</div> </td> </tr>"; // Print Only 5 Rows if($key == 4){ break; } } }else{ $email .="<tr > <td colspan='3' style='text-align:center'> <h4>Email Records were not found this week!</h4> </td> </tr>"; } $email .='</table></td></tr></table> </body> </html>'; if($send_email || isset($_GET['test_reports'])){ $headers = array( 'Content-Type: text/html; charset=UTF-8' ); $admin_email = get_option('admin_email'); if(!empty($admin_email)){ $title = 'Weekly Report'; if(wp_mail($admin_email, $title, $email, $headers)){ echo '<div class="updated notice is-dismissible"> <p>'.__('Email Sent successfully to ').' <a href="mailto:'.$admin_email.'">'.$admin_email.'</a>.</p> </div> <div class="updated notice is-dismissible"> <p>'.__('Weekly email reports were sent from: '.$start.' to: '.$end.'').' </p> </div>'; }else{ echo '<div class="error notice is-dismissible"> <p>'.__('Failed to send email to ').' <a href="mailto:'.$admin_email.'">'.__($admin_email).'</a>'.__('. Plesae check ').'<a href="'.admin_url('admin.php?page=gosmtp-logs').'">'. __(' Email logs ').'</a>'.__('for more info.').'</p> </div>'; } }else{ echo "<script>alert('Admin email has not yet been set up. Please first configure the admin email.')</script>"; } } // Update Timestamp if($send_email){ $gosmtp->options['weekly_reports']['timestamp'] = strtotime("next ".$gosmtp->options['weekly_reports']['weekday']); update_option( 'gosmtp_options', $gosmtp->options ); return; } $email.= '<form style="text-align:center"> <input type="hidden" name="page" value="weekly_email_reports"> <input type="submit" name="test_reports" value = "Send Test Weekly Reports" style="background:var(--blue);color:var(--white);padding:9px 10px;border:none;border-radius:3px;"> <p>'. __('Note: Test weekly report will be sent to admin email') .'</p> </form></div>'; echo $email; } ?> ajax.php 0000644 00000013656 15100073403 0006204 0 ustar 00 <?php if(!defined('ABSPATH')){ die('Hacking Attempt!'); } // ------- ACTIONS -------/ add_action('wp_ajax_loginizer_dismiss_csrf', 'loginizer_dismiss_csrf'); add_action('wp_ajax_loginizer_dismiss_backuply', 'loginizer_dismiss_backuply'); add_action('wp_ajax_loginizer_dismiss_social_alert', 'loginizer_dismiss_social_alert'); add_action('wp_ajax_loginizer_dismiss_newsletter', 'loginizer_dismiss_newsletter'); add_action('wp_ajax_loginizer_failed_login_export', 'loginizer_failed_login_export'); add_action('wp_ajax_loginizer_export', 'loginizer_export'); add_action('wp_ajax_loginizer_social_order', 'loginizer_social_order'); add_action('wp_ajax_loginizer_dismiss_license_alert', 'loginizer_dismiss_license_alert'); add_action('wp_ajax_loginizer_dismiss_softwp_alert', 'loginizer_dismiss_softwp_alert'); // ----- FUNCTIONS ------// function loginizer_dismiss_csrf(){ // Some AJAX security check_ajax_referer('loginizer_admin_ajax', 'nonce'); if(!current_user_can('manage_options')){ wp_die('Sorry, but you do not have permissions to change settings.'); } update_option('loginizer_csrf_promo_time', (0 - time())); echo 1; wp_die(); } function loginizer_dismiss_social_alert(){ // Some AJAX security check_ajax_referer('loginizer_admin_ajax', 'nonce'); if(!current_user_can('manage_options')){ wp_send_json_error('Sorry, but you do not have permissions to change settings.'); } update_option('loginizer_social_login_url', wp_login_url()); wp_send_json_success(); } function loginizer_dismiss_backuply(){ // Some AJAX security check_ajax_referer('loginizer_admin_ajax', 'nonce'); if(!current_user_can('manage_options')){ wp_die('Sorry, but you do not have permissions to change settings.'); } update_option('loginizer_backuply_promo_time', (0 - time())); echo 1; wp_die(); } function loginizer_dismiss_newsletter(){ // Some AJAX security check_ajax_referer('loginizer_admin_ajax', 'nonce'); if(!current_user_can('manage_options')){ wp_die('Sorry, but you do not have permissions to change settings.'); } update_option('loginizer_dismiss_newsletter', time()); echo 1; wp_die(); } //Export Failed Login Attempts function loginizer_failed_login_export(){ global $wpdb; // Some AJAX security check_ajax_referer('loginizer_admin_ajax', 'nonce'); if(!current_user_can('manage_options')){ wp_die('Sorry, but you do not have permissions to change settings.'); } $csv_array = lz_selectquery("SELECT * FROM `".$wpdb->prefix."loginizer_logs` ORDER BY `time` DESC", 1); $filename = 'loginizer-failed-login-attempts'; if(empty($csv_array)){ echo -1; echo __('No data to export', 'loginizer'); wp_die(); } header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: attachment; filename='.$filename.'.csv'); $allowed_fields = array('ip' => 'IP', 'attempted_username' => 'Attempted Username', 'last_f_attemp' => 'Last Failed Attempt', 'f_attempts_count' => 'Failed Attempts Count', 'lockouts_count' => 'Lockouts Count', 'url_attacked' => 'URL Attacked'); $file = fopen("php://output","w"); fputcsv($file, array_values($allowed_fields)); foreach($csv_array as $failed_attempts){ $row = array($failed_attempts['ip'], sanitize_user($failed_attempts['username'], true), date('d/M/Y H:i:s P', $failed_attempts['time']), $failed_attempts['count'], $failed_attempts['lockout'], $failed_attempts['url']); fputcsv($file, $row); } fclose($file); wp_die(); } // Export CSV function loginizer_export(){ // Some AJAX security check_ajax_referer('loginizer_admin_ajax', 'nonce'); if(!current_user_can('manage_options')){ wp_die('Sorry, but you do not have permissions to change settings.'); } $lz_csv_type = lz_optpost('lz_csv_type'); switch($lz_csv_type){ case 'blacklist': $csv_array = get_option('loginizer_blacklist'); $filename = 'loginizer-blacklist'; break; case 'whitelist': $csv_array = get_option('loginizer_whitelist'); $filename = 'loginizer-whitelist'; break; } if(empty($csv_array)){ echo -1; echo __('No data to export', 'loginizer'); wp_die(); } header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: attachment; filename='.$filename.'.csv'); $allowed_fields = array('start' => 'Start IP', 'end' => 'End IP', 'time' => 'Time'); $file = fopen("php://output","w"); fputcsv($file, array_values($allowed_fields)); foreach($csv_array as $ik => $iv){ $iv['start'] = $iv['start']; $iv['end'] = $iv['end']; $iv['time'] = date('d/m/Y', $iv['time']); $row = array(); foreach($allowed_fields as $ak => $av){ $row[$ak] = $iv[$ak]; } fputcsv($file, $row); } fclose($file); wp_die(); } function loginizer_social_order(){ // Some AJAX security check_ajax_referer('loginizer_social_nonce', 'security'); if(!current_user_can('manage_options')){ wp_die(__('Sorry, but you do not have permissions to change settings.', 'loginizer')); } $order = map_deep(map_deep($_POST['order'], 'wp_unslash'), 'sanitize_text_field'); update_option('loginizer_social_order', array_flip($order)); wp_send_json_success(); } function loginizer_dismiss_license_alert(){ // Some AJAX security check_ajax_referer('loginizer_license_notice', 'security'); if(!current_user_can('manage_options')){ wp_die(__('Sorry, but you do not have permissions to change settings.', 'loginizer')); } update_option('loginizer_license_notice', (0 - time()), false); die('DONE'); } function loginizer_dismiss_softwp_alert(){ // Some AJAX security check_ajax_referer('loginizer_softwp_notice', 'security'); if(!current_user_can('activate_plugins')){ wp_die(__('Sorry, but you do not have permissions to change settings.', 'loginizer')); } update_option('loginizer_softwp_upgrade', (0 - time()), false); die('DONE'); } mailer/amazonses/emailservicerequest.php 0000644 00000025556 15100073403 0014615 0 ustar 00 <?php namespace GOSMTP\mailer\amazonses; /** * EmailServiceRequest PHP class * * @link https://github.com/daniel-zahariev/php-aws-ses * @package AmazonEmailService * @version v0.9.1 */ class EmailServiceRequest { private $ses, $verb, $parameters = array(); // CURL request handler that can be reused protected $curl_handler = null; // Holds the response from calling AWS's API protected $response; // public static $curlOptions = array(); /** * Constructor * * @param EmailService $ses The EmailService object making this request * @param string $verb HTTP verb * @return void */ public function __construct(EmailService $ses = null, $verb = 'GET') { $this->ses = $ses; $this->verb = $verb; $this->response = (object) array('body' => '', 'code' => 0, 'error' => false); } /** * Set SES class * * @param EmailService $ses * @return EmailServiceRequest $this */ public function setSES(EmailService $ses) { $this->ses = $ses; return $this; } /** * Set HTTP method * * @param string $verb * @return EmailServiceRequest $this */ public function setVerb($verb) { $this->verb = $verb; return $this; } /** * Set request parameter * * @param string $key Key * @param string $value Value * @param boolean $replace Whether to replace the key if it already exists (default true) * @return EmailServiceRequest $this */ public function setParameter($key, $value, $replace = true) { if(!$replace && isset($this->parameters[$key])) { $temp = (array)($this->parameters[$key]); $temp[] = $value; $this->parameters[$key] = $temp; } else { $this->parameters[$key] = $value; } return $this; } /** * Get the params for the request * * @return array $params */ public function getParametersEncoded() { $params = array(); foreach ($this->parameters as $var => $value) { if(is_array($value)) { foreach($value as $v) { $params[] = $var.'='.$this->__customUrlEncode($v); } } else { $params[] = $var.'='.$this->__customUrlEncode($value); } } sort($params, SORT_STRING); return $params; } /** * Clear the request parameters * @return EmailServiceRequest $this */ public function clearParameters() { $this->parameters = array(); return $this; } /** * Instantiate and setup CURL handler for sending requests. * Instance is cashed in `$this->curl_handler` * * @return resource $curl_handler */ protected function getCurlHandler() { if (!empty($this->curl_handler)) return $this->curl_handler; $curl = curl_init(); curl_setopt($curl, CURLOPT_USERAGENT, 'EmailService/php'); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, ($this->ses->verifyHost() ? 2 : 0)); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, ($this->ses->verifyPeer() ? 1 : 0)); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, false); curl_setopt($curl, CURLOPT_WRITEFUNCTION, array(&$this, '__responseWriteCallback')); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); foreach(self::$curlOptions as $option => $value) { curl_setopt($curl, $option, $value); } $this->curl_handler = $curl; return $this->curl_handler; } /** * Get the response * * @return object | false */ public function getResponse() { $url = 'https://'.$this->ses->getHost().'/'; $query = implode('&', $this->getParametersEncoded()); $headers = $this->getHeaders($query); $curl_handler = $this->getCurlHandler(); curl_setopt($curl_handler, CURLOPT_CUSTOMREQUEST, $this->verb); // Request types switch ($this->verb) { case 'GET': case 'DELETE': $url .= '?'.$query; break; case 'POST': curl_setopt($curl_handler, CURLOPT_POSTFIELDS, $query); $headers[] = 'Content-Type: application/x-www-form-urlencoded'; break; } curl_setopt($curl_handler, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl_handler, CURLOPT_URL, $url); // Execute, grab errors if (curl_exec($curl_handler)) { $this->response->code = curl_getinfo($curl_handler, CURLINFO_HTTP_CODE); } else { $this->response->error = array( 'curl' => true, 'code' => curl_errno($curl_handler), 'message' => curl_error($curl_handler), ); } // cleanup for reusing the current instance for multiple requests curl_setopt($curl_handler, CURLOPT_POSTFIELDS, ''); $this->parameters = array(); // Parse body into XML if ($this->response->error === false && !empty($this->response->body)) { $this->response->body = simplexml_load_string($this->response->body); // Grab SES errors if (!in_array($this->response->code, array(200, 201, 202, 204)) && isset($this->response->body->Error)) { $error = $this->response->body->Error; $output = array(); $output['curl'] = false; $output['Error'] = array(); $output['Error']['Type'] = (string)$error->Type; $output['Error']['Code'] = (string)$error->Code; $output['Error']['Message'] = (string)$error->Message; $output['RequestId'] = (string)$this->response->body->RequestId; $this->response->error = $output; unset($this->response->body); } } $response = $this->response; $this->response = (object) array('body' => '', 'code' => 0, 'error' => false); return $response; } /** * Get request headers * @param string $query * @return array */ protected function getHeaders($query) { $headers = array(); if ($this->ses->getRequestSignatureVersion() == EmailService::REQUEST_SIGNATURE_V4) { $date = (new \DateTime('now', new \DateTimeZone('UTC')))->format('Ymd\THis\Z'); $headers[] = 'X-Amz-Date: ' . $date; $headers[] = 'Host: ' . $this->ses->getHost(); $headers[] = 'Authorization: ' . $this->__getAuthHeaderV4($date, $query); } else { // must be in format 'Sun, 06 Nov 1994 08:49:37 GMT' $date = gmdate('D, d M Y H:i:s e'); $auth = 'AWS3-HTTPS AWSAccessKeyId='.$this->ses->getAccessKey(); $auth .= ',Algorithm=HmacSHA256,Signature='.$this->__getSignature($date); $headers[] = 'Date: ' . $date; $headers[] = 'Host: ' . $this->ses->getHost(); $headers[] = 'X-Amzn-Authorization: ' . $auth; } return $headers; } /** * Destroy any leftover handlers */ public function __destruct() { if (!empty($this->curl_handler)) @curl_close($this->curl_handler); } /** * CURL write callback * * @param resource $curl CURL resource * @param string $data Data * @return integer */ private function __responseWriteCallback($curl, $data) { if (!isset($this->response->body)) { $this->response->body = $data; } else { $this->response->body .= $data; } return strlen($data); } /** * Contributed by afx114 * URL encode the parameters as per http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?Query_QueryAuth.html * PHP's rawurlencode() follows RFC 1738, not RFC 3986 as required by Amazon. The only difference is the tilde (~), so convert it back after rawurlencode * See: http://www.morganney.com/blog/API/AWS-Product-Advertising-API-Requires-a-Signed-Request.php * * @param string $var String to encode * @return string */ private function __customUrlEncode($var) { return str_replace('%7E', '~', rawurlencode($var)); } /** * Generate the auth string using Hmac-SHA256 * * @internal Used by EmailServiceRequest::getResponse() * @param string $string String to sign * @return string */ private function __getSignature($string) { return base64_encode(hash_hmac('sha256', $string, $this->ses->getSecretKey(), true)); } /** * @param string $key * @param string $dateStamp * @param string $regionName * @param string $serviceName * @param string $algo * @return string */ private function __getSigningKey($key, $dateStamp, $regionName, $serviceName, $algo) { $kDate = hash_hmac($algo, $dateStamp, 'AWS4' . $key, true); $kRegion = hash_hmac($algo, $regionName, $kDate, true); $kService = hash_hmac($algo, $serviceName, $kRegion, true); return hash_hmac($algo,'aws4_request', $kService, true); } /** * Implementation of AWS Signature Version 4 * @see https://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html * @param string $amz_datetime * @param string $query * @return string */ private function __getAuthHeaderV4($amz_datetime, $query) { $amz_date = substr($amz_datetime, 0, 8); $algo = 'sha256'; $aws_algo = 'AWS4-HMAC-' . strtoupper($algo); $host_parts = explode('.', $this->ses->getHost()); $service = $host_parts[0]; $region = $host_parts[1]; $canonical_uri = '/'; if($this->verb === 'POST') { $canonical_querystring = ''; $payload_data = $query; } else { $canonical_querystring = $query; $payload_data = ''; } // ************* TASK 1: CREATE A CANONICAL REQUEST ************* $canonical_headers_list = [ 'host:' . $this->ses->getHost(), 'x-amz-date:' . $amz_datetime ]; $canonical_headers = implode("\n", $canonical_headers_list) . "\n"; $signed_headers = 'host;x-amz-date'; $payload_hash = hash($algo, $payload_data, false); $canonical_request = implode("\n", array( $this->verb, $canonical_uri, $canonical_querystring, $canonical_headers, $signed_headers, $payload_hash )); // ************* TASK 2: CREATE THE STRING TO SIGN************* $credential_scope = $amz_date. '/' . $region . '/' . $service . '/' . 'aws4_request'; $string_to_sign = implode("\n", array( $aws_algo, $amz_datetime, $credential_scope, hash($algo, $canonical_request, false) )); // ************* TASK 3: CALCULATE THE SIGNATURE ************* // Create the signing key using the function defined above. $signing_key = $this->__getSigningKey($this->ses->getSecretKey(), $amz_date, $region, $service, $algo); // Sign the string_to_sign using the signing_key $signature = hash_hmac($algo, $string_to_sign, $signing_key, false); // ************* TASK 4: ADD SIGNING INFORMATION TO THE REQUEST ************* return $aws_algo . ' ' . implode(', ', array( 'Credential=' . $this->ses->getAccessKey() . '/' . $credential_scope, 'SignedHeaders=' . $signed_headers , 'Signature=' . $signature )); } } mailer/amazonses/amazonses.php 0000644 00000011230 15100073403 0012514 0 ustar 00 <?php /** * Class GOSMTP_Mailer_AmazonSES. * * @since 1.0.0 */ namespace GOSMTP\Mailer\AmazonSES; use GOSMTP\Mailer\Loader; use GOSMTP\mailer\amazonses\EmailService; use GOSMTP\mailer\amazonses\EmailServiceMessage; class AmazonSES extends Loader{ var $title = 'AmazonSES'; var $mailer = 'amazonses'; var $client = null; public function send(){ global $phpmailer; if ($phpmailer->preSend()) { $response = $this->postSend(); return $this->handle_response( $response ); } return $this->handle_response(new \WP_Error(400, 'Unable to send mail for some reason!', [])); } public function postSend(){ global $phpmailer; $mime = chunk_split(base64_encode($phpmailer->getSentMIMEMessage()), 76, "\n"); $options = $this->getMailerOption(); $region = 'email.' . $options['region'] . '.amazonaws.com'; $ses = new EmailService($options['access_key'], $options['secret_key'], $region, false); $response = $ses->sendRawEmail($mime); if(is_wp_error($response)){ $return_response = new \WP_Error($response->get_error_code(), $response->get_error_message(), $response->get_error_messages()); }else{ $resp_body = wp_remote_retrieve_body($response); $resp_code = wp_remote_retrieve_response_code($response); $resp_body = \json_decode($resp_body, true); if(!empty($response['MessageId'])){ $msgId = $response['MessageId']; $status = __('Email sent successfully'); $return_response = [ 'status' => true, 'code' => 200, 'messageId' => $msgId, 'message' => $status ]; }else{ $err_code = $resp_code; $error_text = ['']; if( ! empty( $resp_body['error'] ) && is_array( $resp_body['error'] ) ){ $message = $resp_body['error']['message']; $error_text[] = $this->message_formatting( $message, $code ); }else{ $error_text[] = $this->get_response_error_message($response); } $error_msg = implode( '\r\n', array_map( 'esc_textarea', array_filter( $error_text ) ) ); $return_response = new \WP_Error($err_code, $error_msg, $resp_body); } } return $return_response; } public function email_checker($data){ $region= 'email.' . $data['amazonses']['region'] . '.amazonaws.com'; set_error_handler(function ($errno, $errstr, $errfile, $errline) { throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); }); $ses = new EmailService($data['amazonses']['access_key'], $data['amazonses']['secret_key'], $region, false); try{ $ses->listVerifiedEmailAddresses(); }catch(\Exception $e) { return new \WP_Error(423, $e->getMessage()); } return false; } public function load_field(){ $fields = array( 'access_key' => array( 'title' => __('Access Key'), 'type' => 'password', ), 'secret_key' => array( 'title' => __('Secret Key'), 'type' => 'password', 'desc' => __( 'Follow this link to get a Secret Key from AmazonSES: <a href="https://aws.amazon.com/blogs/security/wheres-my-secret-access-key/" target="_blank">Secret Key.</a>' ), ), 'region' => array( 'title' => __('Region'), 'type' => 'select', 'list' => array( 'us-east-1' => __('US East (N. Virginia)', 'gosmtp'), 'us-east-2' => __('US East (Ohio)', 'gosmtp'), 'us-west-1' => __('US West (N. California)', 'gosmtp'), 'us-west-2' => __('US West (Oregon)', 'gosmtp'), 'ca-central-1' => __('Canada (Central)', 'gosmtp'), 'eu-west-1' => __('EU (Ireland)', 'gosmtp'), 'eu-west-2' => __('EU (London)', 'gosmtp'), 'eu-west-3' => __('Europe (Paris)', 'gosmtp'), 'eu-central-1' => __('EU (Frankfurt)', 'gosmtp'), 'eu-south-1' => __('Europe (Milan)', 'gosmtp'), 'eu-north-1' => __('Europe (Stockholm)', 'gosmtp'), 'ap-south-1' => __('Asia Pacific (Mumbai)', 'gosmtp'), 'ap-northeast-2' => __('Asia Pacific (Seoul)', 'gosmtp'), 'ap-southeast-1' => __('Asia Pacific (Singapore)', 'gosmtp'), 'ap-southeast-2' => __('Asia Pacific (Sydney)', 'gosmtp'), 'ap-northeast-1' => __('Asia Pacific (Tokyo)', 'gosmtp'), 'sa-east-1' => __('South America (Sao Paulo)', 'gosmtp'), 'me-south-1' => __('Middle East (Bahrain)', 'gosmtp'), 'us-gov-west-1' => __('AWS GovCloud (US)', 'gosmtp'), 'af-south-1' => __('Africa (Cape Town)', 'gosmtp'), 'cn-northwest-1' => __('China (Ningxia)', 'gosmtp') ), 'desc' => __( 'Define which endpoint you want to use for sending messages.<br>If you are operating under EU laws, you may be required to use EU region. <a href="https://aws.amazon.com/about-aws/global-infrastructure/regions_az/" target="_blank">More information</a> on aws.amazon.com.' ), ) ); return $fields; } } mailer/amazonses/emailservice.php 0000644 00000056721 15100073403 0013202 0 ustar 00 <?php namespace GOSMTP\mailer\amazonses; use GOSMTP\mailer\amazonses\EmailServiceRequest; /** * * Copyright (c) 2014, Daniel Zahariev. * Copyright (c) 2011, Dan Myers. * Parts copyright (c) 2008, Donovan Schonknecht. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * This is a modified BSD license (the third clause has been removed). * The BSD license may be found here: * http://www.opensource.org/licenses/bsd-license.php * * Amazon Simple Email Service is a trademark of Amazon.com, Inc. or its affiliates. * * EmailService is based on Donovan Schonknecht's Amazon S3 PHP class, found here: * http://undesigned.org.za/2007/10/22/amazon-s3-php-class * * @copyright 2014 Daniel Zahariev * @copyright 2011 Dan Myers * @copyright 2008 Donovan Schonknecht */ /** * EmailService PHP class * * @link https://github.com/daniel-zahariev/php-aws-ses * @package AmazonEmailService * @version v0.9.1 */ class EmailService { /** * @link(AWS SES regions, http://docs.aws.amazon.com/ses/latest/DeveloperGuide/regions.html) */ const AWS_US_EAST_1 = 'email.us-east-1.amazonaws.com'; const AWS_US_WEST_2 = 'email.us-west-2.amazonaws.com'; const AWS_EU_WEST1 = 'email.eu-west-1.amazonaws.com'; const REQUEST_SIGNATURE_V3 = 'v3'; const REQUEST_SIGNATURE_V4 = 'v4'; /** * AWS SES Target host of region */ protected $__host; /** * AWS SES Access key */ protected $__accessKey; /** * AWS Secret key */ protected $__secretKey; /** * Enable/disable */ protected $__trigger_errors; /** * Controls the reuse of CURL hander for sending a bulk of messages * @deprecated */ protected $__bulk_sending_mode = false; /** * Optionally reusable EmailServiceRequest instance */ protected $__ses_request = null; /** * Controls CURLOPT_SSL_VERIFYHOST setting for EmailServiceRequest's curl handler */ protected $__verifyHost = true; /** * Controls CURLOPT_SSL_VERIFYPEER setting for EmailServiceRequest's curl handler */ protected $__verifyPeer = true; /** * @var string HTTP Request signature version */ protected $__requestSignatureVersion; /** * Constructor * * @param string $accessKey Access key * @param string $secretKey Secret key * @param string $host Amazon Host through which to send the emails * @param boolean $trigger_errors Trigger PHP errors when AWS SES API returns an error * @param string $requestSignatureVersion Version of the request signature */ public function __construct($accessKey = null, $secretKey = null, $host = self::AWS_US_EAST_1, $trigger_errors = true, $requestSignatureVersion = self::REQUEST_SIGNATURE_V4) { if ($accessKey !== null && $secretKey !== null) { $this->setAuth($accessKey, $secretKey); } $this->__host = $host; $this->__trigger_errors = $trigger_errors; $this->__requestSignatureVersion = $requestSignatureVersion; } /** * Set the request signature version * * @param string $requestSignatureVersion * @return EmailService $this */ public function setRequestSignatureVersion($requestSignatureVersion) { $this->__requestSignatureVersion = $requestSignatureVersion; return $this; } /** * @return string */ public function getRequestSignatureVersion() { return $this->__requestSignatureVersion; } /** * Set AWS access key and secret key * * @param string $accessKey Access key * @param string $secretKey Secret key * @return EmailService $this */ public function setAuth($accessKey, $secretKey) { $this->__accessKey = $accessKey; $this->__secretKey = $secretKey; return $this; } /** * Set AWS Host * @param string $host AWS Host */ public function setHost($host = self::AWS_US_EAST_1) { $this->__host = $host; return $this; } /** * @deprecated */ public function enableVerifyHost($enable = true) { $this->__verifyHost = (bool)$enable; return $this; } /** * @deprecated */ public function enableVerifyPeer($enable = true) { $this->__verifyPeer = (bool)$enable; return $this; } /** * @deprecated */ public function verifyHost() { return $this->__verifyHost; } /** * @deprecated */ public function verifyPeer() { return $this->__verifyPeer; } /** * Get AWS target host * @return boolean */ public function getHost() { return $this->__host; } /** * Get AWS SES auth access key * @return string */ public function getAccessKey() { return $this->__accessKey; } /** * Get AWS SES auth secret key * @return string */ public function getSecretKey() { return $this->__secretKey; } /** * Get the verify peer CURL mode * @return boolean */ public function getVerifyPeer() { return $this->__verifyPeer; } /** * Get the verify host CURL mode * @return boolean */ public function getVerifyHost() { return $this->__verifyHost; } /** * Get bulk email sending mode * @return boolean * @deprecated */ public function getBulkMode() { return $this->__bulk_sending_mode; } /** * Enable/disable CURLOPT_SSL_VERIFYHOST for EmailServiceRequest's curl handler * verifyHost and verifyPeer determine whether curl verifies ssl certificates. * It may be necessary to disable these checks on certain systems. * These only have an effect if SSL is enabled. * * @param boolean $enable New status for the mode * @return EmailService $this */ public function setVerifyHost($enable = true) { $this->__verifyHost = (bool)$enable; return $this; } /** * Enable/disable CURLOPT_SSL_VERIFYPEER for EmailServiceRequest's curl handler * verifyHost and verifyPeer determine whether curl verifies ssl certificates. * It may be necessary to disable these checks on certain systems. * These only have an effect if SSL is enabled. * * @param boolean $enable New status for the mode * @return EmailService $this */ public function setVerifyPeer($enable = true) { $this->__verifyPeer = (bool)$enable; return $this; } /** * Enable/disable bulk email sending mode * * @param boolean $enable New status for the mode * @return EmailService $this * @deprecated */ public function setBulkMode($enable = true) { $this->__bulk_sending_mode = (bool)$enable; return $this; } /** * Lists the email addresses that have been verified and can be used as the 'From' address * * @return array An array containing two items: a list of verified email addresses, and the request id. */ public function listVerifiedEmailAddresses() { $ses_request = $this->getRequestHandler('GET'); $ses_request->setParameter('Action', 'ListIdentities'); $ses_response = $ses_request->getResponse(); if ($ses_response->error === false && $ses_response->code !== 200) { $ses_response->error = array('code' => $ses_response->code, 'message' => 'Unexpected HTTP status'); } if ($ses_response->error !== false) { $this->__triggerError('ListIdentities', $ses_response->error); return []; } $response = array(); if (!isset($ses_response->body)) { return $response; } $addresses = array(); foreach ($ses_response->body->ListIdentitiesResult->Identities->member as $address) { if(is_email($address)) { $addresses[] = (string)$address; } } $response['Addresses'] = $addresses; $response['RequestId'] = (string)$ses_response->body->ResponseMetadata->RequestId; return $response; } /** * Requests verification of the provided email address, so it can be used * as the 'From' address when sending emails through EmailService. * * After submitting this request, you should receive a verification email * from Amazon at the specified address containing instructions to follow. * * @param string $email The email address to get verified * @return array The request id for this request. */ public function verifyEmailAddress($email) { $ses_request = $this->getRequestHandler('POST'); $ses_request->setParameter('Action', 'VerifyEmailAddress'); $ses_request->setParameter('EmailAddress', $email); $ses_response = $ses_request->getResponse(); if ($ses_response->error === false && $ses_response->code !== 200) { $ses_response->error = array('code' => $ses_response->code, 'message' => 'Unexpected HTTP status'); } if ($ses_response->error !== false) { $this->__triggerError('verifyEmailAddress', $ses_response->error); return false; } $response['RequestId'] = (string)$ses_response->body->ResponseMetadata->RequestId; return $response; } /** * Removes the specified email address from the list of verified addresses. * * @param string $email The email address to remove * @return array The request id for this request. */ public function deleteVerifiedEmailAddress($email) { $ses_request = $this->getRequestHandler('DELETE'); $ses_request->setParameter('Action', 'DeleteVerifiedEmailAddress'); $ses_request->setParameter('EmailAddress', $email); $ses_response = $ses_request->getResponse(); if ($ses_response->error === false && $ses_response->code !== 200) { $ses_response->error = array('code' => $ses_response->code, 'message' => 'Unexpected HTTP status'); } if ($ses_response->error !== false) { $this->__triggerError('deleteVerifiedEmailAddress', $ses_response->error); return false; } $response['RequestId'] = (string)$ses_response->body->ResponseMetadata->RequestId; return $response; } /** * Retrieves information on the current activity limits for this account. * See http://docs.amazonwebservices.com/ses/latest/APIReference/API_GetSendQuota.html * * @return array An array containing information on this account's activity limits. */ public function getSendQuota() { $ses_request = $this->getRequestHandler('GET'); $ses_request->setParameter('Action', 'GetSendQuota'); $ses_response = $ses_request->getResponse(); if ($ses_response->error === false && $ses_response->code !== 200) { $ses_response->error = array('code' => $ses_response->code, 'message' => 'Unexpected HTTP status'); } if ($ses_response->error !== false) { $this->__triggerError('getSendQuota', $ses_response->error); return false; } $response = array(); if (!isset($ses_response->body)) { return $response; } $response['Max24HourSend'] = (string)$ses_response->body->GetSendQuotaResult->Max24HourSend; $response['MaxSendRate'] = (string)$ses_response->body->GetSendQuotaResult->MaxSendRate; $response['SentLast24Hours'] = (string)$ses_response->body->GetSendQuotaResult->SentLast24Hours; $response['RequestId'] = (string)$ses_response->body->ResponseMetadata->RequestId; return $response; } /** * Retrieves statistics for the last two weeks of activity on this account. * See http://docs.amazonwebservices.com/ses/latest/APIReference/API_GetSendStatistics.html * * @return array An array of activity statistics. Each array item covers a 15-minute period. */ public function getSendStatistics() { $ses_request = $this->getRequestHandler('GET'); $ses_request->setParameter('Action', 'GetSendStatistics'); $ses_response = $ses_request->getResponse(); if ($ses_response->error === false && $ses_response->code !== 200) { $ses_response->error = array('code' => $ses_response->code, 'message' => 'Unexpected HTTP status'); } if ($ses_response->error !== false) { $this->__triggerError('getSendStatistics', $ses_response->error); return false; } $response = array(); if (!isset($ses_response->body)) { return $response; } $datapoints = array(); foreach ($ses_response->body->GetSendStatisticsResult->SendDataPoints->member as $datapoint) { $p = array(); $p['Bounces'] = (string)$datapoint->Bounces; $p['Complaints'] = (string)$datapoint->Complaints; $p['DeliveryAttempts'] = (string)$datapoint->DeliveryAttempts; $p['Rejects'] = (string)$datapoint->Rejects; $p['Timestamp'] = (string)$datapoint->Timestamp; $datapoints[] = $p; } $response['SendDataPoints'] = $datapoints; $response['RequestId'] = (string)$ses_response->body->ResponseMetadata->RequestId; return $response; } /** * Given a EmailServiceMessage object, submits the message to the service for sending. * * @param EmailServiceMessage $sesMessage An instance of the message class * @param boolean $use_raw_request If this is true or there are attachments to the email `SendRawEmail` call will be used * @param boolean $trigger_error Optionally overwrite the class setting for triggering an error (with type check to true/false) * @return array An array containing the unique identifier for this message and a separate request id. * Returns false if the provided message is missing any required fields. * @link(AWS SES Response formats, http://docs.aws.amazon.com/ses/latest/DeveloperGuide/query-interface-responses.html) */ public function sendEmail($sesMessage, $use_raw_request = false, $trigger_error = null) { if (!$sesMessage->validate()) { $this->__triggerError('sendEmail', 'Message failed validation.'); return false; } $ses_request = $this->getRequestHandler('POST'); $action = !empty($sesMessage->attachments) || $use_raw_request ? 'SendRawEmail' : 'SendEmail'; $ses_request->setParameter('Action', $action); // Works with both calls if (!is_null($sesMessage->configuration_set)) { $ses_request->setParameter('ConfigurationSetName', $sesMessage->configuration_set); } if ($action == 'SendRawEmail') { // https://docs.aws.amazon.com/ses/latest/APIReference/API_SendRawEmail.html $ses_request->setParameter('RawMessage.Data', $sesMessage->mime); } else { $i = 1; foreach ($sesMessage->to as $to) { $ses_request->setParameter('Destination.ToAddresses.member.' . $i, $sesMessage->encodeRecipients($to)); $i++; } if (is_array($sesMessage->cc)) { $i = 1; foreach ($sesMessage->cc as $cc) { $ses_request->setParameter('Destination.CcAddresses.member.' . $i, $sesMessage->encodeRecipients($cc)); $i++; } } if (is_array($sesMessage->bcc)) { $i = 1; foreach ($sesMessage->bcc as $bcc) { $ses_request->setParameter('Destination.BccAddresses.member.' . $i, $sesMessage->encodeRecipients($bcc)); $i++; } } if (is_array($sesMessage->replyto)) { $i = 1; foreach ($sesMessage->replyto as $replyto) { $ses_request->setParameter('ReplyToAddresses.member.' . $i, $sesMessage->encodeRecipients($replyto)); $i++; } } $ses_request->setParameter('Source', $sesMessage->encodeRecipients($sesMessage->from)); if ($sesMessage->returnpath != null) { $ses_request->setParameter('ReturnPath', $sesMessage->returnpath); } if ($sesMessage->subject != null && strlen($sesMessage->subject) > 0) { $ses_request->setParameter('Message.Subject.Data', $sesMessage->subject); if ($sesMessage->subjectCharset != null && strlen($sesMessage->subjectCharset) > 0) { $ses_request->setParameter('Message.Subject.Charset', $sesMessage->subjectCharset); } } if ($sesMessage->messagetext != null && strlen($sesMessage->messagetext) > 0) { $ses_request->setParameter('Message.Body.Text.Data', $sesMessage->messagetext); if ($sesMessage->messageTextCharset != null && strlen($sesMessage->messageTextCharset) > 0) { $ses_request->setParameter('Message.Body.Text.Charset', $sesMessage->messageTextCharset); } } if ($sesMessage->messagehtml != null && strlen($sesMessage->messagehtml) > 0) { $ses_request->setParameter('Message.Body.Html.Data', $sesMessage->messagehtml); if ($sesMessage->messageHtmlCharset != null && strlen($sesMessage->messageHtmlCharset) > 0) { $ses_request->setParameter('Message.Body.Html.Charset', $sesMessage->messageHtmlCharset); } } $i = 1; foreach ($sesMessage->message_tags as $key => $value) { $ses_request->setParameter('Tags.member.' . $i . '.Name', $key); $ses_request->setParameter('Tags.member.' . $i . '.Value', $value); $i++; } } $ses_response = $ses_request->getResponse(); if ($ses_response->error === false && $ses_response->code !== 200) { $response = array( 'code' => $ses_response->code, 'error' => array('Error' => array('message' => 'Unexpected HTTP status')), ); return $response; } if ($ses_response->error !== false) { if (($this->__trigger_errors && ($trigger_error !== false)) || $trigger_error === true) { $this->__triggerError('sendEmail', $ses_response->error); return false; } return $ses_response; } $response = array( 'MessageId' => (string)$ses_response->body->{"{$action}Result"}->MessageId, 'RequestId' => (string)$ses_response->body->ResponseMetadata->RequestId, ); return $response; } public function sendRawEmail($sesMessage) { $ses_request = $this->getRequestHandler('POST'); $ses_request->setParameter('Action', 'SendRawEmail'); // https://docs.aws.amazon.com/ses/latest/APIReference/API_SendRawEmail.html $ses_request->setParameter('RawMessage.Data', $sesMessage); $ses_response = $ses_request->getResponse(); if (($ses_response->error === false && $ses_response->code !== 200) || $ses_response->error !== false) { return new \WP_Error($ses_response->code, $this->getErrorMessage('sendRawEmail', $ses_response->error), $ses_response->error); } return array( 'MessageId' => (string)$ses_response->body->SendRawEmailResult->MessageId, 'RequestId' => (string)$ses_response->body->ResponseMetadata->RequestId, ); } /** * Trigger an error message * * {@internal Used by member functions to output errors} * @param string $functionname The name of the function that failed * @param array $error Array containing error information * @return void */ public function __triggerError($functionname, $error) { trigger_error($this->getErrorMessage($functionname, $error), E_USER_WARNING); } public function getErrorMessage($functionname, $error) { if ($error == false) { return sprintf("EmailService::%s(): Encountered an error, but no description given", $functionname); } else if (isset($error['curl']) && $error['curl']) { return sprintf("EmailService::%s(): %s %s", $functionname, $error['code'], $error['message']); } else if (isset($error['Error'])) { $e = $error['Error']; return sprintf("EmailService::%s(): %s - %s: %s\nRequest Id: %s\n", $functionname, $e['Type'], $e['Code'], $e['Message'], $error['RequestId']); } return sprintf("EmailService::%s(): Encountered an error: %s", $functionname, $error); } /** * Set SES Request * * @param EmailServiceRequest $ses_request description * @return EmailService $this */ public function setRequestHandler(EmailServiceRequest $ses_request = null) { if (!is_null($ses_request)) { $ses_request->setSES($this); } $this->__ses_request = $ses_request; return $this; } /** * Get SES Request * * @param string $verb HTTP Verb: GET, POST, DELETE * @return EmailServiceRequest SES Request */ public function getRequestHandler($verb) { if (empty($this->__ses_request)) { $this->__ses_request = new EmailServiceRequest($this, $verb); } else { $this->__ses_request->setVerb($verb); } return $this->__ses_request; } } mailer/amazonses/emailservicemessage.php 0000644 00000045752 15100073403 0014551 0 ustar 00 <?php namespace GOSMTP\mailer\amazonses; /** * EmailServiceMessage PHP class * * @link https://github.com/daniel-zahariev/php-aws-ses * @package AmazonEmailService * @version v0.9.1 */ final class EmailServiceMessage { // these are public for convenience only // these are not to be used outside of the EmailService class! public $to, $cc, $bcc, $replyto, $recipientsCharset; public $from, $returnpath; public $subject, $messagetext, $messagehtml; public $subjectCharset, $messageTextCharset, $messageHtmlCharset; public $attachments, $customHeaders, $configuration_set, $message_tags; public $is_clean, $raw_message; public $mime; public function __construct() { $this->to = array(); $this->cc = array(); $this->bcc = array(); $this->replyto = array(); $this->recipientsCharset = 'UTF-8'; $this->from = null; $this->returnpath = null; $this->subject = null; $this->messagetext = null; $this->messagehtml = null; $this->subjectCharset = 'UTF-8'; $this->messageTextCharset = 'UTF-8'; $this->messageHtmlCharset = 'UTF-8'; $this->attachments = array(); $this->customHeaders = array(); $this->configuration_set = null; $this->message_tags = array(); $this->is_clean = true; $this->raw_message = null; } /** * addTo, addCC, addBCC, and addReplyTo have the following behavior: * If a single address is passed, it is appended to the current list of addresses. * If an array of addresses is passed, that array is merged into the current list. * * @return EmailServiceMessage $this * @link http://docs.aws.amazon.com/ses/latest/APIReference/API_Destination.html */ public function addTo($to) { if (!is_array($to)) { $this->to[] = $to; } else { $this->to = array_unique(array_merge($this->to, $to)); } $this->is_clean = false; return $this; } /** * @return EmailServiceMessage $this */ public function setTo($to) { $this->to = (array) $to; $this->is_clean = false; return $this; } /** * Clear the To: email address(es) for the message * * @return EmailServiceMessage $this */ public function clearTo() { $this->to = array(); $this->is_clean = false; return $this; } /** * @return EmailServiceMessage $this * @see addTo() */ public function addCC($cc) { if (!is_array($cc)) { $this->cc[] = $cc; } else { $this->cc = array_merge($this->cc, $cc); } $this->is_clean = false; return $this; } /** * Clear the CC: email address(es) for the message * * @return EmailServiceMessage $this */ public function clearCC() { $this->cc = array(); $this->is_clean = false; return $this; } /** * @return EmailServiceMessage $this * @see addTo() */ public function addBCC($bcc) { if (!is_array($bcc)) { $this->bcc[] = $bcc; } else { $this->bcc = array_merge($this->bcc, $bcc); } $this->is_clean = false; return $this; } /** * Clear the BCC: email address(es) for the message * * @return EmailServiceMessage $this */ public function clearBCC() { $this->bcc = array(); $this->is_clean = false; return $this; } /** * @return EmailServiceMessage $this * @see addTo() */ public function addReplyTo($replyto) { if (!is_array($replyto)) { $this->replyto[] = $replyto; } else { $this->replyto = array_merge($this->replyto, $replyto); } $this->is_clean = false; return $this; } /** * Clear the Reply-To: email address(es) for the message * * @return EmailServiceMessage $this */ public function clearReplyTo() { $this->replyto = array(); $this->is_clean = false; return $this; } /** * Clear all of the message recipients in one go * * @return EmailServiceMessage $this * @uses clearTo() * @uses clearCC() * @uses clearBCC() * @uses clearReplyTo() */ public function clearRecipients() { $this->clearTo(); $this->clearCC(); $this->clearBCC(); $this->clearReplyTo(); $this->is_clean = false; return $this; } /** * @return EmailServiceMessage $this */ public function setFrom($from) { $this->from = $from; $this->is_clean = false; return $this; } /** * @return EmailServiceMessage $this */ public function setReturnPath($returnpath) { $this->returnpath = $returnpath; $this->is_clean = false; return $this; } /** * @return EmailServiceMessage $this */ public function setRecipientsCharset($charset) { $this->recipientsCharset = $charset; $this->is_clean = false; return $this; } /** * @return EmailServiceMessage $this */ public function setSubject($subject) { $this->subject = $subject; $this->is_clean = false; return $this; } /** * @return EmailServiceMessage $this */ public function setSubjectCharset($charset) { $this->subjectCharset = $charset; $this->is_clean = false; return $this; } /** * @return EmailServiceMessage $this * @link http://docs.aws.amazon.com/ses/latest/APIReference/API_Message.html */ public function setMessageFromString($text, $html = null) { $this->messagetext = $text; $this->messagehtml = $html; $this->is_clean = false; return $this; } /** * @return EmailServiceMessage $this */ public function setMessageFromFile($textfile, $htmlfile = null) { if (file_exists($textfile) && is_file($textfile) && is_readable($textfile)) { $this->messagetext = file_get_contents($textfile); } else { $this->messagetext = null; } if (file_exists($htmlfile) && is_file($htmlfile) && is_readable($htmlfile)) { $this->messagehtml = file_get_contents($htmlfile); } else { $this->messagehtml = null; } $this->is_clean = false; return $this; } /** * @return EmailServiceMessage $this */ public function setMessageFromURL($texturl, $htmlurl = null) { if ($texturl !== null) { $this->messagetext = file_get_contents($texturl); } else { $this->messagetext = null; } if ($htmlurl !== null) { $this->messagehtml = file_get_contents($htmlurl); } else { $this->messagehtml = null; } $this->is_clean = false; return $this; } /** * @return EmailServiceMessage $this */ public function setMessageCharset($textCharset, $htmlCharset = null) { $this->messageTextCharset = $textCharset; $this->messageHtmlCharset = $htmlCharset; $this->is_clean = false; return $this; } /** * @return EmailServiceMessage $this */ public function setConfigurationSet($configuration_set = null) { $this->configuration_set = $configuration_set; $this->is_clean = false; return $this; } /** * @return array $message_tags */ public function getMessageTags() { return $this->message_tags; } /** * @return null|mixed $message_tag */ public function getMessageTag($key) { return isset($this->message_tags[$key]) ? $this->message_tags[$key] : null; } /** * Add Message tag * * Both key and value can contain only ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-) and be less than 256 characters. * * @param string $key * @param mixed $value * @return EmailServiceMessage $this * @link https://docs.aws.amazon.com/ses/latest/DeveloperGuide/event-publishing-send-email.html * @link https://docs.aws.amazon.com/ses/latest/APIReference/API_MessageTag.html */ public function setMessageTag($key, $value) { $this->message_tags[$key] = $value; $this->is_clean = false; return $this; } /** * @param string $key The key of the tag to be removed * @return EmailServiceMessage $this */ public function removeMessageTag($key) { unset($this->message_tags[$key]); $this->is_clean = false; return $this; } /** * @param array $message_tags * @return EmailServiceMessage $this */ public function setMessageTags($message_tags = array()) { $this->message_tags = array_merge($this->message_tags, $message_tags); $this->is_clean = false; return $this; } /** * @return EmailServiceMessage $this */ public function removeMessageTags() { $this->message_tags = array(); $this->is_clean = false; return $this; } /** * Add custom header - this works only with SendRawEmail * * @param string $header Your custom header * @return EmailServiceMessage $this * @link( Restrictions on headers, http://docs.aws.amazon.com/ses/latest/DeveloperGuide/header-fields.html) */ public function addCustomHeader($header) { $this->customHeaders[] = $header; $this->is_clean = false; return $this; } /** * Add email attachment by directly passing the content * * @param string $name The name of the file attachment as it will appear in the email * @param string $data The contents of the attachment file * @param string $mimeType Specify custom MIME type * @param string $contentId Content ID of the attachment for inclusion in the mail message * @param string $attachmentType Attachment type: attachment or inline * @return EmailServiceMessage $this */ public function addAttachmentFromData($name, $data, $mimeType = 'application/octet-stream', $contentId = null, $attachmentType = 'attachment') { $this->attachments[$name] = array( 'name' => $name, 'mimeType' => $mimeType, 'data' => $data, 'contentId' => $contentId, 'attachmentType' => ($attachmentType == 'inline' ? 'inline; filename="' . $name . '"' : $attachmentType), ); $this->is_clean = false; return $this; } /** * Add email attachment by passing file path * * @param string $name The name of the file attachment as it will appear in the email * @param string $path Path to the attachment file * @param string $mimeType Specify custom MIME type * @param string $contentId Content ID of the attachment for inclusion in the mail message * @param string $attachmentType Attachment type: attachment or inline * @return boolean Status of the operation */ public function addAttachmentFromFile($name, $path, $mimeType = 'application/octet-stream', $contentId = null, $attachmentType = 'attachment') { if (file_exists($path) && is_file($path) && is_readable($path)) { $this->addAttachmentFromData($name, file_get_contents($path), $mimeType, $contentId, $attachmentType); return true; } $this->is_clean = false; return false; } /** * Add email attachment by passing file path * * @param string $name The name of the file attachment as it will appear in the email * @param string $url URL to the attachment file * @param string $mimeType Specify custom MIME type * @param string $contentId Content ID of the attachment for inclusion in the mail message * @param string $attachmentType Attachment type: attachment or inline * @return boolean Status of the operation */ public function addAttachmentFromUrl($name, $url, $mimeType = 'application/octet-stream', $contentId = null, $attachmentType = 'attachment') { $data = file_get_contents($url); if ($data !== false) { $this->addAttachmentFromData($name, $data, $mimeType, $contentId, $attachmentType); return true; } $this->is_clean = false; return false; } /** * Get the existence of attached inline messages * * @return boolean */ public function hasInlineAttachments() { foreach ($this->attachments as $attachment) { if ($attachment['attachmentType'] != 'attachment') { return true; } } return false; } /** * Get the raw mail message * * @return string */ public function getRawMessage($encode = true) { if ($this->is_clean && !is_null($this->raw_message) && $encode) { return $this->raw_message; } $this->is_clean = true; $boundary = uniqid(rand(), true); $raw_message = count($this->customHeaders) > 0 ? join("\n", $this->customHeaders) . "\n" : ''; if (!empty($this->message_tags)) { $message_tags = array(); foreach ($this->message_tags as $key => $value) { $message_tags[] = "{$key}={$value}"; } $raw_message .= 'X-SES-MESSAGE-TAGS: ' . join(', ', $message_tags) . "\n"; } if (!is_null($this->configuration_set)) { $raw_message .= 'X-SES-CONFIGURATION-SET: ' . $this->configuration_set . "\n"; } $raw_message .= count($this->to) > 0 ? 'To: ' . $this->encodeRecipients($this->to) . "\n" : ''; $raw_message .= 'From: ' . $this->encodeRecipients($this->from) . "\n"; if (!empty($this->replyto)) { $raw_message .= 'Reply-To: ' . $this->encodeRecipients($this->replyto) . "\n"; } if (!empty($this->cc)) { $raw_message .= 'CC: ' . $this->encodeRecipients($this->cc) . "\n"; } if (!empty($this->bcc)) { $raw_message .= 'BCC: ' . $this->encodeRecipients($this->bcc) . "\n"; } if ($this->subject != null && strlen($this->subject) > 0) { $raw_message .= 'Subject: =?' . $this->subjectCharset . '?B?' . base64_encode($this->subject) . "?=\n"; } $raw_message .= 'MIME-Version: 1.0' . "\n"; $raw_message .= 'Content-type: ' . ($this->hasInlineAttachments() ? 'multipart/related' : 'Multipart/Mixed') . '; boundary="' . $boundary . '"' . "\n"; $raw_message .= "\n--{$boundary}\n"; $raw_message .= 'Content-type: Multipart/Alternative; boundary="alt-' . $boundary . '"' . "\n"; if ($this->messagetext != null && strlen($this->messagetext) > 0) { $charset = empty($this->messageTextCharset) ? '' : "; charset=\"{$this->messageTextCharset}\""; $raw_message .= "\n--alt-{$boundary}\n"; $raw_message .= 'Content-Type: text/plain' . $charset . "\n\n"; $raw_message .= $this->messagetext . "\n"; } if ($this->messagehtml != null && strlen($this->messagehtml) > 0) { $charset = empty($this->messageHtmlCharset) ? '' : "; charset=\"{$this->messageHtmlCharset}\""; $raw_message .= "\n--alt-{$boundary}\n"; $raw_message .= 'Content-Type: text/html' . $charset . "\n\n"; $raw_message .= $this->messagehtml . "\n"; } $raw_message .= "\n--alt-{$boundary}--\n"; foreach ($this->attachments as $attachment) { $raw_message .= "\n--{$boundary}\n"; $raw_message .= 'Content-Type: ' . $attachment['mimeType'] . '; name="' . $attachment['name'] . '"' . "\n"; $raw_message .= 'Content-Disposition: ' . $attachment['attachmentType'] . "\n"; if (!empty($attachment['contentId'])) { $raw_message .= 'Content-ID: ' . $attachment['contentId'] . '' . "\n"; } $raw_message .= 'Content-Transfer-Encoding: base64' . "\n"; $raw_message .= "\n" . chunk_split(base64_encode($attachment['data']), 76, "\n") . "\n"; } $raw_message .= "\n--{$boundary}--\n"; if (!$encode) { return $raw_message; } $this->raw_message = base64_encode($raw_message); return $this->raw_message; } /** * Encode recipient with the specified charset in `recipientsCharset` * * @return string Encoded recipients joined with comma */ public function encodeRecipients($recipient) { if (is_array($recipient)) { return join(', ', array_map(array($this, 'encodeRecipients'), $recipient)); } if (preg_match("/(.*)<(.*)>/", $recipient, $regs)) { $recipient = '=?' . $this->recipientsCharset . '?B?' . base64_encode($regs[1]) . '?= <' . $regs[2] . '>'; } return $recipient; } /** * Validates whether the message object has sufficient information to submit a request to SES. * * This does not guarantee the message will arrive, nor that the request will succeed; * instead, it makes sure that no required fields are missing. * * This is used internally before attempting a SendEmail or SendRawEmail request, * but it can be used outside of this file if verification is desired. * May be useful if e.g. the data is being populated from a form; developers can generally * use this function to verify completeness instead of writing custom logic. * * @return boolean */ public function validate() { // at least one destination is required if (count($this->to) == 0 && count($this->cc) == 0 && count($this->bcc) == 0) { return false; } // sender is required if ($this->from == null || strlen($this->from) == 0) { return false; } // subject is required if (($this->subject == null || strlen($this->subject) == 0)) { return false; } // message is required if ((empty($this->messagetext) || strlen((string) $this->messagetext) == 0) && (empty($this->messagehtml) || strlen((string) $this->messagehtml) == 0)) { return false; } return true; } } mailer/outlook/outlook.php 0000644 00000022316 15100073403 0011713 0 ustar 00 <?php /** * Class GOSMTP_Mailer_Outlook. * * @since 1.0.0 */ namespace GOSMTP\Mailer\Outlook; use GOSMTP\Mailer\Loader; class Outlook extends Loader{ var $title = 'Outlook'; var $mailer = 'outlook'; var $url = 'https://graph.microsoft.com/v1.0/me/sendMail'; public function send(){ global $phpmailer; $phpmailer->isMail(); $phpmailer->Encoding = 'base64'; if ($phpmailer->preSend()) { $response = $this->postSend(); return $this->handle_response( $response ); } return $this->handle_response(new \WP_Error(400, 'Unable to send mail for some reason!', [])); } public function postSend(){ global $phpmailer; try{ $access_token = $this->getAccessToken($this->getMailerOption()); if(is_wp_error($access_token)){ return $access_token->get_error_message(); } $mime = chunk_split(base64_encode($phpmailer->getSentMIMEMessage()), 76, "\n"); $params = array( 'method' => 'POST', 'headers' => [ 'Authorization' => 'Bearer '. $access_token, 'Content-Type' => 'text/plain' ], 'body' => $mime ); $response = wp_remote_request($this->url, $params); if(is_wp_error($response)){ $return_response = new \WP_Error($response->get_error_code(), $response->get_error_message(), $response->get_error_messages()); }else{ $resp_body = wp_remote_retrieve_body($response); $resp_code = wp_remote_retrieve_response_code($response); $resp_body = \json_decode($resp_body, true); if(202 == $resp_code){ $msgId = isset( $response['headers']['request-id'] ) ? $response['headers']['request-id'] : ''; $status = __('Email sent successfully'); $return_response = [ 'status' => true, 'code' => $resp_code, 'messageId' => $msgId, 'message' => $status ]; }else{ $err_code = $resp_code; $error_text = ['']; if(!empty( $resp_body['error']) && is_array($resp_body['error'])){ $message = $resp_body['error']['message']; $code = !empty( $resp_body['error']['code'] ) ? $resp_body['error']['code'] : ''; $desc = ''; if($code === 'ErrorAccessDenied'){ $desc = esc_html__( 'Note: This issue can also be caused by exceeding the total message size limit. If you are using large attachments, please remove the existing Outlook Mailer OAuth connection in WP Mail SMTP settings and reconnect it. We recently added support for large attachments, but oAuth re-connection is required.'); } $error_text[] = $this->message_formatting( $message, $code, $desc ); }else{ $error_text[] = $this->get_response_error_message($response); } $error_msg = implode( '\r\n', array_map( 'esc_textarea', array_filter( $error_text ) ) ); $return_response = new \WP_Error($err_code, $error_msg, $resp_body); } } }catch(\Exception $e){ $return_response = new \WP_Error(423, $e->getMessage(), []); } return $return_response; } public function getRedirectUrl($query = ''){ // TODO check and change this return admin_url().'admin.php?page=gosmtp'.$query; } private function getAccessToken($options){ $accessToken = $options['access_token']; // check if expired or will be expired in 300 seconds if( ($options['expire_stamp'] - 300) < time()){ $api = new \GOSMTP\mailer\outlook\Auth($options['client_id'], $options['client_secret']); $tokens = $api->sendTokenRequest('refresh_token', [ 'refresh_token' => $options['refresh_token'] ]); if(is_wp_error($tokens)) { return false; } $this->saveNewTokens($options, $tokens); $accessToken = $tokens['access_token']; } return $accessToken; } private function saveNewTokens($data, $tokens){ if (empty($tokens['access_token']) || empty($tokens['refresh_token'])) { return false; } $this->update_option('access_token', $tokens['access_token'], $this->mailer); $this->update_option('refresh_token', $tokens['refresh_token'], $this->mailer); $this->update_option('expire_stamp', $tokens['expires_in'] + time(), $this->mailer); } public function load_field(){ $this->outlook_init(); $client_id = $this->getOption('client_id', $this->mailer); $client_secret = $this->getOption('client_secret', $this->mailer); $access_token = $this->getOption('access_token', $this->mailer); $refresh_token = $this->getOption('refresh_token', $this->mailer); $mail_type = $this->getOption('mail_type', $this->mailer); $activate = !empty($client_id) && !empty($client_secret) && empty($access_token) && empty($refresh_token); $deactivate = !empty($refresh_token) && !empty($access_token) && $this->mailer == $mail_type; $readonly = $deactivate ? 'readonly' : ''; $state = ($this->conn_id === 0 ? '' : '-'.$this->conn_id); $api = new \GOSMTP\mailer\outlook\Auth($client_id, $client_secret, $state); $fields = array( 'client_id' => array( 'title' => __('Application Client ID'), 'type' => 'text', 'attr' => $readonly, ), 'client_secret' => array( 'title' => __('Application Client Secret'), 'type' => 'password', 'attr' => $readonly, 'desc' => __( 'Follow this link to get a Application Client Secret from Outlook: <a href="https://learn.microsoft.com/en-us/azure/industry/training-services/microsoft-community-training/frequently-asked-questions/generate-new-clientsecret-link-to-key-vault" target="_blank">Application Client Secret.</a>' ), ), 'redirect_uri' => array( 'title' => __('Outlook Callback URL'), 'type' => 'copy', 'id' => 'outlook_redirect_uri', 'attr'=>'readonly', 'default' => $api->getRedirectUrl(), 'desc' => __('Use this URL to your APP as Redirect URI.') ) ); if($activate){ $fields['get_access_token'] = array( 'title' => __('Get Access Token'), 'type' => 'button', 'class'=>'access_token', 'default' => __('Authenticate with outlook/Office365 & Get Access Token'), 'href' => $api->getAuthUrl(), 'attr' => 'data-field=auth', ); }elseif($deactivate){ $fields['get_access_token'] = array( 'title' => __('Deactivate Access Token'), 'type' => 'button', 'class'=>'deactivate_token', 'default' => 'Deactivate Access Token', 'href' => $this->getRedirectUrl().($this->conn_id !== 0 ? '&type=edit&conn_id='.$this->conn_id.'&act=deactivate_token#gosmtp-connections-settings' : '&act=deactivate_token'), 'attr' => 'data-field=auth', ); }else{ $fields['get_access_token'] = array( 'title' => __('Get Access Token'), 'type' => 'notice', 'default' => __('You need to save settings with Client ID and Client Secret before you can proceed.'), ); } return $fields; } // Generate access token and refresh token and update in data base. public function set_token(){ $errors = []; $options = $this->getMailerOption(); if(empty($options['access_token']) && !empty($options['auth_token'])){ $api = new \GOSMTP\mailer\outlook\Auth($options['client_id'], $options['client_secret']); $tokens = $api->generateToken($options['auth_token']); if(is_wp_error($tokens) || (is_array($tokens) && isset($tokens['error']))) { $err = is_wp_error($tokens) ? $tokens->get_error_message() : __('Mailer Authentication failed!'); return new \WP_Error(423, $err); } $this->saveNewTokens($options, $tokens); }elseif(!$authToken && !$accessToken){ return new \WP_Error(423, __('Please Provide Auth Token.', 'GOSMTP')); } return true; } public function outlook_init(){ $options = $this->getMailerOption(); // Update auth URl when user succesfull regirect our page if( empty($options['access_token']) && empty($options['refresh_token']) && isset( $_GET['auth_code'] ) && isset( $_GET['auth'] ) && $this->mailer == $_GET['auth'] && strlen($this->conn_id) > 0 ){ if( !empty(gosmtp_optget('conn_id')) && $this->conn_id === 0 ){ return; } $auth_code = gosmtp_optget('auth_code'); $this->update_option('auth_token', $auth_code, $this->mailer); $resp = ''; $set_token = $this->set_token(); if(is_wp_error($set_token)){ $resp = $set_token->get_error_message(); }else{ $resp = __('Mailer successfully configured!'); } $query = ''; if( !is_numeric($this->conn_id) ){ $query = '&type=edit&conn_id='.$this->conn_id.$query.'#gosmtp-connections-settings'; } echo '<script> alert("'.$resp.'"); var url = "'.$this->getRedirectUrl($query).'"; history.pushState({urlPath:url},"",url); </script>'; } // Delete all the tokens or expire stamp when user click deactivate access token if(isset($_GET['act']) && $_GET['act'] == 'deactivate_token'){ if(!empty(gosmtp_optget('conn_id')) && $this->conn_id === 0){ return; } $this->delete_option('refresh_token', $this->mailer); $this->delete_option('expire_stamp', $this->mailer); $this->delete_option('expires_in', $this->mailer); $this->delete_option('version', $this->mailer); $this->delete_option('access_token', $this->mailer); $query = ''; if(!is_numeric($this->conn_id)){ $query = '&type=edit&conn_id='.$this->conn_id.$query.'#gosmtp-connections-settings'; } if(isset($_GET['conn_id'])){ echo '<script> var url = "'.$this->getRedirectUrl($query).'"; history.pushState({urlPath:url},"",url); </script>'; } } } } mailer/outlook/auth.php 0000644 00000015056 15100073403 0011163 0 ustar 00 <?php namespace GOSMTP\mailer\outlook; class Auth{ private $clientId; private $clientSecret; private $options; private $state; private $accessTokenMethod = 'POST'; public function __construct($clientId = '', $clientSecret = '', $state = ''){ $this->clientId = $clientId; $this->clientSecret = $clientSecret; $this->state = $state; //$this->assertRequiredOptions($this->getConfig()); $this->options = $this->getConfig(); } public function getAuthUrl(){ return $this->getAuthorizationUrl(); } public function generateToken($authCode){ return $this->sendTokenRequest('authorization_code', [ 'code' => $authCode ]); } public function sendTokenRequest($type, $params){ try { $tokens = $this->getAccessToken($type, $params); return $tokens; } catch (\Exception $exception) { return new \WP_Error(423, $exception->getMessage()); } } public function getRedirectUrl(){ return rest_url('gosmtp-smtp/outlook_callback'); } private function getConfig(){ return array( 'clientId' => $this->clientId, 'clientSecret' => $this->clientSecret, 'redirectUri' => $this->getRedirectUrl(), 'urlAuthorize' => 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize', 'urlAccessToken' => 'https://login.microsoftonline.com/common/oauth2/v2.0/token', 'urlResourceOwnerDetails' => '', 'scopes' => 'offline_access user.read Mail.Send' ); } public function getAuthorizationUrl($options = []){ $base = $this->options['urlAuthorize']; $params = $this->getAuthorizationParameters($options); $query = $this->getAuthorizationQuery($params); return $this->appendQuery($base, $query); } private function getAuthorizationParameters($options){ if(empty($options['state'])){ $options['state'] = $this->getRandomState().$this->state; update_option('_gosmtp_last_generated_state', $options['state']); } if(empty($options['scope'])){ $options['scope'] = $this->options['scopes']; } $options += [ 'response_type' => 'code', 'approval_prompt' => 'auto' ]; if(is_array($options['scope'])){ $separator = ','; $options['scope'] = implode($separator, $options['scope']); } // Store the state as it may need to be accessed later on. $this->options['state'] = $options['state']; // Business code layer might set a different redirect_uri parameter // depending on the context, leave it as-is if(!isset($options['redirect_uri'])){ $options['redirect_uri'] = $this->options['redirectUri']; } $options['client_id'] = $this->options['clientId']; return $options; } /** * Appends a query string to a URL. * * @param string $url The URL to append the query to * @param string $query The HTTP query string * @return string The resulting URL */ protected function appendQuery($url, $query){ $query = trim($query, '?&'); if($query){ $glue = strstr($url, '?') === false ? '?' : '&'; return $url . $glue . $query; } return $url; } /** * Builds the authorization URL's query string. * * @param array $params Query parameters * @return string Query string */ protected function getAuthorizationQuery(array $params){ return $this->buildQueryString($params); } /** * Build a query string from an array. * * @param array $params * * @return string */ protected function buildQueryString(array $params){ return http_build_query($params, null, '&', \PHP_QUERY_RFC3986); } /** * Verifies that all required options have been passed. * * @param array $options * @return void * @throws \InvalidArgumentException */ private function assertRequiredOptions(array $options){ $missing = array_diff_key(array_flip($this->getRequiredOptions()), $options); if (!empty($missing)) { throw new \InvalidArgumentException( 'Required options not defined: ' . implode(', ', array_keys($missing)) ); } } /** * Returns all options that are required. * * @return array */ protected function getRequiredOptions(){ return [ 'urlAuthorize', 'urlAccessToken', 'urlResourceOwnerDetails', ]; } /** * Returns a new random string to use as the state parameter in an * authorization flow. * * @param int $length Length of the random string to be generated. * @return string */ protected function getRandomState($length = 32){ // Converting bytes to hex will always double length. Hence, we can reduce // the amount of bytes by half to produce the correct length. $state = bin2hex(random_bytes($length / 2)); update_option('_gosmtp_last_generated_state', $state); return $state; } /** * Requests an access token using a specified grant and option set. * * @param mixed $grant * @param array $options * @throws \Exception * @return array tokens */ public function getAccessToken($grant, array $options = []){ $params = [ 'client_id' => $this->options['clientId'], 'client_secret' => $this->options['clientSecret'], 'redirect_uri' => $this->options['redirectUri'], 'grant_type' => $grant, ]; $params += $options; $requestData = $this->getAccessTokenRequestDetails($params); $response = wp_remote_request($requestData['url'], $requestData['params']); if(is_wp_error($response)) { throw new \Exception( $response->get_error_message() ); } $responseBody = wp_remote_retrieve_body($response); if(false === is_array($response)){ throw new \Exception( 'Invalid response received from Authorization Server. Expected JSON.' ); } if(empty(['access_token'])){ throw new \Exception( 'Invalid response received from Authorization Server.' ); } return \json_decode($responseBody, true); } /** * Returns a prepared request for requesting an access token. * * @param array $params Query string parameters * @return array $requestDetails */ protected function getAccessTokenRequestDetails($params){ $method = $this->accessTokenMethod; $url = $this->getAccessTokenUrl($params); $options = $this->buildQueryString($params); return [ 'url' => $url, 'params' => [ 'method' => $method, 'body' => $options, 'headers' => [ 'content-type' => 'application/x-www-form-urlencoded' ] ] ]; } /** * Returns the full URL to use when requesting an access token. * * @param array $params Query parameters * @return string */ protected function getAccessTokenUrl($params){ $url = $this->options['urlAccessToken']; if($this->accessTokenMethod === 'GET'){ $query = $this->getAccessTokenQuery($params); return $this->appendQuery($url, $query); } return $url; } protected function getAccessTokenQuery(array $params){ return $this->buildQueryString($params); } } mailer/smtp2go.php 0000644 00000012517 15100073403 0010120 0 ustar 00 <?php /** * Class GOSMTP_Mailer_SMTP2Go. * * @since 1.0.0 */ namespace GoSMTP\Mailer; use GOSMTP\Mailer\Loader; class SMTP2Go extends Loader{ var $title = 'SMTP2Go'; var $mailer = 'smtp2go'; var $url = 'https://api.smtp2go.com/v3/email/send'; public function send(){ global $phpmailer; if($phpmailer->preSend()){ $response = $this->postSend(); return $this->handle_response($response); } return $this->handle_response(new \WP_Error(400, 'Unable to send mail for some reason!', [])); } protected function postSend(){ global $phpmailer; try{ $api_key = $this->getOption('api_key', $this->mailer); if(empty($api_key)){ return new \WP_Error(401, 'SMTP2Go API Key is missing.'); } // SMTP2Go requires subject to be passed $subject = $phpmailer->Subject; if(empty($subject)){ $subject = 'Mail sent from: '. site_url(); } $from = $phpmailer->From; $fromName = $phpmailer->FromName; // Prepare SMTP2Go v4 API JSON Payload $payload = [ 'sender' => $fromName. '<' .$from. '>', 'to' => $this->filterRecipientsArray($phpmailer->getToAddresses()), 'cc' => $this->filterRecipientsArray($phpmailer->getCcAddresses()), 'bcc' => $this->filterRecipientsArray($phpmailer->getBccAddresses()), 'subject' => $subject, 'text_body' => '', 'html_body' => '', 'attachments' => $this->getAttachments() ]; $body_text = $phpmailer->AltBody; $body_html = $phpmailer->Body; if(!empty($body_text)){ $payload['text_body'] = $body_text; } if(!empty($body_html)){ $payload['html_body'] = $body_html; } $params = [ 'method' => 'POST', 'headers' => $this->getRequestHeaders(), 'body' => wp_json_encode($payload) ]; $response = wp_safe_remote_request($this->url, $params); if(is_wp_error($response)){ return new \WP_Error($response->get_error_code(), $response->get_error_message(), $response->get_error_messages()); } else{ $resp_body = wp_remote_retrieve_body($response); $resp_code = wp_remote_retrieve_response_code($response); $resp_body = \json_decode($resp_body, true); if(200 === $resp_code){ $msgId = isset($resp_body['data']['email_id']) ? $resp_body['data']['email_id'] : ''; $status = 'Email sent successfully'; $return_response = [ 'status' => true, 'code' => $resp_code, 'messageId' => $msgId, 'message' => $status ]; } else{ $err_code = $resp_code; $error_text = ['']; if(!empty($resp_body['Error']) && is_array($resp_body['Error'])){ $message = $resp_body['Error']; $code = isset($resp_body['Code']) ? $resp_body['Code'] : ''; $error_text[] = $this->message_formatting($message, $code); } else{ $error_text[] = $this->get_response_error_message($response); } $error_msg = implode('\r\n', array_map('esc_textarea', array_filter($error_text))); $return_response = new \WP_Error($err_code, $error_msg, $resp_body); } } } catch(\Exception $e){ return new \WP_Error(423, $e->getMessage(), []); } return $return_response; } protected function getRequestHeaders(){ return [ 'X-Smtp2go-Api-Key' => $this->getOption('api_key', $this->mailer), 'Content-Type' => 'application/json', 'Accept' => 'application/json' ]; } protected function getAttachments(){ global $phpmailer; $attachments_raw = $phpmailer->getAttachments(); $attachments = []; if(!empty($attachments_raw)){ // Handles multiple filenames /*if(!is_array($attachments_raw)){ $attArray = explode(PHP_EOL, $attachments_raw); } else{ $attArray = $attachments_raw; }*/ foreach($attachments_raw as $attachment){ $file_path = $attachment[0]; if(file_exists($file_path) && is_file($file_path) && is_readable($file_path)){ $file_content = file_get_contents($file_path); if(empty($file_content)){ continue; } $attachments[] = [ 'filename' => basename($file_path), 'mimetype' => $this->determineMimeContentType($file_path), 'fileblob' => base64_encode($file_content) ]; } } } return $attachments; } protected function filterRecipientsArray($args){ $recipients = []; foreach($args as $key => $recip){ $recip = array_filter($recip); if(empty($recip) || ! filter_var($recip[0], FILTER_VALIDATE_EMAIL)){ continue; } $recipients[] = $recip[0]; } return $recipients; } protected function determineMimeContentType($filename){ if(function_exists('mime_content_type')){ return mime_content_type($filename); } elseif(function_exists('finfo_open')){ $finfo = finfo_open(FILEINFO_MIME_TYPE); $mime_type = finfo_file($finfo, $filename); finfo_close($finfo); return $mime_type; } return 'application/octet-stream'; } public function load_field(){ $options = $this->getMailerOption(); $fields = [ 'api_key' => [ 'title' => __('API Key', 'gosmtp-pro'), 'type' => 'password', 'desc' => __('Follow this link to get an API Key from SMTP2Go: <a href="https://app-us.smtp2go.com/sending/apikeys/" target="_blank">Get API Key.</a>', 'gosmtp-pro'), ] ]; return $fields; } } mailer/gmail/auth.php 0000644 00000013040 15100073403 0010547 0 ustar 00 <?php namespace GOSMTP\mailer\gmail; class Auth{ private $client_id; private $client_secret; private $redirect_uri; private $state; private $options; private $accessTokenMethod = 'POST'; public function __construct($client_id = '', $client_secret = '', $redirect_uri = '', $state = ''){ $this->client_id = $client_id; $this->client_secret = $client_secret; $this->redirect_uri = $redirect_uri; $this->state = $state; $this->options = $this->getConfig(); } private function getConfig(){ return array( 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => $this->redirect_uri, 'urlAuthorize' => 'https://accounts.google.com/o/oauth2/auth', 'urlAccessToken' => 'https://www.googleapis.com/oauth2/v4/token', 'urlResourceOwnerDetails' => '', 'scopes' => 'https://www.googleapis.com/auth/gmail.compose', 'access_type' => 'offline', 'include_granted_scopes' => 'true', 'approval_prompt' => 'force', 'state' => $this->state, ); } public function setClientId($client_id){ $this->client_id= $client_id; return true; } public function setClientSecret($client_secret){ $this->client_secret = $client_secret; return true; } public function add_scope($scope){ if(is_array($scope)){ $separator = ','; $this->options['scope'] = implode($separator, $scope); return true; } $this->options['scope'] = $scope; return true; } public function set_access_type($access_type){ $this->options['access_type'] = $access_type; return true; } public function set_approval_prompt($approval_prompt){ $this->options['approval_prompt'] = $approval_prompt; return true; } public function getAuthUrl(){ return $this->getAuthorizationUrl(); } public function getAuthorizationUrl($options = []){ $base = $this->options['urlAuthorize']; $params = $this->getAuthorizationParameters($options); $query = http_build_query($params, null, '&', \PHP_QUERY_RFC3986); return $this->appendQuery($base, $query); } private function getAuthorizationParameters($options){ if(empty($options['scope'])){ $options['scope'] = $this->options['scopes']; } $options += [ 'access_type' => $this->options['access_type'], 'include_granted_scopes' => $this->options['include_granted_scopes'], 'response_type' => 'code', 'state' => $this->getRandomState().$this->options['state'], 'approval_prompt' => $this->options['approval_prompt'], ]; if(is_array($options['scope'])){ $separator = ','; $options['scope'] = implode($separator, $options['scope']); } // Store the state as it may need to be accessed later on. $this->options['state'] = $options['state']; // Business code layer might set a different redirect_uri parameter // depending on the context, leave it as-is if(!isset($options['redirect_uri'])){ $options['redirect_uri'] = $this->options['redirect_uri']; } $options['client_id'] = $this->options['client_id']; return $options; } protected function getRandomState($length = 32){ // Converting bytes to hex will always double length. Hence, we can reduce // the amount of bytes by half to produce the correct length. $state = bin2hex(random_bytes($length / 2)); update_option('_gosmtp_last_generated_state', $state); return $state; } protected function appendQuery($url, $query){ $query = trim($query, '?&'); if($query){ $glue = strstr($url, '?') === false ? '?' : '&'; return $url . $glue . $query; } return $url; } public function sendTokenRequest($type, $params){ try { $tokens = $this->getAccessToken($type, $params); return $tokens; } catch (\Exception $exception) { return new \WP_Error(423, $exception->getMessage()); } } /** * Requests an access token using a specified grant and option set. * * @param mixed $grant * @param array $options * @throws \Exception * @return array tokens */ public function getAccessToken($grant, array $options = []){ $params = [ 'client_id' => $this->options['client_id'], 'client_secret' => $this->options['client_secret'], 'redirect_uri' => $this->options['redirect_uri'], 'grant_type' => $grant, ]; $params += $options; $requestData = $this->getAccessTokenRequestDetails($params); $response = wp_remote_request($requestData['url'], $requestData['params']); if(is_wp_error($response)) { throw new \Exception( $response->get_error_message() ); return $response; } $responseBody = wp_remote_retrieve_body($response); if(false === is_array($response)){ throw new \Exception( 'Invalid response received from Authorization Server. Expected JSON.' ); } if(empty(['access_token'])){ throw new \Exception( 'Invalid response received from Authorization Server.' ); } return \json_decode($responseBody, true); } /** * Returns a prepared request for requesting an access token. * * @param array $params Query string parameters * @return array $requestDetails */ protected function getAccessTokenRequestDetails($params){ $method = $this->accessTokenMethod; $url = $this->options['urlAccessToken']; $options = http_build_query($params, null, '&', \PHP_QUERY_RFC3986); return [ 'url' => $url, 'params' => [ 'method' => $method, 'body' => $options, 'headers' => [ 'content-type' => 'application/x-www-form-urlencoded' ] ] ]; } } mailer/gmail/gmail.php 0000644 00000025746 15100073403 0010717 0 ustar 00 <?php /** * Class GOSMTP_Mailer_Gmail. * * @since 1.0.0 */ namespace GOSMTP\Mailer\Gmail; use GOSMTP\Mailer\Loader; class Gmail extends Loader{ var $title = 'Gmail'; var $mailer = 'gmail'; var $isOk = 200; var $url = 'https://gmail.googleapis.com/gmail/v1/users/me/messages/send'; public function getRedirectUrl($query = ''){ // TODO check and change this return admin_url().'admin.php?page=gosmtp'.$query; } public function send(){ global $phpmailer; if($phpmailer->preSend()){ $response = $this->postSend(); return $this->handle_response( $response ); } return $this->handle_response(new \WP_Error(400, 'Unable to send mail for some reason!', [])); } protected function postSend(){ global $phpmailer; try{ $access_token = $this->getAccessToken($this->getMailerOption()); if(is_wp_error($access_token)){ return $access_token->get_error_message(); } $mime = base64_encode($phpmailer->getSentMIMEMessage()); $body = array( "raw" =>$mime, ); $params = array( 'method' => 'POST', 'headers' => [ 'Authorization' => 'Bearer '. $access_token, 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], 'body' => wp_json_encode($body) ); $response = wp_remote_request($this->url, $params); if(is_wp_error($response)){ $return_response = new \WP_Error($response->get_error_code(), $response->get_error_message(), $response->get_error_messages()); }else{ $resp_body = wp_remote_retrieve_body($response); $resp_code = wp_remote_retrieve_response_code($response); $resp_body = \json_decode($resp_body, true); if($this->isOk == $resp_code){ $msgId = isset( $resp_body['id'] ) ? $resp_body['id'] : ''; $status = 'Email sent successfully'; $return_response = [ 'status' => true, 'code' => $resp_code, 'messageId' => $msgId, 'message' => $status ]; }else{ $err_code = $resp_code; $error_text = ['']; if( ! empty( $resp_body['error'] ) && is_array( $resp_body['error'] ) ){ $message = $resp_body['error']['message']; $code = !empty( $resp_body['error']['code'] ) ? $resp_body['error']['code'] : ''; $error_text[] = $this->message_formatting( $message, $code ); }else{ $error_text[] = $this->get_response_error_message($response); } $error_msg = implode( '\r\n', array_map( 'esc_textarea', array_filter( $error_text ) ) ); $return_response = new \WP_Error($err_code, $error_msg, $resp_body); } } }catch(\Exception $e){ $return_Response = new \WP_Error(423, $e->getMessage(), []); } return $return_response; } // get access token private function getAccessToken($options){ $accessToken = $options['access_token']; // check if expired or will be expired in 300 seconds if( ($options['expire_stamp'] - 300) < time()){ $state = ($this->conn_id === 0 ? '' : '-'.$this->conn_id); $client_id = $this->getOption('client_id', $this->mailer); $client_secret = $this->getOption('client_secret', $this->mailer); $redirect_url = $this->getRedirectUrl('&auth=gmail'); $google_client = new \GOSMTP\mailer\gmail\Auth($client_id, $client_secret, $redirect_url, $state); $tokens = $google_client->sendTokenRequest('refresh_token', [ 'refresh_token' => $options['refresh_token'] ]); if(is_wp_error($tokens)) { return $tokens->get_error_message(); } $this->saveNewTokens($tokens); $accessToken = $tokens['access_token']; } return $accessToken; } //save new token when expire time exeed private function saveNewTokens($tokens){ $tokens['refresh_token'] = empty($tokens['refresh_token']) ? $this->getOption('refresh_token', $this->mailer) : $tokens['refresh_token']; if(empty($tokens['access_token']) || empty($tokens['refresh_token'])){ return false; } $this->update_option('access_token', $tokens['access_token'], $this->mailer); $this->update_option('refresh_token', $tokens['refresh_token'], $this->mailer); $this->update_option('expire_stamp', $tokens['expires_in'] + time(), $this->mailer); $this->update_option('expires_in', $tokens['expires_in'], $this->mailer); return true; } //generate access token and refresh token and update in data base. public function set_token(){ $errors = []; $clientId = $this->getOption('client_id', $this->mailer); $clientSecret = $this->getOption('client_secret', $this->mailer); $accessToken = $this->getOption('access_token', $this->mailer); $authToken = $this->getOption('auth_token', $this->mailer); if(!$accessToken && $authToken ){ $body = [ 'code' => $authToken, 'grant_type' => 'authorization_code', 'redirect_uri' => $this->getRedirectUrl('&auth=gmail'), 'client_id' => $clientId, 'client_secret' => $clientSecret ]; $tokens = $this->makeRequest('https://accounts.google.com/o/oauth2/token', $body, 'POST'); if(is_wp_error($tokens)){ return new \WP_Error(423, $tokens->get_error_message()); }else{ $this->update_option('access_token', $tokens['access_token'], $this->mailer); $this->update_option('refresh_token', $tokens['refresh_token'], $this->mailer); $this->update_option('auth_token', '', $this->mailer); $this->update_option('expire_stamp', time() + $tokens['expires_in'], $this->mailer); $this->update_option('expires_in', $tokens['expires_in'], $this->mailer); $this->update_option('version', 2, $this->mailer); } }elseif(!$authToken && !$accessToken){ return new \WP_Error(423, __('Please Provide Auth Token.', 'GOSMTP')); } return true; } private function makeRequest($url, $bodyArgs, $type = 'GET', $headers = false){ if(!$headers){ $headers = array( 'Content-Type' => 'application/http', 'Content-Transfer-Encoding' => 'binary', 'MIME-Version' => '1.0', ); } $args = array( 'headers' => $headers ); if($bodyArgs){ $args['body'] = json_encode($bodyArgs); } $args['method'] = $type; $request = wp_remote_request($url, $args); if(is_wp_error($request)){ $message = $request->get_error_message(); return new \WP_Error(423, $message); } $body = json_decode(wp_remote_retrieve_body($request), true); if(!empty($body['error'])){ $error = 'Unknown Error'; if(isset($body['error_description'])){ $error = $body['error_description']; }elseif(!empty($body['error']['message'])){ $error = $body['error']['message']; } return new \WP_Error(423, $error); } return $body; } public function get_auth_url() { $state = ($this->conn_id === 0 ? '' : '-'.$this->conn_id); $client_id = $this->getOption('client_id', $this->mailer); $client_secret = $this->getOption('client_secret', $this->mailer); $redirect_url = $this->getRedirectUrl('&auth=gmail'); $google_client = new \GOSMTP\mailer\gmail\Auth($client_id, $client_secret, $redirect_url, $state); if($google_client->getAuthUrl()){ return $google_client->getAuthUrl(); } } public function load_field(){ $this->gmail_init(); $access_token = $this->getOption('access_token', $this->mailer); $client_id = $this->getOption('client_id', $this->mailer); $client_secret = $this->getOption('client_secret', $this->mailer); $refresh_token = $this->getOption('refresh_token', $this->mailer); $mail_type = $this->getOption('mail_type', $this->mailer); $deactivate = !empty($refresh_token) && !empty($access_token) && $this->mailer == $mail_type; $activate = !empty($client_id) && !empty($client_secret) && empty($access_token) && empty($refresh_token); $readonly = $deactivate ? 'readonly' : ''; $fields = array( 'client_id' => array( 'title' => __('Client ID'), 'type' => 'text', 'desc' => '', 'attr'=> $readonly, ), 'client_secret' => array( 'title' => __('Client Secret'), 'type' => 'password', 'desc' => '', 'attr'=> $readonly, ), 'authorized_redirect_uri' => array( 'title' => __('Authorized redirect URI'), 'type' => 'copy', 'id' => 'gmail_redirect_uri', 'attr'=>'readonly', 'default' => $this->getRedirectUrl('&auth=gmail'), 'desc' => __('Please copy this URL into the "Authorized redirect URIs" field of your Google web application.') ), ); if($activate){ $fields['get_acces_token'] = array( 'title' => __('Get Access Token'), 'type' => 'button', 'class'=>'access_token', 'default' => 'Get Access Token', 'href' => $this->get_auth_url(), 'attr' => 'data-field=auth', ); }elseif($deactivate){ $fields['get_acces_token'] = array( 'title' => __('Deactivate Access Token'), 'type' => 'button', 'class'=>'deactivate_token', 'default' => 'Deactivate Access Token', 'href' => $this->getRedirectUrl().($this->conn_id !== 0 ? '&type=edit&conn_id='.$this->conn_id.'&act=deactivate_token#gosmtp-connections-settings' : '&act=deactivate_token'), 'attr' => 'data-field=auth', ); }else{ $fields['get_acces_token'] = array( 'title' => __('Get Access Token'), 'type' => 'notice', 'default' => __('You need to save settings with Client ID and Client Secret before you can proceed.'), ); } return $fields; } public function gmail_init(){ $options = $this->getMailerOption(); // Update auth URl when user succesfull regirect our page if( empty($options['access_token']) && empty($options['refresh_token']) && isset( $_GET['auth_code'] ) && isset( $_GET['auth'] ) && $this->mailer == $_GET['auth'] && strlen($this->conn_id) > 0 ){ if( !empty(gosmtp_optget('conn_id')) && $this->conn_id === 0 ){ return; } $auth_code = gosmtp_optget('auth_code'); $this->update_option('auth_token', $auth_code, $this->mailer); $resp = ''; if($this->set_token()){ $resp = __('Token Updated Sucessfully'); }elseif(is_wp_error($this->set_token())){ $resp = $this->set_token()->get_error_message(); }; $query = ''; if( !is_numeric($this->conn_id) ){ $query = '&type=edit&conn_id='.$this->conn_id.$query.'#gosmtp-connections-settings'; } echo '<script> alert("'.$resp.'"); var url = "'.$this->getRedirectUrl($query).'"; history.pushState({urlPath:url},"",url); </script>'; } // Delete all the tokens or expire stamp when user click deactivate access token if(isset($_GET['act']) && $_GET['act'] == 'deactivate_token'){ if(!empty(gosmtp_optget('conn_id')) && $this->conn_id === 0){ return; } $this->delete_option('refresh_token', $this->mailer); $this->delete_option('expire_stamp', $this->mailer); $this->delete_option('expires_in', $this->mailer); $this->delete_option('version', $this->mailer); $this->delete_option('access_token', $this->mailer); $query = ''; if(!is_numeric($this->conn_id)){ $query = '&type=edit&conn_id='.$this->conn_id.$query.'#gosmtp-connections-settings'; } if(isset($_GET['conn_id'])){ echo '<script> var url = "'.$this->getRedirectUrl($query).'"; history.pushState({urlPath:url},"",url); </script>'; } } } } mailer/zoho.php 0000644 00000037122 15100073403 0007503 0 ustar 00 <?php /** * TODO: need to cleen code and properer arrange * Class GOSMTP_Mailer_Zoho. * * @since 1.0.0 */ namespace GOSMTP\Mailer; use GOSMTP\Mailer\Loader; class Zoho extends Loader{ var $title = 'Zoho'; var $mailer = 'zoho'; var $scope = 'VirtualOffice.messages.CREATE,VirtualOffice.accounts.READ'; var $send_code = 200; var $api_url = ''; var $oauth_url = ''; var $body = []; var $lang = []; private $allowed_exts = array('xlsx', 'xls', 'ods', 'docx', 'docm', 'doc', 'csv', 'pdf', 'txt', 'gif', 'jpg', 'jpeg', 'png', 'tif', 'tiff', 'rtf', 'bmp', 'cgm', 'css', 'shtml', 'html', 'htm', 'zip', 'xml', 'ppt', 'pptx', 'tar', 'ez', 'ics', 'mobi', 'msg', 'pub', 'eps', 'odt', 'mp3', 'm4a', 'm4v', 'wma', 'ogg', 'flac', 'wav', 'aif', 'aifc', 'aiff', 'mp4', 'mov', 'avi', 'mkv', 'mpeg', 'mpg', 'wmv'); public function getLang($str = ''){ $this->lang = array( 'OK' => __('Mailer successfully configured!'), 'unauthorized_client' => __('OAuth Client is Invalid'), 'invalid_client' => __('Invalid Client ID (or) client Credentials did not match.'), 'invalid_code' => __('Code Expired (or) Invalid Refresh Token.'), 'invalid_redirect_uri' => __('Invalid Redirect Url configured'), 'invalid_client_secret' => __('Client Secret did not match.'), 'INVALID_TICKET' => __('Invalid Client Secret'), 'INVALID_OAUTHTOKEN' => __('Authtoken invalidated'), 'access_denied' => __('Multiple requests failed with same Refresh Token.'), 'general_error' => __('Something went wrong'), 'remote_token_error' => __('Error when getting the remote token.'), 'no_user' => __('No User present.'), 'token_limit_reached' => __('Refresh token limit reached.'), 'refresh_token_limit_reached' => __('The limit for refresh token reached.'), 'access_token_limit_reached' => __('The limit for access token reached.'), 'invalid_client_type' => __('Invalid client type'), 'invalid_authtoken' => __('Authtoken invalidated'), 'invalid_operation_type' => __('The scope has an invalid operation.'), 'URL_RULE_NOT_CONFIGURED' => __('Please configure zoho api.'), 'invalid_from' => __('Your zoho account does not match with the from mail.'), ); if(!isset($this->lang[$str])){ return $str; } return $this->lang[$str]; } public function getRedirectUrl($query = ''){ // TODO check and change this return admin_url().'admin.php?page=gosmtp'.$query; } public function send(){ global $phpmailer; $phpmailer->isMail(); $this->setConfig(); if($phpmailer->preSend()){ return $this->handle_response( $this->postSend() ); } return $this->handle_response(new \WP_Error(400, 'Unable to send mail for some reason!', [])); } public function setConfig(){ $domain_name = $this->getOption('domain_name', $this->mailer, 'com'); $this->api_url = 'https://mail.zoho.'.$domain_name.'/api/accounts'; $this->oauth_url = 'https://accounts.zoho.'.$domain_name.'/oauth/v2/'; } public function postSend(){ global $phpmailer; $options = $this->getMailerOption(); $options['access_token'] = $this->getAccessToken($options); $this->body['fromAddress'] = $phpmailer->FromName.'<'.$phpmailer->From.'>'; $this->body['subject'] = $phpmailer->Subject; $this->set_content($phpmailer->Body); $this->set_recipients( array( 'toAddress' => $phpmailer->getToAddresses(), 'ccAddress' => $phpmailer->getCcAddresses(), 'bccAddress' => $phpmailer->getBccAddresses(), 'replyTo' => $phpmailer->getReplyToAddresses() ) ); $attachments = $phpmailer->getAttachments(); if(!empty($attachments)){ $this->set_attachments($attachments); } $headers = [ 'Authorization' => 'Zoho-oauthtoken '.$options['access_token'], 'Content-Type' => 'application/json' ]; $params = array( 'headers' => $headers, 'body' => wp_json_encode($this->body) ); $accId = !empty($options['account_id']) ? $options['account_id'] : ''; $url = $this->api_url.'/'.$accId.'/messages'; // print_r(json_encode($this->body, JSON_PRETTY_PRINT)); $response = wp_safe_remote_post($url, $params); if(is_wp_error($response)){ $return_response = new \WP_Error($response->get_error_code(), $response->get_error_message(), $response->get_error_messages()); }else{ $resp_body = wp_remote_retrieve_body($response); $resp_code = wp_remote_retrieve_response_code($response); $isOk = $resp_code == $this->send_code; $resp_body = \json_decode($resp_body, true); if($isOk) { $msgId = isset( $resp_body['data']['messageId'] ) ? $resp_body['data']['messageId'] : ''; $status = isset($resp_body['status']['description']) ? $resp_body['status']['description'] : ''; $return_response = [ 'status' => true, 'code' => $resp_code, 'messageId' => $msgId, 'message' => $status ]; }else{ $msg = ($resp_code == 500 ) ? $resp_body['data']['moreInfo'] : $this->getLang($resp_body['data']['errorCode']); $return_response = new \WP_Error($resp_code, $msg , $resp_body); } } return $return_response; } public function set_content( $content ){ global $phpmailer; if( empty( $content ) ){ return; } if( is_array( $content ) ){ if( ! empty( $content['text'] ) ){ $this->body['mailFormat'] = 'plaintext'; } if( ! empty( $content['html'] ) ){ $this->body['mailFormat'] = 'html'; } $this->body['content'] = $content['text']; }else{ if( $phpmailer->ContentType === 'text/plain' ){ $this->body['mailFormat'] = 'plaintext'; }else{ $this->body['mailFormat'] = 'html'; } } $this->body['content'] = $content; } public function set_recipients( $recipients ) { global $phpmailer; if( empty( $recipients ) ){ return; } foreach( $recipients as $type => $emails ){ $tmp = ''; foreach( $emails as $key => $email ){ $tmp .= $type == 'replyTo' ? '<'.$email[0].'>' : ( empty($email[1]) ? $email[0] : $email[1].'<'.$email[0].'>' ); if( ( count($emails) - 1 ) != $key ){ $tmp .= ','; } } if(empty($tmp)){ continue; } $this->body[$type] = $tmp; } } public function set_attachments( $attachments = []){ $attachment_data = []; $count = 0; $ext = ''; foreach($attachments as $attachment){ if(!is_file($attachment[0]) || !is_readable($attachment[0])){ continue; } if(!empty($attachment[4])){ $ext = explode("/",$attachment[4])[1]; } $header = array( 'Authorization' => 'Zoho-oauthtoken '. $this->getOption('access_token', $this->mailer), 'Content-Type' => 'application/octet-stream' ); if(in_array($ext, $this->allowed_exts, true)){ $file_name = $attachment[2]; $content = file_get_contents($attachment[0]); $options = $this->getMailerOption(); $url = $this->api_url.'/'.$options['account_id'].'/messages/attachments'.'?fileName='.$file_name; $args = array( 'body' => $content, 'headers' => $header, 'method' => 'POST' ); $response = wp_remote_post($url, $args); $response_body = wp_remote_retrieve_body($response); $http_code = wp_remote_retrieve_response_code($response); $response_ = json_decode($response_body, true); if( isset($response_['data']['errorCode']) ){ $error = $response_['data']['errorCode']; } $attachments_ = array(); if($http_code == '200') { $attachments_['storeName'] = $response_['data']['storeName']; $attachments_['attachmentPath'] = $response_['data']['attachmentPath']; $attachments_['attachmentName'] = $response_['data']['attachmentName']; $attachment_data[$count] = $attachments_; $count = $count + 1; } } } if( count($attachment_data) > 0 ){ $this->body['attachments'] = $attachment_data; } } private function is_authorized(){ $options = $this->getMailerOption(); if(empty($options['refresh_token']) || empty($options['access_token']) || empty($options['account_id'])){ return false; } return true; } public function authentication_process(){ global $phpmailer; $options = $this->getMailerOption(); $response = $this->generate_tokens($options); if( !isset($response['access_token']) || !isset($response['refresh_token']) ){ return $response; } $access_token = $response['access_token']; $refresh_token = $response['refresh_token']; if( empty($options['account_id']) ){ $response = $this->zoho_account_id($access_token); if(!$response != true){ return $response; } } $this->delete_option('auth_code', $this->mailer); return 'OK'; } private function get_authcode_link($options){ $state = wp_create_nonce('redirect_url').($this->conn_id === 0 ? '' : '-'.$this->conn_id); $auth_url = $this->oauth_url ."auth?response_type=code&client_id=". $options['client_id'] ."&scope=". $this->scope ."&redirect_uri=".urlencode($this->getRedirectUrl('&auth=zoho'))."&prompt=consent&access_type=offline&state=". $state; return $auth_url; } public function generate_tokens($options){ $state = wp_create_nonce('redirect_url').($this->conn_id === 0 ? '' : '-'.$this->conn_id); $url = $this->oauth_url ."token?code=". $options['auth_code'] ."&client_id=". $options['client_id'] ."&client_secret=". $options['client_secret'] ."&redirect_uri=".urlencode($this->getRedirectUrl('&auth=zoho'))."&scope=".$this->scope."&grant_type=authorization_code&state=".$state; $response = wp_remote_retrieve_body(wp_remote_post( $url)); $response = json_decode($response, true); if(isset($response['error'])){ if($response['error'] == 'invalid_code'){ $this->delete_option('auth_code', $this->mailer); } return $response['error']; } $access_token = $response['access_token']; $refresh_token = $response['refresh_token']; $this->update_option('access_token', $access_token , $this->mailer); $this->update_option('refresh_token', $refresh_token, $this->mailer); return array( 'access_token' => $access_token, 'refresh_token' => $refresh_token ); } public function zoho_account_id($access_token = ''){ $from_email = $this->conn_id === 0 ? $this->getOption('from_email') : $this->getOption('from_email', $this->mailer,''); $accId = $this->getOption('account_id', $this->mailer, ''); if(!empty($accId)){ return; } $args = [ 'headers' => [ 'Authorization' => 'Zoho-oauthtoken '.$access_token ] ]; $response = wp_remote_retrieve_body(wp_remote_get( $this->api_url, $args)); $response = json_decode($response, true); if(empty($response)){ return 'general_error'; } if( isset($response['data']['errorCode']) ){ return $response['data']['errorCode']; } for($i=0; $i<count($response['data']); $i++){ for($j=0; $j<count($response['data'][$i]['sendMailDetails']); $j++) { if(strcmp($response['data'][$i]['sendMailDetails'][$j]['fromAddress'], $from_email) == 0){ $this->update_option('account_id', $response['data'][0]['accountId'], $this->mailer); }else{ return 'invalid_from'; } } } } public function getAccessToken( $options ){ $setup_time = $options['setup_timestamp']; $access_token = $options['access_token']; if(empty($setup_time) || time() - $setup_time > 3000){ $this->update_option('setup_timestamp', time(), $this->mailer); $url = $this->oauth_url.'token?refresh_token='.$options['refresh_token'].'&grant_type=refresh_token&client_id='.$options['client_id'].'&client_secret='.$options['client_secret'].'&redirect_uri='.urlencode($this->getRedirectUrl('&auth=zoho')).'&scope='.$this->scope; $response = wp_remote_retrieve_body( wp_remote_post( $url ) ); $response = json_decode($response); $access_token = $response->access_token; $this->update_option('access_token', $access_token, $this->mailer); } return $access_token; } public function load_field(){ $fields = array(); $options = $this->getMailerOption(); $client_id = $this->getOption('client_id', $this->mailer); $client_secret = $this->getOption('client_secret', $this->mailer); $opt_text = __('You need to save settings with Client ID and Client Secret before you can proceed.'); $opt_type = 'notice'; $opt_url = ''; $readonly = ''; $this->zoho_init(); $_button = ''; if(!empty($client_id) && !empty($client_secret) ){ $opt_type = $_button = 'button'; if(!$this->is_authorized()){ $opt_url = $this->get_authcode_link($options); $opt_text = __('Authorize Zoho Account'); }else{ $query = '&zoho-deactivate=1'; if(!is_numeric($this->conn_id)){ $query = '&type=edit&conn_id='.$this->conn_id.$query.'#gosmtp-connections-settings'; } $readonly = 'readonly=""'; $opt_url = $this->getRedirectUrl($query); $opt_text = 'Deactivate Access Token'; } } $fields = array( 'domain_name' => array( 'title' => __('Select domain name'), 'type' => 'select', 'list' => array( 'com' => '.com', 'eu' => '.eu', 'in' => '.in', 'com.cn' => '.com.cn', 'com.au' => '.com.au', 'jp' => '.jp', ), 'desc' => __( 'The name of the region the account is configured' ), ), 'client_id' => array( 'title' => __('Client Id'), 'type' => 'text', 'class'=>'zoho_client_id', 'desc' => __( 'Created in the developer console' ), 'attr' => $readonly ), 'client_secret' => array( 'title' => __('Client Secret'), 'type' => 'password', 'class'=>'zoho_client_secret', 'desc' => __( 'Created in the developer console' ), 'attr' => $readonly ), 'redirect_uri' => array( 'title' => __('Authorization Redirect URI'), 'type' => 'copy', 'id' => 'zoho_redirect_uri', 'attr' =>'readonly=""', 'default' => $this->getRedirectUrl('&auth=zoho'), 'desc' => __( 'Copy this URL into Redirect URI field of your Client Id creation' ), ), 'authorize' => array( 'title' => __('Authorize'), 'type' => $opt_type, 'default' => $opt_text, 'href' => $opt_url, 'class' => 'auth_class gosmtp-auto-width '.$_button, 'attr' => 'data-field=auth' ) ); return $fields; } public function zoho_deregister(){ if(!empty(gosmtp_optget('conn_id')) && $this->conn_id === 0){ return; } $this->delete_option('access_token', $this->mailer); $this->delete_option('refresh_token', $this->mailer); $this->delete_option('auth_code', $this->mailer); $this->delete_option('account_id', $this->mailer); $this->delete_option('setup_timestamp', $this->mailer); $query = ''; if(!is_numeric($this->conn_id)){ $query = '&type=edit&conn_id='.$this->conn_id.$query.'#gosmtp-connections-settings'; } if(isset($_GET['conn_id'])){ echo '<script> var url = "'.$this->getRedirectUrl($query).'"; history.pushState({urlPath:url},"",url); </script>'; } } public function zoho_init(){ $this->setConfig(); if(isset( $_GET['zoho-deactivate'] )){ $this->zoho_deregister(); return; } if( !$this->is_authorized() && isset( $_GET['auth_code'] ) && isset( $_GET['auth'] ) && $this->mailer == $_GET['auth'] && strlen($this->conn_id) > 0){ if( !empty(gosmtp_optget('conn_id')) && $this->conn_id === 0 ){ return; } // TODO sanitize $_GET['code'] $this->update_option('auth_code', gosmtp_optget('auth_code'), $this->mailer); $response = $this->authentication_process(); // var_dump($response); if( $response ){ $msg = is_array($this->getLang($response)) ? $this->getLang('general_error') : $this->getLang($response); } $query = ''; if(!is_numeric($this->conn_id)){ $query = '&type=edit&conn_id='.$this->conn_id.$query.'#gosmtp-connections-settings'; } echo '<script> alert("'.$msg.'") var url = "'.$this->getRedirectUrl($query).'"; history.pushState({urlPath:url},"",url); </script>'; } } } mailer/elasticemail.php 0000644 00000013545 15100073403 0011163 0 ustar 00 <?php /** * Class GOSMTP_Mailer_ElasticEmail. * * @since 1.0.0 */ namespace GOSMTP\Mailer; use GOSMTP\Mailer\Loader; class ElasticEmail extends Loader{ var $title = 'Elastic Email'; var $mailer = 'elasticemail'; var $url = 'https://api.elasticemail.com/v4/emails/transactional'; public function send(){ global $phpmailer; if($phpmailer->preSend()){ $response = $this->postSend(); return $this->handle_response($response); } return $this->handle_response(new \WP_Error(400, 'Unable to send mail for some reason!', [])); } protected function postSend(){ global $phpmailer; try{ $api_key = $this->getOption('api_key', $this->mailer); if(empty($api_key)){ return new \WP_Error(401, 'Elastic Email API Key is missing.'); } $subject = $phpmailer->Subject; $from = $phpmailer->From; $fromName = $phpmailer->FromName; // Prepare Elastic Email v4 API JSON Payload $payload = [ 'Recipients' => $this->getRecipients(), 'Content' => [ 'From' => $fromName. '<' .$from. '>', 'EnvelopeFrom' => $fromName. '<' .$from. '>', 'Subject' => $subject, 'Body' => [], 'Attachments' => $this->getAttachments() ] ]; if($replyTo = $this->filterRecipientsArray($phpmailer->getReplyToAddresses())){ $payload['Content']['ReplyTo'] = $replyTo[0]; } $body_content = $phpmailer->Body; if(!empty($body_content)){ $body = []; $body['Content'] = $body_content; $body['ContentType'] = 'HTML'; if(!empty($phpmailer->ContentType) && $phpmailer->ContentType == 'text/plain'){ $body['ContentType'] = 'PlainText'; } $payload['Content']['Body'][] = $body; } if(!empty($phpmailer->XMailer)){ $payload['Content']['Headers'] = ['X-Mailer' => $phpmailer->XMailer]; } $params = [ 'method' => 'POST', 'headers' => $this->getRequestHeaders(), 'body' => wp_json_encode($payload) ]; $response = wp_safe_remote_request($this->url, $params); if (is_wp_error($response)){ return new \WP_Error($response->get_error_code(), $response->get_error_message(), $response->get_error_messages()); } else{ $resp_body = wp_remote_retrieve_body($response); $resp_code = wp_remote_retrieve_response_code($response); $resp_body = \json_decode($resp_body, true); if(200 === $resp_code){ $msgId = isset($resp_body['MessageID']) ? $resp_body['MessageID'] : ''; $status = 'Email sent successfully'; $return_response = [ 'status' => true, 'code' => $resp_code, 'messageId' => $msgId, 'message' => $status ]; } else{ $err_code = $resp_code; $error_text = ['']; if(!empty($resp_body['Error']) && is_array($resp_body['Error'])){ $message = $resp_body['Error']; $code = isset($resp_body['Code']) ? $resp_body['Code'] : ''; $error_text[] = $this->message_formatting($message, $code); } else{ $error_text[] = $this->get_response_error_message($response); } $error_msg = implode('\r\n', array_map('esc_textarea', array_filter($error_text))); $return_response = new \WP_Error($err_code, $error_msg, $resp_body); } } } catch(\Exception $e){ return new \WP_Error(423, $e->getMessage(), []); } return $return_response; } protected function getRequestHeaders(){ return [ 'X-ElasticEmail-ApiKey' => $this->getOption('api_key', $this->mailer), 'Content-Type' => 'application/json', 'Accept' => 'application/json' ]; } protected function getAttachments(){ global $phpmailer; $attachments_raw = $phpmailer->getAttachments(); $attachments = []; if(!empty($attachments_raw)){ // Handles multiple filenames /*if(!is_array($attachments_raw)){ $attArray = explode(PHP_EOL, $attachments_raw); } else{ $attArray = $attachments_raw; }*/ foreach($attachments_raw as $attachment){ $file_path = $attachment[0]; if(file_exists($file_path) && is_file($file_path) && is_readable($file_path)){ $file_content = file_get_contents($file_path); if(empty($file_content)){ continue; } $attachments[] = [ 'BinaryContent' => base64_encode($file_content), 'Name' => basename($file_path), 'ContentType' => $this->determineMimeContentType($file_path), 'Size' => filesize($file_path) ]; } } } return $attachments; } public function getRecipients(){ global $phpmailer; $recipients = [ 'To' => $this->filterRecipientsArray($phpmailer->getToAddresses()), 'CC' => $this->filterRecipientsArray($phpmailer->getCcAddresses()), 'BCC' => $this->filterRecipientsArray($phpmailer->getBccAddresses()), ]; return $recipients; } protected function filterRecipientsArray($args){ $recipients = []; foreach($args as $key => $recip){ $recip = array_filter($recip); if(empty($recip) || ! filter_var($recip[0], FILTER_VALIDATE_EMAIL)){ continue; } $recipients[] = $recip[0]; } return $recipients; } protected function determineMimeContentType($filename){ if(function_exists('mime_content_type')){ return mime_content_type($filename); } elseif(function_exists('finfo_open')){ $finfo = finfo_open(FILEINFO_MIME_TYPE); $mime_type = finfo_file($finfo, $filename); finfo_close($finfo); return $mime_type; } return 'application/octet-stream'; } public function load_field(){ $options = $this->getMailerOption(); $fields = [ 'api_key' => [ 'title' => __('API Key', 'gosmtp-pro'), 'type' => 'password', 'desc' => __('Follow this link to get an API Key from Elastic Email: <a href="https://app.elasticemail.com/api/settings/create-api" target="_blank">Get API Key</a>', 'gosmtp-pro'), ] ]; return $fields; } } primarycategory.php 0000644 00000004701 15100371032 0010470 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class PrimaryCategory{ static function wc_primary_category($none_terms, $terms, $post){ $primary_cat = null; if(!empty($post)){ $wc_primary_cat = get_post_meta($post->ID, '_siteseo_robots_primary_cat', true); if(isset($wc_primary_cat) && '' != $wc_primary_cat && 'none' != $wc_primary_cat){ if(null != $post->post_type && 'product' == $post->post_type){ $primary_cat = get_term($wc_primary_cat, 'product_cat'); } if(!is_wp_error($primary_cat) && null != $primary_cat){ return $primary_cat; } } else{ return $none_terms; } } else{ return $none_terms; } } static function add_primary_category($none_cate, $cats, $post){ $primary_cat = null; if(!empty($post)){ $robots_primary_cat = get_post_meta($post->ID, '_siteseo_robots_primary_cat', true); if(isset($robots_primary_cat) && '' != $robots_primary_cat && 'none' != $robots_primary_cat){ if(null != $post->post_type && 'post' == $post->post_type){ $primary_cat = get_category($robots_primary_cat); } if(!is_wp_error($primary_cat) && null != $primary_cat){ return $primary_cat; } } else{ return $none_cate; } } else{ return $none_cate; } } static function replace_breadcrumb_categories($crumbs, $breadcrumb){ if(!is_product()){ return $crumbs; } global $post; $primary_cat_id = get_post_meta($post->ID, '_siteseo_robots_primary_cat', true); if($primary_cat_id && $primary_cat_id !== 'none'){ $primary_cat = get_term($primary_cat_id, 'product_cat'); if(!is_wp_error($primary_cat)){ $new_crumbs = []; foreach($crumbs as $key => $crumb){ if($key === 0 || (isset($crumb[1]) && strpos($crumb[1], '?post_type=product') !== false)){ $new_crumbs[] = $crumb; } } $ancestors = get_ancestors($primary_cat->term_id, 'product_cat'); $ancestors = array_reverse($ancestors); foreach($ancestors as $ancestor_id){ $ancestor = get_term($ancestor_id, 'product_cat'); $new_crumbs[] = [ $ancestor->name, get_term_link($ancestor) ]; } $new_crumbs[] = [ $primary_cat->name, get_term_link($primary_cat) ]; if(count($crumbs) > 0){ $new_crumbs[] = $crumbs[count($crumbs) - 1]; } return $new_crumbs; } } return $crumbs; } } tableofcontent.php 0000644 00000012407 15100371032 0010260 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } use DOMDocument; use DOMXPath; class TableofContent{ static function enable_toc(){ global $siteseo; if(empty($siteseo->setting_enabled['toggle-advanced']) || empty($siteseo->advanced_settings['toc_enable'])){ return; } add_filter('the_content', '\SiteSEO\TableofContent::add_ids_to_headings'); } static function render_toc(){ global $siteseo; if(empty($siteseo->setting_enabled['toggle-advanced']) || empty($siteseo->advanced_settings['toc_enable'])){ return; } static $siteseo_toc_run = false; if(!empty($siteseo_toc_run)){ return '<p style="padding: 1rem; background-color:#fff3cd; color:#664d03; border:1px solid #ffe69c; border-radius: 0.375rem">'.esc_html__('Table of content shortcode can be used only once on a page, this page is using the shortcode more than once. Please remove the extra table of content shortcodes for this warning to go away.', 'siteseo').'</p>'; } $options = get_option('siteseo_advanced_option_name'); //$options = $siteseo->advanced_settings; $content = get_the_content(); if(empty($content)){ return; } $heading_type = (!empty($options['toc_heading_type']) ? $options['toc_heading_type'] : 'ul'); $dom = new DOMDocument(); $internalErrors = libxml_use_internal_errors(true); $dom->preserveWhiteSpace = false; $html = ''; if($dom->loadHTML('<?xml encoding="utf-8" ?>' . $content)){ $xpath = new DOMXPath($dom); $heading_list = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']; $headings_to_scan = []; foreach($heading_list as $h){ if(!empty($options['toc_excluded_headings']) && is_array($options['toc_excluded_headings']) && in_array($h, $options['toc_excluded_headings'])){ continue; } $headings_to_scan[] = '//'.$h; } if(empty($headings_to_scan)){ return; } $headings_to_scan = implode('|', $headings_to_scan); // The imploded string will look like this //h1|//h2|//h3|//h4|//h5|//h6 $headings = $xpath->query($headings_to_scan); if(empty($headings)){ return; } $last_h = 0; $open_ul = 0; $html .= '<style>.siteseo-toc-wrapper { padding: 20px; border: 1px solid #a2a9b1; background-color: #f8f9fa;}.siteseo-toc-wrapper p { display:flex; align-items:center; gap: 10px; font-size: 1.5rem; font-weight: 500; margin: 0 0 10px 0;}.siteseo-toc-wrapper > '.esc_html($heading_type).' { margin: 0; padding: 0;}.siteseo-toc-wrapper p>label { font-weight: 400; font-size: 0.9rem;}#siteseo-toc-toggle~span { cursor: pointer;}#siteseo-toc-toggle:checked~.siteseo-toc-hide,p:has(#siteseo-toc-toggle:checked) ~ '.esc_html($heading_type).' { display: none;}#siteseo-toc-toggle:not(:checked) ~ .siteseo-toc-hide{ display: inline;}#siteseo-toc-toggle:not(:checked) ~ .siteseo-toc-show { display: none;}</style> <div class="siteseo-toc-wrapper"> <p>'.(!empty($options['toc_label']) ? esc_html($options['toc_label']) : esc_html__('Table of Content', 'siteseo')).' <label for="siteseo-toc-toggle"> <input type="checkbox" style="display:none;" id="siteseo-toc-toggle" name="siteseo-toc-toggle"/> [<span class="siteseo-toc-hide">hide</span><span class="siteseo-toc-show">show</span>]</label></p> <'.esc_html($heading_type).'>'; foreach($headings as $heading){ $title = trim(wp_strip_all_tags($heading->nodeValue)); $id = $heading->getAttribute('id'); $current_h = (int) substr($heading->tagName, 1); if(empty($id)){ $id = '#'.self::title_to_id($title); }else{ $id = '#'.$id; } if($current_h > $last_h){ $html .= '<'.esc_html($heading_type).'>'; $open_ul++; }else{ while($current_h <= $open_ul){ $html .= '</'.esc_html($heading_type).'>'; $open_ul--; } } $html .= '<li><a href="'.esc_attr($id).'">'.esc_html($title).'</a></li>'; $last_h = $current_h; } $html .= '</'.esc_html($heading_type).'></div>'; $siteseo_toc_run = true; } return $html; } // Converts heading text content to ID to be used as link static function title_to_id($title){ $id = trim(wp_strip_all_tags($title)); $id = remove_accents($title); $id = sanitize_title_with_dashes($id); $id = urlencode($id); return $id; } static function add_ids_to_headings($content){ if(empty($content)){ return $content; } // If the page does not have the shortcode then we don't need to update the id's in the heading. if(!has_shortcode($content, 'siteseo_toc')){ return $content; } $dom = new DOMDocument(); $internalErrors = libxml_use_internal_errors(true); $dom->preserveWhiteSpace = false; $html = ''; if($dom->loadHTML('<?xml encoding="utf-8" ?>' . $content)){ $xpath = new DOMXPath($dom); $headings = $xpath->query('//h1|//h2|//h3|//h4|//h5|//h6'); if(empty($headings)){ return; } foreach($headings as $heading){ $title = trim(wp_strip_all_tags($heading->nodeValue)); $id = $heading->getAttribute('id'); if(!empty($id)){ continue; } if(empty($title)){ continue; } $id = self::title_to_id($title); $heading->setAttribute('id', $id); } $content = $dom->saveHTML($dom->documentElement); } return $content; } } titlesmetas.php 0000644 00000072711 15100371032 0007613 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class TitlesMetas{ static function advanced_metas($robots){ global $siteseo, $post; $disable_noindex = !empty($siteseo->advanced_settings['appearance_adminbar_noindex']) ?? ''; if(empty($siteseo->setting_enabled['toggle-titles']) || !empty($disable_noindex)){ return $robots; } $settings = $siteseo->titles_settings; //all post types and taxonomies $post_types = siteseo_post_types(); $taxonomies = get_taxonomies(array('public' => true), 'objects'); $post_id = isset($post) && is_object($post) ? $post->ID : 0; $index_extras = [ 'max-snippet' => '-1', 'max-image-preview' => 'large', 'max-video-preview' => '-1' ]; $robots = [ 'noindex' => !empty($settings['titles_noindex']), 'nofollow' => !empty($settings['titles_nofollow']), 'nosnippet' => !empty($settings['titles_nosnippet']), 'noarchive' => !empty($settings['titles_noarchive']), 'noimageindex' => !empty($settings['titles_noimageindex']) ]; foreach($taxonomies as $taxonomy){ // taxonomies $term_id = 0; if(is_tax() || is_category() || is_tag()){ $queried_object = get_queried_object(); $term_id = $queried_object->term_id ?? 0; if($term_id){ $robots['noindex'] = !empty(get_term_meta($term_id, '_siteseo_robots_index', true)) || $robots['noindex']; $robots['nofollow'] = !empty(get_term_meta($term_id, '_siteseo_robots_follow', true)) || $robots['nofollow']; $robots['nosnippet'] = !empty(get_term_meta($term_id, '_siteseo_robots_snippet', true)) || $robots['nosnippet']; $robots['noarchive'] = !empty(get_term_meta($term_id, '_siteseo_robots_archive', true)) || $robots['noarchive']; $robots['noimageindex'] = !empty(get_term_meta($term_id, '_siteseo_robots_imageindex', true)) || $robots['noimageindex']; } if(!empty($settings['titles_tax_titles'][$taxonomy->name]['noindex'])){ if(isset($robots['index'])){ unset($robots['index']); } $robots['noindex'] = true; } if(!empty($settings['titles_tax_titles'][$taxonomy->name]['nofollow'])){ if(isset($robots['follow'])){ unset($robots['follow']); } $robots['nofollow'] = true; } if(!$robots['noindex']){ $robots['index'] = true; $robots = array_merge($robots, $index_extras); } if(!$robots['nofollow']){ $robots['follow'] = true; } return array_filter($robots); } } // single post types foreach($post_types as $post_type){ if($post_type->has_archive && is_post_type_archive($post_type->name)){ if(function_exists('is_shop') && is_shop()){ $post_id = wc_get_page_id('shop'); } if($post_id){ $robots['noindex'] = !empty(get_post_meta($post_id, '_siteseo_robots_index', true)) || $robots['noindex']; $robots['nofollow'] = !empty(get_post_meta($post_id, '_siteseo_robots_follow', true)) || $robots['nofollow']; $robots['nosnippet'] = !empty(get_post_meta($post_id, '_siteseo_robots_snippet', true)) || $robots['nosnippet']; $robots['noarchive'] = !empty(get_post_meta($post_id, '_siteseo_robots_archive', true)) || $robots['noarchive']; $robots['noimageindex'] = !empty(get_post_meta($post_id, '_siteseo_robots_imageindex', true)) || $robots['noimageindex']; } if(!empty($settings['titles_archive_titles'][$post_type->name]['archive_noindex'])){ if(isset($robots['index'])){ unset($robots['index']); } $robots['noindex'] = true; } if(!empty($settings['titles_archive_titles'][$post_type->name]['archive_nofollow'])){ if(isset($robots['follow'])){ unset($robots['follow']); } $robots['nofollow'] = true; } if(!$robots['noindex']){ $robots['index'] = true; $robots = array_merge($robots, $index_extras); } if(!$robots['nofollow']){ $robots['follow'] = true; } return array_filter($robots); } if(is_singular($post_type->name)){ if($post_id){ $robots['noindex'] = !empty(get_post_meta($post_id, '_siteseo_robots_index', true)) || $robots['noindex']; $robots['nofollow'] = !empty(get_post_meta($post_id, '_siteseo_robots_follow', true)) || $robots['nofollow']; $robots['nosnippet'] = !empty(get_post_meta($post_id, '_siteseo_robots_snippet', true)) || $robots['nosnippet']; $robots['noarchive'] = !empty(get_post_meta($post_id, '_siteseo_robots_archive', true)) || $robots['noarchive']; $robots['noimageindex'] = !empty(get_post_meta($post_id, '_siteseo_robots_imageindex', true)) || $robots['noimageindex']; } if(!empty($settings['titles_single_titles'][$post_type->name]['noindex'])){ if(isset($robots['index'])){ unset($robots['index']); } $robots['noindex'] = true; } if(!empty($settings['titles_single_titles'][$post_type->name]['nofollow'])){ if(isset($robots['follow'])){ unset($robots['follow']); } $robots['nofollow'] = true; } if(!$robots['noindex']){ $robots['index'] = true; $robots = array_merge($robots, $index_extras); } if(!$robots['nofollow']){ $robots['follow'] = true; } return array_filter($robots); } } //archive pages if(is_author()){ $robots['noindex'] = !empty($settings['titles_archives_author_noindex']); if(!$robots['noindex']){ $robots['index'] = true; $robots = array_merge($robots, $index_extras); } } if(is_date()){ $robots['noindex'] = !empty($settings['titles_archives_date_noindex']); if(!$robots['noindex']){ $robots['index'] = true; $robots = array_merge($robots, $index_extras); } } if(is_search()){ $robots['noindex'] = !empty($settings['titles_archives_search_title_noindex']); if(!$robots['noindex']){ $robots['index'] = true; $robots = array_merge($robots, $index_extras); } } // default home page if(is_front_page() && is_home()){ $robots = [ 'index' => true, 'follow' => true ]; if(!empty($settings['titles_noindex'])){ $robots['noindex'] = true; unset($robots['index']); } if(!empty($settings['titles_nofollow'])){ $robots['nofollow'] = true; unset($robots['follow']); } if(!empty($settings['titles_nosnippet'])){ $robots['nosnippet'] = true; } if(!empty($settings['titles_noarchive'])){ $robots['noarchive'] = true; } if(!empty($settings['titles_noimageindex'])){ $robots['noimageindex'] = true; } $robots = array_merge($robots, $index_extras); } // static set posts page if(is_home() && !is_front_page()){ $blog_page_id = get_option('page_for_posts'); $robots = [ 'index' => true, 'follow' => true ]; if($blog_page_id){ // Check blog page specific meta settings $robots['noindex'] = !empty(get_post_meta($blog_page_id, '_siteseo_robots_index', true)); $robots['nofollow'] = !empty(get_post_meta($blog_page_id, '_siteseo_robots_follow', true)); $robots['nosnippet'] = !empty(get_post_meta($blog_page_id, '_siteseo_robots_snippet', true)); $robots['noarchive'] = !empty(get_post_meta($blog_page_id, '_siteseo_robots_archive', true)); $robots['noimageindex'] = !empty(get_post_meta($blog_page_id, '_siteseo_robots_imageindex', true)); } // Apply global settings as fallback if(!empty($settings['titles_noindex'])){ $robots['noindex'] = true; } if(!empty($settings['titles_nofollow'])){ $robots['nofollow'] = true; } if(!empty($settings['titles_nosnippet'])){ $robots['nosnippet'] = true; } if(!empty($settings['titles_noarchive'])){ $robots['noarchive'] = true; } if(!empty($settings['titles_noimageindex'])){ $robots['noimageindex'] = true; } // Clean up conflicting directives if($robots['noindex']){ unset($robots['index']); } if($robots['nofollow']){ unset($robots['follow']); } if(!$robots['noindex']){ $robots = array_merge($robots, $index_extras); } } return array_filter($robots); } static function add_nositelinkssearchbox(){ global $siteseo; if(empty($siteseo->setting_enabled['toggle-titles'])){ return; } if(!empty($siteseo->titles_settings['titles_nositelinkssearchbox'])){ echo '<meta name="google" content="nositelinkssearchbox" >'; } } static function add_canonical_url(){ $post_types = siteseo_post_types(); foreach($post_types as $post_type){ if($post_type->has_archive && is_post_type_archive($post_type->name)){ $post_id = get_the_ID(); $archive_url = get_post_type_archive_link($post_type->name); $canonical_meta = get_post_meta($post_id, '_siteseo_robots_canonical', true); $canonical = !empty($canonical_meta) ? $canonical_meta : $archive_url; if($archive_url){ echo '<link rel="canonical" href="'.esc_url($archive_url).'" />' . "\n"; } } if(is_singular($post_type->name)){ $post_id = get_the_ID(); $canonical_meta = get_post_meta($post_id, '_siteseo_robots_canonical', true); $canonical = !empty($canonical_meta) ? $canonical_meta : urldecode(get_permalink($post_id)); if($canonical){ echo '<link rel="canonical" href="'.esc_url($canonical).'" />' . "\n"; } } } //taxonomies $taxonomies = get_taxonomies(array('public' => true), 'objects'); if(is_tag() || is_category() || is_tax()){ $term = get_queried_object(); if($term && isset($term->term_id, $term->taxonomy)){ $term_id = $term->term_id; $taxonomy_name = $term->taxonomy; $canonical_meta = get_term_meta($term_id, '_siteseo_robots_canonical', true); $canonical = !empty($canonical_meta) ? $canonical_meta : urldecode(get_term_link($term_id, $taxonomy_name)); if($canonical){ echo '<link rel="canonical" href="'.esc_url($canonical).'" />' . "\n"; } } } // default home page if(is_front_page() && is_home()){ $canonical = trailingslashit(home_url()); echo '<link rel="canonical" href="'.esc_url($canonical).'" />' . "\n"; } // if static posts set if(is_home() && !is_front_page()){ $blog_page_id = get_option('page_for_posts'); if($blog_page_id){ $canonical_meta = get_post_meta($blog_page_id, '_siteseo_robots_canonical', true); $canonical = !empty($canonical_meta) ? $canonical_meta : urldecode(get_permalink($blog_page_id)); if($canonical){ echo '<link rel="canonical" href="'.esc_url($canonical).'" />' . "\n"; } } else{ $canonical = trailingslashit(home_url()); echo '<link rel="canonical" href="'.esc_url($canonical).'" />' . "\n"; } } } static function replace_variables($content, $in_editor = false){ global $post, $siteseo, $wp_query, $term; // Site info $site_title = get_bloginfo('name'); $site_tagline = get_bloginfo('description'); $site_sep = $siteseo->titles_settings['titles_sep']; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $page = get_query_var('page') ? get_query_var('page') : 1; // Date info $current_time = current_time('timestamp'); $archive_date = get_the_date('d'); $archive_month = get_the_date('M'); $archive_month_name = get_the_date('F'); $archive_year = get_the_date('Y'); // Author $author_id = isset($post->post_author) ? $post->post_author : get_current_user_id(); $author_first_name = get_the_author_meta('first_name', $author_id); $author_last_name = get_the_author_meta('last_name', $author_id); $author_website = get_the_author_meta('url', $author_id); $author_nickname = get_the_author_meta('nickname', $author_id); $author_bio = get_the_author_meta('description', $author_id); // WooCommerce $wc_variables = []; if(function_exists('wc_get_product') && is_singular('product')){ $product = wc_get_product($post->ID); if($product){ $wc_variables = array( '%%wc_single_cat%%' => wp_strip_all_tags(wc_get_product_category_list($post->ID)), '%%wc_single_tag%%' => wp_strip_all_tags(wc_get_product_tag_list($post->ID)), '%%wc_single_short_desc%%' => $product->get_short_description(), '%%wc_single_price%%' => $product->get_price(), '%%wc_single_price_exe_tax%%' => wc_get_price_excluding_tax($product), '%%wc_sku%%' => $product->get_sku() ); } } $replacements = array( '%%sep%%' => $site_sep, '%%sitetitle%%' => $site_title, '%%tagline%%' => $site_tagline, '%%post_title%%' => (is_singular() || $in_editor === TRUE) ? get_the_title() : (is_home() ? get_the_title(get_option('page_for_posts')) : ''), '%%post_excerpt%%' => (is_singular() || $in_editor === TRUE) ? get_the_excerpt() : '', '%%post_content%%' => (is_singular() || $in_editor === TRUE) ? wp_strip_all_tags(get_the_content()) : '', '%%post_thumbnail_url%%' => get_the_post_thumbnail_url($post), '%%post_url%%' => urldecode(get_permalink()), '%%post_date%%' => get_the_date(), '%%post_modified_date%%' => get_the_modified_date(), '%%post_author%%' => get_the_author(), '%%post_category%%' => wp_strip_all_tags(get_the_category_list(', ')), '%%post_tag%%' => wp_strip_all_tags(get_the_tag_list('', ', ', '')), '%%_category_title%%' => single_cat_title('', false), '%%_category_description%%' => category_description(), '%%tag_title%%' => single_tag_title('', false), '%%tag_description%%' => tag_description(), '%%term_title%%' => single_term_title('', false), '%%term_description%%' => term_description(), '%%search_keywords%%' => get_search_query(), '%%current_pagination%%' => $paged, '%%page%%' => $page, '%%cpt_plural%%' => post_type_archive_title('', false), '%%archive_title%%' => get_the_archive_title(), '%%archive_date%%' => $archive_date, '%%archive_date_day%%' => $archive_date, '%%archive_date_month%%' => $archive_month, '%%archive_date_month_name%%' => $archive_month_name, '%%archive_date_year%%' => $archive_year, '%%currentday%%' => date_i18n('j', $current_time), '%%currentmonth%%' => date_i18n('F', $current_time), '%%currentmonth_short%%' => date_i18n('M', $current_time), '%%currentmonth_num%%' => date_i18n('n', $current_time), '%%currentyear%%' => date_i18n('Y', $current_time), '%%currentdate%%' => date_i18n(get_option('date_format'), $current_time), '%%currenttime%%' => date_i18n(get_option('time_format'), $current_time), '%%author_first_name%%' => $author_first_name, '%%author_last_name%%' => $author_last_name, '%%author_website%%' => $author_website, '%%author_nickname%%' => $author_nickname, '%%author_bio%%' => $author_bio, ); //WooCommerces if(!empty($wc_variables)){ $replacements = array_merge($replacements, $wc_variables); } if(preg_match_all('/%%_cf_(.*?)%%/', $content, $matches)){ foreach ($matches[1] as $custom_field) { $meta_value = get_post_meta($post->ID, $custom_field, true); $replacements["%%_cf_{$custom_field}%%"] = $meta_value; } } if(preg_match_all('/%%_ct_(.*?)%%/', $content, $matches)){ foreach($matches[1] as $taxonomy){ $terms = get_the_terms($post->ID, $taxonomy); $term_names = is_array($terms) ? wp_list_pluck($terms, 'name') : []; $replacements["%%_ct_{$taxonomy}%%"] = implode(', ', $term_names); } } if(preg_match_all('/%%_ucf_(.*?)%%/', $content, $matches)){ foreach($matches[1] as $user_meta){ $meta_value = get_user_meta($author_id, $user_meta, true); $replacements["%%_ucf_{$user_meta}%%"] = $meta_value; } } $target_keywords = isset($siteseo->keywords_settings['tempory_set']) ? $siteseo->keywords_settings['tempory_set'] : ''; $replacements['%%target_keyword%%'] = $target_keywords; $replacements = array_map(function($value){ if(is_array($value) || is_object($value)){ return ''; } return is_null($value) ? '' : wp_strip_all_tags($value); }, $replacements); return str_replace( array_keys($replacements), array_values($replacements), $content ); } static function modify_site_title($title, $sep = ''){ global $siteseo, $post; // Check enabled if(empty($siteseo->setting_enabled['toggle-titles'])){ return $title; } $settings = $siteseo->titles_settings; // post types and taxonomies $post_types = siteseo_post_types(); $taxonomies = get_taxonomies(array('public' => true), 'objects'); // Check set by meta $post_id = isset($post) && is_object($post) ? $post->ID : ''; $post_meta_title = !empty(get_post_meta($post_id, '_siteseo_titles_title', true)) ? get_post_meta($post_id, '_siteseo_titles_title', true) : ''; // default home page if(is_front_page() && is_home()){ if(!empty($settings['titles_home_site_title'])){ $new_title = $settings['titles_home_site_title']; } if(!empty($new_title)){ $new_title = esc_attr(self::replace_variables($new_title)); if(!empty($sep)){ $new_title .= " $sep " . get_bloginfo('name'); } return $new_title; } } // static posts pages if(is_home() && !is_front_page()){ $blog_page_id = get_option('page_for_posts'); if($blog_page_id){ $blog_meta_title = get_post_meta($blog_page_id, '_siteseo_titles_title', true); $default_title = !empty($settings['titles_single_titles']['page']['title']) ? $settings['titles_single_titles']['page']['title'] : ''; $new_title = !empty($blog_meta_title) ? $blog_meta_title : $default_title; if(!empty($new_title)){ $new_title = esc_attr(self::replace_variables($new_title)); if(!empty($sep)){ $new_title .= " $sep " . get_bloginfo('name'); } return $new_title; } } } // single post types foreach($post_types as $post_type){ if($post_type->has_archive && is_post_type_archive($post_type->name)){ $post_meta_title = ''; if(function_exists('is_shop') && is_shop()){ $shop_page_id = wc_get_page_id('shop'); $post_meta_title = get_post_meta($shop_page_id, '_siteseo_titles_title', true); } $default_title = isset($settings['titles_archive_titles'][$post_type->name]['archive_title']) ? $settings['titles_archive_titles'][$post_type->name]['archive_title'] : ''; $new_title = !empty($post_meta_title) ? $post_meta_title : $default_title; if(!empty($new_title)){ $new_title = esc_attr(self::replace_variables($new_title)); if(!empty($sep)){ $new_title .= " $sep " . get_bloginfo('name'); } return $new_title; } } if(is_singular($post_type->name)){ $default_title = isset($settings['titles_single_titles'][$post_type->name]['title']) ? $settings['titles_single_titles'][$post_type->name]['title'] : ''; $new_title = !empty($post_meta_title) ? $post_meta_title : $default_title; if(!empty($new_title)){ $new_title = esc_attr(self::replace_variables($new_title)); if(!empty($sep)){ $new_title .= " $sep " . get_bloginfo('name'); } return $new_title; } } } //taxonomies foreach($taxonomies as $taxonomy){ if(is_category()){ $term = get_queried_object(); $term_id = $term->term_id; $term_meta_title = get_term_meta($term_id, '_siteseo_titles_title', true); $default_title = isset($settings['titles_tax_titles']['category']['title']) ? $settings['titles_tax_titles']['category']['title'] : ''; $disabled = !empty($settings['titles_tax_titles']['category']['disabled']); $new_title = !empty($term_meta_title) ? $term_meta_title : $default_title; if(!empty($new_title) && !$disabled){ $new_title = esc_attr(self::replace_variables($new_title)); if(!empty($sep)){ $new_title .= " $sep " . get_bloginfo('name'); } return $new_title; } } elseif(is_tag()) { $term = get_queried_object(); $term_id = $term->term_id; $term_meta_title = get_term_meta($term_id, '_siteseo_titles_title', true); $default_title = isset($settings['titles_tax_titles']['post_tag']['title']) ? $settings['titles_tax_titles']['post_tag']['title'] : ''; $disabled = !empty($settings['titles_tax_titles']['post_tag']['disabled']); $new_title = !empty($term_meta_title) ? $term_meta_title : $default_title; if(!empty($new_title) && !$disabled){ $new_title = esc_attr(self::replace_variables($new_title)); if(!empty($sep)){ $new_title .= " $sep " . get_bloginfo('name'); } return $new_title; } } elseif(is_tax($taxonomy->name)) { $term = get_queried_object(); $term_id = $term->term_id; $term_meta_title = get_term_meta($term_id, '_siteseo_titles_title', true); $default_title = isset($settings['titles_tax_titles'][$taxonomy->name]['title']) ? $settings['titles_tax_titles'][$taxonomy->name]['title'] : ''; $disabled = !empty($settings['titles_tax_titles'][$taxonomy->name]['disabled']); $new_title = !empty($term_meta_title) ? $term_meta_title : $default_title; if(!empty($new_title) && !$disabled){ $new_title = esc_attr(self::replace_variables($new_title)); if(!empty($sep)){ $new_title .= " $sep " . get_bloginfo('name'); } return $new_title; } } } // author archive if(is_author() && !empty($settings['titles_archives_author_title']) && empty($settings['titles_archives_author_disable'])) { $new_title = esc_attr(self::replace_variables($settings['titles_archives_author_title'])); if(!empty($sep)){ $new_title .= " $sep " . get_bloginfo('name'); } return $new_title; } //Date archive if(is_date() && !empty($settings['titles_archives_date_title']) && empty($settings['titles_archives_date_disable'])){ $new_title = esc_attr(self::replace_variables($settings['titles_archives_date_title'])); if(!empty($sep)){ $new_title .= " $sep " . get_bloginfo('name'); } return $new_title; } // Search archive if(is_search() && !empty($settings['titles_archives_search_title'])){ $new_title = esc_attr(self::replace_variables($settings['titles_archives_search_title'])); if(!empty($sep)){ $new_title .= " $sep " . get_bloginfo('name'); } return $new_title; } // 404 archive if(is_404() && !empty($settings['titles_archives_404_title'])){ $new_title = esc_attr(self::replace_variables($settings['titles_archives_404_title'])); if(!empty($sep)){ $new_title .= " $sep " . get_bloginfo('name'); } return $new_title; } return $title; } static function add_meta_description(){ global $siteseo, $post; if(empty($siteseo->setting_enabled['toggle-titles'])){ return; } $settings = $siteseo->titles_settings; // Get all registered post types $post_types = siteseo_post_types(); $taxonomies = get_taxonomies(array('public' => true), 'objects'); $post_id = isset($post) && is_object($post) ? $post->ID : ''; // default home page if(is_front_page() && is_home()){ if(!empty($settings['titles_home_site_desc'])){ $processed_desc = self::replace_variables($settings['titles_home_site_desc']); echo '<meta name="description" content="' . esc_attr(self::truncate_desc($processed_desc)) . '">'; } else{ $description = get_bloginfo('description'); if(!empty($description)){ echo '<meta name="description" content="' . esc_attr($description) . '">'; } } } // if set static posts page if(is_home() && !is_front_page()){ $blog_page_id = get_option('page_for_posts'); if($blog_page_id){ $meta_desc = get_post_meta($blog_page_id, '_siteseo_titles_desc', true); if(!empty($meta_desc)){ $processed_desc = esc_attr(self::replace_variables($meta_desc)); echo '<meta name="description" content="' . esc_attr(self::truncate_desc($processed_desc)) . '">'; } elseif(!empty($settings['titles_single_titles']['page']['description'])){ $processed_desc = self::replace_variables($settings['titles_single_titles']['page']['description']); echo '<meta name="description" content="' . esc_attr(self::truncate_desc($processed_desc)) . '">'; } else{ $description = get_bloginfo('description'); if(!empty($description)){ echo '<meta name="description" content="' . esc_attr(self::truncate_desc($description)) . '">'; } } } } // single post types foreach($post_types as $post_type){ if($post_type->has_archive && is_post_type_archive($post_type->name)){ $archive_desc = ''; if(is_post_type_archive()){ $obj = get_queried_object(); if(!empty($obj) && isset($obj->name)){ $archive_desc = !empty($obj->description) ? $obj->description : ''; } } $meta_desc = ''; if(function_exists('is_shop') && is_shop()){ $shop_page_id = wc_get_page_id('shop'); $meta_desc = get_post_meta($shop_page_id, '_siteseo_titles_desc', true); } $description = !empty($settings['titles_archive_titles'][$post_type->name]['archive_desc']) ? $settings['titles_archive_titles'][$post_type->name]['archive_desc'] : $archive_desc; $description = !empty($meta_desc) ? $meta_desc : $description; if(!empty($description)){ $description = self::replace_variables($description); echo '<meta name="description" content="' . esc_attr(self::truncate_desc($description)) . '">'; } } if(is_singular($post_type->name)){ $meta_desc = get_post_meta($post_id, '_siteseo_titles_desc', true); $default_desc = isset($settings['titles_single_titles'][$post_type->name]['description']) ? $settings['titles_single_titles'][$post_type->name]['description'] : ''; $description = !empty($meta_desc) ? $meta_desc : $default_desc; if(!empty($description)){ $description = self::replace_variables($description); echo '<meta name="description" content="' . esc_attr(self::truncate_desc($description)) . '">'; } } } if(is_category() || is_tag() || is_tax()){ $term = get_queried_object(); if($term){ $term_id = $term->term_id; $term_meta_desc = get_term_meta($term_id, '_siteseo_titles_desc', true); $default_desc = ''; $taxonomy_name = ''; if(is_category()){ $default_desc = isset($settings['titles_tax_titles']['category']['description']) ? $settings['titles_tax_titles']['category']['description'] : ''; $taxonomy_name = 'category'; } elseif(is_tag()){ $default_desc = isset($settings['titles_tax_titles']['post_tag']['description']) ? $settings['titles_tax_titles']['post_tag']['description'] : ''; $taxonomy_name = 'post_tag'; } else{ $taxonomy_name = $term->taxonomy; $default_desc = isset($settings['titles_tax_titles'][$taxonomy_name]['description']) ? $settings['titles_tax_titles'][$taxonomy_name]['description'] : ''; } $disabled = isset($settings['titles_tax_titles'][$taxonomy_name]['disabled']); $description = !empty($term_meta_desc) ? $term_meta_desc : $default_desc; if(!empty($disabled)){ $description = self::replace_variables($description); echo '<meta name="description" content="' . esc_attr(self::truncate_desc($description)) . '">'; } } } // Author archive if(is_author() && !empty($settings['titles_archives_author_desc']) && empty($settings['titles_archives_author_disable'])){ $description = self::replace_variables($settings['titles_archives_author_desc']); echo '<meta name="description" content="'.esc_attr(self::truncate_desc($description)).'" >'; } // Date archive if(is_date() && !empty($settings['titles_archives_date_desc']) && empty($settings['titles_archives_date_disable'])){ $description = self::replace_variables($settings['titles_archives_date_desc']); echo '<meta name="description" content="'.esc_attr(self::truncate_desc($description)).'" >'; } // Search archive if(is_search() && !empty($settings['titles_archives_search_desc'])){ $description = self::replace_variables($settings['titles_archives_search_desc']); echo '<meta name="description" content="'.esc_attr(self::truncate_desc($description)).'" >'; } // 404 archives if(is_404() && !empty($settings['titles_archives_404_desc'])){ $description = self::replace_variables($settings['titles_archives_404_desc']); echo '<meta name="description" content="'.esc_attr(self::truncate_desc($description)).'" >'; } } static function add_rel_link_pages(){ global $siteseo, $paged; if(empty($siteseo->setting_enabled['toggle-titles'])){ return; } if(!empty($siteseo->titles_settings['titles_paged_rel'])){ if(get_previous_posts_link()){ echo '<link rel="prev" href="'.esc_url(get_pagenum_link($paged - 1)).'" />'; } if(get_next_posts_link()){ echo '<link rel="next" href="'.esc_url(get_pagenum_link($paged + 1)).'" />'; } } } static function date_time_publish(){ global $siteseo; if(empty($siteseo->setting_enabled['toggle-titles'])){ return; } if(!is_singular()){ return; } $current_post_type = get_post_type(); $type_settings = isset($siteseo->titles_settings['titles_single_titles'][$current_post_type]) ? $siteseo->titles_settings['titles_single_titles'][$current_post_type] : ''; // post type if(!empty($type_settings['date'])){ $published_time = get_the_date('c'); $modified_time = get_the_modified_date('c'); echo '<meta property="article:published_time" content="'. esc_attr($published_time) .'">'; echo '<meta property="article:modified_time" content="'. esc_attr($modified_time) .'">'; } // thumbnails if(!empty($type_settings['thumb_gcs'])){ if(get_the_post_thumbnail_url(get_the_ID())){ echo '<meta name="thumbnail" content="'.esc_url(get_the_post_thumbnail_url(get_the_ID())).'">'; } } } static function truncate_desc($desc){ if(mb_strlen($desc) > 160){ return mb_substr($desc, 0, 160 - 3) . '...'; } return $desc; } } generatesitemap.php 0000644 00000052125 15100371032 0010427 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class GenerateSitemap{ private static $paged = 1; static function settings(){ global $siteseo; if(empty($siteseo->setting_enabled['toggle-xml-sitemap'])){ return; } if(!empty($siteseo->sitemap_settings['xml_sitemap_html_enable'])){ add_shortcode('siteseo_html_sitemap', '\SiteSEO\GenerateSitemap::html_sitemap'); } if(!empty($siteseo->sitemap_settings['xml_sitemap_general_enable'])){ self::xml_sitemap(); } } static function xml_sitemap(){ add_filter('query_vars', function($vars){ $vars[] = 'sitemap_type'; $vars[] = 'paged'; $vars[] = 'sitemap-stylesheet'; return $vars; }); } static function add_rewrite_rules(){ global $siteseo; add_rewrite_rule('^sitemaps\.xsl$', 'index.php?sitemap-stylesheet=sitemap', 'top'); add_rewrite_rule('^sitemaps\.xml$', 'index.php?sitemap_type=general', 'top'); add_rewrite_rule('^author.xml$', 'index.php?sitemap_type=author', 'top'); add_rewrite_rule('^media-sitemap([0-9]+)?.xml$', 'index.php?sitemap_type=media&paged=$matches[1]', 'top'); add_rewrite_rule('^news([0-9]+)?.xml$', 'index.php?sitemap_type=news&paged=$matches[1]', 'top'); add_rewrite_rule('^video-sitemap([0-9]+)?.xml$', 'index.php?sitemap_type=video&paged=$matches[1]', 'top'); if(isset($siteseo->sitemap_settings['xml_sitemap_post_types_list'])){ foreach($siteseo->sitemap_settings['xml_sitemap_post_types_list'] as $post_type => $settings){ if(!empty($settings['include'])){ add_rewrite_rule('^'.$post_type.'-sitemap([0-9]+)?\.xml$', 'index.php?sitemap_type='.$post_type.'&paged=$matches[1]', 'top'); } } } if(isset($siteseo->sitemap_settings['xml_sitemap_taxonomies_list'])){ foreach($siteseo->sitemap_settings['xml_sitemap_taxonomies_list'] as $taxonomy => $settings){ if(!empty($settings['include'])){ add_rewrite_rule('^'.$taxonomy.'-sitemap([0-9]+)?\.xml$', 'index.php?sitemap_type='.$taxonomy.'&paged=$matches[1]', 'top'); } } } flush_rewrite_rules(); } static function handle_sitemap_requests(){ global $siteseo; $pro_settings = isset($siteseo->pro) ? $siteseo->pro : ''; self::maybe_redirect(); // Output the Sitemap style if(get_query_var('sitemap-stylesheet')){ self::sitemap_xsl(); exit; } if(get_query_var('paged')){ self::$paged = get_query_var('paged'); } $type = get_query_var('sitemap_type'); if(!empty($type)){ if($type === 'news' && !empty($pro_settings['google_news']) && !empty($pro_settings['toggle_state_google_news'])){ self::generate_google_news_sitemap(); exit; } if($type === 'video' && !empty($pro_settings['toggle_state_video_sitemap']) && !empty($pro_settings['enable_video_sitemap'])){ self::generate_video_sitemap(); exit; } // Custom post type if(isset($siteseo->sitemap_settings['xml_sitemap_post_types_list'][$type]) && !empty($siteseo->sitemap_settings['xml_sitemap_post_types_list'][$type]['include'])){ self::generateSitemap($type); exit; } //custom taxomies type if(isset($siteseo->sitemap_settings['xml_sitemap_taxonomies_list'][$type]) && !empty($siteseo->sitemap_settings['xml_sitemap_taxonomies_list'][$type]['include'])){ self::generate_term_sitemap($type); exit; } switch($type){ case 'general': self::generate_index_sitemap(); break; case 'post': self::generateSitemap('post'); break; case 'page': self::generateSitemap('page'); break; case 'category': self::generate_term_sitemap('category'); break; case 'post_tag': self::generate_term_sitemap('post_tag'); break; case 'author': self::generate_author_sitemap(); break; case 'media': self::generate_media_sitemap(); break; case 'news': self::generate_google_news_sitemap(); break; case 'video': self::generate_video_sitemap(); break; default: wp_die(esc_html__('Invalid sitemap type.', 'siteseo')); } } } static function generate_index_sitemap(){ global $siteseo; $pro_settings = isset($siteseo->pro) ? $siteseo->pro : ''; header('Content-Type: application/xml; charset=UTF-8'); if(get_option('permalink_structure')){ $xsl_url = home_url('/sitemaps.xsl'); } else { $xsl_url = home_url('/?sitemaps-stylesheet=sitemap'); } echo '<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="' . esc_url($xsl_url) . '" ?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; if(isset($siteseo->sitemap_settings['xml_sitemap_post_types_list'])){ foreach($siteseo->sitemap_settings['xml_sitemap_post_types_list'] as $post_type => $settings){ $posts = get_posts( [ 'post_type' => $post_type, 'fields'=> 'ids', 'numberposts' => -1, 'post_status' => 'publish', 'has_password' => false, 'no_found_rows' => true, 'ignore_sticky_posts' => true, 'update_post_term_cache' => false, ] ); if(empty($posts)){ continue; } $total_pages = (int) ceil(count($posts) / 1000); if(!empty($settings['include']) && !empty($total_pages)){ for($page = 1; $page <= $total_pages; $page++){ echo '<sitemap> <loc>'.esc_url(home_url("/$post_type-sitemap$page.xml")).'</loc> </sitemap>'; } } } } // Taxonomies if(isset($siteseo->sitemap_settings['xml_sitemap_taxonomies_list'])){ foreach($siteseo->sitemap_settings['xml_sitemap_taxonomies_list'] as $taxonomy => $settings){ $tax_count = wp_count_terms([ 'hide_empty' => true, 'hierarchical' => false, 'update_term_meta_cache' => false, ]); if(empty($tax_count)){ return; } $total_pages = (int) ceil($tax_count/2000); if(!empty($settings['include'])){ for($page = 1; $page <= $total_pages; $page++){ echo '<sitemap> <loc>'.esc_url(home_url("/$taxonomy-sitemap$page.xml")).'</loc> </sitemap>'; } } } } // Author if(!empty($siteseo->sitemap_settings['xml_sitemap_author_enable'])){ echo '<sitemap> <loc>'.esc_url(home_url('/author.xml')).'</loc> </sitemap>'; } if(!empty($pro_settings['google_news']) && !empty($pro_settings['toggle_state_google_news'])){ echo '<sitemap> <loc>'.esc_url(home_url('/news.xml')).'</loc> </sitemap>'; } if(!empty($pro_settings['toggle_state_video_sitemap']) && !empty($pro_settings['enable_video_sitemap'])){ $video_posts = get_posts([ 'post_type' => 'any', 'fields' => 'ids', 'numberposts' => -1, 'meta_query' => [ [ 'key' => '_siteseo_video_disabled', 'compare' => 'NOT EXISTS' ] ] ]); if(!empty($video_posts)){ $total_pages = (int) ceil(count($video_posts) / 1000); for($page = 1; $page <= $total_pages; $page++){ echo '<sitemap> <loc>'.esc_url(home_url("/video-sitemap$page.xml")).'</loc> </sitemap>'; } } } echo '</sitemapindex>'; exit; } // post static function generate_post_sitemap(){ self::generateSitemap('post'); } // page static function generate_page_sitemap(){ self::generateSitemap('page'); } // category static function generate_category_sitemap(){ self::generate_term_sitemap('category'); } //post tag static function generate_post_tag_sitemap(){ self::generate_term_sitemap('post_tag'); } // taxonomy static function generate_taxonomy_sitemap(){ self::generate_term_sitemap('taxonomy'); } // google news pro feature static function generate_google_news_sitemap(){ if(class_exists('\SiteSEOPro\GoogleNews') && method_exists('\SiteSEOPro\GoogleNews', 'google_news_sitemap')){ \SiteSEOPro\GoogleNews::google_news_sitemap(); } } // video sitemap pro feature static function generate_video_sitemap(){ if(class_exists('\SiteSEOPro\VideoSitemap') && method_exists('\SiteSEOPro\VideoSitemap', 'render_sitemap')){ \SiteSEOPro\VideoSitemap::render_sitemap(); } } static function generateSitemap($post_type){ global $siteseo; header('Content-Type: application/xml; charset=utf-8'); $offset = (1000*(self::$paged - 1)); $posts = get_posts( [ 'post_type' => $post_type, 'post_status' => 'publish', 'numberposts' => 1000, 'offset' => $offset, 'order' => 'DESC', 'orderby' => 'modified', 'has_password' => false, 'no_found_rows' => true, 'meta_query' => [ [ 'key' => '_siteseo_robots_index', 'compare' => 'NOT EXISTS' ]] ]); if(get_option('permalink_structure')){ $xsl_url = home_url('/sitemaps.xsl'); } else { $xsl_url = home_url('/?sitemaps-stylesheet=sitemap'); } echo '<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="' . esc_url($xsl_url) . '" ?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" '.((!empty($siteseo->sitemap_settings['xml_sitemap_img_enable'])) ? 'xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"' : '').'>'; if($post_type == 'post' && self::$paged == 1){ echo "\t".'<url> <loc>'.esc_url(home_url()).'</loc> </url>'; } foreach($posts as $post){ $image_xml = ''; if(!empty($siteseo->sitemap_settings['xml_sitemap_img_enable'])){ $images = self::get_page_images($post); if(!empty($images)){ foreach($images as $image){ $image_xml .= "\t\t".'<image:image>'.PHP_EOL; $image_xml .= "\t\t\t".'<image:loc>'.esc_url($image).'</image:loc>'.PHP_EOL; $image_xml .= "\t\t".'</image:image>'.PHP_EOL; } } } echo "\t".'<url> <loc>'.esc_url(urldecode(get_permalink($post->ID))).'</loc> '.esc_xml($image_xml).' <lastmod>'.esc_html(get_the_modified_date('c', $post->ID)).'</lastmod> </url>'; } echo '</urlset>'; exit; } static function generate_term_sitemap($taxonomy){ header('Content-Type: application/xml; charset=utf-8'); $offset = (2000*(self::$paged - 1)); if(get_option('permalink_structure')){ $xsl_url = home_url('/sitemaps.xsl'); } else { $xsl_url = home_url('/?sitemaps-stylesheet=sitemap'); } echo '<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="' . esc_url($xsl_url) . '" ?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $terms = get_terms([ 'taxonomy' => $taxonomy, 'hide_empty' => false, 'number' => 2000, 'offset' => $offset, 'hierarchical' => false, 'update_term_meta_cache' => false, 'meta_query' => [ [ 'key' => '_siteseo_robots_index', 'compare' => 'NOT EXISTS' ]] ]); foreach($terms as $term){ echo "\t". '<url> <loc>'.esc_url(urldecode(get_term_link($term))).'</loc> </url>'; } echo '</urlset>'; exit; } static function generate_author_sitemap(){ header('Content-Type: application/xml; charset=utf-8'); if(get_option('permalink_structure')){ $xsl_url = home_url('/sitemaps.xsl'); } else { $xsl_url = home_url('/?sitemaps-stylesheet=sitemap'); } echo '<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="' . esc_url($xsl_url) . '" ?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; // Fetch all authors $authors = get_users( ['capability' => ['publish_posts']] ); foreach($authors as $author){ echo "\t".'<url> <loc>'.esc_url(urldecode(get_author_posts_url($author->ID))).'</loc> </url>'; } echo '</urlset>'; exit; } static function html_sitemap($atts = []){ global $siteseo; $atts = shortcode_atts( [ 'cpt' => '', // Default ], $atts, 'siteseo_html_sitemap' ); $disable_date = !empty($siteseo->sitemap_settings['xml_sitemap_html_date']); $order_by = !empty($siteseo->sitemap_settings['xml_sitemap_html_orderby']) ? $siteseo->sitemap_settings['xml_sitemap_html_orderby'] : 'date'; $order = !empty($siteseo->sitemap_settings['xml_sitemap_html_order']) ? $siteseo->sitemap_settings['xml_sitemap_html_order'] : 'DESC'; $exclude_pages = array_map('trim', explode(',', $siteseo->sitemap_settings['xml_sitemap_html_exclude'] ?? '')); $output = ''; if($order !== 'ASC' && $order !== 'DESC'){ $order = 'DESC'; } $orderby_map = [ 'post_title' => 'title', 'modified_date' => 'modified', 'post_id' => 'ID', 'menu_order' => 'menu_order', 'date' => 'date', // Default ]; $orderby = $orderby_map[$order_by] ?? 'date'; $cpt_list = !empty($atts['cpt']) ? explode(',', $atts['cpt']) : []; if(!empty($siteseo->sitemap_settings['xml_sitemap_post_types_list'])){ foreach($siteseo->sitemap_settings['xml_sitemap_post_types_list'] as $post_type => $settings){ if(!empty($settings['include']) && (empty($cpt_list) || in_array($post_type, $cpt_list))){ $output .= '<h2>'.esc_html(ucfirst($post_type)).'</h2>'; $args = [ 'post_type' => $post_type, 'post_status' => 'publish', 'numberposts' => -1, 'orderby' => $orderby, 'order' => $order, ]; $posts = get_posts($args); if(!empty($posts)){ $output .= '<ul>'; foreach($posts as $post){ if(in_array($post->ID, $exclude_pages)){ continue; } $post_title = get_the_title($post->ID) ?: $post->ID; $output .= '<li><a href="'.esc_url(get_permalink($post->ID)).'">'.esc_html($post_title).'</a>'; if(!$disable_date){ $output .= '<span class="post-date"> - '.esc_html(get_the_modified_date('j F Y', $post->ID)).'</span>'; } $output .= '</li>'; } $output .= '</ul>'; }else{ $output .= ''; } } } } return $output; } static function sitemap_xsl(){ global $siteseo; $pro_settings = isset($siteseo->pro) ? $siteseo->pro : ''; $title = __('XML Sitemap', 'siteseo'); $generated_by = __('Generated by SiteSEO', 'siteseo'); $sitemap_index_txt = __('This XML Sitemap Index file contains', 'siteseo'); $sitemap_count_txt = __('This XML Sitemap contains', 'siteseo'); $last_modified_txt = __('Last Modified', 'siteseo'); $index_sitemap_url = home_url('/sitemaps.xml'); $video_sitemap_enabled = !empty($pro_settings['toggle_state_video_sitemap']) && !empty($pro_settings['enable_video_sitemap']) ? true : false; header('Content-Type: application/xml; charset=UTF-8'); echo '<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"'; if(!empty($pro_settings['toggle_state_google_news']) && !empty($pro_settings['google_news'])){ echo "\t" .'xmlns:news="https://www.google.com/schemas/sitemap-news/0.9/"'; } if(!empty($pro_settings['toggle_state_video_sitemap']) && !empty($pro_settings['enable_video_sitemap'])){ echo "\t" .'xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"'; } echo "\t" .'xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>'.esc_xml($title).'</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style> * { box-sizing: border-box; } body{ font-family: "Roboto", sans-serif; background-color: #f0f2f5; margin: 0; padding: 0; overflow-x: hidden; } header{ background: linear-gradient(135deg, #022448, #034f84); padding: 20px; color: #ffffff; text-align: center; width: 100%; margin-bottom:15px; } header h1{ font-size: 32px; margin: 0; } header p{ margin: 5px 0 0; font-size: 16px; text-decoration: underline; } header .siteseo-index-link a{ color: #ffffff; text-decoration: none; } header .siteseo-index-link a:hover{ text-decoration: underline; } .siteseo-sitemap-container{ width: 60%; padding: 20px; background-color: #ffffff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); border-radius: 8px; margin: 0 auto; overflow: auto; } .siteseo-sitemap-container a{ color:#007bff; text-decoration: none; } table{ width: 100%; border-collapse: collapse; } table thead tr{ background-color: #034f84; color: #ffffff; } table th, table td{ padding: 10px; text-align: left; border: 1px solid #ddd; } table tbody tr:nth-child(even){ background-color: #f9f9f9; } .siteseo-video-thumbnail{ max-width: 160px; max-height: 120px; border-radius: 4px; } .siteseo-video-info{ margin-left: 15px; } .siteseo-video-container{ display: flex; align-items: center; margin: 10px 0; } .siteseo-video-title{ font-weight: bold; margin-bottom: 5px; } .siteseo-video-description{ color: #555; font-size: 14px; margin-bottom: 5px; } .siteseo-video-meta{ font-size: 13px; color: #777; } .siteseo-video-url{ word-break: break-all; font-size: 13px; color: #007bff; } </style> </head> <body> <header> <h1>'.esc_xml($title).'</h1> <span>'.esc_xml($generated_by).'</span> <xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) > 0"> <div class="siteseo-description" style="text-align:center;">'.esc_xml($sitemap_index_txt).' <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"/> sitemaps</div> </xsl:if> <xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) < 1"> <div class="siteseo-description" style="text-align:center;">'.esc_xml($sitemap_count_txt).' <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> URLs</div> </xsl:if> </header> <div class="siteseo-sitemap-container"> <xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) < 1"> <a href="'.esc_url($index_sitemap_url).'">Index Sitemap</a> </xsl:if> <table> <xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) > 0"> <thead> <tr><th>URL</th></tr> </thead> <tbody> <xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap"> <tr> <td><a href="{sitemap:loc}"><xsl:value-of select="sitemap:loc"/></a></td> </tr> </xsl:for-each> </tbody> </xsl:if> <xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) < 1">'; if($video_sitemap_enabled && class_exists('\SiteSEOPro\VideoSitemap') && method_exists('\SiteSEOPro\VideoSitemap', 'render_video_xsl')){ echo'<xsl:if test="sitemap:urlset/sitemap:url/video:video">' . \SiteSEOPro\VideoSitemap::render_video_xsl() . '</xsl:if> <xsl:if test="not(sitemap:urlset/sitemap:url/video:video)"> <thead> <tr> <th>URL</th> <th>'.esc_xml($last_modified_txt).'</th> </tr> </thead> <tbody> <xsl:for-each select="sitemap:urlset/sitemap:url"> <tr> <td><a href="{sitemap:loc}"><xsl:value-of select="sitemap:loc"/></a></td> <td><xsl:value-of select="sitemap:lastmod"/></td> </tr> </xsl:for-each> </tbody> </xsl:if>'; } else { echo'<xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) < 1"> <thead> <tr> <th>URL</th> <th>'.esc_xml($last_modified_txt).'</th> </tr> </thead> <tbody> <xsl:for-each select="sitemap:urlset/sitemap:url"> <tr> <td><a href="{sitemap:loc}"><xsl:value-of select="sitemap:loc"/></a></td> <td><xsl:value-of select="sitemap:lastmod"/></td> </tr> </xsl:for-each> </tbody> </xsl:if>'; } echo'</xsl:if> </table> </div> </body> </html> </xsl:template> </xsl:stylesheet>'; } static function get_page_images($post){ $images = []; $thumb = get_the_post_thumbnail_url($post->ID); if(!empty($thumb)){ $images[] = $thumb; } if(!class_exists('DOMDocument') || empty($post->post_content)){ return $images; } libxml_use_internal_errors(true); $dom = new \DOMDocument(); $dom->loadHTML('<?xml encoding="utf-8" ?>' . $post->post_content); $dom->preserveWhiteSpace = false; libxml_clear_errors(); $img_tags = $dom->getElementsByTagName('img'); if(empty($img_tags)){ return; } foreach($img_tags as $img_tag){ $url = $img_tag->getAttribute('src'); if(empty($url)){ continue; } $url = sanitize_url($url); // The Image has some different URL which means it does not belongs to our site. if(strpos($url, untrailingslashit(home_url())) === FALSE){ continue; } $images[] = $url; } return $images; } static function maybe_redirect(){ global $wp; if(empty($wp) || empty($wp->request)){ return; } $redirects = ['sitemap.xml', 'wp-sitemap.xml', 'sitemap_index.xml']; if(in_array($wp->request, $redirects)){ wp_safe_redirect(home_url('sitemaps.xml'), 301); die(); } } } settings/social.php 0000644 00000064505 15100371032 0010371 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO\Settings; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Social{ static function menu(){ global $siteseo; $social_toggle = isset($siteseo->setting_enabled['toggle-social']) ? $siteseo->setting_enabled['toggle-social'] : ''; $nonce = wp_create_nonce('siteseo_toggle_nonce'); $current_tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : 'tab_knowledge_graph'; $social_subtabs = [ 'tab_knowledge_graph' => esc_html__('Knowledge Graph', 'siteseo'), 'tab_social_accounts' => esc_html__('Your social accounts', 'siteseo'), 'tab_facebook' => esc_html__('Facebook (Open Graph) ', 'siteseo'), 'tab_twitter' => esc_html__('X Card', 'siteseo') ]; echo '<div id="siteseo-root">'; Util::admin_header(); echo '<form method="post" id="siteseo-form" class="siteseo-option" name="siteseo-flush">'; wp_nonce_field('siteseo_social_settings'); Util::render_toggle('Social Networks - SiteSEO', 'social_toggle', $social_toggle, $nonce); echo '<div id="siteseo-tabs" class="wrap"> <div class="nav-tab-wrapper">'; foreach($social_subtabs as $tab_key => $tab_caption){ $active_class = ($current_tab === $tab_key) ? ' nav-tab-active' : ''; echo '<a id="' . esc_attr($tab_key) . '-tab" class="nav-tab' . esc_attr($active_class) . '" data-tab="' . esc_attr($tab_key) . '">' . esc_html($tab_caption) . '</a>'; } echo '</div> <div class="tab-content-wrapper"> <div class="siteseo-tab' .($current_tab == 'tab_knowledge_graph' ? ' active' : '').'" id="tab_knowledge_graph" style="display: none;">'; self::knowledge_graph(); echo '</div> <div class="siteseo-tab' .($current_tab == 'tab_social_accounts' ? ' active' : '').'" id="tab_social_accounts" style="display: none;">'; self::social_accouts(); echo '</div> <div class="siteseo-tab' .($current_tab == 'tab_twitter' ? ' active' : '').'" id="tab_twitter" style="display: none;">'; self::twitter(); echo '</div> <div class="siteseo-tab' .($current_tab == 'tab_facebook' ? ' active' : '').'" id="tab_facebook" style="display: none;">'; self::facebook(); echo '</div> </div>'; Util::submit_btn(); echo '</form></div>'; } static function knowledge_graph(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $options = get_option('siteseo_social_option_name'); //load data $option_org_type = !empty($options['social_knowledge_type']) ? $options['social_knowledge_type'] : ''; $option_org_name = !empty($options['social_knowledge_name']) ? $options['social_knowledge_name'] : ''; $option_org_logo = !empty($options['social_knowledge_img']) ? $options['social_knowledge_img'] : ''; $option_org_number = !empty($options['social_knowledge_phone']) ? $options['social_knowledge_phone'] : ''; $option_org_contact_type = !empty($options['social_knowledge_contact_type']) ? $options['social_knowledge_contact_type'] : ''; $option_org_contact_option = !empty($options['social_knowledge_contact_option']) ? $options['social_knowledge_contact_option'] : ''; echo '<h3 class="siteseo-tabs">'.esc_html__('Knowledge Graph','siteseo').'</h3> <p class="description">'.esc_html__('Set up Google Knowledge Graph.','siteseo').'</p> <table class="form-table"> <tbody> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Person or organization','siteseo').'</th> <td> <select name="siteseo_options[org_type]"> <option value="none" '.selected($option_org_type, 'none', false).'>'.esc_html__('None','siteseo').'</option> <option value="Person" '.selected($option_org_type, 'Person', false).'>'.esc_html__('Person','siteseo').'</option> <option value="Organization" '.selected($option_org_type, 'Organization', false).'>'.esc_html__('Organization','siteseo').'</option> </select> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Your name/organization','siteseo').'</th> <td> <input type="text" name="siteseo_options[org_name]" value="'.esc_attr($option_org_name).'" placeholder="'.esc_html__('eg.Miremont','siteseo').'"> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Your photo/organization logo','siteseo').'</th> <td> <input id="knowledge_org_logo_url" autocomplete="off" type="text" name="siteseo_options[org_logo]" value="'.esc_url($option_org_logo).'" placeholder="'.esc_html__('select your logo','siteseo').'"> <button id="knowledge_org_logo" class="btn btnSecondary">'.esc_html__('Upload an image','siteseo').'</button> <p class="description">'.esc_html__('JPG, PNG, WebP and GIF allowed.','siteseo').'</p><br /> <img style="width:300px;max-height:400px;" src="'.esc_url($option_org_logo).'" /> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Organizations phone number (only for Organizations)','siteseo').'</th> <td> <input type="text" name="siteseo_options[org_contact_number]" value="'.esc_attr($option_org_number).'" placeholder="'.esc_html__('eg: +33123456789 (internationlized version required)','siteseo').'"> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Contact type (only for Organizations)','siteseo').'</th> <td> <select name="siteseo_options[org_contact_type]"> <option value="Customer support" '.selected($option_org_contact_type, 'Customer support', false).'>'.esc_html__('Customer support','siteseo').'</option> <option value="Technical support" '.selected($option_org_contact_type, 'Technical support', false).'>'.esc_html__('Technical support','siteseo').'</option> <option value="Billing support" '.selected($option_org_contact_type, 'Billing support', false).'>'.esc_html__('Billing support','siteseo').'</option> <option value="Bill payment" '.selected($option_org_contact_type, 'Bill payment', false).'>'.esc_html__('Bill payment','siteseo').'</option> <option value="Sales payment" '.selected($option_org_contact_type, 'Sales payment', false).'>'.esc_html__('Sales payment','siteseo').'</option> <option value="Credit card support" '.selected($option_org_contact_type, 'Credit card support', false).'>'.esc_html__('Credit card support','siteseo').'</option> <option value="Emergency support" '.selected($option_org_contact_type, 'Emergency support', false).'>'.esc_html__('Emergency support','siteseo').'</option> <option value="Baggage tracking" '.selected($option_org_contact_type, 'Baggage tracking', false).'>'.esc_html__('Baggage tracking','siteseo').'</option> <option value="Roadside assistance" '.selected($option_org_contact_type, 'Roadside assistance', false).'>'.esc_html__('Roadside assistance','siteseo').'</option> <option value="Package tracking" '.selected($option_org_contact_type, 'Package tracking', false).'>'.esc_html__('Package tracking','siteseo').'</option> </select> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Contact option (only for Organizations)','siteseo').'</th> <td> <select name="siteseo_options[org_contact_option]"> <option value="None" '.selected($option_org_contact_option, 'None', false).'>'.esc_html__('None','siteseo').'</option> <option value="TollFree" '.selected($option_org_contact_option, 'TollFree', false).'>'.esc_html__('TollFree', 'siteseo').'</option> <option value="HearingImpairedSupported" '.selected($option_org_contact_option, 'HearingImpairedSupported', false).'>'.esc_html__('Hearing Impaired Supported','siteseo').'</option> </select> </td> </tr> </tbody> </table><input type="hidden" name="siteseo_options[knowledge_graph_tab]" value="1" >'; } static function social_accouts(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->social_settings; $options = get_option('siteseo_social_option_name'); //load settings $facebook_acct = !empty($options['social_accounts_facebook']) ? $options['social_accounts_facebook'] : ''; $twitter_acct = !empty($options['social_accounts_twitter']) ? $options['social_accounts_twitter'] : ''; $instagram_acct = !empty($options['social_accounts_instagram']) ? $options['social_accounts_instagram'] : ''; $youtube_acct = !empty($options['social_accounts_youtube']) ? $options['social_accounts_youtube'] : ''; $pinterest_acct = !empty($options['social_accounts_pinterest']) ? $options['social_accounts_pinterest'] : ''; $additional_acct = !empty($options['social_accounts_additional']) ? implode("\n", $options['social_accounts_additional']) : ''; echo '<h3 class="siteseo-tabs">'.esc_html__('Your social accouts', 'siteseo').'</h3> <table class="form-table"> <tbody> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Facebook', 'siteseo').'</th> <td> <input type="text" name="siteseo_options[facebook]" placeholder="'.esc_html__('eg: https://facebook.com/my-page-url','siteseo').'" value="'.esc_url($facebook_acct).'"> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('X Username', 'siteseo').'</th> <td> <input type="text" name="siteseo_options[twitter]" placeholder="'.esc_html__('eg : @my_twitter_account','siteseo').'" value="'.esc_attr($twitter_acct).'"> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Pinterest URL', 'siteseo').'</th> <td> <input type="text" name="siteseo_options[pinterest]" placeholder="'.esc_html__('eg : https://pinterest.com/my-page-url/','siteseo').'" value="'.esc_url($pinterest_acct).'"> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Instagram URL', 'siteseo').'</th> <td> <input type="text" name="siteseo_options[instagram]" placeholder="'.esc_html__('eg : https://www.instagram.com/my-page-url/','siteseo').'" value="'.esc_url($instagram_acct).'"> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('YouTube URL', 'siteseo').'</th> <td> <input type="text" name="siteseo_options[youtube]" placeholder="'.esc_html__('eg : https://www.youtube.com/my-channel-url/','siteseo').'" value="'.esc_url($youtube_acct).'"> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Additional Accounts', 'siteseo').'</th> <td> <textarea name="siteseo_options[additional]" placeholder="'.esc_html__('eg : https://somesite.com/my-channel-url/','siteseo').'">'.esc_textarea($additional_acct).'</textarea> <p class="description">'.esc_html__('Enter 1 URL per line.', 'siteseo').'</p> </td> </tr> </tbody> </table><input type="hidden" name="siteseo_options[social_account_tab]" value="1">'; } static function twitter(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->social_settings; $options = get_option('siteseo_social_option_name'); //load data $option_enable_card = !empty($options['social_twitter_card']) ? $options['social_twitter_card'] : ''; $options_og_card = !empty($options['social_twitter_card_og']) ? $options['social_twitter_card_og'] : ''; $option_image_size = !empty($options['social_twitter_card_img_size']) ? $options['social_twitter_card_img_size'] : ''; $option_twitter_img = !empty($options['social_twitter_card_img']) ? $options['social_twitter_card_img'] : ''; echo '<h3 class="siteseo-tabs">'.esc_html__('X Card','siteseo').'</h3> <p class="description">'.esc_html__('Manage your X card','siteseo').'</p> <div class="siteseo-notice"> <span class="dashicons dashicons-info"></span> <div> <p>'. /* translators: placeholders are just <strong> tag */ wp_kses_post(sprintf(__('We generate the %1$s og:image %2$s meta in the following order:', 'siteseo'), '<strong>', '</strong>')).'</p> <ol> <li>'.esc_html__('Custom OG Image from the SEO metabox', 'siteseo').'</li> <li>'.esc_html__('Post thumbnail / Product category thumbnail (Featured image)', 'siteseo').'</li> <li>'.esc_html__('First image of your post content', 'siteseo').'</li> <li>'.esc_html__('Global OG Image set in SEO > Social > Open Graph', 'siteseo').'</li> <li>'.esc_html__('Site icon from the Customizer', 'siteseo').'</li> </ol> </div> </div> <table class="form-table"> <tbody> <tr> <th scope="row" style="user:select-auto;">'.esc_html__('X Card','siteseo').'</th> <td>'.esc_html__('Manage your X Card','siteseo').'</td> </tr> <tr> <th scope="row" style="user:select-auto;">'.esc_html__('Enable X Card','siteseo').'</th> <td> <label for="enable_twitter_card"><input id="enable_twitter_card" type="checkbox" name="siteseo_options[enable_twitter_card]" '.(!empty($option_enable_card) ? 'checked="checked"' : 'value="1"') . '>'.esc_html__('Enable X card', 'siteseo') .'</label> </td> </tr> <tr> <th scope="row" style="user:select-auto;">'.esc_html__('Use OG if no X Cards','siteseo').'</th> <td> <label> <input id="enable_twitter_card" type="checkbox" name="siteseo_options[card_og]" '.(!empty($options_og_card) ? 'checked="checked"' : 'value="1"').'>'.esc_html__(' Use OG if no Twitter Cards', 'siteseo').' </label> </td> </tr> <tr> <th scope="row" style="user:select-auto;">'.esc_html__('Default X Image','siteseo').'</th> <td> <input type="text" id="twitter_logo_url" autocomplete="off" name="siteseo_options[twitter_img]" value="'.esc_url($option_twitter_img).'" placeholder="'.esc_html__('Choose your default thumbnail.','siteseo').'"> <button id="twitter_logo" class="btn btnSecondary">'.esc_html__('Upload a image','siteseo').'</button> <p class="description">'.esc_html__('Minimum size: 144x144px (300x157px with large card), recommended aspect ratio 1:1 (2:1 for large card), maximum file size 5MB.','siteseo').'</p> </td> </tr> <tr> <th scope="row" style="user:select-auto;">'.esc_html__('X Card Image Size','siteseo').'</th> <td> <select name="siteseo_options[image_size]"> <option value="Default" '.selected($option_image_size, 'Default', false).'>'.esc_html__('Default','siteseo').'</option> <option value="Large" '.selected($option_image_size, 'Large', false).'>'.esc_html__('Large','siteseo').'</option> </select> </td> </tr> </tbody> </table><input type="hidden" name="siteseo_options[twitter_tab]" value="1">'; } static function facebook(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } // load seetings //$options = $siteseo->social_settings; $options = get_option('siteseo_social_option_name'); $option_fb_enable_og = !empty($options['social_facebook_og']) ? $options['social_facebook_og'] : ''; $option_fb_img = !empty($options['social_facebook_img']) ? $options['social_facebook_img'] : ''; $option_fb_defult_img = !empty($options['social_facebook_img_default']) ? $options['social_facebook_img_default'] : ''; $option_fb_ownership = !empty($options['social_facebook_link_ownership_id']) ? $options['social_facebook_link_ownership_id'] : ''; $option_fb_admin_id = !empty($options['social_facebook_admin_id']) ? $options['social_facebook_admin_id'] : ''; echo '<h3 class="siteseo-tabs">'.esc_html__('Facebook (Open Graph)','siteseo').'</h3> <p class="description">'.esc_html__('Manage Open Graph data to enhance how your links appear on platforms like Facebook, Pinterest, LinkedIn, and WhatsApp when shared. Improve your click-through rate by including relevant details, such as an attention-grabbing image.','siteseo').'<p> <div class="siteseo-notice"> <span class="dashicons dashicons-info"></span> <div> <p> '. /* translators: placeholders are just <strong> tag */ wp_kses_post(sprintf(__('We generate the %1$s OG:image %2$s meta in the following sequence:', 'siteseo'), '<strong>', '</strong>')).'</p> <ol> <li>'.esc_html__('Custom OG image from the SEO metabox', 'siteseo').'</li> <li>'.esc_html__('Post thumbnail / Product category thumbnail (Featured image)', 'siteseo').'</li> <li>'.esc_html__('First image in your post content', 'siteseo').'</li> <li>'.esc_html__('Global OG:image set in SEO > Social > OG Card', 'siteseo').'</li> </ol> </div> </div> <table class="form-table"> <tbody> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Enable OG date','siteseo').'</th> <td> <label for="facebook_graph_enable"> <input id="facebook_graph_enable" type="checkbox" name="siteseo_options[enable_fb_og]" '.(!empty($option_fb_enable_og) ? 'checked="yes"' : 'value="1"').'>'. esc_html__('Enable OG data','siteseo') .' </label> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Default Image','siteseo').'</th> <td> <input id="facebook_org_image_url" autocomplete="off" type="text" name="siteseo_options[fb_image]" value="'.esc_url($option_fb_img).'" palceholder="'.esc_html__('Select your default thumbnail','siteseo').'"> <button id="facebook_upload_logo" class="btn btnSecondary">'.esc_html__('Upload a image','siteseo').'</button> <p class="description">'.esc_html__('Minimum size: 200x200px, ideal ratio 1.91:1, 8MB max. (e.g., 1640x856px or 3280x1712px for retina screens).','siteseo').'</p> <p class="description">'.esc_html__('If no default image is set, we will use your site icon defined in the Customizer.','siteseo').'</p> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Override Default Image','siteseo').'</th> <td> <div class="siteseo_wrap_label"> <label for="override_image_tag"> <input id="override_image_tag" type="checkbox" name="siteseo_options[fb_default_img]" '.(!empty($option_fb_defult_img) ? 'checked="yes"' : 'value="1"').' >'.esc_html__('Override all og:image tags with this default image, unless a custom og:image has been set in the SEO metabox.','siteseo').' </label> </div> <br /><div class="siteseo-notice is-warning"><p>'. /* translators: placeholders are just <strong> tag */ wp_kses_post(sprintf(__('Please define a default %1$s OG image %2$s using the field above.', 'siteseo'), '<strong>','</strong>')).'<p></div> </td> </tr> <tr> <th scope="row" style="user-select:auto">'.esc_html__('Link Ownership ID','siteseo').'</th> <td> <input type="text" placeholder="0123456789" name="siteseo_options[fb_owership_id]" value="'.esc_attr($option_fb_ownership).'"> <p class="description">'.esc_html__('Enter one or more Facebook Page IDs linked to a URL to enable link editing and instant article publishing.','siteseo').'</p> <div class="siteseo-styles pre"><pre>'.esc_html('<meta property="fb:pages" content="page ID"/>').'</pre></div> </td> </tr> <tr> <th scope="row" style="user-select:auto">'.esc_html__('Admin ID','siteseo').'</th> <td> <input type="text" placeholder="0123456789" name="siteseo_options[fb_admin_id]" value="'.esc_attr($option_fb_admin_id).'"> <p class="description">'.esc_html__('The ID (or a comma-separated list for properties that support multiple IDs) of an app, user of the app, or Page Graph API object.', 'siteseo').'</p> <div class="siteseo-styles pre"><pre>'.esc_html('<meta property="fb:admins" content="admins ID"/>').'</pre></div> </td> </tr> </tbody> </table><input type="hidden" name="siteseo_options[facebook_tab]" value="1">'; } static function save_settings(){ global $siteseo; check_admin_referer('siteseo_social_settings'); if(!siteseo_user_can('manage_social') || !is_admin()){ return; } $options = []; if(empty($_POST['siteseo_options'])){ return; } if(isset($_POST['siteseo_options']['knowledge_graph_tab'])){ $options['social_knowledge_type'] = isset($_POST['siteseo_options']['org_type']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_type'])) : ''; $options['social_knowledge_name'] = isset($_POST['siteseo_options']['org_name']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_name'])) : ''; $options['social_knowledge_img'] = isset($_POST['siteseo_options']['org_logo']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_logo'])) : ''; $options['social_knowledge_phone'] = isset($_POST['siteseo_options']['org_contact_number']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_contact_number'])) : ''; $options['social_knowledge_contact_type'] = isset($_POST['siteseo_options']['org_contact_type']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_contact_type'])) : ''; $options['social_knowledge_contact_option'] = isset($_POST['siteseo_options']['org_contact_option']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_contact_option'])) : ''; } if(isset($_POST['siteseo_options']['social_account_tab'])){ $options['social_accounts_facebook'] = isset($_POST['siteseo_options']['facebook']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['facebook'])) : ''; $options['social_accounts_twitter'] = isset($_POST['siteseo_options']['twitter']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['twitter'])) : ''; $options['social_accounts_instagram'] = isset($_POST['siteseo_options']['instagram']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['instagram'])) : ''; $options['social_accounts_youtube'] = isset($_POST['siteseo_options']['youtube']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['youtube'])) : ''; $options['social_accounts_pinterest'] = isset($_POST['siteseo_options']['pinterest']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['pinterest'])) : ''; $options['social_accounts_additional'] = isset($_POST['siteseo_options']['additional']) ? explode("\n", sanitize_textarea_field(wp_unslash($_POST['siteseo_options']['additional']))) : ''; $options['social_accounts_additional'] = Util::clean_url($options['social_accounts_additional']); // We accept 1 url per line. } if(isset($_POST['siteseo_options']['facebook_tab'])){ $options['social_facebook_og'] = isset($_POST['siteseo_options']['enable_fb_og']); $options['social_facebook_img'] = isset($_POST['siteseo_options']['fb_image']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['fb_image'])) : ''; $options['social_facebook_img_default'] = isset($_POST['siteseo_options']['fb_default_img']); $options['social_facebook_link_ownership_id'] = isset($_POST['siteseo_options']['fb_owership_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['fb_owership_id'])) : ''; $options['social_facebook_admin_id'] = isset($_POST['siteseo_options']['fb_admin_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['fb_admin_id'])) : ''; } if(isset($_POST['siteseo_options']['twitter_tab'])){ $options['social_twitter_card'] = isset($_POST['siteseo_options']['enable_twitter_card']); $options['social_twitter_card_og'] = isset($_POST['siteseo_options']['card_og']); $options['social_twitter_card_img'] = isset($_POST['siteseo_options']['twitter_img']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['twitter_img'])) : ''; $options['social_twitter_card_img_size'] = isset($_POST['siteseo_options']['image_size']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['image_size'])) : ''; } update_option('siteseo_social_option_name' , $options); } } settings/util.php 0000644 00000005511 15100371032 0010064 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SITSEO Team */ namespace SiteSEOPro\Settings; // Are we being accessed directly ? if(!defined('ABSPATH')){ die('Hacking Attempt !'); } class Util{ static function render_toggle($toggle_key, $toggle_state, $nonce, $label = false){ $is_active = $toggle_state ? 'active' : ''; $state_text = $toggle_state ? 'Click to disable this feature' : 'Click to enable this feature'; // for dashbord screen if($label){ echo'<div class="siteseo-toggleCnt"> <div class="siteseo-toggleSw '.esc_attr($is_active).'" id="siteseo-toggleSw-' . esc_attr($toggle_key) . '" data-nonce="' . esc_attr($nonce) . '" data-toggle-key="'.esc_attr($toggle_key).'" data-action="siteseo_pro_save_'.esc_attr($toggle_key).'"></div> <input type="hidden" name="siteseo_options['.esc_attr($toggle_key) . ']" id="'.esc_attr($toggle_key).'" value="'.esc_attr($toggle_state).'"> </div>'; } else{ echo'<div class="siteseo-toggleCnt"> <div class="siteseo-toggleSw '.esc_attr($is_active).'" id="siteseo-toggleSw-'.esc_attr($toggle_key).'" data-nonce="' . esc_attr($nonce) . '" data-toggle-key="'.esc_attr($toggle_key).'" data-action="siteseo_pro_save_'.esc_attr($toggle_key).'"></div> <span id="siteseo-arrow-icon" class="dashicons dashicons-arrow-left-alt siteseo-arrow-icon"></span> <p class="toggle_state_'.esc_attr($toggle_key).'">'.esc_html($state_text).'</p> <input type="hidden" name="siteseo_options['.esc_attr($toggle_key).']" id="'.esc_attr($toggle_key).'" value="'.esc_attr($toggle_state).'"> </div>'; } } static function get_logs(){ global $wpdb; $table_name = $wpdb->prefix . 'siteseo_redirect_logs'; self::maybe_create_404_table(); $results = $wpdb->get_results("SELECT * FROM $table_name ORDER BY timestamp DESC"); return ['items' => $results]; } static function maybe_create_404_table(){ global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $sql = "CREATE TABLE IF NOT EXISTS `".$wpdb->prefix."siteseo_redirect_logs` ( id mediumint(9) NOT NULL AUTO_INCREMENT, url varchar(255) NOT NULL, ip_address varchar(46), timestamp datetime DEFAULT CURRENT_TIMESTAMP, user_agent text, referer varchar(255), hit_count int DEFAULT 1, PRIMARY KEY (id), KEY url (url) ) $charset_collate;"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); } static function get_virtual_robots($output, $public){ $robots_path = ABSPATH . 'robots.txt'; if(file_exists($robots_path)){ return $output; } $virtual_content = get_option('siteseo_pro_virtual_robots_txt', ''); if(!empty($virtual_content)){ $output = wp_strip_all_tags($virtual_content) . PHP_EOL; } return $output; } } settings/tools.php 0000644 00000012603 15100371032 0010247 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO\Settings; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Tools{ static function menu(){ echo '<div id="siteseo-root">'; Util::admin_header(); $plugins = Util::importable_plugins(); echo '<form method="post" id="siteseo-form" class="siteseo-option" name="siteseo-flush"> <span id="siteseo-tab-title"><strong>'.esc_html__('Tools - SiteSEO','siteseo').'</strong></span><br/><br/> <span class="line"></span> <div style="siteseo-tools-page"> <h3>'.esc_html__('Import Settings From Other Plugins','siteseo').'</h3> <div class="siteseo_wrap_label"> <p class="description">'.esc_html__('Import posts and terms metadata from the specified source', 'siteseo').'</p> </div> <p><select id="siteseo-plugin-selector"> <option value="none">'.esc_html__('Select an option', 'siteseo').'</option>'; foreach($plugins as $plugin => $name){ $plugin_slug = explode('/', $plugin); $plugin = $plugin_slug[0]; echo '<option value="'. esc_attr($plugin) . '-migration-tool">'.esc_html($name).'</option>'; } echo '</select></p> <p class="description">' . esc_html__('You don\'t need to enable the selected SEO plugin to run the import.', 'siteseo').'</p>'; foreach($plugins as $plugin =>$name){ self::display_plugins($plugin, $name); } echo '<span class="line"></span> <h3>'.esc_html__('Export plugin settings','siteseo').'</h3> <div class="siteseo_wrap_label"> <p class="description">'.esc_html__('Export the plugin settings for this site as a .json file, making it easy to import the configuration into another site.', 'siteseo').'</p> </div> <div class="siteseo_wrap_label"> <button class="btn btnSecondary" id="siteseo-export-btn">'.esc_html__('Export', 'siteseo').'</button> </div> <span class="line"></span> <h3>'.esc_html__('Import plugin settings', 'siteseo').'</h3> <div class="siteseo_wrap_label"> <p class="description">'.esc_html__('Import the plugin settings from a .json file. You can obtain this file by exporting the settings from another site using the form above.','siteseo').'</p> </div> <div class=siteseo_wrap_label> <input type="file" id="siteseo-import-file" accept=".json" /> </div> <div class="siteseo_wrap_label"> <button class="brn btnSecondary" id="siteseo-import-btn">'. esc_html__('Import', 'siteseo') .'</button> </div> <span class="line"></span> <h3>'.esc_html__('Reset All Settings', 'siteseo').'</h3> <div class="siteseo_wrap_label"><div class="siteseo-notice is-warning"> <span id="dashicons-warning" class="dashicons dashicons-info"></span> <div><p>'. /* translators: placeholders are just <strong> tag */ wp_kses_post(sprintf(__('%1$s WARNING: %2$s Delete all options related to this plugin in your database.','siteseo'), '<strong>', '</strong>')).'</p></div> </div></div> <button class="btn btnSecondary" id="siteseo-reset-settings">'.esc_html__('Reset settings', 'siteseo').'</button> </div> </form></div>'; } static function display_plugins($plugin,$name){ $seo_title = 'SiteSEO'; $plugin_slug = explode('/', $plugin); $plugin = $plugin_slug[0]; echo '<div id="'.esc_attr($plugin).'-migration-tool" class="postbox siteseo-section-tool"> <div class="inside"> <h3>'. /* translators: %s represents the import posts and terms */ sprintf(esc_html__('Import posts and terms (if available) metadata from %s', 'siteseo'), esc_html($name)).'</h3> <p>'. esc_html__('By clicking Migrate, we\'ll import:', 'siteseo').'</p> <ul> <li>'. esc_html__('Title tags', 'siteseo') .'</li> <li>'. esc_html__('Meta description', 'siteseo') .'</li> <li>'. esc_html__('Facebook Open Graph tags (title, description and image thumbnail)', 'siteseo') .'</li> <li>'. esc_html__('Twitter tags (title, description and image thumbnail)', 'siteseo') .'</li> <li>'. esc_html__('Meta Robots (noindex, nofollow...)', 'siteseo') .'</li> <li>'.esc_html__('Canonical URL', 'siteseo').'</li>'; if($plugin !='slim-seo'){ echo '<li>'. esc_html__('Focus / target keywords', 'siteseo') .'<li>'; } if($plugin != 'all-in-one-seo-pack' && $plugin !='slim-seo'){ echo '<li>'. esc_html__('Primary category', 'siteseo') .'</li>'; } if('autodescription' == $plugin || 'all-in-one-seo-pack' == $plugin || 'wp-seopress' == $plugin){ echo '<li>'. esc_html__('Redirect URL', 'siteseo') .'</li>'; } echo '</ul> <div class="siteseo_wrap_label"> <div class="siteseo-notice is-warning"> <span id="dashicons-warning" class="dashicons dashicons-warning"></span> <p>'. /* translators: %s represents the degree of severity */ wp_kses_post(sprintf(__('<strong>WARNING:</strong> Migration will delete / update all <strong>%1$s posts and terms metadata</strong>. Some dynamic variables will not be interpreted. We do <strong>NOT delete any %2$s data</strong>.', 'siteseo'), esc_html($seo_title), esc_html($name))). ' </p> </div> </div> <button id="siteseo-'.esc_attr($plugin).'-migrate" type="button" class="btn btnSecondary">' . esc_html__('Import now', 'siteseo').'</button><span class="spinner"></span><div class="log"></div> </div> </div>'; } } settings/analytics.php 0000644 00000166177 15100371032 0011116 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO\Settings; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Analytics{ static function menu(){ global $siteseo; $analytics_toggle = isset($siteseo->setting_enabled['toggle-google-analytics']) ? $siteseo->setting_enabled['toggle-google-analytics'] : ''; $nonce = wp_create_nonce('siteseo_toggle_nonce'); $current_tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : 'tab_google_analytics'; $analytics_sub_tags = [ 'tab_google_analytics' => esc_html__('Google Analytics', 'siteseo'), 'tab_matomo' => esc_html__('Matomo', 'siteseo'), 'tab_clarity' => esc_html__('Clarity', 'siteseo'), 'tab_advanced' => esc_html__('Advanced', 'siteseo'), 'tab_cookie' => esc_html__('Cookie bar / GDPR', 'siteseo'), 'tab_custom_tracking' => esc_html__('Custom Tracking', 'siteseo'), ]; echo '<div id="siteseo-root">'; Util::admin_header(); echo '<form method="post" id="siteseo-form" class="siteseo-option" name="siteseo-flush">'; wp_nonce_field('siteseo_analytics_settings'); Util::render_toggle('Analytics - SiteSEO', 'analytics_toggle', $analytics_toggle, $nonce); echo '<div id="siteseo-tabs" class="wrap"> <div class="nav-tab-wrapper">'; foreach($analytics_sub_tags as $tab_key => $tab_caption){ $active_class = ($current_tab === $tab_key) ? ' nav-tab-active' : ''; echo '<a id="'.esc_attr($tab_key).'-tab" class="nav-tab'.esc_attr($active_class).'" data-tab="'.esc_attr($tab_key).'">'.esc_html($tab_caption).'</a>'; } echo '</div> <div class="tab-content-wrapper"> <div class="siteseo-tab'.($current_tab == 'tab_google_analytics' ? ' active' : '').'" id="tab_google_analytics" style="display: none;">'; self::google_anlytics(); echo '</div> <div class="siteseo-tab'.($current_tab == 'tab_matomo' ? ' active' : '') . '" id="tab_matomo" style="display: none;">'; self::matomo(); echo '</div> <div class="siteseo-tab'.($current_tab == 'tab_clarity' ? ' active' : '').'" id="tab_clarity" style="display: none;">'; self::clarity(); echo '</div> <div class="siteseo-tab'.($current_tab == 'tab_advanced' ? ' active' : '').'" id="tab_advanced" style="display: none;">'; self::advanced(); echo '</div> <div class="siteseo-tab'.($current_tab == 'tab_cookie' ? ' active' : '').'" id="tab_cookie" style="display: none;">'; self::cookies(); echo '</div> <div class="siteseo-tab'.($current_tab == 'tab_custom_tracking' ? 'active' : '').'" id="tab_custom_tracking" style="display: none;">'; self::custom_tracking(); echo '</div> </div>'; Util::submit_btn(); echo '</form></div>'; } static function custom_tracking(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->analaytics_settings; $options = get_option('siteseo_google_analytics_option_name'); $option_head_tracking = !empty($options['google_analytics_other_tracking']) ? $options['google_analytics_other_tracking'] : ''; $option_body_tracking = !empty($options['google_analytics_other_tracking_body']) ? $options['google_analytics_other_tracking_body'] : ''; $option_footer_tracking = !empty($options['google_analytics_other_tracking_footer']) ? $options['google_analytics_other_tracking_footer'] : ''; echo '<h3 class="siteseo-tabs">'.esc_html__('Custom Tracking','siteseo').'</h3> <P class="description">'.esc_html__('Add custom scripts like GTM or Facebook Pixel by copying and pasting the provided code into the HEAD, BODY, or FOOTER sections.','siteseo').'</p> <table class="form-table"> <tbody> <tr> <th scope="row">'.esc_html__('[HEAD] Add an additional tracking code (like Facebook Pixel, Hotjar...)','siteseo').'</th> <td> <textarea name="siteseo_options[head_tracking]" rows="16" placeholder="'.esc_html__('Paste your tracking code here, such as Google Tag Manager (head). Do NOT paste GA4 or Universal Analytics codes, as they are automatically included in your source code.','siteseo').'">'.esc_html($option_head_tracking).'</textarea> <p class="description">'.esc_html__('This code will be added in the head section of your page','siteseo').'</p> </td> </tr> <tr> <th scope="row">'.esc_html__('[BODY] Add an additional tracking code (like Google Tag Manager...)','siteseo').'</th> <td> <textarea name="siteseo_options[body_tracking]" rows="16" placeholder="'.esc_html__('This code will be added just after the opening body tag of your page','siteseo').'">'.esc_html($option_body_tracking).'</textarea> <p>'.esc_html__('This code will be added just after the opening body tag of your page','siteseo').'</p> <p>'.esc_html__('You don‘t see your code? Make sure to call wp_body_open(); just after the opening body tag in your theme.','siteseo').'</p> </td> </tr> <tr> <th scope="row">'.esc_html__('[BODY (FOOTER)] Add an additional tracking code (like Google Tag Manager...)', 'siteseo').'</th> <td> <textarea name="siteseo_options[footer_tracking]" rows="16" placeholder="'.esc_html__('Paste your tracking code here(footer)','siteseo').'">'.esc_html($option_footer_tracking).'</textarea> <p>'.esc_html__('This code will be added just after the closing body tag of your page','siteseo').'</P> </td> </tr> </tbody> </table><input type="hidden" name="siteseo_options[custom_tracking_tab]" value="1"/>'; } static function cookies(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->analaytics_settings; $options = get_option('siteseo_google_analytics_option_name'); $option_cookies_postion = !empty($options['google_analytics_hook']) ? $options['google_analytics_hook'] : ''; $option_tracking_opt = !empty($options['google_analytics_disable']) ? $options['google_analytics_disable'] : ''; $option_half_disable = !empty($options['google_analytics_half_disable']) ? $options['google_analytics_half_disable'] : ''; $option_opt_choices = !empty($options['google_analytics_opt_out_edit_choice']) ? $options['google_analytics_opt_out_edit_choice'] : ''; $option_opt_msg = !empty($options['google_analytics_opt_out_msg']) ? $options['google_analytics_opt_out_msg'] : ''; $option_opt_msg_ok = !empty($options['google_analytics_opt_out_msg_ok']) ? $options['google_analytics_opt_out_msg_ok'] : ''; $option_opt_msg_close = !empty($options['google_analytics_opt_out_msg_close']) ? $options['google_analytics_opt_out_msg_close'] : ''; $option_opt_msg_edit = !empty($options['google_analytics_opt_out_msg_edit']) ? $options['google_analytics_opt_out_msg_edit'] : ''; $option_cd_exp_date = !empty($options['google_analytics_cb_exp_date']) ? $options['google_analytics_cb_exp_date'] : '30'; $option_cd_pos = !empty($options['google_analytics_cb_pos']) ? $options['google_analytics_cb_pos'] : ''; $option_cd_txt_align = !empty($options['google_analytics_cb_txt_align']) ? $options['google_analytics_cb_txt_align'] : ''; $option_cd_width = !empty($options['google_analytics_cb_width']) ? $options['google_analytics_cb_width'] : ''; $option_cd_backdrop = !empty($options['google_analytics_cb_backdrop']) ? $options['google_analytics_cb_backdrop'] : ''; $option_cd_scheme = !empty($options['google_analytics_cb_scheme']) ? $options['google_analytics_cb_scheme'] : ''; //colors load $option_backdrop_bg = !empty($options['google_analytics_cb_backdrop_bg']) ? $options['google_analytics_cb_backdrop_bg'] : ''; $option_cookiebar_bg = !empty($options['google_analytics_cb_bg']) ? $options['google_analytics_cb_bg'] : '#ffffff'; $option_cookiebar_txt = !empty($options['google_analytics_cb_txt_col']) ? $options['google_analytics_cb_txt_col'] : '#000000'; $option_cookiebar_lk = !empty($options['google_analytics_cb_lk_col']) ? $options['google_analytics_cb_lk_col'] : '#0000ff'; $option_primarybtn_bg = !empty($options['google_analytics_cb_btn_bg']) ? $options['google_analytics_cb_btn_bg'] : '#0073aa'; $option_primarybtn_bg_hov = !empty($options['google_analytics_cb_btn_bg_hov']) ? $options['google_analytics_cb_btn_bg_hov'] : '#005f8b'; $option_primarybtn_txt = !empty($options['google_analytics_cb_btn_col']) ? $options['google_analytics_cb_btn_col'] : '#ffffff'; $option_primarybtn_txt_hov = !empty($options['google_analytics_cb_btn_col_hov']) ? $options['google_analytics_cb_btn_col_hov'] : '#ffffff'; $option_sec_bg = !empty($options['google_analytics_cb_btn_sec_bg']) ? $options['google_analytics_cb_btn_sec_bg'] : '#cccccc'; $option_sec_bg_hov = !empty($options['google_analytics_cb_btn_sec_bg_hov']) ? $options['google_analytics_cb_btn_sec_bg_hov'] : '#aaaaaa'; $option_sec_bg_txt = !empty($options['google_analytics_cb_btn_sec_col']) ? $options['google_analytics_cb_btn_sec_col'] : '#000000'; $option_sec_bg_txt_hov = !empty($options['google_analytics_cb_btn_sec_col_hov']) ? $options['google_analytics_cb_btn_sec_col_hov'] : '#000000'; echo '<h3 class="siteseo-tabs">'.esc_html__('Cookies','siteseo').'</h3> <p class="description">'.esc_html__('Easily manage user consent for GDPR and customize your cookie bar.','siteseo').'</p> <p class="description">'.esc_html__('Compatible with Google Analytics and Matomo.','siteseo').'</p> <table> <tbody class="form-table"> <tr> <div class="siteseo-notice" id="custom-dimensions"> <span class="dashicons dashicons-info"></span> <p>'. /* translators: placeholders are just <strong> tag */ wp_kses_post(sprintf(__('%1$s Note : %2$s This feature applies only to cookies added through SiteSEO analytics and tracking.', 'siteseo'), '<strong>', '</strong>')).'</p> </div> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Where to load the cookie bar?','siteseo').'</th> <td> <select name="siteseo_options[cookie_pos]"> <option value="wp_body_open" '.selected($option_cookies_postion, 'wp_body_open', false).'>'.esc_html__('After the opening body tag (recommended)', 'siteseo').'</option> <option value="wp_footer" '.selected($option_cookies_postion, 'wp_footer', false).'>'.esc_html__('Footer', 'siteseo') .'</option> <option value="wp_head" '.selected($option_cookies_postion, 'wp_head', false).'>'.esc_html__('Header (not recommended)', 'siteseo').'</option> </select> </td> </tr> <tr> <th scope"user-select:auto">'.esc_html__('Analytics tracking opt-in','siteseo').'</th> <td> <label> <input name="siteseo_options[opt_tracking]" type="checkbox" '.(!empty($option_tracking_opt) ? 'checked="yes"' : 'value="1"').' /> '.esc_html__('Obtain user consent for analytics tracking, as required by GDPR.', 'siteseo').' </label><br/><br/> <label> <input type="checkbox" name="siteseo_options[half_disable]" '.(!empty($option_half_disable) ? 'checked="yes"' : 'value="1"').' /> '.esc_html__('Display and automatically accept if user does not accept or reject within 10 seconds.','siteseo').' </label> </td> </tr> <tr> <th scope="row" style="user-select:auto:">'.esc_html__('Allow user to change its choice','siteseo').'</th> <td> <label> <input name="siteseo_options[opt_edit_choices]" type="checkbox" '.(!empty($option_opt_choices) ? 'checked="yes"' : 'value="1"').' /> Allow user to change its choice about cookies'.esc_html__('Request user consent for analytics tracking (required by GDPR)', 'siteseo').' </label> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Consent message for user tracking','siteseo').'</th> <td> <textarea placeholder="'.esc_html__('Enter your message (HTML allowed)','siteseo').'" name="siteseo_options[opt_msg]" >'.esc_attr($option_opt_msg).'</textarea> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Accept button for user tracking','siteseo').'</th> <td> <input type="text" name="siteseo_options[opt_msg_ok]" value="'.esc_attr($option_opt_msg_ok).'" placeholder="'.esc_html__('Accept','siteseo').'"> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Close button','siteseo').'</th> <td> <input type="text" name="siteseo_options[opt_close]" value="'.esc_attr($option_opt_msg_close).'" placeholder="'.esc_attr('default:X','siteseo').'"> </td> </tr> <tr> <th scope="row" style="user-select:auto;" >'.esc_html__('Edit cookies button','siteseo').'</th> <td> <input type="text" name="siteseo_options[opt_edit_btn]" value="'.esc_attr($option_opt_msg_edit).'" placeholder="'.esc_attr('default:Manage cookie','siteseo').'"> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('User consent cookie expiration date','siteseo').'</th> <td> <input type="number" name="siteseo_options[cd_exp_date]" value="'.esc_attr($option_cd_exp_date).'" > </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Cookie bar position','siteseo').'</th> <td> <select name="siteseo_options[cd_pos]"> <option value="bottom" '.selected($option_cd_pos, 'bottom', false).'>'.esc_html__('Bottom (default)','siteseo').'</option> <option value="middle" '.selected($option_cd_pos, 'middle', false).'>'.esc_html__('Middle','siteseo').'</option> <option value="top" '.selected($option_cd_pos, 'top', false).'>'.esc_html__('Top','siteseo').'</option> </select> </td> </tr> <tr> <th scope="row" style="use-select:auto;">'.esc_html__('Text alignment','siteseo').'</th> <td> <select name="siteseo_options[cd_txt_align]"> <option value="center" '.selected($option_cd_txt_align, 'center', false).'>'.esc_html__('Center (default)', 'siteseo').'</option> <option value="left" '.selected($option_cd_txt_align, 'left', false).'>'.esc_html__('Left', 'siteseo').'</option> <option value="right" '.selected($option_cd_txt_align, 'right', false).'>'.esc_html__('Right', 'siteseo').'</option> </select> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Cookie bar width', 'siteseo').'</th> <td> <input type="text" name="siteseo_options[cd_width]" value="'.esc_attr($option_cd_width).'"/> <p class="description">'.esc_html__('The default unit is Pixels. To use percentages, simply add % after your custom value (e.g., 80%).', 'siteseo').'</p> <br/> <span class="line"></span> </td> </tr> <tr> <th scope="row" style="user-select:auto;"></th> <td> <h3>'.esc_html__('Backdrop', 'siteseo').'</h3> <p>'.esc_html__('Customize the backdrop of the cookie bar.', 'siteseo').'</p><br/> <label> <input type="checkbox" name="siteseo_options[cd_backdrop]" '.(!empty($option_cd_backdrop) ? 'checked="yes"' : 'value="1"').'>'. esc_html__('Display a backdrop with the cookie bar', 'siteseo') .' </label> <br/><br/> <p>'.esc_html__('Background color:','siteseo').'</p><br/> <input type="color" placeholder="Select color" name="siteseo_options[backdrop_bg]" value="'.esc_attr($option_backdrop_bg).'"/> <br/></br/> <span class="line"></span> </td> </tr> <tr> <th scope="row" style="user-select:auto;"></th> <td> <h3>'.esc_html__('Main settings', 'siteseo').'</h3> <p>'.esc_html__('Customize the general settings of the cookie bar', 'siteseo').'</p> <p>'.esc_html__('Background color:', 'siteseo').'</p><br/> <input type="color" placeholder="'.esc_html__('Select color', 'siteseo').'" name="siteseo_options[cookiesbar_bg]" value="'.esc_attr($option_cookiebar_bg).'"/> <p>'.esc_html__('Text color:', 'siteseo').'</p><br/> <input type="color" placeholder="'.esc_html__('Select color', 'siteseo').'" name="siteseo_options[cookiebar_txt]" value="'.esc_attr($option_cookiebar_txt).'"/> <p>'.esc_html__('Link color: ','siteseo').'</p></br> <input type="color" placeholder="'.esc_html__('Select color', 'siteseo').'" name="siteseo_options[line_co]" value="'.esc_attr($option_cookiebar_lk).'"/><br/></br> <span class="line"></span> </td> </tr> <tr> <th scope="row" style="use-select:auto"></th> <td> <h3>'.esc_html__('Primary button', 'siteseo').'</h3> <p>'.esc_html__('Customize the Accept button', 'siteseo').'</p><br/> <p>'.esc_html__('Background color:', 'siteseo').'</p> <input type="color" placeholder="'.esc_html__('Select color', 'siteseo').'" name="siteseo_options[primary_btn_bg]" value="'.esc_attr($option_primarybtn_bg).'"/><br/><br/> <p>'.esc_html__('Background color on hover:','siteseo').'</p> <input type="color" name="siteseo_options[primary_btn_bg_hov]" value="'.esc_attr($option_primarybtn_bg_hov).'" /><br/><br/> <p>'.esc_html__('Text color:', 'siteseo').'</p> <input type="color" name="siteseo_options[primary_btn_txt]" value="'.esc_attr($option_primarybtn_txt).'"/> <p>'. esc_html__('Text color on hover:', 'siteseo') .'</p> <input type="color" name="siteseo_options[primary_btn_txt_hov]" value="'.esc_attr($option_primarybtn_txt_hov).'"/><br/><br/> <span class="line"></span> </td> </tr> <tr> <th scope="row" style="user-select:auto"></th> <td> <h3>'.esc_html__('Secondary button', 'siteseo').'</h3> <p>'.esc_html__('Customize the Accept button', 'siteseo').'</p><br/> <p>'.esc_html__('Background color:', 'siteseo').'</p> <input type="color" placeholder="'.esc_html__('Select color','siteseo').'" name="siteseo_options[sec_btn_bg]" value="'.esc_attr($option_sec_bg).'"/><br/><br/> <p>'.esc_html__('Background color on hover:', 'siteseo').'</p> <input type="color" name="siteseo_options[sec_btn_bg_hov]" value="'.esc_attr($option_sec_bg_hov).'"/><br/><br/> <p>'.esc_html__('Text color:', 'siteseo').'</p> <input type="color" name="siteseo_options[sec_btn_txt]" value="'.esc_attr($option_sec_bg_txt).'"/> <p>'.esc_html__('Text color on hover:', 'siteseo').'</p> <input type="color" name="siteseo_options[sec_btn_txt_hov]" value="'.esc_attr($option_sec_bg_txt_hov).'"/> </td> </tr> </tbody> </table><input type="hidden" name="siteseo_options[cookies_tab]" value="1"/>'; } static function matomo(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->analaytics_settings; $options = get_option('siteseo_google_analytics_option_name'); $option_enable_matomo = !empty($options['google_analytics_matomo_enable']) ? $options['google_analytics_matomo_enable'] : ''; $option_self_hosted = !empty($options['google_analytics_matomo_self_hosted']) ? $options['google_analytics_matomo_self_hosted'] : ''; $option_matomo_id = !empty($options['google_analytics_matomo_id']) ? $options['google_analytics_matomo_id'] : ''; $option_site_id = !empty($options['google_analytics_matomo_site_id']) ? $options['google_analytics_matomo_site_id'] : ''; $option_sub_domain = !empty($options['google_analytics_matomo_subdomains']) ? $options['google_analytics_matomo_subdomains'] : ''; $option_site_domain = !empty($options['google_analytics_matomo_site_domain']) ? $options['google_analytics_matomo_site_domain'] : ''; $option_enable_corss_domain = !empty($options['google_analytics_matomo_cross_domain']) ? $options['google_analytics_matomo_cross_domain'] : ''; $option_no_js = !empty($options['google_analytics_matomo_no_js']) ? $options['google_analytics_matomo_no_js'] : ''; $option_cross_domain_sites = !empty($options['google_analytics_matomo_cross_domain_sites']) ? $options['google_analytics_matomo_cross_domain_sites'] : ''; $option_no_cookies = !empty($options['google_analytics_matomo_no_cookies']) ? $options['google_analytics_matomo_no_cookies'] : ''; $options_link_tracking = !empty($options['google_analytics_matomo_link_tracking']) ? $options['google_analytics_matomo_link_tracking'] : ''; $options_no_heatmaps = !empty($options['google_analytics_matomo_no_heatmaps']) ? $options['google_analytics_matomo_no_heatmaps'] : ''; $options_matomo_dtn = !empty($options['google_analytics_matomo_dnt']) ? $options['google_analytics_matomo_dnt'] : ''; $matomo_subtabs = [ 'tracking' => 'Tracking', ]; echo '<table class="form-table"> <tbody> <tr> <th scope="row"> <div class="siteseo-container">'; $is_first = true; foreach($matomo_subtabs as $post_key => $post_val){ $active_class = $is_first ? 'active' : ''; echo '<a href="#'.esc_attr($post_key).'" class="'.esc_attr($active_class).'">'.esc_html($post_val).'</a>'; $is_first = false; } echo '</div> </th> <td> <h3>'.esc_html__('Matomo', 'siteseo').'</h3> <div class="siteseo_wrap_label" id="tracking"> <p class="description">'.esc_html__('Track your users with privacy in mind using Matomo. We support both On-Premise and Cloud installations.', 'siteseo').'</p> </div> <span class="line"></span> <h3>'.esc_html__('Tracking', 'siteseo').'</h3> <table class="form-table"> <tbody> <tr> <th scope="row">'.esc_html__('Enable Matomo tracking.', 'siteseo').'</th> <td> <label> <input type="checkbox" name="siteseo_options[enable_matomo]" '.(!empty($option_enable_matomo) ? 'checked="yes"' : '').' value="1"/> '.esc_html__('Enable Matomo tracking', 'siteseo') .' </label> <p class="description">'.esc_html__('A Matomo Cloud account or a self-hosted Matomo installation is necessary.', 'siteseo').'</p> </td> </tr> <tr> <th scope="row">'.esc_html__('Self hosted Matomo installation.', 'siteseo').'</th> <td> <label> <input type="checkbox" name="siteseo_options[self_hosted]" '.(!empty($option_self_hosted) ? 'checked="yes"' : '').' value="1" "/> '.esc_html__('Yes, self-hosted installation', 'siteseo').' </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Enter your tracking ID', 'siteseo').'</th> <td> <input type="text" placeholder="'.esc_html__('Enter "example" if you Matomo account URL is "example.matomo.cloud', 'siteseo').'" name="siteseo_options[tracking_id]" value="'.esc_attr($option_matomo_id).'"/> '.wp_kses_post('<p class="description">Enter only the host without quotes, such as "example.matomo.cloud" </br> (Cloud) or "matomo.example.com" (self-hosted).</p>', 'siteseo').' </td> </tr> <tr> <th scope="row">'.esc_html__('Enter your site ID.', 'siteseo').'</th> <td> <input type="text" placeholder="'.esc_html__('Enter your site ID', 'siteseo').'" name="siteseo_options[site_id]" value="'.esc_attr($option_site_id).'"/> <p class="description">'. /* translators: placeholders are just <strong> tag */ wp_kses_post(sprintf(__('To find your site ID, visit your %1$s Matomo Cloud %2$s account, go to Websites, and click Manage. The <br/>"Site ID" will be displayed on the right side.', 'siteseo'), '<strong>', '</strong>')).'</p> <p class="description">'. /* translators: placeholder is just <br> tag */ wp_kses_post(sprintf(__('For self-hosted installations, navigate to your Matomo administration, then go to Settings, Websites, %1$s and Manage. From the list of websites, locate the "ID" line.', 'siteseo'), '<br/>')).'<p> </td> </tr> <tr> <th scope="row">'.esc_html__('Track visitors across all subdomains', 'siteseo').'</th> <td> <label> <input type="checkbox" name="siteseo_options[track_visitors]" '.(!empty($option_sub_domain) ? 'checked="yes"' : '').' value="1"/> '.esc_html__('Monitor one domain along with its subdomains on the same website.','siteseo') .' <p class=description">'.esc_html__('If a visitor visits x.example.com and y.example.com, they will be counted as a single unique visitor.', 'siteseo').'</p> </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Prepend the site domain.', 'siteseo').'</th> <td> <label> <input type="checkbox" name="siteseo_options[site_domain]" '.(!empty($option_site_domain) ? 'checked="yes"' : '').' value="1" /> '.esc_html__('Add the site domain before the page title when tracking', 'siteseo').' <p class="description">For example, if someone visits the About page on blog.example.com, it will be recorded as "blog / About".<br/> This provides a simple way to get an overview of your traffic by subdomain.</p>` </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Track users with JavaScript disabled.', 'siteseo').'</th> <td> <label> <input type="checkbox" name="siteseo_options[track_users]" '.(!empty($option_no_js) ? 'checked="yes"' : '').' value="1" /> '. esc_html__('Track users with JavaScript disabled', 'siteseo').' </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Enables cross domain linking', 'siteseo').'</th> <td> <label> <input type="checkbox" name="siteseo_options[enable_cross_domains]" '.(!empty($option_enable_corss_domain) ? 'checked="yes"' : '').' value="1" /> '.esc_html__('Enables cross domain linking', 'siteseo').' </label> <p class="description">'.esc_html__('By default, the visitor ID, which uniquely identifies each visitor, is stored in the browser first-party cookies. These cookies can only be accessed by pages on the same domain.', 'siteseo').'</p> <p class="description">'.esc_html__('Enabling cross-domain tracking allows you to monitor all actions and pageviews of a specific visitor within the same session, even when they visit pages across different domains.', 'siteseo').'</p> <p class="description">'.esc_html__('When a user clicks on a link to one of your site alias URLs, a URL parameter, <code>pk_vid</code>, will be appended, forwarding the Visitor ID.', 'siteseo').'</p> </td> </tr> <tr> <th scope="row">'.esc_html__('Cross domain', 'siteseo').'</th> <td> <input type="text" name="siteseo_options[corss_domains]" value="'.esc_attr($option_cross_domain_sites).'" placeholder="'.esc_attr('Enter your domains: siteseo.io,sub.siteseo.io,sub2.siteseo.io').'"/> </td> </tr> <tr> <th scope="row">'.esc_html__('Enable DoNotTrack detection', 'siteseo').'</th> <td> <input type="checkbox" name="siteseo_options[enable_donottack]" '.(!empty($options_matomo_dtn) ? 'checked="yes"' : '').' value="1"/> '.esc_html__('Activate client-side Do Not Track detection.', 'siteseo').' <p class="description">'.esc_html__('Tracking requests will be blocked if visitors opt out of being tracked.', 'siteseo').'</p> </td> </tr> <tr> <th scope="row">'.esc_html__('Disable all tracking cookies.', 'siteseo').'</th> <td> <input type="checkbox" name="siteseo_options[disabled_cookies]" '.(!empty($option_no_cookies) ? 'checked="yes"' : '').' value="1" /> '.esc_html__('Disables all first-party cookies. Any existing Matomo cookies for this site will be deleted on the next page view.', 'siteseo').' </td> </tr> <tr> <th scope="row">'.esc_html__('Download & Outlink tracking.', 'siteseo').'</th> <td> <input type="checkbox" name="siteseo_options[outlink_tracking]" '.(!empty($options_link_tracking) ? 'checked="yes"' : '').' value="1" /> '.esc_html__('Enabling Download & Outlink tracking','siteseo').' <p class="description">By default, files with any of these extensions will be treated as a "download" in the Matomo interface.<p> <div class="siteseo-styles pre"><pre>7z|aac|arc|arj|apk|asf|asx|avi|bin|bz|bz2|csv|deb|dmg|doc|exe|flv|gif|gz|gzip|hqx|jar|jpg|jpeg|js|mp2|mp3|mp4|mpg|mpeg|mov|movie|msi|msp|odb|odf|odg|odp|ods|odt|ogg|ogv| pdf|phps|png|ppt|qt|qtm|ra|ram|rar|rpm|sea|sit|tar|tbz|tbz2|tgz|torrent|txt|wav|wma|wmv|wpd|xls|xml|z|zip</pre></div> </td> </tr> <tr> <th scope="row">'.esc_html__('Disable all heatmaps and session recordings.', 'siteseo').'</th> <td> <input type="checkbox" '.(!empty($options_no_heatmaps) ? 'checked="yes"' : '').' value="1" name="siteseo_options[disabled_heatmaps]" /> '.esc_html__('Turns off all heatmaps and session recordings.', 'siteseo').' </td> </tr> </tbody> </table> </td> </tr> </tbody> </table><input type="hidden" name="siteseo_options[matomo_tab]" value="1"/>'; } static function advanced(){ global $siteseo,$wp_roles; if(!empty($_POST['submit'])){ self::save_settings(); } if(!isset($wp_roles)){ $wp_roles = new WP_Roles(); } //$options = $siteseo->analaytics_settings; $options = get_option('siteseo_google_analytics_option_name'); $option_track_authors = !empty($options['google_analytics_cd_author']) ? $options['google_analytics_cd_author'] : ''; $option_track_categories = !empty($options['google_analytics_cd_category']) ? $options['google_analytics_cd_category'] : ''; $option_track_tag = !empty($options['google_analytics_cd_tag']) ? $options['google_analytics_cd_tag'] : ''; $option_track_post_types = !empty($options['google_analytics_cd_post_type']) ? $options['google_analytics_cd_post_type'] : ''; $option_logged_user = !empty($options['google_analytics_cd_logged_in_user']) ? $options['google_analytics_cd_logged_in_user'] : ''; $adavnced_subtabs =[ 'custom-dimensions' => 'Custom Dimensions', 'Misc' => 'Misc', ]; echo '<table class="form-table"> <tbody> <tr> <th scope="row"> <div class="siteseo-container">'; $is_first = true; foreach($adavnced_subtabs as $post_key => $post_val){ $active_class = $is_first ? 'active' : ''; echo '<a href="#'.esc_attr($post_key).'" class="'.esc_attr($active_class).'">'.esc_html($post_val).'</a>'; $is_first = false; } echo '</div> </th> <td> <h3>'.esc_html__('Advanced settings', 'siteseo').'</h3> <div class="siteseo-notice" id="custom-dimensions"> <span class="dashicons dashicons-info"></span> <p>'.esc_html__('All advanced settings are compatible with both Google Analytics and Matomo tracking codes.', 'siteseo').'</p> </div> <br/> <span class="line"></span> <h3>'.esc_html__('Custom Dimensions', 'siteseo').'</h3> <div class="siteseo_wrap_label"><p class="description">'.esc_html__('Set up your Google Analytics custom dimensions.', 'siteseo').'</p></div> <div class="siteseo_wrap_label"><p class="description">'.esc_html__('Custom dimensions and metrics are similar to the default ones in Google Analytics, but you have the flexibility to create your own.', 'siteseo').'</p></div> <div class="description"><p class="description">'.esc_html__('Utilize custom dimensions to gather and analyze data that Google Analytics does not track automatically.', 'siteseo').'</p><div> <div class="description"><p class="description">'.esc_html__('Remember, you must also configure your custom dimensions in your Google Analytics account. Click the help icon for more information.', 'siteseo').'</p></div> <table class="form-table"> <tbody> <tr> <th scope="row">'.esc_html__('Track Authors', 'siteseo').'</th> <td> <select name="siteseo_options[track_authors]"> <option value="none" '.selected($option_track_authors, 'none', false).'>'.esc_html__('None','siteseo').'</option>'; for($i = 1; $i <= 20; ++$i){ /* translators: %d represents the custom dimension */ echo '<option '.selected($option_track_authors, 'dimension' . $i, false).' value="dimension'.esc_attr($i).'">'.sprintf(esc_html__('Custom Dimension #%d', 'siteseo'), esc_html($i)).'</option>'; } echo '</select> </td> </tr> <tr> <th scope="row">'.esc_html__('Track Categories', 'siteseo').'</th> <td> <select name="siteseo_options[track_categories]"> <option value="none" '.selected($option_track_categories, 'none', false).'>'.esc_html__('None','siteseo').'</option>'; for($i = 1; $i <= 20; ++$i){ /* translators: %d represents the custom dimension */ echo '<option '.selected($option_track_categories, 'dimension' . $i, false).' value="dimension'.esc_attr($i).'">'.sprintf(esc_html__('Custom Dimension #%d', 'siteseo'), esc_html($i)).'</option>'; } echo '</select> </td> </tr> <tr> <th scope="row">'.esc_html__('Track Tags', 'siteseo').'</th> <td> <select name="siteseo_options[track_tags]"> <option value="none" '.selected($option_track_tag, 'none', false).'>'.esc_html__('None','siteseo').'</option>'; for($i = 1; $i <= 20; ++$i){ /* translators: %d represents the custom dimension */ echo '<option '.selected($option_track_tag, 'dimension' . $i, false).' value="dimension'.esc_attr($i).'">'.sprintf(esc_html__('Custom Dimension #%d', 'siteseo'), esc_html($i)).'</option>'; } echo '</select> </td> </tr> <tr> <th scope="row">'.esc_html__('Track Post Types','siteseo').'</th> <td> <select name="siteseo_options[track_post_types]"> <option value="none" '.selected($option_track_post_types, 'none', false).'>'.esc_html__('None','siteseo').'</option>'; for($i = 1; $i <= 20; ++$i){ /* translators: %d represents the custom dimension */ echo '<option '.selected($option_track_post_types, 'dimension' . $i, false).' value="dimension'.esc_attr($i).'">'.sprintf(esc_html__('Custom Dimension #%d', 'siteseo'), esc_html($i)).'</option>'; } echo '</select> </td> </tr> <tr> <th scope="row">'.esc_html__('Track Logged In Users','siteseo').'</th> <td> <select name="siteseo_options[track_user]"> <option value="none" '.selected($option_logged_user, 'none', false).'>'.esc_html__('None','siteseo').'</option>'; for($i = 1; $i <= 20; ++$i){ /* translators: %d represents the custom dimension */ echo '<option '.selected($option_logged_user, 'dimension' . $i, false).' value="dimension'.esc_attr($i).'">'. sprintf(esc_html__('Custom Dimension #%d', 'siteseo'), esc_html($i)).'</option>'; } echo '</select> </td> </tr> </tbody> </table> <div class="description" id="Misc"><span class="line"></span> <h3>'.esc_html__('Misc','siteseo').'</h3> <table> <tbody class="form-table"> <tr> <th scope="row">'.esc_html__('Exclude user roles from tracking (Google Analytics and Matomo)','siteseo').'</th> <td>'; foreach($wp_roles->get_names() as $key => $value){ $select = isset($options['google_analytics_roles'][$key]); echo '<p> <label> <input name="siteseo_options[misc_roles]['.esc_attr($key).']" type="checkbox" '.(!empty($select) ? 'checked="yes"' : 'value="1"').'/> <strong>'. esc_html($value) .'</strong> (<em> '. esc_html(translate_user_role($value, 'default')) .'</em>) </label> </p>'; } echo '</td> </tr> </tbody> </table> </div> </td> </tr> </tbody> </table><input type="hidden" name="siteseo_options[advanced_tab]" value="1"/>'; } static function clarity(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->analaytics_settings; $options = get_option('siteseo_google_analytics_option_name'); $option_enable_clarity = !empty($options['google_analytics_clarity_enable']) ? $options['google_analytics_clarity_enable'] : ''; $option_project_id = !empty($options['google_analytics_clarity_project_id']) ? $options['google_analytics_clarity_project_id'] : ''; echo '<h3 class="siteseo-tabs">'.esc_html__('Microsoft Clarity', 'siteseo').'</h3> <p class="description">'.esc_html__('Use Microsoft Clarity to capture session recordings, access instant heatmaps, and gain powerful insights for free. Understand how users interact with your site to enhance the user experience and boost conversions.', 'siteseo').'</p> <div class="siteseo-notice"> <span class="dashicons dashicons-info"></span> <p>'. /* translators: %s represents the microsoft clarity api url */ wp_kses_post(sprintf(__('Create your first Microsoft Clarity project %1$shere%2$s.', 'siteseo'), '<a href="https://clarity.microsoft.com/" target="_blank">', '</a>')) .'</p> </div> <table class="form-table"> <tbody> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Enable Microsoft Clarity','siteseo').'</th> <td> <input type="checkbox" name="siteseo_options[microsoft_clarity]" '.(!empty($option_enable_clarity) ? 'checked="yes"' : ''). ' value="1"> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Enter your Clarity project ID', 'siteseo').'</th> <td> <input type="text" name="siteseo_options[project_id]" placeholder="'.esc_attr__('Enter your Project Id', 'siteseo').'" value="'.esc_attr($option_project_id).'" > <p><span class="dashicons dashicons-external"></span> <a href="https://siteseo.io/docs/analytics/find-my-microsoft-clarity-project-id/" target="_blank"> '.esc_html__('Find your project ID', 'siteseo').' </a> </span> </p> </td> </tr> </tbody> </table><input type="hidden" name="siteseo_options[clarity_tab]" value="1" />'; } static function google_anlytics(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $options = get_option('siteseo_google_analytics_option_name'); //$options = $siteseo->analaytics_settings; $option_enable_anaytics = !empty($options['google_analytics_enable']) ? $options['google_analytics_enable'] : ''; $option_anaytics_id = !empty($options['google_analytics_ga4']) ? $options['google_analytics_ga4'] : ''; $option_enable_optimize = !empty($options['google_analytics_link_tracking_enable']) ? $options['google_analytics_link_tracking_enable'] : ''; $option_enable_download_tracking= !empty($options['google_analytics_download_tracking_enable']) ? $options['google_analytics_download_tracking_enable'] : ''; $option_download_tracking = !empty($options['google_analytics_download_tracking']) ? $options['google_analytics_download_tracking'] : ''; $option_affiliate_tracking_enable = !empty($options['google_analytics_affiliate_tracking_enable']) ? $options['google_analytics_affiliate_tracking_enable'] : ''; $option_affiliate_tracking = !empty($options['google_analytics_affiliate_tracking']) ? $options['google_analytics_affiliate_tracking'] : ''; $option_phone_tracking = !empty($options['google_analytics_phone_tracking']) ? $options['google_analytics_phone_tracking'] : ''; $option_container_id = !empty($options['google_analytics_optimize']) ? $options['google_analytics_optimize'] : ''; $option_conversion_id = !empty($options['google_analytics_ads']) ? $options['google_analytics_ads'] : ''; $option_ip_anonymization = !empty($options['google_analytics_ip_anonymization']) ? $options['google_analytics_ip_anonymization'] : ''; $option_links_attribution = !empty($options['google_analytics_link_attribution']) ? $options['google_analytics_link_attribution'] : ''; $option_domain_tracking = !empty($options['google_analytics_cross_enable']) ? $options['google_analytics_cross_enable'] : ''; $option_cross_domain = !empty($options['google_analytics_cross_domain']) ? $options['google_analytics_cross_domain'] : ''; $option_enable_remarketing = !empty($options['google_analytics_remarketing']) ? $options['google_analytics_remarketing'] : ''; $google_analytics_fileds = [ 'general-settings' =>'General', 'tracking-settings'=>'Tracking', 'events-settings' => 'Events' ]; echo '<table class="form-table"> <tbody> <tr> <th scope="row"> <div class="siteseo-container">'; $is_first = true; foreach($google_analytics_fileds as $post_key => $post_val){ $active_class = $is_first ? 'active' : ''; echo '<a href="#'.esc_attr($post_key).'" class="'.esc_attr($active_class).'">'.esc_html($post_val).'</a>'; $is_first = false; } echo '</div></th> <td> <div id="general-settings"> <h3>'.esc_html__('Google Anlytics', 'siteseo').'</h3> <div class="siteseo_wrap_label"><p class="description">'.esc_html__('Connect your Google Analytics to your website. The tracking code will be automatically added to your site.', 'siteseo') .'</p></div> <span class="line"></span> <div class="siteseo_wrap_label"><p class="'.esc_html__('description">Link your Google Analytics to your website. The tracking code will be automatically added to your site', 'siteseo').'</p></div> <span class="line"></span> <table class="form-table"> <tbody> <tr> <th scope="row">'.esc_html__('General', 'siteseo').'</th> <td></td> </tr> <tr> <th scope="row">'.esc_html__('Enable Google Analytics tracking', 'siteseo').'</th> <td> <label><input type="checkbox" name="siteseo_options[google_anlytics_tracking]" '.(!empty($option_enable_anaytics) ? 'checked="yes"' : '') . ' value="1"/> ' . esc_html__('Activate Google Analytics tracking using the Global Site Tag (gtag.js).', 'siteseo') . '</label> </td> </tr> <tr> <th scope="row">'.esc_html__('Enter your measurement ID (GA4)', 'siteseo').'</th> <td> <input type="text" placeholder="'.esc_attr('Enter your measurement ID (G-XXXXXXXXXX)','siteseo').'" name="siteseo_options[anlytics_measurement_id]" value="'.esc_attr($option_anaytics_id).'"> <p> <span class="dashicons dashicons-external"></span> <a href="https://support.google.com/analytics/answer/9539598?hl=en&ref_topic=9303319" target="_blank">'.esc_html__('Find your measurement ID', 'siteseo').'</a> </p> </td> </tr> </tbody> </table> </div></div> <div id="tracking-settings"> <span class="line"></span> <h3>'.esc_html__('Tracking','siteseo').'</h3> <p class="description">'.esc_html__('Set up your Google Analytics tracking code.', 'siteseo').'</P> <table class="form-table"> <tbody> <tr> <th scope="row">'.esc_html__('Enable Google Optimize.', 'siteseo').'</th> <td> <label> <input type="text" name="siteseo_options[container_id]" placeholder="'.esc_attr__('Enter your Google Optimize container ID.', 'siteseo').'" value="'.esc_attr($option_container_id).'"/> </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Enable Google Ads','siteseo').'</th> <td> <label> <input type="text" placeholder="'.esc_attr__('Enter your Google Ads conversion ID (eg: AW-123456789).', 'siteseo').'" name="siteseo_options[conversion_id]" value="'.esc_attr($option_conversion_id).'"/> </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Enable remarketing, demographics, and interests reporting', 'siteseo').'</th> <td> <label> <input type="checkbox" name="siteseo_options[enable_remarketing]" '.(!empty($option_enable_remarketing) ? 'checked="yes"' : '').' value="1"/> '. esc_html__('Enable remarketing, demographics, and interests reporting', 'siteseo').' </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Enable IP Anonymization', 'siteseo').'</th> <td> <label> <input type="checkbox" name="siteseo_options[ip_anonymiza]" '.(!empty($option_ip_anonymization) ? 'checked="yes"' : '').'/> '. esc_html__('Enable IP Anonymization', 'siteseo') .' </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Enhanced Link Attribution', 'siteseo').'</th> <td> <label> <input type="checkbox" name="siteseo_options[link_attribution]" '.(!empty($option_links_attribution) ? 'checked="yes"' : '').'/> '. esc_html__('Enhanced Link Attribution', 'siteseo').' </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Enable cross-domain tracking', 'siteseo').'</th> <td> <label> <input type="checkbox" name="siteseo_options[domain_tracking]" '.(!empty($option_domain_tracking) ? 'checked="yes"' : '').' /> '. esc_html__('Enable cross-domain tracking', 'siteseo').' </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Cross domains', 'siteseo').'</th> <td> <input type="text" placeholder="Enter your domains: siteseo.io,sub.siteseo.io,sub2.siteseo.io" name="siteseo_options[cross_domain]" value="'.esc_attr($option_cross_domain).'" /> </td> </tr> </tbody> <table> </div> <div id="events-settings"> <span class="line"></span> <h3>'.esc_html__('Events', 'siteseo').'</h3> <P class="description">'.esc_html__('Track events in Google Analytics', 'siteseo').'</p> <table class="form-table"> <tbody> <tr> <th scope="row">'.esc_html__('Enable Google Optimize', 'siteseo').'</th> <td> <label> <input type="checkbox" name="siteseo_options[google_optimize]" '.(!empty($option_enable_optimize) ? 'checked="yes"' : ''). ' value="1">' . esc_html__(' Enable external links tracking', 'siteseo') . ' </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Enable downloads tracking (eg: PDF, XLSX, DOCX...)', 'siteseo').'</th> <td> <label> <input type="checkbox" name="siteseo_options[enable_download_tracking]" '.(!empty($option_enable_download_tracking) ? 'checked="yes"' : '').' value="1"> '.esc_html__('Enable download tracking', 'siteseo').' </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Track downloads clicks', 'siteseo').'</th> <td> <input type="text" placeholder="pdf|docs|pptx|zip" name="siteseo_options[track_downlaods]" value="'.esc_attr($option_download_tracking).'"/> <p class="description">'.esc_html__('Separate each file type extensions with a pipe "|"','siteseo').'</p> </td> </tr> <tr> <th scope="row">'.esc_html__('Enable affiliate/outbound links tracking (eg: aff, go, out, recommends)', 'siteseo').'</th> <td> <label> <input type="checkbox" name="siteseo_options[aff_tracking_enable]" '.(!empty($option_affiliate_tracking_enable ) ? 'checked="yes"' : '').' value="1"/> '. esc_html__('Enable affiliate/outbound tracking','siteseo') .'</label> </td> </tr> <tr> <th scope="row">'.esc_html__('Track affiliate/outbound links','siteseo').'</th> <td> <input type="text" name="siteseo_options[aff_tracking]" placeholder="aff|go|out" value="'.esc_attr($option_affiliate_tracking).'"/> <p class="description">'.esc_html__('Separate each keyword with a pipe "|"', 'siteseo').'</p> </td> </tr> <tr> <th scope="row">'.esc_html__('Track phone links','siteseo').'</th> <td> <input type="checkbox" name="siteseo_options[track_phones]" '.(!empty($option_phone_tracking ) ? 'checked="yes"' : '') . ' value="1"/> '.esc_html__(' Enable tracking of "tel:" links' , 'siteseo'). ' <div class="siteseo-styles pre"><pre>'.esc_html('<a href="tel:+33123456789">','siteseo').'</pre></div> </td> </tr> </tbody> </table </div> </td> </tbody> </table> <input type="hidden" name="siteseo_options[analytics_tab]" value="1"/>'; } static function save_settings(){ global $siteseo; check_admin_referer('siteseo_analytics_settings'); if(!siteseo_user_can('manage_analytics') || !is_admin()){ return; } $options = []; if(!empty($_post['siteseo_options'])){ return; } if(isset($_POST['siteseo_options']['analytics_tab'])){ $options['google_analytics_enable'] = isset($_POST['siteseo_options']['google_anlytics_tracking']); $options['google_analytics_ga4'] = isset($_POST['siteseo_options']['anlytics_measurement_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['anlytics_measurement_id'])) : ''; $options['google_analytics_link_tracking_enable'] = isset($_POST['siteseo_options']['google_optimize']); $options['google_analytics_download_tracking_enable'] = isset($_POST['siteseo_options']['enable_download_tracking']); $options['google_analytics_download_tracking'] = isset($_POST['siteseo_options']['track_downlaods']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['track_downlaods'])) : ''; $options['google_analytics_affiliate_tracking_enable'] = isset($_POST['siteseo_options']['aff_tracking_enable']); $options['google_analytics_affiliate_tracking'] = isset($_POST['siteseo_options']['aff_tracking']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['aff_tracking'])) : ''; $options['google_analytics_phone_tracking'] = isset($_POST['siteseo_options']['track_phones']); $options['google_analytics_optimize'] = isset($_POST['siteseo_options']['container_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['container_id'])) : ''; $options['google_analytics_ads'] = isset($_POST['siteseo_options']['conversion_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['conversion_id'])) : ''; $options['google_analytics_remarketing'] = isset($_POST['siteseo_options']['enable_remarketing']); $options['google_analytics_ip_anonymization'] = isset($_POST['siteseo_options']['ip_anonymiza']); $options['google_analytics_link_attribution'] = isset($_POST['siteseo_options']['link_attribution']); $options['google_analytics_cross_enable'] = isset($_POST['siteseo_options']['domain_tracking']); $options['google_analytics_cross_domain'] = isset($_POST['siteseo_options']['cross_domain']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cross_domain'])) : ''; } if(isset($_POST['siteseo_options']['clarity_tab'])){ $options['google_analytics_clarity_enable'] = isset($_POST['siteseo_options']['microsoft_clarity']); $options['google_analytics_clarity_project_id'] = isset($_POST['siteseo_options']['project_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['project_id'])) : ''; } if(isset($_POST['siteseo_options']['matomo_tab'])){ $options['google_analytics_matomo_enable'] = isset($_POST['siteseo_options']['enable_matomo']); $options['google_analytics_matomo_self_hosted'] = isset($_POST['siteseo_options']['self_hosted']); $options['google_analytics_matomo_id'] = isset($_POST['siteseo_options']['tracking_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['tracking_id'])) : ''; $options['google_analytics_matomo_site_id'] = isset($_POST['siteseo_options']['site_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['site_id'])) : ''; $options['google_analytics_matomo_subdomains'] = isset($_POST['siteseo_options']['track_visitors']); $options['google_analytics_matomo_site_domain'] = isset($_POST['siteseo_options']['site_domain']); $options['google_analytics_matomo_cross_domain'] = isset($_POST['siteseo_options']['enable_cross_domains']); $options['google_analytics_matomo_no_js'] = isset($_POST['siteseo_options']['track_users']); $options['google_analytics_matomo_cross_domain_sites'] = isset($_POST['siteseo_options']['corss_domains']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['corss_domains'])) : ''; $options['google_analytics_matomo_no_cookies'] = isset($_POST['siteseo_options']['disabled_cookies']); $options['google_analytics_matomo_link_tracking'] = isset($_POST['siteseo_options']['outlink_tracking']); $options['google_analytics_matomo_no_heatmaps'] = isset($_POST['siteseo_options']['disabled_heatmaps']); $options['google_analytics_matomo_dnt'] = isset($_POST['siteseo_options']['enable_donottack']); } if(isset($_POST['siteseo_options']['advanced_tab'])){ $options['google_analytics_cd_author'] = isset($_POST['siteseo_options']['track_authors']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['track_authors'])) : ''; $options['google_analytics_cd_category'] = isset($_POST['siteseo_options']['track_categories']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['track_categories'])) : ''; $options['google_analytics_cd_tag'] = isset($_POST['siteseo_options']['track_tags']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['track_tags'])) : ''; $options['google_analytics_cd_post_type'] = isset($_POST['siteseo_options']['track_post_types']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['track_post_types'])) : ''; $options['google_analytics_cd_logged_in_user'] = isset($_POST['siteseo_options']['track_user']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['track_user'])) : ''; // mics roles if(isset($_POST['siteseo_options']['misc_roles'])){ $options['google_analytics_roles'] = map_deep(wp_unslash($_POST['siteseo_options']['misc_roles']), 'sanitize_text_field'); } } if(isset($_POST['siteseo_options']['custom_tracking_tab']) && current_user_can('unfiltered_html')){ // NOTE: These options can not be sanitized as we need user to be able to add some JS code, so we have added a capability check which only a super admin can have. $options['google_analytics_other_tracking'] = isset($_POST['siteseo_options']['head_tracking']) ? wp_unslash($_POST['siteseo_options']['head_tracking']) : ''; $options['google_analytics_other_tracking_body'] = isset($_POST['siteseo_options']['body_tracking']) ? wp_unslash($_POST['siteseo_options']['body_tracking']) : ''; $options['google_analytics_other_tracking_footer'] = isset($_POST['siteseo_options']['footer_tracking']) ? wp_unslash($_POST['siteseo_options']['footer_tracking']) : ''; } if(isset($_POST['siteseo_options']['cookies_tab'])){ $options['google_analytics_hook'] = isset($_POST['siteseo_options']['cookie_pos']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cookie_pos'])) : ''; $options['google_analytics_disable'] = isset($_POST['siteseo_options']['opt_tracking']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['opt_tracking'])) : ''; $options['google_analytics_half_disable'] = isset($_POST['siteseo_options']['half_disable']); $options['google_analytics_opt_out_edit_choice'] = isset($_POST['siteseo_options']['opt_edit_choices']); $options['google_analytics_opt_out_msg'] = isset($_POST['siteseo_options']['opt_msg']) ? wp_kses_post(wp_unslash($_POST['siteseo_options']['opt_msg'])) : 'We use cookies to enhance your experience.'; $options['google_analytics_opt_out_msg_ok'] = isset($_POST['siteseo_options']['opt_msg_ok']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['opt_msg_ok'])) : 'Accept'; $options['google_analytics_opt_out_msg_edit'] = isset($_POST['siteseo_options']['opt_edit_btn']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['opt_edit_btn'])) : 'Manage cookies'; $options['google_analytics_opt_out_msg_close'] = isset($_POST['siteseo_options']['opt_close']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['opt_close'])) : 'X'; $options['google_analytics_cb_exp_date'] = isset($_POST['siteseo_options']['cd_exp_date']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cd_exp_date'])) : '30'; $options['google_analytics_cb_pos'] = isset($_POST['siteseo_options']['cd_pos']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cd_pos'])) : 'center'; $options['google_analytics_cb_txt_align'] = isset($_POST['siteseo_options']['cd_txt_align']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cd_txt_align'])) : 'center'; $options['google_analytics_cb_width'] = isset($_POST['siteseo_options']['cd_width']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cd_width'])) : '100%'; $options['google_analytics_cb_scheme'] = isset($_POST['siteseo_options']['google_analytics_cb_scheme']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['google_analytics_cb_scheme'])) : ''; // Colors $options['google_analytics_cb_backdrop'] = isset($_POST['siteseo_options']['cd_backdrop']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cd_backdrop'])) : ''; $options['google_analytics_cb_backdrop_bg'] = isset($_POST['siteseo_options']['backdrop_bg']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['backdrop_bg'])) : ''; $options['google_analytics_cb_bg'] = isset($_POST['siteseo_options']['cookiesbar_bg']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cookiesbar_bg'])) : ''; $options['google_analytics_cb_txt_col'] = isset($_POST['siteseo_options']['cookiebar_txt']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cookiebar_txt'])) : ''; $options['google_analytics_cb_lk_col'] = isset($_POST['siteseo_options']['line_co']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['line_co'])) : ''; $options['google_analytics_cb_btn_bg'] = isset($_POST['siteseo_options']['primary_btn_bg']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['primary_btn_bg'])) : ''; $options['google_analytics_cb_btn_bg_hov'] = isset($_POST['siteseo_options']['primary_btn_bg_hov']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['primary_btn_bg_hov'])) : ''; $options['google_analytics_cb_btn_col'] = isset($_POST['siteseo_options']['primary_btn_txt']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['primary_btn_txt'])) : ''; $options['google_analytics_cb_btn_col_hov'] = isset($_POST['siteseo_options']['primary_btn_txt_hov']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['primary_btn_txt_hov'])) : ''; $options['google_analytics_cb_btn_sec_bg'] = isset($_POST['siteseo_options']['sec_btn_bg']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['sec_btn_bg'])) : ''; $options['google_analytics_cb_btn_sec_bg_hov'] = isset($_POST['siteseo_options']['sec_btn_bg_hov']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['sec_btn_bg_hov'])) : ''; $options['google_analytics_cb_btn_sec_col'] = isset($_POST['siteseo_options']['sec_btn_txt']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['sec_btn_txt'])) : ''; $options['google_analytics_cb_btn_sec_col_hov'] = isset($_POST['siteseo_options']['sec_btn_txt_hov']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['sec_btn_txt_hov'])) : ''; } update_option('siteseo_google_analytics_option_name', $options); } } settings/onboarding.php 0000644 00000047706 15100371032 0011245 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO\Settings; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class OnBoarding{ static $current_step = ''; static $import_options = []; static $steps = []; static $current_step_no = 1; static function init(){ if(wp_doing_ajax()){ return; } self::$steps = [ 'your-site' => [ 'title' => 'Your Site', 'desc' => 'Your site and social data', 'fn' => '\SiteSEO\Settings\OnBoarding::site_page', ], 'indexing' => [ 'title' => 'Indexing', 'desc' => 'Select post type indexing', 'fn' => '\SiteSEO\Settings\OnBoarding::indexing_page', ], 'advanced' => [ 'title' => 'Advanced', 'desc' => 'URL configuration', 'fn' => '\SiteSEO\Settings\OnBoarding::advanced_page', ], 'ready' => [ 'title' => 'Ready', 'desc' => 'All set now!', 'fn' => '\SiteSEO\Settings\OnBoarding::ready_page', ], ]; $active_plugins = get_option('active_plugins', []); $importable_plugins = Util::importable_plugins(); $importable_plugins = array_keys($importable_plugins); $importable_found = array_intersect($active_plugins, $importable_plugins); if(!empty($importable_found)){ $import_step = [ 'import' => [ 'title' => 'Import', 'desc' => 'Importing meta data', 'fn' => '\SiteSEO\Settings\OnBoarding::import_page', ] ]; self::$steps = array_merge($import_step, self::$steps); self::$import_options = $importable_found; } self::$current_step = !empty($_REQUEST['step']) ? sanitize_text_field(wp_unslash($_REQUEST['step'])) : ''; remove_all_actions('admin_notices'); remove_all_actions('all_admin_notices'); remove_all_actions('network_admin_notices'); add_action('admin_menu', '\SiteSEO\Settings\OnBoarding::add_to_menu'); add_action('admin_init', '\SiteSEO\Settings\OnBoarding::page'); } static function enqueue_assets(){ wp_enqueue_media(); wp_enqueue_script('siteseo-onboarding', SITESEO_ASSETS_URL . '/js/onboarding.js', ['jquery'], SITESEO_VERSION, true); wp_enqueue_style('siteseo-onboarding' , SITESEO_ASSETS_URL . '/css/onboarding.css', [], SITESEO_VERSION); wp_add_inline_script('siteseo-onboarding', "let siteseo_onboarding = ".wp_json_encode([ 'nonce' => wp_create_nonce('siteseo_admin_nonce'), 'ajax_url' => admin_url('admin-ajax.php'), ])); } static function add_to_menu(){ add_submenu_page('', __('SiteSEO Onboarding', 'siteseo'), 'Onboarding', 'siteseo_manage', 'siteseo-onboarding', 'SiteSEO\Settings\Onboarding::wizard'); } static function page(){ self::enqueue_assets(); ob_start(); ?><!DOCTYPE html> <html <?php language_attributes();?>> <?php echo'<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>'.esc_html__('SiteSEO OnBoarding', 'siteseo').'</title>'; wp_print_head_scripts(); wp_print_styles('siteseo-onboarding'); echo '</head> <body>'; self::wizard(); if(function_exists('wp_print_media_templates')){ wp_print_media_templates(); } wp_print_footer_scripts(); wp_print_scripts('siteseo-onboarding'); echo '</body> </html>'; die(); } static function wizard(){ echo '<div id="siteseo-onboarding-root"> <div class="siteseo-onboarding-nav-wrapper"> <nav> <div class="content"> <div class="header"> <img src="'.esc_url(SITESEO_ASSETS_URL) .'/img/siteseo-white.png" height="40"/> <a href="'.esc_url(admin_url('?page=siteseo')).'" title="'.esc_attr__('Exit to SiteSEO Dashboard', 'siteseo').'"><svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#fff"><path d="M200-120q-33 0-56.5-23.5T120-200v-160h80v160h560v-560H200v160h-80v-160q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm220-160-56-58 102-102H120v-80h346L364-622l56-58 200 200-200 200Z"/></svg></a> </div>'; $step_count = 1; echo '<div class="steps">'; foreach(self::$steps as $step_slug => $step){ echo '<div class="step"> <div class="step-milestone" data-step="'.esc_attr($step_count).'" data-step-slug="'.esc_attr($step_slug).'"></div> <div class="step-info"><span>'.esc_html($step['title']).'</span><span class="description">'.esc_html($step['desc']).'</span></div> </div>'; $step_count++; } echo ' </div> </div> <div class="footer">A Softaculous Product</div> </nav> </div> <main> <div class="siteseo-onboarding-content">'; self::welcome_page(); foreach(self::$steps as $step){ call_user_func($step['fn']); self::$current_step_no++; // increasing the step number after we have rendered the step page. } echo '</div> </main> </div>'; } static function welcome_page(){ $is_active = empty(self::$current_step) ? 'siteseo-step-active' : ''; echo '<div class="siteseo-step-page siteseo-step-is-welcome '.esc_attr($is_active).'" data-step="welcome"> <h1>'.esc_html__('Welcome to the SiteSEO Setup Wizard', 'siteseo').'</h1> <p>'.esc_html__('This wizard will guide you through setting up SiteSEO and help you get started in no time.', 'siteseo').'</p> <button class="siteseo-btn primary" id="siteseo-onboarding-begin" style="margin-top:20px">'.esc_html__('Let\'s begin!', 'siteseo').'</button> </div>'; } static function import_page(){ $is_active = !empty(self::$current_step) && self::$current_step == 'import' ? 'siteseo-step-active' : ''; echo '<div class="siteseo-step-page '.esc_attr($is_active).'" data-step="import"> <span>Step '.esc_html(self::$current_step_no).' of '.count(self::$steps).'</span> <h1>'.esc_html__('Import data from your current SEO plugin', 'siteseo').'</h1> <p>'.esc_html__('SiteSEO has detected the presence of other SEO plugins. To ensure a smooth transition, please select the plugins you wish to import SEO data from', 'siteseo').'</p> <div class="siteseo-onboarding-import-plugins">'; $importable_plugins = Util::importable_plugins(); echo '<form><div class="siteseo-radio-input">'; foreach(self::$import_options as $plugin){ $id = strtolower(str_replace(' ', '-', $plugin)); echo '<input type="radio" name="plugin_name" value="'.esc_attr($id).'" id="'.esc_attr($id).'"/> <label for="'.esc_attr($id).'">'.esc_html($importable_plugins[$plugin]).'</label>'; } echo '</div> <div class="siteseo-onboarding-import-info"> <details> <summary>'.esc_html__('What will be imported?', 'siteseo').'</summary> <ul> <li>'. esc_html__('Title tags', 'siteseo') .'</li> <li>'. esc_html__('Meta description', 'siteseo') .'</li> <li>'. esc_html__('Facebook Open Graph tags (title, description and image thumbnail)', 'siteseo') .'</li> <li>'. esc_html__('Twitter tags (title, description and image thumbnail)', 'siteseo') .'</li> <li>'. esc_html__('Meta Robots (noindex, nofollow...)', 'siteseo') .'</li> <li>'. esc_html__('Canonical URL', 'siteseo').'</li> <li>'. esc_html__('Focus / target keywords', 'siteseo') .'</li> </ul> </details> <button class="siteseo-btn primary" id="siteseo-do-import">Import</button> <p class="siteseo-onboarding-msg"></p> </div> </form> <div class="siteseo-onboarding-content-footer"> <button class="siteseo-skip-step siteseo-btn secondary">'.esc_html__('Skip Step', 'siteseo').'</button><button class="siteseo-btn primary siteseo-skip-step">'.esc_html__('Next Step', 'siteseo').'</button> </div> </div> </div>'; } static function site_page(){ $title_options = get_option('siteseo_titles_option_name', []); $social_options = get_option('siteseo_social_option_name', []); $site_name = !empty($title_options['titles_home_site_title']) ? $title_options['titles_home_site_title'] : '%%sitetitle%%'; $alt_site_name = !empty($title_options['titles_home_site_title_alt']) ? $title_options['titles_home_site_title_alt'] : ''; $site_type = !empty($social_options['social_knowledge_type']) ? $social_options['social_knowledge_type'] : ''; $org_name = !empty($social_options['social_knowledge_name']) ? $social_options['social_knowledge_name'] : ''; $org_img = !empty($social_options['social_knowledge_img']) ? $social_options['social_knowledge_img'] : ''; $fb_url = !empty($social_options['social_accounts_facebook']) ? $social_options['social_accounts_facebook'] : ''; $x_account = !empty($social_options['social_accounts_twitter']) ? $social_options['social_accounts_twitter'] : ''; $additional_url = !empty($social_options['social_accounts_additional']) ? implode("\n", $social_options['social_accounts_additional']) : ''; $is_active = !empty(self::$current_step) && self::$current_step == 'your-site' ? 'siteseo-step-active' : ''; echo '<div class="siteseo-step-page '.esc_attr($is_active).'" data-step="your-site"> <span>Step '.esc_html(self::$current_step_no).' of '.count(self::$steps).'</span> <h1>Your Site: '.esc_html(get_bloginfo('name')).'</h1> <p>'.esc_html__('We need some basic information about your site, so we can built up the knowledge graph', 'siteseo').'</p> <form> <div class="siteseo-input-block"> <label>'.esc_html__('Website Name', 'siteseo').'</label> <input type="text" name="website_name" value="'.esc_attr($site_name).'"/> <p class="siteseo-input-description">'.esc_html__('Enter the name of your site as it should appear in search results, %%sitetitle%% is a dynamic variable for your site title', 'siteseo').'</p> </div> <div class="siteseo-input-block"> <label>'.esc_html__('Altername sitename', 'siteseo').'</label> <input type="text" name="alternate_site_name" value="'.esc_attr($alt_site_name).'" placeholder="Alternate site name"/> <p class="siteseo-input-description">'.esc_html__('The website\'s alternate name, like a common acronym or shorter version, if applicable.', 'siteseo').'</p> </div> <div class="siteseo-input-block"> <label>'.esc_html__('Is your site about an Organization or a Person?', 'siteseo').'</label> <select type="text" name="site_type"> <option value="Person" '.selected($site_type, 'Person', false).'>Person</option> <option value="Organization" '.selected($site_type, 'Organization', false).'>Organization</option> </select> </div> <div class="siteseo-input-block"> <label>'.esc_html__('Your/Organization name', 'siteseo').'</label> <input type="text" name="organization_name" placeholder="eg:. My Company Name" value="'.esc_attr($org_name).'"/> </div> <div class="siteseo-input-block"> <label>'.esc_html__('Organization Logo', 'siteseo').'</label> <button id="siteseo-onboarding-img-holder"> <img src="'.esc_url($org_img).'"/> <svg xmlns="http://www.w3.org/2000/svg" height="50px" viewBox="0 -960 960 960" width="50px" fill="#5f6368" style="'.(!empty($org_img) ? 'display:none;' : '').'"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"/></svg></button> <p class="siteseo-input-description">'.esc_html__('A square image is preferred, with a minimum size of 112x112 pixels.', 'siteseo').'</p> <input type="hidden" name="organization_logo" value="'.esc_url($org_img).'"/> <button class="siteseo-btn primary" id="siteseo-upload-org-img" style="align-self:flex-start">'.esc_html__('Select Image', 'siteseo').'</button> </div> <h4>Social Details</h4> <div class="siteseo-input-block"> <label>'.esc_html__('Facebook page URL', 'siteseo').'</label> <input type="text" name="social_fb" value="'.esc_url($fb_url).'" placeholder="eg: https://facebook.com/my-page-url"/> </div> <div class="siteseo-input-block"> <label>'.esc_html__('X Username', 'siteseo').'</label> <input type="text" name="social_x" value="'.esc_attr($x_account).'" placeholder="eg: @x_account"/> </div> <div class="siteseo-input-block"> <label>'.esc_html__('Additional Accounts', 'siteseo').'</label> <textarea rows="3" name="social_additional" placeholder="eg:https://somesocial.com/my-page">'.esc_textarea($additional_url).'</textarea> <p class="siteseo-input-description">'.esc_html__('Enter 1 URL per line.', 'siteseo').'</p> </div> <div class="siteseo-onboarding-content-footer"> <button class="siteseo-skip-step siteseo-btn secondary">'.esc_html__('Skip Step', 'siteseo').'</button><button class="siteseo-btn primary siteseo-save-n-continue">'.esc_html__('Save and Continue', 'siteseo').'<span class="siteseo-spinner"></span></button> </div> </form> </div>'; } static function indexing_page(){ $is_active = !empty(self::$current_step) && self::$current_step == 'indexing' ? 'siteseo-step-active' : ''; $post_types = get_post_types(['public' => true, 'show_ui' => true], 'objects', 'and'); unset($post_types['attachment']); $taxonomies = get_taxonomies(['public' => true, 'show_ui' => true], 'objects', 'and'); echo '<div class="siteseo-step-page '.esc_attr($is_active).'" data-step="indexing"> <span>Step '.esc_html(self::$current_step_no).' of '.count(self::$steps).'</span> <h1>Indexing</h1> <p>'.esc_html__('Let us know which parts of your website you’d like to be crawled.', 'siteseo').'</p> <form method="POST"> <div class="siteseo-input-block"> <label>'.esc_html__('Is your site under construction or live?', 'siteseo').'</label> <div class="siteseo-radiogroup"> <label><input type="radio" name="site_status" value="underconstruction"/>Under Construction</label> <label><input type="radio" name="site_status" value="live" checked/>Live</label> </div> <p class="siteseo-input-description">'.esc_html__('If your site is under construction then Search Engines will be discouraged to crawl your site by adding noindex metatag attribute and sitemap will be disabled.', 'siteseo').'</p> </div> <div class="siteseo-live-site-options" style="margin-top:35px;"> <p>'.esc_html__('Choose items to exclude from search results', 'siteseo').'</p> <div class="siteseo-input-block"> <label>'.esc_html__('Post Types', 'siteseo').'</label> <div class="siteseo-radiogroup">'; if(!empty($post_types)){ foreach($post_types as $post){ echo '<div><input type="checkbox" name="post_types" value="'.esc_attr($post->name).'" id="post_type_'.esc_attr($post->name).'"/> <label for="post_type_'.esc_attr($post->name).'">'.esc_html($post->label).'</label> </div>'; } echo '<p class="siteseo-input-description">'.esc_html__('Discourage search engines from indexing these post types.', 'siteseo').'</p>'; } else { echo '<p class="siteseo-input-description">'.esc_html__('No post type found.', 'siteseo').'</p>'; } //TODO:: Will need to add options for Archive as well echo '</div> </div> <div class="siteseo-input-block"> <label>'.esc_html__('Taxonomies', 'siteseo').'</label> <div class="siteseo-radiogroup">'; if(!empty($taxonomies)){ foreach($taxonomies as $taxonomy){ echo '<div><input type="checkbox" name="taxonomies" value="'.esc_attr($taxonomy->name).'" id="taxonomy_'.esc_attr($taxonomy->name).'"/> <label for="taxonomy_'.esc_attr($taxonomy->name).'">'.esc_html($taxonomy->label).'</label> </div>'; } echo '<p class="siteseo-input-description">'.esc_html__('Discourage search engines from indexing these taxonomies.', 'siteseo').'</p> <p class="siteseo-input-description">'.esc_html__('Note: We strongly recommend disabling the indexing of tags to avoid potential duplicate content issues that could negatively impact your site\'s SEO.', 'siteseo').'</p>'; } else { echo '<p class="siteseo-input-description">'.esc_html__('No taxonomy found.', 'siteseo').'</p>'; } echo '</div> </div> </div> <div class="siteseo-onboarding-content-footer"> <button class="siteseo-skip-step siteseo-btn secondary">'.esc_html__('Skip Step', 'siteseo').'</button><button class="siteseo-btn primary siteseo-save-n-continue">'.esc_html__('Save and Continue', 'siteseo').'<span class="siteseo-spinner"></span></button> </div> </form> </div>'; } static function advanced_page(){ $is_active = !empty(self::$current_step) && self::$current_step == 'advanced' ? 'siteseo-step-active' : ''; echo '<div class="siteseo-step-page '.esc_attr($is_active).'" data-step="advanced"> <span>Step '.esc_html(self::$current_step_no).' of '.count(self::$steps).'</span> <h1>Advanced Options</h1> <p>'.esc_html__('We\'re nearly there—just a few final optimizations left!', 'siteseo').'</p> <form method="POST"> <div class="siteseo-input-block"> <div class="siteseo-radiogroup"> <label><input type="checkbox" name="universal_metabox" checked/>Enable Universal Metabox</label> </div> <p class="siteseo-input-description">'.esc_html__('Universal metabox makes SiteSEO on page content SEO helper compatible with every Page Builder, so if you are not using Gutenberg then this is a must.', 'siteseo').'</p> </div> <div class="siteseo-input-block"> <div class="siteseo-radiogroup"> <label><input type="checkbox" name="author_noindex"/>'.esc_html__('Don\'t let search engines index author archive pages', 'siteseo').'</label> </div> <p class="siteseo-input-description">'.esc_html__('Recommended: Enable this option if you are the sole author of the site to prevent duplicate content on author archive pages.', 'siteseo').'</p> </div> <div class="siteseo-input-block"> <div class="siteseo-radiogroup"> <label><input type="checkbox" name="redirect_attachment"/>'.esc_html__('Redirect attachment pages to the file itself', 'siteseo').'</label> </div> <p class="siteseo-input-description">'.esc_html__('By default SiteSEO redirects to the parent post.', 'siteseo').'</p> </div> <div class="siteseo-input-block"> <div class="siteseo-radiogroup"> <label><input type="checkbox" name="category_url"/>'.esc_html__('Remove /category/ in your permalinks', 'siteseo').'</label> </div> <p class="siteseo-input-description">'.esc_html__('This reduces the length of the URL.', 'siteseo').'</p> </div> <div class="siteseo-onboarding-content-footer"> <button class="siteseo-skip-step siteseo-btn secondary">'.esc_html__('Skip Step', 'siteseo').'</button><button class="siteseo-btn primary siteseo-save-n-continue">'.esc_html__('Save and Continue', 'siteseo').'<span class="siteseo-spinner"></span></button> </div> </form> </div>'; } static function ready_page(){ $is_active = !empty(self::$current_step) && self::$current_step == 'ready' ? 'siteseo-step-active' : ''; echo '<div class="siteseo-step-page '.esc_attr($is_active).'" data-step="ready"> <span>Step '.esc_html(self::$current_step_no).' of '.count(self::$steps).'</span> <h1>Done! 🎉</h1> <p>'.esc_html__('We are done with the setup, now you can start making content and submit the Sitemap to the search engines.', 'siteseo').'</p> <h4>'.esc_html__('What Next?', 'siteseo').'</h4> <ol style="margin:0"> <li><a href="?page=siteseo-sitemaps" target="_blank">'.esc_html__('Configure your Sitemap', 'siteseo').'</a></li> <li>'.esc_html__('Submit yours sitemap to search engines', 'siteseo').'</li> </ol> <h4>'.esc_html__('You can also, subscribe to our newletter', 'siteseo').'</h4> '.esc_html__('You will get', 'siteseo').' <ul style="list-style-type:none"> <li><span class="dashicons dashicons-minus"></span> '.esc_html__('Alerted about Google Algorithm changes.', 'siteseo').'</li> <li><span class="dashicons dashicons-minus"></span> '.esc_html__('Updates about our products.', 'siteseo').'</li> <li><span class="dashicons dashicons-minus"></span> '.esc_html__('Improve SEO of your website with our resourceful blogs.', 'siteseo').'</li> </ul> <a class="siteseo-btn secondary" href="https://siteseo.io/subscribe/" style="align-self:flex-start;" target="_blank">'.esc_html__('Subscribe', 'siteseo').'</a> <div class="siteseo-onboarding-content-footer"> <a href="'.esc_url(admin_url()).'"class="siteseo-btn primary">Go to Dashboard</a> <a href="?page=siteseo"class="siteseo-btn primary">Review Settings</a> <a href="https://siteseo.io/docs/" class="siteseo-btn primary" target="_blank">Knowledge Base</a> </div> </div>'; } } settings/sitemap.php 0000644 00000047016 15100371032 0010557 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO\Settings; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Sitemap{ static function menu(){ global $siteseo; $sitemap_toggle = isset($siteseo->setting_enabled['toggle-xml-sitemap']) ? $siteseo->setting_enabled['toggle-xml-sitemap'] : ''; $nonce = wp_create_nonce('siteseo_toggle_nonce'); $current_tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : 'tab_sitemap_general'; // Default tab $titles_meta_subtabs = [ 'tab_sitemap_general' => esc_html__('Home', 'siteseo'), 'tab_sitemap_post_types' => esc_html__('Post types', 'siteseo'), 'tab_sitemap_taxonomy ' => esc_html__('Taxonomy', 'siteseo'), 'tab_sitmap_html' => esc_html__('HTML Sitemap', 'siteseo') ]; echo '<div id="siteseo-root">'; Util::admin_header(); echo '<form method="post" id="siteseo-form" class="siteseo-option" name="siteseo-flush">'; wp_nonce_field('siteseo_sitemap_settings'); Util::render_toggle('Sitemaps - SiteSEO', 'sitemap_toggle', $sitemap_toggle, $nonce); echo '<div id="siteseo-tabs" class="wrap"> <div class="nav-tab-wrapper">'; foreach($titles_meta_subtabs as $tab_key => $tab_caption){ $active_class = ($current_tab === $tab_key) ? ' nav-tab-active' : ''; echo '<a id="' . esc_attr($tab_key) . '-tab" class="nav-tab' . esc_attr($active_class) . '" data-tab="' . esc_attr($tab_key) . '">' . esc_html($tab_caption) . '</a>'; } echo '</div> <div class="tab-content-wrapper"> <div class="siteseo-tab' .($current_tab == 'tab_sitemap_general' ? ' active' : '').'" id="tab_sitemap_general" style="display: none;">'; self::general_sitemaps(); echo '</div> <div class="siteseo-tab' .($current_tab == 'tab_sitemap_post_types' ? ' active' : '').'" id="tab_sitemap_post_types" style="display: none;">'; self::post_types_sitemaps(); echo '</div> <div class="siteseo-tab' .($current_tab == 'tab_sitemap_taxonomy' ? ' active' : '').'" id="tab_sitemap_taxonomy" style="display: none;">'; self::taxonomy_sitemap(); echo '</div> <div class="siteseo-tab' .($current_tab == 'tab_sitmap_html' ? ' active' : '').'" id="tab_sitmap_html" style="display: none;">'; self::html_sitemap(); echo '</div> </div>'; Util::submit_btn(); echo '</form></div>'; } static function general_sitemaps(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->sitemap_settings; $options = get_option('siteseo_xml_sitemap_option_name', []); $xml_sitemap = !empty($options['xml_sitemap_general_enable']) ? $options['xml_sitemap_general_enable'] : ''; $img_sitemap = !empty($options['xml_sitemap_img_enable']) ? $options['xml_sitemap_img_enable'] : ''; $author_sitemap = !empty($options['xml_sitemap_author_enable']) ? $options['xml_sitemap_author_enable'] : ''; $html_sitemap = !empty($options['xml_sitemap_html_enable']) ? $options['xml_sitemap_html_enable'] : ''; echo '<h3 class="siteseo-tabs">'.esc_html__('General','siteseo').'</h3> <p>'.esc_html__('Sitemaps are pages which help search engine, know your site better and makes it easier for them to index the pages.','siteseo').'</p> <p>'.esc_html__('Not having a sitemap does not mean search engines won\'t be able to crawl your website, but sitemaps make it easier for them to discover all the URLs which are needed to be indexed.','siteseo').'</p> <div class="siteseo-styles pre"><pre><span class="dashicons dashicons-external"></span><a href="'.esc_url(get_option('home')).'/sitemaps.xml" target="_blank">' . esc_url(get_option('home')) . '/sitemaps.xml</a></pre></div> <div class="siteseo-notice"> <span id="siteseo-dash-icon" class="dashicons dashicons-info"></span> <p>'. /* translators: placeholders are just <strong> tag */ wp_kses_post(sprintf(__('To view your sitemap, %1$s enable permalinks %2$s (other than the default one) and save the settings to flush them.', 'siteseo'), '<strong>', '</strong>')).'</p> </div> <table class="form-table"> <tbody> <tr> <th scope="row">'.esc_html__('Enable XML Sitemap','siteseo').'</th> <td> <label><input id="siteseo_enable_sitemap" name="siteseo_options[enable_xml_sitemap]" type="checkbox" '.(!empty($xml_sitemap) ? 'checked' : '').' value="1"/>'. esc_html__('Enable XML Sitemap', 'siteseo').'</label> </td> </tr> <tr> <th scope="row">'.esc_html__('Enable Image Sitemap','siteseo').'</th> <td> <label><input id="siteseo_image_sitemap" name="siteseo_options[enable_img_sitemap]" type="checkbox" '.(!empty($img_sitemap) ? 'checked' : '').' value="1"/>'. esc_html__('Enable Image Sitemap for standard images, image galleries, featured images, and WooCommerce product images.)', 'siteseo').'</label> <p class="description">'.esc_html__('Images in XML sitemaps are only visible from the source code.', 'siteseo').'</p> </td> </tr> <tr> <th scope="row">'.esc_html__('Enable Author Sitemap','siteseo').'</th> <td> <label><input id="siteseo_author_sitemap" name="siteseo_options[enable_author_sitemap]" type="checkbox" '.(!empty($author_sitemap) ? 'checked' : '').' value="1"/>' . esc_html__('Enable Author Sitemap', 'siteseo').'</label> <p class="description">'.esc_html__('Ensure that you enable the author archive from SEO, under the Titles & Metas section, in the Archives tab.','siteseo').'</p> </td> </tr> <tr> <th scope="row">'.esc_html__('Enable HTML Sitemap','siteseo').'</th> <td> <label><input id="siteseo_html_sitemap" name="siteseo_options[enable_html_sitemap]" type="checkbox" '.(!empty($html_sitemap) ? 'checked' : ''). ' value="1"/>' . esc_html__('Enable HTML Sitemap', 'siteseo').'</label> </td> </tr> </tbody> </table> <input type="hidden" name="siteseo_options[general_sitemaps] value="1"/>'; } static function post_types_sitemaps(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->sitemap_settings; $options = get_option('siteseo_xml_sitemap_option_name', []); $option_sitemap_posts = !empty($options['xml_sitemap_post_types_list']['post']['include']) ? $options['xml_sitemap_post_types_list']['post']['include'] : ''; $option_sitemap_pages = !empty($options['xml_sitemap_post_types_list']['page']['include']) ? $options['xml_sitemap_post_types_list']['page']['include'] : ''; $option_sitemap_media = !empty($options['xml_sitemap_post_types_list']['media']['include']) ? $options['xml_sitemap_post_types_list']['media']['include'] : ''; $post_types = siteseo_post_types(); echo '<h3 class="siteseo-tabs">'.esc_html__('Post Types', 'siteseo').'</h3> <p>'.esc_html__('Select Post Types to Include or Exclude', 'siteseo').'</p> <table class="form-table"> <tbody>'; foreach($post_types as $post_type){ $post_type_name = $post_type->name; $post_type_label = $post_type->labels->singular_name; $option_sitemap_custom = !empty($options['xml_sitemap_post_types_list'][$post_type_name]['include']) ? 'checked="yes"' : ''; echo '<tr> <th></th> <td> <label for="sitemap_post_types_'.esc_attr($post_type_name).'"> <h4>'.esc_html($post_type_label).' <em>(['.esc_html($post_type_name).'])</em></h4> <input id="sitemap_post_types_'.esc_attr($post_type_name).'" name="siteseo_options[xml_sitemap_post_types_list]['.esc_attr($post_type_name).'][include]" type="checkbox" '.esc_attr($option_sitemap_custom).' value="1"/> '.esc_html__('Include', 'siteseo').' </label> </td> </tr>'; } echo '</tbody> </table> <input type="hidden" name= siteseo_options[post_types_tab] value="1"/>'; } static function taxonomy_sitemap(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->sitemap_settings; $get_taxonomies = get_taxonomies(['public' => true, 'show_ui' => true], 'objects'); $check_taxonomies = apply_filters('siteseo_sitemaps_tax', $get_taxonomies); $options = get_option('siteseo_xml_sitemap_option_name'); $option_category = isset($options['xml_sitemap_taxonomies_list']['category']['include']) ?? ''; $option_post_tags = isset($options['xml_sitemap_taxonomies_list']['post_tag']['include']) ?? ''; $get_taxonomies = get_taxonomies(); $check_taxomies = apply_filters('siteseo_sitemaps_tax', $get_taxonomies); $excluded_taxonomies = ['post_format', 'category', 'post_tag']; echo '<h3 class="siteseo-tabs">'.esc_html__('Taxonomies', 'siteseo').'</h3> <p>'.esc_html__('Select Taxonomies to Include or Exclude', 'siteseo').'</p> <table class="form-table"> <tr scope="row"> <th>'.esc_html__('Select to INCLUDE Taxonomies', 'siteseo').'</th> <td><br/><br/> <label for="sitemap_post_types_pages"> <h4>'.esc_html__('Categories ', 'siteseo').' <em>[categories]</em></h4> <input id="sitemap_post_types_pages" name="siteseo_options[xml_sitemap_taxonomies_list][category][include]" type="checkbox" '.(!empty($option_category) ? 'checked' : 'value="1"').'/> '.esc_html__('Include', 'siteseo').' </label> </td> </tr> <tr> <th></th> <td> <label for="sitemap_post_types_pages"> <h4>'.esc_html__('Tags', 'siteseo').' <em>[post_tag]</em></h4> <input id="sitemap_post_types_pages" name="siteseo_options[xml_sitemap_taxonomies_list][post_tag][include]" type="checkbox" '.(!empty($option_post_tags) ? 'checked' : 'value="1"').'/> '.esc_html__('Include', 'siteseo').' </label> </td> </tr>'; foreach($check_taxonomies as $taxonomy_name => $taxonomy_obj){ if(in_array($taxonomy_name, $excluded_taxonomies)){ continue; } //check selected $is_included = !empty($options['xml_sitemap_taxonomies_list'][$taxonomy_name]['include']); // Generate a row for the taxonomy echo '<tr scope="row"> <th></th> <td> <label for="sitemap_taxonomy_'.esc_attr($taxonomy_name).'"> <h4>'.esc_html($taxonomy_obj->labels->name).' <em>[' . esc_html($taxonomy_name).']</em></h4> <input id="sitemap_taxonomy_' . esc_attr($taxonomy_name) . '" name="siteseo_options[xml_sitemap_taxonomies_list][' . esc_attr($taxonomy_name).'][include]" type="checkbox" '.($is_included ? 'checked' : '').' value="1" /> ' . esc_html__('Include', 'siteseo') . ' </label> </td> </tr>'; } echo '</table><input type="hidden" name="siteseo_options[taxonomy_sitemap_tabs]" value="1">'; } static function html_sitemap(){ if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->$sitemap_settings; $options = get_option('siteseo_xml_sitemap_option_name', []); $include_pages = !empty($options['xml_sitemap_html_mapping']) ? $options['xml_sitemap_html_mapping'] : ''; $exclude_page = !empty($options['xml_sitemap_html_exclude']) ? $options['xml_sitemap_html_exclude'] : ''; $order = !empty($options['xml_sitemap_html_order']) ? $options['xml_sitemap_html_order'] : ''; $order_by = !empty($options['xml_sitemap_html_orderby']) ? $options['xml_sitemap_html_orderby'] : ''; $disable_date = !empty($options['xml_sitemap_html_date']) ? $options['xml_sitemap_html_date'] : ''; $remove_archive = !empty($options['xml_sitemap_html_archive_links']) ? $options['xml_sitemap_html_archive_links'] : ''; echo '<h3 class="siteseo-tabs">'.esc_html__('HTML Sitemap', 'siteseo').'</h3> <p>'.esc_html__('Generate an HTML sitemap for your visitors to improve your SEO.','siteseo').'</p> <p>'.esc_html__('Restricted to 1,000 posts per post type. You can change the order and sorting settings below.','siteseo').'</p> <div class="siteseo-notice"><span class="dashicons dashicons-info"></span> <div> <h3>'.esc_html__('How to make use of the HTML Sitemap?', 'siteseo').'</h3> <h4>'.esc_html__('Block Editor', 'siteseo').'</h4> <p>'. /* translators: placeholders are just <strong> tag */ wp_kses_post(sprintf(__('Insert the HTML sitemap block via the %1$s Block Editor %2$s.', 'siteseo'), '<strong>', '</strong>')).'</p> <h4>'.esc_html__('Shortcode', 'siteseo').'</h4> <p>'.esc_html__('You can also insert this shortcode into your content (post, page, custom post type, etc.):', 'siteseo').'</p> <div class="siteseo-styles pre"><pre>'.esc_attr('[siteseo_html_sitemap]','siteseo').'</div></pre> <p>'.esc_html__('To include specific custom post types, use the CPT attribute:', 'siteseo') .'</p> <div class="siteseo-styles pre"><pre>'.esc_attr('[siteseo_html_sitemap cpt="post,product"]','siteseo').'</div></pre> <h4>'.esc_html__('Other', 'siteseo').'</h4> <p>'.esc_html__('Display the sitemap dynamically by entering an ID in the first field below.', 'siteseo').'</p> </div> </div> <table class="form-table"> <tr scope="row"> <th>'.esc_html__('Post, Page, or Custom Post Type IDs to display:','siteseo').'</th> <td> <input type="text" value="'.esc_html($include_pages).'" name="siteseo_options[page_numbers]" placeholder="'.esc_html__('eg:2, 28, 68','siteseo').'"> </td> </tr> <tr scope="row"> <th>'.esc_html__('Exclude Posts, Pages, Custom Post Types or Terms IDs:','siteseo').'</th> <td> <input type="text" value="'.esc_html($exclude_page).'" name="siteseo_options[exclude_page]" placeholder="'.esc_html__('eg: 13 ,8 ,28','siteseo').'"> </td> </tr> <tr scope="row"> <th>'.esc_html__('Order:','siteseo').'</th> <td> <select name="siteseo_options[order]"> <option value="DESC" '.selected($order, 'DESC', false).'>'.esc_html__('DESC (descending order from highest to lowest values (3, 2, 1; c, b, a))','siteseo').'</option> <option value="ASC" '.selected($order, 'ASC', false).'>'.esc_html__('ASC (ascending order from lowest to highest values (1, 2, 3; a, b, c))','siteseo').'</option> </select> </td> </tr> <tr scope="row"> <th>'.esc_html__('Order By:','siteseo').'</th> <td> <select name="siteseo_options[order_by]"> <option value="date" '.selected($order_by, 'date', false).'>'.esc_html__('Deafult (date)','siteseo').'</option> <option value="post_title" '.selected($order_by, 'post_title', false).'>'.esc_html__('Post Title','siteseo').'</option> <option value="modified_date" '.selected($order_by, 'modified_date', false).'>'.esc_html__('Modified date','siteseo').'</option> <option value="post_id" '.selected($order_by, 'post_id', false).'>'.esc_html__('POST ID','siteseo').'</option> <option value="menu_order" '.selected($order_by, 'menu_order', false).'>'.esc_html__('Menu Order','siteseo').'</option> </select> </td> </tr> <tr scope="row"> <th>'.esc_html__('Disable Date:','siteseo').'</th> <td> <label for="sitemap_html_date"> <input id="sitemap_html_date" name="siteseo_options[disable_date]" type="checkbox" '.(!empty($disable_date) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Disable the date display after each post, page, or post type?', 'siteseo'). '</label> </td> </tr> <tr scope="row"> <th>'.esc_html__('Remove Archive Links:','siteseo').'</th> <td> <label for="sitemap_remove_link"> <input id="sitemap_remove_link" name="siteseo_options[remove_links]" type="checkbox" '.(!empty($remove_archive) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Remove links from archive pages (e.g., Products).', 'siteseo'). '</label> </td> </tr> </table><input type="hidden" name="siteseo_options[html_sitemap]" value="1"/>'; } static function save_settings(){ global $siteseo; check_admin_referer('siteseo_sitemap_settings'); if(!siteseo_user_can('manage_sitemap') || !is_admin()){ return; } $options = []; if(empty($_POST['siteseo_options'])){ return; } if(isset($_POST['siteseo_options']['general_sitemaps'])){ $options['xml_sitemap_general_enable'] = isset($_POST['siteseo_options']['enable_xml_sitemap']); $options['xml_sitemap_img_enable'] = isset($_POST['siteseo_options']['enable_img_sitemap']); $options['xml_sitemap_author_enable'] = isset($_POST['siteseo_options']['enable_author_sitemap']); $options['xml_sitemap_html_enable'] = isset($_POST['siteseo_options']['enable_html_sitemap']); flush_rewrite_rules(); } if(isset($_POST['siteseo_options']['html_sitemap'])){ $options['xml_sitemap_html_mapping'] = isset($_POST['siteseo_options']['page_numbers']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['page_numbers'])) : ''; $options['xml_sitemap_html_exclude'] = isset($_POST['siteseo_options']['exclude_page']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['exclude_page'])) : ''; $options['xml_sitemap_html_order'] = isset($_POST['siteseo_options']['order'])? sanitize_text_field(wp_unslash($_POST['siteseo_options']['order'])) : ''; $options['xml_sitemap_html_orderby'] = isset($_POST['siteseo_options']['order_by']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['order_by'])) : ''; $options['xml_sitemap_html_date'] = isset($_POST['siteseo_options']['disable_date']); $options['xml_sitemap_html_archive_links'] = isset($_POST['siteseo_options']['remove_links']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['remove_links'])) : ''; } // posts if(isset($_POST['siteseo_options']['post_types_tab'])){ if(isset($_POST['siteseo_options']['xml_sitemap_post_types_list'])){ $xml_post_types = map_deep(wp_unslash($_POST['siteseo_options']['xml_sitemap_post_types_list']), 'sanitize_text_field'); foreach($xml_post_types as $posttypes_key => $posttypes_value) { if(isset($posttypes_value['include'])) { $options['xml_sitemap_post_types_list'][$posttypes_key]['include'] = $posttypes_value['include']; } } } } // Taxonomies if(isset($_POST['siteseo_options']['taxonomy_sitemap_tabs'])){ if(isset($_POST['siteseo_options']['xml_sitemap_taxonomies_list'])){ $xml_tax_list = map_deep(wp_unslash($_POST['siteseo_options']['xml_sitemap_taxonomies_list']), 'sanitize_text_field'); foreach($xml_tax_list as $taxonomy_key => $taxonomy_value){ if(isset($taxonomy_value['include'])){ $options['xml_sitemap_taxonomies_list'][$taxonomy_key]['include'] = $taxonomy_value['include']; } } } } update_option('siteseo_xml_sitemap_option_name',$options); } } settings/instant.php 0000644 00000034044 15100371032 0010572 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO\Settings; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Instant{ static function menu(){ global $siteseo; $indexing_toggle = isset($siteseo->setting_enabled['toggle-instant-indexing']) ? $siteseo->setting_enabled['toggle-instant-indexing'] : ''; $nonce = wp_create_nonce('siteseo_toggle_nonce'); $current_tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : 'tab_siteseo_general'; $instant_subtabs = [ 'tab_siteseo_general' => esc_html__('General', 'siteseo'), 'tab_siteseo_settings' => esc_html__('Settings', 'siteseo'), 'tab_siteseo_history' => esc_html__('History', 'siteseo'), ]; echo '<div id="siteseo-root">'; Util::admin_header(); echo '<form method="post" id="siteseo-form" class="siteseo-option" name="siteseo-flush">'; wp_nonce_field('siteseo_instant_indexing'); Util::render_toggle('Instant Indexing - SiteSEO', 'indexing_toggle', $indexing_toggle, $nonce); echo '<div id="siteseo-tabs" class="wrap"> <div class="nav-tab-wrapper">'; foreach($instant_subtabs as $tab_key => $tab_caption){ $active_class = ($current_tab === $tab_key) ? ' nav-tab-active' : ''; echo '<a id="'.esc_attr($tab_key).'-tab" class="nav-tab'.esc_attr($active_class).'" data-tab="'.esc_attr($tab_key).'">'.esc_html($tab_caption).'</a>'; } echo '</div> <div class"tab-content-wrapper"> <div class="siteseo-tab'.($current_tab == 'tab_siteseo_general' ? ' active' : '').'" id="tab_siteseo_general" style="display: none;">'; self::general(); echo '</div> <div class="siteseo-tab'.($current_tab == 'tab_siteseo_settings' ? ' active' : '').'" id="tab_siteseo_settings" style="display: none;">'; self::settings(); echo '</div> <div class="siteseo-tab'.($current_tab == 'tab_siteseo_history' ? 'active' : '').'" id="tab_siteseo_history" style="display : none;">'; self::history(); echo '</div> </div>'; Util::submit_btn(); echo '</form></div>'; } static function general(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $options = get_option('siteseo_instant_indexing_option_name'); //$options = $siteseo->instant_settings; $option_engines = !empty($options['engines']) ? $options['engines'] : ''; $option_search_engine_google = !empty($option_engines['google']) ? $option_engines['google'] : ''; $option_search_engine_bing = !empty($option_engines['bing']) ? $option_engines['bing'] : ''; $option_action = !empty($options['instant_indexing_google_action']) ? $options['instant_indexing_google_action'] : ''; $option_manual_batch = !empty($options['instant_indexing_manual_batch']) ? $options['instant_indexing_manual_batch'] : ''; echo '<h3 class="siteseo-tabs">'.esc_html__('Instant Indexing','siteseo').'</h3> <div class="siteseo_wrap_label"> <p class="description">'.esc_html__('Utilize the Indexing API to inform Google and Bing about updates or removals of pages from their indexes. The process may take a few minutes. You can submit URLs in batches of up to 100 (maximum 200 requests per day for Google).','siteseo').'</p> </div> <div class="siteseo-notice"> <span class="dashicons dashicons-info"></span> <div><h3>'.esc_html__('How does this work?', 'siteseo').'</h3> <ol> <li>'. /* translators: placeholders are just <strong> tag */ wp_kses_post(sprintf(__('Setup your Google / Bing API keys from the %1$s Settings %2$s tab', 'siteseo'), '<strong>', '</strong>')).'</li> <li>'. /* translators: placeholders are just <strong> tag */ wp_kses_post(sprintf(__('%1$s Enter the URLs %2$s you want to index in the field below.', 'siteseo'), '<strong>', '</strong>')).'</li> <li><strong>'.wp_kses_post(__('Save changes', 'siteseo')).'</strong></li> <li>'. /* translators: placeholders are just <strong> tag */ wp_kses_post(sprintf(__('Click %1$s Submit URLs to Google & Bing %2$s', 'siteseo'), '<strong>', '</strong>')).'</li> </ol> </div> </div> <table class="form-table"> <tbody> <tr> <th scope="row">'.esc_html__('select search engines','siteseo').'</th> <td> <div class="siteseo_wrap_label"><label for="siteseo_search_engines"> <input id="siteseo_search_engines" name="siteseo_options[search_engine_google]" type="checkbox"' . (!empty($option_search_engine_google) ? 'checked="yes"' : '') . ' value="1"/>'.esc_html__('Google', 'siteseo') . '</label></div> <label for="siteseo_search_engines"> <input id="siteseo_search_engines" name="siteseo_options[search_engine_bing]" type="checkbox"' . (!empty($option_search_engine_bing) ? 'checked="yes"' : '') . ' value="1"/>'.esc_html__('Bing', 'siteseo') . '</label> </td> </tr> <tr> <th scope="row">'.esc_html__('Which action to run for Google?', 'siteseo') .'</th> <td> <div class="siteseo_wrap_label"> <label> <input id="siteseo_update_urls" name="siteseo_options[instant_indexing_actions]" type="radio" value="update_urls" '.checked($option_action, 'update_urls', false).'/> '.esc_html__('Update URLs', 'siteseo').' </label> </div> <div class="siteseo_wrap_label"> <label> <input id="siteseo_remove_urls" name="siteseo_options[instant_indexing_actions]" type="radio" value="remove_urls" '.checked($option_action, 'remove_urls', false).'/> '.esc_html__('Remove URLs (the URL must return a 404 or 410 status code, or the page must include the <meta name="robots" content="noindex" /> meta tag).', 'siteseo').' </label> </div> </td> </tr> <tr> <th scope="row">'.esc_html__('Submit URLs for indexing','siteseo').'</th> <td> <textarea rows="20" name="siteseo_options[instant_indexing_batch]" placeholder="'.esc_html__('Submit one URL per line for search engine submission (maximum of 100 URLs).','siteseo').'">'.esc_attr($option_manual_batch).'</textarea> </td> </tr> <tr> <th scope="row"></th> <td> <button id="siteseo-submit-urls-button" class="btn btnSecondary">'.esc_html__('Submits URLs to Google & Bing', 'siteseo').'</button> </td><div style="position:absolute;margin-top:52.5%;margin-left:38%;" class="spinner"></div> </tr> <tr> <th scope="row"></th> <td> <div id="url-submitter-response"></div> </td> </tr> </tbody> </table><input type="hidden" name="siteseo_options[general]" value="1"/>'; } static function settings(){ global $siteseo,$docs; if(!empty($_POST['submit'])){ self::save_settings(); } $docs['instant_indexing']['api'] = 'https://console.cloud.google.com/apis/library/indexing.googleapis.com?hl=en'; $docs['instant_indexing']['google'] = 'https://siteseo.io/docs/api-cli-dev/use-google-instant-indexing-api-with-siteseo-pro/'; //$options = $siteseo->instant_settings; $options = get_option('siteseo_instant_indexing_option_name'); $option_google_api_key = !empty($options['instant_indexing_google_api_key']) ? $options['instant_indexing_google_api_key'] : ''; $option_bing_api_key = !empty($options['instant_indexing_bing_api_key']) ? $options['instant_indexing_bing_api_key'] : ''; $option_auto_url_submission = !empty($options['instant_indexing_automate_submission']) ? $options['instant_indexing_automate_submission'] : ''; echo '<h3 class="siteseo-tabs">'.esc_html__('Settings','siteseo').'</h3> <table class="form-table"> <tbody> <tr> <th scope="row">'.esc_html__('Instant Indexing Google API Key','siteseo').'</th> <td> <textarea name="siteseo_options[google_api_key]" rows="12" placeholder="'.esc_html__('Paste your Google Json key file here','siteseo').'">'.esc_html($option_google_api_key).'</textarea> </td> </tr> <tr> <th scope="row">'.esc_html__('Instant Indexing Bing API Key', 'siteseo').'</th> <td> <input type="text" id="bing-api-key" name="siteseo_options[bing_api_key]" placeholder="'.esc_html__('Enter your Bing Instant Indexing API', 'siteseo').'" value="'.esc_attr($option_bing_api_key).'"> <button type="button" id="siteseo-generate-api-key-btn" class="btn btnSecondary">'.esc_html__('Generate key', 'siteseo').'</button> <p class="description">'.esc_html__('The Bing Indexing API key is generated automatically. Click Generate Key if you need to recreate it or if it missing.', 'siteseo') .'</p> <p class="description">'.esc_html__('A key should look like this: YjI4MGQxZmU0NWM1NGY2ZGIxMDk5M2VlYTAxMTUyODI=', 'siteseo') .'</p> </td> </tr> <tr> <th scope="row">'.esc_html__('Automate URL Submission','siteseo').'</th> <td> <label for="siteseo_search_engines"> <input id="siteseo_search_engines" name="siteseo_options[auto_submission]" type="checkbox"'.(!empty($option_auto_url_submission) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Activate automatic URL submission for the IndexNow API.', 'siteseo') . '</label> <div class="siteseo_wrap_label"> <p class="description">'.esc_html__('Inform search engines via the IndexNow protocol currently Bing whenever a post is created, updated, or removed.','siteseo').'</p> </div> </td> </tr> </tbody> </table><input type="hidden" name="siteseo_options[setting_tab]" value="1"/>'; } static function history(){ global $siteseo; $options = get_option('siteseo_instant_indexing_option_name'); $indexing_history = !empty($options['indexing_history']) ? $options['indexing_history'] : ''; echo'<h3 class="siteseo-tabs">'.esc_html__('History', 'siteseo').'</h3> <div class="siteseo_wrap_label"> <p class="description">'.esc_html__('Most Recent 10 Indexing API Requests.', 'siteseo').'</p> </div> <table class="wp-list-table widefat fixed striped siteseo-history-table"> <thead><tr> <th>'.esc_html__('Time & Date', 'siteseo').'</th> <th>'.esc_html__('URLs', 'siteseo').'</th> <th>'.esc_html__('Google Response', 'siteseo').'</th> <th>'.esc_html__('Bing Response', 'siteseo').'</th> </tr></thead> <tbody>'; if(empty($indexing_history)){ echo'<tr> <td>'.esc_html__('No submissions yet.', 'siteseo').'</td> </tr></tbody></table><br/><br/>'; return; } foreach($indexing_history as $history){ echo'<tr> <td>'.esc_html(date_i18n('Y-m-d H:i:s', $history['time'])).'</td> <td>'.esc_html(implode(', ', $history['urls'])).'</td> <td>'.(isset($history['google_status_code']) ? esc_html($history['google_status_code']) : 'N/A').'</td> <td>'.(isset($history['bing_status_code']) ? esc_html($history['bing_status_code']) : 'N/A') . (isset($history['source']) && $history['source'] === 'auto' ? esc_html(' ( Auto )') : '') . '</td> </tr>'; } echo'</tr> </tbody></table><br/> <tr> <td> <button id="siteseo-clear-history" class="btn btnSecondary">'.esc_html__('Clean History', 'siteseo').'</button> </td> </tr><br/><br/> <a class="siteseo-show-details">'.esc_html__('Response code guide', 'siteseo').'<span class="dash-icon dashicons dashicons-arrow-down-alt2"></span></a> <div class="siteseo-response-code-table"> <table class="wp-list-table widefat fixed striped siteseo-history-table"> <thead> <tr> <th>'.esc_html__('Response Code', 'siteseo').'</th> <th>'.esc_html__('Response Message', 'siteseo').'</th> <th>'.esc_html__('Reason', 'siteseo').'</th> </tr> </thead> <tr> <td>'.esc_html__('200', 'siteseo').'</td> <td>'.esc_html__('Ok', 'siteseo').'</td> <td>'.esc_html__('URLs submitted successfully.', 'siteseo').'</td> </tr> <tr> <td>'.esc_html__('202', 'siteseo').'</td> <td>'.esc_html__('Accepted', 'siteseo').'</td> <td>'.esc_html__('URL received. IndexNow key validation pending.', 'siteseo').'</td> </tr> <tr> <td>'.esc_html__('400', 'siteseo').'</td> <td>'.esc_html__('Bad Request', 'siteseo').'</td> <td>'.esc_html__('Request Invalid format.', 'siteseo').'</td> </tr> <tr> <td>'.esc_html__('403', 'siteseo').'</td> <td>'.esc_html__('Forbidden', 'siteseo').'</td> <td>'.esc_html__('Key not valid.', 'siteseo').'</td> </tr> <tr> <td>'.esc_html__('422', 'siteseo').'</td> <td>'.esc_html__('Unprocessable Entity', 'siteseo').'</td> <td>'.esc_html__('URLs don\'t belong to the host.', 'siteseo').'</td> </tr> <tr> <td>'.esc_html__('429', 'siteseo').'</td> <td>'.esc_html__('Too Many Requests', 'siteseo').'</td> <td>'.esc_html__('Too Many Requests: Potential Spam.', 'siteseo').'</td> </tr> <tbody> </table></div><br/><br/>'; } static function save_settings(){ global $siteseo; check_admin_referer('siteseo_instant_indexing'); if(!siteseo_user_can('manage_instant_indexing')|| !is_admin()){ return; } $options = $siteseo->instant_settings; if(empty($_POST['siteseo_options'])){ return; } if(isset($_POST['siteseo_options']['general'])){ // general tab $options['engines']['bing'] = isset($_POST['siteseo_options']['search_engine_bing']); $options['engines']['google'] = isset($_POST['siteseo_options']['search_engine_google']); $options['instant_indexing_google_action'] = isset($_POST['siteseo_options']['instant_indexing_actions']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['instant_indexing_actions'])) : 'URL_UPDATED'; $options['instant_indexing_manual_batch'] = isset($_POST['siteseo_options']['instant_indexing_batch']) ? sanitize_textarea_field(wp_unslash($_POST['siteseo_options']['instant_indexing_batch'])) : ''; } if(isset($_POST['siteseo_options']['setting_tab'])){ // setting tab $options['instant_indexing_google_api_key'] = isset($_POST['siteseo_options']['google_api_key']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['google_api_key'])) : ''; $options['instant_indexing_bing_api_key'] = isset($_POST['siteseo_options']['bing_api_key']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['bing_api_key'])) : ''; $options['instant_indexing_automate_submission'] = isset($_POST['siteseo_options']['auto_submission']); } update_option('siteseo_instant_indexing_option_name', $options); } } settings/dashboard.php 0000644 00000034420 15100371032 0011037 0 ustar 00 <?php if(!defined('ABSPATH')){ die('Hacking Attempt'); } // The Loginizer Admin Options Page function loginizer_page_dashboard(){ global $loginizer, $lz_error, $lz_env; if(!current_user_can('manage_options')){ wp_die('Sorry, but you do not have permissions to change settings.'); } // Dismiss the announcement if(isset($_GET['dismiss_announcement'])){ update_option('loginizer_no_announcement', 1); } /* Make sure post was from this page */ if(count($_POST) > 0){ check_admin_referer('loginizer-options'); } do_action('loginizer_pre_page_dashboard'); // Is there a IP Method ? if(isset($_POST['save_lz_ip_method'])){ $ip_method = (int) lz_optpost('lz_ip_method'); $custom_ip_method = lz_optpost('lz_custom_ip_method'); if($ip_method >= 0 && $ip_method <= 3){ update_option('loginizer_ip_method', $ip_method); } // Custom Method name ? if($ip_method == 3){ update_option('loginizer_custom_ip_method', $custom_ip_method); } } loginizer_page_dashboard_T(); } // The Loginizer Admin Options Page - THEME function loginizer_page_dashboard_T(){ global $loginizer, $lz_error, $lz_env; loginizer_page_header('Dashboard'); ?> <style> .lz-welcome-panel{ border: 1px solid #c3c4c7; box-shadow: 0 1px 1px rgba(0,0,0,.04); background: #fff; padding:10px; } .lz-welcome-panel-content{ display:inline; vertical-align:middle; } input[type="text"], textarea, select { width: 70%; } .form-table label{ font-weight:bold; } .exp{ font-size:12px; } </style> <?php $lz_ip = lz_getip(); if($lz_ip != '127.0.0.1' && @$_SERVER['SERVER_ADDR'] == $lz_ip){ echo '<div class="update-message notice error inline notice-error notice-alt"><p style="color:red"> '.__('Your Server IP Address seems to match the Client IP detected by Loginizer. You might want to change the IP detection method to HTTP_X_FORWARDED_FOR under System Information section.', 'loginizer').'</p></div><br>'; } loginizer_newsletter_subscribe(); if(!empty($loginizer['backuply_promo']) && $loginizer['backuply_promo'] > 0 && $loginizer['backuply_promo'] < (time() - (7*24*3600))){ loginizer_backuply_promo(); } echo ' <div class="lz-welcome-panel"> <div class="lz-welcome-panel-content">'. __('Thank you for choosing Loginizer! Many more features coming soon... Review Loginizer at WordPress ', 'loginizer').'<a href="https://wordpress.org/support/view/plugin-reviews/loginizer" class="button button-primary" target="_blank">'. __('Add Review', 'loginizer'). '</a></div> </div><br />'; // Saved ? if(!empty($GLOBALS['lz_saved'])){ echo '<div id="message" class="updated"><p>'. __('The settings were saved successfully', 'loginizer'). '</p></div><br />'; } // Any errors ? if(!empty($lz_error)){ lz_report_error($lz_error);echo '<br />'; } ?> <div style="display:flex; justify-content:space-between;" > <div class="postbox" style="width:34%"> <div class="postbox-header"> <h2 class="hndle ui-sortable-handle"> <span><?php echo __('Getting Started', 'loginizer'); ?></span> </h2> </div> <div class="inside"> <form action="" method="post" enctype="multipart/form-data"> <?php wp_nonce_field('loginizer-options'); ?> <table class="form-table"> <tr> <td scope="row" valign="top" colspan="2" style="line-height:1.9"> <i><?php echo __('Welcome to Loginizer Security. By default the <b>Brute Force Protection</b> is immediately enabled. You should start by going over the default settings and tweaking them as per your needs.', 'loginizer'); ?></i> <?php if(defined('LOGINIZER_PREMIUM')){ echo '<br><i>'.__('In the Premium version of Loginizer you have many more features. We recommend you enable features like <b>reCAPTCHA, Two Factor Auth or Email based PasswordLess</b> login. These features will improve your websites security','loginizer').'</i>'; }else{ echo '<br><i><a href="'.LOGINIZER_PRICING_URL.'" target="_blank" style="text-decoration:none;color:red;">'.__('Upgrade to Pro</a> for more features like <b>reCAPTCHA, Two Factor Auth, Rename wp-admin and wp-login.php pages, Email based PasswordLess</b> login and more. These features will improve your website\'s security.','loginizer').'</i>'; } ?> </td> </tr> </table> </form> </div> </div> <?php $login_attempt_stats = get_option('loginizer_login_attempt_stats', []); $success_logins = 1; $failed_logins = 0; $stats_dataset = []; foreach($login_attempt_stats as $attempt_time => $count){ if($attempt_time < strtotime('-30 days')){ unset($login_attempt_stats[$attempt_time]); update_option('loginizer_login_attempt_stats', $login_attempt_stats, false); continue; } $day_month = date('M j', $attempt_time); if(empty($stats_dataset[$day_month])){ $stats_dataset[$day_month] = 0; } if(!empty($login_attempt_stats[$attempt_time][0])){ $stats_dataset[$day_month] += $login_attempt_stats[$attempt_time][0]; } if($attempt_time > strtotime('-24 hours')){ if(!empty($login_attempt_stats[$attempt_time][0])){ $failed_logins += $login_attempt_stats[$attempt_time][0]; } if(!empty($login_attempt_stats[$attempt_time][1])){ $success_logins += $login_attempt_stats[$attempt_time][1]; } continue; } } $failed_login_color = '#f9fa8e'; if($failed_logins < 40){ $failed_login_color = '#f9fa8e'; $failed_notice = __('Your Website is safe', 'loginizer'); } else if($failed_logins < 70){ $failed_login_color = '#ffcd56'; $failed_notice = __('Risk from Brute-force attacks is low, attacks are under control', 'loginizer'); } else if($failed_logins < 150){ $failed_login_color = '#f67019'; $failed_notice = __('Brute-force attacks on your websites are on rise', 'loginizer'); } else { $failed_login_color = '#fc1e4d'; $failed_notice = __('Your website is under heavy brute-force attacks.<br/> <a href="https://loginizer.com/pricing?utm_source=stats_block" target="_blank">Upgrade to a premium version</a> for added protection if this trend persists. Act fast to secure your site.', 'loginizer'); } if(defined('LOGINIZER_PREMIUM')){ $failed_login_color = '#f53794'; $failed_notice = __('Your website is being protected by Loginizer Security.', 'loginizer'); } ?> <div class="postbox" style="width:65%;"> <div class="postbox-header"> <h2 class="hndle"> <span><?php echo __('Login Attempts', 'loginizer'); ?></span> </h2> </div> <div class="inside" style="display:flex;"> <div style="margin-right:50px;"> <div style="position:relative; width: 250px; height:auto; margin: 0 auto;"> <canvas id="lz-attempts-chart"></canvas> <h3 style="position:absolute; bottom:0%; width:100%; text-align:center;"><?php _e('Total Attempts:', 'loginizer'); ?> <?php echo esc_html($failed_logins + $success_logins); ?></h3> </div> <div><p style="text-align:center;"><?php echo wp_kses_post($failed_notice); ?></p></div> <div style="color:#898989; text-align:right;"><?php _e('Data For Last 24 hours', 'loginizer'); ?></div> </div> <div style="margin:auto; height:100%; min-height:300px; width:80%;"> <canvas id="lz-attemt-chart-thirty"></canvas> </div> </div> </div> </div> <div class="postbox"> <div class="postbox-header"> <h2 class="hndle ui-sortable-handle"> <span><?php echo __('System Information', 'loginizer'); ?></span> </h2> </div> <div class="inside"> <form action="" method="post" enctype="multipart/form-data"> <?php wp_nonce_field('loginizer-options'); ?> <table class="wp-list-table fixed striped users" cellspacing="1" border="0" width="95%" cellpadding="10" align="center"> <?php echo ' <tr> <th align="left" width="25%">'.__('Loginizer Version', 'loginizer').'</th> <td>'.LOGINIZER_VERSION.(defined('LOGINIZER_PREMIUM') ? ' (<font color="green">'.__('Security PRO Version','loginizer').'</font>)' : '').'</td> </tr>'; do_action('loginizer_system_information'); echo '<tr> <th align="left">'.__('URL', 'loginizer').'</th> <td>'.get_site_url().'</td> </tr> <tr> <th align="left">'.__('Path', 'loginizer').'</th> <td>'.ABSPATH.'</td> </tr> <tr> <th align="left">'.__('Server\'s IP Address', 'loginizer').'</th> <td>'.@$_SERVER['SERVER_ADDR'].'</td> </tr> <tr> <th align="left">'.__('Your IP Address', 'loginizer').'</th> <td>'.lz_getip().' <div style="float:right"> Method : <select name="lz_ip_method" id="lz_ip_method" style="font-size:11px; width:150px" onchange="lz_ip_method_handle()"> <option value="0" '.lz_POSTselect('lz_ip_method', 0, (@$loginizer['ip_method'] == 0)).'>REMOTE_ADDR'.(!empty($_SERVER['REMOTE_ADDR']) ? '(' . esc_html($_SERVER['REMOTE_ADDR']) .')' : '').'</option> <option value="1" '.lz_POSTselect('lz_ip_method', 1, (@$loginizer['ip_method'] == 1)).'>HTTP_X_FORWARDED_FOR'.(!empty($_SERVER['HTTP_X_FORWARDED_FOR']) ? '(' . esc_html($_SERVER['HTTP_X_FORWARDED_FOR']) .')' : '').'</option> <option value="2" '.lz_POSTselect('lz_ip_method', 2, (@$loginizer['ip_method'] == 2)).'>HTTP_CLIENT_IP'.(!empty($_SERVER['HTTP_CLIENT_IP']) ? '(' . esc_html($_SERVER['HTTP_CLIENT_IP']) .')' : '').'</option> <option value="3" '.lz_POSTselect('lz_ip_method', 3, (@$loginizer['ip_method'] == 3)).'>CUSTOM</option> </select> <input name="lz_custom_ip_method" id="lz_custom_ip_method" type="text" value="'.lz_optpost('lz_custom_ip_method',(empty($loginizer['custom_ip_method']) ? '' : $loginizer['custom_ip_method'])).'" style="font-size:11px; width:100px; display:none" /> <input name="save_lz_ip_method" class="button button-primary" value="Save" type="submit" /> </div> </td> </tr> <tr> <th align="left">'.__('wp-config.php is writable', 'loginizer').'</th> <td>'.(is_writable(ABSPATH.'/wp-config.php') ? '<span style="color:red">Yes</span>' : '<span style="color:green">No</span>').'</td> </tr>'; if(file_exists(ABSPATH.'/.htaccess')){ echo ' <tr> <th align="left">'.__('.htaccess is writable', 'loginizer').'</th> <td>'.(is_writable(ABSPATH.'/.htaccess') ? '<span style="color:red">Yes</span>' : '<span style="color:green">No</span>').'</td> </tr>'; } // Setting up the dataset for the 30 day chart $line_dataset[] = array( 'label' => __( 'Failed', 'loginizer'), 'data' => $stats_dataset, 'backgroundColor' => 'rgb(54, 162, 235)', 'borderColor' => 'rgb(54, 162, 235)', ); // Enqueues CharJS script and inline the char js wp_enqueue_script('chartjs', LOGINIZER_URL.'/assets/js/chart.js', array('jquery'), '3.0.0'); wp_add_inline_script('chartjs', 'function lz_attempts_chart(){ const ctx = document.getElementById("lz-attempts-chart"); new Chart(ctx, { type: "doughnut", data: { labels: ["Failed", "Success"], datasets: [{ label: "Count", data: ['.esc_html($failed_logins).', '.esc_html($success_logins).'], backgroundColor: [ "'.esc_html($failed_login_color).'", "rgb(54, 162, 235)", ], hoverOffset: 4, borderWidth: [0] }], }, options : { circumference : 180, rotation:-90, responsive: true, } }); const thirty_days = document.getElementById("lz-attemt-chart-thirty"); new Chart(thirty_days, { type: "line", data: { datasets: '.json_encode($line_dataset).' }, options: { responsive: true, maintainAspectRatio: false, hover: { mode: "nearest", intersect: true }, scales: { x: { display: true, scaleLabel: { display: false } }, y: { display: true, scaleLabel: { display: false }, beginAtZero: true, ticks: { callback: function(label, index, labels) { if (Math.floor(label) === label) { return label; } }, } } } } }); } lz_attempts_chart();'); ?> </table> </form> </div> </div> <script type="text/javascript"> function lz_ip_method_handle(){ var ele = jQuery('#lz_ip_method'); if(ele.val() == 3){ jQuery('#lz_custom_ip_method').show(); }else{ jQuery('#lz_custom_ip_method').hide(); } }; lz_ip_method_handle(); </script> <div id="" class="postbox"> <div class="postbox-header"> <h2 class="hndle ui-sortable-handle"> <span><?php echo __('File Permissions', 'loginizer'); ?></span> </h2> </div> <div class="inside"> <form action="" method="post" enctype="multipart/form-data"> <?php wp_nonce_field('loginizer-options'); ?> <table class="wp-list-table fixed striped users" border="0" width="95%" cellpadding="10" align="center"> <?php echo ' <tr> <th style="background:#EFEFEF;">'.__('Relative Path', 'loginizer').'</th> <th style="width:10%; background:#EFEFEF;">'.__('Suggested', 'loginizer').'</th> <th style="width:10%; background:#EFEFEF;">'.__('Actual', 'loginizer').'</th> </tr>'; if(version_compare(phpversion(), '7.0') < 0){ $wp_content = basename(dirname(dirname(dirname(dirname(dirname(__FILE__)))))); }else { $wp_content = basename(dirname(__FILE__, 5)); } $files_to_check = array('/' => array('0755', '0750'), '/wp-admin' => array('0755'), '/wp-includes' => array('0755'), '/wp-config.php' => array('0444'), '/'.$wp_content => array('0755'), '/'.$wp_content.'/themes' => array('0755'), '/'.$wp_content.'/plugins' => array('0755')); if(file_exists(ABSPATH.'/.htaccess')){ $files_to_check['.htaccess'] = array('0444'); } $root = ABSPATH; foreach($files_to_check as $k => $v){ $path = $root.'/'.$k; $stat = @stat($path); $suggested = $v; $actual = substr(sprintf('%o', $stat['mode']), -4); echo ' <tr> <td>'.$k.'</td> <td>'.current($suggested).'</td> <td><span '.(!in_array($actual, $suggested) ? 'style="color: red;"' : '').'>'.$actual.'</span></td> </tr>'; } ?> </table> </form> </div> </div> <?php loginizer_page_footer(); } settings/titles.php 0000644 00000131264 15100371032 0010420 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO\Settings; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Titles{ static function menu(){ global $siteseo; $current_tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : 'tab_siteseo_home'; // Default tab $titles_meta_subtabs = [ 'tab_siteseo_home' => esc_html__('Home', 'siteseo'), 'tab_siteseo_post_types' => esc_html__('Post types', 'siteseo'), 'tab_siteseo_archives' => esc_html__('Archives', 'siteseo'), 'tab_siteseo_taxonomies' => esc_html__('Taxonomies', 'siteseo'), 'tab_siteseo_advanced' => esc_html__('Advanced','siteseo') ]; echo '<div id="siteseo-root">'; Util::admin_header(); echo '<form method="post" id="siteseo-form" class="siteseo-option" name="siteseo-flush">'; wp_nonce_field('siteseo_title_settings'); $titles_meta_toggle = isset($siteseo->setting_enabled['toggle-titles']) ? $siteseo->setting_enabled['toggle-titles'] : ''; $nonce = wp_create_nonce('siteseo_toggle_nonce'); Util::render_toggle('Titles & Metas - SiteSEO', 'titles_meta_toggle', $titles_meta_toggle, $nonce); echo '<div id="siteseo-tabs" class="wrap"> <div class="nav-tab-wrapper">'; foreach($titles_meta_subtabs as $tab_key => $tab_caption) { $active_class = ($current_tab === $tab_key) ? ' nav-tab-active' : ''; echo '<a id="' . esc_attr($tab_key) . '-tab" class="nav-tab' . esc_attr($active_class) . '" data-tab="' . esc_attr($tab_key) . '">' . esc_html($tab_caption) . '</a>'; } echo '</div> <div class="tab-content-wrapper"> <div class="siteseo-tab '.($current_tab == 'tab_siteseo_home' ? ' active' : '').'" id="tab_siteseo_home" style="display: none;">'; self::home(); echo '</div> <div class="siteseo-tab '.($current_tab == 'tab_siteseo_post_types' ? ' active' : '').'" id="tab_siteseo_post_types" style="display: none;">'; self::post_types(); echo '</div> <div class="siteseo-tab '.($current_tab == 'tab_siteseo_archives' ? ' active' : '').'" id="tab_siteseo_archives" style="display: none;">'; self::archives(); echo '</div> <div class="siteseo-tab '.($current_tab == 'tab_siteseo_taxonomies' ? ' active' : '').'" id="tab_siteseo_taxonomies" style="display: none;" style="display: none;">'; self::taxonomies(); echo '</div> <div class="siteseo-tab '.($current_tab == 'tab_siteseo_advanced' ? ' active' : '').'" id="tab_siteseo_advanced">'; self::advanced(); echo '</div> </div>'; Util::submit_btn(); echo '</form></div>'; } static function home(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $options = get_option('siteseo_titles_option_name'); //$options = $siteseo->titles_settings; $option_separator = !empty($options['titles_sep']) ? $options['titles_sep'] : ''; $option_site_title = !empty($options['titles_home_site_title']) ? $options['titles_home_site_title'] : ''; $option_site_title_alt = !empty($options['titles_home_site_title_alt']) ? $options['titles_home_site_title_alt'] : ''; $option_site_desc = !empty($options['titles_home_site_desc']) ? $options['titles_home_site_desc'] : ''; echo '<h3 class="siteseo-tabs">'.esc_html__('HOME','siteseo').'</h3> <div class="siteseo-notice"> <span id="siteseo-dash-icon" class="dashicons dashicons-info"></span> <p>'.esc_html__('Search engines use the title and meta description to create a snippet of your site for the search results page.', 'siteseo').'</p> </div> <p>'.esc_html__('Personalize the title and meta description for your homepage.','siteseo').'</p> <span class="dashicons dashicons-external"></span> <a href="'.esc_attr('https://siteseo.io/docs/meta/google-uses-the-wrong-meta-title-meta-description-in-search-results/').'" target="_blank">'.esc_html__('Incorrect meta title or description appearing in search results?', 'siteseo').'</a> <table class="form-table"> <tbody> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Separator','siteseo').'</th> <td> <input type="text" name="siteseo_options[separator]" placeholder="'.esc_attr__('Specify your separator, e.g:-','siteseo').'" value="'.esc_attr($option_separator).'"> <p class="description">'.esc_attr__('Include this separator using %%sep%% in your title and meta description.','siteseo').'</p> </td> </tr> <td colspan="2"><span class="dashed-line"></span></td> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Site title','siteseo').'</th> <td> <input type="text" name="siteseo_options[site_title]" value="'.esc_attr($option_site_title).'" placeholder="'.esc_html__('My fantastic site','siteseo').'"> <div class="wrap-tags"> <button class="tag-title-btn" id="btn-site-title" data-tag="%%sitetitle%%"><span id="icon" class="dashicons dashicons-insert"></span>'. esc_html__('SITE TITLE','siteseo').'</button> <button class="tag-title-btn" id="btn-separator" data-tag="%%sep%%"><span id="icon" class="dashicons dashicons-insert"></span>'. esc_html__('SEPARATOR','siteseo').'</button> <button class="tag-title-btn" id="btn-tagline" data-tag="%%tagline%%"><span id="icon" class="dashicons dashicons-insert"></span>'. esc_html__('TAGLINE','siteseo').'</button>'; siteseo_suggestion_button(); echo '</div> </td> </tr> <td colspan="2"><span class="dashed-line"></span></td> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Alternative site title','siteseo').'</th> <td> <input type="text" value="'.esc_attr($option_site_title_alt).'" name="siteseo_options[alt_site_title]" placeholder="'.esc_html__('Alternative website title','siteseo').'"> <p class="description">'.esc_html__('The alternative name of the website (e.g., a commonly recognized acronym or shorter name, if applicable). Ensure the name meets the criteria.', 'siteseo').'</p> </td> </tr> <td colspan="2"><span class="dashed-line"></span></td> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Meta description','siteseo').'</th> <td> <textarea type="text" name="siteseo_options[media_desc]" placeholder="'.esc_html__('This is an awesome website about galactic creatures.','siteseo').'">'.esc_html($option_site_desc).'</textarea> <div class="wrap-tags"> <button class="tag-title-btn" id="btn-tagline-meta" data-tag="%%tagline%%"><span id="icon" class="dashicons dashicons-insert"></span>'. esc_html__('TAGLINE','siteseo').'</button>'; siteseo_suggestion_button(); echo '</div> </td> </tr> </tbody> </table> <input type="hidden" name="siteseo_options[home_tab]" value="1"/>'; } static function advanced(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->titles_settings; $options = get_option('siteseo_titles_option_name'); $option_noindex = !empty($options['titles_noindex']) ? $options['titles_noindex'] : ''; $option_nofollow = !empty($options['titles_nofollow']) ? $options['titles_nofollow'] : ''; $option_noimage = !empty($options['titles_noimageindex']) ? $options['titles_noimageindex'] : ''; $option_noarchive = !empty($options['titles_noarchive']) ? $options['titles_noarchive'] : ''; $option_nosnippet = !empty($options['titles_nosnippet']) ? $options['titles_nosnippet'] : ''; $option_nositelinkssearchbox = !empty($options['titles_nositelinkssearchbox']) ? $options['titles_nositelinkssearchbox'] : ''; $option_page_rel = !empty($options['titles_paged_rel']) ? $options['titles_paged_rel'] : ''; $option_paged_noindex = !empty($options['titles_paged_noindex']) ? $options['titles_paged_noindex'] : ''; $option_attachments_noindex = !empty($options['titles_attachments_noindex']) ? $options['titles_attachments_noindex'] : ''; echo '<h3 class="siteseo-tabs">'.esc_html__('Advanced','siteseo').'</h3> <p>'.esc_html__('Customize your metas for all pages','siteseo').'</p> <table class="form-table"> <tbody> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('noindex','siteseo').'</th> <td> <label> <input name="siteseo_options[noindex]" type="checkbox" '.(!empty($option_noindex) ? 'checked="yes"' : '') . ' value="1"/>' . esc_html__('noindex', 'siteseo') . '</label> <p class="description">'.esc_attr__('Do not show all pages of the site in Google search results and avoid displaying "Cached" links in search results.','siteseo').'</p> '.wp_kses_post('<p class="description">Check also the<strong>"Search engine visibility"</strong> setting from the <a href="%s">WordPress Reading page</a></p>','siteseo').' </td> </tr> <td colspan="2"><span class="dashed-line"></span></td> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('nofollow','siteseo').'</th> <td> <label> <input name="siteseo_options[no_follow]" type="checkbox"'.(!empty($option_nofollow) ? 'checked="yes"' : '') . ' value="1"/>'. esc_html__('nofollow', 'siteseo'). '</label> <p class="description">'.esc_html__('Do not follow links on all pages.','siteseo').'</p> </td> <tr> <td colspan="2"><span class="dashed-line"></span></td> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('noimageindex','siteseo').'</th> <td> <label> <input name="siteseo_options[no_image]" type="checkbox"'.(!empty($option_noimage) ? 'checked="yes"' : '').' value="1"/>'. esc_html__('noimageindex', 'siteseo'). '</label> <p class="description">'.esc_html__('Do not follow links on any pages.','siteseo').'</p> </td> <tr> <td colspan="2"><span class="dashed-line"></span></td> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('noarchive','siteseo').'</th> <td> <label> <input name="siteseo_options[no_archive]" type="checkbox"'.(!empty($option_noarchive) ? 'checked="yes"' : '').' value="1"/>' . esc_html__('noarchive', 'siteseo'). '</label> <p class="description">'.esc_html__('Do not show a "Cached" link in Google search results.','siteseo').'</p> </td> </tr> <td colspan="2"><span class="dashed-line"></span></td> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('nosnippet','siteseo').'</th> <td> <label> <input name="siteseo_options[no_snippet]" type="checkbox"'.(!empty($option_nosnippet) ? 'checked="yes"' : '').' value="1"/>' . esc_html__('nosnippet', 'siteseo'). '</label> <p class="description">'.esc_html__('Do not show a description in the Google search results for any pages.','siteseo').'</p> </td> </tr> <td colspan="2"><span class="dashed-line"></span></td> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('nositelinkssearchbox','siteseo').'</th> <td> <label> <input name="siteseo_options[no_site_links_searchbox]" type="checkbox"'.(!empty($option_nositelinkssearchbox) ? 'checked="yes"' : ''). ' value="1"/>' . esc_html__('nositelinkssearchbox', 'siteseo') . '</label> <p class="description">'.esc_html__('Prevents Google from displaying a sitelinks search box in search results. Enabling this option will remove the "Website" schema from your source code.','siteseo') .'</p> </td> </tr> <td colspan="2"><span class="dashed-line"></span></td> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Indicate paginated content to Google','siteseo').'</th> <td> <label> <input name="siteseo_options[page_rel]" type="checkbox"' . (!empty($option_page_rel) ? 'checked="yes"' : '') . ' value="1"/>' . esc_html__('Add rel next/prev link in head of paginated archive pages', 'siteseo') . '</label> <p class="description">'.esc_html__('eg: https://example.com/category/my-category/page/2/.','siteseo').'</p> </td> </tr> <td colspan="2"><span class="dashed-line"></span></td> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('noindex on paged archives','siteseo').'</th> <td> <label> <input name="siteseo_options[titles_paged_noindex]" type="checkbox" '. (!empty($option_paged_noindex) ? 'checked="yes"' : '') . ' value="1"/>'.esc_html__('Add a "noindex" meta robots for all paginated archive pages', 'siteseo'). '</label> <p class="description">'.esc_html__('eg: https://example.com/category/my-category/page/2/.','siteseo').'</p> </td> </tr> <td colspan="2"><span class="dashed-line"></span></td> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('noindex on attachment pages','siteseo').'</th> <td> <label> <input name="siteseo_options[attachments_noindex]" type="checkbox"' . (!empty($option_attachments_noindex) ? 'checked="yes"' : '').' value="1"/>'.esc_html__(' Add a "noindex" meta robots for all attachment pages', 'siteseo') . '</label> <p class="description">'.esc_html__('eg: https://example.com/my-media-attachment-page.','siteseo').'</p> </td> </tr> </tbody> </table><input type="hidden" name="siteseo_options[advanced_tab]" value="1"/>'; } static function archives(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } // $options = $siteseo->titles_settings; $options = get_option('siteseo_titles_option_name'); // Load settings $option_author_title = !empty($options['titles_archives_author_title']) ? $options['titles_archives_author_title'] : ''; $option_author_desc = !empty($options['titles_archives_author_desc']) ? $options['titles_archives_author_desc'] : ''; $option_author_noindex = !empty($options['titles_archives_author_noindex']) ? $options['titles_archives_author_noindex'] : ''; $option_author_disabled = !empty($options['titles_archives_author_disable']) ? $options['titles_archives_author_disable'] : ''; $option_date_title = !empty($options['titles_archives_date_title']) ? $options['titles_archives_date_title'] : ''; $option_date_desc = !empty($options['titles_archives_date_desc']) ? $options['titles_archives_date_desc'] : ''; $option_date_noindex = !empty($options['titles_archives_date_noindex']) ? $options['titles_archives_date_noindex'] : ''; $option_date_disabled = !empty($options['titles_archives_date_disable']) ? $options['titles_archives_date_disable'] : ''; $option_search_title = !empty($options['titles_archives_search_title']) ? $options['titles_archives_search_title'] : ''; $option_search_desc = !empty($options['titles_archives_search_desc']) ? $options['titles_archives_search_desc'] : ''; $option_search_noindex = !empty($options['titles_archives_search_title_noindex']) ? $options['titles_archives_search_title_noindex'] : ''; $option_404_title = !empty($options['titles_archives_404_title']) ? $options['titles_archives_404_title'] : ''; $option_404_desc = !empty($options['titles_archives_404_desc']) ? $options['titles_archives_404_desc'] : ''; $archives_fields = [ 'author-archives' => 'Author archives', 'date-archives' => 'Date archives', 'search-archives' => 'Search archives', '404-archives' => '404 archives' ]; $post_types = siteseo_post_types(); echo'<table class="form-table"> <tbody> <tr> <th scope="row"> <div class="siteseo-container">'; $is_first = true; foreach($archives_fields as $post_key => $post_val){ $active_class = $is_first ? 'active' : ''; echo '<a href="-' . esc_attr($post_key) . '" class="' . esc_attr($active_class) . '">' . esc_html($post_val) . '</a>'; $is_first = false; } foreach($post_types as $post_name => $post_type){ if($post_type->has_archive){ $active_class = $is_first ? 'active' : ''; echo '<a href="-' . esc_attr($post_name) . '" class="' . esc_attr($active_class) . '">' . esc_html($post_type->label) . '</a>'; $is_first = false; } } echo '</div> </th> <td> <div id="author-archives"> <h3>'.esc_html__('Archives', 'siteseo').'</h3> <div class="siteseo_wrap_label"> <p class="description">'.esc_html__('Personalize your meta descriptions for all archives.','siteseo').'</p> </div> <span class="line"></span> <h3>'.esc_html__('Author archives', 'siteseo').'</h3> <div class="siteseo_wrap_label"><p>'.esc_html__('Title template', 'siteseo').'</p></div> <input type="text" name="siteseo_options[author_title]" value="'. esc_attr($option_author_title) . '"> <div class="wrap-tags"> <button class="tag-title-btn" id="btn-author-acrhive-title" data-tag="%%post_author%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('POST AUTHOR','siteseo').' </button> <button class="tag-title-btn" id="btn-author-acrhive-separator" data-tag="%%sep%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SEPARATOR','siteseo').' </button> <button class="tag-title-btn" id="btn-author-acrhive-sitetitle" data-tag="%%sitetitle%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SITE TITLE','siteseo').' </button>'; siteseo_suggestion_button(); echo '</div> <div class="siteseo_wrap_label"><p>Meta description template</p></div> <textarea name="siteseo_options[author_desc]">'.esc_html($option_author_desc) . '</textarea><br> <div class="siteseo_wrap_label"> <label> <input name="siteseo_options[author_noindex]" type="checkbox" '.(!empty($option_author_noindex) ? 'checked="yes"' : '').' value="1"/>' . wp_kses_post('Do not display author archives in search engine results <strong>(noindex)</strong>', 'siteseo') .' </label> <label> <input name="siteseo_options[author_disable]" type="checkbox" '.(!empty($option_author_disabled) ? 'checked="yes"' : '').' value="1"/> ' . esc_html__('Disable author archives', 'siteseo') . ' </label> </div> <span class="line"><span> </div> <div id="date-archives"> <h3>'.esc_html__('Date archives', 'siteseo').'</h3> <div class="siteseo_wrap_label"><p>'.esc_html__('Title template','siteseo').'</p></div> <input type="text" name="siteseo_options[date_title]" value="'. esc_attr($option_date_title) .'"> <div class="wrap-tags"> <button class="tag-title-btn" id="btn-date-archive" data-tag="%%archive_date%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('DATE ARCHIVES','siteseo').' </button> <button class="tag-title-btn" id="btn-date-separator" data-tag="%%sep%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SEPARATOR','siteseo').' </button> <button class="tag-title-btn" id="btn-date-sitetitle" data-tag="%%sitetitle%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SITE TITLE','siteseo').' </button>'; siteseo_suggestion_button(); echo '</div> <div class="siteseo_wrap_label"><p>'.esc_html__('Meta description template','siteseo').'</p></div> <textarea name="siteseo_options[date_desc]">'.esc_attr($option_date_desc).'</textarea><br> <div class="siteseo_wrap_label"> <label> <input name="siteseo_options[date_noindex]" type="checkbox" '.(!empty($option_date_noindex) ? 'checked="yes"' : '').' value="1"/>' . wp_kses_post('Do not display date archives in search engine results <strong>(noindex)</strong>', 'siteseo') . ' </label> <label> <input name="siteseo_options[date_disable]" type="checkbox" '.(!empty($option_date_disabled) ? 'checked="yes"' : '').' value="1"/> ' . esc_html__('Disable date archives', 'siteseo') . ' </label> </div> <span class="line"><span> </div> <div id="search-archives"> <h3>Search archives</h3> <div class="siteseo_wrap_label"><p>'.esc_html__('Title template','siteseo').'</p></div> <input type="text" name="siteseo_options[search_title]" value="'.esc_attr($option_search_title).'"> <div class="wrap-tags"> <button class="tag-title-btn" id="btn-search-keyword" data-tag="%%search_keywords%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SEARCH KEYWORDS','siteseo').' </button> <button class="tag-title-btn" id="btn-search-separator" data-tag="%%sep%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SEPARATOR','siteseo').' </button> <button class="tag-title-btn" id="btn-search-sitetitle" data-tag="%%sitetitle%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SITE TITLE','siteseo').' </button>'; siteseo_suggestion_button(); echo '</div> <div class="siteseo_wrap_label"><p>'.esc_html__('Meta description template','siteseo').'</p></div> <textarea name="siteseo_options[search_desc]">'.esc_attr($option_search_desc).'</textarea><br> <div class="siteseo_wrap_label"> <label> <input name="siteseo_options[search_noindex]" type="checkbox" '.(!empty($option_search_noindex) ? 'checked="yes"' : '').' value="1"/> ' . wp_kses_post('Do not display date archives in search engine results <strong>(noindex)</strong>', 'siteseo') . ' </label> </div> <span class="line"><span> </div> <div id="404-archives"> <h3>404 archives</h3> <div class="siteseo_wrap_label"><p>'.esc_html__('Title template','siteseo').'</p></div> <input type="text" name="siteseo_options[title_404]" value="'.esc_attr($option_404_title).'"> <div class="wrap-tags"> <button class="tag-title-btn" id="btn-404-sitetitle" data-tag="%%sep%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SEPARATOR','siteseo').' </button> <button class="tag-title-btn" id="btn-404-separator" data-tag="%%sitetitle%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SITE TITLE','siteseo').' </button>'; siteseo_suggestion_button(); echo '</div> <div class="siteseo_wrap_label"><p>'.esc_html__('Meta description template','siteseo').'</p></div> <textarea name="siteseo_options[desc_404]">'.esc_attr($option_404_desc).'</textarea><br> </div> <br/><br/> <span class="line"></span>'; foreach($post_types as $post_name => $post_type){ if(empty($post_type->has_archive)){ continue; } $post_data = isset($options['titles_archive_titles'][$post_name]) ? $options['titles_archive_titles'][$post_name] : ''; $archive_title = !empty($post_data['archive_title'])? $post_data['archive_title'] : ''; $archive_description = !empty($post_data['archive_desc']) ? $post_data['archive_desc'] : ''; $archive_noindex = !empty($post_data['archive_noindex']) ? $post_data['archive_noindex'] : ''; $archive_nofollow = !empty($post_data['archive_nofollow']) ? $post_data['archive_nofollow'] : ''; $value_check = !empty($options['titles_archive_titles'][$post_name]['archive_title']) ? $options['titles_archive_titles'][$post_name]['archive_title'] : ''; echo'<div id="'.esc_attr($post_name).'"> <h3>'.esc_html($post_type->label).'</h3> <div class="siteseo_wrap_label"><p>'.esc_html__('Title template','siteseo').'</p></div> <input type="text" name="siteseo_options['.esc_attr($post_name).'][archive_title]" value="'.esc_attr($archive_title).'"> <div class="wrap-tags"> <button class="tag-title-btn" data-tag="%%cpt_plural%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('POST TYPE ARCHIVE NAME','siteseo').' </button> <button class="tag-title-btn" data-tag="%%sep%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SEPARATOR','siteseo').' </button> <button class="tag-title-btn" data-tag="%%sitetitle%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SITE TITLE','siteseo').' </button>'; siteseo_suggestion_button(); echo'</div> <div class="siteseo_wrap_label"><p>'.esc_html__('Meta description template','siteseo').'</p></div> <textarea name="siteseo_options['.esc_attr($post_name).'][archive_desc]">'.esc_attr($archive_description).'</textarea><div class="wrap-tags">'; siteseo_suggestion_button(); echo'</div></div><br> <div class="siteseo_wrap_label"> <label> <input name="siteseo_options['.esc_attr($post_name).'][archive_noindex]" type="checkbox" '.(!empty($archive_noindex) ? 'checked="yes"' : '').' value="1"/> ' . wp_kses_post('Do not display author archives in search engine results <strong>(noindex)</strong>', 'siteseo') .' </label><br/><br/> <label> <input name="siteseo_options['.esc_attr($post_name).'][archive_nofollow]" type="checkbox" '.(!empty($archive_nofollow) ? 'checked="yes"' : 'value="1"').' />'.wp_kses_post(__('Do not follow links for this taxonomy archive<strong>(nofollow)</strong>', 'siteseo')).' </label> </div><span class="line"><span>'; } echo'</td> </tr> </tbody> </table> <input type="hidden" name="siteseo_options[archives_tab]" value="1"/>'; } static function post_types(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $options = get_option('siteseo_titles_option_name'); $post_types = siteseo_post_types(); echo '<table class="form-table"> <tbody> <tr> <th scope="row"> <div class="siteseo-container">'; $is_first = true; foreach($post_types as $post_type => $post_arr){ $active_class = $is_first ? 'active' : ''; echo '<a href="#'.esc_attr($post_type).'-types" class="'.esc_attr($active_class).'">'.esc_html($post_arr->labels->name).'</a>'; $is_first = false; } echo '</div> </th><td> <div> <h3>'.esc_html__('Post Types', 'siteseo').'</h3> <div class="siteseo_wrap_label"><p class="description">'.esc_html__('Personalize your titles and meta descriptions for single custom post types.', 'siteseo').'</p></div> </div>'; foreach($post_types as $post_type => $post_arr){ // Load array $post_data = isset($options['titles_single_titles'][$post_type]) ? $options['titles_single_titles'][$post_type] : ''; // Load settings $option_post_disabled = !empty($post_data['disabled']) ? true : false; $option_post_title = !empty($post_data['title']) ? $post_data['title'] : ''; $option_post_desc = !empty($post_data['description']) ? $post_data['description'] : ''; $option_noindex = !empty($post_data['noindex']) ? $post_data['noindex'] : ''; $option_nofollow = !empty($post_data['nofollow']) ? $post_data['nofollow'] : ''; $option_date = !empty($post_data['date']) ? $post_data['date'] : ''; $option_thumb_gcs = !empty($post_data['thumb_gcs']) ? $post_data['thumb_gcs'] : ''; echo '<div id="'.esc_attr($post_type).'-types">'; echo '<div class="siteseo-toggle-cnt"> <h3>'.esc_html($post_arr->labels->name.' ['.$post_type.']').'</h3> <div class="siteseo-toggle-meta '.($option_post_disabled ? '' : 'active').'" id="siteseo-toggle-meta-'.esc_attr($post_type).'"></div> <span id="siteseo-arrow-icon" class="dashicons dashicons-arrow-left-alt siteseo-arrow-icon"></span> <p class="toggle_state_posts" id="toggle_state_'.esc_attr($post_type).'">'.(!$option_post_disabled ? ' Click to hide any SEO metaboxes / columns for this post type' : ' Click to show any SEO metaboxes / columns for this post type').'</p> <input type="hidden" name="siteseo_options['.esc_attr($post_type).'][disabled]" id="enable_'.esc_attr($post_type).'_toggle" value="'.esc_attr($option_post_disabled).'" class="siteseo-suboption-toggle"> </div> <div class="siteseo_wrap_label"><p>'.esc_html__('Title template', 'siteseo').'</p></div> <input type="text" name="siteseo_options['.esc_attr($post_type).'][title]" value="'.esc_attr($option_post_title).'"> <div class="wrap-tags"> <button class="tag-title-btn" id="btn-post-title" data-tag="%%post_title%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('POST TITLE', 'siteseo').' </button> <button class="tag-title-btn" id="btn-post-separator" data-tag="%%sep%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SEPARATOR', 'siteseo').' </button> <button class="tag-title-btn" id="btn-post-site-title" data-tag="%%sitetitle%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SITE TITLE', 'siteseo').' </button>'; siteseo_suggestion_button(); echo '</div> <div class="siteseo_wrap_label"><p class="description">'.esc_html__('Meta description template', 'siteseo').'</p></div> <textarea name="siteseo_options['.esc_attr($post_type).'][desc]">'.esc_attr($option_post_desc).'</textarea> <div class="wrap-tags"> <button class="tag-title-btn" id="btn-'.esc_attr($post_type).'-meta" data-tag="%%post_excerpt%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('POST EXCERPT', 'siteseo').' </button>'; siteseo_suggestion_button(); echo '</div> <div class="siteseo_wrap_label"> <label> <input name="siteseo_options['.esc_attr($post_type).'][noindex]" type="checkbox" '.(!empty($option_noindex) ? 'checked="yes"' : 'value="1"').' /> '.wp_kses_post(__('Do not display this single post type in search engine results <strong>(noindex)</strong>', 'siteseo')).' </label> </div>'; if(!empty($option_noindex)){ echo '<div class="siteseo_wrap_label"> <div class="siteseo-notice is-error"> <p>'.wp_kses_post(__('This custom post type is <strong>NOT</strong> excluded from your XML sitemaps despite the fact that it is set to <strong>NOINDEX</strong>.', 'siteseo')).' </p> </div> </div>'; } echo '<div class="siteseo_wrap_label"> <label> <input name="siteseo_options['.esc_attr($post_type).'][nofollow]" type="checkbox" '.(!empty($option_nofollow) ? 'checked="yes"' : 'value="1"').' /> '.wp_kses_post(__('Do not follow links for this single post type <strong>nofollow</strong>', 'siteseo')).' </label> </div> <div class="siteseo_wrap_label"> <label> <input name="siteseo_options['.esc_attr($post_type).'][date]" type="checkbox" '.(!empty($option_date) ? 'checked="yes"' : 'value="1"').' /> '.esc_html__('Display date in Google search results by adding article:published_time and article:modified_time meta?', 'siteseo').' </label> <p class="description">'. esc_html__('Unchecking this does not prevent Google from displaying the post date in search results.', 'siteseo').'</p> </div> <div class="siteseo_wrap_label"> <label> <input name="siteseo_options['.esc_attr($post_type).'][thumb_gcs]" type="checkbox" '.(!empty($option_thumb_gcs) ? 'checked="yes"' : 'value="1"').' /> '.esc_html__('Display post thumbnail in Google Custom Search results?', 'siteseo').' </label> <p class="description">'.esc_html__('This option does not apply to traditional search results.', 'siteseo').'</p> </div> </div>'; } echo '</td></tr> </tbody> </table> <input type="hidden" name="siteseo_options[post_types_tab]" value="1"/>'; } static function taxonomies(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } // $options = $siteseo->titles_setting; $options = get_option('siteseo_titles_option_name'); $taxonomies = get_taxonomies(['show_ui' => true, 'public' => true], 'objects', 'and'); echo '<table class="form-table"> <tbody> <tr> <th scope="row"> <div class="siteseo-container">'; $is_first = true; foreach($taxonomies as $fields_key => $fields_val){ $active_class = $is_first ? 'active' : ''; echo '<a href="#'.esc_attr($fields_key).'-types" class="'.esc_attr($active_class).'">'.esc_html($fields_val->label).'</a>'; $is_first = false; } echo '</th> <td> <h3>'.esc_html__('Taxonomies','siteseo').'</h3> <div class="siteseo_wrap_label"> <p class="description">'.esc_html__('Personalize your meta descriptions for all taxonomy archives.','siteseo').'</p> </div>'; foreach($taxonomies as $taxonomy => $_tax){ // Load array $options_tax = isset($options['titles_tax_titles'][$taxonomy]) ? $options['titles_tax_titles'][$taxonomy] : ''; // Load settings $option_disabled_category = !empty($options_tax['disabled']) ? $options_tax['disabled'] : ''; $option_cat_title = !empty($options_tax['title']) ? $options_tax['title'] : ''; $option_cat_desc = !empty($options_tax['description']) ? $options_tax['description'] : ''; $option_cat_noindex = !empty($options_tax['noindex']) ? $options_tax['noindex'] : ''; $option_cat_nofollow = !empty($options_tax['nofollow']) ? $options_tax['nofollow'] : ''; $taxonomies_fields = [ 'categories-types' => 'Categories', 'tags-types' => 'Tags', ]; echo '<div id="'.esc_attr($taxonomy).'-types"><h3>'.esc_html($_tax->label.'['.$taxonomy.']').'</h3> <div class="siteseo-toggle-cnt"> <div class="siteseo-toggle-meta '.($option_disabled_category ? '' : 'active').'" id="siteseo-toggle-meta-category"></div> <span id="siteseo-arrow-icon" class="dashicons dashicons-arrow-left-alt siteseo-arrow-icon"></span> <p class="toggle_state_category" id="toggle_state_category">' .($option_disabled_category ? 'Enable' : 'Disable'). '</p> <input type="hidden" name="siteseo_options['.esc_attr($taxonomy).'][disabled]" id="enable_'.esc_attr($taxonomy).'" value="'.esc_attr($option_disabled_category).'" class="siteseo-suboption-toggle"> </div> <div class="siteseo_wrap_label"> <p class="description">'.esc_html__('Title template','siteseo').'</p> </div> <input type="text" value="'.esc_attr($option_cat_title).'" name="siteseo_options['.esc_attr($taxonomy).'][title]"> <div class="wrap-tags"> <button class="tag-title-btn" data-tag="%%_category_title%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('CATEGORY TITLE','siteseo').' </button> <button class="tag-title-btn" data-tag="%%sep%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SEPARATOR','siteseo').' </button> <button class="tag-title-btn" data-tag="%%sitetitle%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SITE TITLE','siteseo').' </button>'; siteseo_suggestion_button(); echo '</div> <div class="siteseo_wrap_label"> <p class="description">Meta description template</p> </div> <textarea name="siteseo_options['.esc_attr($taxonomy).'][desc]">'.esc_attr($option_cat_desc).'</textarea> <div class="wrap-tags"> <button class="tag-title-btn" data-tag="%%_category_description%%"> <span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('CATEGORY DESCRIPTION','siteseo').' </button>'; siteseo_suggestion_button(); echo '</div> <div class="siteseo_wrap_label"> <label> <input name="siteseo_options['.esc_attr($taxonomy).'][noindex]" type="checkbox" '.(!empty($option_cat_noindex) ? 'checked="yes"' : 'value="1"').' /> '.wp_kses_post(__('Do not display this taxonomy archive in search engine results<strong>(noindex)</strong>', 'siteseo')).' </label> </div>'; if(!empty($option_cat_noindex)){ echo '<div class="siteseo_wrap_label"> <div class="siteseo-notice is-error"> <p>'.wp_kses_post(__('This custom taxonomy is <strong>NOT</strong> excluded from your XML sitemaps despite the fact that it is set to <strong>NOINDEX</strong>. We recommend that you check this out.', 'siteseo')).' </p> </div> </div>'; } echo '<div class="siteseo_wrap_label"> <label> <input name="siteseo_options['.esc_attr($taxonomy).'][nofollow]" type="checkbox" '.(!empty($option_cat_nofollow) ? 'checked="yes"' : 'value="1"').' /> '.wp_kses_post(__('Do not follow links for this taxonomy archive<strong>(nofollow)</strong>', 'siteseo')).' </label> </div> </div>'; } echo '</td> </tr> </tbody> </table> <input type="hidden" name="siteseo_options[taxonomies_tab]" value="1"/>'; } static function save_settings(){ global $siteseo; check_admin_referer('siteseo_title_settings'); if(!siteseo_user_can('manage_title') || !is_admin()){ return; } $options = []; if(empty($_POST['siteseo_options'])){ return; } if(isset($_POST['siteseo_options']['home_tab'])){ $options['titles_sep'] = isset($_POST['siteseo_options']['separator']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['separator'])) : ''; $options['titles_home_site_title'] = isset($_POST['siteseo_options']['site_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['site_title'])) : ''; $options['titles_home_site_title_alt'] = isset($_POST['siteseo_options']['alt_site_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['alt_site_title'])) : ''; $options['titles_home_site_desc'] = isset($_POST['siteseo_options']['media_desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['media_desc'])) : ''; } if(isset($_POST['siteseo_options']['advanced_tab'])){ $options['titles_noindex'] = isset($_POST['siteseo_options']['noindex']); $options['titles_nofollow'] = isset($_POST['siteseo_options']['no_follow']); $options['titles_noimageindex'] = isset($_POST['siteseo_options']['no_image']); $options['titles_noarchive'] = isset($_POST['siteseo_options']['no_archive']); $options['titles_nosnippet'] = isset($_POST['siteseo_options']['no_snippet']); $options['titles_nositelinkssearchbox'] = isset($_POST['siteseo_options']['no_site_links_searchbox']); $options['titles_paged_rel'] = isset($_POST['siteseo_options']['page_rel']); $options['titles_paged_noindex'] = isset($_POST['siteseo_options']['titles_paged_noindex']); $options['titles_attachments_noindex'] = isset($_POST['siteseo_options']['attachments_noindex']); } if(isset($_POST['siteseo_options']['post_types_tab'])){ $post_types = siteseo_post_types(); $post_types = array_keys($post_types); // Saving Posts foreach($post_types as $post_type){ $options['titles_single_titles'][$post_type]['disabled'] = !empty($_POST['siteseo_options'][$post_type]['disabled']) ? true : false; $options['titles_single_titles'][$post_type]['title'] = isset($_POST['siteseo_options'][$post_type]['title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options'][$post_type]['title'])) : ''; $options['titles_single_titles'][$post_type]['description'] = isset($_POST['siteseo_options'][$post_type]['desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options'][$post_type]['desc'])) : ''; $options['titles_single_titles'][$post_type]['noindex'] = isset($_POST['siteseo_options'][$post_type]['noindex']); $options['titles_single_titles'][$post_type]['nofollow'] = isset($_POST['siteseo_options'][$post_type]['nofollow']); $options['titles_single_titles'][$post_type]['date'] = isset($_POST['siteseo_options'][$post_type]['date']); $options['titles_single_titles'][$post_type]['thumb_gcs'] = isset($_POST['siteseo_options'][$post_type]['thumb_gcs']); } } if(isset($_POST['siteseo_options']['archives_tab'])){ $post_types = siteseo_post_types(); $post_types = array_keys($post_types); $options['titles_archives_author_title'] = isset($_POST['siteseo_options']['author_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['author_title'])) : ''; $options['titles_archives_author_desc'] = isset($_POST['siteseo_options']['author_desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['author_desc'])) : ''; $options['titles_archives_author_noindex'] = isset($_POST['siteseo_options']['author_noindex']); $options['titles_archives_author_disable'] = isset($_POST['siteseo_options']['author_disable']); $options['titles_archives_date_title'] = isset($_POST['siteseo_options']['date_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['date_title'])) : ''; $options['titles_archives_date_desc'] = isset($_POST['siteseo_options']['date_desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['date_desc'])) : ''; $options['titles_archives_date_noindex'] = isset($_POST['siteseo_options']['date_noindex']); $options['titles_archives_date_disable'] = isset($_POST['siteseo_options']['date_disable']); $options['titles_archives_search_title'] = isset($_POST['siteseo_options']['search_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['search_title'])) : ''; $options['titles_archives_search_desc'] = isset($_POST['siteseo_options']['search_desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['search_desc'])) : ''; $options['titles_archives_search_title_noindex'] = isset($_POST['siteseo_options']['search_noindex']); $options['titles_archives_404_title'] = isset($_POST['siteseo_options']['title_404']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['title_404'])) : ''; $options['titles_archives_404_desc'] = isset($_POST['siteseo_options']['desc_404']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['desc_404'])) : ''; foreach($post_types as $post_type){ $options['titles_archive_titles'][$post_type]['archive_title'] = isset($_POST['siteseo_options'][$post_type]['archive_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options'][$post_type]['archive_title'])) : ''; $options['titles_archive_titles'][$post_type]['archive_desc'] = isset($_POST['siteseo_options'][$post_type]['archive_desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options'][$post_type]['archive_desc'])) : ''; $options['titles_archive_titles'][$post_type]['archive_noindex'] = isset($_POST['siteseo_options'][$post_type]['archive_noindex']); $options['titles_archive_titles'][$post_type]['archive_nofollow'] = isset($_POST['siteseo_options'][$post_type]['archive_nofollow']); } } if(isset($_POST['siteseo_options']['taxonomies_tab'])){ $taxonomies = get_taxonomies(['show_ui' => true, 'public' => true], 'objects', 'and'); $taxonomies = array_keys($taxonomies); foreach($taxonomies as $taxonomy){ $options['titles_tax_titles'][$taxonomy]['disabled'] = !empty($_POST['siteseo_options'][$taxonomy]['disabled']) ? true : false; $options['titles_tax_titles'][$taxonomy]['title'] = isset($_POST['siteseo_options'][$taxonomy]['title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options'][$taxonomy]['title'])) : ''; $options['titles_tax_titles'][$taxonomy]['description'] = isset($_POST['siteseo_options'][$taxonomy]['desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options'][$taxonomy]['desc'])) : ''; $options['titles_tax_titles'][$taxonomy]['noindex'] = isset($_POST['siteseo_options'][$taxonomy]['noindex']); $options['titles_tax_titles'][$taxonomy]['nofollow'] = isset($_POST['siteseo_options'][$taxonomy]['nofollow']); } } update_option('siteseo_titles_option_name', $options); } } settings/advanced.php 0000644 00000136571 15100371032 0010667 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO\Settings; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Advanced{ static function menu(){ global $siteseo; $current_tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : 'tab_image_seo'; // Default tab $titles_meta_subtabs = [ 'tab_image_seo' => esc_html__('Image SEO', 'siteseo'), 'tab_advanced' => esc_html__('Advanced', 'siteseo'), 'tab_appearance' => esc_html__('Appearance', 'siteseo'), 'tab_security' => esc_html__('Security', 'siteseo'), 'tab_toc' => esc_html__('Table of content', 'siteseo') ]; echo '<div id="siteseo-root">'; Util::admin_header(); echo '<form method="post" id="siteseo-form" class="siteseo-option" name="siteseo-flush">'; wp_nonce_field('siteseo_advance_settings'); $advanced_toggle = isset($siteseo->setting_enabled['toggle-advanced']) ? $siteseo->setting_enabled['toggle-advanced'] : ''; $nonce = wp_create_nonce('siteseo_toggle_nonce'); Util::render_toggle('Image SEO & Advanced Settings - SiteSEO', 'advanced_toggle', $advanced_toggle, $nonce); echo '<div id="siteseo-tabs" class="wrap"> <div class="nav-tab-wrapper">'; foreach($titles_meta_subtabs as $tab_key => $tab_caption){ $active_class = ($current_tab === $tab_key) ? ' nav-tab-active' : ''; echo '<a id="' . esc_attr($tab_key) . '-tab" class="nav-tab' . esc_attr($active_class) . '" data-tab="' . esc_attr($tab_key) . '">' . esc_html($tab_caption) . '</a>'; } echo '</div> <div class="tab-content-wrapper"> <div class="siteseo-tab '.($current_tab == 'tab_image_seo' ? ' active' : '').'" id="tab_image_seo" style="display: none;">'; self::image_seo(); echo '</div> <div class="siteseo-tab '.($current_tab == 'tab_advanced' ? ' active' : '').'" id="tab_advanced" style="display: none;">'; self::advanced(); echo '</div> <div class="siteseo-tab '.($current_tab == 'tab_appearance' ? ' active' : '').'" id="tab_appearance" style="display: none;">'; self::appearance(); echo '</div> <div class="siteseo-tab '.($current_tab == 'tab_security' ? ' active' : '').'" id="tab_security" style="display: none;">'; self::security(); echo '</div> <div class="siteseo-tab '.($current_tab == 'tab_toc' ? ' active' : '').'" id="tab_toc" style="display: none;">'; self::toc(); echo '</div> </div>'; Util::submit_btn(); echo '</form></div>'; } static function image_seo(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->$advanced_settings; $options = get_option('siteseo_advanced_option_name'); $option_attachment = isset($options['advanced_attachments']) ? $options['advanced_attachments'] : ''; $option_attachment_file = isset($options['advanced_attachments_file']) ? $options['advanced_attachments_file'] : ''; $option_clean_filename = isset($options['advanced_clean_filename']) ? $options['advanced_clean_filename'] : ''; $option_img_title = isset($options['advanced_image_auto_title_editor']) ? $options['advanced_image_auto_title_editor'] : ''; $option_img_alt = isset($options['advanced_image_auto_alt_editor']) ? $options['advanced_image_auto_alt_editor'] : ''; $option_target_key = isset($options['advanced_image_auto_alt_target_kw']) ? $options['advanced_image_auto_alt_target_kw'] : ''; $option_cap_img = isset($options['advanced_image_auto_caption_editor']) ? $options['advanced_image_auto_caption_editor'] : ''; $option_desc_img = isset($options['advanced_image_auto_desc_editor']) ? $options['advanced_image_auto_desc_editor'] : ''; echo '<h3 class="siteseo-tabs">'.esc_html__('Image SEO','siteseo').'</h3> <p>'.esc_html__('Images can drive significant traffic to your site. Be sure to always add alt text, optimize file sizes, and properly name the files, among other best practices.','siteseo').'</p> <table class="form-table"> <tbody class="siteseo_tbody"> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Redirect attachment pages to the post parent page.','siteseo').'</th> <td> <label> <input name="siteseo_options[attachment]" type="checkbox"'.(!empty($option_attachment) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Redirect attachment pages to the post parent, or to the homepage if no parent exists.', 'siteseo'). '</label> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Redirect attachment pages to their file URL','siteseo').'</th> <td> <label> <input name="siteseo_options[attachment_file]" type="checkbox"'.(!empty($option_attachment_file) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Redirect attachment pages to their respective file URLs (e.g., https://www.example.com/my-image-file.jpg).', 'siteseo'). '</label> <p class="description">'.esc_html__('If this option is enabled, it will override the redirection of attachment pages to the post parent.','siteseo').'</p> </td> <tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Cleaning media filename','siteseo').'</th> <td> <label> <input name="siteseo_options[clean_filename]" type="checkbox"'.(!empty($option_clean_filename) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('When uploading media, remove accents, spaces, and capital letters, and enforce UTF-8 encoding.', 'siteseo'). '</label> <p class="description">'.esc_html__('e.g. "ExãMple 1 cópy!.jpg" => "example-1-copy.jpg"','siteseo').'</p> </td> <tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Automatically set the image Title','siteseo').'</th> <td> <label> <input name="siteseo_options[auto_img_title]" type="checkbox"'.(!empty($option_img_title) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('When uploading an image file, automatically set the title to match the filename.', 'siteseo'). '</label> <p class="description">'.esc_html__('We use the product title for WooCommerce items.','siteseo').'</p> </td> <tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Automatically set the image Alt txt','siteseo').'</th> <td> <label><input name="siteseo_options[auto_img_alt]" type="checkbox"'.(!empty($option_img_alt) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('When uploading an image file, automatically set the alt text to match the filename.', 'siteseo'). '</label> </td> <tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Automatically set the image alt text using target keywords..','siteseo').'</th> <td> <label> <input name="siteseo_options[auto_target_keyword]" type="checkbox"'.(!empty($option_target_key) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Use the target keywords if no alt text is set for the image.', 'siteseo'). '</label> <p class="description">'.esc_html__('This setting will apply only to images without alt text on the frontend. It is retroactive, meaning if you disable it, images that previously had empty alt text will revert to being empty.','siteseo').'</p> </td> <tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Automatically set the image Caption','siteseo').'</th> <td> <label> <input name="siteseo_options[caption_image]" type="checkbox"'.(!empty($option_cap_img) ? 'checked="yes"' : '') . ' value="1"/>'.esc_html__('When uploading an image file, automatically set the caption to match the filename.', 'siteseo') . '</label> </td> <tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Automatically set the image Description','siteseo').'</th> <td> <label> <input name="siteseo_options[description_img]" type="checkbox"'.(!empty($option_desc_img) ? 'checked="yes"' : ''). ' value="1"/>'.esc_html__('When uploading an image file, automatically set the description to match the filename.', 'siteseo'). '</label> </td> <tr> </tbody> </table><input type="hidden" name="siteseo_options[image_seo]" value="1"/>'; } static function advanced(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->advanced_settings; $options = get_option('siteseo_advanced_option_name'); $option_taxonomy_desc = isset($options['advanced_tax_desc_editor']) ? $options['advanced_tax_desc_editor'] : ''; $option_category_url = isset($options['advanced_category_url']) ? $options['advanced_category_url'] : ''; $option_noreferrer_link = isset($options['advanced_noreferrer']) ? $options['advanced_noreferrer'] : ''; $option_wp_generator = isset($options['advanced_wp_generator']) ? $options['advanced_wp_generator'] : ''; $option_hentry_post = isset($options['advanced_hentry']) ? $options['advanced_hentry'] : ''; $option_author_url = isset($options['advanced_comments_author_url']) ? $options['advanced_comments_author_url'] : ''; $option_site_fileds = isset($options['advanced_comments_website']) ? $options['advanced_comments_website'] : ''; $option_rel_attributes = isset($options['advanced_comments_form_link']) ? $options['advanced_comments_form_link'] : ''; $option_shortlink = isset($options['advanced_wp_shortlink']) ? $options['advanced_wp_shortlink'] : ''; $option_wlw_meta_tag = isset($options['advanced_wp_wlw']) ? $options['advanced_wp_wlw'] : ''; $option_rsd_meta_tag = isset($options['advanced_wp_rsd']) ? $options['advanced_wp_rsd'] : ''; $option_google_meta_value = isset($options['advanced_google']) ? $options['advanced_google'] : ''; $option_bing_meta_value = isset($options['advanced_bing']) ? $options['advanced_bing'] : ''; $option_pinterest_meta_value = isset($options['advanced_pinterest']) ? $options['advanced_pinterest'] : ''; $option_yandex_meta_value = isset($options['advanced_yandex']) ? $options['advanced_yandex'] : ''; $option_remove_wocommerce_cat_url = isset($options['advanced_product_cat_url']) ? $options['advanced_product_cat_url'] : ''; echo '<h3 class="siteseo-tabs">'.esc_html__('Advanced','siteseo').'</h3> <p class="description">'.esc_html__('Advanced SEO options for advanced users.','siteseo').'</p> <table class="form-table"/> <tbody> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Add WP Editor to taxonomy description textarea','siteseo').'</th> <td> <label> <input name="siteseo_options[taxonomy_desc]" type="checkbox"'.(!empty($option_taxonomy_desc) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Add the TINYMCE editor to the term description field to enable rich text formatting.', 'siteseo'). '</label> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Remove /category/ in URL','siteseo').'</th> <td> <label> <input name="siteseo_options[category_url]" type="checkbox"'.(!empty($option_category_url) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Remove /category/ in your permalinks', 'siteseo'). '</label> <p class="description">'.esc_attr('e.g. "https://example.com/category/my-post-category/" => "https://example.com/my-post-category/"','siteseo').'</p> </td> </tr> <tr> <th scope="row">'.esc_html__('Remove category base from product permalinks','siteseo').'</th> <td> <label> <input type="checkbox" name="siteseo_options[remove_cate_woocommerce]" '.(!empty($option_remove_wocommerce_cat_url) ? 'checked="yes"' : '').' value="1"/> '. /* translators: placeholders are just html tags */ wp_kses_post(sprintf(__('Remove %1$s product-category %2$s in your permalinks', 'siteseo'), '<strong>','</strong>')).' </label> </div> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Remove noreferrer link attribute in post content','siteseo').'</th> <td> <label> <input name="siteseo_options[noreferrer_link]" type="checkbox"'.(!empty($option_noreferrer_link) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Remove the noreferrer link attribute from the source code.', 'siteseo'). '</label> <p class="description">'.esc_html__('Useful for affiliate links (eg: Amazon)','siteseo').'</p> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Remove WordPress meta generator tag','siteseo').'</th> <td> <label> <input name="siteseo_options[wp_generator_meta]" type="checkbox"'.(!empty($option_wp_generator) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Remove WordPress meta generator in source code', 'siteseo'). '</label> <div class="siteseo-styles pre"><pre>'.esc_html('<meta name="generator" content="WordPress 6.0.3" />').'</pre></div> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Remove hentry post class','siteseo').'</th> <td> <label> <input name="siteseo_options[hentry_post]" type="checkbox"' . (!empty($option_hentry_post) ? 'checked="yes"' : '') . ' value="1"/>' . esc_html__('Remove the `hentry` post class to prevent Google from treating it as structured data (schema)', 'siteseo') . '</label> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Remove author URL','siteseo').'</th> <td> <label> <input name="siteseo_options[comments_author_url]" type="checkbox"'.(!empty($option_author_url) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Remove the comment author URL in comments if the website field is filled in the profile page.', 'siteseo'). '</label> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Remove website field from comment form','siteseo').'</th> <td> <label> <input name="siteseo_options[website_filed]" type="checkbox"'.(!empty($option_site_fileds) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Remove the website field from the comment form to reduce spam.', 'siteseo'). '</label> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Add the "nofollow", "noopener", and "noreferrer" rel attributes to the links in the comment form.','siteseo').'</th> <td> <label> <input name="siteseo_options[comment_form_link]" type="checkbox"'.(!empty($option_rel_attributes) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Prevent search engines from following or indexing the link to the comment form by adding a "noindex", "nofollow" directive.', 'siteseo'). '</label> <div class="siteseo-styles pre"><pre>'.esc_url('https://www.example.com/my-blog-post/#respond').'</pre></div> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Remove WordPress shortlink meta tag','siteseo').'</th> <td> <label> <input name="siteseo_options[shortlink]" type="checkbox"'.(!empty($option_shortlink) ? 'checked="yes"' : '') .' value="1"/>'.esc_html__('Remove WordPress shortlink meta tag in source', 'siteseo'). '</label> <div class="siteseo-styles pre"><pre>'.esc_html('<link rel="shortlink" href="https://www.example.com/"/>').'</pre></div> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Remove Windows Live Writer meta tag','siteseo').'</th> <td> <label> <input name="siteseo_options[wlw_meta]" type="checkbox"'.(!empty($option_wlw_meta_tag) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Remove the Windows Live Writer meta tag from the source code.', 'siteseo') . '</label> <div class="siteseo-styles pre"><pre>'.esc_html('<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="https://www.example.com/wp-includes/wlwmanifest.xml" />').'</pre></div> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Remove RSD meta tag','siteseo').'</th> <td> <label> <input name="siteseo_options[rsd_meta]" type="checkbox"'.(!empty($option_rsd_meta_tag) ? 'checked="yes"' : ''). ' value="1"/>'. esc_html__('Remove the Really Simple Discovery (RSD) meta tag from the source code.', 'siteseo'). '</label> <p class="description">'.esc_html__('The WordPress Site Health feature will display an HTTPS warning if you enable this option. However, this is a false positive.','siteseo').'</p> <div class="siteseo-styles pre"><pre>' . esc_html('<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="https://www.example.com/wp-includes/wlwmanifest.xml" />') . '</pre></div> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Google site verification','siteseo').'</th> <td> <input name="siteseo_options[google_meta_value]" type="text" placeholder="'.esc_html__('Enter Google meta value site verification','siteseo').'" value="'.esc_attr($option_google_meta_value).'"/> <p class="description">'. /* translators: placeholders are just <strong> tag */ wp_kses_post(sprintf(__('If your site is already verified in %1$s Google Search Console %2$s, you can leave this field blank.', 'siteseo'), '<strong>', '</strong>')).' </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Bing site verification','siteseo').'</th> <td> <input name="siteseo_options[bing_meta_value]" type="text" placeholder="'.esc_html__('Enter Bing meta value site verification','siteseo').'" value="'.esc_attr($option_bing_meta_value).'"/> <p class="description">'. /* translators: placeholders are just <strong> tag */ wp_kses_post(sprintf(__('If your site is already verified in %1$s Bing Webmaster Tools %2$s, you can leave this field blank.', 'siteseo'), '<strong>', '</strong>')).'</p> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Pinterest site verification','siteseo').'</th> <td> <input name="siteseo_options[pinterest_meta_value]" type="text" placeholder="'.esc_html__('Enter the Pinterest meta value for site verification.','siteseo').'" value="'.esc_attr($option_pinterest_meta_value).'"/> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Yandex site verification','siteseo').'</th> <td> <input name="siteseo_options[yandex_meta_value]" type="text" placeholder="'.esc_html__('Enter the Yandex meta value for site verification.','siteseo').'" value="'.esc_attr($option_yandex_meta_value).'"/> </td> </tr> </tbody> </table><input type="hidden" name="siteseo_options[advanced_tab]" value="1"/>'; } static function appearance(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->advanced_settings; $options = get_option('siteseo_advanced_option_name'); $option_enable_universal_metabox = isset($options['appearance_universal_metabox']) ? $options['appearance_universal_metabox'] : ''; $option_disable_universal_metabox = isset($options['appearance_universal_metabox_disable']) ? $options['appearance_universal_metabox_disable'] : ''; $option_content_analysis_metabox = isset($options['appearance_ca_metaboxe']) ? $options['appearance_ca_metaboxe'] : ''; $option_hide_genesis_metabox = isset($options['appearance_genesis_seo_metaboxe']) ? $options['appearance_genesis_seo_metaboxe'] : ''; $option_structured_type_metabox = isset($options['appearance_advice_schema']) ? $options['appearance_advice_schema'] : ''; $option_admin_bar = isset($options['appearance_adminbar']) ? $options['appearance_adminbar'] : ''; $option_noindex_admin_bar = isset($options['appearance_adminbar_noindex']) ? $options['appearance_adminbar_noindex'] : ''; $option_column_title = isset($options['appearance_title_col']) ? $options['appearance_title_col'] : ''; $option_column_desc = isset($options['appearance_meta_desc_col']) ? $options['appearance_meta_desc_col'] : ''; $option_column_redirect = isset($options['appearance_redirect_enable_col']) ? $options['appearance_redirect_enable_col'] : ''; $option_column_post_type = isset($options['appearance_redirect_url_col']) ? $options['appearance_redirect_url_col'] : ''; $option_column_canonical_post_ty = isset($options['appearance_canonical']) ? $options['appearance_canonical'] : ''; $option_column_target_key = isset($options['appearance_target_kw_col']) ? $options['appearance_target_kw_col'] : ''; $option_column_noindex = isset($options['appearance_noindex_col']) ? $options['appearance_noindex_col'] : ''; $option_column_nofollow = isset($options['appearance_nofollow_col']) ? $options['appearance_nofollow_col'] : ''; $option_column_words_no = isset($options['appearance_words_col']) ? $options['appearance_words_col'] : ''; $option_column_score = isset($options['appearance_score_col']) ? $options['appearance_score_col'] : ''; $option_misc_genesis_metabox = isset($options['appearance_genesis_seo_menu']) ? $options['appearance_genesis_seo_menu'] : ''; $appearance_fields =[ 'metaboxes'=>'Metaboxes', 'Admin-bar'=>'Admin bar', 'Columns' => 'Columns', 'Misc' =>'Misc', ]; echo '<table class="form-table"> <tbody> <tr> <th scope="row"> <div class="siteseo-container">'; $is_first = true; foreach($appearance_fields as $post_key => $post_val){ $active_class = $is_first ? 'active' : ''; echo '<a href="#'.esc_attr($post_key).'" class="'.esc_attr($active_class).'">'.esc_html($post_val).'</a>'; $is_first = false; } echo '</div> </th> <td> <div> <h3>'.esc_html__('Appearance','siteseo').'</h3> <div class="siteseo_wrap_label"> <p class="description">'.esc_html__('Customize the plugin to fit your needs','siteseo').'</p> </div> <span class="line"></span> <h3>'.esc_html__('Metaboxes','siteseo').'</h3> <p>'.esc_html__('Edit your SEO metadata directly from your favorite page builder.','siteseo').'</p> <table class="form-table" id="metaboxes"> <tbody> <tr> <th scope="row">'.esc_html__('Universal Metabox (Gutenberg)','siteseo').'</th> <td> <label><input type="checkbox" name="siteseo_options[enable_universal_metabox]" '.(!empty($option_enable_universal_metabox) ? 'checked="yes"' : 'value="1"').' "/> ' . esc_html__('Enable the universal SEO metabox for the Block Editor (Gutenberg)', 'siteseo') . '<label> </td> </tr> <tr> <th scope="row">'.esc_html__('Disable Universal Metabox','siteseo').'</th> <td> </label><input type="checkbox" name="siteseo_options[disable_universal_metabox]" '.(!empty($option_disable_universal_metabox) ? 'checked="yes"' : 'value="1"').' "/>'.esc_html__('Disable the universal SEO metabox','siteseo').' </td> </tr> <tr> <th scope="row">'.esc_html__('Remove Content Analysis Metabox','siteseo').'</th> <td> <label><input type="checkbox" '.(!empty($option_content_analysis_metabox) ? 'checked="yes"' : 'value="1"').' name="siteseo_options[remove_content_analysis]"> '.esc_html__(' Remove Content Analysis Metabox','siteseo').'</label> <p class="description">'.esc_html__('By checking this option, we will no longer track the significant keywords','siteseo').'</p> </td> </tr> <tr> <th scope=row">'.esc_html__('Hide Genesis SEO Metabox','siteseo').'</th> <td> <label><input type="checkbox" '.(!empty($option_hide_genesis_metabox) ? 'checked="yes"' : 'value="1"').' name="siteseo_options[genesis_metabox]"> '.esc_html__(' Remove Genesis SEO Metabox', 'siteseo').'</label> </td> </tr> <tr> <th scope="row">'.esc_html__('Hide advice in Structured Data Types metabox','siteseo').'</th> <td> <label><input type="checkbox" '.(!empty($option_structured_type_metabox) ? 'checked="yes"' : 'value="1"').' name="siteseo_options[structured_data_types_metabox]">'.esc_html__(' Remove the advice if None schema selected', 'siteseo').'</label> </td> </tr> </tbody> </table> <div id="Admin-bar"> <span class="line"></span> <h3>'.esc_html__('Admin bar','siteseo').'</h3> <p class="description">'.esc_html__('The admin bar appears on the top of your pages when logged in to your WP admin','siteseo').'</p> <table> <tbody> <tr> <th scope="row">'.esc_html__('SEO in admin bar','siteseo').'</th> <td> <label><input type="checkbox" '.(!empty($option_admin_bar) ? 'checked="yes"' : 'value="1"').' name="siteseo_options[admin_bar]"> '.esc_html__('Remove SEO from Admin Bar in backend and frontend', 'siteseo').'</label> </td> </tr> <tr> <th scope="row">'.esc_html__('Noindex in admin bar','siteseo').'</th> <td> <label><input type="checkbox" '.(!empty($option_noindex_admin_bar) ? 'checked="yes"' : 'value="1"').' name="siteseo_options[noindex_admin_bar]"> '.esc_html__('Remove noindex item from Admin Bar in backend and frontend', 'siteseo').'</label> </td> </tr> </tbody> </table> </div> <div id="Columns"> <span class="line"></span> <h3>'.esc_html__('Columns','siteseo').'</h3> <p>'.esc_html__('Customize the SEO columns displayed in the posts/pages list.','siteseo').'</p> <table> <tbody> <tr> <th scope="row">'.esc_html__('Show Title tag column in post types','siteseo').'</th> <td> <label><input type="checkbox" '.(!empty($option_column_title) ? 'checked="yes"' : 'value="1"').' name="siteseo_options[title_post_types]"> '.esc_html__('Add title column', 'siteseo').'</label> </td> </tr> <tr> <th scope="row">'.esc_html__('Show Meta description column in post types','siteseo').'</th> <td> <label><input type="checkbox" '.(!empty($option_column_desc) ? 'checked="yes"' : 'value="1"').' name="siteseo_options[desc_post_types]"> '.esc_html__('Add meta description column','siteseo').'</label> </td> </tr> <tr> <th scope="row">'.esc_html__('Show Redirection Enable column in post types','siteseo').'</th> <td> <label><input type="checkbox" '.(!empty($option_column_redirect) ? 'checked="yes"' : 'value="1"').' name="siteseo_options[redirect_post_types]"> '.esc_html__('Add redirection enable column', 'siteseo').'</label> </td> </tr> <tr> <th scope="row">'.esc_html__('Show Redirect URL column in post types','siteseo').'</th> <td> <label><input type="checkbox" '.(!empty($option_column_post_type) ? 'checked="yes"' : 'value="1"').' name="siteseo_options[redirect_url_post_types]"> '.esc_html__('Add redirection URL column', 'siteseo').'</label> </td> </tr> <tr> <th scope="row">'.esc_html__('Show canonical URL column in post types','siteseo').'</th> <td> <label><input type="checkbox" '.(!empty($option_column_canonical_post_ty) ? 'checked="yes"' : 'value="1"').' name="siteseo_options[url_column_post_types]"> '.esc_html__('Add canonical URL column', 'siteseo').'</label> </td> </tr> <tr> <th scope="row">'.esc_html__('Show Target Keyword column in post types','siteseo').'</th> <td> <label><input type="checkbox" '.(!empty($option_column_target_key) ? 'checked="yes"' : 'value="1"').' name="siteseo_options[keyword_column_post_types]"> '.esc_html__('Add target keyword column', 'siteseo').'</label> </td> </tr> <tr> <th scope="row">'.esc_html__('Show noindex column in post types','siteseo').'</th> <td> <label><input type="checkbox" '.(!empty($option_column_noindex) ? 'checked="yes"' : 'value="1"').' name="siteseo_options[noindex_column_post_types]"> '.esc_html__('Display noindex status', 'siteseo').'</label> </td> </tr> <tr> <th scope="row">'.esc_html__('Show nofollow column in post types','siteseo').'</th> <td> <label><input type="checkbox" '.(!empty($option_column_nofollow) ? 'checked="yes"' : 'value="1"').' name="siteseo_options[nofollow_column_post_types]"> '.esc_html__('Display nofollow status', 'siteseo').'</label> </td> </tr> <th scope="row">'.esc_html__('Show total number of words column in post types','siteseo').'</th> <td> <label><input type="checkbox" '.(!empty($option_column_words_no) ? 'checked="yes"' : 'value="1"').' name="siteseo_options[words_column_post_types]"> '.esc_html__('Display total number of words in content', 'siteseo').'</label> </td> </tr> <th scope="row">'.esc_html__('Show content analysis score column in post types','siteseo').'</th> <td> <label><input type="checkbox" '.(!empty($option_column_score) ? 'checked="yes"' : 'value="1"').' name="siteseo_options[score_column_post_types]"> '.esc_html__('Display Content Analysis results column ("Good" or "Should be improved")', 'siteseo').'</label> </td> </tr> </tbody> </table> </div> <div id="Misc"> <span class="line"></span> <h3>'.esc_html__('Misc','siteseo').'</h3> <div class="siteseo_wrap_label"><p>'.esc_html__('Miscellaneous settings for the SEO plugin.','siteseo').'</p></div> <table class="form-table"> <tbody> <tr> <th scope="row">'.esc_html__('Hide Genesis SEO Settings link','siteseo').'</th> <td> <label><input type="checkbox" '.(!empty($option_misc_genesis_metabox) ? 'checked="yes"' : 'value="1"').' name="siteseo_options[genesis_seo_settings]">'.esc_html__('Remove Genesis SEO link in WP Admin Menu', 'siteseo') .'</label> </td> </tr> </tbody> </table> </div> </div> </td> </tr> </tbody> </table> <input type="hidden" name="siteseo_options[appearance_tab]" value="1"/>'; } static function security(){ global $siteseo, $wp_roles, $submenu; if(!empty($_POST['submit'])){ self::save_settings(); } $options = get_option('siteseo_advanced_option_name'); $menus_check = $submenu['siteseo']; $security_fields = [ 'siteseo-metaboxes' => 'SiteSEO Metaboxes', 'siteseo-settings-pages' => 'SiteSEO setting pages', ]; $roles = get_editable_roles(); if(empty($roles)){ return; } wp_nonce_field('siteseo_advance_settings'); echo '<table class="form-table"> <tbody> <tr> <th scope="row"> <div class="siteseo-container">'; $is_first = true; foreach($security_fields as $post_key => $post_val){ $active_class = $is_first ? 'active' : ''; echo '<a href="#' . esc_attr($post_key) . '" class="' . esc_attr($active_class) . '">' . esc_html($post_val) . '</a>'; $is_first = false; } echo '</div> </th> <td> <div> <h3 class="siteseo-tabs">'.esc_html__('Security', 'siteseo').'</h3> <div class="siteseo_wrap_label"> <p class="description">'.esc_html__('Control access to SEO settings and metaboxes by user roles.', 'siteseo').'</p> </div> <h3 class="siteseo-tabs">'.esc_html__('SiteSEO metaboxes', 'siteseo').'</h3> <div class="siteseo_wrap_label"> <p>'.esc_html__('Check a user role to prevent it from editing a specific metabox.', 'siteseo').'</p> </div> <table class="form-table" id="siteseo-metaboxes"> <tbody> <tr> <th scope="row">'.esc_html__('Block SEO metabox to user roles', 'siteseo').'</th> <td>'; foreach($roles as $key => $role){ if(empty($role['capabilities']) || !is_array($role['capabilities']) || !array_key_exists('publish_posts' , $role['capabilities'])){ continue; } $checked = isset($options['security_metaboxe_role'][$key]) ? 'checked' : ''; echo '<label> <input type="checkbox" name="siteseo_options[security_metaboxe_role]['.esc_attr($key).']" value="1" '.esc_attr($checked).'/> <strong>'.esc_html($role['name']).'</strong> </label><br/><br/>'; } echo '</td> </tr> <tr> <th scope="row">'.esc_html__('Block Content analysis metabox to user roles', 'siteseo').'</th> <td>'; foreach($roles as $key => $role){ if(empty($role['capabilities']) || !is_array($role['capabilities']) || !array_key_exists('publish_posts' , $role['capabilities'])){ continue; } $checked = isset($options['security_metaboxe_ca_role'][$key]) ? 'checked' : ''; echo '<label> <input type="checkbox" name="siteseo_options[security_metaboxe_ca_role]['.esc_attr($key).']" value="1" '.esc_attr($checked).'/><strong>'.esc_html($role['name']).'</strong> </label><br/><br/>'; } echo '</td> </tr> </tbody> </table> <span class="line"></span> <h3 class="siteseo-tabs">'.esc_html__('SiteSEO settings pages', 'siteseo').'</h3> <p class="description">'.esc_html__('Check a user role to allow it to edit a specific settings page', 'siteseo').'</p> <table class="form-table" id="siteseo-settings-pages"> <tbody>'; $settings_pages = [ 'titles' => esc_html__('Titles & Metas', 'siteseo'), 'xml-sitemap' => esc_html__('Sitemaps', 'siteseo'), 'social' => esc_html__('Social Networks', 'siteseo'), 'google-analytics' => esc_html__('Analytics', 'siteseo'), 'instant-indexing' => esc_html__('Instant Indexing', 'siteseo'), 'advanced' => esc_html__('Advanced', 'siteseo'), 'import-export' => esc_html__('Tools', 'siteseo') ]; foreach($settings_pages as $page_key => $page_title){ echo '<tr> <th scope="row">' . esc_html($page_title) . '</th> <td>'; foreach($roles as $role_key => $role){ if(empty($role['capabilities']) || !is_array($role['capabilities']) || !array_key_exists('publish_posts' , $role['capabilities']) || $role_key == 'administrator'){ continue; } $checked = isset($options['siteseo_advanced_security_metaboxe_siteseo-' . $page_key][$role_key]) ? 'checked' : ''; echo '<label> <input type="checkbox" name="siteseo_options[siteseo_advanced_security_metaboxe_siteseo-' . esc_attr($page_key) . '][' . esc_attr($role_key) . ']" value="1" ' . esc_attr($checked) . '/> <strong>' . esc_html($role['name']) . '</strong> </label><br/><br/>'; } echo '</td> </tr>'; } //Pro if(is_plugin_active('siteseo-pro/siteseo.php')){ echo '<tr> <th scope="row">' . esc_html__('Pro Features', 'siteseo') . '</th> <td>'; foreach($roles as $key => $role){ if(empty($role['capabilities']) || !is_array($role['capabilities']) || !array_key_exists('publish_posts' , $role['capabilities']) || $key == 'administrator'){ continue; } $checked = isset($options['siteseo_advanced_security_page_pro'][$key]) ? 'checked' : ''; echo '<label> <input type="checkbox" name="siteseo_options[siteseo_advanced_security_page_pro][' . esc_attr($key) . ']" value="1" ' . esc_attr($checked) . '/> <strong>'.esc_html($role['name']).'</strong> </label><br/><br/>'; } echo '</td> </tr>'; } echo '</tbody> </table> </div> </td> </tr> </tbody></table><input type="hidden" name="siteseo_options[security_tab]" value="1"/>'; } static function toc(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $options = get_option('siteseo_advanced_option_name'); $option_toc_enable = isset($options['toc_enable']) ? $options['toc_enable'] : ''; $option_toc_label = isset($options['toc_label']) ? $options['toc_label'] : ''; $option_headings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']; $option_list_types = [ 'ol' => __('Ordered List', 'siteseo'), 'ul' => __('Unordered List', 'siteseo') ]; echo'<h3 class="siteseo-tabs">'.esc_html__('Table of Contents', 'siteseo').'</h3> <p>'.esc_html__('A table of content works as an index section for your post or page. It helps search engines understand your page structure and users find specific sections quickly, which might help SEO, as it helps search engines better understand the structure of your content and also improves user experience.', 'siteseo').'</p> <p>'.esc_html__('To use Table of Content on your pages, you can use this shortcode', 'siteseo').' <code>[siteseo_toc]</code></p> <table class="form-table"> <tr> <th scope="row">'.esc_html__('Enable TOC', 'siteseo').'</th> <td> <label> <input type="checkbox" value="1" id="siteseo_toc_enable" name="siteseo_options[toc_enable]" '.checked($option_toc_enable, true, false).'/> </label> </td> </tr> <tr> <th scope="row">'.esc_html__('TOC Label', 'siteseo').'</th> <td> <label> <input type="text" value="'.esc_attr($option_toc_label).'" name="siteseo_options[toc_label]" placeholder="'.esc_attr__('Table of content', 'siteseo').'"/> </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Exclude Headings', 'siteseo').'</th> <td> <div style="display:flex; gap: 20px;">'; foreach($option_headings as $heading){ $checked = !empty($options) && !empty($options['toc_excluded_headings']) && is_array($options['toc_excluded_headings']) && in_array($heading, $options['toc_excluded_headings']); echo '<label> <input type="checkbox" value="'.esc_attr($heading).'" name="siteseo_options[toc_excluded_headings][]" '.checked($checked, true, false).'/>'.esc_html(strtoupper($heading)).' </label>'; } echo '</div> </td> </tr> <tr> <th scope="row">'.esc_html__('List Type', 'siteseo').'</th> <td> <div> <label> <select name="siteseo_options[toc_heading_type]">'; foreach($option_list_types as $list_type => $list_title){ $selected = !empty($options['toc_heading_type']) && $options['toc_heading_type'] == $list_type ? 'selected' : ''; echo '<option value="'.esc_attr($list_type).'" '.esc_attr($selected).'>'.esc_html($list_title).'</option>'; } echo '</select> </label> </div> </td> </tr> </table><input type="hidden" name="siteseo_options[toc_tab]" value="1" />'; } static function save_settings(){ global $siteseo; check_admin_referer('siteseo_advance_settings'); if(!siteseo_user_can('manage_advanced') || !is_admin()){ return; } $options = []; if(empty($_POST['siteseo_options'])){ return; } if(isset($_POST['siteseo_options']['image_seo'])){ $options['advanced_attachments'] = isset($_POST['siteseo_options']['attachment']); $options['advanced_attachments_file'] = isset($_POST['siteseo_options']['attachment_file']); $options['advanced_clean_filename'] = isset($_POST['siteseo_options']['clean_filename']); $options['advanced_image_auto_title_editor'] = isset($_POST['siteseo_options']['auto_img_title']); $options['advanced_image_auto_alt_editor'] = isset($_POST['siteseo_options']['auto_img_alt']); $options['advanced_image_auto_alt_target_kw'] = isset($_POST['siteseo_options']['auto_target_keyword']); $options['advanced_image_auto_caption_editor'] = isset($_POST['siteseo_options']['caption_image']); $options['advanced_image_auto_desc_editor'] = isset($_POST['siteseo_options']['description_img']); } if(isset($_POST['siteseo_options']['advanced_tab'])){ $options['advanced_product_cat_url'] = isset($_POST['siteseo_options']['remove_cate_woocommerce']); $options['advanced_tax_desc_editor'] = isset($_POST['siteseo_options']['taxonomy_desc']); $options['advanced_category_url'] = isset($_POST['siteseo_options']['category_url']); $options['advanced_noreferrer'] = isset($_POST['siteseo_options']['noreferrer_link']); $options['advanced_wp_generator'] = isset($_POST['siteseo_options']['wp_generator_meta']); $options['advanced_hentry'] = isset($_POST['siteseo_options']['hentry_post']); $options['advanced_comments_author_url'] = isset($_POST['siteseo_options']['comments_author_url']); $options['advanced_comments_website'] = isset($_POST['siteseo_options']['website_filed']); $options['advanced_comments_form_link'] = isset($_POST['siteseo_options']['comment_form_link']); $options['advanced_wp_shortlink'] = isset($_POST['siteseo_options']['shortlink']); $options['advanced_wp_rsd'] = isset($_POST['siteseo_options']['rsd_meta']); $options['advanced_wp_wlw'] = isset($_POST['siteseo_options']['wlw_meta']); $options['advanced_google'] = isset($_POST['siteseo_options']['google_meta_value']) ? sanitize_text_field(Util::extract_content(wp_unslash($_POST['siteseo_options']['google_meta_value']))) : ''; $options['advanced_bing'] = isset($_POST['siteseo_options']['bing_meta_value']) ? sanitize_text_field(Util::extract_content(wp_unslash($_POST['siteseo_options']['bing_meta_value']))) : ''; $options['advanced_pinterest'] = isset($_POST['siteseo_options']['pinterest_meta_value']) ? sanitize_text_field(Util::extract_content(wp_unslash($_POST['siteseo_options']['pinterest_meta_value']))) : ''; $options['advanced_yandex'] = isset($_POST['siteseo_options']['yandex_meta_value']) ? sanitize_text_field(Util::extract_content(wp_unslash($_POST['siteseo_options']['yandex_meta_value']))) : ''; } if(isset($_POST['siteseo_options']['appearance_tab'])){ $options['appearance_universal_metabox'] = isset($_POST['siteseo_options']['enable_universal_metabox']); $options['appearance_universal_metabox_disable'] = isset($_POST['siteseo_options']['disable_universal_metabox']); $options['appearance_ca_metaboxe'] = isset($_POST['siteseo_options']['remove_content_analysis']); $options['appearance_genesis_seo_metaboxe'] = isset($_POST['siteseo_options']['genesis_metabox']); $options['appearance_advice_schema'] = isset($_POST['siteseo_options']['structured_data_types_metabox']); $options['appearance_adminbar'] = isset($_POST['siteseo_options']['admin_bar']); $options['appearance_adminbar_noindex'] = isset($_POST['siteseo_options']['noindex_admin_bar']); $options['appearance_title_col'] = isset($_POST['siteseo_options']['title_post_types']); $options['appearance_meta_desc_col'] = isset($_POST['siteseo_options']['desc_post_types']); $options['appearance_redirect_enable_col'] = isset($_POST['siteseo_options']['redirect_post_types']); $options['appearance_redirect_url_col'] = isset($_POST['siteseo_options']['redirect_url_post_types']); $options['appearance_canonical'] = isset($_POST['siteseo_options']['url_column_post_types']); $options['appearance_target_kw_col'] = isset($_POST['siteseo_options']['keyword_column_post_types']); $options['appearance_noindex_col'] = isset($_POST['siteseo_options']['noindex_column_post_types']); $options['appearance_nofollow_col'] = isset($_POST['siteseo_options']['nofollow_column_post_types']); $options['appearance_words_col'] = isset($_POST['siteseo_options']['words_column_post_types']); $options['appearance_score_col'] = isset($_POST['siteseo_options']['score_column_post_types']); $options['appearance_genesis_seo_menu'] = isset($_POST['siteseo_options']['genesis_seo_settings']); } if(isset($_POST['siteseo_options']['toc_tab'])){ $options['toc_enable'] = isset($_POST['siteseo_options']['toc_enable']); $options['toc_label'] = isset($_POST['siteseo_options']['toc_label']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['toc_label'])) : ''; $options['toc_heading_type'] = isset($_POST['siteseo_options']['toc_heading_type']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['toc_heading_type'])) : ''; //toc_excluded_headings if(isset($_POST['siteseo_options']['toc_excluded_headings'])){ $options['toc_excluded_headings'] = map_deep(wp_unslash($_POST['siteseo_options']['toc_excluded_headings']), 'sanitize_text_field'); } } if(isset($_POST['siteseo_options']['security_tab'])){ $has_admin = ['security_metaboxe_role', 'security_metaboxe_ca_role']; $settings = [ 'security_metaboxe_role', 'security_metaboxe_ca_role', 'siteseo_advanced_security_metaboxe_siteseo-titles', 'siteseo_advanced_security_metaboxe_siteseo-xml-sitemap', 'siteseo_advanced_security_metaboxe_siteseo-social', 'siteseo_advanced_security_metaboxe_siteseo-google-analytics', 'siteseo_advanced_security_metaboxe_siteseo-instant-indexing', 'siteseo_advanced_security_metaboxe_siteseo-advanced', 'siteseo_advanced_security_metaboxe_siteseo-import-export' ]; $advanced_options = map_deep($_POST['siteseo_options'], function($value){ if(!empty($value)){ if(is_string($value)){ return true; } return sanitize_text_field(wp_unslash($value)); } return ''; }); $filtered_options = []; $roles = get_editable_roles(); foreach($settings as $setting){ $accepted_roles = []; foreach($roles as $key => $role){ // We will skip, admin if the setting does not require it. if(!in_array($setting, $has_admin) && $key == 'administrator'){ continue; } // We only accept roles which has capability to 'publish_posts', as giving access to anyone less does not makes sense. if(empty($role['capabilities']) || !is_array($role['capabilities']) || !array_key_exists('publish_posts' , $role['capabilities'])){ continue; } array_push($accepted_roles, $key); } // Making sure the roles being pushed are the once we want. if(isset($advanced_options[$setting])){ $filtered_options[$setting] = array_intersect( $advanced_options[$setting], array_flip($accepted_roles) ); } } $options = array_merge($options, $filtered_options); } update_option('siteseo_advanced_option_name', $options); } } socialmetas.php 0000644 00000060272 15100371032 0007560 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class SocialMetas{ static function add_social_graph(){ global $siteseo; if(empty($siteseo->setting_enabled['toggle-social'])){ return; } $org_type = !empty($siteseo->social_settings['social_knowledge_type']) && $siteseo->social_settings['social_knowledge_type'] !== 'none' ? $siteseo->social_settings['social_knowledge_type'] : ''; $org_name = !empty($siteseo->social_settings['social_knowledge_name']) ? $siteseo->social_settings['social_knowledge_name'] : ''; $org_logo = !empty($siteseo->social_settings['social_knowledge_img']) ? $siteseo->social_settings['social_knowledge_img'] : ''; $org_number = !empty($siteseo->social_settings['social_knowledge_phone']) ? $siteseo->social_settings['social_knowledge_phone'] : ''; $org_contact_type = !empty($siteseo->social_settings['social_knowledge_contact_type']) ? $siteseo->social_settings['social_knowledge_contact_type'] : ''; $org_contact_option = !empty($siteseo->social_settings['social_knowledge_contact_option']) ? $siteseo->social_settings['social_knowledge_contact_option'] : ''; $fb_account = !empty($siteseo->social_settings['social_accounts_facebook']) ? $siteseo->social_settings['social_accounts_facebook'] : ''; $twitter_account = !empty($siteseo->social_settings['social_accounts_twitter']) ? $siteseo->social_settings['social_accounts_twitter'] : ''; $insta_account = !empty($siteseo->social_settings['social_accounts_instagram']) ? $siteseo->social_settings['social_accounts_instagram'] : ''; $yt_account = !empty($siteseo->social_settings['social_accounts_youtube']) ? $siteseo->social_settings['social_accounts_youtube'] : ''; $pt_account = !empty($siteseo->social_settings['social_accounts_pinterest']) ? $siteseo->social_settings['social_accounts_pinterest'] : ''; //description $site_url = get_site_url(); $site_description = get_bloginfo('name'); //JSON-LD data $json_ld = [ '@context' => 'https://schema.org', '@type' => $org_type ? esc_html($org_type) : 'Organization', 'name' => esc_html($org_name), 'url' => esc_url($site_url), 'logo' => esc_url($org_logo), 'description' => esc_html($site_description), ]; //contact point if(!empty($org_contact_option) && !empty($org_contact_type) && !empty($org_number)){ $json_ld['contactPoint'] = [ '@type' => 'ContactPoint', 'contactType' => esc_html($org_contact_type), 'telephone' => esc_html($org_number), 'contactOption' => esc_html($org_contact_option), ]; } $same_as = array_filter([esc_url($fb_account), esc_url($twitter_account), esc_url($insta_account), esc_url($yt_account), esc_url($pt_account)]); if(!empty($same_as)){ $json_ld['sameAs'] = $same_as; } // Output JSON-LD script echo '<script type="application/ld+json">'; echo wp_json_encode($json_ld, JSON_UNESCAPED_SLASHES); echo '</script>'; } static function fb_graph(){ global $siteseo, $post; if(empty($siteseo->setting_enabled['toggle-social']) || empty($siteseo->social_settings['social_facebook_og'])){ return; } $fb_page_id = !empty($siteseo->social_settings['social_facebook_link_ownership_id']) ? $siteseo->social_settings['social_facebook_link_ownership_id'] : ''; $fb_link_owership = !empty($siteseo->social_settings['social_facebook_admin_id']) ? $siteseo->social_settings['social_facebook_admin_id'] : ''; $og_url = get_home_url(); $og_sitename = get_bloginfo('name'); // Check $post_id = isset($post) && is_object($post) ? $post->ID : ''; $og_title = get_the_title(); $og_description = get_bloginfo('description'); $og_img = !empty($siteseo->social_settings['social_facebook_img']) ? $siteseo->social_settings['social_facebook_img'] : ''; // Get post types and taxonomies $post_types = siteseo_post_types(); $taxonomies = get_taxonomies(array('public' => true), 'objects'); // home site page if(is_home() && is_front_page()){ $og_title = !empty($siteseo->titles_settings['titles_home_site_title']) ? $siteseo->titles_settings['titles_home_site_title'] : $og_title; $og_description = !empty($siteseo->titles_settings['titles_home_site_desc']) ? $siteseo->titles_settings['titles_home_site_desc'] : $og_description; } // single post types foreach($post_types as $post_type){ // shop page woocommerces if(function_exists('is_shop') && is_shop()){ $shop_page_id = wc_get_page_id('shop'); $archive_title = ''; $archive_desc = ''; if(is_post_type_archive()){ $obj = get_queried_object(); if(!empty($obj) && isset($obj->name)){ $archive_title = !empty($obj->labels->name) ? $obj->labels->name : ''; $archive_desc = !empty($obj->description) ? $obj->description : ''; } } if(!empty(get_post_meta($shop_page_id, '_siteseo_social_fb_title', true))){ $og_title = get_post_meta($shop_page_id, '_siteseo_social_fb_title', true); } elseif(!empty(get_post_meta($shop_page_id, '_siteseo_titles_title', true))){ $og_title = get_post_meta($shop_page_id, '_siteseo_titles_title', true); } elseif(!empty($siteseo->titles_settings['titles_archive_titles']['product']['archive_title'])){ $og_title = $siteseo->titles_settings['titles_archive_titles']['product']['archive_title']; } else { $og_title = $archive_title; } $og_description = !empty(get_post_meta($shop_page_id, '_siteseo_social_fb_desc', true)) ? get_post_meta($shop_page_id, '_siteseo_social_fb_desc', true) : $og_description; if(!empty(get_post_meta($shop_page_id, '_siteseo_social_fb_desc', true))){ $og_description = get_post_meta($shop_page_id, '_siteseo_social_fb_desc', true); } elseif(!empty(get_post_meta($shop_page_id, '_siteseo_titles_desc', true))){ $og_description = get_post_meta($shop_page_id, '_siteseo_titles_desc', true); } elseif(!empty($siteseo->titles_settings['titles_archive_titles']['product']['archive_desc'])){ $og_description = $siteseo->titles_settings['titles_archive_titles']['product']['archive_desc']; } else { $og_description = $archive_desc; } $og_description = isset($og_description) ? esc_attr(\SiteSEO\TitlesMetas::replace_variables($og_description)) : ''; // OG:IMG if(!empty(get_post_meta($shop_page_id, '_siteseo_social_fb_img', true))){ $og_img = get_post_meta($shop_page_id, '_siteseo_social_fb_img', true); } else if(get_the_post_thumbnail_url($post, 'full')){ $og_img = get_the_post_thumbnail_url($post, 'full'); } else { $og_img = !empty($siteseo->social_settings['social_facebook_img']) ? $siteseo->social_settings['social_facebook_img'] : ''; } $og_url = urldecode(get_permalink($shop_page_id)); break; } // archive page if($post_type->has_archive && is_post_type_archive($post_type->name)){ $archive_title = ''; $archive_desc = ''; if(is_post_type_archive()){ $obj = get_queried_object(); if(!empty($obj) && isset($obj->name)){ $archive_title = !empty($obj->labels->name) ? $obj->labels->name : ''; $archive_desc = !empty($obj->description) ? $obj->description : ''; } } $og_title = !empty($siteseo->titles_settings['titles_archive_titles'][$post_type->name]['archive_title']) ? $siteseo->titles_settings['titles_archive_titles'][$post_type->name]['archive_title'] : $archive_title; $og_description = !empty($siteseo->titles_settings['titles_archive_titles'][$post_type->name]['archive_desc']) ? $siteseo->titles_settings['titles_archive_titles'][$post_type->name]['archive_desc'] : $archive_desc; } // blog page if(is_home() && !is_front_page()){ $post_id = get_option('page_for_posts'); //OG:title if(!empty(get_post_meta($post_id, '_siteseo_social_fb_title', true))){ $og_title = get_post_meta($post_id, '_siteseo_social_fb_title', true); } elseif(!empty(get_post_meta($post_id, '_siteseo_titles_title', true))){ $og_title = get_post_meta($post_id, '_siteseo_titles_title', true); } elseif(!empty($siteseo->titles_settings['titles_single_titles'][$post_type->name]['title'])){ $og_title = $siteseo->titles_settings['titles_single_titles'][$post_type->name]['title']; } else{ $og_title = $og_title; } // og:description if(!empty(get_post_meta($post_id, '_siteseo_social_fb_desc', true))){ $og_description = get_post_meta($post_id, '_siteseo_social_fb_desc', true); } elseif(!empty(get_post_meta($post_id, '_siteseo_titles_desc', true))){ $og_description = get_post_meta($post_id, '_siteseo_titles_desc', true); } elseif(!empty($siteseo->titles_settings['titles_single_titles'][$post_type->name]['description'])){ $og_description = $siteseo->titles_settings['titles_single_titles'][$post_type->name]['description']; } elseif(get_the_excerpt($post_id)){ $og_description = wp_trim_words(get_the_excerpt($post_id), 50); } } if(is_singular($post_type->name)){ if(!empty(get_post_meta($post_id, '_siteseo_social_fb_title', true))){ $og_title = get_post_meta($post_id, '_siteseo_social_fb_title', true); } elseif(!empty(get_post_meta($post_id, '_siteseo_titles_title', true))){ $og_title = get_post_meta($post_id, '_siteseo_titles_title', true); } elseif(!empty($siteseo->titles_settings['titles_single_titles'][$post_type->name]['title'])){ $og_title = $siteseo->titles_settings['titles_single_titles'][$post_type->name]['title']; } else{ $og_title = $og_title; } // og:description if(!empty(get_post_meta($post_id, '_siteseo_social_fb_desc', true))){ $og_description = get_post_meta($post_id, '_siteseo_social_fb_desc', true); } elseif(!empty(get_post_meta($post_id, '_siteseo_titles_desc', true))){ $og_description = get_post_meta($post_id, '_siteseo_titles_desc', true); } elseif(!empty($siteseo->titles_settings['titles_single_titles'][$post_type->name]['description'])){ $og_description = $siteseo->titles_settings['titles_single_titles'][$post_type->name]['description']; } elseif(get_the_excerpt($post_id)){ $og_description = wp_trim_words(get_the_excerpt($post_id), 50); } // OG:IMG if(!empty(get_post_meta($post_id, '_siteseo_social_fb_img', true))){ $og_img = get_post_meta($post_id, '_siteseo_social_fb_img', true); } else if(get_the_post_thumbnail_url($post, 'full')){ $og_img = get_the_post_thumbnail_url($post, 'full'); } else { $og_img = !empty($siteseo->social_settings['social_facebook_img']) ? $siteseo->social_settings['social_facebook_img'] : ''; } $og_url = urldecode(get_permalink($post_id)); break; } } // taxonomies foreach($taxonomies as $taxonomy){ if(is_tax($taxonomy->name) || is_category() || is_tag()){ $term = get_queried_object(); $term_id = $term->term_id; // og:title if(!empty(get_term_meta($term_id, '_siteseo_social_fb_title', true))){ $og_title = get_term_meta($term_id, '_siteseo_social_fb_title', true); } elseif(!empty(get_term_meta($term_id, '_siteseo_titles_title', true))){ $og_title = get_term_meta($term_id, '_siteseo_titles_title', true); } elseif(!empty($siteseo->titles_settings['titles_tax_titles'][$taxonomy->name]['title'])){ $og_title = $siteseo->titles_settings['titles_tax_titles'][$taxonomy->name]['title']; } else{ $og_title = $og_title; } // og:description if(!empty(get_term_meta($term_id, '_siteseo_social_fb_desc', true))){ $og_description = get_term_meta($term_id, '_siteseo_social_fb_desc', true); } elseif(!empty(get_term_meta($term_id, '_siteseo_titles_desc', true))){ $og_description = get_term_meta($term_id, '_siteseo_titles_desc', true); } elseif(!empty($siteseo->titles_settings['titles_tax_titles'][$taxonomy->name]['description'])){ $og_description = $siteseo->titles_settings['titles_tax_titles'][$taxonomy->name]['description']; } else{ $og_description = wp_strip_all_tags(term_description($term_id)); } $og_img = !empty(get_term_meta($term_id, '_siteseo_social_fb_img', true)) ? get_term_meta($term_id, '_siteseo_social_fb_img', true) : $og_img; $og_url = urldecode(get_term_link($term_id)); break; } } $og_title = isset($og_title) ? esc_attr(\SiteSEO\TitlesMetas::replace_variables($og_title)) : ''; $og_description = isset($og_description) ? esc_attr(\SiteSEO\TitlesMetas::replace_variables($og_description)) : ''; if(!empty($og_img)){ $og_img = sanitize_url($og_img); $og_img_width = 0; $og_img_height = 0; if(!empty($og_img)){ $image_info = @getimagesize($og_img); if($image_info !== false){ $og_img_width = $image_info[0]; $og_img_height = $image_info[1]; } } } // Setting og:type if(is_home() || is_front_page()){ $og_type = 'website'; // default website } elseif(is_singular('product') || is_singular('download')){ $og_type = 'product'; } elseif(is_singular()){ $og_type = 'article'; } elseif(is_search() || is_archive() || is_404()){ $og_type = 'object'; } if(!empty($og_url)){ echo '<meta property="og:url" content="'.esc_html($og_url).'" />'; } if(!empty($og_sitename)){ echo '<meta property="og:site_name" content="'.esc_html($og_sitename).'" />'; } if(function_exists('get_locale')){ echo '<meta property="og:locale" content="'.esc_html(get_locale()).'" />'; } if(!empty($og_type)){ echo '<meta property="og:type" content="'.esc_attr($og_type).'" />'; } if(!empty($og_title)){ echo '<meta property="og:title" content="'.esc_html($og_title).'" />'; } if(!empty($og_description)){ echo '<meta property="og:description" content="'.esc_html(\SiteSEO\TitlesMetas::truncate_desc($og_description)).'" />'; } if(!empty($og_img)){ echo '<meta property="og:image" content="'.esc_html($og_img).'" />'; if(is_ssl()){ echo '<meta property="og:secure_url" content="'.esc_html($og_img).'" />'; } } if(!empty($og_img_height)){ echo '<meta property="og:image:height" content="'.esc_attr($og_img_height).'" />'; } if(!empty($og_img_width)){ echo '<meta property="og:image:width" content="'.esc_attr($og_img_width).'" />'; } if(!empty($fb_page_id)){ echo '<meta property="fb:pages" content="'.esc_html($fb_page_id) .'" />'; } if(!empty($fb_link_owership)){ echo '<meta property="fb:admins" content="'. esc_html($fb_link_owership).'" />'; } } static function twitter_card(){ global $siteseo, $post; if(empty($siteseo->setting_enabled['toggle-social']) || empty($siteseo->social_settings['social_twitter_card'])){ return; } $site_url = get_home_url(); $sitename = get_bloginfo('name'); $post_id = isset($post) && is_object($post) ? $post->ID : ''; $site_title = get_the_title(); $site_description = get_bloginfo('description'); $twitter_img = !empty($siteseo->social_settings['social_twitter_card_img']) ? $siteseo->social_settings['social_twitter_card_img'] : ''; // home site page if(is_home() && is_front_page()){ $site_title = !empty($siteseo->titles_settings['titles_home_site_title']) ? $siteseo->titles_settings['titles_home_site_title'] : $site_title; $site_description = !empty($siteseo->titles_settings['titles_home_site_desc']) ? $siteseo->titles_settings['titles_home_site_desc'] : $site_description; } // types and taxonomies $post_types = siteseo_post_types(); $taxonomies = get_taxonomies(array('public' => true), 'objects'); // single post types foreach($post_types as $post_type){ // woocommerce if(function_exists('is_shop') && is_shop()){ $shop_page_id = wc_get_page_id('shop'); $archive_title = ''; $archive_desc = ''; if(is_post_type_archive()){ $obj = get_queried_object(); if(!empty($obj) && isset($obj->name)){ $archive_title = !empty($obj->labels->name) ? $obj->labels->name : ''; $archive_desc = !empty($obj->description) ? $obj->description : ''; } } // twitter:title if(!empty(get_post_meta($shop_page_id, '_siteseo_social_twitter_title', true))){ $site_title = get_post_meta($shop_page_id, '_siteseo_social_twitter_title', true); } elseif(!empty(get_post_meta($shop_page_id, '_siteseo_titles_title', true))){ $site_title = get_post_meta($shop_page_id, '_siteseo_titles_title', true); } elseif(!empty($siteseo->titles_settings['titles_archive_titles']['product']['archive_title'])){ $site_title = $siteseo->titles_settings['titles_archive_titles']['product']['archive_title']; } else { $site_title = $archive_title; } // twitter:description if(!empty(get_post_meta($shop_page_id, '_siteseo_social_twitter_desc', true))){ $site_description = get_post_meta($shop_page_id, '_siteseo_social_twitter_desc', true); } elseif(!empty(get_post_meta($shop_page_id, '_siteseo_titles_desc', true))){ $site_description = get_post_meta($shop_page_id, '_siteseo_titles_desc', true); } elseif(!empty($siteseo->titles_settings['titles_archive_titles']['product']['archive_desc'])){ $site_description = $siteseo->titles_settings['titles_archive_titles']['product']['archive_desc']; } else { $site_description = $archive_desc; } // twitter:image if(!empty(get_post_meta($shop_page_id, '_siteseo_social_twitter_img', true))){ $twitter_img = get_post_meta($shop_page_id, '_siteseo_social_twitter_img', true); } else if(get_the_post_thumbnail_url($post, 'full')){ $twitter_img = get_the_post_thumbnail_url($post, 'full'); } else { $twitter_img = isset($siteseo->social_settings['social_twitter_card_img']) ? $siteseo->social_settings['social_twitter_card_img'] : ''; } $site_url = urldecode(get_permalink($shop_page_id)); break; } // archive page if($post_type->has_archive && is_post_type_archive($post_type->name)){ $archive_title = ''; $archive_desc = ''; if(is_post_type_archive()){ $obj = get_queried_object(); if(!empty($obj) && isset($obj->name)){ $archive_title = !empty($obj->labels->name) ? $obj->labels->name : ''; $archive_desc = !empty($obj->description) ? $obj->description : ''; } } $site_title = !empty($siteseo->titles_settings['titles_archive_titles'][$post_type->name]['archive_title']) ? $siteseo->titles_settings['titles_archive_titles'][$post_type->name]['archive_title'] : $archive_title; $site_description = !empty($siteseo->titles_settings['titles_archive_titles'][$post_type->name]['archive_desc']) ? $siteseo->titles_settings['titles_archive_titles'][$post_type->name]['archive_desc'] : $archive_desc; } // blog page if(is_home() && !is_front_page()){ $post_id = get_option('page_for_posts'); // twitter:title if(!empty(get_post_meta($post_id, '_siteseo_social_twitter_title', true))){ $site_title = get_post_meta($post_id, '_siteseo_social_twitter_title', true); } elseif(!empty(get_post_meta($post_id, '_siteseo_titles_title', true))){ $site_title = get_post_meta($post_id, '_siteseo_titles_title', true); } elseif(!empty($siteseo->titles_settings['titles_single_titles'][$post_type->name]['title'])){ $site_title = $siteseo->titles_settings['titles_single_titles'][$post_type->name]['title']; } else{ $site_title = $site_title; } // twitter:description if(!empty(get_post_meta($post_id, '_siteseo_social_twitter_desc', true))){ $site_description = get_post_meta($post_id, '_siteseo_social_twitter_desc', true); } elseif(!empty(get_post_meta($post_id, '_siteseo_titles_desc', true))){ $site_description = get_post_meta($post_id, '_siteseo_titles_desc', true); } elseif(!empty($siteseo->titles_settings['titles_single_titles'][$post_type->name]['description'])){ $site_description = $siteseo->titles_settings['titles_single_titles'][$post_type->name]['description']; } elseif(!empty(get_the_excerpt($post_id))){ $site_description = wp_trim_words(get_the_excerpt($post_id), 50); } } if(is_singular($post_type->name)){ // twitter:title if(!empty(get_post_meta($post_id, '_siteseo_social_twitter_title', true))){ $site_title = get_post_meta($post_id, '_siteseo_social_twitter_title', true); } elseif(!empty(get_post_meta($post_id, '_siteseo_titles_title', true))){ $site_title = get_post_meta($post_id, '_siteseo_titles_title', true); } elseif(!empty($siteseo->titles_settings['titles_single_titles'][$post_type->name]['title'])){ $site_title = $siteseo->titles_settings['titles_single_titles'][$post_type->name]['title']; } else{ $site_title = $site_title; } // twitter:description if(!empty(get_post_meta($post_id, '_siteseo_social_twitter_desc', true))){ $site_description = get_post_meta($post_id, '_siteseo_social_twitter_desc', true); } elseif(!empty(get_post_meta($post_id, '_siteseo_titles_desc', true))){ $site_description = get_post_meta($post_id, '_siteseo_titles_desc', true); } elseif(!empty($siteseo->titles_settings['titles_single_titles'][$post_type->name]['description'])){ $site_description = $siteseo->titles_settings['titles_single_titles'][$post_type->name]['description']; } else{ $site_description = wp_trim_words(get_the_excerpt($post_id), 50); } // twitter:image if(!empty(get_post_meta($post_id, '_siteseo_social_twitter_img', true))){ $twitter_img = get_post_meta($post_id, '_siteseo_social_twitter_img', true); } else if(get_the_post_thumbnail_url($post, 'full')){ $twitter_img = get_the_post_thumbnail_url($post, 'full'); } else { $twitter_img = isset($siteseo->social_settings['social_twitter_card_img']) ? $siteseo->social_settings['social_twitter_card_img'] : ''; } $site_url = urldecode(get_permalink($post_id)); break; } } //taxonomies foreach($taxonomies as $taxonomy){ if(is_tax($taxonomy->name) || is_category() || is_tag()){ $term = get_queried_object(); $term_id = $term->term_id; //twitter:title if(!empty(get_term_meta($term_id, '_siteseo_social_twitter_title', true))){ $site_title = get_term_meta($term_id, '_siteseo_social_twitter_title', true); } elseif(!empty(get_term_meta($term_id, '_siteseo_titles_title', true))){ $site_title = get_term_meta($term_id, '_siteseo_titles_title', true); } elseif(!empty($siteseo->titles_settings['titles_tax_titles'][$taxonomy->name]['title'])){ $site_title = $siteseo->titles_settings['titles_tax_titles'][$taxonomy->name]['title']; } else{ $site_title = $site_title; } // twitter description if(!empty(get_term_meta($term_id, '_siteseo_social_twitter_desc', true))){ $site_description = get_term_meta($term_id, '_siteseo_social_twitter_desc', true); } elseif(!empty(get_term_meta($term_id, '_siteseo_titles_desc', true))){ $site_description = get_term_meta($term_id, '_siteseo_titles_desc', true); } elseif(!empty($siteseo->titles_settings['titles_tax_titles'][$taxonomy->name]['description'])){ $site_description = $siteseo->titles_settings['titles_tax_titles'][$taxonomy->name]['description']; } else{ $site_description = wp_strip_all_tags(term_description($term_id)); } $twitter_img = !empty(get_term_meta($term_id, '_siteseo_social_twitter_img', true)) ? get_term_meta($term_id, '_siteseo_social_twitter_img', true) : $twitter_img; $site_url = urldecode(get_term_link($term_id)); break; } } $site_title = isset($site_title) ? esc_attr(\SiteSEO\TitlesMetas::replace_variables($site_title)) : ''; $site_description = isset($site_description) ? esc_attr(\SiteSEO\TitlesMetas::replace_variables($site_description)) : ''; echo '<meta name="twitter:card" content="summary"/>'; echo '<meta name="twitter:locale" content="'.esc_html(get_locale()).'"/>'; if(!empty($site_title)){ echo '<meta name="twitter:title" content="'.esc_html($site_title).'"/>'; } if(!empty($site_description)){ echo '<meta name="twitter:description" content="'.esc_html(\SiteSEO\TitlesMetas::truncate_desc($site_description)).'"/>'; } if(!empty($site_url)){ echo '<meta name="twitter:url" content="'.esc_html($site_url).'"/>'; } if(!empty($sitename)){ echo '<meta name="twitter:site" content="@'.esc_html($sitename).'"/>'; } if(!empty($twitter_img)){ echo '<meta name="twitter:image" content="'.esc_html($twitter_img).'"/>'; } } } metaboxes/settings.php 0000644 00000203643 15100371032 0011104 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO\Metaboxes; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Settings{ static function render_metabox(){ global $siteseo; $metabox_data = []; $show_content_analysis = true; if(is_user_logged_in()){ if(is_super_admin()){ $siteseo->display_ca_metaboxe = 1; $show_content_analysis = true; } else{ $user = wp_get_current_user(); $siteseo_user_role = current($user->roles); $siteseo_options = get_option('siteseo_advanced_option_name'); $ca_metabox_roles = !empty($siteseo_options['security_metaboxe_ca_role']) ? $siteseo_options['security_metaboxe_ca_role'] : []; if(array_key_exists($siteseo_user_role, $ca_metabox_roles)){ $siteseo->display_ca_metaboxe = 1; $show_content_analysis = false; } } } $metabox_data = self::metabox_data(); self::metabox_form_html($metabox_data, $show_content_analysis); } static function metabox_data(){ global $post, $siteseo; $metabox_data = []; $metabox_data['title'] = $post->post_title; $metabox_data['excerpt'] = $post->post_excerpt; // Getting the first paragraph of the post if(empty($metabox_data['excerpt'])){ $post_seperated = get_extended($post->post_content); if(!empty($post_seperated['main'])){ $metabox_data['excerpt'] = wp_strip_all_tags($post_seperated['main']); } } $metabox_data['keywords'] = get_post_meta($post->ID, 'siteseo_analysis_target_kw',true); $metabox_data['meta_title'] = get_post_meta($post->ID, '_siteseo_titles_title', true); $metabox_data['meta_desc'] = get_post_meta($post->ID, '_siteseo_titles_desc', true); $metabox_data['robots_canonical'] = get_post_meta($post->ID, '_siteseo_robots_canonical', true); $metabox_data['robots_primary_cat'] = get_post_meta($post->ID, '_siteseo_robots_primary_cat', true); $metabox_data['fb_title'] = get_post_meta($post->ID, '_siteseo_social_fb_title', true); $metabox_data['fb_desc'] = get_post_meta($post->ID, '_siteseo_social_fb_desc', true); $metabox_data['fb_img'] = get_post_meta($post->ID, '_siteseo_social_fb_img', true); $siteseo_social_fb_img_attachment_id = get_post_meta($post->ID, '_siteseo_social_fb_img_attachment_id', true); $siteseo_social_fb_img_width = get_post_meta($post->ID, '_siteseo_social_fb_img_width', true); $siteseo_social_fb_img_height = get_post_meta($post->ID, '_siteseo_social_fb_img_height', true); $metabox_data['x_title'] = get_post_meta($post->ID, '_siteseo_social_twitter_title', true); $metabox_data['x_desc'] = get_post_meta($post->ID, '_siteseo_social_twitter_desc', true); $metabox_data['x_img'] = get_post_meta($post->ID, '_siteseo_social_twitter_img', true); $siteseo_social_twitter_img_attachment_id = get_post_meta($post->ID, '_siteseo_social_twitter_img_attachment_id', true); $siteseo_social_twitter_img_width = get_post_meta($post->ID, '_siteseo_social_twitter_img_width', true); $siteseo_social_twitter_img_height = get_post_meta($post->ID, '_siteseo_social_twitter_img_height', true); $metabox_data['redirections_enabled'] = get_post_meta($post->ID, '_siteseo_redirections_enabled', true); $metabox_data['redirections_enabled_regex'] = get_post_meta($post->ID, '_siteseo_redirections_enabled_regex', true); $metabox_data['redirections_logged_status'] = get_post_meta($post->ID, '_siteseo_redirections_logged_status', true); $metabox_data['redirections_type'] = get_post_meta($post->ID, '_siteseo_redirections_type', true); $metabox_data['redirections_value'] = get_post_meta($post->ID, '_siteseo_redirections_value', true); $metabox_data['redirections_param'] = get_post_meta($post->ID, '_siteseo_redirections_param', true); $title_options = get_option('siteseo_titles_option_name', []); $metabox_data['disabled_robots'] = [ 'robots_index' => '', 'robots_follow' => '', 'archive' => '', 'snippet' => '', 'imageindex' => '', ]; if(post_password_required($post->ID) === true || !empty($title_options['titles_noindex'])){ $metabox_data['robots_index'] = 'yes'; $metabox_data['disabled_robots']['robots_index'] = 'disabled'; } else{ $metabox_data['robots_index'] = get_post_meta($post->ID, '_siteseo_robots_index', true); } if(!empty($title_options['titles_nofollow'])){ $metabox_data['robots_follow'] = 'yes'; $metabox_data['disabled_robots']['robots_follow'] = 'disabled'; } else{ $metabox_data['robots_follow'] = get_post_meta($post->ID, '_siteseo_robots_follow', true); } if(!empty($title_options['titles_noarchive'])){ $metabox_data['robots_archive'] = 'yes'; $metabox_data['disabled_robots']['archive'] = 'disabled'; } else{ $metabox_data['robots_archive'] = get_post_meta($post->ID, '_siteseo_robots_archive', true); } if(!empty($title_options['titles_nosnippet'])){ $metabox_data['robots_snippet'] = 'yes'; $metabox_data['disabled_robots']['snippet'] = 'disabled'; } else{ $metabox_data['robots_snippet'] = get_post_meta($post->ID, '_siteseo_robots_snippet', true); } if(!empty($title_options['titles_noimageindex'])){ $metabox_data['robots_imageindex'] = 'yes'; $metabox_data['disabled_robots']['imageindex'] = 'disabled'; } else{ $metabox_data['robots_imageindex'] = get_post_meta($post->ID, '_siteseo_robots_imageindex', true); } return $metabox_data; } static function metabox_term_data($term){ global $tag; $metabox_data = []; $metabox_data['title'] = $tag->name; $metabox_data['excerpt'] = $tag->description; $metabox_data['meta_title'] = get_term_meta($term->term_id, '_siteseo_titles_title', true); $metabox_data['meta_desc'] = get_term_meta($term->term_id, '_siteseo_titles_desc', true); // Social Fields $metabox_data['fb_title'] = get_term_meta($term->term_id, '_siteseo_social_fb_title', true); $metabox_data['fb_desc'] = get_term_meta($term->term_id, '_siteseo_social_fb_desc', true); $metabox_data['fb_img'] = get_term_meta($term->term_id, '_siteseo_social_fb_img', true); $metabox_data['x_title'] = get_term_meta($term->term_id, '_siteseo_social_twitter_title', true); $metabox_data['x_desc'] = get_term_meta($term->term_id, '_siteseo_social_twitter_desc', true); $metabox_data['x_img'] = get_term_meta($term->term_id, '_siteseo_social_twitter_img', true); // Social Dimensions $fb_img_id = get_term_meta($term->term_id, '_siteseo_social_fb_img_attachment_id', true); $fb_img_width = get_term_meta($term->term_id, '_siteseo_social_fb_img_width', true); $fb_img_height = get_term_meta($term->term_id, '_siteseo_social_fb_img_height', true); $x_img_id = get_term_meta($term->term_id, '_siteseo_social_twitter_img_attachment_id', true); $x_img_width = get_term_meta($term->term_id, '_siteseo_social_twitter_img_width', true); $x_img_height = get_term_meta($term->term_id, '_siteseo_social_twitter_img_height', true); // Redirection fields $metabox_data['redirections_enabled'] = get_term_meta($term->term_id, '_siteseo_redirections_enabled', true); $metabox_data['redirections_logged_status'] = get_term_meta($term->term_id, '_siteseo_redirections_logged_status', true); $metabox_data['redirections_type'] = get_term_meta($term->term_id, '_siteseo_redirections_type', true); $metabox_data['redirections_value'] = get_term_meta($term->term_id, '_siteseo_redirections_value', true); $metabox_data['robots_canonical']= get_term_meta($term->term_id, '_siteseo_robots_canonical', true); $title_options = get_option('siteseo_titles_option_name', []); $metabox_data['disabled_robots'] = [ 'robots_index' => '', 'robots_follow' => '', 'archive' => '', 'snippet' => '', 'imageindex' => '', ]; if(!empty($title_options['titles_noindex'])){ $metabox_data['robots_index'] = 'yes'; $metabox_data['disabled_robots']['robots_index'] = 'disabled'; } else { $metabox_data['robots_index'] = get_term_meta($term->term_id, '_siteseo_robots_index', true); } if(!empty($title_options['titles_nofollow'])){ $metabox_data['robots_follow'] = 'yes'; $metabox_data['disabled_robots']['robots_follow'] = 'disabled'; } else { $metabox_data['robots_follow'] = get_term_meta($term->term_id, '_siteseo_robots_follow', true); } if(!empty($title_options['titles_noarchive'])){ $metabox_data['robots_archive'] = 'yes'; $metabox_data['disabled_robots']['archive'] = 'disabled'; } else { $metabox_data['robots_archive'] = get_term_meta($term->term_id, '_siteseo_robots_archive', true); } if(!empty($title_options['titles_nosnippet'])){ $metabox_data['robots_snippet'] = 'yes'; $metabox_data['disabled_robots']['snippet'] = 'disabled'; } else { $metabox_data['robots_snippet'] = get_term_meta($term->term_id, '_siteseo_robots_snippet', true); } if(!empty($title_options['titles_noimageindex'])){ $metabox_data['robots_imageindex'] = 'yes'; $metabox_data['disabled_robots']['imageindex'] = 'disabled'; } else { $metabox_data['robots_imageindex'] = get_term_meta($term->term_id, '_siteseo_robots_imageindex', true); } return $metabox_data; } static function metabox_form_html(&$metabox_data, $show_content_analysis = false){ global $siteseo, $post, $pagenow, $typenow; $pro_settings = isset($siteseo->pro) ? $siteseo->pro : ''; $data_attr = []; $data_attr['data_tax'] = ''; $data_attr['termId'] = ''; if('post-new.php' == $pagenow || 'post.php' == $pagenow){ $data_attr['current_id'] = $post->ID; $data_attr['origin'] = 'post'; $data_attr['title'] = get_the_title($data_attr['current_id']); } elseif('term.php' == $pagenow || 'edit-tags.php' == $pagenow){ global $tag; $data_attr['current_id'] = $tag->term_id; $data_attr['termId'] = $tag->term_id; $data_attr['origin'] = 'term'; $data_attr['data_tax'] = $tag->taxonomy; $data_attr['title'] = $tag->name; } $data_attr['isHomeId'] = get_option('page_on_front'); if($data_attr['isHomeId'] === '0'){ $data_attr['isHomeId'] = ''; } // Static Data $home_url = home_url(); $parsed_url = wp_parse_url($home_url); $host_uri = $parsed_url['host']; $social_placeholder = SITESEO_ASSETS_URL . '/img/social-placeholder.png'; $metabox_tag_drop_kses = [ 'button' => [ 'class' => true, 'type' => true, ], 'span' => [ 'class' => true, ], 'div' => [ 'class' => true, 'style' => true, ], 'input' => [ 'type' => true, 'class' => true, 'name' => true, 'spellcheck' => true, 'placeholder' => true, ], 'ul' => true, 'li' => [ 'class' => true, 'data-*' => true, 'tabindex' => true, ] ]; // Preview of social title and description $current_screen = get_current_screen(); if(!empty($current_screen) && $current_screen->base === 'term'){ $term_id = isset($_GET['tag_ID']) ? (int)$_GET['tag_ID'] : 0; $taxonomy = $current_screen->taxonomy; } else{ $post_type = $current_screen->post_type; } $social_preview_title = ''; $social_preview_desc = ''; if(!empty($metabox_data['meta_title'])){ $social_preview_title = $metabox_data['meta_title']; } elseif(!empty($post_type) && !empty($siteseo->titles_settings['titles_single_titles'][$post_type]['title'])){ $social_preview_title = $siteseo->titles_settings['titles_single_titles'][$post_type]['title']; } elseif(!empty($taxonomy) && !empty($siteseo->titles_settings['titles_tax_titles'][$taxonomy]['title'])){ $social_preview_title = $siteseo->titles_settings['titles_tax_titles'][$taxonomy]['title']; } else{ $social_preview_title = get_the_title(); } if(!empty($metabox_data['meta_desc'])){ $social_preview_desc = $metabox_data['meta_desc']; } elseif(!empty($post_type) && !empty($siteseo->titles_settings['titles_single_titles'][$post_type]['description'])){ $social_preview_desc = $siteseo->titles_settings['titles_single_titles'][$post_type]['description']; } elseif(!empty($taxonomy) && !empty($siteseo->titles_settings['titles_tax_titles'][$taxonomy]['description'])){ $social_preview_desc = $siteseo->titles_settings['titles_tax_titles'][$taxonomy]['description']; } else{ $social_preview_desc = get_bloginfo('description'); } if(empty($siteseo->advanced_settings['appearance_ca_metaboxe']) && !empty($show_content_analysis)){ $siteseo_metabox_tabs = [ 'content-analysis' => __('Content Analysis', 'siteseo') ]; } $siteseo_metabox_tabs['title-settings'] = __('Title', 'siteseo'); $siteseo_metabox_tabs['social-settings'] = __('Social', 'siteseo'); $siteseo_metabox_tabs['advanced-settings'] = __('Advanced', 'siteseo'); $siteseo_metabox_tabs['redirect'] = __('Redirects', 'siteseo'); if(!empty($pro_settings['enable_structured_data']) && !empty($pro_settings['toggle_state_stru_data']) && !empty($show_content_analysis)){ $siteseo_metabox_tabs['structured-data-types'] = __('Structured Data Types', 'siteseo'); } if(!empty($pro_settings['toggle_state_video_sitemap']) && !empty($pro_settings['enable_video_sitemap']) && !empty($show_content_analysis)){ $siteseo_metabox_tabs['video-sitemap'] = __('Video Sitemap', 'siteseo'); } if(!empty($pro_settings['toggle_state_google_news']) && !empty($pro_settings['google_news']) && !empty($show_content_analysis)){ $siteseo_metabox_tabs['google-news'] = __('Google News', 'siteseo'); } echo'<div id="siteseo-metabox-wrapper" class="siteseo-metabox-wrapper"> <div class="siteseo-metabox-tabs" data-home-id="'.esc_attr($data_attr['isHomeId']).'" data-term-id="'.esc_attr($data_attr['termId']).'" data_id="'.esc_attr($data_attr['current_id']).'" data_origin="'.esc_attr($data_attr['origin']).'" data_tax="'.esc_attr($data_attr['data_tax']).'">'; wp_nonce_field('siteseo_metabox_nonce', 'siteseo_metabox_nonce'); foreach($siteseo_metabox_tabs as $siteseo_metabox_tab => $siteseo_metabox_tab_title){ $selected_metabox_tab = ''; if($siteseo_metabox_tab === 'content-analysis'){ $selected_metabox_tab = 'siteseo-metabox-tab-label-active'; } if(empty($siteseo->display_ca_metaboxe) && $siteseo_metabox_tab === 'title-settings'){ $selected_metabox_tab = 'siteseo-metabox-tab-label-active'; } echo'<div class="siteseo-metabox-tab-label '.esc_attr($selected_metabox_tab).'" data-tab="siteseo-metabox-tab-'.esc_attr($siteseo_metabox_tab).'">'; if($siteseo_metabox_tab === 'advanced-settings' && !empty($metabox_data['robots_index'])){ echo'<span class="dashicons dashicons-hidden siteseo-noindex-warning"></span>'; } echo esc_html($siteseo_metabox_tab_title).'</div>'; } $home_url = home_url(); $parsed_home_url = wp_parse_url($home_url); $meta_desc_percentage = '1'; if(!empty($metabox_data['meta_desc'])){ $meta_desc_percentage = (strlen($metabox_data['meta_desc'])/160)*100; } elseif(!empty($metabox_data['excerpt'])){ $meta_desc_percentage = (strlen($metabox_data['excerpt'])/160)*100; } if(intval($meta_desc_percentage) > 100){ $meta_desc_percentage = '100'; } $meta_title_percentage = '1'; if(!empty($metabox_data['meta_title'])){ $meta_title_percentage = (strlen($metabox_data['meta_title'])/60)*100; } else if(!empty($metabox_data['title'])){ $meta_title_percentage = (strlen($metabox_data['title'])/60)*100; } if(intval($meta_title_percentage) > 100){ $meta_title_percentage = '100'; } echo'</div>'; if(empty($siteseo->advanced_settings['appearance_ca_metaboxe']) && $show_content_analysis){ echo'<div class="siteseo-sidebar-tabs siteseo-sidebar-tabs-opened"><span>'.esc_html__('Content Analysis', 'siteseo').'</span><span class="siteseo-sidebar-tabs-arrow"><span class="dashicons dashicons-arrow-down-alt2"></span></span></div> <div class="siteseo-metabox-tab-content-analysis siteseo-metabox-tab" style="display:block;">'; self::content_analysis($post); echo'</div>'; } $allowed_suggestion_tags = array( 'button' => array( 'class' => array(), 'type' => array(), ), 'span' => array( 'id' => array(), 'class' => array(), ), 'div' => array( 'class' => array(), 'style' => array(), ), 'input' => array( 'type' => array(), 'class' => true, 'placeholder' => true, ) ); echo'<div class="siteseo-sidebar-tabs '.(empty($siteseo->display_ca_metaboxe) ? 'siteseo-sidebar-tabs-opened' : '').'"><span>'.esc_html__('Title', 'siteseo').'</span><span class="siteseo-sidebar-tabs-arrow"><span class="dashicons dashicons-arrow-down-alt2"></span></span></div> <div class="siteseo-metabox-tab-title-settings siteseo-metabox-tab" style="'.(empty($siteseo->display_ca_metaboxe) ? 'display:block;' : '').'"> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label>'.esc_html__('Search Preview','siteseo').'</label> </div> <div class="siteseo-metabox-search-preview"> <div class="siteseo-search-preview-toggle"> <span id="siteseo-metabox-search-pc" style="display:none">'.esc_html__('Show Desktop version', 'siteseo').'</span> <span id="siteseo-metabox-search-mobile">'.esc_html__('Show Mobile version', 'siteseo').'</span> </div> <div class="siteseo-search-preview-desktop"> <div class="siteseo-search-preview-metadata"> <div style="background-color: #e2eeff; border: 1px solid #e2eeff; height:28px; width:28px; padding: 3px; border-radius: 50px; display:flex; align-items:center; justify-content:center;"> <svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#0060f0"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"></path></svg> </div> <div class="siteseo-search-preview-metadata-link"> <div>'.esc_url($parsed_home_url['host']).'</div> <div><cite>'.esc_url(home_url()).'</cite></div> </div> <div> <svg focusable="false" xmlns="http://www.w3.org/2000/svg" width="20" viewBox="0 0 24 24"><path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"></path></svg> </div> </div> <h3>'.(!empty($metabox_data['meta_title']) ? esc_html(\SiteSEO\TitlesMetas::replace_variables($metabox_data['meta_title'], true)) : (get_the_title() ? esc_html(get_the_title()) : 'Post Title here')).'</h3> <div class="siteseo-search-preview-description"> '.(!empty($metabox_data['meta_desc']) ? esc_html(\SiteSEO\TitlesMetas::replace_variables($metabox_data['meta_desc'], true)) : (!empty($metabox_data['excerpt']) ? esc_html(substr($metabox_data['excerpt'], 0, 160)) : 'Post description')).' </div> </div> </div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_titles_title_meta">'.esc_html__('Title', 'siteseo').'</label> </div> <div class="siteseo-metabox-input-wrap"> <div class="siteseo-metabox-tags"> <button type="button" class="siteseo-metabox-tag" data-tag="%%post_title%%"><span class="dashicons dashicons-plus"></span> Post Title</button> <button type="button" class="siteseo-metabox-tag" data-tag="%%sitetitle%%"><span class="dashicons dashicons-plus"></span> Site Title</button> <button type="button" class="siteseo-metabox-tag" data-tag="%%sep%%"><span class="dashicons dashicons-plus"></span>Seperator</button>'.wp_kses(siteseo_suggestion_button_metabox(), $allowed_suggestion_tags).' </div> <input type="text" id="siteseo_titles_title_meta" class="siteseo_titles_title_meta" name="siteseo_titles_title" placeholder="'.(!empty($metabox_data['title']) ? esc_attr($metabox_data['title']) : esc_html__('Enter title for this post', 'siteseo')).'" value="'.(!empty($metabox_data['meta_title']) ? esc_html($metabox_data['meta_title']) : '').'"/> <div class="siteseo-metabox-limits"> <span class="siteseo-metabox-limits-meter"><span style="width:'.esc_attr($meta_title_percentage).'%"></span></span> <span class="siteseo-metabox-limits-numbers"><em>'.esc_html(strlen($metabox_data['meta_title'])).'</em> out of 60 max recommended characters</span> </div> </div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_titles_desc_meta">'.esc_html__('Meta Description', 'siteseo').'</label> </div> <div class="siteseo-metabox-input-wrap"> <div class="siteseo-metabox-tags"> <button type="button" class="siteseo-metabox-tag" data-tag="%%post_excerpt%%"><span class="dashicons dashicons-plus"></span> Post Excerpt</button>'.wp_kses(siteseo_suggestion_button_metabox(), $allowed_suggestion_tags).' </div> <textarea id="siteseo_titles_desc_meta" class="siteseo_titles_desc_meta" name="siteseo_titles_desc" rows="2" placeholder="'.esc_html__('Enter description for this post', 'siteseo').'">'.(!empty($metabox_data['meta_desc']) ? esc_html($metabox_data['meta_desc']) : '').'</textarea> <div class="siteseo-metabox-limits"> <span class="siteseo-metabox-limits-meter"><span style="width:'.esc_attr($meta_desc_percentage).'%"></span></span> <span class="siteseo-metabox-limits-numbers"><em>'.esc_html(strlen($metabox_data['meta_desc'])).'</em> out of 160 max recommended characters</span> </div> </div> </div> </div> <div class="siteseo-sidebar-tabs"><span>'.esc_html__('Social', 'siteseo').'</span><span class="siteseo-sidebar-tabs-arrow"><span class="dashicons dashicons-arrow-down-alt2"></span></span></div> <div class="siteseo-metabox-tab-social-settings siteseo-metabox-tab"> <div class="siteseo-metabox-subtabs"> <div class="siteseo-metabox-tab-label siteseo-metabox-tab-label-active" data-tab="siteseo-metabox-tab-fb-settings">Facebook</div> <div class="siteseo-metabox-tab-label" data-tab="siteseo-metabox-tab-x-settings">X(Twitter)</div> </div> <div class="siteseo-metabox-tab-fb-settings siteseo-metabox-tab" style="display:block;"> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label>'.esc_html__('Preview', 'siteseo').'</label> </div> <div class="siteseo-metabox-fb-preview"> <div class="siteseo-metabox-fb-image"> <img src="'.(!empty($metabox_data['fb_img']) ? esc_url($metabox_data['fb_img']) : esc_url($social_placeholder)).'" alt="Facebook preview" load="lazy"/> </div> <div class="siteseo-metabox-fb-data"> <div class="siteseo-metabox-fb-host">'.(!empty($host_uri) ? esc_html($host_uri) : '').'</div> <div class="siteseo-metabox-fb-title">'.(!empty($metabox_data['fb_title']) ? esc_html(\SiteSEO\TitlesMetas::replace_variables($metabox_data['fb_title'], true)) : esc_html(\SiteSEO\TitlesMetas::replace_variables($social_preview_title, true))).'</div> <div class="siteseo-metabox-fb-desc">'.(!empty($metabox_data['fb_desc']) ? esc_html(\SiteSEO\TitlesMetas::replace_variables($metabox_data['fb_desc'], true)) : esc_html(\SiteSEO\TitlesMetas::replace_variables($social_preview_desc, true))).'</div> </div> </div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_social_fb_title_meta">'.esc_html__('Facebook Title', 'siteseo').'</label> </div> <div class="siteseo-metabox-input-wrap"> <input type="text" id="siteseo_social_fb_title_meta" class="siteseo_social_fb_title_meta" name="siteseo_social_fb_title" placeholder="'.(!empty($social_preview_title) ? esc_html(\SiteSEO\TitlesMetas::replace_variables($social_preview_title, true)) : '').'" value="'.(!empty($metabox_data['fb_title']) ? esc_attr($metabox_data['fb_title']) : '').'" /> <div class="siteseo-metabox-tags"> <button type="button" class="siteseo-facebook-title" data-tag="%%post_title%%"><span class="dashicons dashicons-plus"></span> Post Title</button> <button type="button" class="siteseo-facebook-title" data-tag="%%sitetitle%%"><span class="dashicons dashicons-plus"></span> Site Title</button> <button type="button" class="siteseo-facebook-title" data-tag="%%sep%%"><span class="dashicons dashicons-plus"></span>Seperator</button>'.wp_kses(siteseo_suggestion_button_metabox(), $allowed_suggestion_tags).' </div> </div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_social_fb_desc_meta">'.esc_html__('Facebook description', 'siteseo').'</label> </div> <div class="siteseo-metabox-input-wrap"> <textarea id="siteseo_social_fb_desc_meta" class="siteseo_social_fb_desc_meta" name="siteseo_social_fb_desc" rows="2" placeholder="'.(!empty($social_preview_desc) ? esc_html(\SiteSEO\TitlesMetas::replace_variables($social_preview_desc, true)) : '').'">'.(!empty($metabox_data['fb_desc']) ? esc_html($metabox_data['fb_desc']) : '').'</textarea> <div class="siteseo-metabox-tags"> <button type="button" class="siteseo-facebook-desc" data-tag="%%post_excerpt%%"><span class="dashicons dashicons-plus"></span> Post Excerpt</button>'.wp_kses(siteseo_suggestion_button_metabox(), $allowed_suggestion_tags).' </div> </div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_social_fb_img_meta">'.esc_html__('Facebook Thumbnail', 'siteseo').'</label> </div> <div class="siteseo-metabox-input-wrap"> <span style="color:red; font-weight:bold; display:none;"></span> <input type="text" id="siteseo_social_fb_img_meta" name="siteseo_social_fb_img" class="siteseo_social_fb_img_meta" placeholder="'.esc_html__('Enter URL of the Image you want to be shown as the Facebook image', 'siteseo').'" value="'.(!empty($metabox_data['fb_img']) ? esc_url($metabox_data['fb_img']) : '').'"/> <p class="description">'.esc_html__('Minimum size: 200x200px, ideal ratio 1.91:1, 8Mb max. (eg: 1640x856px or 3280x1712px for retina screens).', 'siteseo').'</p> <input type="hidden" name="siteseo_social_fb_img_attachment_id" id="siteseo_social_fb_img_attachment_id" class="siteseo_social_fb_img_attachment_id" value=""> <input type="hidden" name="siteseo_social_fb_img_width" id="siteseo_social_fb_img_width" class="siteseo_social_fb_img_width" value=""> <input type="hidden" name="siteseo_social_fb_img_height" id="siteseo_social_fb_img_height" class="siteseo_social_fb_img_height" value=""> <button class="components-button is-secondary" id="siteseo_social_fb_img_upload">Upload Image</button> </div> </div> </div> <div class="siteseo-metabox-tab-x-settings siteseo-metabox-tab"> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label>'.esc_html__('Preview','siteseo').'</label> </div> <div> <div class="siteseo-metabox-x-preview"> <div class="siteseo-metabox-x-image"> <img src="'.(!empty($metabox_data['x_img']) ? esc_url($metabox_data['x_img']) : esc_url($social_placeholder)).'" alt="X preview" load="lazy"/> </div> <div class="siteseo-metabox-x-data"> <div class="siteseo-metabox-x-title">'.(!empty($metabox_data['x_title']) ? esc_html(\SiteSEO\TitlesMetas::replace_variables($metabox_data['x_title'], true)) : esc_html(\SiteSEO\TitlesMetas::replace_variables($social_preview_title, true))).'</div> </div> </div> <div class="siteseo-metabox-x-host">From '.(!empty($host_uri) ? esc_html($host_uri) : '').'</div> </div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_social_twitter_title_meta">'.esc_html__('X Title', 'siteseo').'</label> </div> <div class="siteseo-metabox-input-wrap"> <input type="text" id="siteseo_social_twitter_title_meta" class="siteseo_social_twitter_title_meta" name="siteseo_social_twitter_title" placeholder="'.(!empty($social_preview_title) ? esc_html(\SiteSEO\TitlesMetas::replace_variables($social_preview_title, true)) : '').'" value="'.(!empty($metabox_data['x_title']) ? esc_attr($metabox_data['x_title']) : '').'" /> <div class="siteseo-metabox-tags"> <button type="button" class="siteseo-x-title" data-tag="%%post_title%%"><span class="dashicons dashicons-plus"></span> Post Title</button> <button type="button" class="siteseo-x-title" data-tag="%%sitetitle%%"><span class="dashicons dashicons-plus"></span> Site Title</button> <button type="button" class="siteseo-x-title" data-tag="%%sep%%"><span class="dashicons dashicons-plus"></span>Seperator</button>'.wp_kses(siteseo_suggestion_button_metabox(), $allowed_suggestion_tags).' </div> </div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_social_twitter_desc_meta">'.esc_html__('X description', 'siteseo').'</label> </div> <div class="siteseo-metabox-input-wrap"> <textarea id="siteseo_social_twitter_desc_meta" class="siteseo_social_twitter_desc_meta" name="siteseo_social_twitter_desc" rows="2" placeholder="'.(!empty($social_preview_desc) ? esc_html(\SiteSEO\TitlesMetas::replace_variables($social_preview_desc, true)) : '').'">'.(!empty($metabox_data['x_desc']) ? esc_attr($metabox_data['x_desc']) : '').'</textarea> <div class="siteseo-metabox-tags"> <button type="button" class="siteseo-x-desc" data-tag="%%post_excerpt%%"><span class="dashicons dashicons-plus"></span> Post Excerpt</button>'.wp_kses(siteseo_suggestion_button_metabox(), $allowed_suggestion_tags).' </div> </div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_social_twitter_img_meta">'.esc_html__('X Thumbnail', 'siteseo').'</label> </div> <div class="siteseo-metabox-input-wrap"> <span style="color:red; font-weight:bold; display:none;"></span> <input type="text" id="siteseo_social_twitter_img_meta" class="siteseo_social_twitter_img_meta" name="siteseo_social_twitter_img" placeholder="'.esc_html__('Enter URL of the Image you want to be shown as the X image', 'siteseo').'" value="'.(!empty($metabox_data['x_img']) ? esc_attr($metabox_data['x_img']) : '').'" /> <p class="description">'.esc_html__('Minimum size: 144x144px (300x157px with large card enabled), ideal ratio 1:1 (2:1 with large card), 5Mb max.', 'siteseo').'</p> <input type="hidden" name="siteseo_social_twitter_img_attachment_id" id="siteseo_social_twitter_img_attachment_id" class="siteseo_social_twitter_img_attachment_id" value=""> <input type="hidden" name="siteseo_social_twitter_img_width" id="siteseo_social_twitter_img_width" class="siteseo_social_twitter_img_width" value=""> <input type="hidden" name="siteseo_social_twitter_img_height" id="siteseo_social_twitter_img_height" class="siteseo_social_twitter_img_height" value=""> <button class="components-button is-secondary" id="siteseo_social_twitter_img_upload">Upload Image</button> </div> </div> </div> </div>'; if(!empty($pro_settings['enable_structured_data']) && !empty($pro_settings['toggle_state_stru_data']) && !empty($show_content_analysis)){ echo'<div class="siteseo-sidebar-tabs"><span>'.esc_html__('Structured Data Types', 'siteseo').'</span><span class="siteseo-sidebar-tabs-arrow"><span class="dashicons dashicons-arrow-down-alt2"></span></span></div> <div class="siteseo-metabox-tab-structured-data-types siteseo-metabox-tab">'; // Pro fearure do_action('siteseo_display_structured_data_types'); echo'</div>'; } // video sitemap if(!empty($pro_settings['toggle_state_video_sitemap']) && !empty($pro_settings['enable_video_sitemap']) && !empty($show_content_analysis)){ echo'<div class="siteseo-sidebar-tabs"><span>'.esc_html__('Video Sitemap', 'siteseo').'</span><span class="siteseo-sidebar-tabs-arrow"><span class="dashicons dashicons-arrow-down-alt2"></span></span></div> <div class="siteseo-metabox-tab-video-sitemap siteseo-metabox-tab">'; do_action('siteseo_display_video_sitemap'); echo'</div>'; } // gooogle news exclude if(!empty($pro_settings['toggle_state_google_news']) && !empty($pro_settings['google_news']) && !empty($show_content_analysis)){ echo'<div class="siteseo-sidebar-tabs"><span>'.esc_html__('Google News', 'siteseo').'</span><span class="siteseo-sidebar-tabs-arrow"><span class="dashicons dashicons-arrow-down-alt2"></span></span></div> <div class="siteseo-metabox-tab-google-news siteseo-metabox-tab">'; do_action('siteseo_display_google_news'); echo'</div>'; } echo'<div class="siteseo-sidebar-tabs"><span>'; if(!empty($metabox_data['robots_index'])){ echo'<span class="dashicons dashicons-hidden siteseo-noindex-warning"></span>'; } echo esc_html__('Advanced', 'siteseo').'</span><span class="siteseo-sidebar-tabs-arrow"><span class="dashicons dashicons-arrow-down-alt2"></span></span></div> <div class="siteseo-metabox-tab-advanced-settings siteseo-metabox-tab"> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_social_twitter_img_meta">'.esc_html__('Meta Robots Settings', 'siteseo').'</label> <p class="description">'. /* translators: %s represents the degree of severity */ wp_kses_post(sprintf(__('You cannot uncheck a checkbox? This is normal, and it\'s most likely defined in the <a href="%s">global settings of the plugin.</a>', 'siteseo'), esc_url(admin_url('admin.php?page=siteseo-titles#tab=tab_siteseo_titles_single')))).'</p> </div> <div class="siteseo-metabox-input-wrap">'; $robots_options = [ 'siteseo_robots_index_meta' => [ 'desc' => __('Do not display this page in search engine results / Sitemaps', 'siteseo'), 'short' => 'noindex', 'name' => 'siteseo_robots_index', 'checked' => $metabox_data['robots_index'], 'disabled' => $metabox_data['disabled_robots']['robots_index'] ], 'siteseo_robots_follow_meta' => [ 'desc' => __('Do not follow links for this page', 'siteseo'), 'short' => 'nofollow', 'name' => 'siteseo_robots_follow', 'checked' => $metabox_data['robots_follow'], 'disabled' => $metabox_data['disabled_robots']['robots_follow'] ], 'siteseo_robots_imageindex_meta' => [ 'desc' => __('Do not index images for this page', 'siteseo'), 'short' => 'noimageindex', 'name' => 'siteseo_robots_imageindex', 'checked' => $metabox_data['robots_imageindex'], 'disabled' => $metabox_data['disabled_robots']['imageindex'] ], 'siteseo_robots_archive_meta' => [ 'desc' => __('Do not display a "Cached" link in the Google search results', 'siteseo'), 'short' => 'noarchive', 'name' => 'siteseo_robots_archive', 'checked' => $metabox_data['robots_archive'], 'disabled' => $metabox_data['disabled_robots']['archive'] ], 'siteseo_robots_snippet_meta' => [ 'desc' => __('Do not display a description in search results for this page', 'siteseo'), 'short' => 'nosnippet', 'name' => 'siteseo_robots_snippet', 'checked' => $metabox_data['robots_snippet'], 'disabled' => $metabox_data['disabled_robots']['snippet'] ] ]; foreach($robots_options as $robots_id => $robots_option){ $checked = ''; if(!empty($robots_option['checked'])){ $checked = 'checked'; } $disabled = ''; if(!empty($robots_option['disabled'])){ $disabled = 'disabled'; $robots_option['name'] = ''; } echo'<label for="'.esc_attr($robots_id).'" style="display:block; margin-bottom:5px;"> <input type="checkbox" value="yes" id="'.esc_attr($robots_id).'" class="siteseo-metabox-robots-options" name="'.esc_attr($robots_option['name']).'" '.esc_attr($checked).' '.esc_attr($disabled).'/> '.esc_html($robots_option['desc']).' ('.esc_html($robots_option['short']).') </label>'; } echo'</div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_robots_canonical_meta">'.esc_html__('Canonical URL', 'siteseo').'</label> </div> <div class="siteseo-metabox-input-wrap"> <input id="siteseo_robots_canonical_meta" type="text" name="siteseo_robots_canonical" placeholder="'.esc_url(get_the_permalink()).'" value="'.(!empty($metabox_data['robots_canonical']) ? esc_html($metabox_data['robots_canonical']) : '').'"> </div> </div>'; if(!empty($pagenow) && !empty($typenow) && ($pagenow == 'post.php' || $pagenow == 'post-new.php') && ($typenow == 'post' || $typenow == 'product')){ $categories = (object)[]; if($typenow == 'product'){ $categories = get_the_terms($post, 'product_cat'); } else{ $categories = get_categories(); } if(!empty($categories) && !is_wp_error($categories)){ echo'<div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_robots_canonical_meta">'.esc_html__('Select a primary category', 'siteseo').'</label> </div> <div class="siteseo-metabox-input-wrap"> <select id="siteseo_robots_primary_cat" name="siteseo_robots_primary_cat">'; foreach($categories as $category){ $selected = ''; if(!empty($metabox_data['robots_primary_cat']) && $metabox_data['robots_primary_cat'] == $category->term_id){ $selected = 'selected'; } echo'<option value="'.esc_attr($category->term_id).'" '.esc_attr($selected).'>'.esc_html($category->name).'</option>'; } echo'</select> </div> </div>'; } } echo'</div> <div class="siteseo-sidebar-tabs"><span>'.esc_html__('Redirects', 'siteseo').'</span> <span class="siteseo-sidebar-tabs-arrow"><span class="dashicons dashicons-arrow-down-alt2"></span> </span></div> <div class="siteseo-metabox-tab-redirect siteseo-metabox-tab"> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_redirections_enabled_meta">'.esc_html__('Enable redirection', 'siteseo').'</label> </div> <div class="siteseo-metabox-input-wrap"> <input id="siteseo_redirections_enabled_meta" type="checkbox" name="siteseo_redirections_enabled" value="1" '.(!empty($metabox_data['redirections_enabled']) ? 'checked' : '').'> </div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_redirections_enabled_meta">'.esc_html__('Login status', 'siteseo').'</label> </div> <div class="siteseo-metabox-input-wrap"> <select name="siteseo_redirections_logged_status" id="siteseo_redirections_logged_status"> <option value="both" '.(!empty($metabox_data['redirections_logged_status']) && $metabox_data['redirections_logged_status'] == 'both' ? 'selected' : '').'>'.esc_html__('All', 'siteseo').'</option> <option value="only_logged_in" '.(!empty($metabox_data['redirections_logged_status']) && $metabox_data['redirections_logged_status'] == 'only_logged_in' ? 'selected' : '').'>'.esc_html__('Only when logged In', 'siteseo').'</option> <option value="only_not_logged_in" '.(!empty($metabox_data['redirections_logged_status']) && $metabox_data['redirections_logged_status'] == 'only_not_logged_in' ? 'selected' : '').'>'.esc_html__('Only when not logged in', 'siteseo').'</option> </select> </div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_redirections_type">'.esc_html__('Redirection Type', 'siteseo').'</label> </div> <div class="siteseo-metabox-input-wrap"> <select name="siteseo_redirections_type" id="siteseo_redirections_type"> <option value="301" '.(!empty($metabox_data['redirections_type']) && $metabox_data['redirections_type'] == '301' ? 'selected' : '').'>'.esc_html__('301 Moved Permanently', 'siteseo').'</option> <option value="302" '.(!empty($metabox_data['redirections_type']) && $metabox_data['redirections_type'] == '302' ? 'selected' : '').'>'.esc_html__('302 Found / Moved Temporarily', 'siteseo').'</option> <option value="307" '.(!empty($metabox_data['redirections_type']) && $metabox_data['redirections_type'] == '307' ? 'selected' : '').'>'.esc_html__('307 Moved Temporarily', 'siteseo').'</option>'; if($typenow === 'siteseo_404'){ echo'<option value="410" '.(!empty($metabox_data['redirections_type']) && $metabox_data['redirections_type'] == '410' ? 'selected' : '').'>'.esc_html__('410 Gone', 'siteseo').'</option> <option value="451" '.(!empty($metabox_data['redirections_type']) && $metabox_data['redirections_type'] == '451' ? 'selected' : '').'>'. esc_html__('451 Unavailable For Legal Reasons', 'siteseo').'</option>'; } echo'</select> </div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_redirections_value_meta">'.esc_html__('Redirection URL', 'siteseo').'</label> </div> <div class="siteseo-metabox-input-wrap"> <input id="siteseo_redirections_value_meta" type="text" name="siteseo_redirections_value" value="'.(!empty($metabox_data['redirections_value']) ? esc_attr($metabox_data['redirections_value']): '').'"> </div> <input type="hidden" id="analysis_tabs" name="analysis_tabs" value="'.esc_html(wp_json_encode(array_keys($siteseo_metabox_tabs))).'"> </div>'; // Note if($typenow === 'siteseo_404'){ echo'<div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_redirections_param">'.esc_html__('Query parameters', 'siteseo').'</label> </div> <div class="siteseo-metabox-input-wrap"> <select name="siteseo_redirections_param" id="siteseo_redirections_param"> <option value="exact_match" '.(!empty($metabox_data['redirections_param']) && $metabox_data['redirections_param'] == 'exact_match' ? 'selected' : '').'>'.esc_html__('Exactly parameters with exact match', 'siteseo').'</option> <option value="without_param" '.(!empty($metabox_data['redirections_param']) && $metabox_data['redirections_param'] == 'without_param' ? 'selected' : '').'>'.esc_html__('Exclude all parameters', 'siteseo').'</option> <option value="with_ignored_param" '.(!empty($metabox_data['redirections_param']) && $metabox_data['redirections_param'] == 'with_ignored_param' ? 'selected' : '').'>'.esc_html__('Exclude all parameters and pass them to the redirection', 'siteseo').'</option> </select> </div> </div>'; } echo'</div> </div>'; } static function content_analysis($post){ wp_nonce_field('siteseo_ca_nonce', 'siteseo_content_analysis_nonce'); $siteseo_real_preview = [ 'siteseo_nonce' => wp_create_nonce('siteseo_real_preview_nonce'), 'siteseo_real_preview' => admin_url('admin-ajax.php'), 'i18n' => ['progress' => __('Analysis in progress...', 'siteseo')], 'ajax_url' => admin_url('admin-ajax.php'), 'get_preview_meta_title' => wp_create_nonce('get_preview_meta_title'), 'realtime_nonce' => wp_create_nonce('siteseo_realtime_nonce'), ]; $metabox_data = []; $metabox_data['analysis_target_kw'] = get_post_meta($post->ID, '_siteseo_analysis_target_kw', true); $metabox_data['analysis_data'] = get_post_meta($post->ID, '_siteseo_analysis_data', true); $metabox_data['readibility_data'] = get_post_meta($post->ID, '_siteseo_readibility_data', true); $metabox_data['meta_title'] = get_post_meta($post->ID, '_siteseo_titles_title', true); $metabox_data['meta_desc'] = get_post_meta($post->ID, '_siteseo_titles_desc', true); $title_options = get_option('siteseo_titles_option_name', []); if(self::titles_single_cpt_noindex_option() || !empty($title_options['titles_noindex']) || true === post_password_required($post->ID)){ $metabox_data['robots_index'] = 'yes'; } else { $metabox_data['robots_index'] = get_post_meta($post->ID, '_siteseo_robots_index', true); } if(post_password_required($post->ID) === true || !empty($title_options['titles_noindex']) || self::titles_single_cpt_noindex_option()){ $metabox_data['robots_index'] = 'yes'; } else{ $metabox_data['robots_index'] = get_post_meta($post->ID, '_siteseo_robots_index', true); } if(!empty($title_options['titles_nofollow']) || self::titles_single_cpt_nofollow_option()){ $metabox_data['robots_follow'] = 'yes'; } else{ $metabox_data['robots_follow'] = get_post_meta($post->ID, '_siteseo_robots_follow', true); } if(!empty($title_options['titles_noarchive'])){ $metabox_data['robots_archive'] = 'yes'; } else{ $metabox_data['robots_archive'] = get_post_meta($post->ID, '_siteseo_robots_archive', true); } if(!empty($title_options['titles_nosnippet'])){ $metabox_data['robots_snippet'] = 'yes'; } else{ $metabox_data['robots_snippet'] = get_post_meta($post->ID, '_siteseo_robots_snippet', true); } if(!empty($title_options['titles_noimageindex'])){ $metabox_data['robots_imageindex'] = 'yes'; } else{ $metabox_data['robots_imageindex'] = get_post_meta($post->ID, '_siteseo_robots_imageindex', true); } $metabox_data['post_id'] = $post->ID; $metabox_data['readibility_data'] = get_post_meta($post->ID, '_siteseo_readibility_data', true); self::siteseo_content_analysis_tab($metabox_data); } static function titles_single_cpt_nofollow_option(){ $siteseo_get_current_cpt = get_post_type(); $options = get_option('siteseo_titles_option_name'); if(!empty($options) && isset($options['titles_single_titles'][$siteseo_get_current_cpt]['nofollow'])){ return $options['titles_single_titles'][$siteseo_get_current_cpt]['nofollow']; } } static function btn_secondary_classes() { //Classic Editor compatibility global $pagenow; $current_screen = null; if(function_exists('get_current_screen')){ $current_screen = get_current_screen(); } if(!empty($current_screen) && method_exists($current_screen, 'is_block_editor') && true === $current_screen->is_block_editor()){ $btn_classes_secondary = 'components-button is-secondary'; } elseif(isset($pagenow) && ($pagenow === 'term.php' || $pagenow === 'post.php' || $pagenow === 'post-new.php')){ $btn_classes_secondary = 'button button-secondary'; } else{ $btn_classes_secondary = 'btn btnSecondary'; } return $btn_classes_secondary; } static function siteseo_content_analysis_tab(&$metabox_data){ global $post; echo '<div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_titles_title_meta">' . esc_html__('Focus Keywords', 'siteseo') . '</label> </div> <div class="siteseo-metabox-input-wrap"> <div id="siteseo_tags_wrapper" style="display: flex; flex-wrap: wrap; gap: 5px; padding: 5px; border: 1px solid #ccc; border-radius: 5px;">'; if(!empty($metabox_data['analysis_target_kw'])){ $tags_arr = explode(',', $metabox_data['analysis_target_kw']); if(!empty($tags_arr) && is_array($tags_arr)){ foreach($tags_arr as $tag_name){ echo '<span class="siteseo-tag">'.esc_html($tag_name).'<span class="siteseo-remove-tag">×</span></span>'; } } } echo '<input id="siteseo_analysis_target_kw_meta" class="siteseo_analysis_target_kw_meta" type="text" placeholder="' . esc_html__('Enter your target keywords', 'siteseo') . '" style="border: none; outline: none; flex: 1; min-width: 150px;" /> <input type="hidden" id="siteseo_tags_hidden" name="siteseo_analysis_target_kw" value="' . (!empty($metabox_data['analysis_target_kw']) ? esc_attr($metabox_data['analysis_target_kw']) : '') . '" /> </div> <p class="description">Press <kbd>Enter</kbd> key on your keyboard to add keyword</p> <button id="siteseo_refresh_seo_analysis" type="button" style="margin-top:10px;" class="'.esc_attr(self::btn_secondary_classes()).'" data_id="'.esc_attr(get_the_ID()).'" data_post_type="'.esc_attr(get_current_screen()->post_type).'"> '.esc_html__('Refresh analysis', 'siteseo').'</button> <p class="description">'.esc_html__('Refresh analysis after saving the post to improve the accuracy of the analysis', 'siteseo').'</p> </div> </div> <div id="siteseo-metabox-content-analysis"> <div id="siteseo-metabox-tabs-container"> <div class="siteseo-metabox-subtabs"> <div class="siteseo-metabox-tab-label siteseo-metabox-tab-label-active" data-tab="siteseo-metabox-seo-analysis-tab">'. esc_html__('SEO Analysis', 'siteseo').'</div> <div class="siteseo-metabox-tab-label" data-tab="siteseo-metabox-readibility-analysis-tab">'.esc_html__('Content Readability', 'siteseo').'</div> </div> <div id="siteseo-metabox-tab-content"> <div class="siteseo-metabox-seo-analysis-tab siteseo-metabox-tab" style="display:block;">'; $post_id = isset($_POST['post_id']) ? intval($_POST['post_id']) : 0; $post = get_post($post_id); Analysis::display_seo_analysis($post); echo'</div> <div class="siteseo-metabox-readibility-analysis-tab siteseo-metabox-tab"> <p class="description">' . esc_html__('This section works as a guide to help you write, better content for your user, this do not have a direct affect on SEO, but it will help you write better content for your users which will help user stay on your site longer, or will improve the Click Through rate. Which will signal search engines about the userfulness and likeleyness of your content by your user which indirectly improve SEO of the page.', 'siteseo') . '</p>'; Analysis::display_content_readibility($metabox_data); echo'</div> </div> </div> </div>'; } static function titles_single_cpt_noindex_option(){ $siteseo_get_current_cpt = get_post_type(); $options = get_option('siteseo_titles_option_name'); if(!empty($options) && isset($options['titles_single_titles'][$siteseo_get_current_cpt]['noindex'])){ return $options['titles_single_titles'][$siteseo_get_current_cpt]['noindex']; } } static function save_ca_metabox($post_id, $post){ if(!isset($_POST['siteseo_content_analysis_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['siteseo_content_analysis_nonce'])), 'siteseo_ca_nonce')){ return $post_id; } // Post type object $post_type = get_post_type_object($post->post_type); //Check permission if(!current_user_can($post_type->cap->edit_post, $post_id) || !siteseo_user_can_metabox()){ return $post_id; } if('attachment' !== get_post_type($post_id)){ if(isset($_POST['siteseo_analysis_target_kw'])){ update_post_meta($post_id, '_siteseo_analysis_target_kw', self::clean_post('siteseo_analysis_target_kw')); } else{ delete_post_meta($post_id, '_siteseo_analysis_target_kw'); } } } static function save_metabox($post_id, $post){ global $siteseo; // Security Check if(!isset($_POST['siteseo_metabox_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['siteseo_metabox_nonce'])), 'siteseo_metabox_nonce')){ return $post_id; } //Post type object $post_type = get_post_type_object($post->post_type); //Check permission if(!current_user_can($post_type->cap->edit_post, $post_id) || !siteseo_user_can_metabox()){ return $post_id; } if('attachment' !== get_post_type($post_id)){ $analysis_tabs = []; $analysis_tabs = json_decode(self::clean_post('analysis_tabs'), true); if(!empty($analysis_tabs) && is_array($analysis_tabs) && in_array('content-analysis', $analysis_tabs)){ if(!empty($_POST['siteseo_analysis_target_kw'])){ update_post_meta($post_id, '_siteseo_analysis_target_kw', self::clean_post('siteseo_analysis_target_kw')); } else{ delete_post_meta($post_id, '_siteseo_analysis_target_kw'); } } if(!empty($analysis_tabs) && is_array($analysis_tabs) && in_array('title-settings', $analysis_tabs)){ if(!empty($_POST['siteseo_titles_title'])){ update_post_meta($post_id, '_siteseo_titles_title', self::clean_post('siteseo_titles_title')); } else{ delete_post_meta($post_id, '_siteseo_titles_title'); } if(!empty($_POST['siteseo_titles_desc'])){ update_post_meta($post_id, '_siteseo_titles_desc', self::clean_post('siteseo_titles_desc')); } else{ delete_post_meta($post_id, '_siteseo_titles_desc'); } } if(!empty($analysis_tabs) && is_array($analysis_tabs) && in_array('advanced-settings', $analysis_tabs)){ if(isset($_POST['siteseo_robots_index'])){ update_post_meta($post_id, '_siteseo_robots_index', 'yes'); } else{ delete_post_meta($post_id, '_siteseo_robots_index'); } if(isset($_POST['siteseo_robots_follow'])){ update_post_meta($post_id, '_siteseo_robots_follow', 'yes'); } else{ delete_post_meta($post_id, '_siteseo_robots_follow'); } if(isset($_POST['siteseo_robots_imageindex'])){ update_post_meta($post_id, '_siteseo_robots_imageindex', 'yes'); } else{ delete_post_meta($post_id, '_siteseo_robots_imageindex'); } if(isset($_POST['siteseo_robots_archive'])){ update_post_meta($post_id, '_siteseo_robots_archive', 'yes'); } else{ delete_post_meta($post_id, '_siteseo_robots_archive'); } if(isset($_POST['siteseo_robots_snippet'])){ update_post_meta($post_id, '_siteseo_robots_snippet', 'yes'); } else{ delete_post_meta($post_id, '_siteseo_robots_snippet'); } if(!empty($_POST['siteseo_robots_canonical'])){ update_post_meta($post_id, '_siteseo_robots_canonical', self::clean_post('siteseo_robots_canonical')); } else{ delete_post_meta($post_id, '_siteseo_robots_canonical'); } if(!empty($_POST['siteseo_robots_primary_cat'])){ update_post_meta($post_id, '_siteseo_robots_primary_cat', self::clean_post('siteseo_robots_primary_cat')); } else{ delete_post_meta($post_id, '_siteseo_robots_primary_cat'); } } if(!empty($analysis_tabs) && is_array($analysis_tabs) && in_array('social-settings', $analysis_tabs)){ //Facebook if(!empty($_POST['siteseo_social_fb_title'])){ update_post_meta($post_id, '_siteseo_social_fb_title', self::clean_post('siteseo_social_fb_title')); } else{ delete_post_meta($post_id, '_siteseo_social_fb_title'); } if(!empty($_POST['siteseo_social_fb_desc'])){ update_post_meta($post_id, '_siteseo_social_fb_desc', self::clean_post('siteseo_social_fb_desc')); } else{ delete_post_meta($post_id, '_siteseo_social_fb_desc'); } if(!empty($_POST['siteseo_social_fb_img'])){ update_post_meta($post_id, '_siteseo_social_fb_img', self::clean_post('siteseo_social_fb_img')); } else{ delete_post_meta($post_id, '_siteseo_social_fb_img'); } if(!empty($_POST['siteseo_social_fb_img_attachment_id']) && !empty($_POST['siteseo_social_fb_img'])){ update_post_meta($post_id, '_siteseo_social_fb_img_attachment_id', self::clean_post('siteseo_social_fb_img_attachment_id')); } else{ delete_post_meta($post_id, '_siteseo_social_fb_img_attachment_id'); } if(!empty($_POST['siteseo_social_fb_img_width']) && !empty($_POST['siteseo_social_fb_img'])){ update_post_meta($post_id, '_siteseo_social_fb_img_width', self::clean_post('siteseo_social_fb_img_width')); } else{ delete_post_meta($post_id, '_siteseo_social_fb_img_width'); } if(!empty($_POST['siteseo_social_fb_img_height']) && !empty($_POST['siteseo_social_fb_img'])){ update_post_meta($post_id, '_siteseo_social_fb_img_height', self::clean_post('siteseo_social_fb_img_height')); } else{ delete_post_meta($post_id, '_siteseo_social_fb_img_height'); } //Twitter if(!empty($_POST['siteseo_social_twitter_title'])){ update_post_meta($post_id, '_siteseo_social_twitter_title', self::clean_post('siteseo_social_twitter_title')); } else{ delete_post_meta($post_id, '_siteseo_social_twitter_title'); } if(!empty($_POST['siteseo_social_twitter_desc'])){ update_post_meta($post_id, '_siteseo_social_twitter_desc', self::clean_post('siteseo_social_twitter_desc')); } else{ delete_post_meta($post_id, '_siteseo_social_twitter_desc'); } if(!empty($_POST['siteseo_social_twitter_img'])){ update_post_meta($post_id, '_siteseo_social_twitter_img', self::clean_post('siteseo_social_twitter_img')); } else{ delete_post_meta($post_id, '_siteseo_social_twitter_img'); } if(!empty($_POST['siteseo_social_twitter_img_attachment_id']) && !empty($_POST['siteseo_social_twitter_img'])){ update_post_meta($post_id, '_siteseo_social_twitter_img_attachment_id', self::clean_post('siteseo_social_twitter_img_attachment_id')); } else{ delete_post_meta($post_id, '_siteseo_social_twitter_img_attachment_id'); } if(!empty($_POST['siteseo_social_twitter_img_width']) && !empty($_POST['siteseo_social_twitter_img'])){ update_post_meta($post_id, '_siteseo_social_twitter_img_width', self::clean_post('siteseo_social_twitter_img_width')); } else{ delete_post_meta($post_id, '_siteseo_social_twitter_img_width'); } if(!empty($_POST['siteseo_social_twitter_img_height']) && !empty($_POST['siteseo_social_twitter_img'])){ update_post_meta($post_id, '_siteseo_social_twitter_img_height', self::clean_post('siteseo_social_twitter_img_height')); } else{ delete_post_meta($post_id, '_siteseo_social_twitter_img_height'); } } if(!empty($analysis_tabs) && is_array($analysis_tabs) && in_array('redirect', $analysis_tabs)){ if(isset($_POST['siteseo_redirections_type'])){ update_post_meta($post_id, '_siteseo_redirections_type', self::clean_post('siteseo_redirections_type')); } if(!empty($_POST['siteseo_redirections_value'])){ update_post_meta($post_id, '_siteseo_redirections_value', self::clean_post('siteseo_redirections_value')); } else{ delete_post_meta($post_id, '_siteseo_redirections_value'); } if(isset($_POST['siteseo_redirections_param'])){ update_post_meta($post_id, '_siteseo_redirections_param', self::clean_post('siteseo_redirections_param')); } if(isset($_POST['siteseo_redirections_enabled'])){ update_post_meta($post_id, '_siteseo_redirections_enabled', 'yes'); } else{ delete_post_meta($post_id, '_siteseo_redirections_enabled', ''); } if(isset($_POST['siteseo_redirections_enabled_regex'])){ update_post_meta($post_id, '_siteseo_redirections_enabled_regex', 'yes'); } else{ delete_post_meta($post_id, '_siteseo_redirections_enabled_regex'); } if(isset($_POST['siteseo_redirections_logged_status'])){ update_post_meta($post_id, '_siteseo_redirections_logged_status', self::clean_post('siteseo_redirections_logged_status')); } else{ delete_post_meta($post_id, '_siteseo_redirections_logged_status'); } } if(!empty($analysis_tabs) && is_array($analysis_tabs) && in_array('structured-data-types', $analysis_tabs)){ if(class_exists('\SiteSEOPro\StructuredData') && method_exists('\SiteSEOPro\StructuredData', 'save_metabox')){ \SiteSEOPro\StructuredData::save_metabox($post_id, $post); } } if(!empty($analysis_tabs) && is_array($analysis_tabs) && in_array('video-sitemap', $analysis_tabs)){ if(class_exists('\SiteSEOPro\VideoSitemap') && method_exists('\SiteSEOPro\VideoSitemap', 'save_video_sitemap')){ \SiteSEOPro\VideoSitemap::save_video_sitemap($post_id, $post); } } if(!empty($analysis_tabs) && is_array($analysis_tabs) && in_array('google-news', $analysis_tabs)){ if(class_exists('\SiteSEOPro\GoogleNews') && method_exists('\SiteSEOPro\GoogleNews', 'save_google_news')){ \SiteSEOPro\GoogleNews::save_google_news($post_id, $post); } } } } static function clean_post($name){ return self::clean_post_req($name); } static function clean_get($name){ return self::clean_post_req($name); } static function clean_post_req($name){ if(empty($name)){ return ''; } if(!isset($_REQUEST[$name])){ return ''; } if(is_array($_REQUEST[$name]) || is_object($_REQUEST[$name])){ return map_deep(wp_unslash($_REQUEST[$name]), 'sanitize_text_field'); } return sanitize_text_field(wp_unslash($_REQUEST[$name])); } static function universal(){ global $siteseo, $pagenow, $post; $post_id = !empty($_REQUEST['post']) ? (int) sanitize_text_field(wp_unslash($_REQUEST['post'])) : 0; if(empty($post_id)){ return; } if(!current_user_can('edit_post', $post_id)){ wp_die(esc_html__('You do not have access to edit this post', 'siteseo')); } $tmp_post = $post; $post = get_post($post_id); $tmp_pagenow = $pagenow; $pagenow = 'post.php'; if(empty($post)){ $post = $tmp_post; return; } set_current_screen($post->post_type); echo '<style>body{height: 100vh;} #wpcontent,#wpbody-content,html.wp-toolbar{padding:0;} .postbox .handle-order-higher, .postbox .handle-order-lower,#minor-publishing-actions,.site-menu-header{display:none !important;} #adminmenumain, #wpfooter, #wpadminbar{display:none;} #wpcontent{margin:auto;} #wpbody-content{position:relative;} .siteseo-metabox-tab{background-color:white;} .siteseo-meta-submit-container{position:fixed;bottom: 20px;right : 20px;} #siteseo_cpt form {position:relative;}.siteseo-btn{display: inline-flex;padding: 0.5rem 1rem;gap: 0.5rem;justify-content: center;align-items: center;border-radius: 0.375rem;font-size: 0.875rem;line-height: 1.25rem;font-weight: 500;white-space: nowrap;cursor:pointer;box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);border:none;text-decoration:none; text-align:center;}.siteseo-btn.primary{background-color:#141b38;color:white;} .siteseo-spinner{display:none;border-radius:50%;animation: siteseo-spinner 1s linear infinite;height: 0.9375rem;width: 0.9375rem;border: 2px solid #dddcdc80;border-left-color: #e3e3e3;} .siteseo-spinner-active{display:inline-block;} @keyframes siteseo-spinner{ 0% { transform: rotate(0deg);} 100% {transform: rotate(360deg);}} .components-button{align-items: center; -webkit-appearance: none; background: none; border: 0; border-radius: 2px; box-sizing: border-box; color:#1e1e1e; cursor: pointer;display: inline-flex; font-family: inherit; font-size: 13px; font-weight: 400; height: 36px; margin: 0; padding: 6px 12px; text-decoration: none; transition: box-shadow .1s linear;}.components-button.is-secondary {background: #0000; box-shadow: inset 0 0 0 1px #3858e9; color:#3858e9; outline: 1px solid #0000; white-space: nowrap;}.siteseo-sidebar-tabs{display:none;} .notice, .update-nag{ display: none !important;}</style> <div id="siteseo_cpt"><form id="siteseo-universal-post" action="post.php" method="post"> <input type="hidden" name="post_id" value="'.esc_attr($post_id).'"/>'; wp_nonce_field('siteseo_universal_nonce', 'security'); self::render_metabox(); echo '<div class="siteseo-meta-submit-container"> <button type="submit" class="siteseo-btn primary">'.esc_html__('Save Changes', 'siteseo').'<span class="siteseo-spinner"></span></button> </div></form></div> <script> jQuery(document).ready(function(){ jQuery("#siteseo-universal-post").on("submit", function(event){ event.preventDefault(); let jEle = jQuery(event.target), spinner = jEle.find(".siteseo-spinner"), formData = {}; jQuery(this).serializeArray().forEach(field => { formData[field.name] = field.value; }); formData["action"] = "siteseo_save_universal_metabox"; spinner.addClass("siteseo-spinner-active"); jQuery.ajax({ method : "POST", url : "'.esc_url(admin_url('admin-ajax.php')).'", data : formData, success : function(res){ //console.log(res); } }).always(function(){ spinner.removeClass("siteseo-spinner-active"); }) }); }); </script>'; $post = $tmp_post; $pagenow = $tmp_pagenow; global $wp_version; if(!empty($wp_version) && version_compare($wp_version, '6.4', '>')){ remove_action('wp_footer', 'the_block_template_skip_link'); } wp_footer(); exit; } static function render_term_metabox($term){ $metabox_data = self::metabox_term_data($term); self::metabox_form_html($metabox_data); } static function save_meta_terms($term_id){ // Security Check if(!isset($_POST['siteseo_metabox_nonce']) || !wp_verify_nonce(self::clean_post('siteseo_metabox_nonce'), 'siteseo_metabox_nonce') ){ return $term_id; } // Getting taxonomy $term = get_term($term_id); $taxonomy = get_taxonomy($term->taxonomy); // Is this user allowed to make these changes if(!current_user_can($taxonomy->cap->edit_terms, $term_id)) { return $term_id; } $analysis_tabs = []; $analysis_tabs = json_decode(self::clean_post('analysis_tabs'), true); if(empty($analysis_tabs) || !is_array($analysis_tabs)){ return $term_id; } $tabs = [ 'title-settings' => [ 'siteseo_titles_title' => '_siteseo_titles_title', 'siteseo_titles_desc' => '_siteseo_titles_desc', ], 'advanced-settings' => [ 'siteseo_robots_index' => '_siteseo_robots_index', 'siteseo_robots_follow' => '_siteseo_robots_follow', 'siteseo_robots_imageindex'=> '_siteseo_robots_imageindex', 'siteseo_robots_archive' => '_siteseo_robots_archive', 'siteseo_robots_snippet' => '_siteseo_robots_snippet', 'siteseo_robots_canonical' => '_siteseo_robots_canonical', ], 'social-settings' => [ 'siteseo_social_fb_title' => '_siteseo_social_fb_title', 'siteseo_social_fb_desc' => '_siteseo_social_fb_desc', 'siteseo_social_fb_img' => '_siteseo_social_fb_img', 'siteseo_social_fb_img_attachment_id' => '_siteseo_social_fb_img_attachment_id', 'siteseo_social_fb_img_width' => '_siteseo_social_fb_img_width', 'siteseo_social_fb_img_height' => '_siteseo_social_fb_img_height', 'siteseo_social_twitter_title' => '_siteseo_social_twitter_title', 'siteseo_social_twitter_desc' => '_siteseo_social_twitter_desc', 'siteseo_social_twitter_img' => '_siteseo_social_twitter_img', ], 'redirect' => [ 'siteseo_redirections_type' => '_siteseo_redirections_type', 'siteseo_redirections_logged_status' => '_siteseo_redirections_logged_status', 'siteseo_redirections_value' => '_siteseo_redirections_value', 'siteseo_redirections_enabled' => '_siteseo_redirections_enabled', ] ]; // Save the key for all the options which are checkboxes $is_checkboxes = [ 'siteseo_robots_index', 'siteseo_robots_follow', 'siteseo_robots_imageindex', 'siteseo_robots_archive', 'siteseo_robots_snippet', 'siteseo_redirections_enabled', ]; foreach($tabs as $tab => $fields){ if(!in_array($tab, $analysis_tabs)){ continue; } foreach($fields as $post_key => $meta_key){ if(!empty($_POST[$post_key])){ $value = in_array($post_key, $is_checkboxes) ? 'yes' : self::clean_post($post_key); update_term_meta($term_id, $meta_key, $value); } else { delete_term_meta($term_id, $meta_key); } } } return $term_id; } } metaboxes/analysis.php 0000644 00000154204 15100371032 0011065 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO\Metaboxes; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Analysis{ static function display_content_readibility($metabox_data){ if(empty($metabox_data) || !isset($metabox_data['post_id'])){ return; // Safeguard in case $metabox_data is incomplete or invalid. } $post_id = $metabox_data['post_id']; $readability_data = get_post_meta($post_id, '_siteseo_readibility_data', true); // Fetch and analyze readability data $analyzes = self::analyze_content($readability_data); // Render the readability data self::render_readibility($analyzes, $readability_data); } static function analyze_content($data){ $analyzes = []; // Analyze different aspects $analyzes = self::analyze_power_word($analyzes, $data); $analyzes = self::analyze_title_number($analyzes, $data); $analyzes = self::analyze_passive_voice($analyzes, $data); $analyzes = self::analyze_paragraph_length($analyzes, $data); return $analyzes; } static function analyze_power_word($analyzes, $data){ if(!empty($data['power_words'])){ $analyzes['power_words'] = [ 'desc' => '<p>'.__('Good: You have power words in your title.', 'siteseo').'</p>', 'impact' => 'good', 'title'=>'Power Word in title' ]; } else{ $analyzes['power_words'] = [ 'desc' => '<p>'.__('Consider adding power words to your title for better impact.', 'siteseo').'</p>', 'impact' => 'low', 'title'=> __('Power Word in title', 'siteseo') ]; } return $analyzes; } static function analyze_title_number($analyzes, $data){ if(!empty($data['number_found'])){ $analyzes['number_found'] = [ /* translators: %s is the number found in the title */ 'desc' => '<p>'.sprintf(__('Good: Your title contains the number "%s".', 'siteseo'), $data['number_found']).'</p>', 'impact' => 'good', 'title' => 'Number in title' ]; } else{ $analyzes['number_found'] = [ 'desc' => '<p>'.__('Consider adding a number to your title to improve CTR.', 'siteseo').'</p>', 'impact' => 'low', 'title' => 'Number in title' ]; } return $analyzes; } static function analyze_passive_voice($analyzes, $data){ //$analyzes['title'] ='Passive Voice'; if(empty($data['passive_voice'])){ $analyzes['passive_voice'] = [ 'desc' => '<p>'.__('Great: No passive voice detected.', 'siteseo').'</p>', 'impact' => 'good', 'title' => 'Passive Voice' ]; } else { $percentage = round(($data['passive_voice']['passive_sentences'] * 100) / $data['passive_voice']['total_sentences']); if($percentage <= 10){ $analyzes['passive_voice'] = [ /* translators: %s is the number found in the title */ 'desc' => '<p>'.sprintf(__('Good: Only %s%% of sentences use passive voice.', 'siteseo'), $percentage).'</p>', 'impact' => 'good', 'title' => 'Passive Voice' ]; } elseif($percentage < 20){ $analyzes['passive_voice'] = [ /* translators: %s is the percentage of sentences using passive voice */ 'desc' => '<p>'.sprintf(__('Okay: %s%% of sentences use passive voice. Try to reduce it.', 'siteseo'), $percentage).'</p>', 'impact' => 'medium', 'title' => 'Passive Voice' ]; } else{ $analyzes['passive_voice'] = [ /* translators: %s is the percentage of sentences using passive voice */ 'desc' => '<p>'.sprintf(__('High: %s%% of sentences use passive voice. Consider revising.', 'siteseo'), $percentage).'</p>', 'impact' => 'high', 'title' => 'Passive Voice' ]; } } return $analyzes; } static function analyze_paragraph_length($analyzes, $data){ if(empty($data['paragraph_length']) || $data['paragraph_length'] < 150){ $analyzes['paragraph_length'] = [ 'desc' => '<p>Good: Your paragraphs are concise.</p>', 'impact' => 'good', 'title' => 'Paragraph Length' ]; } else{ $analyzes['paragraph_length'] = [ /* translators: %s is the current paragraph length in words */ 'desc' => '<p>'.sprintf(__('Consider reducing paragraph length. Current length: %s words.', 'siteseo'), $data['paragraph_length']) . '</p>', 'impact' => 'low', 'title' => 'Paragraph Length' ]; } return $analyzes; } static function render_readibility($analyzes, $analysis_data, $echo = true){ $acceptable_svg = [ 'svg' => [ 'role' => true, 'aria-hidden' => true, 'focusable' => true, 'width' => true, 'height' => true, 'viewbox' => true, 'version' => true, 'xmlns' => true, 'fill' => true, ], 'path' => ['fill' => true, 'd' => true] ]; if(!empty($analyzes)){ $order = ['1' => 'high', '2' => 'medium', '3' => 'low', '4' => 'good']; usort($analyzes, function ($a, $b) use ($order) { return array_search($a['impact'], $order) - array_search($b['impact'], $order); }); // Define SVG icons $high_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"/></svg>'; $medium_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"/></svg>'; $good_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg>'; // Generate HTML $html = '<div id="siteseo-readibility-tabs">'; foreach($analyzes as $key => $value){ $impact_icon = ''; switch ($value['impact']) { case 'high': $impact_icon = $high_icon; break; case 'medium': case 'low': $impact_icon = $medium_icon; break; case 'good': $impact_icon = $good_icon; break; } $html .= '<div class="siteseo-analysis-block">'; $html .= '<div class="siteseo-analysis-block-title">'; $html .= '<div><span class="impact ' . esc_attr($value['impact']) .'" aria-hidden="true">' . $impact_icon . '</span>' . /* translators: %s represents the degree of severity */ '<span class="screen-reader-text">'. sprintf(esc_html__('Degree of severity: %s','siteseo'), esc_html($value['impact'])).'</span>' . esc_html($value['title']) . '</div>'; $html .= '<span class="siteseo-arrow" aria-hidden="true"></span></div>'; $html .= '<div class="siteseo-analysis-block-content">' . wp_kses_post($value['desc']) . '</div>'; $html .= '</div>'; } $html .= '</div>'; if($echo){ $allowed_html = array_merge(wp_kses_allowed_html('post'), $acceptable_svg); echo wp_kses($html, $allowed_html); return; } return $html; } } // Analaysis static function display_seo_analysis($post){ $seo_analysis = self::perform_seo_analysis($post); echo '<div id="siteseo-analysis-tabs"> <div id="siteseo-analysis-tabs-1"> <div class="siteseo-analysis-summary">'; if(!empty($seo_analysis)){ // grp usort($seo_analysis['checks'], function ($a, $b) { $order = ['error' => 0, 'warning' => 1, 'good' => 2]; $a_status_class = isset($a['status_class']) ? $a['status_class'] : ''; $b_status_class = isset($b['status_class']) ? $b['status_class'] : ''; $a_order = isset($order[$a_status_class]) ? $order[$a_status_class] : 3; $b_order = isset($order[$b_status_class]) ? $order[$b_status_class] : 3; return $a_order - $b_order; }); echo '<div class="siteseo-analysis-summary-pill">'; // counts logic if(!empty($seo_analysis['error_count'])){ echo '<span><svg fill="#f33" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M24 22h-24l12-20z"/></svg>'.esc_html($seo_analysis['error_count']). ' Errors</span>'; } if(!empty($seo_analysis['warning_count'])){ echo '<span><svg xmlns="http://www.w3.org/2000/svg" fill="#fa3" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M0 96C0 60.7 28.7 32 64 32H384c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96z"/></svg>'.esc_html($seo_analysis['warning_count']). ' Warnings</span>'; } if(!empty($seo_analysis['good_count'])){ echo '<span><svg xmlns="http://www.w3.org/2000/svg" fill="#0c6" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512z"/></svg><span>'.esc_html($seo_analysis['good_count']). ' Good</span></span>'; } echo '</div> </div><!-- .analysis-score -->'; // A triangle with exclamation in it. $medium_icon_svg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"/></svg>'; // A check inside a solid circle $good_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg>'; $high_icon_svg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"/></svg>'; $allowed_svg_tags = ['svg' => ['xmlns' => true, 'viewbox' => true, 'width' => true, 'height' => true, 'class' => true, 'fill' => true, 'stroke' => true, 'stroke-width' => true], 'path' => ['d' => true, 'fill' => true, 'stroke' => true, 'stroke-width' => true]]; foreach($seo_analysis['checks'] as $check){ echo '<div class="siteseo-analysis-block">'; if(isset($check['label'])){ echo'<div class="siteseo-analysis-block-title">'; if(isset($check['status_class'])){ $impact_icon = ''; switch($check['status_class']){ case 'good': $impact_icon = $good_icon; break; case 'warning': $impact_icon = $medium_icon_svg; break; case 'error': $impact_icon = $high_icon_svg; break; } echo '<div><span class="impact '.esc_attr($check['status_class']).'" aria-hidden="true">'.wp_kses($impact_icon, $allowed_svg_tags).'</span> <span class="screen-reader-text">'. /* translators: %s represents the degree of severity */ sprintf(esc_html__('Degree of severity: %s','siteseo'), esc_html($check['status_class'])).'</span>'; } echo esc_html($check['label']).'</div> <span class="siteseo-arrow" aria-hidden="true"></span> </div>'; } if(isset($check['details'])){ echo '<div class="siteseo-analysis-block-content" aria-hidden="true">'.wp_kses_post($check['details']).'</div>'; } echo '</div><!-- .siteseo-analysis-block -->'; } echo '</div><!-- #siteseo-analysis-tabs-1 --> </div><!-- #siteseo-analysis-tabs -->'; } } static function perform_seo_analysis($post){ $content = $post->post_content; $title = $post->post_title; $title = !empty(get_post_meta($post->ID, '_siteseo_titles_title',true)) ? get_post_meta($post->ID, '_siteseo_titles_title', true) : $title; $permalink = get_permalink($post->ID); $keywords = get_post_meta($post->ID, '_siteseo_analysis_target_kw', true); $meta_desc = get_post_meta($post->ID, '_siteseo_titles_desc', true); if(empty($meta_desc)){ $meta_desc = ''; } $analysis = [ 'good_count' => 0, 'warning_count' => 0, 'error_count' => 0, 'checks' => [] ]; $canonical_check = self::check_canonical_url($permalink); $analysis['checks'][] = $canonical_check; self::update_analysis_score($analysis, $canonical_check); $word_count_check = self::check_word_count($content); $analysis['checks'][] = $word_count_check; self::update_analysis_score($analysis, $word_count_check); $keywords_density_check = self::check_keywords_density($content, $keywords); $analysis['checks'][] = $keywords_density_check; self::update_analysis_score($analysis, $keywords_density_check); $meta_title_check = self::check_meta_title($title); $analysis['checks'][] = $meta_title_check; self::update_analysis_score($analysis, $meta_title_check); $meta_description_check = self::check_meta_description($content, $meta_desc); $analysis['checks'][] = $meta_description_check; self::update_analysis_score($analysis, $meta_description_check); $image_alt_check = self::check_image_alt_texts($content); $analysis['checks'][] = $image_alt_check; self::update_analysis_score($analysis, $image_alt_check); $links_outbound_check = self::analyze_outbound_links($content); $analysis['checks'][] = $links_outbound_check; self::update_analysis_score($analysis, $links_outbound_check); $links_internal_check = self::analyze_internal_links($content); $analysis['checks'][] = $links_internal_check; self::update_analysis_score($analysis, $links_internal_check); $headings_check = self::check_headings($content); $analysis['checks'][] = $headings_check; self::update_analysis_score($analysis, $headings_check); $social_tags_check = self::check_social_meta_tags($post); $analysis['checks'][] = $social_tags_check; self::update_analysis_score($analysis, $social_tags_check); $structured_data_check = self::check_structured_data($post); $analysis['checks'][] = $structured_data_check; self::update_analysis_score($analysis, $structured_data_check); $permalink_keywords_check = self::check_keywords_in_permalink($permalink, $keywords); $analysis['checks'][] = $permalink_keywords_check; self::update_analysis_score($analysis, $permalink_keywords_check); $meta_robots_check = self::check_meta_robots($post); $analysis['checks'][] = $meta_robots_check; self::update_analysis_score($analysis, $meta_robots_check); $last_modified_check = self::check_last_modified_date($post); $analysis['checks'][] = $last_modified_check; self::update_analysis_score($analysis, $last_modified_check); $nofollow_links_check = self::analyze_nofollow_links($content); $analysis['checks'][] = $nofollow_links_check; self::update_analysis_score($analysis, $nofollow_links_check); $readability_data = []; $readability_data = self::analyze_readability($content, $title); update_post_meta($post->ID, '_siteseo_readibility_data', $readability_data); $analysis['checks'][] = $readability_data; return $analysis; } static function update_analysis_score(&$analysis, $check){ switch($check['status']){ case 'Good': $analysis['good_count']++; break; case 'Warning': $analysis['warning_count']++; break; case 'Error': $analysis['error_count']++; break; } } static function check_canonical_url($permalink){ $response = wp_remote_get($permalink); if(is_wp_error($response)){ return [ 'label' => 'Canonical URL', 'status' => 'Error', 'status_class' => 'error', 'details' => '<p>' . __('Unable to check canonical URL.', 'siteseo') . '</p>' ]; } $content = wp_remote_retrieve_body($response); preg_match_all('/<link[^>]+rel=[\'"](canonical)[\'"][^>]+href=[\'"]([^\'"]+)[\'"][^>]*>/i', $content, $matches); $canonical_urls = !empty($matches[2]) ? array_unique($matches[2]) : []; $count = count($canonical_urls); $details = ''; $status = 'Warning'; $details .= '<p>'. __('A canonical URL is required by search engines to handle duplicate content.', 'siteseo') .'</p>'; if($count > 0){ $details .= '<p>' . sprintf( /* translators: %s represents the degree of severity */ _n( 'We found %s canonical URL in your source code. Below, the list:', 'We found %s canonical URLs in your source code. Below, the list:', $count, 'siteseo' ), number_format_i18n($count) ) . '</p>'; $details .= '<ul>'; foreach($canonical_urls as $link){ $details .= '<li>' . '<span class="dashicons dashicons-arrow-right"></span>' . '<a href="' . esc_url($link) . '" target="_blank">' . esc_url($link) . '</a>' . '<span class="dashicons dashicons-external"></span>' . '</li>'; } $details .= '</ul>'; if($count > 1){ $status = 'Error'; $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('You must fix this. Canonical URL duplication is bad for SEO.', 'siteseo') . '</p>'; } else{ $status = 'Good'; } } else{ if(get_post_meta(get_the_ID(), '_siteseo_robots_index', true)){ $status = 'Good'; $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>' . __('This page doesn\'t have any canonical URL because your post is set to <strong>noindex</strong>. This is normal.', 'siteseo') . '</p>'; } else{ $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('This page doesn\'t have any canonical URL.', 'siteseo') . '</p>'; } } return [ 'label' => 'Canonical URL', 'status' => $status, 'status_class' => strtolower($status), 'details' => $details ]; } static function check_word_count($content){ $word_count = str_word_count(wp_strip_all_tags($content)); $unique_words = count(array_unique(str_word_count(wp_strip_all_tags($content), 1))); $details = ''; if($word_count != 0){ $details = '<p>'. __('Word count isn\'t a direct ranking factor, but it\'s important for your content to be high-quality, relevant, and unique. To meet these criteria, your article should include a sufficient number of paragraphs to ensure adequate word count.', 'siteseo') .'</p>'; $details .= '<ul>'; /* translators: %d represents the words found */ $details .= '<li>'. sprintf(__('%d words found', 'siteseo'), $word_count) .'</li>'; /* translators: %d represents the unique words found */ $details .= '<li>'. sprintf(__('%d unique words found', 'siteseo'), $unique_words) .'</li>'; $details .= '</ul>'; } if($word_count == 0){ $status = 'Error'; $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('No content? Try adding a few more paragraphs.!', 'siteseo') . '</p>'; } elseif($word_count > 300){ $status = 'Good'; $details .= '<li><span class="dashicons dashicons-thumbs-up"></span>' . __('Your content contains over 300 words, which meets the minimum requirement for a post', 'siteseo') .'</li>'; } else{ $status = 'Error'; $details .= '<li><span class="dashicons dashicons-thumbs-down"></span>' . __('Your content is too brief. Consider adding a few more paragraphs!', 'siteseo') .'</li>'; } return [ 'label' => __('Word Count', 'siteseo'), 'status' => $status, 'status_class' => strtolower($status), 'details' => $details ]; } static function check_keywords_density($content, $keywords){ $content = strtolower(wp_strip_all_tags($content)); $keywords = array_filter(explode(',', trim($keywords))); $content_words = str_word_count($content, 1); $count_words = count($content_words); $details = ''; if(empty($keywords) || empty($content_words)){ $details .= '<p>' . __('We couldn\'t calculate the keyword density. This may be because you haven\'t added any content or your target keywords are missing from the post.', 'siteseo') . '</p>'; return [ 'label' => __('Keyword Density', 'siteseo'), 'status' => 'Error', 'status_class' => 'error', 'details' => $details ]; } // calulate $density_details = []; $all_density = []; foreach($keywords as $keyword){ $keyword_occurrence = 0; $keyword = strtolower(trim($keyword)); // If keyword has multiple words if(str_word_count($keyword) > 1){ $pattern = '/\b' . preg_quote($keyword, '/') . '\b/i'; preg_match_all($pattern, $content, $matches); $keyword_occurrence = count($matches[0]); } else { $keyword_occurrence = array_count_values($content_words)[$keyword] ?? 0; } // Calculate density as percentage $kw_density = ($keyword_occurrence * str_word_count($keyword) * 100)/$count_words; $all_density[] = number_format($kw_density, 2); $density_details[] = /* translators: %s represents the degree of severity */ sprintf( '<ul><li><span class="dashicons dashicons-arrow-right"></span>%s</li></ul>', sprintf( /* translators: %s represents a keyword density of */ esc_html__('%1$s was found %2$d times in your content, a keyword density of %3$s%%', 'siteseo'), $keyword, $keyword_occurrence, number_format($kw_density, 2) ) ); } $details .= implode('', $density_details); $details .= '<p class="description">'. sprintf( /* translators: %s represents the keywords stuffing */ __('Find out more about <a href="%s" target="_blank">keywords stuffing</a>', 'siteseo'), 'https://www.youtube.com/watch?v=Rk4qgQdp2UA' ) . '</p>'; if(empty($all_density)){ return [ 'label' => __('Keyword Density', 'siteseo'), 'status' => 'Error', 'status_class' => 'error', 'details' => $details ]; } //avg density $avg_density = array_sum($all_density)/count($all_density); $status = ($avg_density > 1) ? 'Good' : 'Warning'; return [ 'label' => __('Keyword Density', 'siteseo'), 'status' => $status, 'status_class' => strtolower($status), 'details' => $details ]; } static function check_meta_title($title, $keywords = []){ $details = ''; $status = 'Good'; $status_class = 'good'; $title = \SiteSEO\TitlesMetas::replace_variables($title); // length if(empty($title)){ $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('A custom title has not been set for this post. If the global meta title works for you, you can disregard this recommendation.', 'siteseo') . '</p>'; $status = 'Warning'; $status_class = 'warning'; } elseif(strlen($title) > 60){ $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('Your custom title is too lengthy.', 'siteseo') . '</p>'; $status = 'Warning'; $status_class = 'warning'; } elseif(strlen($title) >= 10 && strlen($title) <= 60){ $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>' . __('The length of your title is appropriate.', 'siteseo') . '</p>'; } else{ $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('Your custom title is too short.', 'siteseo') . '</p>'; $status = 'Warning'; $status_class = 'warning'; } if(!empty($keywords)){ $keyword_counts = []; foreach($keywords as $kw_name){ $kw_count = substr_count(strtolower($title), strtolower($kw_name)); if($kw_count > 0){ $keyword_counts[] = $kw_count; /* translators: %s represents the degree of severity */ $details .= '<ul><li><span class="dashicons dashicons-arrow-right"></span>'. sprintf(esc_html__('%1$s was found %2$d times.', 'siteseo'), $kw_name, $kw_count) . '</li></ul>'; } } if(!empty($keyword_counts)){ $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>'.__('The target keywords are included in the Meta Title', 'siteseo').'</p>'; } else { $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>'.__('None of your target keywords are present in the Meta Title.', 'siteseo').'</p>'; $status = $status === 'Good' ? 'Warning' : $status; $status_class = $status_class === 'good' ? 'warning' : $status_class; } } return [ 'label' => __('Meta Title', 'siteseo'), 'status' => $status, 'status_class' => $status_class, 'details' => $details ]; } static function check_meta_description($content, $meta_description = '', $keywords = []){ $details = ''; $status = 'Good'; $status_class = 'good'; $desc = !empty($meta_description) ? $meta_description : wp_trim_words($content, 20); $description = \SiteSEO\TitlesMetas::replace_variables($desc); // desc length if(empty($meta_description)){ $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('A custom meta description has not been set for this post. If the global meta description works for you, you can ignore this recommendation.', 'siteseo') . '</p>'; $status = 'Warning'; $status_class = 'warning'; } elseif(strlen($description) > 160){ $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('Your custom meta description is too lengthy', 'siteseo') .'</p>'; $status = 'Warning'; $status_class = 'warning'; } elseif(strlen($description) >= 50 && strlen($description) <= 160){ $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>'. __('The length of your meta description is appropriate.', 'siteseo').'</p>'; } else{ $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>'. __('The description has been set properly.', 'siteseo').'</p>'; } if(!empty($keywords)){ $keyword_counts = []; foreach($keywords as $kw_name){ $kw_count = substr_count(strtolower($description), strtolower($kw_name)); if($kw_count > 0){ $keyword_counts[] = $kw_count; $details .= '<li><span class="dashicons dashicons-arrow-right"></span>' . /* translators: %s represents the key word count */ sprintf(esc_html__('%1$s was found %2$d times.', 'siteseo'), $kw_name, $kw_count) . '</li>'; } } if(!empty($keyword_counts)){ $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>'. __('The target keywords are included in the Meta description.', 'siteseo') . '</p>'; } else{ $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>'. __('None of your target keywords are included in the Meta description.', 'siteseo') . '</p>'; $status = $status === 'Good' ? 'Warning' : $status; $status_class = $status_class === 'good' ? 'warning' : $status_class; } } return [ 'label' => 'Meta Description', 'status' => $status, 'status_class' => $status_class, 'details' => $details ]; } static function check_image_alt_texts($content){ $result = [ 'label' => __('Alternative texts of images', 'siteseo'), 'status' => 'Good', 'status_class' => 'good', 'details' => '' ]; if(empty($content)){ $result['status'] = 'Warning'; $result['status_class'] = 'warning'; $result['details'] = '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('No content found to analyze. Please add some content to check for images and alt texts.', 'siteseo') . '</p>'; return $result; } preg_match_all('/<img[^>]+src=[\'"]([^\'"]+)[\'"][^>]*>/i', $content, $image_matches); preg_match_all('/<img[^>]+alt=[\'"]([^\'"]+)[\'"][^>]*>/i', $content, $alt_matches); $images_count = count($image_matches[0]); $alt_text_count = count(array_filter($alt_matches[1], 'strlen')); if($images_count === 0){ $result['status'] = 'Warning'; $result['status_class'] = 'warning'; $result['details'] = '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('We couldn\'t find any images in your content. Adding media can boost your SEO.', 'siteseo') . '</p>'; return $result; } if($images_count !== $alt_text_count){ $result['status'] = ($alt_text_count > 0) ? 'Warning' : 'Error'; $result['status_class'] = strtolower($result['status']); $result['details'] = '<p><span class="dashicons dashicons-thumbs-down"></span>' . esc_html__('No alternative text has been found for these images. Alt tags are essential for SEO and accessibility. Please edit your images in the media library or using your preferred page builder, and provide alternative text.', 'siteseo') . '</p>'; if(!empty($image_matches[1])){ $result['details'] .= '<ul class="attachments">'; foreach($image_matches[1] as $index => $img){ if(empty($alt_matches[1][$index])){ $result['details'] .= '<li class="attachment"><figure>' . '<img src="' . esc_url($img) . '"/>' . '<figcaption style="word-break: break-all;">' . esc_html($img) . '</figcaption>' . '</figure></li>'; } } $result['details'] .= '</ul>'; } $result['details'] .= '<p>'. __('Please note that we scan all your source code, which means some missing alternative text for images may be found in your header, sidebar, or footer.', 'siteseo') .'</p>'; } else{ $result['details'] = '<p><span class="dashicons dashicons-thumbs-up"></span>' . __('All alternative tags have been completed. Great job!', 'siteseo') .'</p>'; } return $result; } static function analyze_outbound_links($content){ preg_match_all('/<a[^>]+href=([\'"])(?!#)([^\'"]+)[\'"][^>]*>/i', $content, $links); $outbound_links = array_filter($links[2], function($link){ return strpos($link, get_site_url()) === false; }); $total_outbound = count($outbound_links); $nofollow_count = preg_match_all('/rel=[\'"]nofollow[\'"]/', implode(' ', $links[0])); $status = $total_outbound > 0 ? 'Good' : 'Warning'; $details = ''; $details .= '<p>'. __('The internet is based on the concept of hyperlinks, so linking to different websites is completely natural. However, avoid linking to low-quality or spammy sites. If youre uncertain about a site quality, add the "nofollow" attribute to your link.', 'siteseo') .'</p>'; if($total_outbound > 0){ /* translators: %s represents the detected outbound links on page */ $details .= '<p>'.sprintf(__('We detected %s outbound links on your page. Below is the list.', 'siteseo'), $total_outbound) .'</p>'; $details .= '<ul>'; foreach($outbound_links as $link){ $details .= '<li><span class="dashicons dashicons-arrow-right"></span>'; $details .= '<a href="'.esc_url($link).'" target="_blank">'.esc_url($link).'</a></li>'; } $details .= '</ul>'; } else{ $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('This page does not contain any outbound links.', 'siteseo') . '</p>'; } return [ 'label' => __('Outbound Links', 'siteseo'), 'status' => $status, 'status_class' => strtolower($status), 'details' => $details ]; } static function analyze_internal_links($content){ preg_match_all('/<a[^>]+href=([\'"])(?!#)([^\'"]+)[\'"][^>]*>(.*?)<\/a>/i', $content, $links, PREG_SET_ORDER); $internal_links = array_filter($links, function($link) { return strpos($link[2], get_site_url()) !== false; }); $total_internal = count($internal_links); $status = $total_internal > 0 ? 'Good' : 'Warning'; $details = ''; $details .= '<p>'. __('Internal links are crucial for both SEO and user experience. Always aim to interconnect your content using meaningful and relevant anchor text.', 'siteseo') .'</p>'; if($total_internal > 0){ /* translators: %s represents the internal links pointing to page */ $details .= '<p>'. sprintf(__('We identified %s internal links pointing to this page.', 'siteseo'), $total_internal) .'</p>'; $details .= '<ul>'; foreach($internal_links as $link){ $url = $link[2]; $post_id = url_to_postid($url); $details .= '<li><span class="dashicons dashicons-arrow-right"></span>'; $details .= '<a href="'.esc_url($url) .'" target="_blank">'. esc_html($url) . '</a>'; if($post_id){ $details .= '<a class="nounderline" href="' . get_edit_post_link($post_id) . '" ' . 'title="' . /* translators: %s represents the degree of severity */ sprintf(__('edit %s', 'siteseo'), esc_html(get_the_title($post_id))) . '">' . '<span class="dashicons dashicons-edit-large"></span></a>'; } $details .= '</li>'; } $details .= '</ul>'; } else{ $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('This page has no internal links from other content. Links from archive pages are not counted as internal links because they lack contextual relevance.', 'siteseo') . '</p>'; } return [ 'label' => __('Internal Links', 'siteseo'), 'status' => $status, 'status_class' => strtolower($status), 'details' => $details ]; } static function analyze_nofollow_links($content){ preg_match_all('/<a[^>]+href=([\'"])([^\'"]+)[\'"][^>]*>(.*?)<\/a>/i', $content, $all_links, PREG_SET_ORDER); $nofollow_links = array_filter($all_links, function($link){ return preg_match('/rel=[\'"][^\'"]*nofollow[^\'"]*[\'"]/', $link[0]); }); $total_nofollow = count($nofollow_links); $status = $total_nofollow > 0 ? 'Warning' : 'Good'; $details = ''; if($total_nofollow > 0){ $details .= '<p>' . /* translators: %d represents the number nofollow attribute */ sprintf( esc_html__('We found %d links with the nofollow attribute on your page. Avoid overusing the nofollow attribute in links. Below is the list:', 'siteseo'), $total_nofollow ) . '</p>'; $details .= '<ul>'; foreach($nofollow_links as $link){ $href = $link[2]; $link_text = $link[3]; $details .= '<li>'. '<span class="dashicons dashicons-arrow-right"></span>'. '<a href="' . esc_url($href) . '" target="_blank">'.esc_html($link_text).'</a>'. '<span class="dashicons dashicons-external"></span>'. '</li>'; } $details .= '</ul>'; } else{ $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>' . __('This page does not contain any nofollow links.', 'siteseo') . '</p>'; } return [ 'label' => __('Nofollow Links', 'siteseo'), 'status' => $status, 'status_class' => strtolower($status), 'details' => $details ]; } static function check_headings($content, $keywords = []) { $details = ''; $status = 'Good'; $status_class = 'good'; if(empty(trim($content))){ return [ 'label' => 'Headings', 'status' => 'Warning', 'status_class' => 'warning', 'details' => '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('No content available to check headings.', 'siteseo') . '</p>' ]; } preg_match_all('/<h([1-6])([^>]*)>(.*?)<\/h\1>/is', $content, $heading_matches); if(empty($heading_matches[0])){ return [ 'label' => 'Headings', 'status' => 'Error', 'status_class' => 'error', 'details' => '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('No headings found in the content. Using headings is essential for both SEO and accessibility!', 'siteseo') . '</p>' ]; } $heading_counts = array_count_values($heading_matches[1]); $total_headings = count($heading_matches[0]); $h1_count = $heading_counts[1] ?? 0; if($h1_count > 0){ $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>' . /* translators: %d represents the number of h1 tags */ sprintf(esc_html__('We found %d Heading 1 (H1) tags in your content.', 'siteseo'), $h1_count+1) . '</p>'; $details .= '<p>' . __('You should avoid using more than one H1 heading in your post content. The rule is simple: each web page should have only one H1, which benefits both SEO and accessibility. Below is the list:', 'siteseo') . '</p>'; $details .= '<ul>'; foreach(array_keys($heading_matches[1], '1') as $index){ $details .= '<li><span class="dashicons dashicons-arrow-right"></span>' . wp_strip_all_tags($heading_matches[0][$index]) . '</li>'; } $details .= '</ul>'; $status = 'Warning'; $status_class = 'warning'; } foreach([2, 3] as $level){ $level_count = $heading_counts[$level] ?? 0; $details .= '<p><span class="dashicons dashicons-info"></span>' . /* translators: %d represents the heading */ sprintf(__('Found %1$d H%2$d heading(s)', 'siteseo'), $level_count, $level) . '</p>'; if($level_count > 0){ $details .= '<ul>'; foreach(array_keys($heading_matches[1], (string)$level) as $index){ $details .= '<li><span class="dashicons dashicons-arrow-right"></span>'. wp_strip_all_tags($heading_matches[0][$index]) .'</li>'; } $details .= '</ul>'; } if(!empty($keywords) && $level_count > 0){ $keyword_found = false; $keyword_details = '<ul>'; foreach($keywords as $kw_name){ $kw_count = 0; foreach(array_keys($heading_matches[1], (string)$level) as $index){ $kw_count += substr_count( strtolower(wp_strip_all_tags($heading_matches[0][$index])), strtolower($kw_name) ); } if($kw_count > 0){ $keyword_found = true; $keyword_details .= '<li><span class="dashicons dashicons-arrow-right"></span>' . /* translators: %s represents the degree of severity */ sprintf(esc_html__('%1$s was found %2$d times.', 'siteseo'), $kw_name, $kw_count) . '</li>'; } } $keyword_details .= '</ul>'; if($keyword_found){ $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>' . /* translators: %s represents the target keywords */ sprintf(__('Target keywords were found in Heading %1$d (H%2$d).', 'siteseo'), $level, $level) . '</p>' . $keyword_details; } else{ $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>' . /* translators: %d represents the target keywords */ sprintf(__('None of your target keywords were found in Heading %1$d (H%2$d).', 'siteseo'), $level, $level) . '</p>'; if($status === 'Good'){ $status = 'Warning'; $status_class = 'warning'; } } } } return [ 'label' => 'Headings', 'status' => $status, 'status_class' => $status_class, 'details' => $details ]; } static function check_social_meta_tags($post = null){ if(!$post){ $post = get_queried_object(); } $details = ''; $status = 'Good'; $status_class = 'good'; $og_titles = get_post_meta($post->ID, '_siteseo_social_fb_title', true); $og_title = $og_titles ? $og_titles : ''; if(empty($og_title)){ $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>'. __('Your Open Graph Title tag has not been set!', 'siteseo') .'</p>'; $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>'. __('Your Open Graph Title is missing!', 'siteseo') .'</p>'; $status = 'Error'; $status_class = 'error'; } else{ $details .= '<h4>'. __('Open Graph Title', 'siteseo') . '</h4>'; $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>'. __('An Open Graph Title tag was found in your source code.', 'siteseo') . '</p>'; $details .= '<ul><li><span class="dashicons dashicons-arrow-right"></span>' . esc_html($og_title) . '</li></ul>'; } $og_descriptions = get_post_meta($post->ID, '_siteseo_social_fb_desc', true); $og_description = $og_descriptions ? $og_descriptions : ''; if(empty($og_description)){ $details .= '<h4>'. __('Open Graph Description', 'siteseo') .'</h4>'; $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>'. __('Your Open Graph Description has not been set!','siteseo').'</p>'; $status = $status === 'Good' ? 'Warning' : $status; $status_class = $status_class === 'good' ? 'warning' : $status_class; } else { $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>' . /* translators: %s represents the og description */ sprintf(esc_html__('We found %s og:description in your content.', 'siteseo'), $og_descriptions) . '</p>'; } // OG Check $og_images = get_post_meta($post->ID, '_siteseo_social_fb_img', true); $og_image = $og_images ? $og_images : ''; if(empty($og_image)){ $details .= '<h4>'. __('Open Graph Image', 'siteseo') .'</h4>'; $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>'. __('Your Open Graph Image has not been set!' ,'siteseo') .'</p>'; $status = $status === 'Good' ? 'Warning' : $status; $status_class = $status_class === 'good' ? 'warning' : $status_class; } else{ /* translators: %s represents the og images */ $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>'. sprintf(esc_html__('We found %s og:image in your content.', 'siteseo'), $og_images) . '</p>'; } // Open Graph $og_site_name = get_bloginfo('name'); if(empty($og_site_name)){ $details .= '<h4>'. __('Open Graph Site Name', 'siteseo') .'</h4>'; $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>'. __('Your Open Graph Site Name has not been set!' ,'siteseo') .'</p>'; $status = $status === 'Good' ? 'Warning' : $status; $status_class = ($status_class === 'good') ? 'warning' : $status_class; } // Twitter $twitter_title = get_post_meta($post->ID, '_siteseo_social_twitter_title', true); if(empty($twitter_title)){ $details .= '<h4>'. __('X Title', 'siteseo').'</h4>'; $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>'. __('Your X Title has not been set!', 'siteseo').'</p>'; $status = $status === 'Good' ? 'Warning' : $status; $status_class = $status_class === 'good' ? 'warning' : $status_class; } $twitter_description = get_post_meta($post->ID, '_siteseo_social_twitter_desc', true); if(empty($twitter_description)){ $details .= '<h4>'. __('X Description','siteseo').'</h4>'; $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>'. __('Your X Description has not been set!','siteseo') .'</p>'; $status = $status === 'Good' ? 'Warning' : $status; $status_class = $status_class === 'good' ? 'warning' : $status_class; } $twitter_image = get_post_meta($post->ID, '_siteseo_social_twitter_img', true); if(empty($twitter_image)){ $details .= '<h4>'. __('X Image', 'siteseo') .'</h4>'; $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>'. __('Your X Image has not been set!', 'siteseo').'</p>'; $status = $status === 'Good' ? 'Warning' : $status; $status_class = ($status_class === 'good') ? 'warning' : $status_class; } return [ 'label' => __('Social Meta Tags', 'siteseo'), 'status' => $status, 'status_class' => $status_class, 'details' => $details ]; } static function check_structured_data($post){ $schema_type = get_post_meta($post->ID, '_siteseo_structured_data_type', true); $status = !empty($schema_type) ? 'Good' : 'Warning'; return [ 'label' => 'Structured Data', 'status' => $status, 'status_class' => strtolower($status), 'details' => !empty($schema_type) ? 'Schema Type: '.$schema_type : 'No schema defined' ]; } static function check_keywords_in_permalink($permalink, $keywords){ $keywords = array_filter(explode(',', trim($keywords))); $permalink = str_replace('-', ' ', strtolower(basename($permalink))); $content_words = str_word_count($permalink, 1); $count_words = count($content_words); $kw_density = []; $matching_keywords = []; foreach($keywords as $keyword){ $keyword_occurrence = 0; $keyword = strtolower(trim($keyword)); // If keyword has multiple words if(str_word_count($keyword) > 1){ $pattern = '/\b' . preg_quote($keyword, '/') . '\b/i'; preg_match_all($pattern, $permalink, $matches); $keyword_occurrence = count($matches[0]); } else { $keyword_occurrence = array_count_values($content_words)[$keyword] ?? 0; } // Calculate density as percentage $kw_density[] = ($keyword_occurrence * str_word_count($keyword) * 100)/$count_words; if(!empty($kw_density)){ $matching_keywords[] = $keyword; break; } } $status = !empty($kw_density) ? 'Good' : 'Error'; $details = ''; if($status === 'Good'){ $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>'. __('Great! One of your target keywords is included in your permalink.', 'siteseo') .'</p>'; $details .= '<ul><li><span class="dashicons dashicons-arrow-right"></span>' . implode(', ', $matching_keywords) . '</li></ul>'; } elseif($permalink === get_home_url() || $permalink === home_url()){ $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>'. __('This is your homepage, so this check doesn\'t apply as there is no slug.', 'siteseo') . '</p>'; } else{ $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>'. __('You should include one of your target keywords in your permalink.', 'siteseo') . '</p>'; } return [ 'label' => __('Keywords in Permalink', 'siteseo'), 'status' => $status, 'status_class' => strtolower($status), 'details' => $details ]; } static function check_meta_robots($post){ $noindex = get_post_meta($post->ID, '_siteseo_robots_index', true); $nofollow = get_post_meta($post->ID, '_siteseo_robots_follow', true); $noimageindex = get_post_meta($post->ID, '_siteseo_robots_imageindex', true); $noarchive = get_post_meta($post->ID, '_siteseo_robots_archive', true); $nosnippet = get_post_meta($post->ID, '_siteseo_robots_snippet', true); $count_meta_robots = 0; $details = ''; $meta_robots_checks = [ 'noindex' => $noindex, 'nofollow' => $nofollow, 'noimageindex' => $noimageindex, 'noarchive' => $noarchive, 'nosnippet' => $nosnippet, ]; foreach($meta_robots_checks as $robot => $value){ if($value !== 'yes'){ continue; } $count_meta_robots++; switch($robot){ case 'noindex': $details .= '<p data-robots="noindex"><span class="dashicons dashicons-thumbs-down"></span>' . __('<strong>noindex</strong> is enabled! Search engines cannot index this page', 'siteseo') . '</p>'; break; case 'nofollow': $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('<strong>nofollow</strong> is on! Search engines can\'t follow your links on this page.', 'siteseo') . '</p>'; break; case 'noimageindex': $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('<strong>nofollow</strong> is enabled! Search engines cannot follow the links on this page.', 'siteseo').'</p>'; break; case 'noarchive': $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('<strong>noarchive</strong> is enabled! Search engines will not cache your page.', 'siteseo') .'</p>'; break; case 'nosnippet': $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>' . __('<strong>nosnippet</strong> is enabled! Search engines will not display a snippet of this page in the search results.', 'siteseo') .'</p>'; break; } } if($count_meta_robots > 0){ /* translators: %s represents the robots tags */ $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>'. sprintf(esc_html__('We found %s meta robots tags on your page. There may be an issue with your theme!', 'siteseo'), $count_meta_robots) .'</p>'; } if($noindex !== 'yes'){ $details .= '<p data-robots="index"><span class="dashicons dashicons-thumbs-up"></span>'. __('<strong>noindex</strong> is disabled. Search engines will index this page.', 'siteseo') .'</p>'; } if($nofollow !== 'yes'){ $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>'. __('<strong>nofollow</strong> is disabled. Search engines will follow links on this page.', 'siteseo') .'</p>'; } if($noimageindex !== 'yes'){ $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>'. __('<strong>noimageindex</strong> is disabled. Google will index the images on this page.', 'siteseo') .'</p>'; } if($noarchive !== 'yes'){ $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>'. __('<strong>noarchive</strong> is disabled. Search engines will probably cache your page.', 'siteseo') .'</p>'; } if($nosnippet !== 'yes'){ $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>'. __('<strong>nosnippet</strong> is disabled. Search engines will display a snippet of this page in search results.', 'siteseo') .'</p>'; } if($count_meta_robots === 0){ $details .= '<p><span class="dashicons dashicons-thumbs-up"></span>' . __('We found no meta robots on this page. It means, your page is index,follow. Search engines will index it, and follow links. ', 'siteseo') . '</p>'; } $status = ($count_meta_robots === 0) ? 'Good' : (($count_meta_robots <= 2) ? 'Warning' : 'Error'); return [ 'label' => 'Meta Robots', 'status' => $status, 'status_class' => strtolower($status), 'details' => $details ]; } static function check_last_modified_date($post){ $last_modified = get_the_modified_date('Y-m-d', $post); $days_since_modified = round((time() - strtotime($last_modified)) / (60 * 60 * 24)); $status = $days_since_modified < 30 ? 'Good' : ($days_since_modified < 90 ? 'Warning' : 'Error'); $details = ''; if($status == 'Error'){ $details .= '<p><span class="dashicons dashicons-thumbs-down"></span>'. __('This post is a little old!', 'siteseo') .'</p>'; } if($days_since_modified < 365){ $details .='<p><span class="dashicons dashicons-thumbs-up"></span>'.__('The last modified date of this article is less than 1 year. Cool', 'siteseo') .'</p>'; } $details .= '<p>'.__('Search engines love fresh content. Update regularly your articles without entirely rewriting your content and give them a boost in search rankings. SiteSEO takes care of the technical part', 'siteseo').'</p>'; return [ 'label' => 'Last Modified Date', 'status' => $status, 'status_class' => strtolower($status), 'details' => $details ]; } static function analyze_readability($post, $title){ $data = []; // These are power words specifically for headlines. // These are not hard rules, but they are perceived to have a higher CTR if used in the heading. $power_words = ['exclusive', 'revealed', 'secrets', 'ultimate', 'proven', 'unleashed', 'discover', 'breakthrough', 'shocking', 'insider', 'elite', 'uncovered', 'powerful', 'guaranteed', 'transformative', 'instant', 'revolutionary', 'unbelievable', 'top', 'best', 'must-have', 'limited', 'rare', 'unique', 'unprecedented', 'premium', 'urgent', 'today', 'now', 'latest', 'new', 'free', 'bonus', 'offer', 'sensational', 'astonishing', 'incredible', 'jaw-dropping', 'unmissable', 'essential', 'critical', 'vital', 'pivotal', 'game-changer', 'spotlight', 'trending', 'hot', 'popular', 'featured', 'special', 'limited-time', 'hurry', 'last chance', 'countdown']; if(!empty($title)){ // Checking power words. $title_words = explode(' ', strtolower($title)); $present_power_words = array_intersect($title_words, $power_words); if(!empty($present_power_words)){ $data['power_words'] = $present_power_words; } // Checking number in the Title if(preg_match('/\s?\d+\s/', preg_quote($title), $number)){ $data['number_found'] = $number[0]; } } // We are checking paragarph length too. if(!isset($data['paragraph_length'])){ $data['paragraph_length'] = 0; } if(!empty($post)){ preg_match_all('/<p>.*<\/p>/U', $post, $paragraphs); foreach($paragraphs[0] as $paragraph){ $paragraph = normalize_whitespace(wp_strip_all_tags($paragraph)); $data['paragraph_length'] += substr_count($paragraph, ' ') + 1; // updating paragraph length self::analyse_passive_voice($paragraph, $data); } } return $data; } static function analyse_passive_voice($paragraph, &$data){ if(empty($paragraph)){ return; } $sentences = explode('.', $paragraph); $passive_count = 0; if(!isset($data['passive_voice']['passive_sentences'])){ $data['passive_voice']['passive_sentences'] = 0; } if(!isset($data['passive_voice']['total_sentences'])){ $data['passive_voice']['total_sentences'] = 0; } if(empty($sentences)){ return; } foreach($sentences as $sentence){ if(empty($sentence)){ continue; } $sentence = normalize_whitespace($sentence); $is_passive = self::sentence_is_passive($sentence); if($is_passive == true){ $passive_count++; } } $data['passive_voice']['passive_sentences'] += $passive_count; $data['passive_voice']['total_sentences'] += count($sentences); } static function sentence_is_passive($sentence){ $be_words = ['am', 'is', 'are', 'was', 'were', 'be', 'being', 'been']; // TODO: We can check if "en" ending words are a comman pattern too, then we will remove the en ending words too from here. $past_particles = ['gone' ,'done' ,'seen' ,'taken' ,'eaten' ,'written' ,'driven' ,'spoken' ,'broken' ,'chosen' ,'fallen' ,'forgotten' ,'forgiven' ,'hidden' ,'known' ,'grown' ,'drawn' ,'flown' ,'thrown' ,'blown' ,'shown' ,'worn' ,'sworn' ,'torn' ,'woken' ,'begun' ,'sung' ,'run' ,'swum' ,'shaken' ,'given' ,'proven' ,'ridden' ,'risen' ,'shone' ,'shot' ,'fought' ,'thought' ,'bought' ,'brought' ,'caught' ,'taught' ,'built' ,'felt' ,'kept' ,'slept' ,'left' ,'lost' ,'meant' ,'met' ,'read' ,'sold' ,'sent' ,'spent' ,'stood' ,'understood' ,'won' ,'held' ,'told' ,'heard' ,'paid' ,'laid' ,'said' ,'found' ,'made' ,'learned' ,'put']; if(empty($sentence)){ return false; } $words = explode(' ', $sentence); for($i = 0; $i < count($words); $i++){ // Checking if we have a be word if(!in_array($words[$i], $be_words)){ continue; } // If be word is there then need to check if next one is past particle with mostly ends with ed. if(strpos($words[$i+1], 'ed') != strlen($words[$i+1]) - 2){ if(!in_array($words[$i+1], $past_particles)){ continue; } } return true; } return false; } } imageseo.php 0000644 00000006420 15100371032 0007040 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class ImageSeo{ static function init(){ global $siteseo; if(empty($siteseo->setting_enabled['toggle-advanced'])){ return; // toggle disable } if(!empty($siteseo->advanced_settings['advanced_attachments'])){ add_action('template_redirect', '\SiteSEO\ImageSeo::redirect_attachment_to_parent'); } if(!empty($siteseo->advanced_settings['advanced_clean_filename'])){ add_filter('sanitize_file_name', '\SiteSEO\ImageSeo::clean_media_filename', 10, 1); } if(!empty($siteseo->advanced_settings['advanced_image_auto_alt_editor']) || !empty($siteseo->advanced_settings['advanced_image_auto_caption_editor']) || !empty($siteseo->advanced_settings['advanced_image_auto_desc_editor']) || !empty($siteseo->advanced_settings['advanced_image_auto_title_editor']) ){ add_action('add_attachment', '\SiteSEO\ImageSeo::set_image_content'); } } static function set_image_content($attachment_id){ global $siteseo; if(!wp_attachment_is_image($attachment_id)){ return; } $attachment = get_post($attachment_id); $file_name = pathinfo($attachment->guid, PATHINFO_FILENAME); $file_name = sanitize_file_name($file_name); $file_name = ucwords(str_replace(['-', '_'], ' ', $file_name)); // WooCommerce product img $is_woocommerce_product_image = false; $product_title = ''; $parent_id = $attachment->post_parent; if(!empty($parent_id)){ $parent_post = get_post($parent_id); if(!empty($parent_post) && $parent_post->post_type === 'product'){ $is_woocommerce_product_image = true; $product_title = get_the_title($parent_id); } } $file_name = $is_woocommerce_product_image ? $product_title : $file_name; // Adding alt text to the image if(!empty($siteseo->advanced_settings['advanced_image_auto_alt_editor'])){ update_post_meta($attachment_id, '_wp_attachment_image_alt', $file_name); } $options = []; $options['ID'] = $attachment_id; // Adding Title to the image if(!empty($siteseo->advanced_settings['advanced_image_auto_title_editor'])){ $options['post_title'] = $file_name; } // Adding Img Caption if(!empty($siteseo->advanced_settings['advanced_image_auto_caption_editor'])){ $options['post_content'] = $file_name; } // Adding Img Caption if(!empty($siteseo->advanced_settings['advanced_image_auto_desc_editor'])){ $options['post_excerpt'] = $file_name; } if(count($options) > 1){ wp_update_post($options); } } static function clean_media_filename($filename){ $filename = strtolower($filename); $filename = remove_accents($filename); $filename = preg_replace('/[^a-z0-9-.]+/', '-', $filename); $filename = trim($filename, '-.'); $file_info = pathinfo($filename); $name = $file_info['filename']; $extension = isset($file_info['extension']) ? '.' . $file_info['extension'] : ''; $filename = $name . $extension; return $filename; } static function redirect_attachment_to_parent(){ if(is_attachment()){ $attachment_id = get_queried_object_id(); $parent_id = wp_get_post_parent_id($attachment_id); if($parent_id){ wp_redirect(get_permalink($parent_id)); }else{ wp_redirect(home_url()); } exit; } } } googleanalytics.php 0000644 00000062621 15100371032 0010440 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class GoogleAnalytics{ static function ga_render(){ global $siteseo; if(empty($siteseo->setting_enabled['toggle-google-analytics'])){ return; } if(!empty($siteseo->analaytics_settings['google_analytics_clarity_enable']) && !empty($siteseo->analaytics_settings['google_analytics_clarity_project_id'])){ add_action('wp_head', '\SiteSEO\GoogleAnalytics::microsoft_clarity'); } if(!empty($siteseo->analaytics_settings['google_analytics_enable']) && !empty($siteseo->analaytics_settings['google_analytics_ga4'])){ add_action('wp_head', '\SiteSEO\GoogleAnalytics::ga_tracking_code'); } if(!empty($siteseo->analaytics_settings['google_analytics_enable'])){ add_action('wp_footer', '\SiteSEO\GoogleAnalytics::tracking'); } if(!empty($siteseo->analaytics_settings['google_analytics_link_tracking_enable'])){ add_action('wp_footer', '\SiteSEO\GoogleAnalytics::add_tracking_script'); } if(!empty($siteseo->analaytics_settings['google_analytics_matomo_enable']) && !empty($siteseo->analaytics_settings['google_analytics_matomo_site_id'])){ add_action('wp_footer', '\SiteSEO\GoogleAnalytics::matomo_tracking_code'); } if(!empty($siteseo->analaytics_settings['google_analytics_other_tracking'])){ add_action('wp_head', '\SiteSEO\GoogleAnalytics::add_custom_head_script'); } if(!empty($siteseo->analaytics_settings['google_analytics_other_tracking_body'])){ add_action('wp_body_open', '\SiteSEO\GoogleAnalytics::add_custom_body_script'); } if(!empty($siteseo->analaytics_settings['google_analytics_other_tracking_footer'])){ add_action('wp_footer', '\SiteSEO\GoogleAnalytics::add_custom_footer_script'); } if(!empty($siteseo->analaytics_settings['google_analytics_hook'])){ $load_cookies_bar = $siteseo->analaytics_settings['google_analytics_hook']; add_action($load_cookies_bar, '\SiteSEO\GoogleAnalytics::render_cookie_bar'); } } static function render_cookie_bar(){ global $siteseo; if(empty($siteseo->setting_enabled['toggle-google-analytics']) || empty($siteseo->analaytics_settings['google_analytics_disable'])){ return; } // load setting $auto_accept_cookies = !empty($siteseo->analaytics_settings['google_analytics_half_disable']) ? $siteseo->analaytics_settings['google_analytics_half_disable'] : ''; $cookies_msg = !empty($siteseo->analaytics_settings['google_analytics_opt_out_msg']) ? $siteseo->analaytics_settings['google_analytics_opt_out_msg'] : 'By visiting our site, you agree to our privacy policy regarding cookies, tracking statistics, etc.'; $accept_btn_msg = !empty($siteseo->analaytics_settings['google_analytics_opt_out_msg_ok']) ? $siteseo->analaytics_settings['google_analytics_opt_out_msg_ok'] : 'Accept'; $close_btn_msg = !empty($siteseo->analaytics_settings['google_analytics_opt_out_msg_close']) ? $siteseo->analaytics_settings['google_analytics_opt_out_msg_close'] : 'X'; $edit_btn_msg = !empty($siteseo->analaytics_settings['google_analytics_opt_out_msg_edit']) ? $siteseo->analaytics_settings['google_analytics_opt_out_msg_edit'] : 'Manage cookies'; $cookies_expir = !empty($siteseo->analaytics_settings['google_analytics_cb_exp_date']) ? $siteseo->analaytics_settings['google_analytics_cb_exp_date'] : ''; $bar_postion = !empty($siteseo->analaytics_settings['google_analytics_cb_pos']) ? $siteseo->analaytics_settings['google_analytics_cb_pos'] : '' ; $bar_width = !empty($siteseo->analaytics_settings['google_analytics_cb_width']) ? $siteseo->analaytics_settings['google_analytics_cb_width'] : ''; $display_backrop = !empty($siteseo->analaytics_settings['google_analytics_cb_backdrop']) ?? ''; // colors load $backdrop_bg = !empty($siteseo->analaytics_settings['google_analytics_cb_backdrop_bg']) ? $siteseo->analaytics_settings['google_analytics_cb_backdrop_bg'] : ''; $cookiebar_bg = !empty($siteseo->analaytics_settings['google_analytics_cb_bg']) ? $siteseo->analaytics_settings['google_analytics_cb_bg'] : '#ffffff'; $cookiebar_bg_txt = !empty($siteseo->analaytics_settings['google_analytics_cb_txt_col']) ? $siteseo->analaytics_settings['google_analytics_cb_txt_col'] : '#000000'; $cookiesbar_bg_lk = !empty($siteseo->analaytics_settings['google_analytics_cb_lk_col']) ? $siteseo->analaytics_settings['google_analytics_cb_lk_col'] : '#0073aa'; $primary_btn_bg = !empty($siteseo->analaytics_settings['google_analytics_cb_btn_bg']) ? $siteseo->analaytics_settings['google_analytics_cb_btn_bg'] : '#0073aa'; $primary_btn_bg_hov = !empty($siteseo->analaytics_settings['google_analytics_cb_btn_bg']) ? $siteseo->analaytics_settings['google_analytics_cb_btn_bg'] : '#ffffff'; $primary_btn_txt = !empty($siteseo->analaytics_settings['google_analytics_cb_btn_col']) ? $siteseo->analaytics_settings['google_analytics_cb_btn_col'] : '#005177'; $primary_btn_txt_hov = !empty($siteseo->analaytics_settings['google_analytics_cb_btn_col']) ? $siteseo->analaytics_settings['google_analytics_cb_btn_col'] : '#ffffff'; $sec_btn_bg = !empty($siteseo->analaytics_settings['google_analytics_cb_btn_sec_bg']) ? $siteseo->analaytics_settings['google_analytics_cb_btn_sec_bg'] : '#cccccc'; $sec_btn_bg_txt = !empty($siteseo->analaytics_settings['google_analytics_cb_btn_sec_col']) ? $siteseo->analaytics_settings['google_analytics_cb_btn_sec_col'] : '#000000'; $sec_btn_bg_hov = !empty($siteseo->analaytics_settings['google_analytics_cb_btn_sec_bg_hov']) ? $siteseo->analaytics_settings['google_analytics_cb_btn_sec_bg_hov'] : '#aaaaaa'; $sec_btn_txt_hov = !empty($siteseo->analaytics_settings['google_analytics_cb_btn_sec_col_hov']) ? $siteseo->analaytics_settings['google_analytics_cb_btn_sec_col_hov'] : '#000000'; //position $position_class = ''; $backdrop = false; switch(strtolower($bar_postion)){ case 'middle': $position_class = 'siteseo-cookie-bar-middle'; $backdrop = true; break; case 'top': $position_class = 'siteseo-cookie-bar-top'; $backdrop = false; break; default: $position_class = 'siteseo-cookie-bar-bottom'; $backdrop = false; } /* Translators: %s is the background color */ $bar_styles = sprintf( 'background-color: %s; color: %s;', esc_attr($cookiebar_bg), esc_attr($cookiebar_bg_txt) ); $backdrop_html = ''; if(!empty($display_backrop) && $backdrop){ $backdrop_html = '<div id="siteseo-cookie-bar-backdrop" style="background-color:'.esc_attr($backdrop_bg).'" class="siteseo-cookie-bar-backdrop"></div>'; } $css = '<style> #siteseo-cookie-bar-accept{ --primary-btn-bg: '.esc_attr($primary_btn_bg).'; --primary-btn-text: '.esc_attr($primary_btn_txt).'; --primary-btn-hover-bg: '.esc_attr($primary_btn_bg_hov).'; --primary-btn-hover-text: '.esc_attr($primary_btn_txt_hov).'; } #siteseo-cookie-bar-close{ --secondary-btn-bg: '.esc_attr($sec_btn_bg).'; --secondary-btn-text: '.esc_attr($sec_btn_bg_txt).'; --secondary-btn-hover-bg: '.esc_attr($sec_btn_bg_hov).'; --secondary-btn-hover-text: '.esc_attr($sec_btn_txt_hov).'; } </style>'; $html = $backdrop_html; $html .= '<div id="siteseo-cookie-bar" class="siteseo-cookie-bar '.esc_attr($position_class).'" style="'.esc_attr($bar_styles).'" data-half-disable="'.esc_attr($auto_accept_cookies).'"> <div class="siteseo-cookie-bar-content"> <span>'.wp_kses_post($cookies_msg).'</span> <div class="siteseo-cookie-bar-buttons"> <button id="siteseo-cookie-bar-accept" class="siteseo-cookie-bar-button siteseo-cookie-bar-primary-btn" style="background-color: '.esc_attr($primary_btn_bg).'; color: '.esc_attr($primary_btn_txt).'"> '.esc_html($accept_btn_msg).' </button> <button id="siteseo-cookie-bar-close" class="siteseo-cookie-bar-button siteseo-cookie-bar-secondary-btn" style="background-color: '.esc_attr($sec_btn_bg).'; color: '.esc_attr($sec_btn_bg_txt).'"> '.esc_html($close_btn_msg).' </button> </div> </div> </div> <button id="siteseo-cookie-bar-manage-btn" class="siteseo-cookie-bar-button siteseo-cookie-bar-primary-btn" style="background-color: '.$primary_btn_bg.'; color: '.esc_attr($primary_btn_txt).'"> '.esc_html($edit_btn_msg).' </button>'; echo wp_kses_post($html); } static function update_src_tag($tag, $handle, $src){ global $siteseo; $tracking_handles = [ 'siteseo-gtag', 'siteseo-matomo-tracking', 'siteseo-microsoft-clarity', 'siteseo-microsoft-clarity-js-after', 'siteseo-ga-tracking' ]; if(!in_array($handle, $tracking_handles)){ return $tag; } if(!empty($siteseo->analaytics_settings['google_analytics_disable']) && !isset($_COOKIE['siteseo-user-consent-accept']) && !isset($_COOKIE['siteseo-user-consent-close'])){ $tag = str_replace(' src=', ' data-src-siteseo=', $tag); } return $tag; } static function process_script_src($scripts){ global $siteseo; if(!empty($siteseo->analaytics_settings['google_analytics_disable']) && !isset($_COOKIE['siteseo-user-consent-accept']) && !isset($_COOKIE['siteseo-user-consent-close'])){ $scripts = preg_replace('/(<script[^>]*) src=(["\'])(.*?)\\2/i', '$1 data-src-siteseo=$2$3$2', $scripts); } return $scripts; } static function add_custom_head_script(){ global $siteseo; $scripts = $siteseo->analaytics_settings['google_analytics_other_tracking']; $scripts = self::process_script_src($scripts); echo wp_kses($scripts, [ 'script' => [ 'async' => [], 'src' => [], 'data-src-siteseo' => [], 'type' => [] ] ]); } static function add_custom_body_script(){ global $siteseo; $scripts = $siteseo->analaytics_settings['google_analytics_other_tracking_body']; $scripts = self::process_script_src($scripts); echo wp_kses($scripts, [ 'script' => [ 'async' => [], 'src' => [], 'data-src-siteseo' => [], 'type' => [] ] ]); } static function add_custom_footer_script(){ global $siteseo; $scripts = $siteseo->analaytics_settings['google_analytics_other_tracking_footer']; $scripts = self::process_script_src($scripts); echo wp_kses($scripts, [ 'script' => [ 'async' => [], 'src' => [], 'data-src-siteseo' => [], 'type' => [] ] ]); } static function exclude_user_tracking(){ global $siteseo; if(!is_user_logged_in()){ return false; } $current_user = wp_get_current_user(); if(!$current_user){ return false; } $excluded_roles = isset($siteseo->analaytics_settings['google_analytics_roles']) ? $siteseo->analaytics_settings['google_analytics_roles'] : []; if(empty($excluded_roles)){ return false; } foreach($current_user->roles as $user_role){ if(isset($excluded_roles[$user_role])){ return true; } } return false; } static function custom_dimensions(){ global $siteseo; $dimensions = []; $settings = $siteseo->analaytics_settings; // Track Authors if(!empty($settings['track_authors']) && $settings['track_authors'] !== 'none'){ if(is_singular()){ $author_id = get_post_field('post_author', get_the_ID()); $author_name = get_the_author_meta('display_name', $author_id); $dimensions[$settings['track_authors']] = $author_name; } } // Track Categories if(!empty($settings['track_categories']) && $settings['track_categories'] !== 'none'){ if(is_singular()){ $categories = get_the_category(); if(!empty($categories)){ $category_names = array_map(function($cat){ return $cat->name; }, $categories); $dimensions[$settings['track_categories']] = implode(', ', $category_names); } } } // Track Tags if(!empty($settings['track_tags']) && $settings['track_tags'] !== 'none'){ if(is_singular()){ $tags = get_the_tags(); if(!empty($tags)){ $tag_names = array_map(function($tag){ return $tag->name; }, $tags); $dimensions[$settings['track_tags']] = implode(', ', $tag_names); } } } // Track Post Types if(!empty($settings['track_post_types']) && $settings['track_post_types'] !== 'none'){ if(is_singular()){ $dimensions[$settings['track_post_types']] = get_post_type(); } } // Track Logged In Users if(!empty($settings['track_user']) && $settings['track_user'] !== 'none'){ if(is_user_logged_in()){ $current_user = wp_get_current_user(); $dimensions[$settings['track_user']] = $current_user->roles[0]; } } return $dimensions; } static function matomo_tracking_code(){ global $siteseo; if(self::exclude_user_tracking()){ return; } $settings = $siteseo->analaytics_settings; $tracking_url = !empty($settings['google_analytics_matomo_id']) ? $settings['google_analytics_matomo_id'] : ''; $site_id = !empty($settings['google_analytics_matomo_site_id']) ? $settings['google_analytics_matomo_site_id'] : ''; $cross_domain = !empty($settings['google_analytics_matomo_cross_domain']) ? $settings['google_analytics_matomo_cross_domain'] : ''; $do_not_track = !empty($settings['google_analytics_matomo_dnt']) ? $settings['google_analytics_matomo_dnt'] : ''; $disable_cookies = !empty($settings['google_analytics_matomo_no_cookies']) ? $settings['google_analytics_matomo_no_cookies'] : ''; $disable_heatmaps = !empty($settings['google_analytics_matomo_no_heatmaps']) ? $settings['google_analytics_matomo_no_heatmaps'] : ''; $track_subdomains = !empty($settings['google_analytics_matomo_subdomains']) ? $settings['google_analytics_matomo_subdomains'] : ''; $track_js_disabled = !empty($settings['google_analytics_matomo_no_js']) ? $settings['google_analytics_matomo_no_js'] : ''; wp_register_script('siteseo-matomo-tracking', false, [], null, [ 'strategy' => true, 'in_footer' => true, ]); wp_enqueue_script('siteseo-matomo-tracking'); add_filter('script_loader_tag', '\SiteSEO\GoogleAnalytics::update_src_tag', 10, 3); wp_add_inline_script('siteseo-matomo-tracking', "var _paq = _paq || []; _paq.push(['setSiteId', '".esc_html($site_id)."']); _paq.push(['setTrackerUrl', '".esc_html($tracking_url)."']); if(".esc_html($cross_domain).") _paq.push(['enableCrossDomainLinking']); if(".esc_html($do_not_track).") _paq.push(['setDoNotTrack', true]); if(".esc_html($disable_cookies).") _paq.push(['disableCookies']); if(".esc_html($disable_heatmaps).") _paq.push(['disableAllHeatmaps']); if(".esc_html($track_subdomains).") _paq.push(['setDocumentTitle', document.domain + '/' + document.title]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function(){ var u=\"".esc_html($tracking_url)."\"; _paq.push(['setTrackerUrl', u + 'matomo.php']); _paq.push(['setSiteId', '".esc_html($site_id)."']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })();"); if($track_js_disabled){ echo '<noscript><img src="'.esc_url($tracking_url.'/matomo.php?idsite='.$site_id.'&rec=1').'" style="border:0" alt="" /></noscript>'; } } static function add_tracking_script(){ global $siteseo; if(self::exclude_user_tracking()){ return; } echo '<script> document.addEventListener("DOMContentLoaded", function() {'; if(!empty($siteseo->analaytics_settings['google_analytics_link_tracking_enable'])){ echo 'document.querySelectorAll("a").forEach(function(link){ if(link.hostname !== location.hostname){ link.addEventListener("click", function(){ gtag("event", "click", { "event_category": "External Link", "event_label": link.href }); }); } });'; } if(!empty($siteseo->analaytics_settings['google_analytics_download_tracking_enable']) && !empty($siteseo->analaytics_settings['google_analytics_download_tracking'])) { $fileExtensions = preg_replace('/\s+/', '', $siteseo->analaytics_settings['google_analytics_download_tracking']); $fileExtensionsPattern = str_replace('|', '|\\.', $fileExtensions); echo 'document.querySelectorAll("a[href$=\'.' .esc_js(str_replace('|', '\'], a[href$=\'.', $fileExtensions)) . '\']").forEach(function(link) { link.addEventListener("click", function() { gtag("event", "download", { "event_category": "Download", "event_label": link.href }); }); });'; } if(!empty($siteseo->analaytics_settings['google_analytics_affiliate_tracking_enable']) && ! empty($options['google_analytics_affiliate_tracking'])){ $keywords = wp_json_encode( explode( ',', $options['google_analytics_affiliate_tracking'])); echo 'const keywords = '.esc_attr($keywords).'; document.querySelectorAll("a").forEach(function(link){ keywords.forEach(function(keyword){ if(link.href.includes(keyword.trim())){ link.addEventListener("click", function(){ gtag("event", "click", { "event_category": "Affiliate/Outbound Link", "event_label": link.href }); }); } }); });'; } if(!empty($siteseo->analaytics_settings['google_analytics_phone_tracking'])){ echo 'document.querySelectorAll("a[href^=\'tel:\']").forEach(function(link){ link.addEventListener("click", function() { gtag("event", "click", { "event_category": "Telephone Link", "event_label": link.href }); }); });'; } echo '}); </script>'; } static function tracking(){ global $siteseo; if(self::exclude_user_tracking()){ return; } $settings = $siteseo->analaytics_settings; $ga_id = !empty($settings['google_analytics_optimize']) ? $settings['google_analytics_optimize'] : ''; $conversion_id = !empty($settings['google_analytics_ads']) ? $settings['google_analytics_ads'] : ''; $optimize_id = !empty($settings['google_analytics_ads']) ? $settings['google_analytics_ads'] : ''; $remarketing = !empty($settings['google_analytics_remarketing']) ? $settings['google_analytics_remarketing'] : ''; $anonymize_ip = !empty($settings['google_analytics_ip_anonymization']) ? $settings['google_analytics_ip_anonymization'] : ''; $enhanced_link = !empty($settings['google_analytics_link_attribution']) ? $settings['google_analytics_link_attribution'] : ''; $cross_domain = !empty($settings['google_analytics_cross_domain']) ? $settings['google_analytics_cross_domain'] : ''; $cross_domain_name = !empty($settings['google_analytics_remarketing']) ? $settings['google_analytics_remarketing'] : ''; //custom dimensions $get_custom_dimensions = self::custom_dimensions(); wp_enqueue_script('siteseo-gtag', 'https://www.googletagmanager.com/gtag/js?id=' . esc_attr($ga_id), [], SITESEO_VERSION, [ 'strategy' => 'async', ]); add_filter('script_loader_tag', '\SiteSEO\GoogleAnalytics::update_src_tag', 10, 3); $gtag_config = [ 'anonymize_ip' => $anonymize_ip ? true : false, 'link_attribution' => $enhanced_link ? true : false, ]; if($cross_domain && $cross_domain_name){ $gtag_config['linker'] = [ 'domains' => [$cross_domain_name] ]; } // config foreach($get_custom_dimensions as $dimension => $value){ $gtag_config[$dimension] = $value; } $inline_script = 'window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag("js", new Date()); window.addEventListener("load", function (){ var links = document.querySelectorAll("a"); for(let i = 0; i < links.length; i++){ links[i].addEventListener("click", function(e) { var n = this.href.includes("' . wp_parse_url(home_url(), PHP_URL_HOST) . '"); if (n == false) { gtag("event", "click", {"event_category": "external links","event_label" : this.href}); } }); } }); gtag("config", "'.esc_js($ga_id).'", '.wp_json_encode($gtag_config).');'; if($optimize_id){ $inline_script .= 'gtag("config", "'.esc_js($optimize_id).'");'; } if($conversion_id){ $inline_script .= 'gtag("config", "'.esc_js($conversion_id).'");'; } if($remarketing){ $inline_script .= 'gtag("set", "allow_google_signals", true);'; } wp_add_inline_script('siteseo-gtag', $inline_script); } static function microsoft_clarity(){ global $siteseo; if(self::exclude_user_tracking()){ return; } $project_id = !empty($siteseo->analaytics_settings['google_analytics_clarity_project_id']) ? $siteseo->analaytics_settings['google_analytics_clarity_project_id'] : ''; if(empty($project_id)){ return; } wp_register_script('siteseo-microsoft-clarity', '', [], SITESEO_VERSION, true); wp_enqueue_script('siteseo-microsoft-clarity'); $inline_script = "(function(c,l,a,r,i,t,y){ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; t=l.createElement(r);t.async=1;t.src='https://www.clarity.ms/tag/'+i; y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); })(window, document, 'clarity', 'script', '".esc_js($project_id)."');"; wp_add_inline_script('siteseo-microsoft-clarity', $inline_script); add_filter('script_loader_tag', '\SiteSEO\GoogleAnalytics::update_src_tag', 10, 3); } static function ga_tracking_code(){ global $siteseo; if(self::exclude_user_tracking()){ return; } $ga_id = isset($siteseo->analaytics_settings['google_analytics_ga4']) ? esc_attr($siteseo->analaytics_settings['google_analytics_ga4']) : ''; if(empty($ga_id)){ return; } wp_enqueue_script('siteseo-ga-tracking', 'https://www.googletagmanager.com/gtag/js?id=' . $ga_id, [], SITESEO_VERSION, true); add_filter('script_loader_tag', '\SiteSEO\GoogleAnalytics::add_async_attribute', 10, 2); $inline_script = " window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '{$ga_id}'); "; wp_add_inline_script('siteseo-ga-tracking', $inline_script); } static function add_async_attribute($tag, $handle){ global $siteseo; if('siteseo-ga-tracking' === $handle){ if(!empty($siteseo->analaytics_settings['google_analytics_disable'])){ if(isset($_COOKIE['siteseo-user-consent-accept']) && $_COOKIE['siteseo-user-consent-accept'] === 'true'){ return str_replace(' src', ' async src', $tag); } else{ return str_replace(' src', ' data-src-siteseo', $tag); } } } return $tag; } /** TODO:: temporary in this file*/ static function handle_custom_redirect(){ global $post; // post types and taxonomies $post_types = siteseo_post_types(); $taxonomies = get_taxonomies(array('public' => true), 'objects'); $is_singular = false; foreach($post_types as $post_type){ if(is_singular($post_type->name)){ $is_singular = true; break; } } $is_taxonomy = false; foreach($taxonomies as $taxonomy){ if(is_tax($taxonomy->name)){ $is_taxonomy = true; break; } } if($is_singular || is_404() || $is_taxonomy || is_category() || is_tag()){ if(is_404()){ $args = array( 'post_type' => 'siteseo_404', 'posts_per_page' => 1, 'meta_query' => array( array( 'key' => '_siteseo_redirections_enabled', 'value' => 'yes', 'compare' => '=' ) ) ); $redirect_posts = get_posts($args); if(empty($redirect_posts)){ return; } $post = $redirect_posts[0]; } // Taxonomy archives if($is_taxonomy || is_category() || is_tag()){ $term = get_queried_object(); $term_id = $term->term_id; // Check redirection is enabled $enable_redirect = get_term_meta($term_id, '_siteseo_redirections_enabled', true); if(empty($enable_redirect)){ return; } $login_status = get_term_meta($term_id, '_siteseo_redirections_logged_status', true); $redirect_type = get_term_meta($term_id, '_siteseo_redirections_type', true); $redirect_url = get_term_meta($term_id, '_siteseo_redirections_value', true); $param_handling = get_term_meta($term_id, '_siteseo_redirections_param', true); } // Singular posts, pages, and products else{ $enable_redirect = get_post_meta($post->ID, '_siteseo_redirections_enabled', true); if(empty($enable_redirect)){ return; } $login_status = get_post_meta($post->ID, '_siteseo_redirections_logged_status', true); $redirect_type = get_post_meta($post->ID, '_siteseo_redirections_type', true); $redirect_url = get_post_meta($post->ID, '_siteseo_redirections_value', true); $param_handling = get_post_meta($post->ID, '_siteseo_redirections_param', true); } if($login_status === 'only_logged_in' && !is_user_logged_in()){ return; } if($login_status === 'only_not_logged_in' && is_user_logged_in()){ return; } if(!empty($redirect_url)){ $final_url = $redirect_url; if(is_404() && !empty($_SERVER['QUERY_STRING'])){ switch($param_handling){ case 'exact_match': $current_params = sanitize_text_field(wp_unslash($_SERVER['QUERY_STRING'])); $redirect_params = wp_parse_url($redirect_url, PHP_URL_QUERY); if($current_params !== $redirect_params){ return; } break; case 'without_param': $final_url = strtok($redirect_url, '?'); break; case 'with_ignored_param': $query_string = sanitize_text_field(wp_unslash($_SERVER['QUERY_STRING'])); $final_url = $redirect_url; if(!empty($query_string)){ $final_url .= (strpos($redirect_url, '?') !== false ? '&' : '?') . $query_string; } break; } } $status_code = !empty($redirect_type) ? intval($redirect_type) : 301; if(in_array($status_code, [410, 451]) && is_404()){ status_header($status_code); nocache_headers(); include(get_query_template('404')); exit; } wp_redirect($final_url, $status_code); exit; } } } } admin.php 0000644 00000100533 15100371032 0006337 0 ustar 00 <?php if(!defined('ABSPATH')){ die('Hacking Attempt!'); } // HOOKS add_action('admin_menu', 'loginizer_admin_menu'); add_action('admin_notices', 'loginizer_social_login_url_alert'); add_action('admin_footer', 'loginizer_social_interim_js'); add_action('admin_init', 'loginizer_admin_actions'); //add_filter("plugin_action_links_plugin_loginizer", 'loginizer_plugin_action_links'); function loginizer_admin_actions(){ global $loginizer; if(defined('LOGINIZER_PREMIUM') && !defined('SITEPAD') && current_user_can('activate_plugins') && isset($_GET['page']) && strpos($_GET['page'], 'loginizer') !== FALSE){ $license_notice = get_option('loginizer_license_notice', 0); if(empty($license_notice)){ $license_notice = time(); update_option('loginizer_license_notice', $license_notice); } $license = get_option('loginizer_license', []); // Here we are making sure that we have a license and it has expiry time and has not been dismissed for 2 months if(!empty($license) && !empty($license['expires']) && ($license_notice > 0 || (abs($license_notice) + MONTH_IN_SECONDS * 2) < time())){ $current_timestamp = time(); $expiration_timestamp = strtotime($license['expires']); $timediff = $expiration_timestamp - $current_timestamp; if($timediff <= WEEK_IN_SECONDS){ add_action('admin_notices', 'loginizer_check_expires'); } } } // Notice to let user know about SoftWP. if( !defined('LOGINIZER_PREMIUM') && !defined('BACKUPLY_PRO') && !defined('SPEEDYCACHE_PRO') && !defined('PAGELAYER_PREMIUM') && !defined('GOSMTP_PREMIUM') && !defined('SITESEO_PREMIUM') ){ add_action('admin_notices', 'loginizer_softwp_upgrader_notice'); } } // Add settings link on plugin page function loginizer_plugin_action_links($links) { if(!defined('LOGINIZER_PREMIUM')){ $links[] = '<a href="'.LOGINIZER_PRO_URL.'" style="color:#3db634;" target="_blank">'._x('Upgrade', 'Plugin action link label.', 'loginizer').'</a>'; } $settings_link = '<a href="admin.php?page=loginizer">Settings</a>'; array_unshift($links, $settings_link); return $links; } function loginizer_newsletter_subscribe(){ $newsletter_dismiss = get_option('loginizer_dismiss_newsletter'); if(!empty($newsletter_dismiss)){ return; } $env['url'] = 'https://loginizer.com/'; echo ' <style> .newsletter_container{ color: #000000; background: #FFFFFF; text-align:center; } .subscribe_form_row{ color: #000000; padding-bottom:0px !important; } .subscribe_heading{ font-size:22px; } </style> <div class="notice my-loginizer-dismiss-notice is-dismissible" style="background:#FFF;padding:15px; border: 1px solid #ccd0d4; width:80%;margin-left:0px;margin:auto;"> <div class="container"> <div class="col-md-6 col-md-offset-3 text-center newsletter_container"> <h2 style="font-weight:100; margin-bottom:20px; margin-top:5px;" class="subscribe_heading">Subscribe to our Newsletter</h2> <form class="form-inline" action="" method="POST"> <div class="row subscribe_form_row"> <div class="col-md-12"> <input type="email" name="email" size="40" id="subscribe_email" class="" placeholder="email@example.com" value=""> <input type="button" name="subscribe" id="subscribe_button" class="button button-primary" value="Subscribe" onclick="loginizer_email_subscribe();" style="margin-top:0px;"> </div> <div class="col-md-3"> </div> </div> </form> <p><b>Note :</b> If a Loginizer account does not exist it will be created.</p> </div> </div> </div><br /> <script type="text/javascript"> function loginizer_dismiss_newsletter(){ var data = new Object(); data["action"] = "loginizer_dismiss_newsletter"; data["nonce"] = "'.wp_create_nonce('loginizer_admin_ajax').'"; var admin_url = "'.admin_url().'"+"admin-ajax.php"; jQuery.post(admin_url, data, function(response){ }); } function loginizer_email_subscribe(){ var subs_location = "'.$env['url'].'?email="+encodeURIComponent(jQuery("#subscribe_email").val()); window.open(subs_location, "_blank"); } jQuery(document).on("click", ".my-loginizer-dismiss-notice .notice-dismiss", loginizer_dismiss_newsletter); </script>'; return true; } function loginizer_backuply_promo(){ $plugins = get_plugins(); // Dont show Backuply Promo if its already installed if(array_key_exists('backuply-pro/backuply-pro.php', $plugins) || array_key_exists('backuply/backuply.php', $plugins)){ return; } if(isset($_REQUEST['install_backuply'])){ if(!wp_verify_nonce($_REQUEST['security'], 'loginizer_install_backuply') || !current_user_can('activate_plugins')){ die('Only Admin can access it'); } loginizer_backuply_install(); return; } echo '<div class="notice is-dismissible lz-welcome-panel lz-backuply-dismissible" style="padding:20px; margin:0;"> <table> <tr> <th width="25%"> <img src="'.LOGINIZER_URL.'\assets\images\backuply-square.png" height="150px" width="150px"/> </th> <td width="75%"> <div class="inside" style="margin-left: 20px;"> <strong><i>'.__('Backups are the best form of security. Secure your WordPress site by creating backups with Backuply','loginizer').'</i>:</strong><br> <ul class="lz-right-ul"> <li>'.__('Backup to remote locations like FTP, FTPS, SFTP, WebDAV, Google Drive, OneDrive, Dropbox, Amazon S3','loginizer').'</li> <li>'.__('Auto Backups','loginizer').'</li> <li>'.__('Easy One-Click restores','loginizer').'</li> <li>'.__('Stress Free Migrations','loginizer').'</li> </ul> <a class="button button-primary" href="'.esc_url(admin_url('admin.php?page=loginizer&install_backuply=1&security='.wp_create_nonce('loginizer_install_backuply'))).'">'.__('Install Backuply', 'loginizer').'</a> <a class="button button-secondary" target="_blank" href="https://wordpress.org/plugins/backuply/">'.__('Visit Backuply','loginizer').'</a> </div> </td> </tr> </table> </div><br /> <script type="text/javascript"> function loginizer_dismiss_backuply(){ var data = new Object(); data["action"] = "loginizer_dismiss_backuply"; data["nonce"] = "'.wp_create_nonce('loginizer_admin_ajax').'"; var admin_url = "'.admin_url().'"+"admin-ajax.php"; jQuery.post(admin_url, data, function(response){ }); } jQuery(document).on("click", ".lz-backuply-dismissible .notice-dismiss", loginizer_dismiss_backuply); </script>'; return true; } function loginizer_csrf_promo(){ echo '<div class="notice notice-success is-dismissible lz-csrf-dismissible"><p>Secure your WordPress site from CSRF attacks with our new feature <strong>CSRF Protection</strong> <a href="https://loginizer.com/docs/configuration-and-settings/how-to-enable-csrf-protection/" target="_blank" class="button button-primary">Read More</a></p></div>'; echo'<script type="text/javascript"> function loginizer_dismiss_csrf(){ var data = new Object(); data["action"] = "loginizer_dismiss_csrf"; data["nonce"] = "'.wp_create_nonce('loginizer_admin_ajax').'"; var admin_url = "'.admin_url().'"+"admin-ajax.php"; jQuery.post(admin_url, data, function(response){ }); } jQuery(document).on("click", ".lz-csrf-dismissible", loginizer_dismiss_csrf); </script>'; } // Install Backuply function loginizer_backuply_install(){ // Include the necessary stuff include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); // Includes necessary for Plugin_Upgrader and Plugin_Installer_Skin include_once( ABSPATH . 'wp-admin/includes/file.php' ); include_once( ABSPATH . 'wp-admin/includes/misc.php' ); include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); // Filter to prevent the activate text add_filter('install_plugin_complete_actions', 'loginizer_backuply_install_complete_actions', 10, 3); $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin() ); $installed = $upgrader->install('https://downloads.wordpress.org/plugin/backuply.zip'); if ( !is_wp_error( $installed ) && $installed ) { echo 'Activating Backuply !'; $activate = activate_plugin('backuply/backuply.php'); if ( is_null($activate) ) { echo '<div id="message" class="updated"><p>'. esc_html__('Done! Backuply is now installed and activated.', 'loginizer'). '</p></div><br /><br><br><b>'. esc_html__('Done! Backuply is now installed and activated.', 'loginizer').'</b>'; } } return $installed; } // Prevent pro activate text for installer function loginizer_backuply_install_complete_actions($install_actions, $api, $plugin_file){ if($plugin_file == 'backuply/backuply.php'){ return array(); } return $install_actions; } // The Loginizer Theme footer function loginizer_page_footer(){ if(!loginizer_is_premium()){ echo '<script> jQuery("[loginizer-premium-only]").each(function(index) { jQuery(this).find( "input, textarea, select" ).attr("disabled", true); }); </script>'; } echo '</td> <td width="200" valign="top" id="loginizer-right-bar">'; if(!defined('SITEPAD')){ if(!defined('LOGINIZER_PREMIUM')){ echo ' <div class="postbox" style="min-width:0px !important;"> <div class="postbox-header"> <h2 class="hndle ui-sortable-handle"> <span>'.__('Premium Version','loginizer').'</span> </h2> </div> <div class="inside"> <i>'.__('Upgrade to the premium version and get the following features','loginizer').' </i>:<br> <ul class="lz-right-ul"> <li>'.__('PasswordLess Login','loginizer').'</li> <li>'.__('Two Factor Auth - Email','loginizer').'</li> <li>'.__('Two Factor Auth - App','loginizer').'</li> <li>'.__('Login Challenge Question','loginizer').'</li> <li>'.__('reCAPTCHA','loginizer').'</li> <li>'.__('Rename Login Page','loginizer').'</li> <li>'.__('Disable XML-RPC','loginizer').'</li> <li>'.__('And many more ...','loginizer').'</li> </ul> <center><a class="button button-primary" target="_blank" href="'.LOGINIZER_PRICING_URL.'">Upgrade</a></center> </div> </div>'; }else{ echo ' <div class="postbox" style="min-width:0px !important;"> <div class="postbox-header"> <h2 class="hndle ui-sortable-handle"> <span>'.__('Recommendations','loginizer').'</span> </h2> </div> <div class="inside"> <i>'.__('We recommed that you enable atleast one of the following security features','loginizer').'</i>:<br> <ul class="lz-right-ul"> <li>'.__('Rename Login Page','loginizer').'</li> <li>'.__('Login Challenge Question','loginizer').'</li> <li>'.__('reCAPTCHA','loginizer').'</li> <li>'.__('Two Factor Auth - Email','loginizer').'</li> <li>'.__('Two Factor Auth - App','loginizer').'</li> <li>'.__('Change \'admin\' Username','loginizer').'</li> </ul> </div> </div>'; } echo ' <div class="postbox" style="min-width:0px !important;"> <div class="postbox-header"> <h2 class="hndle ui-sortable-handle"> <span><a target="_blank" href="https://backuply.com/?from=loginizer-plugin"><img src="'.LOGINIZER_URL.'/assets/images/backuply-black.png" width="100%" /></a></span> </h2> </div> <div class="inside"> <i>'.__('Secure your WordPress site by creating backups with Backuply', 'loginizer').'</i>:<br> <ul class="lz-right-ul"> <li>'.__('Remote Backup to 8 location','loginizer').'</li> <li>'.__('Auto Backups', 'loginizer').'</li> <li>'.__('Backup Rotation', 'loginizer').'</li> <li>'.__('One-Click Restore', 'loginizer').'</li> <li>'.__('Stress-free Migration', 'loginizer').'</li> <li>'.__('Backup to Google Drive', 'loginizer').'</li> <li>'.__('Backup to Amazon S3', 'loginizer').'</li> <li>'.__('Backup to Dropbox', 'loginizer').'</li> <li>'.__('Backup to FTP,FTPS and many more ...','loginizer').'</li> </ul> <center><a class="button button-primary" target="_blank" href="https://wordpress.org/plugins/backuply/">'.__('Visit Backuply','loginizer').'</a></center> </div> </div>'; echo ' <div class="postbox" style="min-width:0px !important;"> <div class="postbox-header"> <h2 class="hndle ui-sortable-handle"> <span><a target="_blank" href="https://pagelayer.com/?from=loginizer-plugin"><img src="'.LOGINIZER_URL.'/assets/images/pagelayer_product.png" width="100%" /></a></span> </h2> </div> <div class="inside"> <i>'.__('Easily manage and make professional pages and content with our Pagelayer builder','loginizer').'</i>:<br> <ul class="lz-right-ul"> <li>'.__('30+ Free Widgets','loginizer').'</li> <li>'.__('60+ Premium Widgets','loginizer').'</li> <li>'.__('400+ Premium Sections','loginizer').'</li> <li>'.__('Theme Builder','loginizer').'</li> <li>'.__('WooCommerce Builder','loginizer').'</li> <li>'.__('Theme Creator and Exporter','loginizer').'</li> <li>'.__('Form Builder','loginizer').'</li> <li>'.__('Popup Builder','loginizer').'</li> <li>'.__('And many more ...','loginizer').'</li> </ul> <center><a class="button button-primary" target="_blank" href="https://wordpress.org/plugins/pagelayer/">'.__('Visit Pagelayer','loginizer').'</a></center> </div> </div>'; } echo '</td> </tr> </table>'; if(!defined('SITEPAD')){ echo '<br /> <div style="width:45%;background:#FFF;padding:15px; margin:auto"> <b>'.__('Let your friends know that you have secured your website :','loginizer').'</b> <form method="get" action="https://twitter.com/intent/tweet" id="tweet" onsubmit="return dotweet(this);"> <textarea name="text" cols="45" row="3" style="resize:none;">'.__('I just secured my @WordPress site against #bruteforce using @loginizer','loginizer').'</textarea> <input type="submit" value="Tweet!" class="button button-primary" onsubmit="return false;" id="twitter-btn" style="margin-top:20px;"/> </form> </div> <br /> <script> function dotweet(ele){ window.open(jQuery("#"+ele.id).attr("action")+"?"+jQuery("#"+ele.id).serialize(), "_blank", "scrollbars=no, menubar=no, height=400, width=500, resizable=yes, toolbar=no, status=no"); return false; } </script> <hr /> <a href="http://loginizer.com" target="_blank">Loginizer</a> '.__('v'.LOGINIZER_VERSION.'. You can report any bugs ','loginizer').'<a href="http://wordpress.org/support/plugin/loginizer" target="_blank">'.__('here','loginizer').'</a>.'; } echo ' </div> </div> </div> </div>'; } // The Loginizer Admin Options Page function loginizer_page_header($title = 'Loginizer'){ global $loginizer; ?> <style> .lz-right-ul{ padding-left: 10px !important; } .lz-right-ul li{ list-style: circle !important; } </style> <?php echo '<div style="margin: 10px 20px 0 2px;"> <div class="metabox-holder columns-2"> <div class="postbox-container"> <div id="top-sortables" class="meta-box-sortables ui-sortable"> <table cellpadding="2" cellspacing="1" width="100%" class="fixed" border="0"> <tr> <td valign="top"><h3>'.$loginizer['prefix'].$title.'</h3></td>'; if(!defined('SITEPAD')){ echo '<td align="right"><a href="https://www.softaculous.com/clients?ca=affiliate" class="button button-primary" target="_blank">'. __('Refer and Earn', 'loginizer'). '</a> <a target="_blank" class="button button-primary" href="https://wordpress.org/support/view/plugin-reviews/loginizer">'.__('Review Loginizer', 'loginizer').'</a></td> <td align="right" width="40"><a target="_blank" href="https://twitter.com/loginizer"><img src="'.LOGINIZER_URL.'/assets/images/twitter.png" /></a></td> <td align="right" width="40"><a target="_blank" href="https://www.facebook.com/Loginizer-815504798591884"><img src="'.LOGINIZER_URL.'/assets/images/facebook.png" /></a></td>'; } echo ' </tr> </table> <hr /> <!--Main Table--> <table cellpadding="8" cellspacing="1" width="100%" class="fixed"> <tr> <td valign="top">'; if(defined('LOGINIZER_PREMIUM') && !empty($loginizer['enable_csrf_protection']) && !loginizer_is_csrf_prot_mod_set()){ $lz_error['csrf_mod'] = esc_html__('You have enabled CSRF protection but the .htaccess file has not been updated', 'loginizer'); if(!empty($lz_error)){ lz_report_error($lz_error);echo '<br />'; } } } // Shows the admin menu of Loginizer function loginizer_admin_menu() { global $wp_version, $loginizer; if(!defined('SITEPAD')){ // Add the menu page add_menu_page(__('Loginizer Dashboard', 'loginizer'), __('Loginizer Security', 'loginizer'), 'activate_plugins', 'loginizer', 'loginizer_dashboard'); // Dashboard add_submenu_page('loginizer', __('Loginizer Dashboard', 'loginizer'), __('Dashboard', 'loginizer'), 'activate_plugins', 'loginizer', 'loginizer_dashboard'); }else{ // Add the menu page add_menu_page(__('Security', 'loginizer'), __('Security', 'loginizer'), 'activate_plugins', 'loginizer', 'loginizer_security_settings', 'dashicons-shield', 85); // Rename Login add_submenu_page('loginizer', __('Security Settings', 'loginizer'), __('Rename Login', 'loginizer'), 'activate_plugins', 'loginizer', 'loginizer_security_settings'); } // Brute Force add_submenu_page('loginizer', __('Brute Force Settings', 'loginizer'), __('Brute Force', 'loginizer'), 'activate_plugins', 'loginizer_brute_force', 'loginizer_brute_force_settings'); // PasswordLess add_submenu_page('loginizer', __($loginizer['prefix'].'PasswordLess Settings', 'loginizer'), __('PasswordLess', 'loginizer'), 'activate_plugins', 'loginizer_passwordless', 'loginizer_passwordless_settings'); // Security Settings if(!defined('SITEPAD')){ // Two Factor Auth add_submenu_page('loginizer', __($loginizer['prefix'].' Two Factor Authentication', 'loginizer'), __('Two Factor Auth', 'loginizer'), 'activate_plugins', 'loginizer_2fa', 'loginizer_2fa_settings'); } // reCaptcha add_submenu_page('loginizer', __($loginizer['prefix'].'reCAPTCHA Settings', 'loginizer'), __('reCAPTCHA', 'loginizer'), 'activate_plugins', 'loginizer_recaptcha', 'loginizer_recaptcha_settings'); // Temporary Login add_submenu_page('loginizer', __($loginizer['prefix'].'SSO', 'loginizer'), __('Single Sign On', 'loginizer'). ((time() < strtotime('30 November 2023')) ? ' <span style="color:yellow;">Update</span>' : ''), 'activate_plugins', 'loginizer_sso', 'loginizer_sso_settings'); // Social Login $hook_name = add_submenu_page('loginizer', __($loginizer['prefix'].'social_login', 'loginizer'), __('Social Login', 'loginizer') . (defined('LOGINIZER_PREMIUM') && (time() < strtotime('30 June 2025')) ? ' <span style="color:yellow;font-size:12px;">Updated</span>' : ''), 'activate_plugins', 'loginizer_social_login', 'loginizer_social_login_settings'); // Security Settings if(!defined('SITEPAD')){ // Security Settings add_submenu_page('loginizer', __($loginizer['prefix'].'Security Settings', 'loginizer'), __('Security Settings', 'loginizer'), 'activate_plugins', 'loginizer_security', 'loginizer_security_settings'); // File Checksums add_submenu_page('loginizer', __('Loginizer File Checksums', 'loginizer'), __('File Checksums', 'loginizer'), 'activate_plugins', 'loginizer_checksums', 'loginizer_checksums_settings'); } if(!defined('LOGINIZER_PREMIUM') && !empty($loginizer['ins_time']) && $loginizer['ins_time'] < (time() - (30*24*3600))){ // Go Pro link add_submenu_page('loginizer', __('Loginizer Go Pro', 'loginizer'), __('Go Pro', 'loginizer'), 'activate_plugins', LOGINIZER_PRO_URL); } // NOTE: This hook is just for Social Login for now, // will need to change if we make different CSS files for every Menu page // INFO:: Using this action helps is loading the CSS beforehand preventing any layout change on load. add_action('load-'.$hook_name, 'loginizer_load_admin_assets'); } // Loads assets like CSS and JS for admin Pages. function loginizer_load_admin_assets(){ wp_enqueue_style('loginizer_social_style', LOGINIZER_URL . '/assets/css/social-admin.css', [], LOGINIZER_VERSION); wp_enqueue_script('loginizer_social_script', LOGINIZER_URL . '/assets/js/social-admin.js', ['jquery', 'jquery-ui-sortable'], LOGINIZER_VERSION, true); } // Show the promo function loginizer_promo(){ echo ' <style> .lz_button { background-color: #4CAF50; /* Green */ border: none; color: white; padding: 8px 16px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; -webkit-transition-duration: 0.4s; /* Safari */ transition-duration: 0.4s; cursor: pointer; } .lz_button:focus{ border: none; color: white; } .lz_button1 { color: white; background-color: #4CAF50; border:3px solid #4CAF50; } .lz_button1:hover { box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 9px 25px 0 rgba(0,0,0,0.19); color: white; border:3px solid #4CAF50; } .lz_button2 { color: white; background-color: #0085ba; } .lz_button2:hover { box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 9px 25px 0 rgba(0,0,0,0.19); color: white; } .lz_button3 { color: white; background-color: #365899; } .lz_button3:hover { box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 9px 25px 0 rgba(0,0,0,0.19); color: white; } .lz_button4 { color: white; background-color: rgb(66, 184, 221); } .lz_button4:hover { box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 9px 25px 0 rgba(0,0,0,0.19); color: white; } .loginizer_promo-close{ float:right; text-decoration:none; margin: 5px 10px 0px 0px; } .loginizer_promo-close:hover{ color: red; } </style> <script> jQuery(document).ready( function() { (function($) { $("#loginizer_promo .loginizer_promo-close").click(function(){ var data; // Hide it $("#loginizer_promo").hide(); // Save this preference $.post("'.admin_url('?loginizer_promo=0').'", data, function(response) { //alert(response); }); }); })(jQuery); }); </script> <div class="notice notice-success" id="loginizer_promo" style="min-height:120px"> <a class="loginizer_promo-close" href="javascript:" aria-label="Dismiss this Notice"> <span class="dashicons dashicons-dismiss"></span> Dismiss </a> <img src="'.LOGINIZER_URL.'/assets/images/loginizer-200.png" style="float:left; margin:10px 20px 10px 10px" width="100" /> <p style="font-size:16px">We are glad you like Loginizer and have been using it since the past few days. It is time to take the next step </p> <p> <a class="lz_button lz_button1" target="_blank" href="https://loginizer.com/features">Upgrade to Pro</a> <a class="lz_button lz_button2" target="_blank" href="https://wordpress.org/support/view/plugin-reviews/loginizer">Rate it 5★\'s</a> <a class="lz_button lz_button3" target="_blank" href="https://www.facebook.com/Loginizer-815504798591884/">Like Us on Facebook</a> <a class="lz_button lz_button4" target="_blank" href="https://twitter.com/home?status='.rawurlencode('I use @loginizer to secure my #WordPress site - https://loginizer.com').'">Tweet about Loginizer</a> </p> </div>'; } function loginizer_recaptcha_settings(){ include_once LOGINIZER_DIR . '/main/settings/recaptcha.php'; loginizer_page_recaptcha(); } function loginizer_2fa_settings(){ include_once LOGINIZER_DIR . '/main/settings/2fa.php'; loginizer_page_2fa(); } function loginizer_passwordless_settings(){ include_once LOGINIZER_DIR . '/main/settings/passwordless.php'; loginizer_page_passwordless(); } function loginizer_security_settings(){ include_once LOGINIZER_DIR . '/main/settings/security.php'; loginizer_page_security(); } function loginizer_brute_force_settings(){ include_once LOGINIZER_DIR . '/main/settings/brute-force.php'; loginizer_page_brute_force(); } function loginizer_checksums_settings(){ include_once LOGINIZER_DIR . '/main/settings/checksum.php'; loginizer_page_checksums(); } function loginizer_dashboard(){ include_once LOGINIZER_DIR . '/main/settings/dashboard.php'; loginizer_page_dashboard(); } function loginizer_sso_settings(){ include_once LOGINIZER_DIR . '/main/settings/sso.php'; loginizer_sso(); } function loginizer_social_login_settings(){ include_once LOGINIZER_DIR . '/main/settings/social_login.php'; loginizer_social_login(); } // Hides the interim login poup after successful login. function loginizer_social_interim_js(){ if(isset($_GET['interim_login']) && $_GET['interim_login'] === 'lz' && is_user_logged_in()){ echo '<script> document.addEventListener("DOMContentLoaded", () => { parent.document.querySelector("#wp-auth-check-wrap")?.classList.add("hidden"); }); </script>'; } } // Show alert when the login url gets changes from when the Loginizer social settings were setup. function loginizer_social_login_url_alert(){ // We want to show this error to user which has sufficient privilage if(!current_user_can('activate_plugins')){ return; } $set_login_url = get_option('loginizer_social_login_url', ''); if(empty($set_login_url) || $set_login_url === wp_login_url()){ return; } $provider_settings = get_option('loginizer_provider_settings', []); // If we dont have any settings then it dosent matter what URL is set. // As it will be updated once user saves the settings. if(empty($provider_settings)){ return; } $has_enabled = false; $has_non_login_auth = false; foreach($provider_settings as $provider){ if(empty($provider['loginizer_social_key']) && !empty($provider['enabled'])){ $has_non_login_auth = true; } if(!empty($provider['enabled'])){ $has_enabled = true; } } // We will only show this error if the user is using key based config if(empty($has_non_login_auth)){ return; } // If we have no Provider enabled then just show the warning on the social login page. if(empty($has_enabled) && (empty($_GET['page']) || $_GET['page'] !== 'loginizer_social_login')){ return; } echo '<div class="notice notice-error"> <h4>'.esc_html__('You changed login slug!', 'loginizer').'</h4> <p>'.esc_html__('You changed the login slug and have some social login apps enabled. These social login apps use the login URL as the redirect URI. This means that since the login URL has changed, the social login will now break.', 'loginizer').'</p> <h4>'.esc_html__('How to fix:', 'loginizer').'</h4> <p>'.esc_html__('When you created secret keys for the social apps, you also provided a Redirect URI. To fix this issue, you need to update that Redirect URI.', 'loginizer').'<br/> You just need to update the <code>/wp-login.php</code> to the new slug you have.</p> <p><button class="button button-primary" id="loginizer-social-login-alert">'.esc_html__('I have fixed this issue', 'loginizer').'</button></p> </div>'; wp_register_script('loginizer_social_alert', '', ['jquery'], LOGINIZER_VERSION, true); wp_enqueue_script('loginizer_social_alert'); wp_add_inline_script('loginizer_social_alert', ' jQuery("#loginizer-social-login-alert").on("click", function(){ jQuery(this).closest(".notice").slideToggle(); var data = new Object(); data["action"] = "loginizer_dismiss_social_alert"; data["nonce"] = "'.wp_create_nonce('loginizer_admin_ajax').'"; var admin_url = "'.admin_url().'"+"admin-ajax.php"; jQuery.post(admin_url, data, function(response){ }); });'); } function loginizer_softwp_upgrader_notice(){ // We want to show this error to user which has sufficient privilage if(!current_user_can('activate_plugins')){ return; } /*$notice_end_time = strtotime('31 March 2025'); if(!empty($notice_end_time) && time() > $notice_end_time){ return; }*/ $softwp_upgrade = get_option('loginizer_softwp_upgrade', 0); if(empty($softwp_upgrade) || $softwp_upgrade < 0){ return; } if(empty($_GET['page']) || !preg_match('/loginizer/is', $_GET['page'])){ return; } echo '<style>.loginizer_promo-close{float:right;text-decoration:none;margin: 5px 10px 0px 0px;}.loginizer_promo-close:hover{color: red;}</style> <div class="notice notice-warning" id="loginizer_softwp_notice"> <a class="loginizer_promo-close" id="loginizer-softwp-promo-close" href="javascript:" aria-label="Dismiss Forever"> <span class="dashicons dashicons-dismiss"></span> '.esc_html__('Dismiss Forever', 'loginizer').' </a> <p>' . esc_html__('Hey, you might be eligible to access Premium plugins provided by Softaculous for Free ! Please refer to these documents for details on how to avail them.', 'loginizer').' <a href="https://softwp.net/docs/admin/generate-softwp-license" target="_blank">' . esc_html__('Generate SoftWP License', 'loginizer') . '</a> | <a href="https://softwp.net/docs/admin/installing-plugins" target="_blank">' . esc_html__('How to Install the Pro plugins', 'loginizer') . '</a></p> </div>'; wp_register_script('loginizer_softwp_alert', '', ['jquery'], LOGINIZER_VERSION, true); wp_enqueue_script('loginizer_softwp_alert'); wp_add_inline_script('loginizer_softwp_alert', ' jQuery("#loginizer-softwp-promo-close").on("click", function(){ jQuery(this).closest("#loginizer_softwp_notice").slideToggle(); var data = new Object(); data["action"] = "loginizer_dismiss_softwp_alert"; data["security"] = "'.wp_create_nonce('loginizer_softwp_notice').'"; var admin_url = "'.admin_url().'"+"admin-ajax.php"; jQuery.post(admin_url, data, function(response){ }); });'); } function loginizer_check_expires(){ global $loginizer; // We do not want to show the expiry notice if the license is by SoftWP. if(!empty($loginizer['license']) && !empty($loginizer['license']['has_plid'])){ return; } $current_timestamp = time(); $expiration_timestamp = strtotime($loginizer['license']['expires']); $time_diff = $expiration_timestamp - $current_timestamp; // Renew link $loginizer_user_license = $loginizer['license']['license']; $loginizer_user_plan = $loginizer['license']['plan']; $loginizer_renew_url = 'https://www.softaculous.com/clients?ca=loginizer_buy&plan=' . $loginizer_user_plan . '&license=' . $loginizer_user_license; if($time_diff > 0 && $time_diff <= WEEK_IN_SECONDS){ $human_time = human_time_diff($current_timestamp, $expiration_timestamp); echo '<style>.loginizer_promo-close{float:right;text-decoration:none;margin: 5px 10px 0px 0px;}.loginizer_promo-close:hover{color: red;}</style> <div class="notice notice-error" id="loginizer_license_notice"> <a class="loginizer_promo-close" id="loginizer-license-promo-close" href="javascript:" aria-label="Dismiss this Notice"> <span class="dashicons dashicons-dismiss"></span> '.esc_html__('Dismiss for 60 days', 'loginizer').' </a> <p>' . sprintf(esc_html__('Alert : Your Loginizer Premium license will expire in %s. Renew to keep getting updates!', 'loginizer'), esc_html($human_time)).' <a href="' . esc_url($loginizer_renew_url) . '" target="_blank">' . esc_html__('Click here to renew', 'loginizer') . '</a> </p> </div>'; } else if($time_diff <= 0){ echo '<style>.loginizer_promo-close{float:right;text-decoration:none;margin: 5px 10px 0px 0px;}.loginizer_promo-close:hover{color: red;}</style> <div class="notice notice-error" id="loginizer_license_notice"> <a class="loginizer_promo-close" id="loginizer-license-promo-close" href="javascript:" aria-label="Dismiss this Notice"> <span class="dashicons dashicons-dismiss"></span> '.esc_html__('Dismiss for 60 days', 'loginizer').' </a> <p>' . esc_html__('Alert: Your Loginizer Premium license has expired. Please renew immediately to keep getting updates ', 'loginizer').' <a href="' . esc_url($loginizer_renew_url) . '" target="_blank">' . esc_html__('Click here to renew', 'loginizer') . '</a></p> </div>'; } wp_register_script('loginizer_license_alert', '', ['jquery'], LOGINIZER_VERSION, true); wp_enqueue_script('loginizer_license_alert'); wp_add_inline_script('loginizer_license_alert', ' jQuery("#loginizer-license-promo-close").on("click", function(){ jQuery(this).closest("#loginizer_license_notice").slideToggle(); var data = new Object(); data["action"] = "loginizer_dismiss_license_alert"; data["security"] = "'.wp_create_nonce('loginizer_license_notice').'"; var admin_url = "'.admin_url().'"+"admin-ajax.php"; jQuery.post(admin_url, data, function(response){ }); });'); } columns.php 0000644 00000012235 15100371032 0006730 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Columns{ static function add_columns($colums){ global $siteseo; if(empty($siteseo->setting_enabled['toggle-advanced'])){ return $colums; // toggle disable } $options = $siteseo->advanced_settings; if(!empty($options['appearance_title_col'])){ $colums['seo_title'] = __('Title tag', 'siteseo'); } if(!empty($options['appearance_meta_desc_col'])){ $colums['meta_description'] = __('Meta Desc' , 'siteseo'); } if(!empty($options['appearance_redirect_enable_col'])){ $colums['redirect_enabled'] = __('Redirect?', 'siteseo'); } if(!empty($options['appearance_redirect_url_col'])){ $colums['redirect_url'] = __('Redirect URL', 'siteseo'); } if(!empty($options['appearance_canonical'])){ $colums['canonical_url'] = __('Canonical', 'siteseo'); } if(!empty($options['appearance_target_kw_col'])){ $colums['target_keyword'] = __('Target Kw', 'siteseo'); } if(!empty($options['appearance_noindex_col'])){ $colums['noindex'] = __('noindex?', 'siteseo'); } if(!empty($options['appearance_nofollow_col'])){ $colums['nofollow'] = __('nofollow?', 'siteseo'); } if(!empty($options['appearance_words_col'])){ $colums['word_count'] = __('Words', 'siteseo'); } if(!empty($options['appearance_score_col'])){ $colums['seo_score'] = __('Score', 'siteseo'); } return $colums; } static function populate_custom_seo_columns($column, $post_id){ global $siteseo; if(empty($siteseo->setting_enabled['toggle-advanced'])){ return; // toggle disable } $options = $siteseo->advanced_settings; switch($column){ case 'seo_title': if(!empty($options['appearance_title_col'])){ $title = get_post_meta($post_id, '_siteseo_titles_title', true); echo esc_html(\SiteSEO\TitlesMetas::replace_variables($title)); } break; case 'meta_description': if(!empty($options['appearance_meta_desc_col'])){ $desc = get_post_meta($post_id, '_siteseo_titles_desc', true); $replaced_desc = \SiteSEO\TitlesMetas::replace_variables($desc); echo esc_html($replaced_desc); } break; case 'redirect_enabled': if(!empty($options['appearance_meta_desc_col'])){ $redirect_enabled = get_post_meta($post_id, 'siteseo_redirections_enabled', true); echo $redirect_enabled ? esc_html__('Yes', 'siteseo') : esc_html__('No', 'siteseo'); } break; case 'redirect_url': if(!empty($options['appearance_redirect_enable_col'])){ echo esc_url(get_post_meta($post_id, '_siteseo_redirections_value', true)); } break; case 'canonical_url': if(!empty($options['appearance_redirect_url_col'])){ echo esc_url(get_post_meta($post_id, '_siteseo_robots_canonical', true)); } break; case 'target_keyword': if(!empty($options['appearance_canonical'])){ $keywords = esc_html(get_post_meta($post_id, '_siteseo_analysis_target_kw', true)); echo isset($keywords) ? esc_html($keywords) :''; } break; case 'noindex': if(!empty($options['appearance_noindex_col'])){ $noindex = get_post_meta($post_id, '_siteseo_robots_index', true); echo $noindex ? esc_html__('Yes', 'siteseo') : esc_html__('No', 'siteseo'); } break; case 'nofollow': if(!empty($options['appearance_nofollow_col'])){ $nofollow = get_post_meta($post_id, '_siteseo_robots_follow', true); echo $nofollow ? esc_html__('Yes', 'siteseo') : esc_html__('No', 'siteseo'); } break; case 'word_count': if(!empty($options['appearance_words_col'])){ $content = get_post_field('post_content', $post_id); echo esc_html(str_word_count(wp_strip_all_tags($content))); } break; case 'seo_score': if(!empty($options['appearance_score_col'])){ $score = get_post_meta($post_id, '_siteseo_score', true); echo !empty($score) ? esc_html($score) : ''; } break; } } static function make_seo_columns_sortable($columns){ global $siteseo; if(empty($siteseo->setting_enabled['toggle-advanced'])){ return $columns; // toggle disable } $options = $siteseo->advanced_settings; if(!empty($options['appearance_title_col'])){ $columns['seo_title'] = 'seo_title'; } if(!empty($options['appearance_meta_desc_col'])){ $columns['meta_description'] = 'meta_description'; } if(!empty($options['appearance_target_kw_col'])){ $columns['target_keyword'] = 'target_keyword'; } if(!empty($options['appearance_words_col'])){ $columns['word_count'] = 'word_count'; } if(!empty($options['appearance_score_col'])){ $columns['seo_score'] = 'seo_score'; } return $columns; } static function hide_genesis_seo(){ global $siteseo; if(empty($siteseo->setting_enabled['toggle-advanced'])){ return; // toggle disable } $options = $siteseo->advanced_settings; if(!empty($options['appearance_genesis_seo_menu'])){ remove_theme_support('genesis-seo-settings-menu'); } if(!empty($options['appearance_genesis_seo_metaboxe'])){ remove_action('admin_menu', 'genesis_add_inpost_seo_box'); } } } install.php 0000644 00000001312 15100371032 0006710 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEOPro; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Install{ static function activate(){ update_option('siteseo_pro_version', SITESEO_PRO_VERSION); } static function deactivate(){ global $wpdb; wp_clear_scheduled_hook('siteseo_send_404_report_email'); wp_clear_scheduled_hook('siteseo_404_cleanup'); } static function uninstall(){ global $wpdb; $wpdb->query("DROP TABLE IF EXISTS `".$wpdb->prefix."siteseo_redirect_logs`"); delete_option('siteseo_pro_version'); delete_option('siteseo_pro_options'); delete_option('siteseo_pro_page_speed'); delete_option('siteseo_license'); } } import.php 0000644 00000060443 15100371032 0006566 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Import{ static function rank_math(){ $imported_count = 0; $log = []; $posts = get_posts(['posts_per_page' => -1, 'post_type' => 'any', 'post_status' => 'any']); foreach($posts as $post){ $robots = get_post_meta($post->ID, 'rank_math_robots', true); $robots_array = is_array($robots) ? $robots : []; $meta_mapping = [ '_siteseo_titles_title' => get_post_meta($post->ID, 'rank_math_title', true), '_siteseo_titles_desc' => get_post_meta($post->ID, 'rank_math_description', true), '_siteseo_social_fb_title' => get_post_meta($post->ID, 'rank_math_facebook_title', true), '_siteseo_social_fb_desc' => get_post_meta($post->ID, 'rank_math_facebook_description', true), '_siteseo_social_fb_img' => get_post_meta($post->ID, 'rank_math_facebook_image', true), '_siteseo_social_twitter_title' => get_post_meta($post->ID, 'rank_math_twitter_title', true), '_siteseo_social_twitter_desc' => get_post_meta($post->ID, 'rank_math_twitter_description', true), '_siteseo_social_twitter_img' => get_post_meta($post->ID, 'rank_math_twitter_image', true), '_siteseo_robots_index' => in_array('noindex', $robots_array) ? '1' : '', '_siteseo_robots_follow' => in_array('nofollow', $robots_array) ? '1' : '', '_siteseo_robots_imageindex' => in_array('noimageindex', $robots_array) ? '1' : '', '_siteseo_robots_archive' => in_array('noarchive', $robots_array) ? '1' : '', '_siteseo_robots_snippet' => in_array('nosnippet', $robots_array) ? '1' : '', '_siteseo_robots_canonical' => get_post_meta($post->ID, 'rank_math_canonical_url', true), '_siteseo_analysis_target_kw' => get_post_meta($post->ID, 'rank_math_focus_keyword', true), '_siteseo_robots_primary_cat' => get_post_meta($post->ID, 'rank_math_primary_category', true) ]; foreach($meta_mapping as $siteseo_key => $value){ if(!empty($value)){ update_post_meta($post->ID, $siteseo_key, $value); $imported_count++; } } $log[] = "Imported post ID: {$post->ID}"; } $taxonomies = get_taxonomies(); foreach($taxonomies as $taxonomy){ $terms = get_terms([ 'taxonomy' => $taxonomy, 'hide_empty' => false, ]); foreach($terms as $term){ $term_robots = get_term_meta($term->term_id, 'rank_math_robots', true); $term_robots_array = is_array($term_robots) ? $term_robots : []; $meta_mapping = [ '_siteseo_titles_title' => get_term_meta($term->term_id, 'rank_math_title', true), '_siteseo_titles_desc' => get_term_meta($term->term_id, 'rank_math_description', true), '_siteseo_social_fb_title' => get_term_meta($term->term_id, 'rank_math_facebook_title', true), '_siteseo_social_fb_desc' => get_term_meta($term->term_id, 'rank_math_facebook_description', true), '_siteseo_social_fb_img' => get_term_meta($term->term_id, 'rank_math_facebook_image', true), '_siteseo_social_twitter_title' => get_term_meta($term->term_id, 'rank_math_twitter_title', true), '_siteseo_social_twitter_desc' => get_term_meta($term->term_id, 'rank_math_twitter_description', true), '_siteseo_social_twitter_img' => get_term_meta($term->term_id, 'rank_math_twitter_image', true), '_siteseo_robots_index' => in_array('noindex', $term_robots_array) ? '1' : '', '_siteseo_robots_follow' => in_array('nofollow', $term_robots_array) ? '1' : '', '_siteseo_robots_imageindex' => in_array('noimageindex', $term_robots_array) ? '1' : '', '_siteseo_robots_archive' => in_array('noarchive', $term_robots_array) ? '1' : '', '_siteseo_robots_snippet' => in_array('nosnippet', $term_robots_array) ? '1' : '', '_siteseo_robots_canonical' => get_term_meta($term->term_id, 'rank_math_canonical_url', true), '_siteseo_analysis_target_kw' => get_term_meta($term->term_id, 'rank_math_focus_keyword', true) ]; foreach($meta_mapping as $siteseo_key => $value){ if(!empty($value)){ update_term_meta($term->term_id, $siteseo_key, $value); $imported_count++; } } $log[] = "Imported term ID: {$term->term_id}"; } } return [ 'count' => $imported_count, 'log' => $log, /* translators: %d count of items imported */ 'message' => sprintf(__('Rank Math import completed. Imported %d items.', 'siteseo'), $imported_count) ]; } static function yoast_seo(){ $imported_count = 0; $log = []; $posts = get_posts(['posts_per_page' => -1, 'post_type' => 'any', 'post_status' => 'any']); foreach($posts as $post){ $yoast_robots = get_post_meta($post->ID, '_yoast_wpseo_meta-robots-adv', true); $robots_array = $yoast_robots ? explode(',', $yoast_robots) : []; $meta_mapping = [ '_siteseo_titles_title' => get_post_meta($post->ID, '_yoast_wpseo_title', true), '_siteseo_titles_desc' => get_post_meta($post->ID, '_yoast_wpseo_metadesc', true), '_siteseo_social_fb_title' => get_post_meta($post->ID, '_yoast_wpseo_opengraph-title', true), '_siteseo_social_fb_desc' => get_post_meta($post->ID, '_yoast_wpseo_opengraph-description', true), '_siteseo_social_fb_img' => get_post_meta($post->ID, '_yoast_wpseo_opengraph-image', true), '_siteseo_social_twitter_title' => get_post_meta($post->ID, '_yoast_wpseo_twitter-title', true), '_siteseo_social_twitter_desc' => get_post_meta($post->ID, '_yoast_wpseo_twitter-description', true), '_siteseo_social_twitter_img' => get_post_meta($post->ID, '_yoast_wpseo_twitter-image', true), '_siteseo_robots_index' => get_post_meta($post->ID, '_yoast_wpseo_meta-robots-noindex', true) ? '1' : '', '_siteseo_robots_follow' => get_post_meta($post->ID, '_yoast_wpseo_meta-robots-nofollow', true) ? '1' : '', '_siteseo_robots_imageindex' => in_array('noimageindex', $robots_array) ? '1' : '', '_siteseo_robots_archive' => in_array('noarchive', $robots_array) ? '1' : '', '_siteseo_robots_snippet' => in_array('nosnippet', $robots_array) ? '1' : '', '_siteseo_robots_canonical' => get_post_meta($post->ID, '_yoast_wpseo_canonical', true), '_siteseo_analysis_target_kw' => get_post_meta($post->ID, '_yoast_wpseo_focuskw', true), '_siteseo_robots_primary_cat' => get_post_meta($post->ID, '_yoast_wpseo_primary_category', true) ]; foreach($meta_mapping as $siteseo_key => $value){ if(!empty($value)){ update_post_meta($post->ID, $siteseo_key, $value); $imported_count++; } } $log[] = "Imported post ID: {$post->ID}"; } $yoastseo_term_meta = get_option('wpseo_taxonomy_meta'); foreach($yoastseo_term_meta as $taxonomy){ if(!is_array($taxonomy)){ continue; } foreach($taxonomy as $term_id => $term){ $meta_mapping = [ '_siteseo_titles_title' => !empty($term['wpseo_title']) ? $term['wpseo_title'] : '', '_siteseo_titles_desc' => !empty($term['wpseo_desc']) ? $term['wpseo_desc'] : '', '_siteseo_social_fb_title' => !empty($term['wpseo_opengraph-title']) ? $term['wpseo_opengraph-title'] : '', '_siteseo_social_fb_desc' => !empty($term['wpseo_opengraph-description']) ? $term['wpseo_opengraph-description'] : '', '_siteseo_social_fb_img' => !empty($term['wpseo_opengraph-image']) ? $term['wpseo_opengraph-image'] : '', '_siteseo_social_twitter_title' => !empty($term['wpseo_twitter-title']) ? $term['wpseo_twitter-title'] : '', '_siteseo_social_twitter_desc' => !empty($term['wpseo_twitter-description']) ? $term['wpseo_twitter-description'] : '', '_siteseo_social_twitter_img' => !empty($term['wpseo_twitter-image']) ? $term['wpseo_twitter-image'] : '', '_siteseo_robots_index' => !empty($term['wpseo_noindex']) ? 'yes' : '', '_siteseo_robots_follow' => !empty($term['wpseo_nofollow']) ? 'yes' : '', '_siteseo_robots_imageindex' => !empty($term['wpseo_noimageindex']) ? 'yes' : '', '_siteseo_robots_archive' => !empty($term['wpseo_noarchive']) ? 'yes' : '', '_siteseo_robots_snippet' => !empty($term['wpseo_nosnippet']) ? 'yes' : '', '_siteseo_analysis_target_kw' => !empty($term['wpseo_focuskw']) ? $term['wpseo_focuskw'] : '', '_siteseo_robots_primary_cat' => !empty($term['wpseo_primary_category']) ? $term['wpseo_primary_category'] : '', '_siteseo_robots_canonical' => !empty($term['wpseo_canonical']) ? $term['wpseo_canonical'] : '', ]; foreach($meta_mapping as $siteseo_key => $value){ if(!empty($value)){ update_term_meta($term_id, $siteseo_key, $value); $imported_count++; } } $log[] = "Imported term ID: {$term_id}"; } } return [ 'count' => $imported_count, 'log' => $log, /* translators: %d count of items imported */ 'message' => sprintf(__('Yoast SEO import completed. Imported %d items.', 'siteseo'), $imported_count) ]; } static function aio_seo(){ $imported_count = 0; $log = []; $posts = get_posts(['posts_per_page' => -1, 'post_type' => 'any', 'post_status' => 'any']); foreach($posts as $post){ $meta_mapping = [ '_siteseo_titles_title' => get_post_meta($post->ID, '_aioseo_title', true), '_siteseo_titles_desc' => get_post_meta($post->ID, '_aioseo_description', true), '_siteseo_social_fb_title' => get_post_meta($post->ID, '_aioseo_og_title', true), '_siteseo_social_fb_desc' => get_post_meta($post->ID, '_aioseo_og_description', true), '_siteseo_social_fb_img' => get_post_meta($post->ID, '_aioseo_og_image', true), '_siteseo_social_twitter_title' => get_post_meta($post->ID, '_aioseo_twitter_title', true), '_siteseo_social_twitter_desc' => get_post_meta($post->ID, '_aioseo_twitter_description', true), '_siteseo_social_twitter_img' => get_post_meta($post->ID, '_aioseo_twitter_image', true), '_siteseo_robots_index' => get_post_meta($post->ID, '_aioseo_noindex', true) ? '1' : '', '_siteseo_robots_follow' => get_post_meta($post->ID, '_aioseo_nofollow', true) ? '1' : '', '_siteseo_robots_imageindex' => '1', '_siteseo_robots_archive' => '1', '_siteseo_robots_snippet' => '1', // Default to 1 if not specified '_siteseo_robots_canonical' => get_post_meta($post->ID, '_aioseo_canonical_url', true), '_siteseo_analysis_target_kw' => get_post_meta($post->ID, '_aioseo_keywords', true) ]; foreach($meta_mapping as $siteseo_key => $value){ if(!empty($value)){ update_post_meta($post->ID, $siteseo_key, $value); $imported_count++; } } $log[] = "Imported post ID: {$post->ID}"; } $taxonomies = get_taxonomies(); foreach($taxonomies as $taxonomy){ $terms = get_terms([ 'taxonomy' => $taxonomy, 'hide_empty' => false, ]); foreach($terms as $term){ $meta_mapping = [ '_siteseo_titles_title' => get_term_meta($term->term_id, '_aioseo_title', true), '_siteseo_titles_desc' => get_term_meta($term->term_id, '_aioseo_description', true), '_siteseo_social_fb_title' => get_term_meta($term->term_id, '_aioseo_og_title', true), '_siteseo_social_fb_desc' => get_term_meta($term->term_id, '_aioseo_og_description', true), '_siteseo_social_fb_img' => get_term_meta($term->term_id, '_aioseo_og_image', true), '_siteseo_social_twitter_title' => get_term_meta($term->term_id, '_aioseo_twitter_title', true), '_siteseo_social_twitter_desc' => get_term_meta($term->term_id, '_aioseo_twitter_description', true), '_siteseo_social_twitter_img' => get_term_meta($term->term_id, '_aioseo_twitter_image', true), '_siteseo_robots_index' => get_term_meta($term->term_id, '_aioseo_noindex', true) ? '1' : '', '_siteseo_robots_follow' => get_term_meta($term->term_id, '_aioseo_nofollow', true) ? '1' : '', '_siteseo_robots_canonical' => get_term_meta($term->term_id, '_aioseo_canonical_url', true), '_siteseo_analysis_target_kw' => get_term_meta($term->term_id, '_aioseo_keywords', true) ]; foreach($meta_mapping as $siteseo_key => $value){ if(!empty($value)){ update_term_meta($term->term_id, $siteseo_key, $value); $imported_count++; } } $log[] = "Imported term ID: {$term->term_id}"; } } return [ 'count' => $imported_count, 'log' => $log, /* translators: %d count of items imported */ 'message' => sprintf(__('All In One SEO import completed. Imported %d items.', 'siteseo'), $imported_count) ]; } static function seo_framework(){ $imported_count = 0; $log = []; $posts = get_posts(['posts_per_page' => -1, 'post_type' => 'any', 'post_status' => 'any']); foreach($posts as $post){ $meta_mapping = [ '_siteseo_titles_title' => get_post_meta($post->ID, '_genesis_title', true), '_siteseo_titles_desc' => get_post_meta($post->ID, '_genesis_description', true), '_siteseo_social_fb_title' => get_post_meta($post->ID, '_open_graph_title', true), '_siteseo_social_fb_desc' => get_post_meta($post->ID, '_open_graph_description', true), '_siteseo_social_fb_img' => get_post_meta($post->ID, '_social_image_url', true), '_siteseo_social_twitter_title' => get_post_meta($post->ID, '_twitter_title', true), '_siteseo_social_twitter_desc' => get_post_meta($post->ID, '_twitter_description', true), '_siteseo_social_twitter_img' => get_post_meta($post->ID, '_twitter_image', true), '_siteseo_robots_index' => get_post_meta($post->ID, '_genesis_noindex', true) ? '1' : '', '_siteseo_robots_follow' => get_post_meta($post->ID, '_genesis_nofollow', true) ? '1' : '', '_siteseo_robots_imageindex' => '1', '_siteseo_robots_archive' => '1', '_siteseo_robots_snippet' => '1', '_siteseo_robots_canonical' => get_post_meta($post->ID, '_genesis_canonical_uri', true), '_siteseo_analysis_target_kw' => get_post_meta($post->ID, '_genesis_keywords', true) ]; foreach($meta_mapping as $siteseo_key => $value){ if(!empty($value)){ update_post_meta($post->ID, $siteseo_key, $value); $imported_count++; } } $log[] = "Imported post ID: {$post->ID}"; } $taxonomies = get_taxonomies(); foreach($taxonomies as $taxonomy){ $terms = get_terms([ 'taxonomy' => $taxonomy, 'hide_empty' => false, ]); foreach($terms as $term){ $term_data = get_term_meta($term->term_id, 'autodescription-term-settings', true); if(empty($term_data) || !is_array($term_data)){ continue; } $meta_mapping = [ '_siteseo_titles_title' => !empty($term_data['doctitle']) ? $term_data['doctitle'] : '', '_siteseo_titles_desc' => !empty($term_data['description']) ? $term_data['description'] : '', '_siteseo_social_fb_title' => !empty($term_data['og_title']) ? $term_data['og_title'] : '', '_siteseo_social_fb_desc' => !empty($term_data['og_description']) ? $term_data['og_description'] : '', '_siteseo_social_fb_img' => !empty($term_data['social_image_url']) ? $term_data['social_image_url'] : '', '_siteseo_social_twitter_title' => !empty($term_data['tw_title']) ? $term_data['tw_title'] : '', '_siteseo_social_twitter_desc' => !empty($term_data['tw_description']) ? $term_data['tw_description'] : '', '_siteseo_social_twitter_img' => !empty($term_data['social_image_url']) ? $term_data['social_image_url'] : '', '_siteseo_robots_index' => !empty($term_data['noindex']) ? true : '', '_siteseo_robots_follow' => !empty($term_data['nofollow'] ) ? true : '', '_siteseo_robots_archive' => !empty($term_data['noarchive']) ? true : '', '_siteseo_robots_canonical' => !empty($term_data['canonical']) ? $term_data['canonical'] : '', '_siteseo_analysis_target_kw' => !empty($term_data['keywords']) ? $term_data['keywords'] : '', ]; foreach($meta_mapping as $siteseo_key => $value){ if(!empty($value)){ update_term_meta($term->term_id, $siteseo_key, $value); $imported_count++; } } $log[] = "Imported term ID: {$term->term_id}"; } } return [ 'count' => $imported_count, 'log' => $log, /* translators: %d count of items imported */ 'message' => sprintf(__('SEO Framework import completed. Imported %d items.', 'siteseo'), $imported_count) ]; } static function seo_press(){ $imported_count = 0; $log = []; $posts = get_posts(['posts_per_page' => -1, 'post_type' => 'any', 'post_status' => 'any']); foreach($posts as $post){ $robots_index = get_post_meta($post->ID, '_seopress_robots_index', true); $robots_follow = get_post_meta($post->ID, '_seopress_robots_follow', true); $robots_imageindex = get_post_meta($post->ID, '_seopress_robots_imageindex', true); $robots_archive = get_post_meta($post->ID, '_seopress_robots_archive', true); $meta_mapping = [ '_siteseo_titles_title' => get_post_meta($post->ID, '_seopress_titles_title', true), '_siteseo_titles_desc' => get_post_meta($post->ID, '_seopress_titles_desc', true), '_siteseo_social_fb_title' => get_post_meta($post->ID, '_seopress_social_fb_title', true), '_siteseo_social_fb_desc' => get_post_meta($post->ID, '_seopress_social_fb_desc', true), '_siteseo_social_fb_img' => get_post_meta($post->ID,'_seopress_social_fb_img',true), '_siteseo_social_twitter_title' => get_post_meta($post->ID, '_seopress_social_twitter_title', true), '_siteseo_social_twitter_desc' => get_post_meta($post->ID, '_seopress_social_twitter_desc', true), '_siteseo_social_twitter_img' => get_post_meta($post->ID, '_seopress_social_twitter_img', true), '_siteseo_robots_index' => (!empty($robots_index) && $robots_index === 'yes') ? '1' : '0', '_siteseo_robots_follow' => (!empty($robots_follow) && $robots_follow === 'yes') ? '1' : '0', '_siteseo_robots_imageindex' => (!empty($robots_imageindex) && $robots_imageindex === 'yes') ? '1' : '0', '_siteseo_robots_archive' => (!empty($robots_archive) && $robots_archive === 'yes') ? '1' : '0', '_siteseo_robots_snippet' => get_post_meta($post->ID, '_seopress_robots_snippet', true), '_siteseo_robots_canonical' => get_post_meta($post->ID, '_seopress_robots_canonical', true), '_siteseo_analysis_target_kw' => get_post_meta($post->ID, '_seopress_analysis_target_kw', true), '_siteseo_redirections_enabled' => get_post_meta($post->ID, '_seopress_redirections_enabled', true) ? '1' : '0', '_siteseo_redirections_value' => get_post_meta($post->ID, '_seopress_redirections_value', true), '_siteseo_redirections_type' => get_post_meta($post->ID, '_seopress_redirections_type', true), '_siteseo_redirections_param' => get_post_meta($post->ID, '_seopress_redirections_param', true), '_siteseo_redirections_logged_status' => get_post_meta($post->ID, '_seopress_redirections_logged_status', true), '_siteseo_redirections_enabled_regex' => get_post_meta($post->ID, '_seopress_redirections_enabled_regex', true), ]; foreach($meta_mapping as $siteseo_key => $value){ if(!empty($value)){ update_post_meta($post->ID, $siteseo_key, $value); $imported_count++; } } $log[] = "Imported post ID: {$post->ID}"; } $taxonomies = get_taxonomies(); foreach($taxonomies as $taxonomy){ $terms = get_terms([ 'taxonomy' => $taxonomy, 'hide_empty' => false, ]); foreach($terms as $term){ $robots_index = get_term_meta($term->term_id, '_seopress_robots_index', true); $robots_follow = get_term_meta($term->term_id, '_seopress_robots_follow', true); $robots_imageindex = get_term_meta($term->term_id, '_seopress_robots_imageindex', true); $robots_archive = get_term_meta($term->term_id, '_seopress_robots_archive', true); $meta_mapping = [ '_siteseo_titles_title' => get_term_meta($term->term_id, '_seopress_titles_title', true), '_siteseo_titles_desc' => get_term_meta($term->term_id, '_seopress_titles_desc', true), '_siteseo_social_fb_title' => get_term_meta($term->term_id, '_seopress_social_fb_title', true), '_siteseo_social_fb_desc' => get_term_meta($term->term_id, '_seopress_social_fb_desc', true), '_siteseo_social_fb_img' => get_term_meta($term->term_id,'_seopress_social_fb_img',true), '_siteseo_social_twitter_title' => get_term_meta($term->term_id, '_seopress_social_twitter_title', true), '_siteseo_social_twitter_desc' => get_term_meta($term->term_id, '_seopress_social_twitter_desc', true), '_siteseo_social_twitter_img' => get_term_meta($term->term_id, '_seopress_social_twitter_img', true), '_siteseo_robots_index' => (!empty($robots_index) && $robots_index === 'yes') ? '1' : '0', '_siteseo_robots_follow' => (!empty($robots_follow) && $robots_follow === 'yes') ? '1' : '0', '_siteseo_robots_imageindex' => (!empty($robots_imageindex) && $robots_imageindex === 'yes') ? '1' : '0', '_siteseo_robots_archive' => (!empty($robots_archive) && $robots_archive === 'yes') ? '1' : '0', '_siteseo_robots_snippet' => get_term_meta($term->term_id, '_seopress_robots_snippet', true), '_siteseo_robots_canonical' => get_term_meta($term->term_id, '_seopress_robots_canonical', true), '_siteseo_analysis_target_kw' => get_term_meta($term->term_id, '_seopress_analysis_target_kw', true), '_siteseo_redirections_enabled' => get_term_meta($term->term_id, '_seopress_redirections_enabled', true) ? '1' : '0', '_siteseo_redirections_value' => get_term_meta($term->term_id, '_seopress_redirections_value', true), '_siteseo_redirections_type' => get_term_meta($term->term_id, '_seopress_redirections_type', true), '_siteseo_redirections_param' => get_term_meta($term->term_id, '_seopress_redirections_param', true), '_siteseo_redirections_logged_status' => get_term_meta($term->term_id, '_seopress_redirections_logged_status', true), '_siteseo_redirections_enabled_regex' => get_term_meta($term->term_id, '_seopress_redirections_enabled_regex', true), ]; foreach($meta_mapping as $siteseo_key => $value){ if(!empty($value)){ update_term_meta($term->term_id, $siteseo_key, $value); $imported_count++; } } $log[] = "Imported term ID: {$term->term_id}"; } } return [ 'count' => $imported_count, 'log' => $log, /* translators: %d count of items imported */ 'message' => sprintf(__('SEOPress migration completed. Imported %d items.', 'siteseo'), $imported_count) ]; } static function slim_seo(){ $imported_count = 0; $log = []; $posts = get_posts(['posts_per_page' => -1, 'post_type' => 'any', 'post_status' => 'any']); $taxonomies = get_taxonomies(array('public' => true), 'objects'); foreach($posts as $post){ $post_data = get_post_meta($post->ID, 'slim_seo', true); if(empty($post_data) || !is_array($post_data)){ continue; } $meta_mapping = [ '_siteseo_titles_title' => $post_data['title'] ?? '', '_siteseo_titles_desc' => $post_data['description'] ?? '', '_siteseo_social_fb_img' => $post_data['facebook_image'] ?? '', '_siteseo_social_twitter_img' => $post_data['twitter_image'] ?? '', '_siteseo_robots_index' => ($post_data['noindex'] ?? false) ? '1' : '', '_siteseo_robots_canonical' => $post_data['canonical'] ?? '', ]; foreach($meta_mapping as $siteseo_key => $value){ if(!empty($value)){ update_post_meta($post->ID, $siteseo_key, $value); $imported_count++; } } $log[] = "Imported post ID: {$post->ID}"; } $taxonomies = get_taxonomies(); foreach($taxonomies as $taxonomy){ $terms = get_terms([ 'taxonomy' => $taxonomy, 'hide_empty' => false, ]); foreach($terms as $term){ $term_data = get_term_meta($term->term_id, 'slim_seo', true); if(empty($term_data) || !is_array($term_data)){ continue; } $meta_mapping = [ '_siteseo_titles_title' => !empty($term_data['title']) ? $term_data['title'] : '', '_siteseo_titles_desc' => !empty($term_data['description']) ? $term_data['description'] : '', '_siteseo_social_fb_img' => !empty($term_data['facebook_image']) ? $term_data['facebook_image'] : '', '_siteseo_social_twitter_img' => !empty($term_data['twitter_image']) ? $term_data['twitter_image'] : '', '_siteseo_robots_index' => !empty($term_data['noindex']) ? true : '', '_siteseo_robots_canonical' => !empty($term_data['canonical']) ? $term_data['canonical'] : '', ]; foreach($meta_mapping as $siteseo_key => $value){ if(!empty($value)){ update_term_meta($term->term_id, $siteseo_key, $value); $imported_count++; } } $log[] = "Imported term ID: {$term->term_id}"; } } return [ 'count' => $imported_count, 'log' => $log, /* translators: %d count of items imported */ 'message' => sprintf(__('Slim SEO import completed. Imported %d items.', 'siteseo'), $imported_count) ]; } } advanced.php 0000644 00000015121 15100371032 0007012 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Advanced{ static function tags(){ global $siteseo; if(empty($siteseo->setting_enabled['toggle-advanced'])){ return; // toggle disable } // meta tags if(!empty($siteseo->advanced_settings['advanced_google'])){ echo '<meta name="google-site-verification" content="'.esc_attr($siteseo->advanced_settings['advanced_google']).'" />' . "\n"; } if(!empty($siteseo->advanced_settings['advanced_bing'])){ echo '<meta name="msvalidate.01" content="'.esc_attr($siteseo->advanced_settings['advanced_bing']).'" />' . "\n"; } if(!empty($siteseo->advanced_settings['advanced_pinterest'])){ echo '<meta name="p:domain_verify" content="'.esc_attr($siteseo->advanced_settings['advanced_pinterest']).'" />'; } if(!empty($siteseo->advanced_settings['advanced_yandex'])){ echo '<meta name="yandex-verification" content="'.esc_attr($siteseo->advanced_settings['advanced_yandex']).'" />'; } if(!empty($siteseo->advanced_settings['advanced_wp_rsd'])){ remove_action('wp_head', 'rsd_link'); } } static function remove_links(){ global $siteseo; if(empty($siteseo->setting_enabled['toggle-advanced'])){ return; // toggle disable } if(!empty($siteseo->advanced_settings['advanced_wp_rsd'])){ remove_action('wp_head', 'rsd_link'); } if(!empty($siteseo->advanced_settings['advanced_wp_wlw'])){ remove_action('wp_head', 'wlwmanifest_link'); } if(!empty($siteseo->advanced_settings['advanced_wp_shortlink'])){ remove_action('wp_head', 'wp_shortlink_wp_head'); } if(!empty($siteseo->advanced_settings['advanced_wp_generator'])){ remove_action('wp_head', 'wp_generator'); } if(!empty($siteseo->advanced_settings['advanced_comments_form_link'])){ add_filter('comment_form_default_fields', '\SiteSEO\Advanced::remove_comment_url_field'); } if(!empty($siteseo->advanced_settings['advanced_comments_author_url'])){ add_filter('get_comment_author_link', '\SiteSEO\Advanced::remove_author_link_if_profile_url'); } if(!empty($siteseo->advanced_settings['advanced_hentry'])){ add_filter('post_class', '\SiteSEO\Advanced::remove_hentry_post_class'); } if(!empty($siteseo->advanced_settings['advanced_noreferrer'])){ add_filter('the_content', '\SiteSEO\Advanced::remove_noreferrer_from_post_content'); } if(!empty($siteseo->advanced_settings['advanced_tax_desc_editor'])){ add_action('edit_term', '\SiteSEO\Advanced::add_wp_editor_to_taxonomy_description', 10, 2); } if(!empty($siteseo->advanced_settings['advanced_category_url'])){ add_action('init', '\SiteSEO\Advanced::remove_category_base', 111); add_action('template_redirect', '\SiteSEO\Advanced::redirect_category'); } } static function add_wp_editor_to_taxonomy_description($tag){ if('edit' !== get_current_screen()->base || 'edit-tags' !== get_current_screen()->id){ return; } if(isset($tag->description)){ $editor_settings = array( 'textarea_name' => 'description', 'textarea_rows' => 10, 'editor_class' => 'wp-editor-area', 'media_buttons' => true, 'tinymce' => true, 'quicktags' => true, ); wp_editor($tag->description, 'description', $editor_settings); } } static function remove_noreferrer_from_post_content($content){ $content = preg_replace('/<a[^>]+rel=["\']?noreferrer["\']?[^>]*>/i', '<a', $content); return $content; } static function remove_hentry_post_class($classes){ $classes = array_diff($classes, array('hentry')); return $classes; } static function remove_comment_url_field($fields){ if(isset($fields['url'])){ unset($fields['url']); } return $fields; } static function remove_author_link_if_profile_url(){ $user_id = $comment->user_id; if(!empty($user_id)){ $user_website = get_the_author_meta('user_url', $user_id); if($user_website){ return get_comment_author($comment->comment_ID); } } return $author; } static function remove_category_base(){ $categories = get_categories(array('hide_empty' => false)); $category_slugs = wp_list_pluck($categories, 'slug'); if(empty($category_slugs)){ return; } $category_pattern = '(' . implode('|', $category_slugs) .')'; add_rewrite_rule( '^'.$category_pattern.'/?$', 'index.php?category_name=$matches[1]', 'top' ); // Add rule for handle pagination add_rewrite_rule( '^'.$category_pattern.'/page/([0-9]+)/?$', 'index.php?category_name=$matches[1]&paged=$matches[2]', 'top' ); } static function redirect_category(){ if(is_category() && !is_admin()){ $category = get_query_var('category_name'); $category_base = get_option('category_base'); $base_to_check = !empty($category_base) ? $category_base : 'category'; if(!empty($category) && strpos(sanitize_url($_SERVER['REQUEST_URI']), '/'.$base_to_check.'/') !== false){ wp_safe_redirect(home_url('/' . $category . '/'), 301); exit; } } } static function remove_wc_category_base(){ global $siteseo; if(empty($siteseo->advanced_settings['advanced_product_cat_url']) || empty($siteseo->setting_enabled['toggle-advanced'])){ return; } if(!in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))){ return; } add_filter('term_link', '\SiteSEO\Advanced::remove_category_base_woo', 10, 3); add_filter('request', '\SiteSEO\Advanced::category_url_request'); add_action('created_product_cat', 'flush_rewrite_rules'); add_action('delete_product_cat', 'flush_rewrite_rules'); add_action('edited_product_cat', 'flush_rewrite_rules'); add_action('parse_request', '\SiteSEO\Advanced::old_category_url_request'); } static function remove_category_base_woo($termlink, $term, $taxonomy){ if($taxonomy === 'product_cat'){ $category_base = '/product-category/'; return str_replace($category_base, '/', $termlink); } return $termlink; } static function category_url_request($query_vars){ if(!isset($query_vars['product_cat']) && isset($query_vars['pagename'])){ $pagename = $query_vars['pagename']; $term = get_term_by('slug', $pagename, 'product_cat'); if($term){ $query_vars['product_cat'] = $term->slug; unset($query_vars['pagename']); } } return $query_vars; } static function old_category_url_request($wp){ if(!isset($wp->query_vars['pagename'])){ return; } $pagename = $wp->query_vars['pagename']; $term = get_term_by('slug', $pagename, 'product_cat'); if($term){ $wp->query_vars['product_cat'] = $term->slug; unset($wp->query_vars['pagename']); } } } instantindexing.php 0000644 00000021007 15100371032 0010453 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEO; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class InstantIndexing{ static function bing_txt_file(){ global $wp, $siteseo; $request = home_url($wp->request); if(empty($request)){ return; } $api_key = $siteseo->instant_settings['instant_indexing_bing_api_key']; $api_url = trailingslashit(home_url()) . $api_key . '.txt'; if($request == $api_url){ header('X-Robots-Tag: noindex'); header('Content-Type: text/plain'); status_header(200); echo esc_html($api_key); die(); } } static function submit_urls_to_google($urls){ $access_token = self::get_google_auth_token(); if(empty($access_token)){ return; } $boundary = wp_rand(); $batch_body = ''; $options = get_option('siteseo_instant_indexing_option_name'); $type = !empty($options['instant_indexing_google_action']) ? $options['instant_indexing_google_action'] : 'URL_UPDATED'; switch($type){ case 'remove_urls': $type = 'URL_DELETED'; break; case 'update_urls': $type = 'URL_UPDATED'; break; } // Creating a batch request foreach($urls as $url){ $post_data = wp_json_encode(['url' => $url, 'type' => $type]); $batch_body .= '--'.$boundary.PHP_EOL; $batch_body .= 'Content-Type: application/http'.PHP_EOL; $batch_body .= 'Content-Transfer-Encoding: binary'.PHP_EOL; $batch_body .= 'Content-ID: <'.esc_url($url).'>'.PHP_EOL.PHP_EOL; $batch_body .= 'POST /v3/urlNotifications:publish HTTP/1.1'.PHP_EOL; $batch_body .= 'Content-Type: application/json' . PHP_EOL; $batch_body .= 'accept: application/json'.PHP_EOL; $batch_body .= 'content-length: '.strlen($post_data).PHP_EOL.PHP_EOL; $batch_body .= $post_data.PHP_EOL; } $batch_body .= '--'.$boundary.'--'; $response = wp_remote_post('https://indexing.googleapis.com/batch', [ 'body' => $batch_body, 'headers' => [ 'Content-Type' => 'multipart/mixed; boundary='.$boundary, 'Authorization' => 'Bearer ' . $access_token ], 'timeout' => 30 ]); if(is_wp_error($response)){ $response = ['error' => $response->get_error_message()]; return; } $res_code = wp_remote_retrieve_response_code($response); if($res_code > 299){ return $response; } $batch_response = self::parse_batch_response($response); $response = [ 'status_code' => wp_remote_retrieve_response_code($response), 'urls' => $batch_response, 'error' => is_wp_error($response) ? $response->get_error_message() : null ]; return $response; } static function parse_batch_response(&$response){ $response_headers = wp_remote_retrieve_headers($response); $response_headers = $response_headers->getAll(); $content_type = $response_headers['content-type']; $urls = []; $content_type = explode(';', $content_type); $boundary = false; foreach($content_type as $part){ $part = explode('=', $part, 2); if (isset($part[0]) && 'boundary' == trim($part[0])) { $boundary = $part[1]; } } $res_body = wp_remote_retrieve_body($response); $res_body = str_replace('--'.$boundary.'--', '--'.$boundary, $res_body); $batch_responses = explode('--'.$boundary, $res_body); $batch_responses = array_filter($batch_responses); foreach($batch_responses as $batch_response){ $batch_response = trim($batch_response); if(empty($batch_response)){ continue; } $batch_response = explode("\r\n\r\n", $batch_response); if(empty($batch_response[2])){ continue; } $batch_body = json_decode($batch_response[2], true); if(empty($batch_body)){ continue; } if(!empty($batch_body['urlNotificationMetadata']) && !empty($batch_body['urlNotificationMetadata']['url'])){ $urls[] = sanitize_url($batch_body['urlNotificationMetadata']['url']); } } return $urls; } static function get_google_auth_token(){ global $siteseo; $endpoint = 'https://oauth2.googleapis.com/token'; $scope = 'https://www.googleapis.com/auth/indexing'; if(!function_exists('openssl_sign')){ return false; } $google_api_data = isset($siteseo->instant_settings['instant_indexing_google_api_key']) ? $siteseo->instant_settings['instant_indexing_google_api_key'] : ''; if(empty($google_api_data)){ return false; } $google_api_data = json_decode($google_api_data, true); if(empty($google_api_data)){ return; } // Header $headers = wp_json_encode(['alg' => 'RS256', 'typ' => 'JWT']); $headers = base64_encode($headers); // Claim Set $now = time(); $claims = wp_json_encode([ 'iss' => $google_api_data['client_email'], 'scope' => 'https://www.googleapis.com/auth/indexing', 'aud' => 'https://oauth2.googleapis.com/token', 'exp' => $now + 3600, 'iat' => $now ]); $claims = base64_encode($claims); // Make sure base64 encoding is URL-safe $headers = str_replace(['+', '/', '='], ['-', '_', ''], $headers); $claim = str_replace(['+', '/', '='], ['-', '_', ''], $claims); // Sign the JWT with the private key $signature_input = "$headers.$claim"; openssl_sign($signature_input, $signature, $google_api_data['private_key'], OPENSSL_ALGO_SHA256); $signature = base64_encode($signature); $signature = str_replace(['+', '/', '='], ['-', '_', ''], $signature); // JWT Token $jwt_assertion = "$signature_input.$signature"; // OAuth2 Request $post_data = http_build_query([ 'grant_type' => 'urn:ietf:params:oauth:grant-type:jwt-bearer', 'assertion' => $jwt_assertion ]); $response = wp_remote_post($endpoint, [ 'body' => $post_data, 'headers' => [ 'Content-Type' => 'application/x-www-form-urlencoded', ] ]); if(is_wp_error($response)){ return false; } $body = json_decode(wp_remote_retrieve_body($response), true); return $body['access_token'] ?? false; } /** * Sends request to index now api with list of urls and key and key location. * * Key location is just the URL to a file which has the same name as the Key * as key.txt and the content in it is the key as well. This is a virtual file. * * @param array $urls List of URLs to submit. * @param string $api_key bing key. * * @return array with 'status_code' and response 'body' */ static function submit_urls_to_bing($urls, $api_key){ $host = wp_parse_url(home_url(), PHP_URL_HOST); $key_location = trailingslashit(home_url()) . $api_key . '.txt'; $endpoint = 'https://api.indexnow.org/indexnow/'; $body = wp_json_encode([ 'host' => $host, 'key' => $api_key, 'keyLocation' => $key_location, 'urlList' => $urls ]); $response = wp_remote_post($endpoint, [ 'body' => $body, 'headers' => [ 'Content-Type' => 'application/json', 'Accept' => 'application/json' ], 'timeout' => 30 ]); return [ 'status_code' => wp_remote_retrieve_response_code($response), 'body' => wp_remote_retrieve_body($response) ]; } // Sends request to bing when the status of post changes // We will only do it only if the post is published. static function on_status_change($new_status, $old_status, $post){ if($new_status == $old_status){ return; } if($new_status != 'publish'){ return; } $options = get_option('siteseo_instant_indexing_option_name', []); $api_key = isset($options['instant_indexing_bing_api_key']) ? $options['instant_indexing_bing_api_key'] : ''; $url = get_permalink($post); if(empty($url) || empty($api_key)){ return; } $url_list = [$url]; $res = self::submit_urls_to_bing($url_list, $api_key); self::save_index_history($url_list, null, $res, 'auto'); } static function save_index_history($urls, $google_response = null, $bing_response = null, $source = 'manual'){ global $siteseo; $history = $siteseo->instant_settings; if(!isset($history['indexing_history'])){ $history['indexing_history'] = []; } array_unshift($history['indexing_history'], [ 'time' => time(), 'urls' => $urls, 'google_status_code' => $google_response['status_code'] ?? null, 'bing_status_code' => $bing_response['status_code'] ?? null, 'source' => $source // 'manual' or 'auto' ]); $history['indexing_history'] = array_slice($history['indexing_history'], 0, 10); update_option('siteseo_instant_indexing_option_name', $history); } } download_google_fonts.php 0000644 00000007060 15103567077 0011647 0 ustar 00 <?php ////////////////////////////////////////////////////////////// //=========================================================== // download_google_fonts.php //=========================================================== // PAGELAYER // Inspired by the DESIRE to be the BEST OF ALL // ---------------------------------------------------------- // Started by: Pulkit Gupta // Date: 23rd Jan 2017 // Time: 23:00 hrs // Site: http://pagelayer.com/wordpress (PAGELAYER) // ---------------------------------------------------------- // Please Read the Terms of use at http://pagelayer.com/tos // ---------------------------------------------------------- //=========================================================== // (c)Pagelayer Team //=========================================================== ////////////////////////////////////////////////////////////// // Are we being accessed directly ? if(!defined('PAGELAYER_PRO_VERSION')) { exit('Hacking Attempt !'); } // Download google fonts function pagelayer_pro_download_google_fonts($url){ global $wp_filesystem; if (!defined('FS_METHOD')) { define( 'FS_METHOD', 'direct' ); } $uploads_dir = wp_upload_dir(); $font_url = $uploads_dir['baseurl'].'/pl-google-fonts'; $font_dir = $uploads_dir['basedir'].'/pl-google-fonts'; // Find hash of current url $url_md5 = md5($url); $local_path = $font_dir.'/'.$url_md5.'.css'; if(file_exists( $local_path ) ){ return $local_path; } // Load Wp filesystem class if ( ! function_exists( 'WP_Filesystem' ) ) { $file_path = ABSPATH . 'site-admin/includes/file.php'; $file_path = file_exists($file_path) ? $file_path : ABSPATH . 'wp-admin/includes/file.php'; include $file_path; } WP_Filesystem(); // Is google fonts directory exists? if( !file_exists( $font_dir ) ){ wp_mkdir_p( $font_dir ); } //verify fonts upload directory exists or not $fonts_dir = $font_dir.'/fonts'; if( !file_exists( $fonts_dir ) ){ wp_mkdir_p($fonts_dir); } // Fetch stylesheet $useragent = array( 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36'); $response = wp_remote_get($url, $useragent); $response_code = wp_remote_retrieve_response_code($response); if ( is_wp_error( $response ) || $response_code !== 200 ) { return false; } $remote_file = wp_remote_retrieve_body($response); // Collect google fonts urls preg_match_all( '/url\(.*?\)/i', $remote_file, $font_links ); if(!isset( $font_links[0] ) || count( $font_links[0] ) < 1 ) { return false; } foreach( $font_links[0] as $key => $_fontlink ){ $download_url = str_ireplace( array('url(',')'), '', $_fontlink ); if(empty($download_url)){ continue; } $parse_url = parse_url($download_url); $font_name = basename($parse_url['path']); $local_file = $font_dir.'/fonts/'.$font_name; $_local_file = './fonts/'.$font_name; if( empty( $font_name ) || strpos($font_name, '.woff2') === false ){ continue; } // Download font files if(!file_exists( $local_file ) ){ $tmp_file = download_url( $download_url ); if(is_wp_error( $tmp_file )){ continue; } $wp_filesystem->copy( $tmp_file, $local_file ); $wp_filesystem->delete( $tmp_file ); } // Update font links $remote_file = str_replace( $download_url, $_local_file, $remote_file ); } // Save local stylesheet $wp_filesystem->put_contents( $local_path, $remote_file ); return $local_path; } functions.php 0000644 00000030714 15103567077 0007305 0 ustar 00 <?php ////////////////////////////////////////////////////////////// //=========================================================== // functions.php //=========================================================== // PAGELAYER // Inspired by the DESIRE to be the BEST OF ALL // ---------------------------------------------------------- // Started by: Pulkit Gupta // Date: 23rd Jan 2017 // Time: 23:00 hrs // Site: http://pagelayer.com/wordpress (PAGELAYER) // ---------------------------------------------------------- // Please Read the Terms of use at http://pagelayer.com/tos // ---------------------------------------------------------- //=========================================================== // (c)Pagelayer Team //=========================================================== ////////////////////////////////////////////////////////////// // Are we being accessed directly ? if(!defined('PAGELAYER_PRO_VERSION')) { exit('Hacking Attempt !'); } // Is called when the ADMIN enables the plugin function pagelayer_pro_activation(){ global $wpdb; $sql = array(); add_option('pagelayer_pro_version', PAGELAYER_PRO_VERSION); add_option('pagelayer_pro_options', array()); // Update free verion pagelayer_pro_update_free_after_pro(null, array( 'action' => 'update', 'type' => 'plugin', 'plugin' => 'pagelayer-pro/pagelayer-pro.php', 'silent_skin' => true, )); } // Checks if we are to update ? function pagelayer_pro_update_check(){ global $wpdb; $sql = array(); $current_version = get_option('pagelayer_pro_version'); $version = (int) str_replace('.', '', $current_version); // No update required if($current_version == PAGELAYER_PRO_VERSION){ return true; } // Is it first run ? if(empty($current_version)){ // Reinstall pagelayer_pro_activation(); // Trick the following if conditions to not run $version = (int) str_replace('.', '', PAGELAYER_PRO_VERSION); } $is_network_wide = pagelayer_pro_is_network_active('pagelayer-pro'); if($is_network_wide){ $free_ins = get_site_option('pagelayer_free_installed'); }else{ $free_ins = get_option('pagelayer_free_installed'); } // If plugin runing reached here it means Pagelayer free installed if(empty($free_ins)){ if($is_network_wide){ update_site_option('pagelayer_free_installed', time()); }else{ update_option('pagelayer_free_installed', time()); } } // Re-init NAG dismiss expire time update_option('pagelayer_pro_older_pro_version_nag', time()); update_option('pagelayer_pro_older_free_version_nag', time()); // Save the new Version update_option('pagelayer_pro_version', PAGELAYER_PRO_VERSION); } // Load license data function pagelayer_pro_load_license($parent = 0){ global $pagelayer, $lic_resp; $license_field = 'pagelayer_license'; $license_api_url = PAGELAYER_PRO_API; // Save license if(!empty($parent) && is_string($parent) && strlen($parent) > 5){ $lic['license'] = $parent; // Load license of Soft Pro }elseif(!empty($parent)){ $license_field = 'softaculous_pro_license'; $lic = get_option('softaculous_pro_license', []); // My license }else{ $lic = get_option($license_field, []); } // Loaded license is a Soft Pro if(!empty($lic['license']) && preg_match('/^softwp/is', $lic['license'])){ $license_field = 'softaculous_pro_license'; $license_api_url = 'https://a.softaculous.com/softwp/'; $prods = apply_filters('softaculous_pro_products', []); }else{ $prods = []; } if(empty($lic['last_update'])){ $lic['last_update'] = time() - 86600; } // Update license details as well if(!empty($lic) && !empty($lic['license']) && (time() - @$lic['last_update']) >= 86400){ $url = $license_api_url.'/license.php?license='.$lic['license'].'&prods='.implode(',', $prods).'&url='.rawurlencode(site_url()); $resp = wp_remote_get($url); $lic_resp = $resp; //Did we get a response ? if(is_array($resp)){ $tosave = json_decode($resp['body'], true); //Is it the license ? if(!empty($tosave['license'])){ $tosave['last_update'] = time(); update_option($license_field, $tosave); $lic = $tosave; } } } // If the license is Free or Expired check for Softaculous Pro license if(empty($lic) || empty($lic['active'])){ if(function_exists('softaculous_pro_load_license')){ $softaculous_license = softaculous_pro_load_license(); if(!empty($softaculous_license['license']) && (!empty($softaculous_license['active']) || empty($lic['license'])) ){ $lic = $softaculous_license; } }elseif(empty($parent)){ $lic = get_option('softaculous_pro_license', []); if(!empty($lic)){ return pagelayer_pro_load_license(1); } } } if(!empty($lic['license'])){ $pagelayer->license = $lic; } } add_filter('softaculous_pro_products', 'pagelayer_softaculous_pro_products', 10, 1); function pagelayer_softaculous_pro_products($r = []){ $r['pagelayer'] = 'pagelayer'; return $r; } // Add our license key if ANY function pagelayer_pro_updater_filter_args($queryArgs) { global $pagelayer; if ( !empty($pagelayer->license['license']) ) { $queryArgs['license'] = $pagelayer->license['license']; } $queryArgs['url'] = rawurlencode(site_url()); return $queryArgs; } // Handle the Check for update link and ask to install license key function pagelayer_pro_updater_check_link($final_link){ global $pagelayer; if(empty($pagelayer->license['license'])){ return '<a href="'.admin_url('admin.php?page=pagelayer_license').'">Install Pagelayer Pro License Key</a>'; } return $final_link; } function pagelayer_pro_is_network_active($pluign){ $is_network_wide = false; // Handling network site if(!is_multisite()){ return $is_network_wide; } $_tmp_plugins = get_site_option('active_sitewide_plugins'); if(!empty($_tmp_plugins) && preg_grep('/.*\/'.$pluign.'\.php$/', array_keys($_tmp_plugins))){ $is_network_wide = true; } return $is_network_wide; } // Prevent update of pagelayer free function pagelayer_pro_get_free_version_num(){ if(defined('PAGELAYER_VERSION')){ return PAGELAYER_VERSION; } // In case of pagelayer deactive return pagelayer_pro_file_get_version_num('pagelayer/pagelayer.php'); } // Prevent update of pagelayer free function pagelayer_pro_file_get_version_num($plugin){ $file = WP_PLUGIN_DIR . '/'.$plugin; if(!file_exists($file)){ return false; } // In case of pagelayer deactive include_once(ABSPATH . 'wp-admin/includes/plugin.php'); $plugin_data = get_plugin_data($file); if(empty($plugin_data)){ return false; } return $plugin_data['Version']; } // Prevent update of pagelayer free function pagelayer_pro_disable_manual_update_for_plugin($transient){ $plugin = 'pagelayer/pagelayer.php'; // Is update available? if(!isset($transient->response) || !isset($transient->response[$plugin])){ return $transient; } $free_version = pagelayer_pro_get_free_version_num(); $pro_version = PAGELAYER_PRO_VERSION; if(!empty($GLOBALS['pagelayer_pro_is_upgraded'])){ $pro_version = pagelayer_pro_file_get_version_num('pagelayer-pro/pagelayer-pro.php'); } // Update the Pagelayer version to the equivalent of Pro version if(!empty($pro_version) && version_compare($free_version, $pro_version, '<')){ $transient->response[$plugin]->new_version = $pro_version; $transient->response[$plugin]->package = 'https://downloads.wordpress.org/plugin/pagelayer.'.$pro_version.'.zip'; }else{ unset($transient->response[$plugin]); } return $transient; } // Auto update free version after update pro version function pagelayer_pro_update_free_after_pro($upgrader_object, $options){ // Check if the action is an update for the plugins if($options['action'] != 'update' || $options['type'] != 'plugin'){ return; } // Define the slugs for the free and pro plugins $free_slug = 'pagelayer/pagelayer.php'; $pro_slug = 'pagelayer-pro/pagelayer-pro.php'; // Check if the pro plugin is in the list of updated plugins if( (isset($options['plugins']) && in_array($pro_slug, $options['plugins']) && !in_array($free_slug, $options['plugins'])) || (isset($options['plugin']) && $pro_slug == $options['plugin']) ){ // Trigger the update for the free plugin $current_version = pagelayer_pro_get_free_version_num(); if(empty($current_version)){ return; } $GLOBALS['pagelayer_pro_is_upgraded'] = true; // This will set the 'update_plugins' transient again wp_update_plugins(); // Check for updates for the free plugin $update_plugins = get_site_transient('update_plugins'); if(empty($update_plugins) || !isset($update_plugins->response[$free_slug]) || version_compare($update_plugins->response[$free_slug]->new_version, $current_version, '<=')){ return; } include_once(ABSPATH . 'wp-admin/includes/file.php'); include_once(ABSPATH . 'wp-admin/includes/misc.php'); require_once(ABSPATH . 'wp-admin/includes/plugin.php'); require_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'); $skin = wp_doing_ajax()? new WP_Ajax_Upgrader_Skin() : null; if(!empty($options['silent_skin'])){ class Pagelayer_Silent_Upgrader_Skin extends WP_Upgrader_Skin { public function feedback($string, ...$args){} public function header(){} public function footer(){} public function error($errors){} public function before(){} public function after(){} } $skin = new Pagelayer_Silent_Upgrader_Skin(); } $upgrader = new Plugin_Upgrader($skin); $upgraded = $upgrader->upgrade($free_slug); if(!is_wp_error($upgraded) && $upgraded){ // Re-active free plugins if( file_exists( WP_PLUGIN_DIR . '/'. $free_slug ) && is_plugin_inactive($free_slug) ){ activate_plugin($free_slug); // TODO for network } // Re-active pro plugins if( file_exists( WP_PLUGIN_DIR . '/'. $pro_slug ) && is_plugin_inactive($pro_slug) ){ activate_plugin($pro_slug); // TODO for network } } } } function pagelayer_pro_api_url($main_server = 0, $suffix = 'pagelayer'){ global $pagelayer; $r = array( 'https://s0.softaculous.com/a/softwp/', 'https://s1.softaculous.com/a/softwp/', 'https://s2.softaculous.com/a/softwp/', 'https://s3.softaculous.com/a/softwp/', 'https://s4.softaculous.com/a/softwp/', 'https://s5.softaculous.com/a/softwp/', 'https://s7.softaculous.com/a/softwp/', 'https://s8.softaculous.com/a/softwp/' ); $mirror = $r[array_rand($r)]; // If the license is newly issued, we need to fetch from API only if(!empty($main_server) || empty($pagelayer->license['last_edit']) || (!empty($pagelayer->license['last_edit']) && (time() - 3600) < $pagelayer->license['last_edit']) ){ $mirror = PAGELAYER_PRO_API; } if(!empty($suffix)){ $mirror = str_replace('/softwp', '/'.$suffix, $mirror); } return $mirror; } function pagelayer_pro_plugins_expired($plugins){ $plugins[] = 'Pagelayer'; return $plugins; } function pagelayer_pro_expiry_notice(){ global $pagelayer; // The combined notice for all Softaculous plugin to show that the license has expired $dismissed_at = get_option('softaculous_expired_licenses', 0); $expired_plugins = apply_filters('softaculous_expired_licenses', []); if( !empty($expired_plugins) && is_array($expired_plugins) && !defined('SOFTACULOUS_EXPIRY_LICENSES') && (empty($dismissed_at) || ($dismissed_at + WEEK_IN_SECONDS) < time()) ){ define('SOFTACULOUS_EXPIRY_LICENSES', true); // To make sure other plugins don't return a Notice echo '<div class="notice notice-error is-dismissible" id="pagelayer-pro-expiry-notice"> <p>'.sprintf(__('Your SoftWP license has %1$sexpired%2$s. Please renew it to continue receiving uninterrupted updates and support for %3$s.', 'pagelayer-pro'), '<font style="color:red;"><b>', '</b></font>', esc_html(implode(', ', $expired_plugins)) ). '</p> </div>'; wp_register_script('pagelayer-pro-expiry-notice', '', ['jquery'], PAGELAYER_PRO_VERSION, true); wp_enqueue_script('pagelayer-pro-expiry-notice'); wp_add_inline_script('pagelayer-pro-expiry-notice', ' jQuery(document).ready(function(){ jQuery("#pagelayer-pro-expiry-notice").on("click", ".notice-dismiss", function(e){ e.preventDefault(); let target = jQuery(e.target); let jEle = target.closest("#pagelayer-pro-expiry-notice"); jEle.slideUp(); jQuery.post("'.admin_url('admin-ajax.php').'", { security : "'.wp_create_nonce('pagelayer_expiry_notice').'", action: "pagelayer_pro_dismiss_expired_licenses", }, function(res){ if(!res["success"]){ alert(res["data"]); } }).fail(function(data){ alert("There seems to be some issue dismissing this alert"); }); }); })'); } } pagelayer-init.php 0000644 00000015007 15103567077 0010205 0 ustar 00 <?php ////////////////////////////////////////////////////////////// //=========================================================== // pagelayer-init.php //=========================================================== // PAGELAYER // Inspired by the DESIRE to be the BEST OF ALL // ---------------------------------------------------------- // Started by: Pulkit Gupta // Date: 23rd Jan 2017 // Time: 23:00 hrs // Site: http://pagelayer.com/wordpress (PAGELAYER) // ---------------------------------------------------------- // Please Read the Terms of use at http://pagelayer.com/tos // ---------------------------------------------------------- //=========================================================== // (c)Pagelayer Team //=========================================================== ////////////////////////////////////////////////////////////// // Are we being accessed directly ? if(!defined('PAGELAYER_PRO_VERSION')) { exit('Hacking Attempt !'); } // Ok so we are now ready to go register_activation_hook(PAGELAYER_PRO_FILE, 'pagelayer_pro_activation'); // Prevent update of pagelayer free // This also work for auto update add_filter('site_transient_update_plugins', 'pagelayer_pro_disable_manual_update_for_plugin'); add_filter('pre_site_transient_update_plugins', 'pagelayer_pro_disable_manual_update_for_plugin'); // Auto update free version after update pro version add_action('upgrader_process_complete', 'pagelayer_pro_update_free_after_pro', 10, 2); add_action('plugins_loaded', 'pagelayer_pro_load_plugin'); function pagelayer_pro_load_plugin(){ global $pagelayer; if(empty($pagelayer)){ $pagelayer = new stdClass(); } // Load license pagelayer_pro_load_license(); // Check if the installed version is outdated pagelayer_pro_update_check(); // Check for updates include_once(PAGELAYER_PRO_DIR.'/main/plugin-update-checker.php'); $pagelayer_updater = Pagelayer_PucFactory::buildUpdateChecker(pagelayer_pro_api_url().'updates.php?version='.PAGELAYER_PRO_VERSION, PAGELAYER_PRO_FILE); // Add the license key to query arguments $pagelayer_updater->addQueryArgFilter('pagelayer_pro_updater_filter_args'); // Show the text to install the license key add_filter('puc_manual_final_check_link-pagelayer-pro', 'pagelayer_pro_updater_check_link', 10, 1); // Nag informing the user to install the free version. if(current_user_can('activate_plugins')){ add_action('admin_notices', 'pagelayer_pro_free_version_nag', 9); add_action('admin_menu', 'pagelayer_pro_add_menu', 9); } $is_network_wide = pagelayer_pro_is_network_active('pagelayer-pro'); $_pl_version = get_option('pagelayer_version'); $req_free_update = !empty($_pl_version) && version_compare($_pl_version, '1.8.7', '<'); if($is_network_wide){ $pl_free_installed = get_site_option('pagelayer_free_installed'); }else{ $pl_free_installed = get_option('pagelayer_free_installed'); } if(!empty($pl_free_installed)){ return; } // Include the necessary stuff include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); include_once(ABSPATH . 'wp-admin/includes/plugin.php'); include_once(ABSPATH . 'wp-admin/includes/file.php'); if( file_exists( WP_PLUGIN_DIR . '/pagelayer/pagelayer.php' ) && is_plugin_inactive( '/pagelayer/pagelayer.php' ) && empty($req_free_update) ) { if($is_network_wide){ update_site_option('pagelayer_free_installed', time()); }else{ update_option('pagelayer_free_installed', time()); } activate_plugin('/pagelayer/pagelayer.php', '', $is_network_wide); remove_action('admin_notices', 'pagelayer_pro_free_version_nag', 9); remove_action('admin_menu', 'pagelayer_pro_add_menu', 9); return; } // Includes necessary for Plugin_Upgrader and Plugin_Installer_Skin include_once(ABSPATH . 'wp-admin/includes/misc.php'); include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'); // Filter to prevent the activate text add_filter('install_plugin_complete_actions', 'pagelayer_pro_prevent_activation_text', 10, 3); $upgrader = new Plugin_Upgrader(new WP_Ajax_Upgrader_Skin()); // Upgrade the plugin to the latest version of free already installed. if(!empty($req_free_update) && file_exists( WP_PLUGIN_DIR . '/pagelayer/pagelayer.php' )){ $installed = $upgrader->upgrade('pagelayer/pagelayer.php'); }else{ $installed = $upgrader->install('https://downloads.wordpress.org/plugin/pagelayer.zip'); } if(!is_wp_error($installed) && $installed){ if($is_network_wide){ update_site_option('pagelayer_free_installed', time()); }else{ update_option('pagelayer_free_installed', time()); } activate_plugin('pagelayer/pagelayer.php', '', $is_network_wide); remove_action('admin_notices', 'pagelayer_pro_free_version_nag', 9); remove_action('admin_menu', 'pagelayer_pro_add_menu', 9); //wp_safe_redirect(admin_url('/')); } } // Do not shows the activation text if function pagelayer_pro_prevent_activation_text($install_actions, $api, $plugin_file){ if($plugin_file == 'pagelayer/pagelayer.php'){ return array(); } return $install_actions; } function pagelayer_pro_free_version_nag(){ $pl_version = get_option('pagelayer_version'); $lower_version = __('You have not installed/activated the free version of Pagelayer. Pagelayer Pro depends on the free version, so you must install/activate it first in order to use Pagelayer Pro.'); $btn_text = __('Install / Activate Now'); if(!empty($pl_version) && version_compare($pl_version, '1.8.6', '<')){ $lower_version = __('You are using an older version of the free version of Pagelayer, please update Pagelayer to work without any issues'); $btn_text = __('Update Now'); } echo '<div class="notice notice-error"> <p style="font-size:16px;">'.esc_html($lower_version).' <a href="'.admin_url('plugin-install.php?s=pagelayer&tab=search').'" class="button button-primary">'.esc_html($btn_text).'</a></p> </div>'; } function pagelayer_pro_add_menu(){ add_menu_page('Pagelayer', 'Pagelayer Pro', 'activate_plugins', 'pagelayer-pro', 'pagelayer_pro_menu_page', PAGELAYER_PRO_URL.'/images/pagelayer-logo-19.png'); } function pagelayer_pro_menu_page(){ echo '<div style="color: #333;padding: 50px;text-align: center;"> <h1 style="font-size: 2em;margin-bottom: 10px;">Pagelayer Free version is not installed / outdated!</h> <p style=" font-size: 16px;margin-bottom: 20px; font-weight:400;">Pagelayer Pro depends on the free version of Pagelayer, so you need to install / update the free version first.</p> <a href="'.admin_url('plugin-install.php?s=pagelayer&tab=search').'" style="text-decoration: none;font-size:16px;">Install/Update Now</a> </div>'; } custom_fonts.php 0000644 00000022072 15103567077 0010016 0 ustar 00 <?php ////////////////////////////////////////////////////////////// //=========================================================== // custom_fonts.php //=========================================================== // PAGELAYER // Inspired by the DESIRE to be the BEST OF ALL // ---------------------------------------------------------- // Started by: Pulkit Gupta // Date: 23rd Jan 2017 // Time: 23:00 hrs // Site: http://pagelayer.com/wordpress (PAGELAYER) // ---------------------------------------------------------- // Please Read the Terms of use at http://pagelayer.com/tos // ---------------------------------------------------------- //=========================================================== // (c)Pagelayer Team //=========================================================== ////////////////////////////////////////////////////////////// // Are we being accessed directly ? if(!defined('PAGELAYER_PRO_VERSION')) { exit('Hacking Attempt !'); } // This function will handle the custom fonts pages in Pagelayer add_action('init', 'pagelayer_custom_fonts_page', 9999); function pagelayer_custom_fonts_page() { global $pagelayer; // Custom fonts supports $supports = array( 'title', // post title ); // Add custom fonts lables $labels = array( 'name' => _x('Custom Fonts', 'plural'), 'singular_name' => _x('Custom Font', 'singular'), 'menu_name' => _x('Custom Fonts', 'admin menu'), 'name_admin_bar' => _x('Custom Fonts', 'admin bar'), 'add_new' => _x('Add New', 'Add'), 'add_new_item' => __('Add New'), 'new_item' => __('New Font'), 'edit_item' => __('Edit Font'), 'view_item' => __('View Font'), 'all_items' => __('All Fonts'), 'search_items' => __('Search Fonts'), 'not_found' => __('No Pagelayer custom fonts found'), ); $args = array( 'supports' => $supports, 'labels' => $labels, 'public' => false, 'show_in_menu' => false, 'publicly_queryable' => true, 'show_ui' => true, 'exclude_from_search' => true, 'show_in_nav_menus' => false, 'has_archive' => false, 'rewrite' => false, ); // Register custom post type register_post_type(PAGELAYER_FONT_POST_TYPE, $args); remove_post_type_support( PAGELAYER_FONT_POST_TYPE, 'editor'); } // Removing extra columns add_filter( 'manage_'.PAGELAYER_FONT_POST_TYPE.'_posts_columns', 'pagelayer_add_custom_columns' ); function pagelayer_add_custom_columns($columns){ unset( $columns['author'] ); unset( $columns['date'] ); $columns['pl-preview'] = __('Preview'); return $columns; } // Adding preview column data add_action( 'manage_'.PAGELAYER_FONT_POST_TYPE.'_posts_custom_column' , 'pagelayer_add_custom_columns_data', 10, 2 ); function pagelayer_add_custom_columns_data( $column, $post_id ){ if($column == __('pl-preview')){ $font_link = get_post_meta( $post_id, 'pagelayer_font_link', true ); echo '<style>@font-face { font-family: "'.get_the_title($post_id).'"; src: url("'.wp_unslash( $font_link ).'"); }</style>'; echo '<span style="font-family:\''.get_the_title($post_id).'\'; font-size:16px" >Preview of the CUSTOM font</span>'; } } // Removing row actions add_filter( 'post_row_actions', 'pagelayer_remove_row_actions', 10, 1 ); function pagelayer_remove_row_actions( $actions ){ if( get_post_type() === PAGELAYER_FONT_POST_TYPE ){ foreach($actions as $action => $html){ if($action == 'edit' || $action == 'trash' || $action == 'clone' || $action == 'untrash' || $action == 'delete'){ continue; }else{ unset($actions[$action]); } } } return $actions; } // Removing Screen options add_filter('screen_options_show_screen', 'pagelayer_remove_screen_options', 1, 1); function pagelayer_remove_screen_options($show_screen) { if(get_post_type() == PAGELAYER_FONT_POST_TYPE) { return false; } return $show_screen; } // Removing all other metaboxes. add_action('admin_init', function() {pagelayer_remove_all_metaboxes(PAGELAYER_FONT_POST_TYPE);}); function pagelayer_remove_all_metaboxes($type) { add_filter("get_user_option_meta-box-order_{$type}", function() use($type) { global $wp_meta_boxes; $publishbox = $wp_meta_boxes[$type]['side']['core']['submitdiv']; $fontsBox = $wp_meta_boxes[$type]['normal']['default']['pl-fonts-link-box']; $wp_meta_boxes[$type] = array( 'side' => array( 'core' => array( 'submitdiv' => $publishbox ) ), 'normal' => array( 'default' => array( 'pl-fonts-link-box' => $fontsBox ) ) ); return array(); }, PHP_INT_MAX); } // Hiding extra options of publish metabox add_action( 'admin_head', 'pagelayer_hide_publish_options' ); function pagelayer_hide_publish_options() { if(get_post_type() == PAGELAYER_FONT_POST_TYPE){ echo '<style>.submitbox #minor-publishing{ display: none; }</style>'; } } // Adding source metabox add_action('add_meta_boxes', 'pagelayer_add_meta_box'); function pagelayer_add_meta_box(){ add_meta_box( 'pl-fonts-link-box', _x('Source', 'font source'), 'pagelayer_font_link_metabox', PAGELAYER_FONT_POST_TYPE, 'normal', 'default', null); } function pagelayer_font_link_metabox($object){ wp_enqueue_media(); wp_nonce_field('pagelayer-font-post', 'pagelayer'); $link = get_post_meta($object->ID, 'pagelayer_font_link', true); ?> <div> <table width="100%"> <tr> <th valign="top" style="text-align:right; padding-right:20px; width:20%;"><?php echo __('Font File');?> : </th> <td> <div> <input type="text" class="pagelayer_font_input" id="pl_font_link" name="pagelayer_font_link" onclick="fontUpload(event)" style="width:70%" value="<?php echo wp_unslash($link); ?>" autocomplete="false" readonly="true"/> <button type="button" class="button button-light" onclick="fontUpload(event)">Upload Font</button> </div> </td> </tr> </table> </div> <script> window.onload = function(){ jQuery('#submitdiv').on('click', '#publish', function(e){ if(jQuery('#title').val()==''){ alert('Please insert title of the page'); return false; }else{ if(jQuery('#pl_font_link').val()==''){ alert('Please insert link of the font'); return false; }else{ return true; } } }); } function fontUpload(e){ var allowed_mime_type = ['.ttf', '.woff', '.woff2','.otf']; var allClear = false; var custom_uploader = wp.media({ title: 'Upload Font', library : { type : 'font' }, button: { text: 'Select Font' // button label text }, multiple: false }).on('select', function() { // it also has "open" and "close" events var attachment = custom_uploader.state().get('selection').first().toJSON(); for(var i=0; i<allowed_mime_type.length; i++){ if(attachment['filename'].indexOf(allowed_mime_type[i]) != -1){ allClear=true; break; } } if(allClear){ jQuery('.pagelayer_font_input').val(attachment['url']); }else{ alert('Kindly insert a correct font file. Allowed font file types are (otf|ttf|woff|woff2)'); } }).open(); } </script> <?php } // Saving source metabox content add_action('save_post', 'pagelayer_save_source_meta_box', 10, 3); function pagelayer_save_source_meta_box($post_id, $post, $update){ if(PAGELAYER_FONT_POST_TYPE != $post->post_type){ return $post_id; } // DO an admin referrer check if(!empty($_POST)){ check_admin_referer('pagelayer-font-post', 'pagelayer'); }else{ return $post_id; } $meta_box_link_value = ''; if(isset($_POST['pagelayer_font_link'])){ $meta_box_link_value = wp_unslash($_POST['pagelayer_font_link']); } update_post_meta($post_id, 'pagelayer_font_link', $meta_box_link_value ); } // Adding custom mime type add_filter('upload_mimes', 'pagelayer_custom_mime_types', 1, 1); function pagelayer_custom_mime_types($mime_types = array()){ global $pagelayer; forEach($pagelayer->allowed_mime_type as $key => $value){ $mime_types[$key]=$value; } return $mime_types; } // Adding custom mime type add_filter( 'mime_types', 'pagelayer_mime_types' ); function pagelayer_mime_types($default_mimes){ global $pagelayer; forEach($pagelayer->allowed_mime_type as $key => $value){ $default_mimes[$key]=$value; } return $default_mimes; } // Adding custom mime type add_filter( 'wp_check_filetype_and_ext', 'pagelayer_check_filetype_and_ext', 10, 5 ); function pagelayer_check_filetype_and_ext( $types, $file, $filename, $mimes, $real_mime = false ){ global $pagelayer; forEach($pagelayer->allowed_mime_type as $key => $value){ if ( false !== strpos( $filename, '.'.$key ) ) { $types['ext'] = $key; $types['type'] = $value; } } return $types; } // Removing notification. add_filter( 'post_updated_messages', 'pagelayer_delete_notification' ); function pagelayer_delete_notification( $messages ){ if(get_post_type() == PAGELAYER_FONT_POST_TYPE){ unset($messages['post'][1]); unset($messages['post'][6]); return $messages; } } premium-woocommerce.php 0000644 00000047373 15103567077 0011301 0 ustar 00 <?php ////////////////////////////////////////////////////////////// //=========================================================== // PAGELAYER // Inspired by the DESIRE to be the BEST OF ALL // ---------------------------------------------------------- // Started by: Pulkit Gupta // Date: 23rd Jan 2017 // Time: 23:00 hrs // Site: http://pagelayer.com/wordpress (PAGELAYER) // ---------------------------------------------------------- // Please Read the Terms of use at http://pagelayer.com/tos // ---------------------------------------------------------- //=========================================================== // (c)Pagelayer Team //=========================================================== ////////////////////////////////////////////////////////////// // Are we being accessed directly ? if(!defined('PAGELAYER_PRO_VERSION')) { exit('Hacking Attempt !'); } add_action( 'wp', 'pagelayer_pro_wc_customization' ); function pagelayer_pro_wc_customization(){ $options = pagelayer_get_customize_options(); if(!is_product()){ return; } if(!empty($options['woo_enable_product_zoom'] ) && $options['woo_enable_product_zoom'] == 'disable'){ remove_theme_support( 'wc-product-gallery-zoom' ); } if(!empty($options['woo_enable_product_zoom'] ) && $options['woo_enable_product_zoom'] == 'enable'){ add_theme_support( 'wc-product-gallery-zoom' ); } // Disable Product description if(!empty($options['woo_disable_product_desc'])){ remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 ); } // Disable up sell products if(!empty($options['woo_disable_upsells'])){ remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 ); } // Disable Related Products if(!empty($options['woo_disable_related_product'])){ remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 ); } } // WooCommerce Checkout Fields Hook add_filter('woocommerce_checkout_fields','pagelayer_wc_checkout_fields_no_label',10); function pagelayer_wc_checkout_fields_no_label($fields) { $options = pagelayer_get_customize_options(); if(empty($options['woo_checkout_label_placeholder'])){ return $fields; } // loop by category foreach ($fields as $category => $value) { // loop by fields foreach ($fields[$category] as $field => $property) { //Add label as placeholder if( $fields[$category][$field]['required'] == true ){ //Add required * in placeholder $fields[$category][$field]['placeholder'] = $fields[$category][$field]['label'] .' *'; }else{ //Add (optional) in placeholder $fields[$category][$field]['placeholder'] = $fields[$category][$field]['label'] .'(optional)'; } // remove label property unset($fields[$category][$field]['label']); } } return $fields; } // Disable sale flash add_filter( 'woocommerce_sale_flash', 'pagelayer_woo_sale_flash', 10, 3 ); function pagelayer_woo_sale_flash( $html, $post, $product ) { $options = pagelayer_get_customize_options(); if(empty($options['woo_disable_onsale'])){ return $html; } return ''; } // Change number of related product on single page add_filter( 'woocommerce_output_related_products_args', 'pagelayer_single_product_number_related_products', 99 ); function pagelayer_single_product_number_related_products( $args ) { $options = pagelayer_get_customize_options(); if(empty($options['woo_number_related_product'])){ return $args; } $args['posts_per_page'] = $options['woo_number_related_product']; // # Of related products if(!empty($options['woo_col_related_product'])){ $args['columns'] = $options['woo_col_related_product']; } return $args; } add_filter( 'pagelayer_wc_styles_array', 'pagelayer_pro_wc_styles_array'); function pagelayer_pro_wc_styles_array($woo_styles){ $styles = array( 'woo_shop_pagi_bg_color' => array( '.woocommerce .woocommerce-pagination ul li a, .woocommerce .woocommerce-pagination a.page-numbers' => 'background-color: {{color}}', ), 'woo_shop_pagi_color' => array( '.woocommerce .woocommerce-pagination ul li a, .woocommerce .woocommerce-pagination a.page-numbers' => 'color: {{color}}', ), 'woo_shop_pagi_borderwidth' => array( '.woocommerce .woocommerce-pagination ul li a, .woocommerce .woocommerce-pagination a.page-numbers' => 'border: {{val}}px solid', '.woocommerce .woocommerce-pagination ul li a:focus, .woocommerce .woocommerce-pagination ul li a:hover, .woocommerce .woocommerce-pagination ul li span.current, .woocommerce .woocommerce-pagination a.page-numbers:hover, .woocommerce .woocommerce-pagination a.page-numbers:focus, .woocommerce .woocommerce-pagination span.page-numbers.current' => 'border: {{val}}px solid', ), 'woo_shop_pagi_border_color' => array( '.woocommerce .woocommerce-pagination ul li a, .woocommerce .woocommerce-pagination a.page-numbers' => 'border-color: {{color}}', ), 'woo_shop_pagi_borderradius' => array( '.woocommerce .woocommerce-pagination ul li a, .woocommerce .woocommerce-pagination a.page-numbers' => 'border-radius: {{val}}px', '.woocommerce .woocommerce-pagination ul li a:focus, .woocommerce .woocommerce-pagination ul li a:hover, .woocommerce .woocommerce-pagination ul li span.current, .woocommerce .woocommerce-pagination a.page-numbers:hover, .woocommerce .woocommerce-pagination a.page-numbers:focus, .woocommerce .woocommerce-pagination span.page-numbers.current' => 'border-radius: {{val}}px', ), 'woo_shop_pagi_bg_hover_color' => array( '.woocommerce .woocommerce-pagination ul li a:focus, .woocommerce .woocommerce-pagination ul li a:hover, .woocommerce .woocommerce-pagination ul li span.current, .woocommerce .woocommerce-pagination a.page-numbers:hover, .woocommerce .woocommerce-pagination a.page-numbers:focus, .woocommerce .woocommerce-pagination span.page-numbers.current' => 'background-color: {{color}}', ), 'woo_shop_pagi_hover_color' => array( '.woocommerce .woocommerce-pagination ul li a:focus, .woocommerce .woocommerce-pagination ul li a:hover, .woocommerce .woocommerce-pagination ul li span.current, .woocommerce .woocommerce-pagination a.page-numbers:hover, .woocommerce .woocommerce-pagination a.page-numbers:focus, .woocommerce .woocommerce-pagination span.page-numbers.current' => 'color: {{color}}', ), 'woo_shop_pagi_hover_border_color' => array( '.woocommerce .woocommerce-pagination ul li a:focus, .woocommerce .woocommerce-pagination ul li a:hover, .woocommerce .woocommerce-pagination ul li span.current, .woocommerce .woocommerce-pagination a.page-numbers:hover, .woocommerce .woocommerce-pagination a.page-numbers:focus, .woocommerce .woocommerce-pagination span.page-numbers.current' => 'border-color: {{color}}', ), 'woo_onsale_bg_color' => array( '.woocommerce .product span.onsale' => 'background-color:{{color}};', ), 'woo_onsale_color' => array( '.woocommerce .product span.onsale' => 'color:{{color}};', ), 'woo_onsale_radius' => array( '.woocommerce .product span.onsale' => 'border-radius:{{color}}%;', ), 'woo_product_breadcrumb_color' => array( '.single-product .woocommerce-breadcrumb, .single-product .woocommerce-breadcrumb *' => 'color: {{color}}' ), 'woo_product_description_color' => array( '.single-product div.product .woocommerce-product-details__short-description, .single-product div.product .woocommerce-product-details__short-description p, .single-product div.product .product_meta, .single-product div.product .entry-content' => 'color: {{color}}' ), 'woo_product_price_color' => array( '.single-product div.product p.price, .single-product div.product span.price' => 'color: {{color}}' ), 'woo_product_title_color' => array( '.single-product .product .entry-title' => 'color: {{color}}' ) ); return array_merge( $woo_styles, $styles ); } add_filter( 'customize_register', 'pagelayer_pro_customizer_get_fields', 11); function pagelayer_pro_customizer_get_fields($wp_customize){ // General Setting $wp_customize->add_setting( 'pagelayer_lable_onsale', array( 'capability' => 'edit_theme_options', )); $wp_customize->add_control( new Pagelayer_Customize_Control( $wp_customize, 'pagelayer_lable_onsale', array( 'type' => 'hidden', 'section' => 'pgl_woo_general', 'description' => __('<div class="pagelayer-customize-heading"><div>Onsale Style</div></div>', 'pagelayer'), 'li_class' => 'pagelayer-accordion-tab', 'priority' => 2 ) )); $wp_customize->add_setting( 'pagelayer_customizer_options[woo_disable_onsale]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh', ) ); $wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, 'pagelayer_customizer_options[woo_disable_onsale]', array( 'type' => 'checkbox', 'label' => __('Disable Sale Notification'), 'section' => 'pgl_woo_general', 'priority' => 2 )) ); // Adds Customizer settings $wp_customize->add_setting( 'pagelayer_customizer_options[woo_onsale_color]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh' ) ); $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_onsale_color]', array( 'label' => __('Sale Text Color'), 'section' => 'pgl_woo_general', 'priority' => 3 ) ) ); // Adds Customizer settings $wp_customize->add_setting( 'pagelayer_customizer_options[woo_onsale_bg_color]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh', ) ); $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_onsale_bg_color]', array( 'label' => __('Sale Background'), 'section' => 'pgl_woo_general', 'priority' => 4 ) ) ); // General Setting pagelayer_register_slider_custoze_control($wp_customize, array( 'control' => 'pagelayer_customizer_options[woo_onsale_radius]', 'section' => 'pgl_woo_general', 'setting_type' => 'option', 'label' => __( 'Sale Notification Radius'), 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'priority' => 4, 'input_attrs' => array( 'min' => 0, 'max' => 100, 'step' => 1, ) )); pagelayer_register_slider_custoze_control($wp_customize, array( 'control' => 'pagelayer_customizer_options[woo_product_image_width]', 'section' => 'pgl_woo_single_product', 'setting_type' => 'option', 'label' => __('Image Width'), 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'priority' => 3, 'input_attrs' => array( 'min' => 0, 'max' => 70, 'step' => 1, ) )); $wp_customize->add_setting( 'pagelayer_customizer_options[woo_enable_product_zoom]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh', ) ); $wp_customize->add_control( 'pagelayer_customizer_options[woo_enable_product_zoom]', array( 'type' => 'select', 'label' => __('Image Zoom Effect'), 'section' => 'pgl_woo_single_product', 'priority' => 4, 'choices' => array( '' => __('Default'), 'enable' => __('Enable'), 'disable' => __('Disable'), ) ) ); $wp_customize->add_setting( 'pagelayer_customizer_options[woo_disable_product_desc]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh', ) ); $wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, 'pagelayer_customizer_options[woo_disable_product_desc]', array( 'type' => 'checkbox', 'label' => __('Hide Products Description'), 'section' => 'pgl_woo_single_product', 'priority' => 5 )) ); $wp_customize->add_setting( 'pagelayer_customizer_options[woo_disable_upsells]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh', ) ); $wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, 'pagelayer_customizer_options[woo_disable_upsells]', array( 'type' => 'checkbox', 'label' => __('Disable Products Up Sells'), 'section' => 'pgl_woo_single_product', 'priority' => 6 )) ); $wp_customize->add_setting( 'pagelayer_customizer_options[woo_disable_related_product]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh', ) ); $wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, 'pagelayer_customizer_options[woo_disable_related_product]', array( 'type' => 'checkbox', 'label' => __('Disable Related Products'), 'section' => 'pgl_woo_single_product', 'priority' => 7 )) ); pagelayer_register_slider_custoze_control($wp_customize, array( 'control' => 'pagelayer_customizer_options[woo_number_related_product]', 'section' => 'pgl_woo_single_product', 'setting_type' => 'option', 'label' => __('No. of Related Products'), 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'priority' => 8, 'input_attrs' => array( 'min' => 1, 'max' => 10, 'step' => 1, ), )); pagelayer_register_slider_custoze_control($wp_customize, array( 'control' => 'pagelayer_customizer_options[woo_col_related_product]', 'section' => 'pgl_woo_single_product', 'setting_type' => 'option', 'label' => __('Related Products columns'), 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'priority' => 8, 'input_attrs' => array( 'min' => 1, 'max' => 6, 'step' => 1, ), )); $wp_customize->add_setting( 'pagelayer_customizer_options[woo_product_title_color]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh' ) ); $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_product_title_color]', array( 'label' => __('Title Color'), 'section' => 'pgl_woo_single_product', 'priority' => 9 )) ); $wp_customize->add_setting( 'pagelayer_customizer_options[woo_product_price_color]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh' ) ); $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_product_price_color]', array( 'label' => __('Price Color'), 'section' => 'pgl_woo_single_product', 'priority' => 10 )) ); $wp_customize->add_setting( 'pagelayer_customizer_options[woo_product_description_color]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh' ) ); $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_product_description_color]', array( 'label' => __('Description Color'), 'section' => 'pgl_woo_single_product', 'priority' => 11 )) ); $wp_customize->add_setting( 'pagelayer_customizer_options[woo_product_breadcrumb_color]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh' ) ); $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_product_breadcrumb_color]', array( 'label' => __('Breadcrumb Color'), 'section' => 'pgl_woo_single_product', 'priority' => 12 )) ); $wp_customize->add_setting( 'pagelayer_customizer_options[woo_checkout_label_placeholder]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh', ) ); $wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, 'pagelayer_customizer_options[woo_checkout_label_placeholder]', array( 'type' => 'checkbox', 'label' => __('Show Label as Placeholder'), 'section' => 'pgl_woo_checkout', 'priority' => 4 )) ); // Shop page settings $wp_customize->add_setting( 'pagelayer_lable_shop_pagi', array( 'capability' => 'edit_theme_options', )); $wp_customize->add_control( new Pagelayer_Customize_Control( $wp_customize, 'pagelayer_lable_shop_pagi', array( 'type' => 'hidden', 'section' => 'pgl_woo_product_catalog', 'description' => __('<div class="pagelayer-customize-heading"><div>Pagination Style</div></div>', 'pagelayer'), 'li_class' => 'pagelayer-accordion-tab', 'priority' => 11 ) )); $wp_customize->add_setting( 'pagelayer_customizer_options[woo_shop_pagi_bg_color]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh' ) ); $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_shop_pagi_bg_color]', array( 'label' => __('Background Color'), 'section' => 'pgl_woo_product_catalog', 'priority' => 11 )) ); $wp_customize->add_setting( 'pagelayer_customizer_options[woo_shop_pagi_bg_hover_color]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh' ) ); $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_shop_pagi_bg_hover_color]', array( 'label' => __('Background Hover Color'), 'section' => 'pgl_woo_product_catalog', 'priority' => 11 )) ); $wp_customize->add_setting( 'pagelayer_customizer_options[woo_shop_pagi_color]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh', ) ); $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_shop_pagi_color]', array( 'label' => __('Text Color'), 'section' => 'pgl_woo_product_catalog', 'priority' => 11 )) ); $wp_customize->add_setting( 'pagelayer_customizer_options[woo_shop_pagi_hover_color]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh', ) ); $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_shop_pagi_hover_color]', array( 'label' => __('Text Hover Color'), 'section' => 'pgl_woo_product_catalog', 'priority' => 11 )) ); $wp_customize->add_setting( 'pagelayer_customizer_options[woo_shop_pagi_border_color]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh', ) ); $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_shop_pagi_border_color]', array( 'label' => __('Border Color'), 'section' => 'pgl_woo_product_catalog', 'priority' => 11 )) ); $wp_customize->add_setting( 'pagelayer_customizer_options[woo_shop_pagi_hover_border_color]', array( 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh', ) ); $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_shop_pagi_hover_border_color]', array( 'label' => __('Border Hover Color'), 'section' => 'pgl_woo_product_catalog', 'priority' => 11 )) ); pagelayer_register_slider_custoze_control($wp_customize, array( 'control' => 'pagelayer_customizer_options[woo_shop_pagi_borderwidth]', 'section' => 'pgl_woo_product_catalog', 'setting_type' => 'option', 'label' => __('Pagination Border Width'), 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'absint', 'priority' => 11, 'input_attrs' => array( 'min' => 0, 'max' => 50, 'step' => 1, ), 'responsive' => 1, )); pagelayer_register_slider_custoze_control($wp_customize, array( 'control' => 'pagelayer_customizer_options[woo_shop_pagi_borderradius]', 'section' => 'pgl_woo_product_catalog', 'setting_type' => 'option', 'label' => __('Border Radius'), 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'absint', 'priority' => 11, 'input_attrs' => array( 'min' => 0, 'max' => 100, 'step' => 1, ), )); } template-builder.php 0000644 00000072633 15103567077 0010542 0 ustar 00 <?php ////////////////////////////////////////////////////////////// //=========================================================== // tampalte-builder.php //=========================================================== // PAGELAYER // Inspired by the DESIRE to be the BEST OF ALL // ---------------------------------------------------------- // Started by: Pulkit Gupta // Date: 23rd Jan 2017 // Time: 23:00 hrs // Site: http://pagelayer.com/wordpress (PAGELAYER) // ---------------------------------------------------------- // Please Read the Terms of use at http://pagelayer.com/tos // ---------------------------------------------------------- //=========================================================== // (c)Pagelayer Team //=========================================================== ////////////////////////////////////////////////////////////// // Are we being accessed directly ? if(!defined('PAGELAYER_PRO_VERSION')) { exit('Hacking Attempt !'); } // The function shows the page to add template function pagelayer_builder_template_wizard(){ global $pagelayer; if(!empty($_REQUEST['post'])){ $posts = get_posts([ 'post_type' => $pagelayer->builder['name'], 'post_status' => 'any', 'include' => (int) $_REQUEST['post'], ]); //print_r($posts); // Did we find it ? if(!empty($posts[0])){ $post = $posts[0]; $_post['id'] = $post->ID; $_post['type'] = get_post_meta($post->ID, 'pagelayer_template_type', true); $_post['conditions'] = get_post_meta( $post->ID, 'pagelayer_template_conditions', true ); $_post['post_title'] = $post->post_title; } } // Fill in defaults if nothing found if(empty($_post)){ $_post['id'] = 0; $_post['type'] = ''; $_post['post_title'] = ''; $_post['conditions'] = []; } ?> <style> .pagelayer-temp-search-sel-open{ float: right; font-size: 10px; padding: 0px; line-height: 20px; } .pagelayer-temp-search-sel-remove{ position: absolute; right: 20px; font-size: 11px; top: 10px; z-index: 10; } .pagelayer-temp-search-sel-span{ display: block; margin: 2px; cursor: pointer; box-sizing: border-box; border: 1px solid #dbdbdb; transition: all 0.3s; font-size: 13px; padding: 3px; } .pagelayer-temp-search-sel-span:hover{ border-color: #00A0D2; background-color: #3e8ef7; color: #ffffff; box-shadow: 0px 1px 1px #3e8ef7bf; } .pagelayer-temp-search-sel-span i{ font-size: 15px; line-height: 1em; padding: 3px; color: #555; transition: all 0.3s; vertical-align: middle; } .pagelayer-temp-search-sel-span:hover i{ color: #ffffff; } .pagelayer-temp-search-sel{ vertical-align: top } .pagelayer-temp-toggle{ cursor:pointer; } .pagelayer-temp-label{ display:block; margin-bottom:5px; } .pagelayer-temp-fields{ display:inline-block; position:relative; margin:0 3px; } .pagelayer-temp-condition{ border:1px solid #d0d0d0; margin-bottom:10px; } .pagelayer-temp-tab{ padding: 6px 10px; background: #d0d0d0; display: flow-root; } .pagelayer-temp-condition-div{ padding:10px; } .pagelayer-temp-hide{ display:none; } .pagelayer-temp-search-holder{ position:relative; display:inline-block; } .pagelayer-temp-search-div{ cursor: pointer; padding: 5px; border: solid 1px #d1d1d1; background: #fffffc; color: #333; vertical-align: middle; width: 126px; display: flex; /* min-width: 245px; border-radius: 4px; margin: 0 auto; position: absolute; top: 7px; */ } .pagelayer-temp-search-preview{ position: relative; margin-right: 5px; width: 100%; border: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } .pagelayer-temp-search-preview i{ padding-right: 5px; font-size: 19px; color: #666; vertical-align: middle; } .pagelayer-temp-search-name{ font-size: 13px; } .pagelayer-temp-search-selector{ position: absolute; z-index: 1000; border: 1px solid rgba(0,0,0,0.2) !important; background: #fff !important; box-shadow: 0 3px 5px rgba(0,0,0,0.2) !important; -webkit-border-radius: 2px !important; text-shadow: none !important; padding: 5px; height: auto; box-sizing: border-box; display: none; width: 100%; border-radius: 2px; margin: 0 0 0 auto; top: 35px; } .pagelayer-temp-search-val{ margin-bottom: 5px !important; padding: 2px 6px; line-height: 20px !important; border-radius: 3px !important; width: 100%; } .pagelayer-temp-search-list{ width: 100%; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; padding: 0; max-height: 183px; overflow-y: auto; } .pagelayer-temp-close{ float:right; font-size:15px; } .pagelayer-close-condition{ font-size: 15px; font-weight: 900; height:7px; margin-top: -2px; padding-left:5px; padding-right:5px; float:right; cursor: pointer; } .pagelayer-temp-add-new, .pagelayer-temp-submit-btn{ font-size: 14px; font-weight: bold; cursor: pointer; border-radius: 2px; padding: 4px 8px; border: #398439 1px solid; color: #fff; background: #449d44; } .pagelayer-temp-pad5{ padding-left:5px; padding-right:5px; } .pagelayer-temp-container{ background-color:#fff; padding:0px; width:95%; border-radius: 4px; margin: 10px auto; } .pagelayer-temp-head{ padding:10px; font-weight:bold; border-bottom: 1px solid #dfdfdf; } .pagelayer-temp-row{ display:table-cell; padding: 10px; } .pagelayer-temp-condition-holder{ padding: 0px 10px; display: none; } .pagelayer-temp-submit{ padding: 10px; } .pagelayer-temp-container select{ font-size:13px; } .postbox{ margin-bottom:5px; } </style> <?php $sel_type = $_post['type']; $dis_conditions = $_post['conditions']; echo ' <div class="pagelayer-temp-container"> <div class="pagelayer-temp-head"> <img src="'.PAGELAYER_URL.'/images/pagelayer-logo-19.png'.'" style="vertical-align: top;" /> '; if(empty($_post['type'])){ echo __pl('add_temp'); }else{ echo __pl('edit_temp').'<span style="float:right" class="pagelayer-temp-edit"><a href="'.esc_url( pagelayer_shortlink($_post['id']).'&pagelayer-live=1' ).'">'.__pl('edit_using').'</a></span>'; } echo ' </div> <div class="pagelayer-temp-row"> <label class="pagelayer-temp-label">'.__('Select Template Type :').'</label> <select name="pagelayer_template_type" class="postbox"> '.pagelayer_create_sel_options( $pagelayer->builder["type"], $sel_type ).' </select> </div> <div class="pagelayer-temp-row"> <label for="pagelayer_lib_title" class="pagelayer-temp-label">'.__('Name :').'</label> <input type="text" name="pagelayer_lib_title" size="30" value="'.$_post['post_title'].'" /> </div> <div class="pagelayer-temp-condition-holder '.((!empty($pagelayer->builder["type"][$sel_type]['no_condition'])) ? ' pagelayer-temp-hide' : '').'"> <label class="pagelayer-temp-label">'.__('Template Display Conditions :').'</label> <div class="pagelayer-temp-condition-container">'; if( !empty($dis_conditions) ){ foreach($dis_conditions as $condi){ echo ' <div class="pagelayer-temp-condition"> <div class="pagelayer-temp-tab"> <span class="pagelayer-temp-toggle pagelayer-temp-pad5">☰</span> <span>'. __('Display Conditions').'</span> <span class="pagelayer-close-condition">×</span> </div> <div class="pagelayer-temp-condition-div"> <div class="pagelayer-temp-fields"> <label for="pagelayer_condition_type" class="pagelayer-temp-label">'. __('Action Type :').'</label> <select name="pagelayer_condition_type[]" class="postbox"> '.pagelayer_create_sel_options( $pagelayer->builder["action"], $condi['type'] ).' </select> </div> <div class="pagelayer-temp-fields"> <label for="pagelayer_condition_name" class="pagelayer-temp-label"> '. __('Display On : ').'</label> <select name="pagelayer_condition_name[]" class="postbox"> '.pagelayer_create_sel_options( $pagelayer->builder['dispay_on'], $condi['template'] ).' </select> </div> <div class="pagelayer-temp-fields '.(empty($condi['template']) ? 'pagelayer-temp-hide' : '').'"> <label for="pagelayer_condition_sub_template" class="pagelayer-temp-label"> '. __('Template : ').'</label> <select name="pagelayer_condition_sub_template[]" class="postbox">'; if($condi['template'] == 'archives'){ echo pagelayer_create_sel_options( $pagelayer->builder['archives_templates'], $condi['sub_template'] ); }else{ echo pagelayer_create_sel_options( $pagelayer->builder['singular_templates'], $condi['sub_template'] ); } echo ' </select> </div> <div class="pagelayer-temp-fields pagelayer-temp-search-sel '. ((empty($condi['sub_template'])) ? ' pagelayer-temp-hide' : '').'"> <label for="pagelayer_condition_id" class="pagelayer-temp-label">'.__('Specific Items').'</label>'; $req_arr['id'] = $condi['id']; $req_arr['filter_type'] = 'post'; if( is_numeric(strpos($condi['sub_template'] , 'author'))){ $req_arr['filter_type'] = 'author'; } if( is_numeric(strpos($condi['sub_template'] , 'category')) || is_numeric(strpos($condi['sub_template'] , 'tag')) ){ $req_arr['filter_type'] = 'taxonomy'; } $title_array = pagelayer_builder_get_title($req_arr['filter_type'], $req_arr['id']); $id = ''; $title = ''; foreach ( $title_array as $tmp_id => $tmp_title ) { $id = $tmp_id; $title = $tmp_title; } echo ' <select name="pagelayer_condition_id[]" class="postbox pagelayer-temp-hide"> <option selected value="'. ((empty($id)) ? '' : $id).'"> '. ((empty($title)) ? __('All') : $title).'</option> </select> <div class="pagelayer-temp-search-holder"> <div class="pagelayer-temp-search-div"> <div class="pagelayer-temp-search-preview"> <span class="pagelayer-temp-search-name"> '. ((empty($title)) ? __('All') : $title).' </span> <span class="pagelayer-temp-close '. ((empty($title)) ? ' pagelayer-temp-hide' : '').'">×</span> </div> <span class="">⯆</span> </div> <div class="pagelayer-temp-search-selector"> <input autocomplete="off" type="text" class="pagelayer-temp-search-val" name="search-icon" placeholder="Search"> <div class="pagelayer-temp-search-list"> </div> </div> </div> </div> </div> </div>'; } } echo ' </div> <div style="margin:15px 10px;"> <span class="pagelayer-temp-add-new" >'. __('Add Conditions').'</span> </div> </div> <div class="pagelayer-temp-submit"> <center><button type="submit" class="pagelayer-temp-submit-btn button button-primary">'.__('Save Template').'</button></center> </div> </div> <script type="text/javascript"> pagelayer_cpt = '.json_encode($pagelayer->builder).'; pagelayer_ajax_url = "'.admin_url( 'admin-ajax.php' ).'?"; pagelayer_builder_nonce = "'.wp_create_nonce('pagelayer_builder').'"; </script>'; ?> <script type="text/javascript"> jQuery(document).ready(function(){ var $ = jQuery; if(typeof pagelayer !== 'undefined'){ var $ = pagelayer.$$ || $; } // The container var pl_temp = $(".pagelayer-temp-container"); var pl_condi = pl_temp.find('.pagelayer-temp-condition-holder'); // Get values from multi-dimensional array by key var pagelayer_multi_array_search = function(array = [], key){ var array_key = []; if (key in array) { array_key = array[key]; } for( var k in array) { if (typeof array[k] === 'object' && key in array[k]) { array_key = array[k][key]; } } return array_key; } // Creates the select options var create_options = function(opt_array){ var options = ''; var tmp_numeric = ''; // Required to handle key 404 in singular templates as json decode puts number first and that spoils our order for (x in opt_array){ // Single item if(typeof opt_array[x] == 'string'){ options += option(x, opt_array[x]); if(tmp_numeric.length > 0){ options += tmp_numeric; tmp_numeric = ''; } // If is array then we get the label string }else if(typeof opt_array[x] == 'object'){ if('label' in opt_array[x]){ if(x == 404){ tmp_numeric = option(x, opt_array[x]['label']); continue; } options += option(x, opt_array[x]['label']); // Groups }else{ options += '<optgroup label="'+x+'">'; options += create_options(opt_array[x]); options += '</optgroup>'; } } } return options; } var option = function(val, lang){ return '<option value="'+val+'">'+lang+'</option>'; } var html_condi = '<div class="pagelayer-temp-condition">'+ '<div class="pagelayer-temp-tab">'+ '<span class="pagelayer-temp-toggle pagelayer-temp-pad5">☰</span>'+ '<span>'+<?php echo "'".__('Display Conditions')."'";?>+'</span>'+ '<span class="pagelayer-close-condition">×</span>'+ '</div>'+ '<div class="pagelayer-temp-condition-div">'+ '<div class="pagelayer-temp-fields">'+ '<label for="pagelayer_condition_type" class="pagelayer-temp-label">'+<?php echo "'".__('Action Type')."'";?>+'</label>'+ '<select name="pagelayer_condition_type[]" class="postbox">'+ create_options(pagelayer_cpt["action"])+ '</select>'+ '</div>'+ ' <div class="pagelayer-temp-fields">'+ '<label for="pagelayer_condition_name" class="pagelayer-temp-label">'+<?php echo "'".__('Display On')."'";?>+'</label>'+ '<select name="pagelayer_condition_name[]" class="postbox">'+ create_options(pagelayer_cpt["dispay_on"])+ '</select>'+ '</div>'+ ' <div class="pagelayer-temp-fields pagelayer-temp-hide">'+ '<label for="pagelayer_condition_sub_template" class="pagelayer-temp-label">'+<?php echo "'".__('Template')."'";?>+'</label>'+ '<select name="pagelayer_condition_sub_template[]" class="postbox">'+ '</select>'+ '</div>'+ ' <div class="pagelayer-temp-fields pagelayer-temp-hide pagelayer-temp-search-sel">'+ '<label for="pagelayer_condition_id" class="pagelayer-temp-label">'+<?php echo "'".__('Specific Items')."'";?>+'</label>'+ '<select name="pagelayer_condition_id[]" class="postbox pagelayer-temp-hide">'+ '<option selected value="">All</option>'+ '</select>'+ '<div class="pagelayer-temp-search-holder">'+ '<div class="pagelayer-temp-search-div">'+ '<div class="pagelayer-temp-search-preview">'+ '<span class="pagelayer-temp-search-name">All</span>'+ '<span class="pagelayer-temp-close pagelayer-temp-hide">×</span>'+ '</div>'+ '<span class="">⯆</span>'+ '</div>'+ '<div class="pagelayer-temp-search-selector">'+ '<input autocomplete="off" type="text" class="pagelayer-temp-search-val" name="search-icon" placeholder="Search">'+ '<div class="pagelayer-temp-search-list">'+ '</div>'+ '</div>'+ '</div>'+ '</div>'+ '</div>'+ '</div>'; // Removes a condition var close_tab = function(){ var condi = pl_temp.find(".pagelayer-temp-condition"); condi.find(".pagelayer-close-condition").click(function(){ jQuery(this).closest(".pagelayer-temp-condition").remove(); }); }; // Toggle a condition content var toggle_tab = function(){ var condi = pl_temp.find(".pagelayer-temp-condition"); condi.find(".pagelayer-temp-tab").unbind("click"); condi.find(".pagelayer-temp-tab").click(function(){ jQuery(this).closest(".pagelayer-temp-condition").find(".pagelayer-temp-condition-div").toggle(); }); }; // Opens the search selector var open_search = function(){ var el = pl_temp.find('.pagelayer-temp-search-div') el.unbind('click'); el.on('click', function(){ jQuery(this).parent().find('.pagelayer-temp-search-selector').slideToggle(); }); }; var pagelayer_set_inter; // A timer // Get closest select box by name in closest "pagelayer-temp-condition" class var pagelayer_get_closest_sel = function(jEle, name){ return jEle.closest(".pagelayer-temp-condition").find("[name='"+name+"']"); } // Handle search of values var search_list = function(){ pl_temp.find('.pagelayer-temp-search-val').on('keyup', function(){ var v = this.value; var iEle = jQuery(this); var template_name, ele_name, template_name_array; //v = v.replace(/\s+/g, '-'); template_name = pagelayer_get_closest_sel(iEle, 'pagelayer_condition_name[]').val(); ele_name = pagelayer_get_closest_sel(iEle, 'pagelayer_condition_sub_template[]').val(); template_name_array = pagelayer_multi_array_search(pagelayer_cpt[template_name+'_templates'], ele_name); data_array = { pagelayer_nonce: pagelayer_builder_nonce, search : v, filter_type : template_name_array['filter_type'] || 'post', object_type : template_name_array['object_type'] || 'post', }; clearTimeout(pagelayer_set_inter); pagelayer_set_inter = setTimeout(function () { v = v.toLowerCase(); jQuery.ajax({ url: pagelayer_ajax_url+'&action=pagelayer_search_ids', type: 'post', data : data_array, success:function(response){ iEle.next().html(response); //console.log(response); } }); //row.find('.pagelayer-temp-search-list').empty().html(span); }, 200); }); // Handle click within the ID selector pl_temp.find('.pagelayer-temp-search-selector').unbind('click'); pl_temp.find('.pagelayer-temp-search-selector').on('click', function(e){ var jEle = jQuery(e.target); var val = jEle.attr('value'); var text = jEle.text(); if(val.length < 1 || text.length < 1){ return false; } // Set the ID in this list var row = jEle.closest('.pagelayer-temp-search-sel'); row.find('[name="pagelayer_condition_id[]"]').html('<option selected value="'+ val +'">'+ text +'</option>'); row.find('.pagelayer-temp-search-preview .pagelayer-temp-search-name').text(text).next().show(); row.find('.pagelayer-temp-search-selector').slideUp(); return false; }); pl_temp.find('.pagelayer-temp-close').click(function(e){ e.stopPropagation(); var sHold = jQuery(this).closest('.pagelayer-temp-search-sel'); sHold.find('[name="pagelayer_condition_id[]"]').html('<option selected value="">All</option>'); sHold.find('.pagelayer-temp-search-preview .pagelayer-temp-search-name').text('All').next().hide(); }); }; // Whenever a condition is to be initialized var reinit_conditions = function(){ close_tab(); toggle_tab(); open_search(); search_list(); pl_temp.find('select').unbind('change'); pl_temp.find('select').on('change', function(event, triggerEle){ var sEle = jQuery(this); var sVal = sEle.val(); var condiEle = triggerEle || pl_condi; //console.log(sVal); // Hide search box if any select is changed var temp_search = jQuery('.pagelayer-temp-search-selector'); if(temp_search.is(':visible') || jQuery('.pagelayer-temp-search-preview > .pagelayer-temp-close').is(':visible')){ temp_search.hide(); temp_search.find('.pagelayer-temp-search-list').empty(); temp_search.find('.pagelayer-temp-search-val').val(''); } switch(sEle.attr('name')){ case 'pagelayer_template_type': var no_condition = pagelayer_cpt["type"][sVal]['no_condition'] || false; if( no_condition ){ pl_condi.hide(); }else if(!pl_condi.is(':visible')){ pl_condi.show(); } condiEle.find("[name='pagelayer_condition_name[]']").each(function(){ var condi_name = jQuery(this); var need_selection = pagelayer_multi_array_search(pagelayer_cpt["type"], sVal); if(typeof need_selection === 'object' && 'need_selection' in need_selection){ if(need_selection['need_selection'] != condi_name.val() ){ condi_name.val(need_selection['need_selection']).trigger('change'); } condi_name.css('pointer-events', 'none'); }else if(condi_name.css('pointer-events') == 'none'){ condi_name.css('pointer-events', 'all'); } }); break; case 'pagelayer_condition_type[]': //console.log(sEle.val()); break; case 'pagelayer_condition_name[]': var ele_name = pagelayer_get_closest_sel(sEle, 'pagelayer_condition_sub_template[]'); //console.log(sEle.val()); if(sVal.length == 0){ ele_name.closest(".pagelayer-temp-fields").addClass('pagelayer-temp-hide'); }else{ if(pagelayer_cpt[sVal+"_templates"]){ ele_name.html(create_options(pagelayer_cpt[sVal+"_templates"])); ele_name.closest(".pagelayer-temp-fields").removeClass('pagelayer-temp-hide'); } } ele_name.trigger('change'); break; case 'pagelayer_condition_sub_template[]': // Get selected template name var template_name = pagelayer_get_closest_sel(sEle, 'pagelayer_condition_name[]').val(); var ele_name = pagelayer_get_closest_sel(sEle, 'pagelayer_condition_id[]'); var template_name_array = pagelayer_multi_array_search(pagelayer_cpt[template_name+'_templates'], sVal); if(sVal.length == 0 || template_name_array['no_id_section'] || !sEle.is(':visible')){ ele_name.closest(".pagelayer-temp-fields").addClass('pagelayer-temp-hide'); }else{ ele_name.closest(".pagelayer-temp-fields").removeClass('pagelayer-temp-hide'); } ele_name.closest(".pagelayer-temp-fields").find('.pagelayer-temp-close').click(); break; case 'pagelayer_condition_id[]': //console.log(sEle.val()); break; } }); } reinit_conditions(); <?php if(!empty($_post['id'])){ $sub_template_sel = "'pagelayer_condition_sub_template[]'"; echo ' //reinit_conditions(); pl_condi.show(); pl_temp.find("select[name=pagelayer_template_type]").trigger("change"); pl_temp.find("select[name='.$sub_template_sel.']").trigger("change"); pl_temp.find("select[name=pagelayer_template_type]").prop("disabled", true); //pl_condi.find("select").trigger("change")'; } ?> // On click add more condition pl_temp.find(".pagelayer-temp-add-new").click(function(){ pl_condi.show(); var hEle = jQuery(html_condi); pl_temp.find('.pagelayer-temp-condition-container').append(hEle); reinit_conditions(); pl_temp.find('select[name="pagelayer_template_type"]').trigger('change', [hEle]); }); // Save the template pl_temp.find(".pagelayer-temp-submit-btn").click(function(e){ e.preventDefault(); var data = pl_temp.find('input, select, textarea').serialize(); //alert(data); jQuery.ajax({ url: pagelayer_ajax_url+'&action=pagelayer_save_template&postID='+ <?php echo "'".$_post['id']."'";?>, type: 'post', data : 'pagelayer_nonce='+ pagelayer_builder_nonce +'&'+ data, success: function(response, status, xhr){ var obj = jQuery.parseJSON(response); //alert(obj); if(obj['error']){ alert(obj['error']); }else{ alert(obj['success']); var hasPost = new window.URLSearchParams(window.location.search).has('post'); if(!hasPost){ window.location.replace(window.location+'&post='+obj['id']); } } }, error: function(errorThrown){ alert(errorThrown); console.log(errorThrown); } }); }); }); </script> <?php } // Get Title from ID function pagelayer_builder_get_title($type, $ids = array()){ $ids = (array) $ids; $sel_title = []; switch ( $type ) { case 'taxonomy': $terms = get_terms([ 'include' => $ids, 'hide_empty' => false, ]); global $wp_taxonomies; foreach ( $terms as $term ) { $sel_title[ $term->term_taxonomy_id ] = $term->name ; } break; case 'post': $query = new \WP_Query([ 'post_type' => 'any', 'post__in' => $ids, 'posts_per_page' => -1, 'post_status' => 'any', ]); foreach ( $query->posts as $post ) { $sel_title[ $post->ID ] = $post->post_title; } break; case 'author': $query_params = [ 'capability' => array( 'edit_posts' ), 'fields' => ['ID', 'display_name'], 'include' => $ids, ]; // Capability queries were only introduced in WP 5.9. if( version_compare( $GLOBALS['wp_version'], '5.9-alpha', '<' ) ){ $args['who'] = 'authors'; unset( $args['capability'] ); } $user_query = new \WP_User_Query( $query_params ); foreach ( $user_query->get_results() as $author ) { $sel_title[ $author->ID ] = $author->display_name; } break; } return $sel_title; } // Append the Popup templates function pagelayer_builder_popup_append(){ global $pagelayer; if(!empty($GLOBALS['pagelayer_builder_popup_append_called'])){ return; } $GLOBALS['pagelayer_builder_popup_append_called'] = 1; // Render the multiple Popups foreach($pagelayer->template_popup_ids as $id => $priority){ $bLoadString = ''; $content = pagelayer_get_post_content($id); // For popup before loading option // First check that att is placed or not. Then scan and extract the value of id and insert it into bLoadString variable if(strpos($content, 'data-trig_before_load') !== false){ preg_match('#pagelayer-id=([^\s]+)#', $content, $matches); $bLoadString = 'pagelayer-popup-Shown="1" style="display: flex;" pagelayer-popup-id="'.$matches[1].'"'; } echo '<div class="pagelayer-popup-modal" '.$bLoadString.'> <div class="pagelayer-popup-modal-content"> <div class="pagelayer-popup-content"> '.$content.' </div> </div> </div>'; } } // Export Pages, Media and Pagelayer Template Files function pagelayer_builder_export($type){ global $pagelayer; // Load the templates pagelayer_builder_load_templates(); $data['page'] = []; // Load the other posts foreach($pagelayer->settings['post_types'] as $type){ // Make the query $type_query = new WP_Query(['post_type' => $type, 'status' => 'publish', 'posts_per_page' => -1, 'orderby' => 'name', 'order' => 'ASC']); $data[$type] = $type_query->posts; } $nonce = wp_create_nonce('pagelayer_builder'); echo '<h1>Pagelayer - Export Template into a Theme</h1> <span style="font-size:12px">With this wizard you can export Pagelayer Template(s) (and pages) into a theme folder. This theme folder can be distributed as a theme and can be used by any Pagelayer user.</span>'; // Make two tables echo ' <script> pagelayer_ajax_url = "'.admin_url( 'admin-ajax.php' ).'?"; function pagelayer_checkbox(ele, cl){ var jEle = jQuery(ele); jQuery(cl).prop("checked", jEle.prop("checked")); } function pagelayer_export_template(){ var data = jQuery("#pagelayer_export_template_form").serialize(); //console.log(data); jQuery.ajax({ dataType: "json", url: pagelayer_ajax_url+"&action=pagelayer_export_template", type: "post", data: data, success:function(response){ if("success" in response){ alert(response["success"]); } if("error" in response){ alert(response["error"]); } } }); return false; } </script> <form id="pagelayer_export_template_form"> <input type="hidden" name="pagelayer_nonce" value="'.$nonce.'"> <div style="display:flex; flex-wrap: wrap; width:100%;"> <div style="width:50%; padding: 10px;"> <h2>Pagelayer Templates</h2> <table cellspacing="0" cellpadding="8" border="0" width="100%" class="wp-list-table widefat fixed striped"> <tr> <td width="10"><input type="checkbox" onclick="pagelayer_checkbox(this, \'.pagelayer_temp_cb\');"></td> <td>Title</td> <td>Type</td> <td>Display On</td> </tr>'; foreach($pagelayer->templates as $k => $v){ $type = get_post_meta($v->ID, 'pagelayer_template_type', true); $dis_conditions = get_post_meta( $v->ID, 'pagelayer_template_conditions', true ); $dis_html = 'None'; if( !empty($dis_conditions) ){ $dis_html = ''; foreach($dis_conditions as $condi){ $dis_html .= '<span>'; if(isset($condi['template'])){ $template = pagelayer_multi_array_search($pagelayer->builder['dispay_on'], $condi['template']); if(is_array($template) && array_key_exists('label', $template)){ $template = $template['label']; } $dis_html .= $template; } if(isset($condi['sub_template'])){ $sub_template = pagelayer_multi_array_search($pagelayer->builder[$condi['template'].'_templates'], $condi['sub_template']); if(is_array($sub_template) && array_key_exists('label', $sub_template)){ $sub_template = $sub_template['label']; } if(!empty($sub_template)){ $dis_html .= ' > '. $sub_template; } } if(!empty($condi['id'])){ $dis_html .= ' > #'. $condi['id']; } $dis_html .= '</span></br>'; } } //print_r($v); echo ' <tr> <td><input type="checkbox" class="pagelayer_temp_cb" name="templates['.$v->ID.']"></td> <td>'.$v->post_title.'</td> <td>'.(!empty($pagelayer->builder['type'][$type]['label']) ? $pagelayer->builder['type'][$type]['label'] : $pagelayer->builder['type'][$type]).'</td> <td>'.$dis_html.'</td> </tr>'; } echo ' </table> </div>'; $pt_objects = get_post_types(['public' => true], 'objects'); foreach($data as $type => $d){ if(empty($pt_objects[$type])){ continue; } echo ' <div style="width:22%; padding: 10px;"> <h2>'.$pt_objects[$type]->labels->name.'</h2> <table cellspacing="0" cellpadding="8" border="0" width="100%" class="wp-list-table widefat fixed striped"> <tr> <td width="10"><input type="checkbox" onclick="pagelayer_checkbox(this, \'.pagelayer_'.$type.'_cb\');"></td> <td>Title</td> <td width="80">Type</td> </tr>'; foreach($data[$type] as $k => $v){ //$type = get_post_meta($v->ID, 'pagelayer_template_type', true); //print_r($v); echo ' <tr> <td><input type="checkbox" class="pagelayer_'.$type.'_cb" name="'.$type.'['.$v->ID.']"></td> <td>'.$v->post_title.'</td> <td>'.$pt_objects[$type]->labels->name.'</td> </tr>'; } echo ' </table> </div>'; } echo ' </div> <div class="pagelayer-temp-submit"> <center> <button onclick="return pagelayer_export_template()" class="pagelayer-temp-submit-btn button button-primary">'.__('Export Template Files').'</button> </center> </div> </form>'; } premium_functions.php 0000644 00000072336 15103567077 0011051 0 ustar 00 <?php ////////////////////////////////////////////////////////////// //=========================================================== // class.php //=========================================================== // PAGELAYER // Inspired by the DESIRE to be the BEST OF ALL // ---------------------------------------------------------- // Started by: Pulkit Gupta // Date: 23rd Jan 2017 // Time: 23:00 hrs // Site: http://pagelayer.com/wordpress (PAGELAYER) // ---------------------------------------------------------- // Please Read the Terms of use at http://pagelayer.com/tos // ---------------------------------------------------------- //=========================================================== // (c)Pagelayer Team //=========================================================== ////////////////////////////////////////////////////////////// // Are we being accessed directly ? if(!defined('PAGELAYER_PRO_VERSION')) { exit('Hacking Attempt !'); } // Audio Handler function pagelayer_sc_audio(&$el){ global $pagelayer; if(empty($pagelayer->sc_audio_enqueued) && !pagelayer_is_live_iframe()){ wp_enqueue_script('wp-mediaelement'); wp_enqueue_style( 'wp-mediaelement' ); $pagelayer->sc_audio_enqueued = 1; } return; $el['atts']['a_url'] = ''; if ($el['atts']['source'] == 'external'){ $el['atts']['a_url'] = $el['atts']['url']; } if ($el['atts']['source'] == 'library'){ $el['atts']['a_url'] = wp_get_attachment_url($el['atts']['id']); } if(!empty($el['atts']['a_url'])){ $filename=$el['atts']['a_url']; //Get the file extension $extension = pathinfo($filename, PATHINFO_EXTENSION); //Create source tag according to audio file switch($extension){ default: case 'mp3': $el['atts']['a_type'] = 'audio/mpeg'; break; case 'ogg': $el['atts']['a_type']= 'audio/ogg'; break; case 'wav': $el['atts']['a_type'] = 'audio/wav'; break; } } if(!empty($el['atts']['a_url']) && !empty($el['atts']['a_type'])){ $el['attr'][]= ['source' => 'src="{{a_url}}']; $el['attr'][]= ['source' => 'type="{{a_type}}']; } } // Image Portfolio function pagelayer_sc_single_img(&$el){ // Decide the image URL $img_size = pagelayer_isset($el['atts'], 'img-size'); $el['atts']['func_img'] = pagelayer_isset($el['tmp'], 'img-'.$img_size.'-url'); $el['atts']['func_img'] = empty($el['atts']['func_img']) ? pagelayer_isset($el['tmp'], 'img-url') : $el['atts']['func_img']; // What is the link ? if(!empty($el['atts']['link_type'])){ // Custom url if($el['atts']['link_type'] == 'custom_url'){ // Backward compatibility for new link props pagelayer_add_link_backward($el, array( 'rel' => '', 'selector' => '.pagelayer-ele-link')); $el['atts']['func_link'] = empty($el['tmp']['link']) ? '' : $el['tmp']['link']; } // Link to the media file itself if($el['atts']['link_type'] == 'media_file'){ $el['atts']['func_link'] = $el['atts']['func_img']; } // Lightbox if($el['atts']['link_type'] == 'lightbox'){ $el['atts']['func_link'] = $el['atts']['func_img']; } } } // Posts Grid function pagelayer_sc_wp_posts_grid($atts, $content = '', $tag = ''){ $args = array( 'numberposts' => -1, 'post_type' => 'post', 'post_status' => array('publish', 'pending', 'draft', 'future', 'private', 'inherit', 'trash') ); $all_posts = get_posts($args); $html = '<div '.pagelayer_create_sc($tag, $atts, 'pagelayer-posts-grid').'>'; //pagelayer_print($all_posts); foreach($all_posts as $pk => $pv){ $post_link = get_permalink($pv->ID); $html .= '<div> <h2><a href="'.$post_link.'">'.$pv->post_title.'</a></h2> <p>'.date('F jS, Y', strtotime($pv->post_date)).' | Published by <a href="'.site_url('author/'.get_the_author_meta('user_login', $pv->post_author)).'">'.get_the_author_meta('display_name', $pv->post_author).'</a></p> <p>'.pagelayer_the_content($pv->post_content).'</p> <p><a href="'.$post_link.'">Read More</a></p> </div>'; } $html .= '</div>'; return $html; } // Posts Slider function pagelayer_sc_wp_posts_slider(&$el){ $params = array(); $params['post'] = array(); if($el['atts']['post_type']) $params['post']['post_type'] = $el['atts']['post_type']; if($el['atts']['post_count']) $params['post']['post_count'] = $el['atts']['post_count']; if($el['atts']['category']) $params['post']['category'] = $el['atts']['category']; if($el['atts']['tags']) $params['post']['tags'] = $el['atts']['tags']; if($el['atts']['order_by']) $params['post']['order_by'] = $el['atts']['order_by']; if($el['atts']['sort_order']) $params['post']['sort_order'] = $el['atts']['sort_order']; if($el['atts']['image_size']) $params['post']['image_size'] = $el['atts']['image_size']; if($el['atts']['show_excerpt']) $params['post']['show_excerpt'] = $el['atts']['show_excerpt']; $el['atts']['posts_slides'] = pagelayer_posts_slider($params); //wp_reset_postdata(); } // Search function function pagelayer_sc_search(&$el){ if(!empty($el['atts']['placeholder'])){ $el['tmp']['placeholder'] = htmlspecialchars($el['atts']['placeholder']); } } // Post portfolio function pagelayer_sc_post_folio(&$el){ $args = array(); if($el['atts']['type']) $args['post_type'] = $el['atts']['type']; // Filter by if($el['atts']['filter_by']) $args['filter_by'] = $el['atts']['filter_by']; // Page count if($el['atts']['count']) $args['posts_per_page'] = $el['atts']['count']; $el['atts']['post_html'] = pagelayer_widget_posts($args); } // Posts Handler function pagelayer_sc_posts(&$el){ global $pagelayer; $allow_param = array('show_thumb', 'thumb_size', 'show_content', 'show_title', 'more', 'btn_type', 'size', 'icon_position', 'icon', 'show_more', 'meta_sep', 'exc_length', 'post_type', 'exc_term', 'exc_author', 'offset','ignore_sticky', 'orderby', 'by_period', 'before_date', 'after_date', 'thumb_img_type', 'infinite_types' ); $param = array(); // Page count $param['posts_per_page'] = !empty($el['atts']['count']) ? $el['atts']['count'] : ''; $param['order'] = !empty($el['atts']['posts_order']) ? $el['atts']['posts_order'] : ''; $param['term'] = !empty($el['atts']['inc_term']) ? $el['atts']['inc_term'] : ''; $param['author_name'] = !empty($el['atts']['inc_author']) ? $el['atts']['inc_author'] : ''; if(!empty($el['atts']['thumb_img_type'])){ $thumb_size = pagelayer_isset($el['atts'], 'thumb_size'); $img_size = pagelayer_isset($el['tmp'], 'def_thumb_img-'.$thumb_size.'-url'); $param['def_thumb_img'] = empty($img_size) ? pagelayer_isset($el['tmp'], 'def_thumb_img-url') : $img_size; } foreach($allow_param as $val){ $param[$val] = !empty($el['atts'][$val]) ? $el['atts'][$val] : ''; } if(!empty($el['atts']['meta'])){ $meta_arr = explode(',',$el['atts']['meta']); //pagelayer_print($el['atts']['meta']); foreach($meta_arr as $arr){ $param[$arr] = $arr; } } if(wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'pagelayer_infinite_posts'){ $param['paged'] = $el['atts']['paged']; }else{ $data = array('tag' => $el['tag'],'atts' => $el['oAtts']); $pagelayer->localScript['pagelayer_post_'.$el['id']] = $data; } //pagelayer_print($param); $el['atts']['post_html'] = pagelayer_posts($param); } // Author Box function pagelayer_sc_author_box(&$el){ global $post; if($el['atts']['box_source'] == 'current'){ $author_data = pagelayer_author_data ($post->ID); $el['atts']['display_name'] = $author_data['display_name']; $el['atts']['description'] = $author_data['description']; $el['atts']['user_url'] = $author_data['user_url']; $el['tmp']['avatar-url'] = $author_data['avatar']; $el['tmp']['avatar-title'] = ''; $el['tmp']['avatar-alt'] = ''; }else{ $el['tmp']['avatar-url'] = empty($el['tmp']['avatar-url']) ? $el['atts']['avatar'] : $el['tmp']['avatar-url']; } $el['atts']['display_html'] = '<'.$el['atts']['name_style'].'>'.$el['atts']['display_name'].'</'.$el['atts']['name_style'].'>'; } //Grid Gallery Handler function pagelayer_sc_login(&$el){ if(pagelayer_is_live()){ $el['atts']['login_cap'] = ''; return false; } ob_start(); if(!did_action( 'login_enqueue_scripts' )){ do_action( 'login_enqueue_scripts' ); } do_action( 'login_form' ); $el['atts']['login_cap'] = ob_get_clean(); } // Load all tags function pagelayer_get_tags(){ $tags = get_tags(['hide_empty' => false]); $taglist = array(); $taglist[] = 'Default'; foreach ($tags as $tag) { $taglist[$tag->name] = $tag->name ; } return $taglist; } // Load all categories function pagelayer_get_categories(){ $categories = get_categories(['hide_empty' => 0]); $category_list = array(); $category_list[] = 'Default'; foreach($categories as $category) { $category_list[$category->name] = $category->name ; } return $category_list; } // Templates Handler - 2C function pagelayer_sc_templates(&$el){ global $pagelayer, $post; if( !empty($el['atts']['templates']) ) $id = $el['atts']['templates']; $post_obj = get_post($id); $content = ''; // If both current post and tempate post are same if (empty( $post_obj) || (!empty( $post_obj) && $post_obj == $post) ) { $el['atts']['template_content'] = $content; return; } $pagelayer->dont_make_editable = true; $content = $post_obj->post_content; $content = apply_filters( 'the_content', $content ); $pagelayer->dont_make_editable = false; if(pagelayer_is_live()){ // Create the HTML object $node = pagelayerQuery::parseStr($content); $node->query('.pagelayer-ele')->removeClass('pagelayer-ele'); $content = $node->html(); } $el['atts']['template_content'] = $content; } // Get the list of post by post type - 2C function pagelayer_post_list_by_type($post_type = 'post'){ $postlist = []; $posts_list = get_posts(array( 'post_type' => $post_type, 'numberposts' => -1 )); foreach($posts_list as $post){ $postlist[$post->ID] = $post->post_title; } return $postlist; } ///////////////////////////////////// // WooCommerce Shortcode Functions ///////////////////////////////////// // Product Images Handler - 2C function pagelayer_sc_product_images(&$el){ global $product; $product = pagelayer_get_product(); $images_templ = ''; if( empty( $product ) && (pagelayer_is_live_template() || wp_doing_ajax())){ $images_templ = __pl('no_woo_product'); } if( empty( $product ) ) { $el['atts']['product_images_templ'] = $images_templ; return; } // Start the output buffer ob_start(); if( !empty($el['atts']['sale_flash']) ){ wc_get_template( 'loop/sale-flash.php' ); } wc_get_template( 'single-product/product-image.php' ); $el['atts']['product_images_templ'] = ob_get_clean(); } // Related products Handler - 2C function pagelayer_sc_product_related(&$el){ global $product; $product = pagelayer_get_product(); $related_templ = ''; if( empty( $product ) && (pagelayer_is_live_template() || wp_doing_ajax())){ $related_templ = __pl('no_woo_product'); } if( empty( $product ) ) { $el['atts']['related_products'] = $related_templ; return; } // start output buffer ob_start(); // If is related if($el['atts']['select_product'] == 'related'){ $args = [ 'posts_per_page' => 4, 'columns' => 4, 'orderby' => $el['atts']['order_by'], 'order' => $el['atts']['order'], ]; if( ! empty( $el['atts']['posts_per_page'] ) ) { $args['posts_per_page'] = $el['atts']['posts_per_page']; } if( ! empty( $el['atts']['columns'] ) ) { $args['columns'] = $el['atts']['columns']; } if(function_exists( 'woocommerce_related_products' )){ woocommerce_related_products($args); } // If is upsel; }elseif($el['atts']['select_product'] == 'upsell'){ $limit = '-1'; $columns = 4; $orderby = $el['atts']['order_by']; $order = $el['atts']['order']; if( ! empty( $el['atts']['columns'] ) ) { $columns = $el['atts']['columns']; } if(function_exists( 'woocommerce_upsell_display' )){ woocommerce_upsell_display( $limit, $columns, $orderby, $order ); } } // Get data and clean output buffer $el['atts']['related_products'] = ob_get_clean(); } // WooCommers Pages - 2C function pagelayer_sc_woo_pages(&$el){ // if is not empty if(!empty($el['atts']['pages'])){ $shortcode = '['. $el['atts']['pages'] .']'; $content = pagelayer_the_content($shortcode); // if is checkout page if ( 'woocommerce_checkout' === $el['atts']['pages'] && '<div class="woocommerce"></div>' == $content ) { $content = '<div class="woocommerce">' . __( 'Your cart is currently empty.') . '</div>'; } } // If the content is empty if(empty($content)){ $content = '<div class="woocommerce">' . __( 'Page content not found.') . '</div>'; } $el['atts']['page_content'] = $content; } // Product Pages - 2C function pagelayer_sc_product_categories(&$el){ $attributes = ''; $attributes .= ' number="'. (isset($el['atts']['number']) ? $el['atts']['number'] : '').'" '; $attributes .= ' columns="'. (isset($el['atts']['columns']) ? $el['atts']['columns'] : '').'" '; $attributes .= ' hide_empty="'. (!empty($el['atts']['hide_empty']) ? 1 : 0) .'" '; $attributes .= ' orderby="'. (isset($el['atts']['nuorderbymber']) ? $el['atts']['nuorderbymber'] : '') .'" '; $attributes .= ' order="'. (isset($el['atts']['order']) ? $el['atts']['order'] : '') .'" '; $source = isset($el['atts']['source']) ? $el['atts']['source'] : ''; if ( 'by_id' === $source ) { $attributes .= ' ids="'. $el['atts']['by_id'] .'" '; } elseif ( 'by_parent' === $source ) { $attributes .= ' parent="'. $el['atts']['parent'] .'" '; } elseif ( 'current_subcategories' === $source ) { $attributes .= ' parent="'. get_queried_object_id() .'" '; } $shortcode = '[product_categories '. $attributes .']'; // do_shortcode the shortcode $el['atts']['product_categories'] = pagelayer_the_content($shortcode); } // Products - 2C function pagelayer_sc_products(&$el){ if( WC()->session ){ wc_print_notices(); } $no_found = $el['atts']['no_found']; $attributes = ''; $type = $el['atts']['source']; $attributes .= ' columns="'. $el['atts']['columns'] .'" '; $attributes .= ' rows="'. $el['atts']['rows'] .'" '; $attributes .= ' paginate="'. (!empty($el['atts']['paginate']) ? true : false) .'" '; $attributes .= ' orderby="'. $el['atts']['orderby'] .'" '; $attributes .= ' order="'. $el['atts']['order'] .'" '; $attributes .= ' cache="false" '; // Hide the catalog order if( empty($el['atts']['allow_order']) ){ remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); } // Hide the result count if( empty($el['atts']['show_result']) ){ remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); } if( $type == 'by_id' ){ $type = 'products'; $attributes .= ' ids="'. (!empty($el['atts']['ids']) ? $el['atts']['ids'] : '') .'" '; }elseif( $type == 'pagelayer_current_query' ){ $atts['paginate'] = (!empty($el['atts']['paginate']) ? true : false); $atts['cache'] = false; $type = 'pagelayer_current_query'; // Set the current query add_action( 'woocommerce_shortcode_products_query', 'pagelayer_shortcode_current_query', 10, 10); // If product not found add_action( "woocommerce_shortcode_{$type}_loop_no_results", function ($attributes) use ($no_found){ echo '<div class="pagelayer-product-no-found">'.$no_found.'</div>'; } ); $shortcode = new WC_Shortcode_Products( $atts, $type ); $el['atts']['products_content'] = $shortcode->get_content(); return true; } $shortcode = '['.$type.' '. $attributes .']'; $content = pagelayer_the_content($shortcode); // If product not found if('<div class="woocommerce columns-'.$el['atts']['columns'] .' "></div>' == $content){ $content = '<div class="pagelayer-product-no-found">'. __($no_found) .'</div>'; } $el['atts']['products_content'] = $content; } // Archives Product Pages - 2C function pagelayer_sc_product_archives(&$el){ global $post; if ( WC()->session ) { wc_print_notices(); } $atts['paginate'] = true; $atts['cache'] = false; $no_found = $el['atts']['no_found']; if( empty($el['atts']['allow_order']) ){ remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); } if( empty($el['atts']['show_result']) ){ remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); } $type = 'pagelayer_current_query'; // We need to define costom if( (isset($post->post_type) && $post->post_type == 'pagelayer-template') || wp_doing_ajax()){ $type = ''; } // Set the current query add_action( 'woocommerce_shortcode_products_query', 'pagelayer_shortcode_current_query', 10, 10); // If product not found add_action( "woocommerce_shortcode_{$type}_loop_no_results", function ($attributes) use ($no_found){ echo '<div class="pagelayer-product-no-found">'.$no_found.'</div>'; } ); $shortcode = new WC_Shortcode_Products( $atts, $type ); $el['atts']['product_archives'] = $shortcode->get_content(); } // Product Price render - 2C function pagelayer_sc_product_price(&$el) { global $product; $product = pagelayer_get_product(); $price = ''; if( empty( $product ) && (pagelayer_is_live_template() || wp_doing_ajax())){ $price = __pl('no_woo_product'); } if ( empty( $product ) ) { $el['atts']['pagelayer-product-price'] = $price; return; } ob_start(); wc_get_template( '/single-product/price.php' ); $el['atts']['pagelayer-product-price'] = ob_get_clean(); } // Product add to cart render - 2C function pagelayer_sc_add_to_cart(&$el) { global $product; $product = pagelayer_get_product(); $cart = ''; if( empty( $product ) && (pagelayer_is_live_template() || wp_doing_ajax())){ $cart = __pl('no_woo_product'); } if ( empty( $product ) ) { $el['atts']['product_add_to_cart'] = $cart; return; } ob_start(); woocommerce_template_single_add_to_cart(); $el['atts']['product_add_to_cart'] = '<div class="pagelayer-add-to-cart-holder pagelayer-product-'. esc_attr( $product->get_type() ) .'"> '. ob_get_clean() .' </div>'; } // Product rating render - 2C function pagelayer_sc_product_rating(&$el) { if( ! post_type_supports( 'product', 'comments' ) ){ return; } global $product; $product = pagelayer_get_product(); $product_rating = ''; if( empty( $product ) && (pagelayer_is_live_template() || wp_doing_ajax())){ $product_rating = __pl('no_woo_product'); } if ( empty( $product ) ) { $el['atts']['product_rating'] = $product_rating; return; } ob_start(); wc_get_template( '/single-product/rating.php' ); $product_rating = ob_get_clean(); if( empty( $product_rating ) && pagelayer_is_live_template()){ $product_rating = __('No Rating Found!'); } $el['atts']['product_rating'] = $product_rating; } /* // Product stock render - 2C function pagelayer_product_stock() { global $product; $product = wc_get_product(); if ( empty( $product ) ) { return; } return wc_get_stock_html( $product ); } */ // Product meta render - 2C function pagelayer_sc_product_meta(&$el) { global $product; $product = pagelayer_get_product(); $product_meta = ''; if( empty( $product ) && (pagelayer_is_live_template() || wp_doing_ajax())){ $product_meta = __pl('no_woo_product'); } if ( empty( $product ) ) { $el['atts']['product_meta'] = $product_meta; return; } ob_start(); wc_get_template( '/single-product/meta.php' ); $el['atts']['product_meta'] = ob_get_clean(); } // Product short description render - 2C function pagelayer_sc_product_short_desc(&$el) { global $product, $post; $product = pagelayer_get_product(); $product_short_desc = ''; if( empty( $product ) && (pagelayer_is_live_template() || wp_doing_ajax())){ $product_short_desc = __pl('no_woo_product'); } if ( empty( $product ) ) { $el['atts']['product_short_desc'] = $product_short_desc; return; } if((isset($post->post_type) && $post->post_type == 'pagelayer-template') || wp_doing_ajax()){ $el['atts']['product_short_desc'] = '<div class="woocommerce-product-details__short-description"><p>'.$product->get_short_description().'</p></div>'; return; } ob_start(); wc_get_template( 'single-product/short-description.php' ); $el['atts']['product_short_desc'] = ob_get_clean(); } // WooCommerce breadcrumb render - 2C function pagelayer_woo_breadcrumb() { ob_start(); woocommerce_breadcrumb(); return ob_get_clean(); } // Get product categories - 2C function pagelayer_get_product_cat() { $categories = get_terms( 'product_cat' ); $options = []; foreach ( $categories as $category ) { $options[ $category->term_id ] = $category->name; } return $options; } // Get product categories - 2C function pagelayer_get_product_archives_desc() { ob_start(); do_action( 'woocommerce_archive_description' ); return ob_get_clean(); } // Get product additional Information - 2C function pagelayer_sc_product_addi_info(&$el) { global $product; $product = pagelayer_get_product(); $product_additional_info = ''; if( empty( $product ) && (pagelayer_is_live_template() || wp_doing_ajax())){ $product_additional_info = __pl('no_woo_product'); } if ( empty( $product ) ) { $el['atts']['product_additional_info'] = $product_additional_info; return; } ob_start(); wc_get_template( 'single-product/tabs/additional-information.php' ); $el['atts']['product_additional_info'] = ob_get_clean(); } // Get product data tab Information - 2C function pagelayer_sc_product_data_tabs(&$el) { global $product, $post; $product = pagelayer_get_product(); $product_data_tab = ''; if( empty( $product ) && (pagelayer_is_live_template() || wp_doing_ajax())){ $product_data_tab = __pl('no_woo_product'); } if ( empty( $product ) ) { $el['atts']['product_data_tab'] = $product_data_tab; return; } // We need load Pagelayer shortcodes pagelayer_load_shortcodes(); setup_postdata( $product->get_id()); ob_start(); wc_get_template( 'single-product/tabs/tabs.php' ); $data_tabs = ob_get_clean(); // If no data tabs if(empty($data_tabs)){ $data_tabs = __('Data tab not found'); } $el['atts']['product_data_tab'] = $data_tabs; } // Get the HTML for menu cart function pagelayer_sc_woo_menu_cart(&$el){ // Maybe init cart $has_cart = is_a( WC()->cart, 'WC_Cart' ); if ( ! $has_cart ) { $session_class = apply_filters( 'woocommerce_session_handler', 'WC_Session_Handler' ); WC()->session = new $session_class(); WC()->session->init(); WC()->cart = new \WC_Cart(); WC()->customer = new \WC_Customer( get_current_user_id(), true ); } // Get the cart values $widget_cart_is_hidden = apply_filters( 'woocommerce_widget_cart_is_hidden', is_cart() || is_checkout() ); $product_count = WC()->cart->get_cart_contents_count(); $sub_total = WC()->cart->get_cart_subtotal(); $cart_items = WC()->cart->get_cart(); $toggle_button_link = $widget_cart_is_hidden ? wc_get_cart_url() : '#'; /** workaround WooCommerce Subscriptions issue that changes the behavior of is_cart() */ $toggle_button_classes = 'pagelayer-cart-button pagelayer-size-sm'; $toggle_button_classes .= $widget_cart_is_hidden ? ' pagelayer-menu-cart-hidden' : ''; $counter_attr = 'data-counter="' . $product_count . '"'; $cart_html = '<div class="pagelayer-menu-cart-toggle"> <a href="'. esc_attr( $toggle_button_link ) .'" class="'. $toggle_button_classes .'"> <span class="pagelayer-cart-button-text">'. $sub_total .'</span> <span class="pagelayer-cart-button-icon" '. $counter_attr .'> <i class="'.$el['atts']['icon_type'].'" aria-hidden="true"></i> </span> </a> </div>'; // If is cart and checkout page the except this if ( ! $widget_cart_is_hidden ){ ob_start(); wc_get_template( 'cart/mini-cart.php' ); $mini_cart_html = ob_get_clean(); $cart_html .= '<div class="pagelayer-menu-cart-container"> <form class="pagelayer-menu-cart-main woocommerce-cart-form" action="'. esc_url( wc_get_cart_url() ) .'" method="post"> <div class="pagelayer-menu-cart-close">×</div> '. $mini_cart_html .' </form> </div>'; } $el['atts']['cart_html'] = $cart_html; } // SiteMap Item Box - 2C function pagelayer_sc_sitemap_item(&$el){ $html_element = ''; $hier = ''; $depth = ''; $option = ''; $id = $el['id']; $option = '<div class="pagelayer-sitemap-section">'; $hier = (empty($el['atts']['hierarchical']) ? '' : $el['atts']['hierarchical']); $depth = (empty($el['atts']['depth']) ? '' : $el['atts']['depth']); if($el['atts']['sitemap_type'] == 'post_type'){ if(empty($el['atts']['title'])){ $el['atts']['title'] = 'Pages'; } $html_element .= $el['atts']['title']; $args = array( 'post_type' => $el['atts']['source_post'], 'orderby' => $el['atts']['order_post'], 'order' => $el['atts']['order'], 'hierarchical' => $hier, 'number' => $depth, 'posts_per_page' => -1, ); $option .= '<span>'.$html_element.'</span>'; $option .= '<ul>'; $pages = new WP_Query($args); $posts = $pages->posts; foreach ( $posts as $page ) { $option .= '<li class="pagelayer-sitemap-list-item" data-postID="'.$page->ID.'"><a class="pagelayer-ele-link" href="'.get_permalink($page->ID).'">'.$page->post_name.'</a></li>'; } $option .= '</ul>'; }else{ if(empty($el['atts']['title'])){ $el['atts']['title'] = 'Categories'; } $html_element .= $el['atts']['title']; $args = array( 'title_li' => 0, 'orderby' => $el['atts']['order_taxonomy'], 'order' => $el['atts']['order'], 'style' => '', 'hide_empty' => $el['atts']['hide_empty'], 'echo' => false, 'hierarchical' => $hier, 'taxonomy' => $el['atts']['source_taxonomy'], 'depth' => $depth, ); $taxonomies = get_categories( $args ); $option .= '<span>'.$html_element.'</span>'; $option .= '<ul>'; foreach ( $taxonomies as $taxonomy ) { $option .= '<li class="pagelayer-sitemap-list-item" data-postID="'.$taxonomy->term_id.'"><a class="pagelayer-ele-link" href="'.get_term_link($taxonomy->term_id).'">'.$taxonomy->name.'</a></li>'; } $option .= '</ul>'; } $option .= '</div>'; $el['atts']['sitemap_html'] = $option; } function pagelayer_sc_slides(&$el) { if( !pagelayer_is_live() ) { return; } foreach($el['inner_blocks'] as $key => $inner_block) { if(empty($inner_block['blockName']) || 'pagelayer/pl_slide' != $inner_block['blockName']) { continue; } $slide = serialize_block($inner_block); $col = get_comment_delimited_block_content('pagelayer/pl_col', [] , $slide); $row = get_comment_delimited_block_content('pagelayer/pl_inner_row', ['col_gap' => '0.0'] , $col); $el['inner_blocks'][$key] = array( 'blockName' => 'pagelayer/pl_content_slide', 'innerBlocks' => parse_blocks($row), 'innerHTML' => '', 'attrs' => array(), 'innerContent' => array(), ); } } function pagelayer_sc_chart(&$el){ $el['atts']['xcolor'] = empty($el['atts']['xcolor']) ? '' : pagelayer_parse_color($el['atts']['xcolor'], false); $el['atts']['ycolor'] = empty($el['atts']['ycolor']) ? '' : pagelayer_parse_color($el['atts']['ycolor'], false); } function pagelayer_sc_chart_datasets(&$el){ $el['atts']['chart_border_color'] = empty($el['atts']['chart_border_color']) ? '' : pagelayer_parse_color($el['atts']['chart_border_color'], false); $el['atts']['bg_color'] = empty($el['atts']['bg_color']) ? '' : pagelayer_parse_color($el['atts']['bg_color'], false); } // Render the image map function pagelayer_sc_image_map(&$el) { $map_size = pagelayer_isset($el['atts'], 'img_map-size'); $map_key = 'img_map-id-' . $map_size . '-url'; $el['atts']['map_img_id'] = isset($el['tmp'][$map_key]) ? $el['tmp'][$map_key] : pagelayer_isset($el['tmp'], 'map_img-id-url'); $el['atts']['pagelayer-srcset'] = $el['atts']['map_img_id'] . ', ' . $el['atts']['map_img_id'] . ' 1x, '; // Handle multiple paths if(isset($el['atts']['pagelayer_image_map']) && is_array($el['atts']['pagelayer_image_map'])){ $el['atts']['pagelayer_map_path'] = ''; // Initialize as empty foreach ($el['atts']['pagelayer_image_map'] as $key => $data) { $data_cord = isset($data['path']) ? $data['path'] : ''; $data_id = isset($key) ? $key : ''; $data_link = isset($data['link']) ? $data['link'] : ''; $el['atts']['pagelayer_map_path'] .= "<path class='pagelayer-imgmap-item' d='' stroke-width='2' data-cord='" . $data_cord . "' data-id='" . $data_id . "' fill-opacity='0.3' fill-rule='evenodd' data-link='" . $data_link . "'></path>"; } } if(empty($el['atts']['pagelayer_map_path'])){ $el['atts']['pagelayer_map_path'] = ' '; } $image_atts = array( 'name' => 'img_map-id', 'size' => 'img_map-size' ); pagelayer_get_img_srcset($el, $image_atts); } ai-functions.php 0000644 00000036147 15103567077 0007702 0 ustar 00 <?php // Are we being accessed directly ? if(!defined('PAGELAYER_VERSION')) { exit('Hacking Attempt !'); } // Add tmp attribute to block code function pagelayer_pro_replace_content_atts($content, $new_atts){ $blocks = parse_blocks( $content ); $output = ''; foreach ( $blocks as $block ) { $block_name = $block['blockName']; // Is pagelayer block if ( is_string( $block_name ) && 0 === strpos( $block_name, 'pagelayer/' ) ) { $_block = pagelayer_pro_add_atts_block($block, $new_atts); $output .= serialize_block($_block); continue; } $output .= serialize_block($block); } return $output; } function pagelayer_pro_add_atts_block($block, $new_atts){ global $pagelayer; // Load shortcode pagelayer_load_shortcodes(); if(empty($block['attrs']['pagelayer-id'])) return $block; $pl_id = $block['attrs']['pagelayer-id']; if (isset($new_atts[$pl_id]) && is_array($new_atts[$pl_id])){ $block['attrs'] = array_merge($block['attrs'], $new_atts[$pl_id]); // If block saved by Pagelayer Editor if(in_array( $block['blockName'], ['pagelayer/pl_inner_col', 'pagelayer/pl_inner_row'])){ $block['blockName'] = str_replace('inner_', '', $block['blockName']); } $tag = substr( $block['blockName'], 10 ); $pl_tag = str_replace('-', '_', $tag); if(isset($pagelayer->shortcodes[$pl_tag])){ // Create attribute Object $innerHTML = pagelayer_isset($pagelayer->shortcodes[$pl_tag], 'innerHTML'); if(!empty($innerHTML) && isset($block['attrs'][$innerHTML])){ $block['innerHTML'] = $block['attrs'][$innerHTML]; $block['innerContent'] = array($block['attrs'][$innerHTML]); } } } // This have innerBlocks if(!empty($block['innerBlocks']) && is_array($block['innerBlocks'])){ foreach($block['innerBlocks'] as $key => $inner_block){ $block['innerBlocks'][$key] = pagelayer_pro_add_atts_block($inner_block, $new_atts); } } return $block; } // Add tmp attribute to block code function pagelayer_pro_extract_editable_atts($content, $only_images = false){ $blocks = parse_blocks( $content ); $el_atts = array(); foreach( $blocks as $block ){ $block_name = $block['blockName']; // Is pagelayer block if( is_string( $block_name ) && 0 === strpos( $block_name, 'pagelayer/' ) ){ pagelayer_pro_parse_ai_atts($block, $el_atts, $only_images); } } return array_filter($el_atts); } function pagelayer_pro_parse_ai_atts($block, &$el_atts, $only_images = false){ global $pagelayer; // Load shortcode pagelayer_load_shortcodes(); // TODO: if empty then assign id and updated content if(empty($block['attrs']['pagelayer-id'])){ return; } // If block saved by Pagelayer Editor if(in_array( $block['blockName'], ['pagelayer/pl_inner_col', 'pagelayer/pl_inner_row'])){ $block['blockName'] = str_replace('inner_', '', $block['blockName']); } $tag = substr( $block['blockName'], 10 ); $pl_tag = str_replace('-', '_', $tag); if(isset($pagelayer->shortcodes[$pl_tag])){ // Create attribute Object $pl_props = $pagelayer->shortcodes[$pl_tag]; $pl_id = $block['attrs']['pagelayer-id']; $el_atts[$pl_id] = array(); foreach($pagelayer->tabs as $tab){ if(empty($pl_props[$tab])){ continue; } foreach($pl_props[$tab] as $section => $_props){ $props = !empty($pl_props[$section]) ? $pl_props[$section] : $pagelayer->styles[$section]; if(empty($props)){ continue; } // Reset / Create the cache foreach($props as $prop => $param){ // No value set if(empty($block['attrs'][$prop]) || (isset($param['ai']) && $param['ai'] === false)){ continue; } // Is editable? if(!empty($param['edit']) && empty($only_images)){ $el_atts[$pl_id][$prop] = $block['attrs'][$prop]; $el_atts[$pl_id]['blockName'] = $pl_props['name']; } // Is image? if(!empty($only_images) && !empty($param['type']) && $param['type'] == 'image'){ $el_atts['img_urls'][] = $block['attrs'][$prop]; } // Is multi_image? if(!empty($only_images) && !empty($param['type']) && $param['type'] == 'multi_image'){ $el_atts['img_urls'][] = $block['attrs'][$prop]; } } } } } // This have innerBlocks if(!empty($block['innerBlocks'])){ foreach($block['innerBlocks'] as $key => $inner_block){ pagelayer_pro_parse_ai_atts($inner_block, $el_atts, $only_images); } } } // Call to AI server function pagelayer_pro_ai_prompt_run($ai_data = array()){ global $pagelayer; if(empty($pagelayer->license) || empty($pagelayer->license['license'])){ return null; } // Only SoftWP license works $ai_data['license'] = $pagelayer->license['license']; $ai_data['url'] = apply_filters('pagelayer_ai_siteurl', site_url()); $response = wp_remote_post(PAGELAYER_AI_API, [ 'body' => $ai_data, 'timeout' => 600, ]); $body = wp_remote_retrieve_body($response); $result = json_decode($body, true); if(isset($_GET['debug1']) && $_GET['debug1'] == 'regenerate'){ pagelayer_print($ai_data); pagelayer_print($result); } if(isset($result['error'])){ // TODO: show this error error if possible error_log('API Request Failed: ' . $result['error']); return null; } if(isset($result['response'])){ $json_content = $result['response']; // Remove markdown code fences if they exist if(strpos($json_content, '```') !== false){ $json_content = preg_replace('/^```(?:json)?\s*/', '', trim($json_content)); $json_content = preg_replace('/\s*```$/', '', $json_content); } $generated = json_decode($json_content, true); if (json_last_error() === JSON_ERROR_NONE) { return $generated; } else { error_log("JSON decode error: " . json_last_error_msg()); return null; } } return null; } // The actual function to import the theme function pagelayer_pro_generate_ai_contents($contents, $args = array()){ if(empty($args['description'])) return $contents; $widgets_attrs = []; // STEP 1: Prepare blocks and extract editable attributes foreach($contents as $page => $content){ if(defined('PAGELAYER_BLOCK_PREFIX') && PAGELAYER_BLOCK_PREFIX == 'wp'){ $content = str_replace('<!-- sp:pagelayer', '<!-- wp:pagelayer', $content); $content = str_replace('<!-- /sp:pagelayer', '<!-- /wp:pagelayer', $content); } $contents[$page] = $content; if(!pagelayer_has_blocks($content)) continue; $widgets_attrs[$page] = pagelayer_pro_extract_editable_atts($content); } if(empty($widgets_attrs)){ return $contents; } // STEP 2: Prepare data for AI prompt $widgets_attrs_json = json_encode( $widgets_attrs ); $data = [ 'request_type' => 'builder_replacer', 'site_name' => get_bloginfo('name'), 'user_context' => $args['description'], 'widgets_attrs_json' => $widgets_attrs_json ]; // STEP 3: Run AI prompt $new_atts = pagelayer_pro_ai_prompt_run($data); // Retry logic if AI prompt fails if(empty($new_atts)){ if(empty($args['retry'])){ $args['retry'] = 1; $contents = pagelayer_pro_generate_ai_contents($contents, $args); } return $contents; } // STEP 4: Check for unconverted attributes $updated_content = !empty($new_atts)? $new_atts : array(); $unconverted = array(); foreach($widgets_attrs as $page => $atts){ $updated = empty($updated_content[$page]) ? [] : $updated_content[$page]; $_unconverted = pagelayer_pro_unconverted_fields($atts, $updated); if(!empty($_unconverted)){ $unconverted[$page] = $_unconverted; } } // STEP 5: Re-run prompt for unconverted fields if(!empty($unconverted)){ $data['widgets_attrs_json'] = json_encode($unconverted); $retry_atts = pagelayer_pro_ai_prompt_run($data); if(!empty($retry_atts)){ if(!empty($retry_atts) && is_array($retry_atts)){ foreach($new_atts as $page => $new_fields){ if(empty($retry_atts[$page])) continue; $new_atts[$page] = array_replace_recursive($new_atts[$page], $retry_atts[$page]); } } } } //pagelayer_print($new_atts); foreach($contents as $page => $content){ if(!isset($new_atts[$page])){ continue; } $content = pagelayer_pro_replace_content_atts($content, $new_atts[$page]); $contents[$page] = $content; } return $contents; } // Content image replace with random images function pagelayer_pro_replace_rand_imgs($content, $images, &$mapImages = array()) { if(empty($images) || !is_array($images)){ return $content; } // Image provide by user to replace $image_urls = array_map(function($item) { $url = is_array($item) ? $item['image_url'] : $item; return strpos($url, 'https://images.pexels.com/photos/') === 0 ? strtok($url, '?') : $url; }, $images); $img_data = pagelayer_pro_extract_editable_atts($content, true); if(empty($img_data['img_urls']) || !is_array($image_urls)){ return $content; } // Copy from original image list $rand_images = $image_urls; shuffle($rand_images); foreach($img_data['img_urls'] as $imgUrl){ $imgUrls = is_string($imgUrl) ? explode(',', $imgUrl) : (is_array($imgUrl) ? $imgUrl : []); foreach ($imgUrls as $url) { $url = trim($url); // Build a lookup map for replaced images if(!pagelayer_pro_is_image_url($url)){ continue; } // Cache replacements for same URL if(!isset($mapImages[$url])) { // Refill with random images if(empty($rand_images)){ $rand_images = $image_urls; shuffle($rand_images); } $first_img = array_shift($rand_images); // URL replace with first image and removed first image to random image list $mapImages[$url] = pagelayer_pro_resize_pexel_img($url, $first_img); } // Replace old image URL with the new one in the content $escapedUrl = str_replace('/', '\/', $url); $escapedMapUrl = str_replace('/', '\/', $mapImages[$url]); $content = str_replace([$url, $escapedUrl], [$mapImages[$url], $escapedMapUrl], $content); } } return $content; } // Get random Pexels images function pagelayer_pro_resize_pexel_img($url, $new_url){ if(empty($new_url)){ return $url; } // Get the dimensions of the old image (assuming the path is local) $template_path = apply_filters('pagelayer_template_path', ''); $oldImagePath = str_replace('{{theme_url}}', $template_path, $url); // Replace theme_url placeholder // Check if the new image URL is from Pexels if (strpos($new_url, 'https://images.pexels.com/photos/') !== 0) { return $new_url; } // Assuming that the old image is local and can be fetched $size = @getimagesize($oldImagePath); $size = $size ? $size : [0, 0]; list($width, $height) = $size; if(empty($width) || empty($height)){ return $new_url; } // Parse existing query parameters and remove width/height $parsed_url = parse_url( $new_url ); parse_str( isset( $parsed_url['query'] ) ? $parsed_url['query'] : '', $query ); unset( $query['w'], $query['h'] ); // Ensure optimization parameters are included $optimize_defaults = [ 'auto' => 'compress', 'cs' => 'tinysrgb', 'dpr' => '1', 'fit' => 'crop', 'pl' => pagelayer_RandomString(4), // Set unique ID for each image to import each suggested image ]; // Merge defaults if not already set $query = array_merge( $optimize_defaults, $query ); // Add width and height $query['w'] = (int) $width; $query['h'] = (int) $height; // Rebuild the full URL $base = strtok( $new_url, '?' ); $new_url = $base . '?' . http_build_query( $query ); return $new_url; } // Helper function to detect image URLs for import only function pagelayer_pro_is_image_url($str) { return is_string($str) && preg_match('/\.(jpe?g|png|gif)(\?.*)?$/i', $str) && strpos($str, '{{theme_url}}') !== false; } function pagelayer_pro_unconverted_fields($inputWidgets, $updatedContent){ $unconverted = []; if(empty($updatedContent)){ return $inputWidgets; } foreach($inputWidgets as $widgetId => $widgetData){ foreach ($widgetData as $field => $value) { // Skip field if($field == 'blockName'){ continue; } // TEXT FIELD CHECK if (is_string($value) && strip_tags($value) !== '' && !is_numeric($value)) { $original = trim($value); $updated = $updatedContent[$widgetId][$field] ? $updatedContent[$widgetId][$field] : ''; if (is_string($updated) && (trim($updated) === '' || trim($updated) === $original)) { $unconverted[$widgetId][$field] = $original; } } } } return $unconverted; } // Download external images like pexels function pagelayer_pro_download_external_images($content) { global $pagelayer; if (empty($content)){ return $content; } if (defined('PAGELAYER_BLOCK_PREFIX') && PAGELAYER_BLOCK_PREFIX == 'wp') { $content = str_replace('<!-- sp:pagelayer', '<!-- wp:pagelayer', $content); $content = str_replace('<!-- /sp:pagelayer', '<!-- /wp:pagelayer', $content); } if (!pagelayer_has_blocks($content)) return $content; $widgets_attrs = pagelayer_pro_extract_editable_atts($content); if (empty($widgets_attrs)) return $content; $processed_images = []; foreach($widgets_attrs as $widget_id => $attrs) { if( empty($attrs['img_urls']) || !is_array($attrs['img_urls'])){ continue; } foreach($attrs['img_urls'] as $image_url) { $imgUrls = is_string($image_url) ? explode(',', $image_url) : (is_array($image_url) ? $image_url : []); foreach ($imgUrls as $url) { if (!is_string($url)){ continue; } $url = trim($url); // Caching the image if(strpos($url, 'https://images.pexels.com/photos/') === false || isset($pagelayer->import_media[$url])){ continue; } // Get ilename $filename = basename(strtok($url, '?')); // We are going to create a loop to find the image for($i = 1; $i <= 3; $i++){ // Upload the image $ret = pagelayer_upload_media($filename, file_get_contents($url)); // Lets check the file exists ? if(!empty($ret)){ // Lets check if the file exists $tmp_image_path = pagelayer_cleanpath(get_attached_file($ret)); // If the file does not exist, simply delete the old upload as well if(!file_exists($tmp_image_path)){ wp_delete_attachment($ret, true); $ret = false; // The image does exist and we can continue }else{ break; } } } if(empty($ret)){ continue; } // This replaces images when inserting content $pagelayer->import_media[$url] = $ret; $imgs_json = array('sitepad_img_source' => 'pexels.com', 'sitepad_download_url' => $url, 'sitepad_img_lic' => ''); $fields = array('sitepad_img_source', 'sitepad_download_url', 'sitepad_img_lic'); foreach($fields as $field){ if(!empty($imgs_json[$field])){ update_post_meta($ret, $field, $imgs_json[$field]); } } } } } return $content; } premium.php 0000644 00001536746 15103567077 0006774 0 ustar 00 <?php ////////////////////////////////////////////////////////////// //=========================================================== // premium.php //=========================================================== // PAGELAYER // Inspired by the DESIRE to be the BEST OF ALL // ---------------------------------------------------------- // Started by: Pulkit Gupta // Date: 23rd Jan 2017 // Time: 23:00 hrs // Site: http://pagelayer.com/wordpress (PAGELAYER) // ---------------------------------------------------------- // Please Read the Terms of use at http://pagelayer.com/tos // ---------------------------------------------------------- //=========================================================== // (c)Pagelayer Team //=========================================================== ////////////////////////////////////////////////////////////// // Are we being accessed directly ? if(!defined('PAGELAYER_PRO_VERSION')) { exit('Hacking Attempt !'); } global $pagelayer; // Image Hotspot pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_image_hotspot', array( 'name' => __pl('Image Hotspot'), 'group' => 'image', 'has_group' => [ 'section' => 'params', 'prop' => 'elements' ], 'holder' => '.pagelayer-icon-holder', 'html' => '<div class="pagelayer-image-hotspot-holder"> <img class="pagelayer-img" src="{{{img-url}}}" title="{{{img-title}}}" alt="{{{img-alt}}}" /> <div class="pagelayer-icon-holder pagelayer-hotspots-{{common_tip_show}} pagelayer-{{common_tip_theme}}"></div> </div>', 'params' => array( 'elements' => array( 'type' => 'group', 'label' => __pl('hotspots'), 'sc' => PAGELAYER_SC_PREFIX.'_hotspot', 'item_label' => array( 'default' => __pl('hotspot'), 'param' => 'title', ), 'count' => 1, 'text' => __pl('Add New Hotspot'), ), 'img' => array( 'type' => 'image', 'label' => __pl('Main Image'), 'default' => PAGELAYER_URL.'/images/default-image.png', 'desc' => __pl('Choose an image from Media Library'), 'css' => ['{{element}} .pagelayer-icon-holder' => 'position:absolute; top:0; left:0; height:100%; width:100%;', '{{element}} .pagelayer-icon-holder .pagelayer-ele-wrap' => 'display: contents', '{{element}} .pagelayer-image-hotspot-holder' => 'position:relative'], ), 'icon_anim_hover' => array( 'type' => 'select', 'label' => __pl('icon_animation'), 'list' => [ '' => __pl('none'), 'grow' => __pl('Grow'), 'shrink' => __pl('Shrink'), 'pulse' => __pl('Pulse'), 'pulse-grow' => __pl('Pulse Grow'), 'pulse-shrink' => __pl('Pulse Shrink'), 'push' => __pl('Push'), 'pop' => __pl('Pop'), 'buzz' => __pl('Buzz'), 'buzz-out' => __pl('Buzz Out'), 'float' => __pl('Float'), 'sink' => __pl('Sink'), 'bob' => __pl('Bob'), 'hang' => __pl('Hang'), 'bounce-in' => __pl('Bounce In'), 'bounce-out' => __pl('Bounce Out'), 'rotate' => __pl('Rotate'), 'grow-rotate' => __pl('Grow Rotate'), 'skew-forward' => __pl('Skew Forward'), 'skew-backward' => __pl('Skew Backward'), 'wobble-vertical' => __pl('Wobble Vertical'), 'wobble-horizontal' => __pl('Wobble Horizontal'), 'wobble-bottom-to-right' => __pl('Wobble Bottom To Right'), 'wobble-top-to-right' => __pl('Wobble Top To Right'), 'wobble-top' => __pl('Wobble Top'), 'wobble-bottom' => __pl('Wobble Bottom'), 'wobble-skew' => __pl('Wobble Skew'), ], 'addAttr' => ['{{element}} .pagelayer-icon-holder' => 'pagelayer-animation="{{icon_anim_hover}}"'], ), /* 'common_hotspot_color' => array( 'type' => 'color', 'label' => __pl('Hotspot Theme'), 'default' => 'mp-text-color-red', 'list' => array( 'mp-text-color-red' => __pl('red'), 'mp-text-color-dark-grey' => __pl('grey'), 'mp-text-color-black' => __pl('black'), 'custom' => __pl('custom'), ), ), 'common_hotspot_custom_color' => array( 'type' => 'color', 'label' => __pl('Hotspot Color'), 'default' => '#e25441', 'req' => array( 'common_hotspot_color' => 'custom' ) ), 'common_plus_color' => array( 'type' => 'color', 'label' => __pl('Hotspot Icon Color'), 'default' => '#ffffff', 'req' => array( 'common_hotspot_color' => 'custom' ) ), 'common_hotspot_size' => array( 'type' => 'radio', 'label' => __pl('Hotspot Size'), 'default' => 'normal', 'list' => array( 'small' => __pl('small'), 'normal' => __pl('middle'), 'big' => __pl('large'), ) ),*/ 'common_tip_show' => array( 'type' => 'select', 'label' => __pl('tooltip_display'), 'default' => 'hover', 'list' => array( 'hover' => __pl('On Hover'), 'always' => __pl('always'), 'click' => __pl('On Click'), ) ), ) ) ); // Hotspot pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_hotspot', array( 'name' => __pl('hotspot'), 'group' => 'image', 'not_visible' => 1, 'parent' => [PAGELAYER_SC_PREFIX.'_image_hotspot'], 'innerHTML' => 'tooltip_text', 'html' => '<div class="pagelayer-hotspots-icon-holder"> <div if-ext="{{icon_pulse}}" class="pagelayer-image-hotspots-anim"> <i class="{{icon}}"></i> <div if="{{tooltip_text}}" class="pagelayer-tooltip-text pagelayer-tooltip-{{tooltip_position}}"> {{tooltip_text}} </div> </div> </div>', 'params' => array( 'title' => array( 'type' => 'text', 'label' => __pl('title'), 'default' => 'Lorem', ), 'align_top' => array( 'type' => 'slider', 'label' => __pl('verticle_postion'), 'default' => 50, 'min' => 0, 'max' => 100, 'css' => ['{{element}}' => 'top: {{val}}%'], ), 'align_left' => array( 'type' => 'slider', 'label' => __pl('horizontal_pos'), 'default' => 50, 'min' => 0, 'max' => 100, 'css' => ['{{element}}' => 'left: {{val}}%'], ), ), 'icon_style' => [ 'icon' => array( 'type' => 'icon', 'label' => __pl('icon'), 'default' => 'fas fa-map-pin', 'css' => ['{{element}}' => 'position: absolute;transform: translateY(-{{align_top}}%) translateX(-{{align_left}}%);display: inline-block; cursor: pointer;'], ), 'icon_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-hotspots-icon-holder .fas' => 'color:{{val}}'], ), 'icon_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-hotspots-icon-holder .fas' => 'background-color:{{val}}'], ), 'icon_pulse' => array( 'type' => 'checkbox', 'label' => __pl('pulse'), 'default' => 'true', ), 'icon_pluse_color' => array( 'type' => 'color', 'label' => __pl('pulse_color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-image-hotspots-anim::before' => 'background-color:{{val}}'], ), 'icon_rounded' => array( 'type' => 'checkbox', 'label' => __pl('rounded'), 'default' => 'true', 'css' => ['{{element}} .pagelayer-hotspots-icon-holder .fas' => 'border-radius:100%', '{{element}} .pagelayer-image-hotspots-anim::before ' => 'border-radius:100%'], ), 'icon_padding' => array( 'type' => 'dimension', 'label' => __pl('padding'), 'screen' => 1, 'default' => '15,18', 'css' => ['{{element}} .pagelayer-hotspots-icon-holder .fas' => 'padding:{{val[0]}}px {{val[1]}}px;margin-right:1px'], ), ], 'tooltip_style' => [ 'tooltip_text' => array( 'type' => 'editor', 'label' => __pl('text'), 'default' => 'Lorem ipsum dolor sit amet', 'edit' => '.pagelayer-tooltip-text', ), 'tooltip_position' => array( 'type' => 'select', 'label' => __pl('position'), 'default' => 'top', 'list' => array( 'top' => __pl('top'), 'right' => __pl('right'), 'bottom' => __pl('bottom'), 'left' => __pl('left'), ) ), 'common_tip_theme' => array( 'type' => 'select', 'label' => __pl('theme'), 'default' => 'tooltipster-default', 'list' => array( 'tooltipster-default' => __pl('dark'), /* 'tooltipster-light' => __pl('silver'), 'tooltipster-noir' => __pl('noir'), 'tooltipster-shadow' => __pl('shadow'), */ 'custom' => __pl('custom'), ), ), 'common_custom_bg_theme' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#eb002c', 'req' => array( 'common_tip_theme' => 'custom' ), 'css' => ['{{element}} .pagelayer-tooltip-text' => 'background-color:{{val}}', '{{element}} .pagelayer-tooltip-text:after' => 'border-color:transparent !important ;border-{{tooltip_position}}-color:{{val}} !important'] ), 'common_custom_font_theme' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'req' => array( 'common_tip_theme' => 'custom' ), 'css' => ['{{element}} .pagelayer-tooltip-text' => 'color:{{val}}'] ), ], 'styles' => [ 'icon_style' => __pl('icon'), 'tooltip_style' => __pl('tooltip') ] ) ); // Audio pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_audio', array( 'name' => __pl('audio'), 'group' => 'media', 'html' => '<div class="pagelayer-audio-container"> <audio controls> <source src="{{{src-url}}}"></source> </audio> </div>', 'params' => array( 'src' => array( 'type' => 'audio', 'label' => __pl('wp_audio_source_title'), 'desc' => __pl('wp_audio_source_desc'), 'default' => 'http://wpcom.files.wordpress.com/2007/01/mattmullenweg-interview.mp3', ), 'autoplay' => array( 'type' => 'checkbox', 'label' => __pl('wp_audio_autoplay_title'), 'desc' => __pl('wp_audio_autoplay_desc'), 'default' => '', 'addAttr' => ['{{element}} audio' => 'autoplay="autoplay"'], ), 'loop' => array( 'type' => 'checkbox', 'label' => __pl('wp_audio_loop_title'), 'desc' => __pl('wp_audio_loop_desc'), 'default' => '', 'addAttr' => ['{{element}} audio' => 'loop="loop"'], ), 'width' => array( 'type' => 'slider', 'label' => __pl('shape_width'), 'units' => ['%', 'px'], 'min' => 0, 'max' => 100, 'screen' => 1, 'css' => 'width: {{val}} !important', ), 'padding' => array( 'type' => 'dimension', 'label' => __pl('padding'), 'default' => '10,10', 'screen' => 1, 'css' => ['{{element}} .pagelayer-audio-container' => 'padding-top: {{val[0]}}px; padding-bottom: {{val[0]}}px; padding-left: {{val[1]}}px; padding-right: {{val[1]}}px;'], ), ), 'playpause_style' => [ 'playpause_size' => array( 'type' => 'spinner', 'label' => __pl('size'), 'default' => 12, 'min' => 0, 'max' => 200, 'screen' => 1, 'css' => ['{{element}} .mejs-playpause-button button' => 'font-size:{{val}}px;'] ), 'playpause_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#333333', 'css' => ['{{element}} .mejs-playpause-button button:after' => 'color:{{val}}'] ), 'playpause_space' => array( 'type' => 'spinner', 'label' => __pl('space_around'), 'default' => 5, 'min' => -100, 'max' => 100, 'screen' => 1, 'css' => ['{{element}} .mejs-playpause-button button' => 'padding:calc( 1em + {{val}}px ) !important;'] ), 'playpause_bg' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#E5E5E5', 'css' => ['{{element}} .mejs-playpause-button button' => 'background-color:{{val}} !important;'] ), 'playpause_radius' => array( 'type' => 'slider', 'label' => __pl('border_radius'), 'default' => 50, 'min' => 0, 'max' => 50, 'screen' => 1, 'css' => ['{{element}} .mejs-playpause-button button' => 'border-radius: {{val}}%;'] ), ], 'duration_style' => [ 'show_duration' => array( 'type' => 'checkbox', 'label' => __pl('show'), 'default' => 'true', 'addAttr' => ['{{element}} .pagelayer-audio-container' => 'show_duration="{{show_duration}}"'], ), 'duration_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#333333', 'css' => ['{{element}} .mejs-duration' => 'color:{{val}} !important;'] ), ], 'progress_style' => [ 'show_progress' => array( 'type' => 'checkbox', 'label' => __pl('show'), 'default' => 'true', 'addAttr' => ['{{element}} .pagelayer-audio-container' => 'show_progress="{{show_progress}}"'], ), 'progress_height' => array( 'type' => 'slider', 'label' => __pl('progress_height'), 'units' => ['px', '%'], 'min' => 0, 'max' => 100, 'screen' => 1, 'default' => 10, 'css' => [ '{{element}} .mejs-time-total' => 'height:{{val}} !important;', ], ), 'progress_bg' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => 'rgba(0,0,0,0.1)', 'css' => ['{{element}} .mejs-controls .mejs-time-rail .mejs-time-total' => 'background:{{val}} !important;'] ), 'progress_loaded' => array( 'type' => 'color', 'label' => __pl('loaded_color'), 'default' => '#777777', 'css' => ['{{element}} .mejs-time-loaded' => 'background:{{val}} !important;'] ), 'progress_current' => array( 'type' => 'color', 'label' => __pl('current_color'), 'default' => '#0986c0', 'css' => ['{{element}} .mejs-time-current' => 'background:{{val}} !important;'] ), 'progress_hovered' => array( 'type' => 'color', 'label' => __pl('hovered_color'), 'default' => '#b5d2f9', 'css' => ['{{element}} .mejs-time-hovered' => 'background:{{val}} !important;'] ), 'progress_handle' => array( 'type' => 'color', 'label' => __pl('handle_color'), 'default' => '#000000', 'css' => [ '{{element}} .mejs-time-handle' => 'background:{{val}} !important;', '{{element}} .mejs-time-handle-content' => 'background:{{val}} !important;', ] ), ], 'current_style' => [ 'show_current' => array( 'type' => 'checkbox', 'label' => __pl('show'), 'default' => 'true', 'addAttr' => ['{{element}} .pagelayer-audio-container' => 'show_current="{{show_current}}"'], ), 'current_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#333333', 'css' => ['{{element}} .mejs-currenttime' => 'color:{{val}} !important;'] ), ], 'volume_style' => [ 'show_volume' => array( 'type' => 'checkbox', 'label' => __pl('show'), 'default' => 'true', 'addAttr' => ['{{element}} .pagelayer-audio-container' => 'show_volume="{{show_volume}}"'], ), 'volume_size' => array( 'type' => 'spinner', 'label' => __pl('size'), 'default' => 12, 'min' => 0, 'max' => 200, 'screen' => 1, 'css' => ['{{element}} .mejs-volume-button button' => 'font-size:{{val}}px;'] ), 'volume_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#333333', 'css' => ['{{element}} .mejs-volume-button button:after' => 'color:{{val}}'] ), 'volume_space' => array( 'type' => 'spinner', 'label' => __pl('space_around'), 'default' => 5, 'min' => -100, 'max' => 100, 'screen' => 1, 'css' => ['{{element}} .mejs-volume-button button' => 'padding:calc( 1em + {{val}}px ) !important;'] ), 'volume_bg' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#E5E5E5', 'css' => ['{{element}} .mejs-volume-button button' => 'background-color:{{val}} !important;'] ), 'volume_radius' => array( 'type' => 'slider', 'label' => __pl('border_radius'), 'default' => 50, 'min' => 0, 'max' => 50, 'screen' => 1, 'css' => ['{{element}} .mejs-volume-button button' => 'border-radius: {{val}}%;'] ), ], 'volume_slider' => [ 'volume_height' => array( 'type' => 'slider', 'label' => __pl('progress_height'), 'units' => ['px', '%'], 'min' => 0, 'max' => 100, 'screen' => 1, 'default' => 10, 'css' => [ '{{element}} .mejs-horizontal-volume-total' => 'height:{{val}} !important;' ], ), 'volume_width' => array( 'type' => 'slider', 'label' => __pl('shape_width'), 'min' => 0, 'max' => 100, 'default' => 35, 'screen' => 1, 'css' => [ '{{element}} .mejs-horizontal-volume-total' => 'width:{{val}}px !important;', '{{element}} .mejs-horizontal-volume-slider' => 'width: calc( {{val}}px + 10px ) !important;', ], ), 'vslides_bg' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => 'rgba(0,0,0,0.1)', 'css' => ['{{element}} .mejs-horizontal-volume-total' => 'background:{{val}} !important;'] ), 'vslider_current' => array( 'type' => 'color', 'label' => __pl('current_color'), 'default' => '#777777', 'css' => ['{{element}} .mejs-horizontal-volume-current' => 'background:{{val}} !important;'] ), ], 'styles' => [ 'playpause_style' => __pl('playpause_style'), 'duration_style' => __pl('duration_style'), 'progress_style' => __pl('progress_style'), 'current_style' => __pl('current_style'), 'volume_style' => __pl('volume_style'), 'volume_slider' => __pl('volume_slider'), ] ) ); // Video Slider pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_video_slider', array( 'name' => __pl('video_slider'), 'group' => 'media', 'has_group' => [ 'section' => 'params', 'prop' => 'elements' ], 'prevent_inside' => ['pl_slides'], 'holder' => '.pagelayer-video-slider-holder', 'child_selector' => '>.pagelayer-owl-stage-outer>.pagelayer-owl-stage>.pagelayer-owl-item', // Make it very specifc 'html' => '<div class="pagelayer-video-slider-holder pagelayer-owl-holder pagelayer-owl-carousel pagelayer-owl-theme"></div>', 'params' => array( 'elements' => array( 'type' => 'group', 'label' => __pl('Videos'), 'sc' => PAGELAYER_SC_PREFIX.'_video', 'item_label' => array( 'default' => __pl('video'), 'param' => 'video_type' ), 'count' => 2, 'text' => __pl('add_media'), ), ), 'slider_options' => $pagelayer->slider_options, 'arrow_styles' => $pagelayer->slider_arrow_styles, 'pager_styles' => $pagelayer->slider_pager_styles, 'styles' => [ 'slider_options' => __pl('slider_options'), 'arrow_styles' => __pl('arrow_styles'), 'pager_styles' => __pl('pager_styles'), ], ) ); // Download Button pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_download', array( 'name' => __pl('Download Button'), 'group' => 'button', 'html' => '<a href="{{{attachment-url}}}" target="_blank" class="pagelayer-btn-holder pagelayer-ele-link {{type}} {{size}} {{icon_position}}" download=""> <i class="{{icon}} pagelayer-btn-icon"></i> <span class="pagelayer-btn-text">{{text}}</span> <i class="{{icon}} pagelayer-btn-icon"></i> </a>', 'params' => array( 'text' => array( 'type' => 'text', 'label' => __pl('button_text_label'), 'default' => 'Download', 'edit' => '.pagelayer-btn-text' ), 'attachment' => array( 'type' => 'media', 'label' => __pl('media_file'), 'desc' => __pl('media_description'), 'default' => '', ), 'file_name' => array( 'type' => 'text', 'label' => __pl('Download File Name'), 'addAttr' => ['{{element}} a.pagelayer-btn-holder' => 'download="{{file_name}}"'] ), 'full_width' => array( 'type' => 'checkbox', 'label' => __pl('stretch'), 'screen' => 1, 'css' => ['{{element}} a' => 'width: 100%; text-align: center;'] ), 'align' => array( 'type' => 'radio', 'label' => __pl('obj_align_label'), 'default' => 'left', 'screen' => 1, 'css' => 'text-align: {{val}}', 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ), 'req' => array( 'full_width' => '' ) ), 'btn_typo' => array( 'type' => 'typography', 'label' => __pl('quote_content_typo'), 'css' => [ '{{element}} .pagelayer-btn-text' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', '{{element}} .pagelayer-btn-holder' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', ], ), ), 'btn_style' => [ 'type' => array( 'type' => 'select', 'label' => __pl('button_type_label'), 'default' => 'pagelayer-btn-default', 'list' => array( 'pagelayer-btn-default' => __pl('btn_type_default'), 'pagelayer-btn-primary' => __pl('btn_type_primary'), 'pagelayer-btn-secondary' => __pl('btn_type_secondary'), 'pagelayer-btn-success' => __pl('btn_type_success'), 'pagelayer-btn-info' => __pl('btn_type_info'), 'pagelayer-btn-warning' => __pl('btn_type_warning'), 'pagelayer-btn-danger' => __pl('btn_type_danger'), 'pagelayer-btn-dark' => __pl('btn_type_dark'), 'pagelayer-btn-light' => __pl('btn_type_light'), 'pagelayer-btn-link' => __pl('btn_type_link'), 'pagelayer-btn-custom' => __pl('btn_type_custom') ), ), 'size' => array( 'type' => 'select', 'label' => __pl('button_size_label'), 'default' => 'pagelayer-btn-large', 'list' => array( 'pagelayer-btn-mini' => __pl('mini'), 'pagelayer-btn-small' => __pl('small'), 'pagelayer-btn-large' => __pl('large'), 'pagelayer-btn-extra-large' => __pl('extra_large'), 'pagelayer-btn-double-large' => __pl('double_large'), 'pagelayer-btn-custom' => __pl('custom'), ) ), 'btn_custom_size' => array( 'type' => 'spinner', 'label' => __pl('btn_custom_size'), 'min' => 1, 'step' => 1, 'max' => 100, 'default' => 5, 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'padding: {{val}}px calc({{val}}px *2)'], 'req' => array( 'size' => 'pagelayer-btn-custom' ), ), 'btn_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => '', //'no_val' => 1,// Dont set any value to element 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), 'req' => array( 'type' => 'pagelayer-btn-custom', ), ), 'btn_bg_color' => array( 'type' => 'color', 'label' => __pl('btn_bg_color_label'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-btn-holder' => 'background-color: {{val}};'], 'req' => array( 'type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => '' ), ), 'btn_color' => array( 'type' => 'color', 'label' => __pl('btn_color_label'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-btn-holder' => 'color: {{val}};'], 'req' => array( 'type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => '' ), ), 'btn_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('btn_hover_delay_label'), 'desc' => __pl('btn_hover_delay_desc'), 'min' => 0, 'step' => 100, 'max' => 5000, 'default' => 400, 'css' => ['{{element}} .pagelayer-btn-holder' => '-webkit-transition: all {{val}}ms !important; transition: all {{val}}ms !important;'], 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('btn_bg_color_hover_label'), 'default' => '', 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'background-color: {{val}};'], 'req' => array( 'type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_color_hover' => array( 'type' => 'color', 'label' => __pl('btn_color_hover_label'), 'default' => '', 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'color: {{val}};'], 'req' => array( 'type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => 'hover' ), ), ], 'icon_style' => [ 'icon' => array( 'type' => 'icon', 'label' => __pl('service_box_font_icon_label'), 'default' => 'fas fa-download', ), 'icon_position' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'pagelayer-btn-icon-left', 'list' => array( 'pagelayer-btn-icon-left' => __pl('left'), 'pagelayer-btn-icon-right' => __pl('right') ), 'req' => array( '!icon' => '' ) ), 'icon_spacing' => array( 'type' => 'slider', 'label' => __pl('icon_spacing'), 'min' => 1, 'step' => 1, 'max' => 100, 'default' => 5, 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-icon' => 'padding: 0 {{val}}px;'], 'req' => array( '!icon' => '' ), ), ], 'border_style' => [ 'btn_bor_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => '', //'no_val' => 1,// Dont set any value to element 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ) ), 'btn_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_color' => array( 'type' => 'color', 'label' => __pl('border_color_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-color: {{val}};'], 'req' => array( '!btn_border_type' => '' ), 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!btn_border_type' => '' ], 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!btn_border_type' => '' ), 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'btn_bor_hover' => 'hover' ), ), 'btn_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color_hover_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'border-color: {{val}};'], 'req' => array( '!btn_border_type_hover' => '' ), 'show' => array( 'btn_bor_hover' => 'hover' ), ), 'btn_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width_hover'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!btn_border_type_hover' => '' ], 'show' => array( 'btn_bor_hover' => 'hover' ), ), 'btn_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius_hover'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!btn_border_type_hover' => '' ), 'show' => array( 'btn_bor_hover' => 'hover' ), ), ], 'styles' => [ 'btn_style' => __pl('btn_style'), 'icon_style' => __pl('icon_style'), 'border_style' => __pl('border_style'), ], ) ); // Table pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_table', array( 'name' => __pl('table'), 'group' => 'other', 'no_gt' => 1, 'has_group' => [ 'section' => 'params', 'prop' => 'elements' ], 'holder' => '.pagelayer-data-holder', 'html' => '<div class="pagelayer-data-holder"></div> <table class="pagelayer-table-holder"></table>', 'params' => array( 'elements' => array( 'type' => 'group', 'label' => __pl('table_row'), 'sc' => PAGELAYER_SC_PREFIX.'_table_row', 'item_label' => array( 'default' => __pl('table_row'), //'param' => 'title', ), 'count' => 3, 'text' => strtr(__pl('add_new_item'), array('%name%' => __pl('table_row'))) ), 'table_width' => array( 'type' => 'slider', 'label' => __pl('width'), 'screen' => 1, 'units' => ['%', 'px'], 'min' => 0, 'css' => ['{{element}} .pagelayer-table-holder' => 'width:{{val}}'], ), 'table_height' => array( 'type' => 'slider', 'label' => __pl('height'), 'units' => ['px', 'em', '%'], 'screen' => 1, 'min' => 0, 'css' => ['{{element}} .pagelayer-table-holder' => 'height:{{val}}'], ), 'table_td_padding' => [ 'type' => 'padding', 'label' => __pl('table_td_padding'), 'screen' => 1, 'units' => ['px', 'em'], 'css' => ['{{element}} td, {{element}} th' => 'padding-top: {{val[0]}}; padding-right: {{val[1]}}; padding-bottom: {{val[2]}}; padding-left: {{val[3]}}'], ], ), 'table_style' => array( 'table_position' => array( 'type' => 'select', 'label' => __pl('table_position'), 'css' => ['{{element}} .pagelayer-table-holder' => '{{val}}:auto'], 'list' => array( 'margin-right' => __pl('left'), 'margin' => __pl('center'), 'margin-left' => __pl('right'), ), ), 'table_content_align' => array( 'type' => 'select', 'label' => __pl('content_align'), 'css' => ['{{element}} .pagelayer-table-holder' => 'text-align:{{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), ), 'table_verti_align' => array( 'type' => 'select', 'label' => __pl('vertical_align'), 'css' => ['{{element}} .pagelayer-table-holder *' => 'vertical-align:{{val}}'], 'list' => array( '' => __pl('none'), 'top' => __pl('top'), 'middle' => __pl('middle'), 'bottom' => __pl('bottom'), ), ), 'even_odd_row' => array( 'type' => 'radio', 'label' => __pl('colors'), 'default' => 'odd_row', 'list' => array( 'odd_row' => __pl('odd_row'), 'even_row' => __pl('even_row'), 'hover' => __pl('hover'), ), ), 'odd_row_text_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} tr:nth-child(odd) td, {{element}} tr:nth-child(odd) th' => 'color:{{val}}'], 'show' => ['even_odd_row' => 'odd_row'], ), 'odd_row_color' => array( 'type' => 'color', 'label' => __pl('odd_row_bg'), 'default' => '#ffffff', 'css' => ['{{element}} tr:nth-child(odd) td, {{element}} tr:nth-child(odd) th' => 'background-color:{{val}}'], 'show' => ['even_odd_row' => 'odd_row'], ), 'even_row_text_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} tr:nth-child(even) td, {{element}} tr:nth-child(even) th' => 'color:{{val}}'], 'show' => ['even_odd_row' => 'even_row'], ), 'even_row_color' => array( 'type' => 'color', 'label' => __pl('even_row_bg'), 'default' => '#e3e3e3', 'css' => ['{{element}} tr:nth-child(even) td, {{element}} tr:nth-child(even) th' => 'background-color:{{val}}'], 'show' => ['even_odd_row' => 'even_row'], ), 'tr_hover_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} tr:hover td, {{element}} tr:hover th' => 'color:{{val}} !important'], 'show' => ['even_odd_row' => 'hover'], ), 'tr_hover_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#e3e3e3', 'css' => ['{{element}} tr:hover td, {{element}} tr:hover th' => 'background-color:{{val}} !important'], 'show' => ['even_odd_row' => 'hover'], ), 'table_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} .pagelayer-table-holder' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', ], ), 'table_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} table' =>'border-style: {{val}};', '{{element}} th' =>'border-style: {{val}};', '{{element}} td' =>'border-style: {{val}};' ], 'default' => 'solid', 'list' => [ 'none' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'table_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'default' => '#42414f', 'css' => ['{{element}} table' =>'border-color: {{val}};', '{{element}} th' =>'border-color: {{val}};', '{{element}} td' =>'border-color: {{val}};' ], 'req' => ['!table_border_type' => 'none'] ), 'table_border_width' => array( 'type' => 'spinner', 'label' => __pl('border_width'), 'default' => 1, 'screen' => 1, 'css' => ['{{element}} table' =>'border-width: {{val}}px;', '{{element}} th' =>'border-width: {{val}}px;', '{{element}} td' =>'border-width: {{val}}px;' ], 'req' => ['!table_border_type' => 'none'] ), ), 'styles' => array( 'table_style' => __pl('table_style'), ), ) ); // Table row pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_table_row', array( 'name' => __pl('table_row'), 'group' => 'other', 'not_visible' => 1, 'parent' => [PAGELAYER_SC_PREFIX.'_table'], 'has_group' => [ 'section' => 'params', 'prop' => 'col_elements' ], 'holder' => '.pagelayer-table-row-holder', 'html' => '<div class="pagelayer-table-row-holder"></div>', 'params' => array( 'col_elements' => array( 'type' => 'group', 'label' => __pl('table_cell'), 'sc' => PAGELAYER_SC_PREFIX.'_table_col', 'item_label' => array( 'default' => __pl('table_cell'), 'param' => 'title', ), 'count' => 3, 'text' => strtr(__pl('add_new_item'), array('%name%' => __pl('table_cell'))) ), 'tr_colors' => array( 'type' => 'radio', 'label' => __pl('colors'), 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'tr_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.pagelayer-table [pagelayer-table-id="{{ele_id}}"] td, .pagelayer-table [pagelayer-table-id="{{ele_id}}"] th' => 'color:{{val}} !important'], 'show' => ['tr_colors' => ''], ), 'tr_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['.pagelayer-table [pagelayer-table-id="{{ele_id}}"] td, .pagelayer-table [pagelayer-table-id="{{ele_id}}"] th' => 'background-color:{{val}} !important'], 'show' => ['tr_colors' => ''], ), 'tr_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.pagelayer-table [pagelayer-table-id="{{ele_id}}"]:hover td, .pagelayer-table [pagelayer-table-id="{{ele_id}}"]:hover th' => 'color:{{val}} !important'], 'show' => ['tr_colors' => 'hover'], ), 'tr_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['.pagelayer-table [pagelayer-table-id="{{ele_id}}"]:hover td, .pagelayer-table [pagelayer-table-id="{{ele_id}}"]:hover th' => 'background-color:{{val}} !important'], 'show' => ['tr_colors' => 'hover'], ), 'tr_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '.pagelayer-table [pagelayer-table-id="{{ele_id}}"]' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', ], ), 'tr_td_padding' => [ 'type' => 'padding', 'label' => __pl('row_data_padding'), 'screen' => 1, 'units' => ['px', 'em'], 'css' => ['.pagelayer-table [pagelayer-table-id="{{ele_id}}"] td, .pagelayer-table [pagelayer-table-id="{{ele_id}}"] th' => 'padding-top: {{val[0]}}; padding-right: {{val[1]}}; padding-bottom: {{val[2]}}; padding-left: {{val[3]}}'], ], ) ) ); // Table col pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_table_col', array( 'name' => __pl('table_cell'), 'group' => 'other', 'not_visible' => 1, 'parent' => [PAGELAYER_SC_PREFIX.'_table_row'], 'innerHTML' => 'data', 'html' => '<div class="pagelayer-col-data"></div>', 'params' => array( 'data' => array( 'type' => 'textarea', 'label' => __pl('data'), 'default' => 'Lorem ipsum', 'addAttr' => ['{{element}} .pagelayer-col-data' => 'data-td="{{data}}"'], ), 'td_width' => array( 'type' => 'slider', 'label' => __pl('width'), 'screen' => 1, 'units' => ['%', 'px'], 'css' => ['.pagelayer-table tr [pagelayer-table-id="{{ele_id}}"]' => 'width:{{val}}'], ), 'td_tag' => array( 'type' => 'select', 'label' => __pl('cell_type'), 'default' => 'td', 'list' => array( 'td' => __pl('standard_cell'), 'th' => __pl('header_cell'), ), 'addAttr' => ['{{element}} .pagelayer-col-data' => 'data-tag="{{td_tag}}"'], ), 'td_colors' => array( 'type' => 'radio', 'label' => __pl('colors'), 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'td_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.pagelayer-table tr [pagelayer-table-id="{{ele_id}}"]' => 'color:{{val}} !important'], 'show' => ['td_colors' => ''], ), 'td_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['.pagelayer-table tr [pagelayer-table-id="{{ele_id}}"]' => 'background-color:{{val}} !important'], 'show' => ['td_colors' => ''], ), 'td_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.pagelayer-table tr [pagelayer-table-id="{{ele_id}}"]:hover' => 'color:{{val}} !important'], 'show' => ['td_colors' => 'hover'], ), 'td_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['.pagelayer-table tr [pagelayer-table-id="{{ele_id}}"]:hover' => 'background-color:{{val}} !important'], 'show' => ['td_colors' => 'hover'], ), 'td_colspan' => array( 'type' => 'spinner', 'label' => __pl('colspan'), 'min' => 1, 'addAttr' => ['{{element}} .pagelayer-col-data' => 'data-colspan="{{td_colspan}}"'], ), 'td_rowspan' => array( 'type' => 'spinner', 'label' => __pl('rowspan'), 'min' => 1, 'addAttr' => ['{{element}} .pagelayer-col-data' => 'data-rowspan="{{td_rowspan}}"'], ), ), ) ); // Call To Action pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_call', array( 'name' => __pl('cta'), 'group' => 'other', 'innerHTML' => 'content', 'html' => '<div if={{show_ribbon}} class="pagelayer-cta-ribbon pagelayer-cta-ribbon-{{ribbon_pos}}"><div class="pagelayer-cta-ribbon-text">{{ribbon_text}}</div></div> <div class="pagelayer-cta-img-holder"> <div if="{{cta_image}}" class="pagelayer-cta-image" style="background-image: url(\'{{{cta_image-url}}}\');"> </div> </div> <div class="pagelayer-cta-content-holder"> <div class="pagelayer-cta-content"> <div if="{{heading}}" class="pagelayer-cta-heading">{{heading}}</div> <div if="{{subheading}}" class="pagelayer-cta-subheading">{{subheading}}</div> <div if="{{content}}" class="pagelayer-cta-text">{{content}}</div> <a if={{button_text}} class="pagelayer-btn-holder pagelayer-ele-link {{btn_type}} {{btn_size}}" href="{{{button_link}}}">{{button_text}}</a> </div> </div>', 'params' => array( 'layout' => array( 'type' => 'select', 'label' => __pl('cta_layout_label'), 'default' => 'normal', 'addClass' => 'pagelayer-cta-layout-{{val}}', 'list' => array( 'normal' => __pl('normal'), 'overlay' => __pl('overlay') ) ), 'align' => array( 'type' => 'radio', 'label' => __pl('cta_align_label'), 'default' => 'left', 'addClass' => 'pagelayer-cta-align-{{val}}', 'list' => array( 'left' => __pl('left'), '' => __pl('center'), 'right' => __pl('right'), ), 'req' => array( 'layout' => 'normal' ) ), ), 'image_style' => [ 'cta_image' => array( 'type' => 'image', 'label' => __pl('cta_image_label'), 'default' => PAGELAYER_URL.'/images/default-image.png' ), 'height' => array( 'type' => 'slider', 'label' => __pl('cta_img_height_label'), 'css' => ['{{element}} .pagelayer-cta-image' => 'min-height: {{val}}px;'], 'screen' => 1, 'default' => 300, 'min' => 0, 'max' => 1000, 'step' => 1, ), 'width' => array( 'type' => 'slider', 'label' => __pl('cta_img_width_label'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-cta-img-holder' => 'flex-basis: {{val}}%;', '{{element}} .pagelayer-cta-content-holder' => 'flex-basis: calc(100% - {{val}}%);'], 'default' => 50, 'min' => 0, 'max' => 100, 'step' => 1, 'req' => array( 'layout' => 'normal', '!align' => '' ) ), 'img_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => '', //'no_val' => 1,// Dont set any value to element 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ) ), 'img_overlay' => array( 'type' => 'color', 'label' => __pl('overlay'), 'css' => ['{{element}} .pagelayer-cta-image:before' => 'background-color: {{val}}'], 'show' => ['img_hover' => ''] ), 'img_opacity' => array( 'type' => 'slider', 'label' => __pl('opacity'), 'css' => ['{{element}} .pagelayer-cta-image:before' => 'opacity: {{val}};'], 'min' => 0, 'max' => 1, 'step' => 0.1, 'show' => ['img_hover' => ''] ), 'hov_delay' => array( 'type' => 'slider', 'label' => __pl('delay'), 'css' => ['{{element}} .pagelayer-cta-image:before, {{element}} .pagelayer-cta-image' => 'transition: all {{val}}ms;'], 'default' => 800, 'min' => 200, 'max' => 10000, 'step' => 100, 'show' => ['img_hover' => 'hover'] ), 'img_overlay_hover' => array( 'type' => 'color', 'label' => __pl('overlay'), 'default' => '#333333', //'css' => ['{{element}} .pagelayer-cta-img-overlay' => 'background-color: {{val}}'], 'css' => ['{{element}}:hover .pagelayer-cta-image:before' => 'background-color: {{val}}'], 'show' => ['img_hover' => 'hover'] ), 'img_opacity_hover' => array( 'type' => 'slider', 'label' => __pl('opacity'), 'css' => ['{{element}}:hover .pagelayer-cta-image:before' => 'opacity: {{val}};'], 'default' => 0.3, 'min' => 0, 'max' => 1, 'step' => 0.1, 'show' => ['img_hover' => 'hover'] ), 'hover_anim' => array( 'type' => 'select', 'label' => __pl('cta_hover_anim_label'), 'default' => 'pagelayer-cta-zoomin', 'addClass' => '{{val}}', 'list' => array( '' => __pl('cta_anim_none'), 'pagelayer-cta-zoomin' => __pl('cta_anim_zoomin'), 'pagelayer-cta-zoomout' => __pl('cta_anim_zoomout'), 'pagelayer-cta-moveup' => __pl('cta_anim_moveup'), 'pagelayer-cta-movedown' => __pl('cta_anim_movedown'), 'pagelayer-cta-moveleft' => __pl('cta_anim_moveleft'), 'pagelayer-cta-moveright' => __pl('cta_anim_moveright'), ), 'show' => ['img_hover' => 'hover'] ), ], 'heading_styles' => [ 'heading' => array( 'type' => 'text', 'label' => __pl('heading_name'), 'default' => 'Time for action', 'edit' => '.pagelayer-cta-heading', ), 'heading_hover' => array( 'type' => 'radio', 'label' => __pl(''), 'default' => '', //'no_val' => 1,// Dont set any value to element 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ) ), 'heading_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-cta-heading' => 'color: {{val}}'], 'show' => ['heading_hover' => ''] ), 'heading_typo' => array( 'type' => 'typography', 'label' => __pl('heading_typo'), 'default' => 'Advent Pro,40,,700,,,solid,1.7,,,', 'css' => ['{{element}} .pagelayer-cta-heading' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'show' => ['heading_hover' => ''] ), 'heading_shadow' => array( 'type' => 'shadow', 'label' => __pl('heading_shadow'), 'css' => ['{{element}} .pagelayer-cta-heading' => 'text-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}};'], 'show' => ['heading_hover' => ''] ), 'heading_delay' => array( 'type' => 'slider', 'label' => __pl('delay'), 'css' => ['{{element}} .pagelayer-cta-heading' => 'transition: all {{val}}ms;'], 'default' => 800, 'min' => 200, 'max' => 3000, 'step' => 100, 'show' => ['heading_hover' => 'hover'] ), 'heading_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}}:hover .pagelayer-cta-heading' => 'color: {{val}}'], 'show' => ['heading_hover' => 'hover'] ), 'heading_typo_hover' => array( 'type' => 'typography', 'label' => __pl('heading_typo'), 'css' => ['{{element}}:hover .pagelayer-cta-heading' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'show' => ['heading_hover' => 'hover'] ), 'heading_shadow_hover' => array( 'type' => 'shadow', 'label' => __pl('heading_shadow'), 'css' => ['{{element}}:hover .pagelayer-cta-heading' => 'text-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}};'], 'show' => ['heading_hover' => 'hover'] ), ], 'subheading_styles' => [ 'subheading' => array( 'type' => 'text', 'label' => __pl('subheading_name'), 'edit' => '.pagelayer-cta-subheading', ), 'subheading_hover' => array( 'type' => 'radio', 'label' => __pl(''), 'default' => '', //'no_val' => 1,// Dont set any value to element 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ) ), 'subheading_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#555555', 'css' => ['{{element}} .pagelayer-cta-subheading' => 'color: {{val}}'], 'show' => ['subheading_hover' => ''] ), 'subheading_typo' => array( 'type' => 'typography', 'label' => __pl('heading_typo'), 'css' => ['{{element}} .pagelayer-cta-subheading' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'show' => ['subheading_hover' => ''] ), 'subheading_shadow' => array( 'type' => 'shadow', 'label' => __pl('heading_shadow'), 'css' => ['{{element}} .pagelayer-cta-subheading' => 'text-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}};'], 'show' => ['subheading_hover' => ''] ), 'subheading_delay' => array( 'type' => 'slider', 'label' => __pl('delay'), 'css' => ['{{element}} .pagelayer-cta-subheading' => 'transition: all {{val}}ms;'], 'default' => 800, 'min' => 200, 'max' => 3000, 'step' => 100, 'show' => ['subheading_hover' => 'hover'] ), 'subheading_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#333333', 'css' => ['{{element}}:hover .pagelayer-cta-subheading' => 'color: {{val}}'], 'show' => ['subheading_hover' => 'hover'] ), 'subheading_typo_hover' => array( 'type' => 'typography', 'label' => __pl('heading_typo'), 'css' => ['{{element}}:hover .pagelayer-cta-subheading' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'show' => ['subheading_hover' => 'hover'] ), 'subheading_shadow_hover' => array( 'type' => 'shadow', 'label' => __pl('heading_shadow'), 'css' => ['{{element}}:hover .pagelayer-cta-subheading' => 'text-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}};'], 'show' => ['subheading_hover' => 'hover'] ), ], 'text_style' => [ 'content' => array( 'type' => 'editor', 'label' => __pl('text'), 'default' => '<p><span style="color: rgb(255, 255, 255);">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. consectetur adipiscing elit, sed do eiusmod tempor</span></p>', 'edit' => '.pagelayer-cta-text', ), ], 'content_styles' => [ 'content_spacing' => [ 'type' => 'padding', 'label' => __pl('cta_content_spacing_label'), 'default' => '25,25,25,25', 'screen' => 1, //'units' => ['px', 'em', '%'], 'css' => ['{{element}} .pagelayer-cta-content' => 'padding-top: {{val[0]}}px; padding-right: {{val[1]}}px; padding-bottom: {{val[2]}}px; padding-left: {{val[3]}}px'], ], 'content-align' => array( 'type' => 'radio', 'label' => __pl('cta_content_align_label'), 'default' => 'left', 'screen' => 1, 'css' => ['{{element}} .pagelayer-cta-content-holder' => 'text-align: {{val}};'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ) ), 'content_valign' => array( 'type' => 'radio', 'label' => __pl('cta_valign_label'), 'default' => 'flex-start', 'screen' => 1, 'addClass' => 'pagelayer-cta-align-{{val}}', 'css' => ['{{element}} .pagelayer-cta-content-holder' => 'align-items: {{val}};'], 'list' => array( 'flex-start' => __pl('top'), 'center' => __pl('center'), 'flex-end' => __pl('bottom'), ) ), 'content_hover' => array( 'type' => 'radio', 'label' => __pl(''), 'default' => '', //'no_val' => 1,// Dont set any value to element 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ) ), 'content_bg' => array( 'type' => 'color', 'label' => __pl('cta_content_bg_label'), 'default' => '#4B6270', 'css' => ['{{element}} .pagelayer-cta-content-holder' => 'background-color: {{val}}'], 'show' => ['content_hover' => ''], 'req' => array( 'layout' => 'normal' ) ), 'content_delay' => array( 'type' => 'slider', 'label' => __pl('delay'), 'css' => ['{{element}} .pagelayer-cta-content-holder' => 'transition: all {{val}}ms;'], 'default' => 800, 'min' => 200, 'max' => 3000, 'step' => 100, 'show' => ['content_hover' => 'hover'], ), 'content_bg_hover' => array( 'type' => 'color', 'label' => __pl('cta_content_bg_label'), 'default' => '#E88987', 'css' => ['{{element}}:hover .pagelayer-cta-content-holder' => 'background-color: {{val}}'], 'show' => ['content_hover' => 'hover'], 'req' => array( 'layout' => 'normal' ) ), ], 'button_style' => [ 'button_text' => array( 'type' => 'text', 'label' => __pl('text'), 'default' => __pl('button_name'), 'edit' => '.pagelayer-btn-holder', ), 'button_link' => array( 'type' => 'link', 'label' => __pl('link_settings'), 'selector' => '.pagelayer-ele-link', 'desc' => __pl('button_link_desc'), ), 'btn_type' => array( 'type' => 'select', 'label' => __pl('button_type_label'), 'default' => 'pagelayer-btn-success', 'list' => array( 'pagelayer-btn-default' => __pl('btn_type_default'), 'pagelayer-btn-primary' => __pl('btn_type_primary'), 'pagelayer-btn-secondary' => __pl('btn_type_secondary'), 'pagelayer-btn-success' => __pl('btn_type_success'), 'pagelayer-btn-info' => __pl('btn_type_info'), 'pagelayer-btn-warning' => __pl('btn_type_warning'), 'pagelayer-btn-danger' => __pl('btn_type_danger'), 'pagelayer-btn-dark' => __pl('btn_type_dark'), 'pagelayer-btn-light' => __pl('btn_type_light'), 'pagelayer-btn-link' => __pl('btn_type_link'), 'pagelayer-btn-custom' => __pl('btn_type_custom'), ), ), 'btn_size' => array( 'type' => 'select', 'label' => __pl('button_size_label'), 'default' => 'pagelayer-btn-mini', 'list' => array( 'pagelayer-btn-mini' => __pl('mini'), 'pagelayer-btn-small' => __pl('small'), 'pagelayer-btn-large' => __pl('large'), 'pagelayer-btn-extra-large' => __pl('extra_large'), 'pagelayer-btn-double-large' => __pl('double_large'), 'pagelayer-btn-custom' => __pl('custom'), ) ), 'btn_custom_size' => array( 'type' => 'dimension', 'label' => __pl('btn_custom_size'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'padding: {{val[0]}}px {{val[1]}}px;'], 'req' => array( 'btn_size' => 'pagelayer-btn-custom' ), ), 'btn_spacing' => array( 'type' => 'slider', 'label' => __pl('cta_btn_spacing_label'), 'css' => ['{{element}} .pagelayer-btn-holder' => 'margin-top: {{val}}px;'], 'default' => 5, 'min' => 0, 'max' => 100, 'step' => 1, 'screen' => 1, ), 'btn_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => '', //'no_val' => 1,// Dont set any value to element 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'btn_bg_color' => array( 'type' => 'color', 'label' => __pl('btn_bg_color_label'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-btn-holder' => 'background-color: {{val}};'], 'req' => array( 'btn_type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => '' ), ), 'btn_color' => array( 'type' => 'color', 'label' => __pl('btn_color_label'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-btn-holder' => 'color: {{val}};'], 'req' => array( 'btn_type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => '' ), ), 'btn_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('btn_hover_delay_label'), 'desc' => __pl('btn_hover_delay_desc'), 'min' => 0, 'step' => 100, 'max' => 5000, 'default' => 400, 'css' => ['{{element}} .pagelayer-btn-holder' => '-webkit-transition: all {{val}}ms !important; transition: all {{val}}ms !important;'], 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('btn_bg_color_hover_label'), 'default' => '', 'css' => ['{{element}}:hover .pagelayer-btn-holder' => 'background-color: {{val}};'], 'req' => array( 'btn_type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_color_hover' => array( 'type' => 'color', 'label' => __pl('btn_color_hover_label'), 'default' => '', 'css' => ['{{element}}:hover .pagelayer-btn-holder' => 'color: {{val}};'], 'req' => array( 'btn_type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'btn_hover' => '' ), ), 'btn_border_color' => array( 'type' => 'color', 'label' => __pl('border_color_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-color: {{val}};'], 'req' => array( '!btn_border_type' => '' ), 'show' => array( 'btn_hover' => '' ), ), 'btn_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!btn_border_type' => '' ], 'show' => array( 'btn_hover' => '' ), ), 'btn_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'default' => '40,40,40,40', 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'show' => array( 'btn_hover' => '' ), ), 'btn_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}}:hover .pagelayer-btn-holder' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color_hover_label'), 'default' => '#42414f', 'css' => ['{{element}}:hover .pagelayer-btn-holder' => 'border-color: {{val}};'], 'req' => array( '!btn_border_type_hover' => '' ), 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width_hover'), 'screen' => 1, 'css' => ['{{element}}:hover .pagelayer-btn-holder' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!btn_border_type_hover' => '' ], 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius_hover'), 'screen' => 1, 'css' => ['{{element}}:hover .pagelayer-btn-holder' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'show' => array( 'btn_hover' => 'hover' ), ), ], 'ribbon_style' => [ 'show_ribbon' => array( 'type' => 'checkbox', 'label' => __pl('cta_show_ribbon'), 'css' => ['{{element}} .pagelayer-cta-ribbon' => 'position: absolute; z-index: 2;'], 'default' => 'true' ), 'ribbon_style' => array( 'type' => 'select', 'label' => __pl('style'), //'css' => ['{{element}} .pagelayer-cta-ribbon' => '{{val}}: 0px;'], 'default' => '', 'list' => array( '' => __pl('default') ), 'req' => [ 'show_ribbon' => 'true' ] ), 'ribbon_text' => array( 'type' => 'text', 'label' => __pl('cta_ribbon_text_label'), 'default' => __pl('ribbon_text_default'), 'edit' => '.pagelayer-cta-ribbon-text', 'req' => array( 'show_ribbon' => 'true' ), ), 'ribbon_bg' => array( 'type' => 'color', 'label' => __pl('cta_ribbon_bg_label'), 'default' => '#0986c0', 'css' => [ '{{element}} .pagelayer-cta-ribbon' => 'background-color: {{val}}', '{{element}} .pagelayer-cta-ribbon-text:before' => 'border-top-color: {{val}}; border-bottom-color: {{val}};' ], 'req' => array( 'show_ribbon' => 'true' ), ), 'ribbon_color' => array( 'type' => 'color', 'label' => __pl('cta_ribbon_color_label'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-cta-ribbon' => 'color: {{val}}'], 'req' => array( 'show_ribbon' => 'true' ), ), 'ribbon_typo' => array( 'type' => 'typography', 'label' => __pl('heading_typo'), 'css' => ['{{element}} .pagelayer-cta-ribbon-text' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => [ 'show_ribbon' => 'true' ] ), 'ribbon_pos' => array( 'type' => 'radio', 'label' => __pl('ribbon_pos_label'), 'css' => ['{{element}} .pagelayer-cta-ribbon' => '{{val}}: 0px;'], 'default' => 'left', 'screen' => 1, 'list' => array( 'left' => __pl('left'), 'right' => __pl('right') ), 'req' => [ 'show_ribbon' => 'true', 'ribbon_style' => '' ] ), 'ribbon_top' => array( 'type' => 'slider', 'label' => __pl('verticle_postion'), 'css' => ['{{element}} .pagelayer-cta-ribbon' => 'top: {{val}}%;'], 'screen' => 1, 'default' => 5, 'min' => 0, 'max' => 100, 'step' => 1, 'req' => [ 'show_ribbon' => 'true', 'ribbon_style' => '' ] ), 'ribbon_spacing' => array( 'type' => 'dimension', 'label' => __pl('space_around'), 'default' => '10,10', 'screen' => 1, 'css' => ['{{element}} .pagelayer-cta-ribbon-text' => 'padding-left: {{val[0]}}px; padding-right: {{val[1]}}px;'], 'req' => [ 'show_ribbon' => 'true', 'ribbon_style' => '' ] ), 'ribbon_height' => array( 'type' => 'slider', 'label' => __pl('block_height'), 'css' => [ '{{element}} .pagelayer-cta-ribbon' => 'height: {{val}}px;', '{{element}} .pagelayer-cta-ribbon-left:before' => 'border-width: calc( {{val}}px / 2 ); right: calc( -{{val}}px / 2 );', '{{element}} .pagelayer-cta-ribbon-right:before' => 'border-width: calc( {{val}}px / 2 ); left: calc( -{{val}}px / 2 );', '{{element}} .pagelayer-cta-ribbon-left .pagelayer-cta-ribbon-text:before' => 'border-width: calc( {{val}}px / 2 ); right: calc( -{{val}}px / 2 );', '{{element}} .pagelayer-cta-ribbon-right .pagelayer-cta-ribbon-text:before' => 'border-width: calc( {{val}}px / 2 ); left: calc( -{{val}}px / 2 );', '{{element}} .pagelayer-cta-ribbon-text' => 'line-height: {{val}}px;' ], 'default' => 35, 'min' => 0, 'max' => 200, 'screen' => 1, 'step' => 1, 'screen' => 1, 'req' => [ 'show_ribbon' => 'true', 'ribbon_style' => '' ] ), 'ribbon_shadow' => array( 'type' => 'color', 'label' => __pl('shadow_color'), 'default' => 'rgba(0,0,0,0.5)', 'css' => [ '{{element}} .pagelayer-cta-ribbon:after' => 'background-color: {{val}}', /* '{{element}} .pagelayer-cta-ribbon-left:before' => 'border-top-color: {{val}}; border-bottom-color: {{val}}; border-left-color: {{val}}', '{{element}} .pagelayer-cta-ribbon-right:before' => 'border-top-color: {{val}}; border-bottom-color: {{val}}; border-right-color: {{val}}', */ '{{element}} .pagelayer-cta-ribbon:before' => 'border-top-color: {{val}}; border-bottom-color: {{val}};' ], 'req' => array( 'show_ribbon' => 'true', 'ribbon_style' => '' ), ), 'shadow_height' => array( 'type' => 'slider', 'label' => __pl('shadow_pos'), 'css' => [ '{{element}} .pagelayer-cta-ribbon:before' => 'top: {{val}}px', '{{element}} .pagelayer-cta-ribbon:after' => 'height: {{val}}px; bottom: -{{val}}px;' ], 'default' => 3, 'min' => 0, 'max' => 50, 'screen' => 1, 'step' => 1, 'screen' => 1, 'req' => [ 'show_ribbon' => 'true', 'ribbon_style' => '' ] ), ], 'styles' => [ 'image_style' => __pl('image_style'), 'heading_styles' => __pl('heading_styles'), 'subheading_styles' => __pl('subheading_styles'), 'text_style' => __pl('text_style'), 'content_styles' => __pl('content_styles'), 'button_style' => __pl('button_style'), 'ribbon_style' => __pl('ribbon_style'), ] ) ); // Modal pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_modal', array( 'name' => __pl('modal'), 'group' => 'other', 'innerHTML' => 'content', 'html' => '<div class="pagelayer-modal-container"> <div class="pagelayer-modal-button"> <a class="pagelayer-btn-holder pagelayer-ele-link {{type}} {{size}} {{button_icon_position}}" onclick="pagelayer_render_pl_modal(event)"> <i if="{{button_icon}}" class="{{button_icon}} pagelayer-btn-icon pagelayer-icon-left"></i> <span class="pagelayer-btn-text" if="{{button_text}}">{{button_text}}</span> <i if="{{button_icon}}" class="{{button_icon}} pagelayer-btn-icon pagelayer-icon-right"></i> </a> </div> <div class="pagelayer-modal-content pagelayer-modal-{{modal_style}}"> <div if={{close_by_overlay}} class="pagelayer-modal-bg-close" onclick="pagelayer_pl_modal_close(event)"></div> <div class="pagelayer-modal-close" onclick="pagelayer_pl_modal_close(event)"></div> <div class="pagelayer-modal-body"> <div if="{{modal_title}}"class="pagelayer-modal-title">{{modal_title}}</div> <div class="pagelayer-modal-content-overflow" if-ext="{{content}}"> <div class="pagelayer-modal-bottom-content" if-ext="{{content}}">{{content}}</div> </div> </div> </div> </div>', 'params' => array( 'modal_style' => array( 'type' => 'radio', 'label' => __pl('obj_style'), 'default' => 'dark', 'list' => array( 'dark' => __pl('dark'), 'light' => __pl('light'), 'custom' => __pl('custom') ) ), 'modal_shadow_color' => array( 'type' => 'color', 'label' => __pl('obj_shadow_color_label'), 'default' => '#0b0b0b', 'req' => array( 'modal_style' => 'custom' ), 'css' => ['{{element}} .pagelayer-modal-content' => 'background-color: {{val}}'], ), 'modal_popup_width' => array( 'type' => 'slider', 'label' => __pl('modal_popup_width'), 'default' => 70, 'min' => 20, 'max' => 100, 'step' => 1, 'screen' => 1, 'css' => ['{{element}} .pagelayer-modal-body' => 'width: {{val}}%'], ), 'modal_popup_height' => array( 'type' => 'slider', 'label' => __pl('content_max_height'), 'min' => 100, 'max' => 1500, 'step' => 1, 'screen' => 1, 'css' => ['{{element}} .pagelayer-modal-content-overflow' => 'max-height: {{val}}px'], ), ), 'icon_style' => [ 'button_icon' => array( 'type' => 'icon', 'label' => __pl('icon'), 'list' => pagelayer_icon_class_list(true) ), 'icon_spacing' => array( 'type' => 'spinner', 'label' => __pl('icon_spacing'), 'min' => 1, 'step' => 1, 'max' => 100, 'default' => 5, 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-icon' => 'padding: 0 {{val}}px;'], 'req' => array( '!button_icon' => '' ), ), 'button_icon_position' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'pagelayer-btn-icon-left', 'list' => array( 'pagelayer-btn-icon-left' => __pl('left'), 'pagelayer-btn-icon-right' => __pl('right') ), 'req' => array( '!button_icon' => '' ), ), ], 'btn_styles' => [ 'button_text' => array( 'type' => 'text', 'label' => __pl('button_text_label'), 'default' => 'Open Modal Box', ), 'size' => array( 'type' => 'select', 'label' => __pl('button_size_label'), 'default' => 'pagelayer-btn-large', 'list' => array( 'pagelayer-btn-mini' => __pl('mini'), 'pagelayer-btn-small' => __pl('small'), 'pagelayer-btn-large' => __pl('large'), 'pagelayer-btn-extra-large' => __pl('extra_large'), 'pagelayer-btn-double-large' => __pl('double_large'), 'pagelayer-btn-custom' => __pl('custom'), ) ), 'btn_custom_size' => array( 'type' => 'spinner', 'label' => __pl('btn_custom_size'), 'min' => 1, 'step' => 1, 'max' => 100, 'default' => 5, 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'padding: {{val}}px {{val}}px;'], 'req' => array( 'size' => 'pagelayer-btn-custom' ) ), 'type' => array( 'type' => 'select', 'label' => __pl('button_type_label'), 'default' => 'pagelayer-btn-default', 'list' => array( 'pagelayer-btn-default' => __pl('btn_type_default'), 'pagelayer-btn-primary' => __pl('btn_type_primary'), 'pagelayer-btn-secondary' => __pl('btn_type_secondary'), 'pagelayer-btn-success' => __pl('btn_type_success'), 'pagelayer-btn-info' => __pl('btn_type_info'), 'pagelayer-btn-warning' => __pl('btn_type_warning'), 'pagelayer-btn-danger' => __pl('btn_type_danger'), 'pagelayer-btn-dark' => __pl('btn_type_dark'), 'pagelayer-btn-light' => __pl('btn_type_light'), 'pagelayer-btn-link' => __pl('btn_type_link'), 'pagelayer-btn-custom' => __pl('btn_type_custom') ), ), 'button_full_width' => array( 'type' => 'checkbox', 'label' => __pl('stretch'), 'screen' => 1, 'css' => ['{{element}} a' => 'width: 100%; text-align: center;'] ), 'button_align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'left', 'screen' => 1, 'css' => ['{{element}} .pagelayer-modal-button' => 'text-align: {{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ), 'req' => array( 'button_full_width' => '' ) ), 'btn_hover' => array( 'type' => 'radio', 'label' => '', 'default' => '', //'no_val' => 1,// Dont set any value to element 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ) ), 'btn_bg_color' => array( 'type' => 'color', 'label' => __pl('btn_bg_color_label'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-btn-holder' => 'background-color: {{val}};'], 'req' => array( 'type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => '' ), ), 'btn_color' => array( 'type' => 'color', 'label' => __pl('btn_color_label'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-btn-holder' => 'color: {{val}};'], 'req' => array( 'type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => '' ), ), 'btn_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('btn_hover_delay_label'), 'desc' => __pl('btn_hover_delay_desc'), 'min' => 0, 'step' => 100, 'max' => 5000, 'default' => 400, 'css' => ['{{element}} .pagelayer-btn-holder' => '-webkit-transition: all {{val}}ms !important; transition: all {{val}}ms !important;'], 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('btn_bg_color_hover_label'), 'default' => '', 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'background-color: {{val}};'], 'req' => array( 'type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_color_hover' => array( 'type' => 'color', 'label' => __pl('btn_color_hover_label'), 'default' => '', 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'color: {{val}};'], 'req' => array( 'type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'btn_hover' => '' ), ), 'btn_border_color' => array( 'type' => 'color', 'label' => __pl('border_color_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-color: {{val}};'], 'req' => array( '!btn_border_type' => '' ), 'show' => array( 'btn_hover' => '' ), ), 'btn_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!btn_border_type' => '' ], 'show' => array( 'btn_hover' => '' ), ), 'btn_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!btn_border_type' => '' ), 'show' => array( 'btn_hover' => '' ), ), 'btn_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color_hover_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'border-color: {{val}};'], 'req' => array( '!btn_border_type_hover' => '' ), 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width_hover'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!btn_border_type_hover' => '' ], 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius_hover'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!btn_border_type_hover' => '' ), 'show' => array( 'btn_hover' => 'hover' ), ), ], 'title_style' => [ 'modal_title' => array( 'type' => 'textarea', 'label' => __pl('title'), 'default' => __pl('modal_title_content_default'), 'edit' => '.pagelayer-modal-title' ), 'title_align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'center', 'screen' => 1, 'css' => ['{{element}} .pagelayer-modal-title' => 'text-align: {{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ), 'req' => [ '!modal_title' => '' ], ), 'title_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-modal-title' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => [ '!modal_title' => '' ], ), 'padding' => array( 'type' => 'padding', 'label' => __pl('stars_spacing'), 'default' => '25,25,25,25', 'screen' => 1, 'css' => ['{{element}} .pagelayer-modal-title' => 'padding-top: {{val[0]}}px; padding-right: {{val[1]}}px; padding-bottom: {{val[2]}}px; padding-left: {{val[3]}}px'], 'req' => [ '!modal_title' => '' ], ), 'modal_title_bgcolor' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#3D54DF', 'css' => ['{{element}} .pagelayer-modal-title' => 'background-color: {{val}}'], 'req' => [ '!modal_title' => '', 'modal_style' => 'custom' ], ), 'modal_title_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-modal-title' => 'color: {{val}}'], 'req' => [ '!modal_title' => '', 'modal_style' => 'custom' ], ) ], 'content_style' => [ 'content' => array( 'type' => 'editor', 'label' => __pl('obj_content'), 'default' => __pl('content_with_tags_default'), 'edit' => '.pagelayer-modal-bottom-content' ), 'content_padding' => array( 'type' => 'padding', 'label' => __pl('stars_spacing'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-modal-bottom-content' => 'padding-top: {{val[0]}}px; padding-right: {{val[1]}}px; padding-bottom: {{val[2]}}px; padding-left: {{val[3]}}px'] ), 'modal_content_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#000000', 'req' => array( 'modal_style' => 'custom' ), 'css' => ['{{element}} .pagelayer-modal-body' => 'color: {{val}}'], ), 'modal_content_bg' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#ffffff', 'req' => array( 'modal_style' => 'custom' ), 'css' => ['{{element}} .pagelayer-modal-bottom-content' => 'background-color: {{val}}'], ), ], 'close_style' => [ 'close_size' => array( 'type' => 'spinner', 'label' => __pl('size'), 'min' => 0, 'step' => 1, 'max' => 200, 'default' => 50, 'screen' => 1, 'css' => [ '{{element}} .pagelayer-modal-close:before' => 'height: {{val}}px; right: calc( {{val}}px / 2 );', '{{element}} .pagelayer-modal-close' => 'height: {{val}}px; width: {{val}}px;', '{{element}} .pagelayer-modal-close:after' => 'height: {{val}}px; right: calc( {{val}}px / 2 );' ] ), 'modal_close_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-modal-close::before' => 'background-color:{{val}}', '{{element}} .pagelayer-modal-close::after' => 'background-color:{{val}}'], 'req' => array( 'modal_style' => 'custom', ) ), 'close_by_overlay' => array( 'type' => 'checkbox', 'label' => __pl('close_by_overlay') ) ], 'styles' => [ 'btn_styles' => __pl('btn_style'), 'icon_style' => __pl('icon_style'), 'title_style' => __pl('title_style'), 'content_style' => __pl('content_style'), 'close_style' => __pl('close_style'), ] ) ); // Splash Screen pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_splash', array( 'name' => __pl('splash_screen'), 'group' => 'other', 'innerHTML' => 'content', 'html' => '<div class="pagelayer-splash-container pagelayer-splash-{{style}}"> <div if={{close_by_overlay}} class="pagelayer-splash-bg-close"></div> <span class="pagelayer-splash-close"></span> <div class="pagelayer-splash-body"> <div if="{{title}}"class="pagelayer-splash-title">{{title}}</div> <div class="pagelayer-splash-content-overflow" if-ext="{{content}}"> <div class="pagelayer-splash-bottom-content">{{content}}</div> </div> </div> </div>', 'params' => array( 'style' => array( 'type' => 'radio', 'label' => __pl('style'), 'default' => 'dark', 'list' => array( 'dark' => __pl('dark'), 'light' => __pl('light'), 'custom' => __pl('custom') ) ), 'shadow_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#0b0b0b', 'css' => ['{{element}} .pagelayer-splash-container ' => 'background:{{val}}'], 'req' => array( 'style' => 'custom' ) ), 'display' => array( 'type' => 'select', 'label' => __pl('display'), 'list' => array( 'once' => __pl('once'), 'always' => __pl('always') ), 'default' => 'once', 'addAttr' => ['{{element}} .pagelayer-splash-container' => 'display_type="{{display}}"'] ), 'delay' => array( 'type' => 'spinner', 'label' => __pl('animation_delay'), 'default' => 1000, 'min' => 100, 'addAttr' => ['{{element}} .pagelayer-splash-container' => 'delay="{{delay}}"'] ), 'width' => array( 'type' => 'slider', 'label' => __pl('icon_border_width'), 'screen' => 1, 'default' => '90', 'css' => ['{{element}} .pagelayer-splash-body' => 'width:{{val}}%'], ), 'splash_popup_height' => array( 'type' => 'slider', 'label' => __pl('content_max_height'), 'min' => 100, 'max' => 1500, 'step' => 1, 'screen' => 1, 'css' => ['{{element}} .pagelayer-splash-content-overflow' => 'max-height: {{val}}px'], ), ), 'title_style' => [ 'title' => array( 'type' => 'textarea', 'label' => __pl('title'), 'default' => __pl('splash_title_content_default'), 'edit' => '.pagelayer-splash-title' ), 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'center', 'screen' => 1, 'css' => ['{{element}} .pagelayer-splash-title' => 'text-align: {{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ), 'req' => [ '!title' => '' ], ), 'title_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-splash-title' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => [ '!title' => '' ], ), 'padding' => array( 'type' => 'padding', 'label' => __pl('space_around'), 'default' => '25,25,25,25', 'screen' => 1, 'css' => ['{{element}} .pagelayer-splash-title' => 'padding-top: {{val[0]}}px; padding-right: {{val[1]}}px; padding-bottom: {{val[2]}}px; padding-left: {{val[3]}}px'], 'req' => [ '!title' => '' ], ), 'title_bg' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#3D54DF', 'css' => ['{{element}} .pagelayer-splash-title' => 'background-color: {{val}}'], 'req' => [ '!title' => '', 'style' => 'custom' ], ), 'title_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-splash-title' => 'color: {{val}}'], 'req' => [ '!title' => '', 'style' => 'custom' ], ) ], 'content_style' => [ 'content' => array( 'type' => 'editor', 'label' => __pl('obj_content'), 'default' => __pl('content_with_tags_default'), 'edit' => '.pagelayer-splash-bottom-content' ), 'content_color' => array( 'type' => 'color', 'label' => __pl('obj_content_color_label'), 'default' => '#0b0b0b', 'css' => ['{{element}} .pagelayer-splash-container ' => 'color:{{val}}'], 'req' => array( 'style' => 'custom' ) ), 'content_padding' => array( 'type' => 'padding', 'label' => __pl('space_around'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-splash-bottom-content' => 'padding-top: {{val[0]}}px; padding-right: {{val[1]}}px; padding-bottom: {{val[2]}}px; padding-left: {{val[3]}}px'], ), ], 'close_style' => [ 'close_size' => array( 'type' => 'spinner', 'label' => __pl('size'), 'min' => 0, 'step' => 1, 'max' => 200, 'default' => 50, 'screen' => 1, 'css' => [ '{{element}} .pagelayer-splash-close:before' => 'height: {{val}}px; right: calc( {{val}}px / 2 );', '{{element}} .pagelayer-splash-close' => 'height: {{val}}px; width: {{val}}px;', '{{element}} .pagelayer-splash-close:after' => 'height: {{val}}px; right: calc( {{val}}px / 2 );' ] ), 'close_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-splash-close::after, {{element}} .pagelayer-splash-close::before ' => 'background-color:{{val}}'], 'req' => array( 'style' => 'custom' ) ), 'close_by_overlay' => array( 'type' => 'checkbox', 'label' => __pl('close_by_overlay') ), ], 'styles' => [ 'title_style' => __pl('title_style'), 'content_style' => __pl('content_style'), 'close_style' => __pl('close_style'), ] ) ); // Chart pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_chart', array( 'name' => __pl('chart'), 'group' => 'other', 'has_group' => [ 'section' => 'datasets', 'prop' => 'elements' ], 'holder' => '.pagelayer-chart-child-holder', 'html' => '<div if="{{title}}" class="pagelayer-chart-title">{{title}}</div> <div class="pagelayer-chart-child-holder"></div> <canvas class="pagelayer-chart-holder"></canvas>', 'params' => array( 'type' => array( 'type' => 'select', 'label' => __pl('type'), 'desc' => __pl('google_charts_type_desc'), 'default' => 'bar', 'addAttr' => ['{{element}} .pagelayer-chart-holder' => 'chart-type="{{type}}"'], 'list' => array( 'line' => __pl('google_charts_type_list_line'), 'bar' => __pl('google_charts_type_list_bar'), 'horizontalBar' => __pl('horizontalbar_chart'), 'radar' => __pl('radar'), 'doughnut' => __pl('doughnut_chart'), 'pie' => __pl('google_charts_type_list_pie'), 'polarArea' => __pl('polararea'), ) ), 'legend_pos' => array( 'type' => 'select', 'label' => __pl('legend_pos'), //'desc' => __pl('legend_pos_desc'), 'default' => 'top', 'addAttr' => ['{{element}} .pagelayer-chart-holder' => 'chart-legend="{{legend_pos}}"'], 'list' => array( '' => __pl('none'), 'top' => __pl('top'), 'left' => __pl('left'), 'bottom' => __pl('bottom'), 'right' => __pl('right'), ) ), 'custom_dimension' => array( 'type' => 'checkbox', 'label' => __pl('custom_dimension'), 'default' => '', ), 'chart_height' => array( 'type' => 'slider', 'label' => __pl('custom_height'), 'screen' => 1, 'min' => 0, 'max' => 1000, 'step' => 1, 'default' => 350, 'addAttr' => ['{{element}} .pagelayer-chart-holder' => 'chart-height="{{chart_height}}"'], 'css' => ['{{element}} .pagelayer-chart-holder' => 'height: {{val}}px !important;'], 'req' => array( 'custom_dimension' => 'true' ), ), 'chart_width' => array( 'type' => 'slider', 'label' => __pl('custom_width'), 'screen' => 1, 'min' => 0, 'max' => 100, 'step' => 1, 'default' => 100, 'css' => ['{{element}} .pagelayer-chart-holder' => 'width: {{val}}% !important;'], 'req' => array( 'custom_dimension' => 'true' ), ), /* 'colors' => array( 'type' => 'textarea', 'label' => __pl('google_charts_colors_label'), 'desc' => 'You can give multiple colors here and separate them by coma(,) E.g. #000000, #ffffff, #f4c63d, #923a3a', 'addAttr' => ['{{element}} .pagelayer-chart-holder' => 'chart-colors="{{colors}}"'], ), */ /* 'width' => array( 'type' => 'slider', 'label' => __pl('Chart_width'), 'addAttr' => ['{{element}} .pagelayer-chart-holder' => 'data-width="{{width}}%"'], ), */ ), 'label_style' => [ 'labels' => array( 'type' => 'textarea', 'label' => __pl('label_style'), 'desc' => __pl('Enter labels with comma(,) separeted'), 'default' => 'Jan,Feb,Mar,Apr,May', 'addAttr' => ['{{element}} .pagelayer-chart-holder' => 'chart-labels="{{labels}}"'], ), 'label_colors' => array( 'type' => 'textarea', 'label' => __pl('colors'), 'desc' => __pl('Enter hex color code with comma(,) separeted'), 'default' => '#3e95cd,#8e5ea2,#3cba9f,#e8c3b9,#c45850', 'addAttr' => ['{{element}} .pagelayer-chart-holder' => 'chart-colors="{{label_colors}}"'], 'req' => [ 'type' => ['doughnut', 'pie', 'polarArea'] ] ), ], 'datasets' => [ 'elements' => array( 'type' => 'group', 'label' => __pl('datasets'), 'sc' => PAGELAYER_SC_PREFIX.'_chart_datasets', 'item_label' => array( 'default' => __pl('dataset'), 'param' => 'datasets', ), 'count' => 1, 'text' => strtr(__pl('add_new_item'), array('%name%' => __pl('dataset_name'))), ), ], 'ticks_style' => [ 'tick_type' => array( 'type' => 'radio', 'label' => __pl('axis'), 'default' => 'xaxis', //'no_val' => 1,// Dont set any value to element 'list' => array( 'xaxis' => __pl('x-axis'), 'yaxis' => __pl('y-axis'), ) ), 'xcolor' => array( 'type' => 'color', 'label' => __pl('color'), 'addAttr' => ['{{element}} .pagelayer-chart-holder' => 'data-xcolor="{{xcolor}}"'], 'show' => array( 'tick_type' => 'xaxis' ), ), 'xsize' => array( 'type' => 'slider', 'label' => __pl('size'), 'min' => 0, 'max' => 100, 'screen' => 1, 'addAttr' => ['{{element}} .pagelayer-chart-holder' => 'data-xsize="{{xsize}}"'], 'show' => array( 'tick_type' => 'xaxis' ), ), 'xrotate' => array( 'type' => 'slider', 'label' => __pl('Rotate'), 'min' => 0, 'max' => 360, 'screen' => 1, 'addAttr' => ['{{element}} .pagelayer-chart-holder' => 'data-xrotate="{{xrotate}}"'], 'show' => array( 'tick_type' => 'xaxis' ), ), 'xbegin' => array( 'type' => 'checkbox', 'label' => __pl('begin_at_zero'), 'default' => 'true', 'addAttr' => ['{{element}} .pagelayer-chart-holder' => 'data-xbegin="{{xbegin}}"'], 'show' => array( 'tick_type' => 'xaxis' ), ), 'ycolor' => array( 'type' => 'color', 'label' => __pl('color'), 'addAttr' => ['{{element}} .pagelayer-chart-holder' => 'data-ycolor="{{ycolor}}"'], 'show' => array( 'tick_type' => 'yaxis' ), ), 'ysize' => array( 'type' => 'slider', 'label' => __pl('size'), 'min' => 0, 'max' => 100, 'screen' => 1, 'addAttr' => ['{{element}} .pagelayer-chart-holder' => 'data-ysize="{{ysize}}"'], 'show' => array( 'tick_type' => 'yaxis' ), ), 'yrotate' => array( 'type' => 'slider', 'label' => __pl('Rotate'), 'min' => 0, 'max' => 360, 'screen' => 1, 'addAttr' => ['{{element}} .pagelayer-chart-holder' => 'data-yrotate="{{yrotate}}"'], 'show' => array( 'tick_type' => 'yaxis' ), ), 'ybegin' => array( 'type' => 'checkbox', 'label' => __pl('begin_at_zero'), 'default' => 'true', 'addAttr' => ['{{element}} .pagelayer-chart-holder' => 'data-ybegin="{{ybegin}}"'], 'show' => array( 'tick_type' => 'yaxis' ), ), ], 'title_style' => [ 'title' => array( 'type' => 'text', 'label' => __pl('title'), 'default' => __pl('company_performance'), 'edit' => '.pagelayer-chart-title', ), 'title_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#47425d', 'css' => ['{{element}} .pagelayer-chart-title' => 'color:{{val}}'], 'req' => [ '!title' => '' ], ), 'title_align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'center', 'screen' => 1, 'css' => ['{{element}} .pagelayer-chart-title' => 'text-align:{{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'req' => [ '!title' => '' ], ), 'title_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-chart-title' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => [ '!title' => '' ], ), ], 'styles' => [ 'label_style' => __pl('label_style'), 'datasets' => __pl('datasets'), 'ticks_style' => __pl('ticks_style'), 'title_style' => __pl('title_style'), ], ) ); // Chart pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_chart_datasets', array( 'name' => __pl('chart_dataset'), 'group' => 'other', 'not_visible' => 1, 'parent' => [PAGELAYER_SC_PREFIX.'_chart'], 'holder' => '.pagelayer-chart-datasets', 'html' => '<div class="pagelayer-chart-datasets"></div>', 'params' => array( 'label' => array( 'type' => 'text', 'label' => __pl('label'), 'default' => __pl('dataset_name'), 'addAttr' => ['{{element}} .pagelayer-chart-datasets' => 'datasets-label="{{label}}"'], ), 'datasets' => array( 'type' => 'textarea', 'label' => __pl('dataset_name'), 'desc' => __pl('Enter the datasets and separate by coma(,)'), 'default' => '5,9,7,8,5', 'addAttr' => ['{{element}} .pagelayer-chart-datasets' => 'chart-datasets="{{datasets}}"'], ), 'bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'addAttr' => ['{{element}} .pagelayer-chart-datasets' => 'dataset-bg="{{bg_color}}"'], ), 'chart_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'addAttr' => ['{{element}} .pagelayer-chart-datasets' => 'border-color="{{chart_border_color}}"'], ), 'fill_color' => array( 'type' => 'checkbox', 'label' => __pl('fill_color'), 'default' => 'true', 'addAttr' => ['{{element}} .pagelayer-chart-datasets' => 'dataset-fill="{{fill_color}}"'] ), ), ) ); // Menu list pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_menu_list', array( 'name' => __pl('menu_list'), 'group' => 'other', 'holder' => '.pagelayer-menu-list', //'innerHTML' => 'text', 'has_group' => [ 'section' => 'params', 'prop' => 'elements' ], 'html' => '<div class="pagelayer-menu-list"></div>', 'params' => [ 'elements' => array( 'type' => 'group', 'label' => __pl('menu_item'), 'sc' => PAGELAYER_SC_PREFIX.'_menu_item', 'item_label' => array( 'default' => __pl('menu_item'), 'param' => 'title' ), 'count' => 3, 'text' => strtr(__pl('add_new_item'), array('%name%' => __pl('menu_name'))), ), 'item_space' => array( 'type' => 'slider', 'label' => __pl('space_between'), 'min' => 0, 'max' => 100, 'step' => 1, 'default' => 10, 'screen' => 1, 'css' => ['{{element}} .pagelayer-menu-item' => 'padding-bottom: calc({{val}}px / 2); margin-bottom: calc({{val}}px / 2);'], ), 'valign' => array( 'type' => 'select', 'label' => __pl('badge_vertical_align'), 'default' => 'center', 'screen' => 1, 'css' => ['{{element}} .pagelayer-menu-item' => '-webkit-box-align:{{val}}; -webkit-align-items:{{val}}; -ms-flex-align:{{val}}; align-items:{{val}};'], 'list' => [ 'flex-start' => __pl('top'), 'center' => __pl('center'), 'flex-end' => __pl('bottom'), ], ), 'item_border_type' => array( 'type' => 'select', 'label' => __pl('divider'), 'default' => '', 'css' => ['{{element}} .pagelayer-menu-item' => 'border-bottom-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'item_border_color' => array( 'type' => 'color', 'label' => __pl('divider_color'), 'default' => '#dbdbdb', 'css' => ['{{element}} .pagelayer-menu-item' => 'border-bottom-color: {{val}};'], 'req' => ['!item_border_type' => ''] ), 'item_border_width' => array( 'type' => 'slider', 'label' => __pl('thickness'), 'min' => 0, 'max' => 20, 'step' => 1, 'default' => 2, 'screen' => 1, 'css' => ['{{element}} .pagelayer-menu-item' => 'border-bottom-width: {{val}}px;'], 'req' => ['!item_border_type' => ''] ), ], 'title_styles' => [ 'title_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#0c0901', 'css' => ['{{element}} .pagelayer-menu-title' => 'color:{{val}}'], ), 'title_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',19,,700,,,solid,,,,', 'css' => ['{{element}} .pagelayer-menu-title span:first-child' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'space_bottom' => array( 'type' => 'slider', 'label' => __pl('space_bottom'), 'min' => 0, 'max' => 100, 'step' => 1, 'screen' => 1, 'css' => ['{{element}} .pagelayer-menu-title' => 'padding-bottom:{{val}}px;'] ), ], 'item_details' => [ 'includes_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#484745', 'css' => ['{{element}} .pagelayer-menu-includes' => 'color:{{val}}'], ), 'includes_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',12,italic,200,,,,,,,', 'css' => ['{{element}} .pagelayer-menu-includes' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ], 'separator_style' => [ 'separater' => array( 'type' => 'select', 'label' => __pl('type'), 'default' => 'dotted', 'css' => ['{{element}} .pagelayer-menu-separeter' =>'border-top-style:{{val}};'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), ] ), 'separater_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#777777', 'css' => ['{{element}} .pagelayer-menu-separeter' => 'border-top-color:{{val}};'], 'req' => ['!separater' => ''] ), 'separater_width' => array( 'type' => 'slider', 'label' => __pl('shape_width'), 'min' => 0, 'max' => 20, 'step' => 1, 'screen' => 1, 'css' => ['{{element}} .pagelayer-menu-separeter' => 'border-top-width:{{val}}px;'], 'default' => 1, 'req' => ['!separater' => ''] ), 'separater_spacing' => array( 'type' => 'slider', 'label' => __pl('stars_spacing'), 'min' => 0, 'max' => 100, 'step' => 1, 'screen' => 1, 'css' => ['{{element}} .pagelayer-menu-separeter' => 'margin: 0 {{val}}px;'], 'default' => 10, 'req' => ['!separater' => ''] ), ], 'price_style' => [ 'price_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#c02530', 'css' => ['{{element}} .pagelayer-menu-price' => 'color:{{val}}'], ), 'price_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',25,,600,,,,,,,', 'css' => ['{{element}} .pagelayer-menu-price' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ], 'desc_style' => [ 'desc_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#484745', 'css' => ['{{element}} .pagelayer-menu-desc' => 'color:{{val}}'], ), 'desc_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',14,,,,,solid,1.5,,,', 'css' => ['{{element}} .pagelayer-menu-desc' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ], 'image_style' => [ 'custom_size' => array( 'type' => 'spinner', 'label' => __pl('shape_width'), 'min' => 0, 'max' => 2000, 'step' => 1, 'screen' => 1, 'css' => ['{{element}} .pagelayer-menu-img img' => 'width: {{val}}px;'], 'default' => 400, ), 'img_spacing' => array( 'type' => 'slider', 'label' => __pl('stars_spacing'), 'min' => 0, 'max' => 100, 'step' => 1, 'screen' => 1, 'css' => ['{{element}} .pagelayer-menu-img' => 'padding-right: {{val}}px;'], 'default' => 10, ), 'img_border_hover' => array( 'type' => 'radio', 'label' => '', 'default' => '', 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'img_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-menu-img img' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'img_border_hover' => '' ), ), 'img_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-menu-img img' => 'border-color: {{val}};'], 'req' => array( '!img_border_type' => '' ), 'show' => array( 'img_border_hover' => '' ), ), 'img_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-menu-img img' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!img_border_type' => '' ], 'show' => array( 'img_border_hover' => '' ), ), 'img_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-menu-img img' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'show' => array( 'img_border_hover' => '' ), ), 'img_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}}:hover .pagelayer-menu-img img' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'img_border_hover' => 'hover' ), ), 'img_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['{{element}}:hover .pagelayer-menu-img img' => 'border-color: {{val}};'], 'default' => '#0986c0', 'req' => array( '!img_border_type' => '' ), 'show' => array( 'img_border_hover' => 'hover' ), ), 'img_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}}:hover .pagelayer-menu-img img' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!img_border_type' => '' ], 'show' => array( 'img_border_hover' => 'hover' ), ), 'img_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}}:hover .pagelayer-menu-img img' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'show' => array( 'img_border_hover' => 'hover' ), ), ], 'styles' => [ 'title_styles' => __pl('title_style'), 'item_details' => __pl('item_details'), 'price_style' => __pl('price_style'), 'desc_style' => __pl('desc_style'), 'image_style' => __pl('image_style'), 'separator_style' => __pl('separator_style'), ] ) ); // Menu item pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_menu_item', array( 'name' => __pl('menu_item'), 'group' => 'other', 'not_visible' => 1, 'parent' => [PAGELAYER_SC_PREFIX.'_menu_list'], //'innerHTML' => 'text', 'html' => '<div class="pagelayer-menu-item"> <div if="{{img}}" class="pagelayer-menu-img"> <img class="pagelayer-img" src="{{{img-url}}}" title="{{{img-title}}}" alt="{{{img-alt}}}"/> </div> <div class="pagelayer-menu-details"> <div class="pagelayer-menu-text"> <div class="pagelayer-menu-title"> <span if="{{title}}"> <div class="pagelayer-menu-title-holder">{{title}}</div> <div if="{{includes}}" class="pagelayer-menu-includes">{{includes}}</div> </span> <span class="pagelayer-menu-separeter"></span> <span if="{{price}}" class="pagelayer-menu-price">{{price}}</span> </div> <div if="{{desc}}" class="pagelayer-menu-desc">{{desc}}</div> </div> </div> </div>', 'params' => array( 'title' => array( 'type' => 'text', 'label' => __pl('title'), 'default' => __pl('menu_item'), 'edit' => '.pagelayer-menu-title-holder', ), 'includes' => array( 'type' => 'text', 'label' => __pl('includes_styles'), 'default' => __pl('includes_default'), 'edit' => '.pagelayer-menu-includes', ), 'desc' => array( 'type' => 'textarea', 'label' => __pl('desc_style'), 'default' => __pl('desc_default'), 'edit' => '.pagelayer-menu-desc', ), 'price' => array( 'type' => 'text', 'label' => __pl('price_style'), 'default' => __pl('$59'), 'edit' => '.pagelayer-menu-price', ), 'img' => array( 'type' => 'image', 'label' => __pl('Image'), ), ) ) ); // Post Portfolio pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_post_folio', array( 'name' => __pl('post_folio'), 'group' => 'other', 'html' => '<div class="pagelayer-postfolio-section">{{post_html}}</div>', 'params' => array( 'type' => array( 'type' => 'select', 'label' => __pl('type'), 'default' => 'post', 'list' => array( 'post' => __pl('post'), 'page' => __pl('page'), ), ), 'columns' => array( 'type' => 'select', 'label' => __pl('columns'), 'default' => '3', 'screen' => 1, 'css' => ['{{element}} .pagelayer-postfolio-container' => 'grid-template-columns: repeat({{val}},1fr);'], 'list' => array( '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', ), ), 'count' => array( 'type' => 'spinner', 'label' => __pl('post_per_page'), 'min' => 1, 'step' => 1, 'default' => 6, ), 'ratio' => array( 'type' => 'spinner', 'label' => __pl('ratio'), 'min' => 0, 'step' => 0.1, 'max' => 2, 'default' => 1, 'screen' => 1, 'css' => ['{{element}} .pagelayer-postfolio-thumb' => 'padding: calc(50% * {{val}}) 0;'], ), 'col_gap' => array( 'type' => 'slider', 'label' => __pl('col_gap'), 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 0, 'screen' => 1, 'css' => ['{{element}} .pagelayer-postfolio-container' => 'grid-column-gap: {{val}}px;'], ), 'row_gap' => array( 'type' => 'slider', 'label' => __pl('row_gap'), 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 0, 'screen' => 1, 'css' => ['{{element}} .pagelayer-postfolio-container' => 'grid-row-gap: {{val}}px;'], ), 'thumb_radius' => array( 'type' => 'slider', 'label' => __pl('border_radius'), 'min' => 0, 'step' => 1, 'max' => 50, 'default' => 0, 'screen' => 1, 'css' => [ '{{element}} .pagelayer-postfolio-thumb' => 'border-radius:{{val}}%;', '{{element}} .pagelayer-postfolio-content' => 'border-radius:{{val}}%;' ], ), ), 'title_style' => [ 'title_hover' => [ 'type' => 'radio', 'label' => '', 'default' => '', 'list' => [ '' => __pl('normal'), 'hover' => __pl('hover'), ], ], 'show_title' => array( 'type' => 'checkbox', 'label' => __pl('show_title'), 'default' => '', 'css' => ['{{element}} .pagelayer-entry-title' => 'opacity:1;'], 'show' => ['title_hover' => ''] ), 'title_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#333333', 'css' => ['{{element}} .pagelayer-entry-title' => 'color:{{val}};'], 'show' => ['title_hover' => ''], 'req' => ['show_title' => 'true'] ), 'title_typo' => array( 'type' => 'typography', 'label' => __pl('title_typo'), 'default' => ',20,,600,,,,,,,', 'css' => ['{{element}} .pagelayer-entry-title' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'show' => ['title_hover' => ''], 'req' => ['show_title' => 'true'] ), 'show_title_hover' => array( 'type' => 'checkbox', 'label' => __pl('show_title'), 'default' => 'true', 'css' => ['{{element}} .pagelayer-postfolio-content:hover .pagelayer-entry-title' => 'opacity:1;'], 'show' => ['title_hover' => 'hover'] ), 'title_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#333333', 'css' => ['{{element}} .pagelayer-postfolio-content:hover .pagelayer-entry-title' => 'color:{{val}};'], 'show' => ['title_hover' => 'hover'], 'req' => ['show_title_hover' => 'true'] ), 'title_typo_hover' => array( 'type' => 'typography', 'label' => __pl('title_typo'), 'default' => ',20,,600,,,,,,,', 'css' => ['{{element}} .pagelayer-postfolio-content:hover .pagelayer-entry-title' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'show' => ['title_hover' => 'hover'], 'req' => ['show_title_hover' => 'true'] ), ], 'overlay_style' => [ 'overlay_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#dadada', 'css' => ['{{element}} .pagelayer-postfolio-thumb' => 'background-color:{{val}};'] ), 'overlay_color_hover' => array( 'type' => 'color', 'label' => __pl('on_hover'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-postfolio-content:hover' => 'background-color:{{val}};'] ), 'overlay_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('overlay_hover_delay'), 'min' => 0, 'step' => 100, 'max' => 3000, 'default' => 400, 'css' => [ '{{element}} .pagelayer-postfolio-content' => '-webkit-transition: all {{val}}ms !important; transition: all {{val}}ms !important;', '{{element}} .pagelayer-entry-title' => '-webkit-transition: all {{val}}ms !important; transition: all {{val}}ms !important;', ], ), ], 'filter_style' => [ 'filter_by' => array( 'type' => 'select', 'label' => __pl('filter_by'), 'default' => 'category', 'list' => array( 'none' => __pl('none'), 'category' => __pl('category'), 'tags' => __pl('tags'), ), ), 'filter_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#8DBCFA', 'css' => ['{{element}} .pagelayer-postfolio-btn' => 'color:{{val}};'], 'req' => ['!filter_by' => ''] ), 'filter_bg' => array( 'type' => 'color', 'label' => __pl('background_color'), 'default' => '', 'css' => ['{{element}} .pagelayer-postfolio-btn' => 'background-color:{{val}};'], 'req' => ['!filter_by' => ''] ), 'filter_typo' => array( 'type' => 'typography', 'label' => __pl('title_typo'), 'default' => ',20,,,,,,,,,', 'css' => ['{{element}} .pagelayer-postfolio-btn' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => ['!filter_by' => ''] ), 'filter_size' => array( 'type' => 'dimension', 'label' => __pl('btn_padding'), 'default' => '5,10', 'screen' => 1, 'css' => ['{{element}} .pagelayer-postfolio-btn' => 'padding-top: {{val[0]}}px; padding-bottom: {{val[0]}}px; padding-left: {{val[1]}}px; padding-right: {{val[1]}}px;'], 'req' => ['!filter_by' => ''] ), 'filter_radius' => array( 'type' => 'slider', 'label' => __pl('border_radius'), 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 0, 'screen' => 1, 'css' => ['{{element}} .pagelayer-postfolio-btn' => 'border-radius:{{val}}px;'], 'req' => ['!filter_by' => ''] ), 'filter_spacing' => array( 'type' => 'slider', 'label' => __pl('space_between'), 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 5, 'screen' => 1, 'css' => ['{{element}} .pagelayer-postfolio-btn' => 'margin:0 {{val}}px;'], 'req' => ['!filter_by' => ''] ), 'space_bottom' => array( 'type' => 'slider', 'label' => __pl('space_bottom'), 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 10, 'screen' => 1, 'css' => ['{{element}} .pagelayer-postfolio-filter' => 'padding-bottom:{{val}}px;'], 'req' => ['!filter_by' => ''] ), ], 'styles' => [ 'title_style' => __pl('title_style'), 'overlay_style' => __pl('overlay_style'), 'filter_style' => __pl('filter_style'), ] ) ); // Posts pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_posts', array( 'name' => __pl('posts'), 'group' => 'other', 'prevent_inside' => ['pl_slides'], 'html' => '<div class="pagelayer-posts-container">{{post_html}}</div> <div if="{{infinite_types}}" class="pagelayer_load_button" data-text={{infinite_final}}> <a data-max="{{max_pages}}" class="pagelayer-btn-holder pagelayer-btn-load pagelayer-ele-link {{infinite_btn_type}} {{infinite_btn_size}} {{load_btn_icon_position}}"> <i if="{{load_btn_icon}}" class="{{load_btn_icon}} pagelayer-btn-load-icon"></i> <span if="{{infinite_text}}" class="pagelayer-btn-load-text" >{{infinite_text}}</span> <i if="{{load_btn_icon}}" class="{{load_btn_icon}} pagelayer-btn-load-icon"></i> </a> <div class="pagelayer-loader-holder" > <i class="fa fa-spinner fa-spin fa-3x fa-fw" aria-hidden="true"></i> </div> </div>', 'params' => array( 'post_type' => array( 'type' => 'select', 'label' => __pl('posts_grid_post_type_label'), 'desc' => __pl('posts_grid_post_type_desc'), 'list' => array( 'post' => __pl('post'), //'page' => __pl('page') ) ), 'by_period' => array( 'type' => 'select', 'label' => __pl('period'), 'default' => '', 'list' => array( '' => __pl('all'), 'last_day' => __pl('last_day'), 'last_week' => __pl('last_week'), 'last_month' => __pl('last_month'), 'last_year' => __pl('last_year'), 'custom' => __pl('custom'), //'ID' => __pl('ID'), ) ), 'before_date' => array( 'type' => 'datetime', 'displayMode' => 'datetime', // date | datetime (default) 'returnMode' => 'YYYY-MM-DD H:m:s', // mysql format uses here (default: Y-m-d H:i:s ) 'label' => __pl('before'), 'default' => '', 'req' => ['by_duration' => 'custom'] ), 'after_date' => array( 'type' => 'datetime', 'displayMode' => 'datetime', // date | datetime (default) 'returnMode' => 'YYYY-MM-DD H:m:s', // mysql format uses here (default: Y-m-d H:i:s ) 'label' => __pl('after'), 'default' => '', 'req' => ['by_duration' => 'custom'] ), 'orderby' => array( 'type' => 'select', 'label' => __pl('posts_order_by'), 'default' => 'date', 'list' => array( 'date' => __pl('date'), 'title' => __pl('title'), 'modified' => __pl('posts_order_by_modified'), 'rand' => __pl('posts_order_by_random'), 'menu_order' => __pl('posts_order_by_menu_order'), 'author' => __pl('author'), 'ID' => __pl('ID'), ) ), 'posts_order' => array( 'type' => 'select', 'label' => __pl('posts_grid_sort_order'), 'default' => 'DESC', 'list' => array( 'ASC' => __pl('posts_grid_sort_order_ascending'), 'DESC' => __pl('posts_grid_sort_order_descending') ) ), 'count' => array( 'type' => 'spinner', 'label' => __pl('post_per_page'), 'min' => 1, 'step' => 1, 'default' => 6, ), 'que_sec' => array( 'type' => 'radio', 'label' => '', 'default' => 'include', 'list' => array( 'include' => __pl('include'), 'exclude' => __pl('exclude') ) ), 'include_by' => array( 'type' => 'multiselect', 'label' => __pl('include_by'), 'list' => array( 'term' => __pl('term'), 'author' => __pl('author') ), 'show' => ['que_sec' => 'include'] ), 'inc_term' => array( 'type' => 'multiselect', 'label' => __pl('term'), 'list' => pagelayer_get_post_term(), 'req' => ['include_by' => ['term','term,author']], 'show' => ['que_sec' => 'include'] ), 'inc_author' => array( 'type' => 'select', 'label' => __pl('author'), 'list' => pagelayer_get_post_author(), 'req' => ['include_by' => ['author','term,author']], 'show' => ['que_sec' => 'include'] ), 'ignore_sticky' => array( 'label' => __pl('ignore_sticky_posts'), 'type' => 'checkbox', 'show' => ['que_sec' => 'include'] ), 'exclude_by' => array( 'type' => 'multiselect', 'label' => __pl('exclude_by'), 'list' => array( 'term' => __pl('term'), 'author' => __pl('author') ), 'show' => ['que_sec' => 'exclude'] ), 'exc_term' => array( 'type' => 'multiselect', 'label' => __pl('term'), 'list' => pagelayer_get_post_term(), 'req' => ['exclude_by' => ['term','term,author']], 'show' => ['que_sec' => 'exclude'] ), 'exc_author' => array( 'type' => 'select', 'label' => __pl('author'), 'list' => pagelayer_get_post_author(), 'req' => ['exclude_by' => ['author','term,author']], 'show' => ['que_sec' => 'exclude'] ), 'offset' => array( 'type' => 'spinner', 'label' => __pl('offset'), 'min' => 0, 'step' => 1, 'max' => 50, 'show' => ['que_sec' => 'exclude'] ), ), 'posts_options' => $pagelayer_posts_options, 'thumb_style' => $pagelayer_thumb_style, 'title_style' => $pagelayer_title_style, 'meta_options' => $pagelayer_meta_style, 'content_style' => $pagelayer_content_style, 'more_style' => $pagelayer_more_style, 'btn_border_style' => $pagelayer_btn_border_style, 'slider_options' => [ 'enable_slider' => array( 'type' => 'checkbox', 'label' => __pl('enable_slider'), 'default' => '', 'addAttr' => ['{{element}} .pagelayer-posts-container' => 'data-enable_slider="enable"'] ), 'slide_items' => array( 'type' => 'spinner', 'label' => __pl('number_of_items'), 'min' => 1, 'step' => 1, 'max' => 10, 'default' => 1, 'addAttr' => ['{{element}} .pagelayer-posts-container' => 'data-owl-items="{{slide_items}}"'], 'req' => ['enable_slider' => 'true'] ), 'slide_margin' => array( 'type' => 'slider', 'label' => __pl('space_between'), 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 10, 'addAttr' => ['{{element}} .pagelayer-posts-container' => 'data-owl-margin="{{slide_margin}}"'], 'req' => [ '!slide_items' => '1', 'enable_slider' => 'true' ] ), 'slide_loop' => array( 'type' => 'checkbox', 'label' => __pl('loop'), 'addAttr' => ['{{element}} .pagelayer-posts-container' => 'data-owl-loop="{{slide_loop}}"'], 'req' => ['enable_slider' => 'true'] ), 'slide_nav' => array( 'type' => 'checkbox', 'label' => __pl('navigation'), 'addAttr' => ['{{element}} .pagelayer-posts-container' => 'data-owl-nav="{{slide_nav}}"'], 'req' => ['enable_slider' => 'true'] ), 'slide_dots' => array( 'type' => 'checkbox', 'label' => __pl('bullets'), 'default' => 'true', 'addAttr' => ['{{element}} .pagelayer-posts-container' => 'data-owl-dots="{{slide_dots}}"'], 'req' => ['enable_slider' => 'true'] ), 'slide_autoplay' => array( 'type' => 'checkbox', 'label' => __pl('autoplay'), 'default' => 'true', 'addAttr' => ['{{element}} .pagelayer-posts-container' => 'data-owl-autoplay="{{slide_autoplay}}"'], 'req' => ['enable_slider' => 'true'] ), 'slide_timeout' => array( 'type' => 'spinner', 'label' => __pl('autoplay_timeout'), 'min' => 1000, 'step' => 200, 'max' => 10000, 'addAttr' => ['{{element}} .pagelayer-posts-container' => 'data-owl-autoplay-timeout="{{slide_timeout}}"'], 'req' => [ 'slide_autoplay' => 'true', 'enable_slider' => 'true' ] ), 'slide_hoverpause' => array( 'type' => 'checkbox', 'label' => __pl('autoplay_hover_pause'), 'addAttr' => ['{{element}} .pagelayer-posts-container' => 'data-owl-autoplay-hover-pause="{{slide_hoverpause}}"'], 'req' => [ 'slide_autoplay' => 'true', 'enable_slider' => 'true' ] ), ], 'infinite' => $pagelayer_infinite_style, 'arrow_styles' => $pagelayer->slider_arrow_styles, 'pager_styles' => $pagelayer->slider_pager_styles, 'styles' => [ 'posts_options' => __pl('posts_options'), 'thumb_style' => __pl('thumb_style'), 'title_style' => __pl('title_style'), 'meta_options' => __pl('meta_options'), 'content_style' => __pl('content_style'), 'more_style' => __pl('more_style'), 'btn_border_style' => __pl('border_styles'), 'slider_options' => __pl('slider_options'), 'arrow_styles' => __pl('arrow_styles'), 'pager_styles' => __pl('pager_styles'), 'infinite' => __pl('infinite_scroll'), ] ) ); // Slides pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_slides', array( 'name' => __pl('slides'), 'group' => 'other', 'has_group' => [ 'section' => 'params', 'prop' => 'elements' ], 'prevent_inside' => ['pl_slides'], 'holder' => '.pagelayer-slides-holder', 'child_selector' => '>.pagelayer-owl-stage-outer>.pagelayer-owl-stage>.pagelayer-owl-item', // Make it very specifc 'html' => '<div class="pagelayer-slides-holder pagelayer-owl-holder pagelayer-owl-carousel pagelayer-owl-theme"></div>', 'params' => array( 'elements' => array( 'type' => 'group', 'label' => __pl('slide'), 'sc' => PAGELAYER_SC_PREFIX.'_content_slide', 'item_label' => array( 'default' => __pl('slide'), 'param' => 'item' ), 'count' => 2, 'text' => strtr(__pl('add_new_item'), array('%name%' => __pl('slide'))), ), 'height' => array( 'type' => 'slider', 'label' => __pl('height'), 'screen' => 1, 'min' => 1, 'step' => 1, 'max' => 1500, 'units' => ['vh','px','%'], 'css' => [ '{{element}} .pagelayer-slide, {{element}} .pagelayer-content-slide' => 'max-height: {{val}}; height:{{val}};', ], ), ), 'slider_options' => $pagelayer->slider_options, 'arrow_styles' => $pagelayer->slider_arrow_styles, 'pager_styles' => $pagelayer->slider_pager_styles, 'styles' => [ 'slider_options' => __pl('slider_options'), 'arrow_styles' => __pl('arrow_styles'), 'pager_styles' => __pl('pager_styles'), ] ) ); // Content Slide pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_content_slide', array( 'name' => __pl('content_slide'), 'group' => 'other', 'has_group' => [ 'section' => 'params', 'prop' => 'elements', ], 'not_visible' => 1, 'parent' => [PAGELAYER_SC_PREFIX.'_slides'], 'holder' => '.pagelayer-content-slide', 'html' => '<div class="pagelayer-content-slide-bg"></div> <div class="pagelayer-slide-bg-overlay"></div> <div class="pagelayer-content-slide"></div>', 'params' => array( 'elements' => array( 'type' => 'group', 'label' => __pl('Inner Row'), 'sc' => PAGELAYER_SC_PREFIX.'_inner_row', 'count' => 1, 'item_label' => array( 'default' => __pl('Slide Inner Row'), ), 'inner_content' => [ ['pl_col' => [ 'atts' => ['ele_padding' => '8%,8%,8%,8%', 'content_pos' => 'center'], 'inner_content' => [ ['pl_anim_heading' => [ 'atts' => ['text' => 'Faster & Easiest way to make a slide with', 'type' => 'rotating', 'align' => 'center', 'animations' => 'pagelayer-aheading-push', 'color' => '#fff', 'color_type' => 'color', 'rotate_color' => '#ff7a03', 'rotate_text' => 'Drag&Drop,Animations,&More', 'typo' => ',30,,700,,,Solid,,,,'] ]], ['pl_heading' => [ 'atts' => ['text' => '<h4>Slide show Sub-Heading</h4>', 'color' => '#ffffff', 'align' => 'center'] ]], ['pl_text' => [ 'atts' => ['text' => '<p style="text-align: center; color: rgb(255, 255, 255);">This is the default Slide show content. Feel free to delete it.</p>'] ]], ['pl_btn' => [ 'atts' => ['align' => 'center', 'type' => 'pagelayer-btn-custom', 'size' => 'pagelayer-btn-mini', 'btn_bg_color' => '', 'btn_color' => '#fff', 'btn_border_type' => 'solid', 'btn_border_color' => '#fff', 'btn_color_hover' => '#fff'] ]], ] ]], ], 'hide' => 1, ), 'type' => array( 'label' => __pl('background_type'), 'type' => 'radio', 'list' => array( '' => __pl('color'), 'image' => __pl('image'), 'gradient' => __pl('gradient') ), ), 'bg_color' => [ 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-content-slide-bg' => 'background: {{val}};'], 'req' => ['type' => ''] ], 'gradient' => [ 'type' => 'gradient', 'label' => '', 'default' => '150,#44d3f6,23,#72e584,45,#2ca4eb,100', 'css' => ['{{element}} .pagelayer-content-slide-bg' => 'background: linear-gradient({{val[0]}}deg, {{val[1]}} {{val[2]}}%, {{val[3]}} {{val[4]}}%, {{val[5]}} {{val[6]}}%);'], 'req' => ['type' => 'gradient'] ], 'img_color' => [ 'type' => 'color', 'label' => __pl('color'), 'desc' => __pl('fallback_color'), 'css' => ['{{element}} .pagelayer-content-slide-bg' => 'background: {{val}};'], 'req' => ['type' => 'image'] ], 'bg_img' => [ 'type' => 'image', 'label' => __pl('Image'), 'css' => ['{{element}} .pagelayer-content-slide-bg' => 'background: url("{{{bg_img-url}}}");'], 'req' => ['type' => 'image'] ], 'bg_attachment' => [ 'type' => 'select', 'label' => __pl('ele_bg_attachment'), 'list' => [ '' => __pl('default'), 'scroll' => __pl('scroll'), 'fixed' => __pl('fixed') ], 'css' => ['{{element}} .pagelayer-content-slide-bg' => 'background-attachment: {{val}};', '{{element}} .pagelayer-content-slide-bg' => 'background-attachment: {{val}};'], 'req' => ['type' => 'image'] ], 'bg_posx' => [ 'type' => 'select', 'label' => __pl('ele_bg_posx'), 'list' => [ '' => __pl('default'), 'center' => __pl('center'), 'left' => __pl('left'), 'right' => __pl('right') ], 'css' => ['{{element}} .pagelayer-content-slide-bg' => 'background-position-x: {{val}};'], 'req' => ['type' => 'image'] ], 'bg_posy' => [ 'type' => 'select', 'label' => __pl('ele_bg_posy'), 'list' => [ '' => __pl('default'), 'center' => __pl('center'), 'top' => __pl('top'), 'bottom' => __pl('bottom') ], 'css' => ['{{element}} .pagelayer-content-slide-bg' => 'background-position-y: {{val}};'], 'req' => ['type' => 'image'] ], 'bg_repeat' => [ 'type' => 'select', 'label' => __pl('ele_bg_repeat'), 'css' => ['{{element}} .pagelayer-content-slide-bg' => 'background-repeat: {{val}};'], 'list' => [ '' => __pl('default'), 'repeat' => __pl('repeat'), 'no-repeat' => __pl('no-repeat'), 'repeat-x' => __pl('repeat-x'), 'repeat-y' => __pl('repeat-y'), ], 'req' => ['type' => 'image'] ], 'bg_size' => [ 'type' => 'select', 'label' => __pl('ele_bg_size'), 'css' => ['{{element}} .pagelayer-content-slide-bg' => 'background-size: {{val}};'], 'list' => [ '' => __pl('default'), 'cover' => __pl('cover'), 'contain' => __pl('contain') ], 'req' => ['type' => 'image'] ], 'bg_ken_burn' => array( 'type' => 'checkbox', 'label' => __pl('ken_burn_effect'), 'css' => ['{{element}} .pagelayer-content-slide-bg' => 'animation-name: pagelayerKenBurn;'], 'req' => ['type' => 'image'] ), 'bg_ken_burn_speed' => array( 'type' => 'spinner', 'label' => __pl('ken_burn_speed'), 'min' => 1, 'step' => 1, 'default' => '20', 'css' => ['{{element}} .pagelayer-content-slide-bg' => 'animation-duration:{{val}}s;'], 'req' => ['!bg_ken_burn' => '', 'type' => 'image'], ), 'bg_ken_burn_rev' => array( 'type' => 'checkbox', 'label' => __pl('ken_burn_reverse'), 'css' => ['{{element}} .pagelayer-content-slide-bg' => 'animation-name: pagelayerKenBurnReverse;'], 'req' => ['!bg_ken_burn' => '', 'type' => 'image'], ), 'bg_ken_burn_loop' => array( 'type' => 'checkbox', 'label' => __pl('loop_kenburn'), 'css' => ['{{element}} .pagelayer-content-slide-bg' => 'animation-iteration-count: infinite;'], 'req' => ['!bg_ken_burn' => '', 'type' => 'image'], ), 'bg_overlay' => [ 'type' => 'checkbox', 'label' => __pl('row_bg_overlay'), ], 'bg_overlay_color' => [ 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-slide-bg-overlay' => 'background-color: {{val}}'], 'req' => ['!bg_overlay' => ''] ], 'bg_overlay_blend_mode' => [ 'type' => 'select', 'label' => __pl('blend_mode'), 'list' => [ '' => __pl('Normal'), 'multiply' => __pl('Multiply'), 'screen' => __pl('Screen'), 'overlay' => __pl('Overlay'), 'darken' => __pl('Darken'), 'lighten' => __pl('Lighten'), 'color-dodge' => __pl('Color Dodge'), 'color-burn' => __pl('Color Burn'), 'hue' => __pl('Hue'), 'saturation' => __pl('Saturation'), 'color' => __pl('Color'), 'exclusion' => __pl('Exclusion'), 'luminosity' => __pl('Luminosity'), ], 'css' => ['{{element}} .pagelayer-slide-bg-overlay' => 'mix-blend-mode:{{val}};'], 'req' => ['!bg_overlay' => ''], ], ), )); // Slide, for backward compatibility of slides child pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_slide', array( 'name' => __pl('slide'), 'group' => 'other', 'holder' => '.pagelayer-slide-btns', 'not_visible' => 1, 'parent' => [PAGELAYER_SC_PREFIX.'_slides'], 'html' => '<div class="pagelayer-slide-holder"> <div if="{{heading}}" class="pagelayer-slide-heading">{{heading}}</div> <div if="{{sub}}" class="pagelayer-slide-sub">{{sub}}</div> <div if="{{desc}}" class="pagelayer-slide-desc">{{desc}}</div> <div class="pagelayer-slide-btns"></div> </div>', //'innerHTML' => 'desc', 'has_group' => [ 'section' => 'btn_style', 'prop' => 'elements' ], 'params' => array( 'type' => array( 'label' => __pl('background_type'), 'type' => 'radio', 'default' => 'color', 'list' => array( 'color' => __pl('color'), 'image' => __pl('image'), 'gradient' => __pl('gradient') ) ), 'color' => [ 'type' => 'color', 'label' => __pl('color'), 'default' => '#0986c0', 'css' => 'background: {{val}};', 'req' => ['type' => 'color'] ], 'gradient' => [ 'type' => 'gradient', 'label' => '', 'default' => '150,#44d3f6,23,#72e584,45,#2ca4eb,100', 'css' => 'background: linear-gradient({{val[0]}}deg, {{val[1]}} {{val[2]}}%, {{val[3]}} {{val[4]}}%, {{val[5]}} {{val[6]}}%);', 'req' => ['type' => 'gradient'] ], 'img_color' => [ 'type' => 'color', 'label' => __pl('color'), 'default' => '', 'desc' => __pl('fallback_color'), 'css' => 'background: {{val}};', 'req' => ['type' => 'image'] ], 'bg_img' => [ 'type' => 'image', 'label' => __pl('Image'), 'css' => 'background: url("{{{bg_img-url}}}");', 'req' => ['type' => 'image'] ], 'bg_attachment' => [ 'type' => 'select', 'label' => __pl('ele_bg_attachment'), 'list' => [ '' => __pl('default'), 'scroll' => __pl('scroll'), 'fixed' => __pl('fixed') ], 'css' => 'background-attachment: {{val}};', 'req' => ['type' => 'image'] ], 'bg_posx' => [ 'type' => 'select', 'label' => __pl('ele_bg_posx'), 'list' => [ '' => __pl('default'), 'center' => __pl('center'), 'left' => __pl('left'), 'right' => __pl('right') ], 'css' => 'background-position-x: {{val}};', 'req' => ['type' => 'image'] ], 'bg_posy' => [ 'type' => 'select', 'label' => __pl('ele_bg_posy'), 'list' => [ '' => __pl('default'), 'center' => __pl('center'), 'top' => __pl('top'), 'bottom' => __pl('bottom') ], 'css' => 'background-position-y: {{val}};', 'req' => ['type' => 'image'] ], 'bg_repeat' => [ 'type' => 'select', 'label' => __pl('ele_bg_repeat'), 'css' => 'background-repeat: {{val}};', 'list' => [ '' => __pl('default'), 'repeat' => __pl('repeat'), 'no-repeat' => __pl('no-repeat'), 'repeat-x' => __pl('repeat-x'), 'repeat-y' => __pl('repeat-y'), ], 'req' => ['type' => 'image'] ], 'bg_size' => [ 'type' => 'select', 'label' => __pl('ele_bg_size'), 'css' => 'background-size: {{val}};', 'list' => [ '' => __pl('default'), 'cover' => __pl('cover'), 'contain' => __pl('contain') ], 'req' => ['type' => 'image'] ], ), 'content_box_style' => [ 'content_width' => array( 'type' => 'spinner', 'label' => __pl('width'), 'screen' => 1, 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 80, 'css' => ['{{element}} .pagelayer-slide-holder' => 'width: {{val}}%'], ), 'content_posx' => array( 'type' => 'slider', 'label' => __pl('horizontal_pos'), 'screen' => 1, 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 50, 'css' => ['{{element}} .pagelayer-slide-holder' => 'left: {{val}}%;'], ), 'content_posy' => array( 'type' => 'slider', 'label' => __pl('verticle_postion'), 'screen' => 1, 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 50, 'css' => ['{{element}} .pagelayer-slide-holder' => 'top: {{val}}%; transform: translate(-{{content_posx}}%, -{{val}}%);'], ), 'content_bg' => [ 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#46494a98', 'css' => ['{{element}} .pagelayer-slide-holder' => 'background: {{val}}'], ], 'content_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'screen' => 1, 'default' => '50,50,50,50', 'css' => ['{{element}} .pagelayer-slide-holder' => 'padding-top:{{val[0]}}px; padding-right:{{val[1]}}px; padding-bottom:{{val[2]}}px; padding-left:{{val[3]}}px'], ), 'align' => array( 'label' => __pl('alignment'), 'type' => 'radio', 'default' => 'center', 'css' => ['{{element}} .pagelayer-slide-holder' => 'text-align:{{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ) ), ], 'heading_style' => [ 'heading' => array( 'type' => 'text', 'label' => __pl('heading_style'), 'default' => __pl('This is Heading'), 'edit' => '.pagelayer-slide-heading', ), 'heading_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-slide-heading' => 'color: {{val}};'], ), 'heading_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',44,,700,,,solid,,,,', 'css' => ['{{element}} .pagelayer-slide-heading' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'heading_spacing' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'screen' => 1, 'min' => 0, 'step' => 1, 'default' => 0, 'max' => 200, 'css' => ['{{element}} .pagelayer-slide-heading' => 'padding-bottom: {{val}}px'], ), ], 'sub_style' => [ 'sub' => array( 'type' => 'textarea', 'label' => __pl('sub_style'), 'default' => __pl('This is Sub-Heading'), 'edit' => '.pagelayer-slide-sub', ), 'sub_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-slide-sub' => 'color: {{val}};'], ), 'sub_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',26,,,,,solid,,,,', 'css' => ['{{element}} .pagelayer-slide-sub' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'sub_spacing' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'screen' => 1, 'min' => 0, 'step' => 1, 'default' => 20, 'max' => 200, 'css' => ['{{element}} .pagelayer-slide-sub' => 'padding-bottom: {{val}}px'], ), ], 'btn_style' => [ 'elements' => array( 'type' => 'group', 'label' => __pl('buttons'), 'sc' => PAGELAYER_SC_PREFIX.'_btn', 'item_label' => array( 'default' => __pl('button'), 'param' => 'text' ), 'count' => 2, 'text' => strtr(__pl('add_new_item'), array('%name%' => __pl('button_name'))), ), 'btn_space' => array( 'type' => 'slider', 'label' => __pl('space_between'), 'screen' => 1, 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 10, 'css' => ['{{element}} .pagelayer-btn' => 'padding-right: {{val}}px;'], ) ], 'desc_style' => [ 'desc' => array( 'type' => 'textarea', 'label' => __pl('desc_style'), 'default' => __pl('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ac leo ut arcu dictum viverra at eu magna.'), 'edit' => '.pagelayer-slide-desc', ), 'desc_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-slide-desc' => 'color: {{val}};'], ), 'desc_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',15,,,,,solid,,,,', 'css' => ['{{element}} .pagelayer-slide-desc' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'desc_spacing' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'screen' => 1, 'min' => 0, 'step' => 1, 'default' => 10, 'max' => 200, 'css' => ['{{element}} .pagelayer-slide-desc' => 'padding-bottom: {{val}}px'], ), ], 'styles' => [ 'content_box_style' => __pl('content_box_style'), 'heading_style' => __pl('heading_style'), 'sub_style' => __pl('sub_style'), 'desc_style' => __pl('desc_style'), 'btn_style' => __pl('btn_style'), ] ) ); // Author Box pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_author_box', array( 'name' => __pl('author_box'), 'group' => 'archive', 'html' => '<div class="pagelayer-author-box-div pagelayer-author-box-holder pagelayer-layout-{{layout}}"> <div class="pagelayer-author-profile-pic" if={{author_picture}}> <a if-ext={{show_website}} href="{{{author_website}}}" class="pagelayer-link-sel"> <img class="pagelayer-img pagelayer-author-image" src="{{{avatar-url}}}" title="{{{avatar-title}}}" alt="{{{avatar-alt}}}" /> </a> </div> <div class="pagelayer-author-profile-desc"> <a href="{{{author_website}}}" if-ext={{show_website}}> <div class="pagelayer-author-title" if={{show_name}}>{{display_html}}</div> </a> <p class="pagelayer-author-bio" if={{show_bio}}>{{description}}</p> <a href="{{user_url}}" class="pagelayer-author-btn {{type}} pagelayer-button {{size}} pagelayer-ele-link" if={{archive_btn}}>{{archive_btn_txt}}</a> <a href="{{{author_website}}}" class="pagelayer-author-btn {{type}} pagelayer-button {{size}} pagelayer-ele-link" if={{show_as_button}}>{{btn_txt}}</a> </div> </div>', 'params' => array( 'box_source' => array( 'type' => 'select', 'label' => __pl('box_source_type'), 'default' => 'current', 'list' => array( 'current' => __pl('current_author'), 'custom' => __pl('custom'), ), ), 'avatar' => array( 'type' => 'image', 'label' => __pl('custom_image'), 'default' => PAGELAYER_URL.'/images/default-image.png', 'req' => ['box_source' => 'custom'], ), 'author_picture' => array( 'type' => 'checkbox', 'label' => __pl('author_picture'), 'default' => true, ), 'show_name' => array( 'type' => 'checkbox', 'label' => __pl('show_name'), 'default' => true, ), 'display_name' => array( 'type' => 'text', 'label' => __pl('display_name'), 'req' => ['box_source' => 'custom', 'show_name' => 'true' ], 'default' => 'Author', ), 'name_style' => array( 'type' => 'select', 'label' => __pl('name_style'), 'default' => 'h4', 'list' => array( 'h1' => __pl('H1'), 'h2' => __pl('H2'), 'h3' => __pl('H3'), 'h4' => __pl('H4'), 'h5' => __pl('H5'), 'h6' => __pl('H6'), ), ), 'user_url' => array( 'type' => 'select', 'label' => __pl('link'), 'default' => 'none', 'list' => array( 'none' => __pl('none'), 'archives' => __pl('archives'), ), 'req' => ['box_source' => 'current'], ), 'show_website' => array( 'type' => 'checkbox', 'label' => __pl('show_site'), 'default' => '', ), 'author_website' => array( 'type' => 'link', 'label' => __pl('author_website'), 'selector' => '.pagelayer-link-sel', 'req' => ['show_website' => 'true'], ), 'show_as_button' => array( 'type' => 'checkbox', 'label' => __pl('show_website_btn'), 'default' => '', 'req' => ['show_website' => 'true'], ), 'btn_txt' => array( 'type' => 'text', 'label' => __pl('button_text'), 'default' => 'Website', 'req' => array( 'show_as_button' => 'true', 'show_website' => 'true' ), ), 'show_bio' => array( 'type' => 'checkbox', 'label' => __pl('show_bio'), 'req' => ['box_source' => 'custom'], 'default' => 'true', ), 'description' => array( 'type' => 'textarea', 'label' => __pl('description'), 'default' => 'This is my Bio!', 'req' => array( 'box_source' => 'custom', 'show_bio' => 'true' ), ), 'archive_btn' => array( 'type' => 'checkbox', 'label' => __pl('show_archive_btn'), 'default' => '', 'req' => ['box_source' => 'current'], ), 'archive_btn_txt' => array( 'type' => 'text', 'label' => __pl('archive_btn_txt'), 'default' => 'All Post', 'req' => array( 'archive_btn' => 'true', 'box_source' => 'current' ), ), 'layout' => array( 'type' => 'radio', 'label' => __pl('layout'), 'default' => 'left', //'css' => ['{{element}} .pagelayer-author-profile-pic' => 'text-align: {{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ) ), 'alignment' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'left', 'screen' => 1, 'css' => ['{{element}} .pagelayer-author-profile-desc' => 'text-align: {{val}}', '{{element}} .pagelayer-author-profile-pic' => 'text-align: {{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ) ), ), 'image_style' => [ 'image_size' => array( 'type' => 'slider', 'label' => __pl('image_size'), 'step' => 1, 'max' => 200, 'min' => 0, 'screen' => 1, 'css' => ['{{element}} .pagelayer-author-image' => 'height: {{val}}px; width: {{val}}px;'], ), 'image_gap' => array( 'type' => 'slider', 'label' => __pl('gap'), 'step' => 1, 'max' => 100, 'min' => 0, 'screen' => 1, 'css' => ['{{element}} .pagelayer-author-profile-pic' => 'padding-right: {{val}}px;'], ), 'image_border' => array( 'type' => 'checkbox', 'label' => __pl('border'), 'default' => '', ), 'image_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'req' => ['image_border' => 'true'], 'css' => ['{{element}} .pagelayer-author-image' => 'border-color: {{val}};'], ), 'image_border_width' => array( 'type' => 'slider', 'label' => __pl('border_width'), 'max' => 20, 'step' => 1, 'min' => 0, 'screen' => 1, 'req' => ['image_border' => 'true'], 'css' => ['{{element}} .pagelayer-author-image' => 'border-width: {{val}}px;'], ), 'image_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-author-image' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'req' => ['image_border' => 'true'], ), 'image_border_radius' => array( 'type' => 'slider', 'label' => __pl('border_radius'), 'step' => 1, 'max' => 100, 'min' => 0, 'screen' => 1, 'css' => ['{{element}} .pagelayer-author-image' => 'border-radius: {{val}}px;'], ), 'image_border_shadow' => array( 'type' => 'box_shadow', 'label' => __pl('shadow'), 'css' => ['{{element}} .pagelayer-author-image' =>'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}} !important;'], ) ], 'text_style' => [ 'name_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-author-title *' => 'color: {{val}};'], ), 'name_typography' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-author-title *' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', '{{element}} .pagelayer-author-title' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'title_gap' => array( 'type' => 'slider', 'label' => __pl('gap'), 'step' => 1, 'max' => 100, 'min' => 0, 'screen' => 1, 'css' => ['{{element}} .pagelayer-author-title' => 'padding-bottom: {{val}}px;'], ), 'bio_color' => array( 'type' => 'color', 'label' => __pl('bio_color'), 'css' => ['{{element}} .pagelayer-author-bio' => 'color: {{val}};'], ), 'bio_typography' => array( 'type' => 'typography', 'label' => __pl('bio_typo'), 'css' => ['{{element}} .pagelayer-author-bio *' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', '{{element}} .pagelayer-author-bio' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'bio_gap' => array( 'type' => 'slider', 'label' => __pl('bio_gap'), 'step' => 1, 'max' => 100, 'min' => 0, 'screen' => 1, 'css' => ['{{element}} .pagelayer-author-bio' => 'padding-bottom: {{val}}px;'], ), ], 'button_style' => [ 'type' => array( 'type' => 'select', 'label' => __pl('button_type_label'), 'default' => 'pagelayer-btn-default', //'addClass' => ['{{element}} .pagelayer-btn-holder' => '{{val}}'], 'list' => array( 'pagelayer-btn-default' => __pl('btn_type_default'), 'pagelayer-btn-primary' => __pl('btn_type_primary'), 'pagelayer-btn-secondary' => __pl('btn_type_secondary'), 'pagelayer-btn-success' => __pl('btn_type_success'), 'pagelayer-btn-info' => __pl('btn_type_info'), 'pagelayer-btn-warning' => __pl('btn_type_warning'), 'pagelayer-btn-danger' => __pl('btn_type_danger'), 'pagelayer-btn-dark' => __pl('btn_type_dark'), 'pagelayer-btn-light' => __pl('btn_type_light'), 'pagelayer-btn-link' => __pl('btn_type_link'), 'pagelayer-btn-custom' => __pl('btn_type_custom') ), ), 'size' => array( 'type' => 'select', 'label' => __pl('button_size_label'), 'default' => 'pagelayer-btn-large', 'list' => array( 'pagelayer-btn-mini' => __pl('mini'), 'pagelayer-btn-small' => __pl('small'), 'pagelayer-btn-large' => __pl('large'), 'pagelayer-btn-extra-large' => __pl('extra_large'), 'pagelayer-btn-double-large' => __pl('double_large'), 'pagelayer-btn-custom' => __pl('custom'), ) ), 'btn_custom_size' => array( 'type' => 'spinner', 'label' => __pl('btn_custom_size'), 'min' => 1, 'step' => 1, 'max' => 100, 'default' => 5, 'screen' => 1, 'css' => ['{{element}} .pagelayer-author-btn' => 'padding: calc({{val}}px / 2) {{val}}px;'], 'req' => array( 'size' => 'pagelayer-btn-custom' ), ), 'btn_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => '', //'no_val' => 1,// Dont set any value to element 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), 'req' => array( 'type' => 'pagelayer-btn-custom', ), ), 'btn_bg_color' => array( 'type' => 'color', 'label' => __pl('btn_bg_color_label'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-author-btn' => 'background-color: {{val}};'], 'req' => array( 'type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => '' ), ), 'btn_color' => array( 'type' => 'color', 'label' => __pl('btn_color_label'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-author-btn' => 'color: {{val}};'], 'req' => array( 'type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => '' ), ), 'btn_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('btn_hover_delay_label'), 'desc' => __pl('btn_hover_delay_desc'), 'min' => 0, 'step' => 100, 'max' => 5000, 'default' => 400, 'css' => ['{{element}} .pagelayer-author-btn' => '-webkit-transition: all {{val}}ms !important; transition: all {{val}}ms !important;'], 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('btn_bg_color_hover_label'), 'default' => '', 'css' => ['{{element}} .pagelayer-author-btn:hover' => 'background-color: {{val}};'], 'req' => array( 'type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_color_hover' => array( 'type' => 'color', 'label' => __pl('btn_color_hover_label'), 'default' => '', 'css' => ['{{element}} .pagelayer-author-btn:hover' => 'color: {{val}};'], 'req' => array( 'type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_bor_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => '', //'no_val' => 1,// Dont set any value to element 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ) ), 'btn_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-author-btn' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_color' => array( 'type' => 'color', 'label' => __pl('border_color_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-author-btn' => 'border-color: {{val}};'], 'req' => array( '!btn_border_type' => '' ), 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'css' => ['{{element}} .pagelayer-author-btn' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!btn_border_type' => '' ], 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'css' => ['{{element}} .pagelayer-author-btn' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!btn_border_type' => '' ), 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-author-btn:hover' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'btn_bor_hover' => 'hover' ), ), 'btn_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color_hover_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-author-btn:hover' => 'border-color: {{val}};'], 'req' => array( '!btn_border_type_hover' => '' ), 'show' => array( 'btn_bor_hover' => 'hover' ), ), 'btn_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width_hover'), 'css' => ['{{element}} .pagelayer-author-btn:hover' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!btn_border_type_hover' => '' ], 'show' => array( 'btn_bor_hover' => 'hover' ), ), 'btn_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius_hover'), 'css' => ['{{element}} .pagelayer-author-btn:hover' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!btn_border_type_hover' => '' ), 'show' => array( 'btn_bor_hover' => 'hover' ), ), 'btn_gap' => array( 'type' => 'slider', 'label' => __pl('btn_gap'), 'step' => 1, 'max' => 100, 'min' => 0, 'screen' => 1, 'css' => ['{{element}} .pagelayer-author-btn' => 'margin-bottom: {{val}}px;'], ), ], 'styles' => [ 'image_style' => __pl('image'), 'text_style' => __pl('text'), 'button_style' => __pl('button'), ] ) ); // Login pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_login', array( 'name' => __pl('login'), 'group' => 'other', 'html' => '<div class="pagelayer-login-div pagelayer-login-holder" > <form class="pagelayer-login-form" onsubmit="return pagelayer_login_submit(this, event)" method="POST"> <div> <label if={{show_label}} class="pagelayer-login-username">{{custom_label_username}}</label> <input type="text" name="username" id="username" placeholder="{{custom_placeholder_login}}" class="pagelayer-login-input-field" spellcheck="false"/> </div> <div class="user-pass-wrap"> <label if={{show_label}} class="pagelayer-login-password">{{custom_label_password}}</label> <input type="password" name="password" id="password" placeholder="{{custom_placeholder_password}}" class="pagelayer-login-input-field" spellcheck="false"/> </div> <div class="pagelayer-login-cap" if="{{login_cap}}">{{login_cap}}</div> <div> <input type="checkbox" name="remember_me" if="{{remember_me}}" class="pagelayer-rememberMe"/><label if="{{remember_me}}" class="pagelayer-rememberMe">Remember Me</label> </div> <div class="wrapper pagelayer-login-btn-{{alignment}} pagelayer-login-wrappers"> <input type="hidden" name="login_url" value="{{redirect_url}}" if="{{redirect_login}}" /> <input type="hidden" name="logout_url" value="{{logout_url}}" if="{{redirect_logout}}" /> <button name="submit" class="pagelayer-ele-link pagelayer-login-btn {{btn_type}} pagelayer-button {{btn_size}}">{{login_text}}</button> </div> <div class="pagelayer-login-wrappers"> <a if="{{lost_pass}}" href="'. esc_url( wp_lostpassword_url( get_permalink() ) ) .'" class="pagelayer-ele-link">Lost your Password?</a> </div> </form> <div class="pagelayer-login-error-box"></div> </div> <div class="pagelayer-logout-txt" if={{display_logouttxt}}>{{display_logouttxt}}</div>', 'params' => array( 'show_label' => array( 'type' => 'checkbox', 'label' => __pl('show_label'), 'default' => 'true' ), 'remember_me' => array( 'type' => 'checkbox', 'label' => __pl('remember_me'), 'default' => 'true' ), 'lost_pass' => array( 'type' => 'checkbox', 'label' => __pl('lost_pass'), 'default' => 'true' ), 'custom_label' => array( 'type' => 'checkbox', 'label' => __pl('custom_label'), 'default' => '', ), 'custom_label_username' => array( 'type' => 'text', 'label' => __pl('custom_label_username'), 'default' => 'Username', 'show' => ['custom_label' => 'true'], 'edit' => '.pagelayer-login-username', ), 'custom_placeholder_login' => array( 'type' => 'text', 'label' => __pl('custom_placeholder_login'), 'default' => 'Username', 'show' => ['custom_label' => 'true'], ), 'custom_label_password' => array( 'type' => 'text', 'label' => __pl('custom_label_password'), 'default' => 'Password', 'show' => ['custom_label' => 'true'], 'edit' => '.pagelayer-login-password', ), 'custom_placeholder_password' => array( 'type' => 'text', 'label' => __pl('custom_placeholder_password'), 'default' => 'Password', 'show' => ['custom_label' => 'true'], ), 'redirect_login' => array( 'type' => 'checkbox', 'label' => __pl('redirect_login'), 'default' => '', ), 'redirect_url' => array( 'type' => 'text', 'label' => __pl('login_redirect_url'), 'desc' => __pl('redirect_url_desc'), 'default' => '', 'req' => ['redirect_login' => 'true'], ), 'redirect_logout' => array( 'type' => 'checkbox', 'label' => __pl('redirect_logout'), 'default' => '', ), 'logout_url' => array( 'type' => 'text', 'label' => __pl('logout_redirect_url'), 'desc' => __pl('redirect_url_desc'), 'default' => '', 'req' => ['redirect_logout' => 'true'], ), ), 'form_style' => array( 'row_gap' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'step' => 1, 'screen' => 1, 'max' => 60, 'css' => ['{{element}} .pagelayer-login-div input, .pagelayer-login-div .pagelayer-login-wrappers' => 'margin-bottom: {{val}}px;'], ), 'alignment' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'screen' => 1, 'default' => 'left', 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'css' => ['{{element}} .pagelayer-login-div, .pagelayer-login-input-field' => 'text-align: {{val}};'], 'addClass' => ['{{element}} .pagelayer-login-input-field' => 'pagelayer-login-input-{{val}}'] ), 'link_color' => array( 'type' => 'color', 'label' => __pl('link_color'), 'css' => ['{{element}} .pagelayer-login-form a' => 'color: {{val}};'], ), 'link_color_hover' => array( 'type' => 'color', 'label' => __pl('link_color_hover'), 'css' => ['{{element}} .pagelayer-login-form a:hover' => 'color: {{val}};'], ), ), 'label_style' => array( 'label_gap' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'step' => 1, 'screen' => 1, 'max' => 60, 'css' => ['{{element}} .pagelayer-login-div label' => 'margin-bottom: {{val}}px;'], ), 'text_color' => array( 'type' => 'color', 'label' => __pl('text_color'), 'css' => ['{{element}} .pagelayer-login-form label, {{element}} .pagelayer-login-cap' => 'color: {{val}};'], ), 'label_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-login-form label, {{element}} .pagelayer-login-cap' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ), 'fields_style' => array( 'field_width' => array( 'type' => 'slider', 'label' => __pl('width'), 'desc' => __pl('login_widget_width_desc'), 'min' => 10, 'max' => 100, 'step' => 1, 'screen' => 1, 'css' => ['{{element}} .pagelayer-login-form .pagelayer-login-input-field' => 'width: {{val}}%;'] ), 'field_color' => array( 'type' => 'color', 'label' => __pl('text_color'), 'css' => ['{{element}} .pagelayer-login-form .pagelayer-login-input-field, {{element}} .pagelayer-login-cap input' => 'color: {{val}};', '{{element}} .pagelayer-login-form .pagelayer-login-input-field::selection' => 'color:white; background-color: {{val}};'], ), 'field_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-login-form input' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'field_bgcolor' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} .pagelayer-login-form .pagelayer-login-input-field, {{element}} .pagelayer-login-cap input' => 'background-color: {{val}};'], ), 'field_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['{{element}} .pagelayer-login-form .pagelayer-login-input-field, {{element}} .pagelayer-login-cap input' => 'border-color: {{val}};'], ), 'field_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-login-form .pagelayer-login-input-field, {{element}} .pagelayer-login-cap input' => 'border-width: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], ), 'field_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-login-form .pagelayer-login-input-field, {{element}} .pagelayer-login-cap input' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], ), ), 'buttons_style' => array( 'login_text' => array( 'type' => 'text', 'label' => __pl('text'), 'default' => 'Log In', 'edit' => '.pagelayer-login-btn', ), 'btn_stretch' => array( 'type' => 'checkbox', 'label' => __pl('stretch'), 'css' => ['{{element}} .pagelayer-login-btn' => 'width:100%;'], ), 'btn_gap' => array( 'type' => 'padding', 'label' => __pl('spacing'), 'step' => 1, 'screen' => 1, 'max' => 60, 'default' => '10', 'css' => ['{{element}} .pagelayer-login-btn' => 'margin-top: {{val[0]}}px; margin-right: {{val[1]}}px; margin-bottom: {{val[2]}}px; margin-left: {{val[3]}}px'], ), 'btn_type' => array( 'type' => 'select', 'label' => __pl('button_type_label'), 'default' => 'pagelayer-btn-default', //'addClass' => ['{{element}} .pagelayer-btn-holder' => '{{val}}'], 'list' => array( 'pagelayer-btn-default' => __pl('btn_type_default'), 'pagelayer-btn-primary' => __pl('btn_type_primary'), 'pagelayer-btn-secondary' => __pl('btn_type_secondary'), 'pagelayer-btn-success' => __pl('btn_type_success'), 'pagelayer-btn-info' => __pl('btn_type_info'), 'pagelayer-btn-warning' => __pl('btn_type_warning'), 'pagelayer-btn-danger' => __pl('btn_type_danger'), 'pagelayer-btn-dark' => __pl('btn_type_dark'), 'pagelayer-btn-light' => __pl('btn_type_light'), 'pagelayer-btn-link' => __pl('btn_type_link'), 'pagelayer-btn-custom' => __pl('btn_type_custom') ), ), 'btn_size' => array( 'type' => 'select', 'label' => __pl('button_size_label'), 'default' => 'pagelayer-btn-large', 'list' => array( 'pagelayer-btn-mini' => __pl('mini'), 'pagelayer-btn-small' => __pl('small'), 'pagelayer-btn-large' => __pl('large'), 'pagelayer-btn-extra-large' => __pl('extra_large'), 'pagelayer-btn-double-large' => __pl('double_large'), 'pagelayer-btn-custom' => __pl('custom'), ) ), 'btn_custom_size' => array( 'type' => 'spinner', 'label' => __pl('btn_custom_size'), 'min' => 1, 'step' => 1, 'max' => 100, 'screen' => 1, 'default' => 5, 'css' => ['{{element}} .pagelayer-login-btn' => 'padding: calc({{val}}px / 2) {{val}}px;'], 'req' => array( 'btn_size' => 'pagelayer-btn-custom' ), ), 'btn_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => '', 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), 'req' => array( 'btn_type' => 'pagelayer-btn-custom', ), ), 'btn_bg_color' => array( 'type' => 'color', 'label' => __pl('btn_bg_color_label'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-login-btn' => 'background-color: {{val}};'], 'req' => array( 'btn_type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => '' ), ), 'btn_color' => array( 'type' => 'color', 'label' => __pl('btn_color_label'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-login-btn' => 'color: {{val}};'], 'req' => array( 'btn_type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => '' ), ), 'btn_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('btn_hover_delay_label'), 'desc' => __pl('btn_hover_delay_desc'), 'min' => 0, 'step' => 100, 'max' => 5000, 'default' => 400, 'css' => ['{{element}} .pagelayer-login-btn' => '-webkit-transition: all {{val}}ms !important; transition: all {{val}}ms !important;'], 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('btn_bg_color_hover_label'), 'default' => '', 'css' => ['{{element}} .pagelayer-login-btn:hover' => 'background-color: {{val}};'], 'req' => array( 'btn_type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_color_hover' => array( 'type' => 'color', 'label' => __pl('btn_color_hover_label'), 'default' => '', 'css' => ['{{element}} .pagelayer-login-btn:hover' => 'color: {{val}};'], 'req' => array( 'btn_type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_bor_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => '', //'no_val' => 1,// Dont set any value to element 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ) ), 'btn_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-login-btn' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_color' => array( 'type' => 'color', 'label' => __pl('border_color_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-login-btn' => 'border-color: {{val}};'], 'req' => array( '!btn_border_type' => '' ), 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-login-btn' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!btn_border_type' => '' ], 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-login-btn' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!btn_border_type' => '' ), 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-login-btn:hover' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'btn_bor_hover' => 'hover' ), ), 'btn_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color_hover_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-login-btn:hover' => 'border-color: {{val}};'], 'req' => array( '!btn_border_type_hover' => '' ), 'show' => array( 'btn_bor_hover' => 'hover' ), ), 'btn_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width_hover'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-login-btn:hover' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!btn_border_type_hover' => '' ], 'show' => array( 'btn_bor_hover' => 'hover' ), ), 'btn_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius_hover'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-login-btn:hover' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!btn_border_type_hover' => '' ), 'show' => array( 'btn_bor_hover' => 'hover' ), ), ), 'styles' => [ 'form_style' => __pl('Form'), 'label_style' => __pl('Label'), 'fields_style' => __pl('Fields'), 'buttons_style' => __pl('Button'), ] ) ); // SiteMap pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_sitemap', array( 'name' => __pl('sitemap'), 'group' => 'other', 'has_group' => [ 'section' => 'params', 'prop' => 'elements' ], 'holder' => '.pagelayer-sitemap-div-holder', 'html' => '<div class="pagelayer-sitemap-div pagelayer-sitemap-holder"> <div class="pagelayer-sitemap-div-holder pagelayer-sitemap-flex-wrapper"> </div> </div>', 'params' => array( 'elements' => array( 'type' => 'group', 'label' => __pl('Label'), 'sc' => PAGELAYER_SC_PREFIX.'_sitemap_item', 'item_label' => array( 'default' => __pl('Label'), 'param' => 'title' ), 'count' => 1, 'text' => strtr(__pl('add_new_item'), array('%name%' => __pl('sitemap_item'))), ), 'columns' => array( 'type' => 'select', 'label' => __pl('columns'), 'default' => '2', 'list' => array( '1' => __pl('1'), '2' => __pl('2'), '3' => __pl('3'), '4' => __pl('4'), '5' => __pl('5'), '6' => __pl('6'), ), 'css' => [ '{{element}} .pagelayer-sitemap-div-holder > *' => 'flex-basis: calc( 1 / {{val}} * 100% );' ], ), 'nofollow' => array( 'type' => 'checkbox', 'label' => __pl('nofollow'), 'default' => '', 'addAttr' => ['{{element}} .pagelayer-sitemap-list-item a' => 'rel="nofollow"', '{{element}} .pagelayer-sitemap-div-holder' => 'data-nofollow="true"'], ), ), 'additional_opt' => [ 'protected' => array( 'type' => 'checkbox', 'label' => __pl('protected_post'), 'default' => '', ), ], 'list_styles' => [ 'indent' => array( 'type' => 'slider', 'label' => __pl('indent'), 'default' => 0, 'min' => 0, 'max' => 100, 'css' => ['{{element}} .pagelayer-sitemap-section li' => 'margin-left: {{val}}px'], ), 'padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-sitemap-section' => 'padding-top: {{val[0]}}px; padding-right: {{val[1]}}px; padding-bottom: {{val[2]}}px; padding-left: {{val[3]}}px'], ), 'title_color' => array( 'type' => 'color', 'label' => __pl('title_color'), 'css' => ['{{element}} .pagelayer-sitemap-section span' => 'color: {{val}}'], ), 'title_typography' => array( 'type' => 'typography', 'label' => __pl('title_typography'), 'css' => ['{{element}} .pagelayer-sitemap-section span' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'list_color' => array( 'type' => 'color', 'label' => __pl('list_color'), 'css' => ['{{element}} .pagelayer-sitemap-section li' => 'color: {{val}}', '{{element}} .pagelayer-sitemap-section a' => 'color: {{val}}'], ), 'list_typography' => array( 'type' => 'typography', 'label' => __pl('list_typography'), 'css' => ['{{element}} .pagelayer-sitemap-section li, {{element}} .pagelayer-sitemap-section a' =>'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'list_type' => array( 'type' => 'radio', 'label' => __pl('list_type'), 'default' => 'disc', 'list' => array( 'disc' => __pl('sitemap_disc'), 'circle' => __pl('sitemap_circle'), 'square' => __pl('sitemap_square'), 'none' => __pl('sitemap_none') ), 'css' => ['{{element}} .pagelayer-sitemap-section li' => 'list-style-type: {{val}}'], ), ], 'styles' => [ 'additional_opt' => __pl('additional_option'), 'list_styles' => __pl('list_option'), ] ) ); // SiteMap Builder pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_sitemap_item', array( 'name' => __pl('sitemap_item'), 'group' => 'other', 'not_visible' => 1, 'parent' => [PAGELAYER_SC_PREFIX.'_sitemap'], 'html' => '{{sitemap_html}}', 'params' => array( 'sitemap_type' => array( 'type' => 'select', 'label' => __pl('type'), 'default' => 'post_type', 'list' => array( 'post_type' => __pl('post_type'), 'taxonomy' => __pl('taxonomy'), ) ), 'source_post' => array( 'type' => 'select', 'label' => __pl('source'), 'default' => 'page', 'list' => array( 'post' => __pl('Posts'), 'page' => __pl('Pages'), ), 'show' => array( 'sitemap_type' => 'post_type', ), ), 'source_taxonomy' => array( 'type' => 'select', 'label' => __pl('source'), 'default' => 'category', 'list' => array( 'category' => __pl('categories'), 'post_tag' => __pl('tags'), 'post_format' => __pl('format'), ), 'show' => array( 'sitemap_type' => 'taxonomy' ), ), 'title' => array( 'type' => 'text', 'label' => __pl('title'), 'default' => '', ), 'order_post' => array( 'type' => 'select', 'label' => __pl('order_by'), 'default' => 'random', 'list' => array( 'post_date' => __pl('date'), 'post_title' => __pl('title'), 'menu_order' => __pl('menu_order'), 'rand' => __pl('random'), ), 'show' => array( 'sitemap_type' => 'post_type', ), ), 'order_taxonomy' => array( 'type' => 'select', 'label' => __pl('order_by'), 'default' => 'name', 'list' => array( 'ID' => __pl('id'), 'name' => __pl('name'), ), 'show' => array( 'sitemap_type' => 'taxonomy' ), ), 'order' => array( 'type' => 'select', 'label' => __pl('order'), 'default' => 'DESC', 'list' => array( 'ASC' => __pl('asc'), 'DESC' => __pl('desc'), ) ), 'hide_empty' => array( 'type' => 'checkbox', 'label' => __pl('hide_empty'), 'default' => true, 'show' => array( 'sitemap_type' => 'taxonomy' ), ), 'hierarchical' => array( 'type' => 'checkbox', 'label' => __pl('hierarchical_view'), 'default' => '', ), 'depth' => array( 'type' => 'select', 'label' => __pl('depth'), 'list' => array( '0' => __pl('all'), '1' => __pl('1'), '2' => __pl('2'), '3' => __pl('3'), '4' => __pl('4'), '5' => __pl('5'), '6' => __pl('6'), ), 'show' => array( 'hierarchical' => 'true' ), ), ), ) ); // Search Form pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_search', array( 'name' => __pl('search_form'), 'group' => 'other', 'html' => '<div class="pagelayer-search-container pagelayer-search-{{type}}"> <button class="pagelayer-search-toggle pagelayer-search-button"> <span if="{{button_text}}" class="pagelayer-search-submit-label">{{button_text}}</span> <i if="{{button_icon}}" class="pagelayer-search-submit-icon {{button_icon}}"></i> </button> <form role="search" method="get" class="pagelayer-searchform" action="'.esc_url( home_url( '/' ) ).'"> <div class="pagelayer-search-fields"> <input class="pagelayer-search-input" type="text" value="" name="s" placeholder="{{{placeholder}}}" /> <input type="hidden" if="{{post_type}}" value="{{post_type}}" name="post_type"/> <button type="submit" class="pagelayer-search-submit pagelayer-search-button"> <span if="{{button_text}}" class="pagelayer-search-submit-label">{{button_text}}</span> <i if="{{button_icon}}" class="pagelayer-search-submit-icon {{button_icon}}"></i> </button> </div> </form> </div>', 'params' => array( 'post_type' => array( 'type' => 'select', 'label' => __pl('posts_grid_post_type_label'), 'desc' => __pl('posts_grid_post_type_desc'), 'list' => array_merge(['' => __pl('All Post Types')], pagelayer_post_types(true)) ), 'type' => array( 'type' => 'select', 'label' => __pl('form_type'), 'default' => 'classic', 'list' => array( 'classic' => __pl('classic'), 'full-screen' => __pl('full_screen'), ), ), 'placeholder' => array( 'type' => 'text', 'label' => __pl('placeholder'), 'default' => __pl('search'), ), 'button_type' => array( 'type' => 'radio', 'label' => __pl('button_type'), 'default' => 'icon', 'list' => array( 'icon' => __pl('list_icon_label'), 'text' => __pl('text'), ), ), 'button_icon' => array( 'type' => 'icon', 'label' => __pl('button_icon'), 'default' => 'fas fa-search', 'req' => ['button_type' => 'icon'] ), 'button_text' => array( 'type' => 'text', 'label' => __pl('button_text'), 'default' => __pl('search'), 'req' => ['button_type' => 'text'] ), 'field-width' => array( 'type' => 'slider', 'label' => __pl('width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-search-fields' => 'max-width:{{val}}%;'], 'req' => ['type' => 'classic'], ), 'size' => array( 'type' => 'slider', 'label' => __pl('min_height'), 'default' => 40, 'screen' => 1, 'css' => ['{{element}} .pagelayer-search-fields, {{element}} .pagelayer-search-full-screen input' => 'min-height:{{val}}px;', '{{element}} .pagelayer-search-fields input' => 'padding-left: calc({{val}}px / 3);padding-right: calc({{val}}px / 3);', '{{element}} .pagelayer-search-fields button' => 'padding-left: calc({{val}}px / 3)'], ), 'field_align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'center', 'screen' => 1, 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'css' => ['{{element}} .pagelayer-search-fields' => 'margin:auto;margin-{{val}}:0;'], 'req' => ['type' => 'classic'], ), 'toggle_align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'left', 'screen' => 1, 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'css' => ['{{element}} .pagelayer-search-container' => 'text-align:{{val}};'], 'req' => ['type' => 'full-screen'], ), 'holder_border_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} .pagelayer-search-full-screen .pagelayer-search-fields' => 'background-color: {{val}};'], 'req' => ['type' => 'full-screen'], ), 'holder_border_type' => array( 'type' => 'select', 'label' => __pl('border_styles'), 'default' => 'solid', 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'css' => ['{{element}} .pagelayer-search-fields' =>'border-style: {{val}};'], ), 'holder_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-search-fields' => 'border-color: {{val}};'], 'req' => ['!holder_border_type' => ''] ), 'holder_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'default' => '1,1,1,1', 'screen' => 1, 'css' => ['{{element}} .pagelayer-search-fields' =>'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px;'], 'req' => ['!holder_border_type' => ''] ), 'holder_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-search-fields' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => ['!holder_border_type' => ''] ), 'holder_shadow' => array( 'type' => 'box_shadow', 'label' => __pl('shadow'), 'css' => ['{{element}} .pagelayer-search-fields' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}};'], ), ), 'input_style' => array( 'input_colors' => array( 'type' => 'radio', 'label' => '', 'default' => '', 'list' => array( 'normal' => __pl('normal'), 'focus' => __pl('focus'), ), ), 'input_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-search-input' => 'color:{{val}}'], 'show' => ['input_colors' => 'normal'], ), 'input_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} .pagelayer-search-input' => 'background-color:{{val}}'], 'show' => ['input_colors' => 'normal'], ), 'input_hover_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-search-input:focus' => 'color:{{val}}'], 'show' => ['input_colors' => 'focus'], ), 'input_bg_hover_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} .pagelayer-search-input:focus' => 'background-color:{{val}}'], 'show' => ['input_colors' => 'focus'], ), 'input_size' => array( 'type' => 'slider', 'label' => __pl('font_size'), 'css' => ['{{element}} .pagelayer-search-input' => 'font-size:{{val}}px'], ), 'input_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-search-input' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'input_width' => array( 'type' => 'slider', 'label' => __pl('width'), 'default' => 100, 'max' => 100, 'screen' => 1, 'css' => ['{{element}} .pagelayer-search-input' => 'width:{{val}}%'], ), 'input_border_type' => array( 'type' => 'select', 'label' => __pl('border_styles'), 'css' => ['{{element}} .pagelayer-search-input' =>'border-style: {{val}};'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'input_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-search-input' => 'border-color: {{val}};'], 'req' => ['!input_border_type' => ''] ), 'input_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'default' => '0,0,0,0', 'css' => ['{{element}} .pagelayer-search-input' =>'border-width: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px !important;'], 'req' => ['!input_border_type' => ''] ), 'input_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'css' => ['{{element}} .pagelayer-search-input' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => ['!input_border_type' => ''] ), ), 'button_style' => array( 'button_colors' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => 'normal', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'button_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-search-button' => 'color:{{val}}'], 'show' => ['button_colors' => 'normal'], ), 'button_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} .pagelayer-search-button' => 'background-color:{{val}}'], 'show' => ['button_colors' => 'normal'], ), 'button_hover_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-search-button:hover' => 'color:{{val}}'], 'show' => ['button_colors' => 'hover'], ), 'button_bg_hover_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} .pagelayer-search-button:hover' => 'background-color:{{val}}'], 'show' => ['button_colors' => 'hover'], ), 'button_position' => array( 'type' => 'radio', 'label' => __pl('position'), 'screen' => 1, 'default' => 'row', 'list' => array( 'row-reverse' => __pl('left'), 'row' => __pl('right'), ), 'css' => ['{{element}} .pagelayer-search-fields' => 'flex-direction:{{val}}'], 'req' => ['type' => 'classic'], ), 'button_size' => array( 'type' => 'slider', 'label' => __pl('font_size'), 'units' => ['px', 'em'], 'screen' => 1, 'css' => ['{{element}} .pagelayer-search-submit-label' => 'font-size:{{val}}', '{{element}} .pagelayer-search-submit-icon' => 'font-size:{{val}}'], ), 'button_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-search-button' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => ['button_type' => 'text'] ), 'button_width' => array( 'type' => 'slider', 'label' => __pl('width'), 'units' => ['px', '%'], 'screen' => 1, 'css' => ['{{element}} .pagelayer-search-button' => 'min-width:{{val}}'], ), 'button_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'units' => ['px', 'em','%'], 'screen' => 1, 'css' => ['{{element}} .pagelayer-search-button' => 'padding:{{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}'], ), 'submit_border_type' => array( 'type' => 'select', 'label' => __pl('border_styles'), 'css' => ['{{element}} .pagelayer-search-submit' =>'border-style: {{val}};'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'submit_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-search-submit' => 'border-color: {{val}};'], 'req' => ['!submit_border_type' => ''] ), 'submit_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'default' => '0,0,0,0', 'css' => ['{{element}} .pagelayer-search-submit' =>'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px;'], 'req' => ['!submit_border_type' => ''] ), 'button_radius' => array( 'type' => 'slider', 'label' => __pl('border_radius'), 'max' => 100, 'units' => ['px', '%'], 'screen' => 1, 'css' => ['{{element}} .pagelayer-search-button' => 'border-radius:{{val}} !important'], ), ), 'styles' => [ 'input_style' => __pl('input_style'), 'button_style' => __pl('button_style'), ] ) ); //FACEBOOK buttons pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_fb_btn', array( 'name' => __pl('Facebook Button'), 'group' => 'other', 'html' => '<div class="pagelayer-fb-btn-container" pagelayer-facebook-load="1"> <span class="pagelayer-app-details" pagelayer-app-id="{{fb-app-id}}"></span> <div id="fb-root"></div> <div if="{{link_type}}" class="fb-like pagelayer-fb-btn-details" id="fb-like-btn" data-href="{{custom-url}}" data-layout="{{layout}}" data-action="{{btn_action}}" data-show-faces="{{peoples_faces}}" data-size="{{btn_size}}" data-share="{{share_btn}}"> </div> </div>', 'params' => array( 'fb-app-id' => array( 'type' => 'text', 'label' => __pl('app_id'), 'default' => get_option('pagelayer-fbapp-id'), ), 'link_type' => array( 'type' => 'select', 'label' => __pl('post_link_type'), 'default' => 'current', 'list' => array( 'current' => __pl('current_url'), 'custom_link' => __pl('custom_url') ), ), 'custom-url' => array( 'type' => 'text', 'label' => __pl('page_url'), 'default' => 'https://www.facebook.com/', 'req' => array( 'link_type' => 'custom_link', ) ), 'share_btn' => array( 'type' => 'checkbox', 'label' => __pl('share_btn'), ), 'peoples_faces' => array( 'type' => 'checkbox', 'label' => __pl('liked_faces'), ), 'layout' => array( 'type' => 'select', 'label' => __pl('layout_type'), 'default' => 'standard', 'list' => array( 'standard' => __pl('standard'), 'box_count' => __pl('box_count'), 'button_count' => __pl('button_count'), 'button' => __pl('button'), ), ), 'btn_action' => array( 'type' => 'select', 'label' => __pl('btn_action'), 'default' => 'Like', 'list' => array( 'like' => __pl('like'), 'recommend' => __pl('recommend'), ), ), 'btn_size' => array( 'type' => 'select', 'label' => __pl('btn_size'), 'default' => 'small', 'list' => array( 'small' => __pl('small'), 'large' => __pl('large'), ), ), ), ) ); //FACEBOOK embed pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_fb_embed', array( 'name' => __pl('Facebook Embed'), 'group' => 'other', 'html' => '<div class="pagelayer-fb-embed-container" pagelayer-facebook-load="1"> <span class="pagelayer-app-details" pagelayer-app-id={{fb-app-id}}></span> <div id="fb-root"></div> <div if={{embed_type}} class="fb-embed fb-{{embed_type}}" data-href={{post-url}} data-show-text={{post_text}} data-width=500 data-adapt-container-width="true" data-allowfullscreen={{fullscreen_video}} data-autoplay={{autoplay_video}} data-show-captions={{video_captions}} data-include-parent={{parent_comments}}> </div> </div>', 'params' => array( 'fb-app-id' => array( 'type' => 'text', 'label' => __pl('app_id'), 'default' => get_option('pagelayer-fbapp-id'), ), 'embed_type' => array( 'type' => 'select', 'label' => __pl('embed_type'), 'default' => 'post', 'list' => array( 'post' => __pl('post'), 'video' => __pl('video'), 'comment-embed' => __pl('comment'), ), ), 'post-url' => array( 'type' => 'text', 'label' => __pl('post-url'), 'addAttr' => ['{{element}} .fb-post' => 'data-href="{{post-url}}"'], 'default' => 'https://www.facebook.com/pagelayer/posts/528135551039110', 'req' => array( 'embed_type' => 'post', ), ), 'video-url' => array( 'type' => 'text', 'label' => __pl('video-url'), 'addAttr' => ['{{element}} .fb-video' => 'data-href="{{video-url}}"'], 'default' => 'https://www.facebook.com/seekahost/videos/1027688264058449/', 'req' => array( 'embed_type' => 'video', ), ), 'comment-url' => array( 'type' => 'text', 'label' => __pl('comment-url'), 'addAttr' => ['{{element}} .fb-comment' => 'data-href="{{comment-url}}"'], 'default' => 'https://www.facebook.com/sitepad/posts/751812071877561?comment_id=830006664058101&reply_comment_id=831580997234001&comment_tracking=%7B%22tn%22%3A%22R%22%7D', 'req' => array( 'embed_type' => 'comment-embed', ), ), 'post_text' => array( 'type' => 'checkbox', 'label' => __pl('full_post'), 'req' => array( '!embed_type' => 'comment-embed', ), ), 'autoplay_video' => array( 'type' => 'checkbox', 'label' => __pl('autoplay'), 'req' => array( 'embed_type' => 'video', ), ), 'fullscreen_video' => array( 'type' => 'checkbox', 'label' => __pl('full_screen'), 'req' => array( 'embed_type' => 'video', ), ), 'video_captions' => array( 'type' => 'checkbox', 'label' => __pl('captions'), 'req' => array( 'embed_type' => 'video', ), ), 'parent_comments' => array( 'type' => 'checkbox', 'label' => __pl('parent_comments'), 'default' => 'true', 'req' => array( 'embed_type' => 'comment-embed', ), ), ), ) ); //FACEBOOK comments pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_fb_comments', array( 'name' => __pl('Facebook Comments'), 'group' => 'other', 'html' => '<div class="pagelayer-fb-comments-container" pagelayer-facebook-load="1"> <span class="pagelayer-app-details" pagelayer-app-id={{fb-app-id}}></span> <div id="fb-root"></div> <div class="fb-comments" data-href="{{custom-url}}" data-colorscheme="{{color_scheme}}" data-numposts="{{number-of-comments}}" data-order-by="{{comments_order}}"> </div> </div>', 'params' => array( 'fb-app-id' => array( 'type' => 'text', 'label' => __pl('app_id'), 'default' => get_option('pagelayer-fbapp-id'), ), 'link_type' => array( 'type' => 'select', 'label' => __pl('post_link_type'), 'default' => 'current', 'list' => array( 'current' => __pl('current_url'), 'custom_link' => __pl('custom_url') ), ), 'custom-url' => array( 'type' => 'text', 'label' => __pl('page_url'), 'default' => 'https://www.facebook.com/pagelayer', 'req' => array( 'link_type' => 'custom_link', ) ), 'color_scheme' => array( 'type' => 'select', 'label' => __pl('color_scheme'), 'default' => 'light', 'list' => array( 'light' => __pl('Light'), 'dark' => __pl('Dark'), ), ), 'number-of-comments' => array( 'type' => 'slider', 'label' => __pl('comments_count'), 'min' => '1', 'max' => '100', 'default' => '10', ), 'comments_order' => array( 'type' => 'select', 'label' => __pl('comments_order'), 'default' => '', 'list' => array( 'social' => __pl('social'), 'reverse_time' => __pl('reverse_time'), 'time' => __pl('time'), ), ), ), ) ); //FACEBOOK page pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_fb_page', array( 'name' => __pl('Facebook Page'), 'group' => 'other', 'html' => '<div class="pagelayer-fb-page-container" pagelayer-facebook-load="1"> <span class="pagelayer-app-details" pagelayer-app-id={{fb-app-id}}></span> <div id="fb-root"></div> <div if={{page_url}} class="fb-page" data-href={{page_url}} data-width="500" data-hide-cta={{cta-button}} data-tabs={{tabs_types}} data-small-header={{small_header}} data-adapt-container-width="true" data-hide-cover={{hide_cover}} data-show-facepile={{show_friends_faces}}> </div> </div>', 'params' => array( 'fb-app-id' => array( 'type' => 'text', 'label' => __pl('app_id'), 'default' => get_option('pagelayer-fbapp-id'), ), 'page_url' => array( 'type' => 'text', 'label' => __pl('page_link'), 'default' => 'https://www.facebook.com/pagelayer', ), 'tabs_types' => array( 'type' => 'multiselect', 'label' => __pl('tabs'), 'default' => 'timeline', 'list' => array( 'timeline' => __pl('timeline'), 'events' => __pl('events'), 'messages' => __pl('messages') ), ), 'height' => array( 'type' => 'spinner', 'label' => __pl('page_height'), 'default' => 500, 'min' => 70, 'max' => 1000, 'step' => 10, 'addAttr' => ['{{element}} .pagelayer-fb-page-container .fb-page' => 'data-height="{{height}}"'], ), 'small_header' => array( 'type' => 'checkbox', 'label' => __pl('small_header'), ), 'hide_cover' => array( 'type' => 'checkbox', 'label' => __pl('hide_cover'), ), 'show_friends_faces' => array( 'type' => 'checkbox', 'label' => __pl('liked_faces'), 'default' => "true", ), 'cta-button' => array( 'type' => 'checkbox', 'label' => __pl('cta_button'), 'default' => "true", ), ), ) ); // Review Item pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_review', array( 'name' => __pl('review'), 'group' => 'button', 'not_visible' => 1, 'parent' => [PAGELAYER_SC_PREFIX.'_review_slider'], 'html' => '<div class="pagelayer-review-slide"> <div class="pagelayer-review-author"> <div if={{author_image}} class="pagelayer-review-author-img"> <img class="pagelayer-img" title="{{{author_image-title}}}" alt="{{{author_image-alt}}}"/> </div> <div class="pagelayer-review-author-details"> <div if={{author_name}} class="pagelayer-review-author-name">{{author_name}}</div> <div if={{author_title}} class="pagelayer-review-author-title">{{author_title}}</div> <div if={{number_of_ratings}} class="pagelayer-stars-container" title="{{number_of_ratings}}/5" pagelayer-stars-value="{{number_of_ratings}}" pagelayer-stars-count="5"> </div> </div> <div class="pagelayer-icon-holder pagelayer-{{icon}}-icon"> <a if-ext="{{icon_url}}" class="pagelayer-ele-link pagelayer-review-icon-link" href="{{{icon_url}}}"> <i class="pagelayer-social-fa {{icon}} {{bg_shape}} {{icon_size}} pagelayer-animation-{{anim_hover}}"></i> </a> </div> </div> <hr> <div class="pagelayer-review-text"> <p if={{review_text}} class="pagelayer-review-p">{{review_text}}</p> </div> </div>', 'params' => array( 'author_name' => array( 'type' => 'text', 'label' => __pl('author_Name'), 'default' => 'Jane Doe', 'edit' => '.pagelayer-review-author-name', ), 'author_title' => array( 'type' => 'text', 'label' => __pl('author_title'), 'default' => '@janedoe', 'edit' => '.pagelayer-review-author-title', ), 'show_avatar' => array( 'type' => 'checkbox', 'label' => __pl('show_avatar'), ), 'author_image' => array( 'type' => 'image', 'label' => __pl('avatar_style'), 'addAttr' => ['{{element}} .pagelayer-review-author-img img' => 'src="{{{author_image-url}}}"'], 'req' => ['show_avatar' => 'true'], 'ai' => false, ), 'number_of_ratings' => array( 'type' => 'spinner', 'label' => __pl('author_rating'), 'min' => '0', 'max' => '5', 'step' => '.1', ), 'icon_url' => array( 'type' => 'link', 'label' => __pl('author_url'), 'selector' => '.pagelayer-review-icon-link', ), 'icon' => array( 'type' => 'icon', 'label' => __pl('author_Icon'), 'default' => 'fab fa-facebook', 'list' => ['facebook', 'facebook-official', 'facebook-square', 'twitter', 'twitter-square', 'x-twitter', 'x-twitter-square', 'google-plus', 'google-plus-square', 'instagram', 'linkedin', 'linkedin-square', 'behance', 'behance-square', 'pinterest', 'pinterest-p', 'pinterest-square', 'reddit-alien', 'reddit-square', 'reddit', 'rss', 'rss-square', 'skype', 'slideshare', 'snapchat', 'snapchat-ghost', 'snapchat-square', 'soundcloud', 'spotify', 'stack-overflow', 'steam', 'steam-square', 'stumbleupon', 'telegram', 'thumb-tack', 'tripadvisor', 'tumblr', 'tumblr-square', 'twitch', 'vimeo', 'vimeo-square', 'vk', 'weibo', 'weixin', 'whatsapp', 'wordpress', 'xing', 'xing-square', 'yelp', 'youtube', 'youtube-square', 'youtube-play', '500px', 'flickr', 'android', 'github', 'github-square', 'gitlab', 'apple', 'jsfiddle', 'houzz', 'bitbucket', 'bitbucket-square', 'codepen', 'delicious', 'medium', 'meetup', 'mixcloud', 'dribbble', 'foursquare'], ), 'review_text' => array( 'type' => 'textarea', 'label' => __pl('review'), 'default' => '"There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which look even slightly believable."', 'edit' => '.pagelayer-review-p', 'e' => [ 'v', 'f', 'c', 'r'], ), ) ) ); // Reviews Slider pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_review_slider', array( 'name' => __pl('reviews'), 'group' => 'other', 'prevent_inside' => ['pl_slides'], 'holder' => '.pagelayer-reviews-holder', 'child_selector' => '>.pagelayer-owl-stage-outer>.pagelayer-owl-stage>.pagelayer-owl-item', // Make it very specifc 'html' => '<div class="pagelayer-review-slides-container"> <div class="pagelayer-reviews-holder pagelayer-owl-holder pagelayer-owl-carousel pagelayer-owl-theme"></div> </div>', 'has_group' => [ 'section' => 'params', 'prop' => 'elements' ], 'params' => array( 'elements' => array( 'type' => 'group', 'label' => __pl('review'), 'sc' => PAGELAYER_SC_PREFIX.'_review', 'item_label' => array( 'default' => __pl('review'), 'param' => 'author_name', ), 'count' => 3, 'text' => strtr(__pl('add_new_item'), array('%name%' => __pl('review'))), ), 'width' => array( 'type' => 'slider', 'label' => __pl('width'), 'default' => 100, 'min' => 30, 'max' => 100, 'screen' => 1, 'css' => ['{{element}} .pagelayer-reviews-holder' => 'width:{{val}}%;'] ), ), 'author_style' => array( 'author_name_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#000000', 'css' => ['{{element}} .pagelayer-review-author-name' => 'color:{{val}} !important;'], ), 'author_name' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',16,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-review-author-name' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ), 'title_style' => array( 'author_title_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#000000', 'css' => ['{{element}} .pagelayer-review-author-title' => 'color:{{val}} !important;'], ), 'author_title' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',14,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-review-author-title' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ), 'review_style' => array( 'review_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#000000', 'css' => ['{{element}} .pagelayer-review-text p' => 'color: {{val}} !important;'], ), 'review_typography' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',18,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-review-text p' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ), 'icon_style' => array( 'icon_color' => array( 'type' => 'color', 'label' => __pl('icon_color'), 'css' => ['{{element}} .pagelayer-social-fa' => 'color: {{val}};'] ), 'icon_size_custom' => array( 'type' => 'spinner', 'label' => __pl('service_box_icon_custom_size_label'), 'min' => 1, 'step' => 1, 'max' => 100, 'default' => 20, 'screen' => 1, 'css' => ['{{element}} .pagelayer-social-fa' => 'font-size: {{val}}px'] ) ), 'seperator_style' => array( 'seperator_width' => array( 'type' => 'slider', 'label' => __pl('seperator_width'), 'default' => 1, 'min' => 0, 'max' => 20, 'screen' => 1, 'css' => ['{{element}} .pagelayer-review-slide hr' => 'border-top:{{val}}px solid;'], ), 'seperator_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#c5c5c5', 'css' => ['{{element}} .pagelayer-review-slide hr' => 'border-top-color:{{val}};'], ), ), 'stars_style' => array( 'stars_color' => array( 'type' => 'color', 'label' => __pl('stars_color'), 'default' => '#FFEB3B', 'css' => ['{{element}} .pagelayer-stars-icon:before' => 'color: {{val}}'], ), 'unmarked_stars_color' => array( 'type' => 'color', 'label' => __pl('unmarked_star_color'), 'default' => '#ccd6df', 'css' => ['{{element}} .pagelayer-stars-container' => 'color: {{val}}'], ), 'stars_font_size' => array( 'label' => __pl('stars_font_size'), 'type' => 'slider', 'min' => 5, 'max' => 100, 'default' => 20, 'screen' => 1, 'css' => ['{{element}} .pagelayer-stars-container' => 'font-size:{{val}}px;'], ), 'stars_spacing' => array( 'label' => __pl('stars_spacing'), 'type' => 'slider', 'min' => 0, 'max' => 20, 'default' => 2, 'screen' => 1, 'css' => ['{{element}} .pagelayer-stars-icon:not(:first-child)' => 'margin-left:{{val}}px;'], ), ), 'avatar_style' => array( 'author_image_width' => array( 'type' => 'slider', 'label' => __pl('rw_image_width'), 'min' => 50, 'max' => 120, 'default' => 70, 'screen' => 1, 'css' => ['{{element}} .pagelayer-review-author-img img' => 'width:{{val}}px !important; height: {{val}}px !important;'], ), 'author_image_radius' => array( 'type' => 'slider', 'label' => __pl('border_radius'), 'max' => 100, 'default' => 0, 'screen' => 1, 'css' => ['{{element}} .pagelayer-review-author-img img' => 'border-radius:{{val}}px !important;'], ), ), 'slide_style' => array( 'background-color' => array( 'type' => 'color', 'label' => __pl('background_color'), 'css' => ['{{element}} .pagelayer-review-slide' =>'background-color: {{val}};'] ), 'slide_border_hover' => array( 'type' => 'radio', 'label' => __pl('border_state'), 'default' => '', 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'slide_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-review-slide' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'slide_border_hover' => '' ), ), 'slide_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['{{element}} .pagelayer-review-slide' => 'border-color: {{val}}!important;'], 'req' => array( '!slide_border_type' => '' ), 'show' => array( 'slide_border_hover' => '' ), ), 'slide_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-review-slide' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!slide_border_type' => '' ], 'show' => array( 'slide_border_hover' => '' ), ), 'slide_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-review-slide' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!slide_border_type' => '' ), 'show' => array( 'slide_border_hover' => '' ), ), 'slide_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-review-slide:hover' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'slide_border_hover' => 'hover' ), ), 'slide_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['{{element}} .pagelayer-review-slide:hover' => 'border-color: {{val}} !important;'], 'default' => '#0986c0', 'req' => array( '!slide_border_type_hover' => '' ), 'show' => array( 'slide_border_hover' => 'hover' ), ), 'slide_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-review-slide:hover' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!slide_border_type_hover' => '' ], 'show' => array( 'slide_border_hover' => 'hover' ), ), 'slide_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-review-slide:hover' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!slide_border_type_hover' => '' ), 'show' => array( 'slide_border_hover' => 'hover' ), ), 'slide_box_shadow' => array( 'type' => 'box_shadow', 'label' => __pl('shadow'), 'css' => ['{{element}} .pagelayer-review-slide' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}} !important;'], ), ), 'slider_options' => $pagelayer->slider_options, 'arrow_styles' => $pagelayer->slider_arrow_styles, 'pager_styles' => $pagelayer->slider_pager_styles, 'styles' => array( 'author_style' => __pl('author_style'), 'title_style' => __pl('title_style'), 'review_style' => __pl('review_style'), 'icon_style' => __pl('icon_style'), 'seperator_style' => __pl('seperator_style'), 'stars_style' => __pl('stars_style'), 'avatar_style' => __pl('avatar_style'), 'slide_style' => __pl('slide_style'), 'slider_options' => __pl('slider_options'), 'arrow_styles' => __pl('arrow_styles'), 'pager_styles' => __pl('pager_styles'), ) ) ); // Template list pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_templates', array( 'name' => __pl('templates'), 'group' => 'other', 'no_gt' => 1, 'html' => '<div class="pagelayer-template-content">{{template_content}}</div>', 'params' => array( 'templates' => array( 'type' => 'select', 'label' => __pl('select_templates'), 'default' => '0', 'list' => ['0' => __pl('none')] + pagelayer_post_list_by_type('pagelayer-template'), ), ) ) ); // Posts Grid /* pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_wp_posts_grid', array( 'name' => __pl('Posts Grid'), 'group' => 'wordpress', 'html' => '<div class="pagelayer-wp-posts-grid-container"></div>', 'params' => array( 'query_type' => array( 'type' => 'radio', 'label' => __pl('posts_grid_query_type_label'), 'desc' => __pl('posts_grid_query_type_desc'), 'default' => 'simple', 'list' => array( 'simple' => __pl('simple'), 'custom' => __pl('posts_grid_custom_query_label'), 'ids' => __pl('ids'), ) ), 'post_type' => array( 'type' => 'select', 'label' => __pl('posts_grid_post_type_label'), 'desc' => __pl('posts_grid_post_type_desc'), 'list' => pagelayer_post_types(), 'req' => array( 'query_type' => 'simple' ) ), 'category' => array( 'type' => 'text', 'label' => __pl('posts_grid_category_label'), 'desc' => __pl('posts_grid_category_desc'), 'req' => array( 'post_type' => 'post' ) ), 'tag' => array( 'type' => 'text', 'label' => __pl('posts_grid_tag_label'), 'desc' => __pl('posts_grid_tag_desc'), 'req' => array( 'post_type' => 'post' ) ), 'custom_tax' => array( 'type' => 'text', 'label' => __pl('posts_grid_custom_tax_label'), 'req' => array( 'query_type' => 'simple' ) ), 'custom_tax_field' => array( 'type' => 'select', 'label' => __pl('posts_grid_custom_tax_field_label'), 'default' => 'slug', 'list' => array( 'term_id' => __pl('term_id'), 'slug' => __pl('slug'), 'name' => __pl('name') ), 'req' => array( 'query_type' => 'simple' ) ), 'custom_tax_terms' => array( 'type' => 'text', 'label' => __pl('posts_grid_custom_tax_term_label'), 'desc' => __pl('posts_grid_custom_tax_term_desc'), 'req' => array( 'query_type' => 'simple' ) ), 'posts_per_page' => array( 'type' => 'spinner', 'label' => __pl('posts_grid_posts_per_page_label'), 'default' => 4, // For backward compatibility in lite version must be 3 posts per page 'min' => 1, 'max' => 40, 'step' => 1, 'req' => array( 'query_type' => 'simple' ) ), 'posts_order' => array( 'type' => 'radio', 'label' => __pl('posts_grid_sort_order'), 'default' => 'DESC', 'list' => array( 'ASC' => __pl('posts_grid_sort_order_ascending'), 'DESC' => __pl('posts_grid_sort_order_descending') ), 'req' => array( 'query_type' => 'simple' ) ), 'custom_query' => array( 'type' => 'textarea', 'label' => __pl('posts_grid_custom_query_label'), 'desc' => __pl('posts_grid_custom_query_desc'), 'req' => array( 'query_type' => 'custom' ) ), 'ids' => array( 'type' => 'text', 'label' => __pl('posts_grid_ids_label'), 'desc' => __pl('posts_grid_ids_desc'), 'req' => array( 'query_type' => 'ids' ) ), 'columns' => array( 'type' => 'radio', 'label' => __pl('columns_count'), 'default' => 2, 'list' => array( 1 => 1, 2 => 2, 3 => 3, 4 => 4, 6 => 6 ) ), 'template' => array( 'type' => 'select', 'label' => __pl('posts_grid_template_label'), 'list' => array(), ), 'posts_gap' => array( 'type' => 'slider', 'label' => __pl('posts_grid_posts_gap_label'), 'default' => 30, 'min' => 0, 'max' => 100, 'step' => 10, ), 'show_featured_image' => array( 'type' => 'checkbox', 'label' => __pl('posts_grid_show_featured_image'), 'default' => 'true', ), 'image_size' => array( 'type' => 'radio', 'label' => __pl('obj_image_size_label'), 'default' => 'large', 'list' => array( 'full' => __pl('full'), 'large' => __pl('large'), 'medium' => __pl('medium'), 'thumbnail' => __pl('thumbnail'), 'custom' => __pl('custom') ), 'req' => array( 'show_featured_image' => 'true' ), ), 'image_custom_size' => array( 'type' => 'text', 'desc' => __pl('image_custom_size_label'), 'req' => array( 'image_size' => 'custom' ), ), 'title_tag' => array( 'type' => 'radio', 'label' => __pl('posts_grid_title_tag'), 'default' => 'h2', 'list' => array( 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'hide' => __pl('posts_grid_title_tag_none'), ) ), 'show_date_comments' => array( 'type' => 'checkbox', 'label' => __pl('posts_grid_show_date_comments'), 'default' => 'true', ), 'show_content' => array( 'type' => 'radio', 'label' => __pl('posts_grid_show_content'), 'default' => 'short', 'list' => array( 'short' => __pl('posts_grid_show_content_short'), 'full' => __pl('posts_grid_show_content_full'), 'excerpt' => __pl('posts_grid_show_content_excerpt'), 'hide' => __pl('posts_grid_show_content_none'), ) ), 'short_content_length' => array( 'type' => 'slider', 'label' => __pl('posts_grid_short_content_length'), 'default' => 200, 'min' => 0, 'max' => 1000, 'step' => 20, 'req' => array( 'show_content' => 'short' ), ), 'read_more_text' => array( 'type' => 'text', 'label' => __pl('posts_grid_read_more_text_label'), 'default' => __pl('posts_grid_read_more_text') ), 'display_style' => array( 'type' => 'radio', 'label' => __pl('posts_grid_display_style'), 'default' => 'show_all', 'list' => array( 'show_all' => __pl('show_all'), 'load_more' => __pl('posts_grid_display_style_load_more'), 'pagination' => __pl('posts_grid_display_style_pagination') ) ), 'load_more_text' => array( 'type' => 'text', 'label' => __pl('posts_grid_load_more_text_label'), 'default' => __pl('posts_grid_load_more_text_default'), // "Load More" 'req' => array( 'display_style' => 'load_more' ) ), 'filter' => array( 'type' => 'radio', 'label' => __pl('posts_grid_filter_label'), 'desc' => __pl('posts_grid_filter_desc'), 'default' => 'none', 'list' => array( 'none' => __pl('none'), 'cats' => __pl('posts_grid_filter_by_first_tax'), 'tags' => __pl('posts_grid_filter_by_second_tax'), 'both' => __pl('posts_grid_filter_by_both') ), 'req' => array( 'query_type' => 'simple' ) ), 'filter_tax_1' => array( 'type' => 'select', 'label' => __pl('posts_grid_filter_first_tax_name'), 'default' => 'category', 'list' => pagelayer_tax_list('category'), 'req' => array( 'filter' => array( 'cats', 'both' ) ) ), 'filter_tax_2' => array( 'type' => 'select', 'label' => __pl('posts_grid_filter_second_tax_name'), 'default' => 'post_tag', 'list' => pagelayer_tax_list('post_tag'), 'req' => array( 'filter' => array( 'tags', 'both' ) ) ), 'filter_btn_color' => array( 'type' => 'color', 'label' => __pl('button_color_label'), 'default' => '#333333', 'req' => array( '!filter' => 'none' ) ), 'filter_btn_divider' => array( 'type' => 'text', 'label' => __pl('filter_links_divider'), 'default' => '/', 'req' => array( 'filter_btn_color' => 'none' ) ), 'filter_cats_text' => array( 'type' => 'text', 'label' => __pl('posts_grid_filter_first_tax_text_label'), 'default' => __pl('categories') . ':', 'req' => array( 'filter' => array('cats', 'both') ) ), 'filter_tags_text' => array( 'type' => 'text', 'label' => __pl('posts_grid_filter_second_tax_text_label'), 'default' => __pl('tags') . ':', 'req' => array( 'filter' => array('tags', 'both') ) ), 'filter_all_text' => array( 'type' => 'text', 'label' => __pl('posts_grid_filter_view_all_text_label'), 'default' => __pl('all'), 'req' => array( '!filter' => 'none' ) ) ) ) ); */ // Posts Slider /* pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_wp_posts_slider', array( 'name' => __pl('Posts Slider'), 'group' => 'wordpress', 'html' => '<div class="pagelayer-posts-slider-container" slider-autoplay="{{slider_autoplay}}" count="{{items_to_display}}" post-slider-pause="{{pause_on_hover}}" bullets="{{show_bullets}}" controlbtn ="{{show_nav}}" hide-posts-title="{{post_title}}" hide-posts-image="{{posts_image}}" hide-posts-date="{{post_date}}" post-content="{{show_content}}" hide-post-link ="{{read_more}}"> <ul class="pagelayer-posts-slider-main"> {{posts_slides}} </ul> </div>', 'params' => array( 'post_count' => array( 'type' => 'spinner', 'label' => __pl('posts_count'), 'default' => 1, 'min' => 1, 'max' => 10, 'step' => 1 ), 'post_type' => array( 'type' => 'select', 'label' => __pl('post_types'), 'default' => 'post', 'list' => pagelayer_post_types(true), ), 'category' => array( 'type' => 'select', 'label' => __pl('categories'), 'list' => pagelayer_get_categories(), 'req' => array( 'post_type' => 'post' ), ), 'tags' => array( 'type' => 'select', 'label' => __pl('tags'), 'list' => pagelayer_get_tags(), 'req' => array( 'post_type' => 'post' ), ), 'order_by' => array( 'type' => 'select', 'label' => __pl('posts_order_by'), 'default' => 'date', 'list' => array( 'ID' => __pl('posts_order_by_id'), 'date' => __pl('posts_order_by_date'), 'author' => __pl('posts_order_by_author'), 'modified' => __pl('posts_order_by_modified'), 'rand' => __pl('posts_order_by_random'), 'comment_count' => __pl('posts_order_by_comment_count'), 'menu_order' => __pl('posts_order_by_menu_order'), ), ), 'sort_order' => array( 'type' => 'radio', 'label' => __pl('post_sort_order'), 'default' => 'DESC', 'list' => array( 'ASC' => __pl('sort_order_ascending'), 'DESC' => __pl('sort_order_descending'), ), ), 'show_excerpt' => array( 'type' => 'checkbox', 'label' => __pl('show_excerpt'), ), ), 'title_style' => [ 'post_title' => array( 'type' => 'checkbox', 'label' => __pl('hide_title'), ), 'title_color' => array( 'type' => 'color', 'label' => __pl('title_color'), 'default' => '#000000', 'css' => ['{{element}} .pagelayer-posts-slider-title' => 'color:{{val}}'], 'req' => array( 'post_title' => '', ), ), 'title_spacing' => array( 'type' => 'padding', 'label' => __pl('spacing'), 'css' => ['{{element}} .pagelayer-posts-slider-title' => 'margin:{{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( 'post_title' => '', ), ), 'post_title_style' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',20,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-posts-slider-title' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => array( 'post_title' => '', ), ), ], 'image_style' => [ 'posts_image' => array( 'type' => 'checkbox', 'label' => __pl('hide_image'), ), 'image_size' => array( 'type' => 'radio', 'label' => __pl('image_size'), 'default' => 'full', 'list' => array( 'full' => __pl('full'), 'thumbnail' => __pl('thumbnail'), 'custom' => __pl('custom') ), 'req' => array( 'posts_image' => '', ), ), 'img_height' => array( 'type' => 'slider', 'label' => __pl('img_height'), 'css' => ['{{element}} .pagelayer-posts-slider-img' => 'height: {{val}}em;'], 'default' => 10, 'min' => 10, 'max' => 20, 'step' => 0.2, 'req' => array( 'image_size' => 'custom', ), ), 'image_spacing' => array( 'type' => 'padding', 'label' => __pl('spacing'), 'css' => ['{{element}} .pagelayer-posts-slider-featured-img' => 'margin: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( 'posts_image' => '', ), ), ], 'content_style' => [ 'content_color' => array( 'type' => 'color', 'label' => __pl('content_color'), 'default' => '#000000', 'css' => ['{{element}} .pagelayer-posts-slider-excerpt' => 'color:{{val}}'], ), 'post_content_style' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',16,,300,,,solid,,,,', 'css' => ['{{element}} .pagelayer-posts-slider-excerpt ' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ], 'date_style' => [ 'post_date' => array( 'type' => 'checkbox', 'label' => __pl('hide_date'), ), 'date_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#000000', 'css' => ['{{element}} .pagelayer-post-slider-date p' => 'color:{{val}}'], 'req' => array( 'post_date' => '', ), ), 'post_date_style' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',14,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-post-slider-date p' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}}!important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing:{{val[10]}}px !important;'], 'req' => array( 'post_date' => '', ), ), ], 'post_style' => [ 'read_more' => array( 'type' => 'checkbox', 'label' => __pl('hide_link'), ), 'link_color' => array( 'type' => 'color', 'label' => __pl('link_color'), 'default' => '#e82121', 'css' => ['{{element}} .pagelayer-posts-slider-link' => 'color:{{val}}'], ), 'background_color' => array( 'type' => 'color', 'label' => __pl('background_color'), 'css' => ['{{element}} .pagelayer-posts-slider-post' => 'background-color:{{val}}'], ), 'link_style' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',16,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-posts-slider-link' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'post_shadow' => array( 'type' => 'box_shadow', 'label' => __pl('post_shadow'), 'css' => ['{{element}} .pagelayer-posts-slider-post' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}};'], ), 'post_border_hover' => array( 'type' => 'radio', 'label' => __pl('border_state'), 'default' => '', 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'post_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-posts-slider-post' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'post_border_hover' => '' ), ), 'post_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['{{element}} .pagelayer-posts-slider-post' => 'border-color: {{val}}!important;'], 'req' => array( '!post_border_type' => '' ), 'show' => array( 'post_border_hover' => '' ), ), 'post_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'css' => ['{{element}} .pagelayer-posts-slider-post' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!post_border_type' => '' ], 'show' => array( 'post_border_hover' => '' ), ), 'post_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'css' => ['{{element}} .pagelayer-posts-slider-post' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!post_border_type' => '' ), 'show' => array( 'post_border_hover' => '' ), ), 'post_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-posts-slider-post:hover' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'post_border_hover' => 'hover' ), ), 'post_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['{{element}} .pagelayer-posts-slider-post:hover' => 'border-color: {{val}} !important;'], 'default' => '#0986c0', 'req' => array( '!post_border_type_hover' => '' ), 'show' => array( 'post_border_hover' => 'hover' ), ), 'post_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'css' => ['{{element}} .pagelayer-posts-slider-post:hover' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!post_border_type_hover' => '' ], 'show' => array( 'post_border_hover' => 'hover' ), ), 'post_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'css' => ['{{element}} .pagelayer-posts-slider-post:hover' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!post_border_type_hover' => '' ), 'show' => array( 'post_border_hover' => 'hover' ), ), ], 'slider_options' => [ 'items_to_display' => array( 'type' => 'spinner', 'label' => __pl('slider_items_display'), 'default' => 1, 'min' => 1, 'max' => 10, 'step' => 1 ), 'slider_autoplay' => array( 'type' => 'checkbox', 'label' => __pl('autoplay'), 'default' => 'true', ), 'show_nav' => array( 'type' => 'checkbox', 'label' => __pl('slider_navigations'), 'default' => 'true', ), 'nav_arrow_color' => array( 'type' => 'color', 'label' => __pl('slider_arrows_color'), 'css' => ['{{element}} .pagelayer-prev-arrow:before' => 'color:{{val}} !important;', '{{element}} .pagelayer-next-arrow:before' => 'color:{{val}} !important;'], 'req' => array( 'show_nav' => 'true', ) ), 'show_bullets' => array( 'type' => 'checkbox', 'label' => __pl('bullets'), 'default' => 'true', ), 'pause_on_hover' => array( 'type' => 'checkbox', 'label' => __pl('slider_pause_on_hover'), ), ], 'styles' => [ 'title_style' => __pl('title_style'), 'image_style' => __pl('image_style'), 'content_style' => __pl('content_style'), 'date_style' => __pl('date_style'), 'post_style' => __pl('posts_style'), 'slider_options' => __pl('slider_options'), ], ) ); */ // Image Portfolio pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_img_portfolio', array( 'name' => __pl('img_portfolio'), 'group' => 'image', 'icon' => 'fas fa-briefcase', 'has_group' => [ 'section' => 'params', 'prop' => 'elements' ], //'child_selector' => '>.pagelayer-owl-stage-outer>.pagelayer-owl-stage>.pagelayer-owl-item', // Make it very specifc 'holder' => '.pagelayer-img_portfolio-holder', 'html' => '<div class="pagelayer-category-holder"></div> <div class="pagelayer-img_portfolio-holder"></div>', 'params' => array( 'elements' => array( 'type' => 'group', 'label' => __pl('image'), 'sc' => PAGELAYER_SC_PREFIX.'_single_img', 'item_label' => array( 'default' => __pl('image'), 'param' => 'title' ), 'count' => 1, 'text' => strtr(__pl('add_new_item'), array('%name%' => __pl('image'))) ) ), 'img_style' =>[ 'img_width' => array( 'type' => 'slider', 'label' => __pl('width'), 'screen' => 1, 'min' => 0, 'step' => 1, 'max' => 100, 'css' => ['{{element}} .pagelayer-img_portfolio-holder>div' => 'width: {{val}}%;'], ), 'img_spacing' => array( 'type' => 'padding', 'label' => __pl('space_around'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-single_img' => 'padding-top: {{val[0]}}px; padding-right: {{val[1]}}px; padding-bottom: {{val[2]}}px; padding-left: {{val[3]}}px'], ), 'img_height' => array( 'type' => 'spinner', 'label' => __pl('height'), 'screen' => 1, 'min' => 0, 'step' => 1, 'css' => ['{{element}} .pagelayer-img_portfolio-holder>div' => 'height: {{val}}px; overflow:hidden;'], ), 'img_stretch' => array( 'type' => 'checkbox', 'label' => __pl('stretch'), 'css' => [ '{{element}}, {{element}} .pagelayer-pf-img, {{element}} .pagelayer-pf-img img'=> 'height:100%; width:100%;' ], 'req' => ['!img_height' => ''] ), 'img_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'img_filter' => array( 'type' => 'filter', 'label' => __pl('filter'), 'css' => ['{{element}} .pagelayer-pf-img img' => 'filter: blur({{val[0]}}px) brightness({{val[1]}}%) contrast({{val[2]}}%) grayscale({{val[3]}}%) hue-rotate({{val[4]}}deg) opacity({{val[5]}}%) saturate({{val[6]}}%)'], 'show' => ['img_hover' => ''] ), 'img_shadow' => array( 'type' => 'box_shadow', 'label' => __pl('shadow'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-pf-img img' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}} !important;'], 'show' => ['img_hover' => ''] ), 'img_rotate' => array( 'type' => 'spinner', 'label' => __pl('Rotate'), 'min' => 0, 'max' => 360, 'step' => 1, 'screen' => 1, 'css' => ['{{element}} .pagelayer-pf-img img' => 'transform: rotate({{val}}deg)'], 'show' => ['img_hover' => ''] ), 'img_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('btn_hover_delay_label'), 'desc' => __pl('btn_hover_delay_desc'), 'min' => 0, 'step' => 100, 'max' => 5000, 'css' => ['{{element}} .pagelayer-pf-img img' => '-webkit-transition: all {{val}}ms; transition: all {{val}}ms;',], 'show' => ['img_hover' => 'hover'] ), 'img_filter_hover' => array( 'type' => 'filter', 'label' => __pl('filter'), 'css' => ['{{element}} .pagelayer-pf-img img:hover' => 'filter: blur({{val[0]}}px) brightness({{val[1]}}%) contrast({{val[2]}}%) grayscale({{val[3]}}%) hue-rotate({{val[4]}}deg) opacity({{val[5]}}%) saturate({{val[6]}}%)'], 'show' => ['img_hover' => 'hover'] ), 'img_shadow_hover' => array( 'type' => 'box_shadow', 'label' => __pl('shadow'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-pf-img img:hover' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}} !important;'], 'show' => ['img_hover' => 'hover'] ), 'img_rotate_hover' => array( 'type' => 'spinner', 'label' => __pl('Rotate'), 'min' => 0, 'max' => 360, 'step' => 1, 'screen' => 1, 'css' => ['{{element}} .pagelayer-pf-img img:hover' => 'transform: rotate({{val}}deg)'], 'show' => ['img_hover' => 'hover'] ) ], 'btns_style' => [ 'disable_category' => array( 'type' => 'checkbox', 'label' => __pl('disable_category'), 'css' => ['{{element}} .pagelayer-category-holder' => 'display:none'] ), 'btn_align' => array( 'label' => __pl('alignment'), 'type' => 'select', 'screen' => 1, 'css' => ['{{element}} .pagelayer-category-holder' => 'text-align:{{val}};'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), 'justify' => __pl('justify'), ) ), 'btn_size' => array( 'type' => 'dimension', 'label' => __pl('size'), 'screen' => 1, 'css' => ['{{element}} button' => 'padding-top: {{val[0]}}px; padding-right: {{val[1]}}px; padding-bottom: {{val[0]}}px; padding-left: {{val[1]}}px;'], ), 'btn_spacing' => array( 'type' => 'dimension', 'label' => __pl('space_around'), 'screen' => 1, 'css' => ['{{element}} button' => 'margin-top: {{val[0]}}px; margin-right: {{val[1]}}px; margin-bottom: {{val[0]}}px; margin-left: {{val[1]}}px;'], ), 'btn_space_bottom' => array( 'type' => 'slider', 'label' => __pl('space_bottom'), 'screen' => 1, 'min' => 0, 'step' => 1, 'max' => 1000, 'css' => ['{{element}} .pagelayer-category-holder' => 'padding-bottom: {{val}}px;'], ), 'btn_hover' => [ 'type' => 'radio', 'label' => '', 'list' => [ '' => __pl('normal'), 'hover' => __pl('hover'), ], ], 'btn_color' => array( 'label' => __pl('color'), 'type' => 'color', 'css' => ['{{element}} button' => 'color: {{val}};'], 'show' => ['btn_hover' => ''], ), 'btn_bg' => array( 'label' => __pl('bg_color'), 'type' => 'color', 'css' => ['{{element}} button' => 'background-color: {{val}};'], 'show' => ['btn_hover' => ''], ), 'btn_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} button' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'show' => ['btn_hover' => ''], ), 'btn_border_type' => [ 'type' => 'select', 'label' => __pl('border_type'), 'screen' => 1, 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => ['btn_hover' => ''], 'css' => ['{{element}} button' => 'border-style: {{val}}'], ], 'btn_border_width' => [ 'type' => 'padding', 'label' => __pl('border_width'), 'units' => ['px', 'em'], 'screen' => 1, 'show' => [ 'btn_hover' => '' ], 'req' => [ '!btn_border_type' => '' ], 'css' => ['{{element}} button' => 'border-top-width: {{val[0]}}; border-right-width: {{val[1]}}; border-bottom-width: {{val[2]}}; border-left-width: {{val[3]}}'], ], 'btn_border_color' => [ 'type' => 'color', 'label' => __pl('border_color'), 'screen' => 1, 'show' => [ 'btn_hover' => '' ], 'req' => [ '!btn_border_type' => '' ], 'css' => ['{{element}} button' => 'border-color: {{val}}'], ], 'btn_border_radius' => [ 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => ['px', 'em'], 'screen' => 1, 'show' => ['btn_hover' => ''], 'css' => ['{{element}} button' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], ], 'btn_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('btn_hover_delay_label'), 'desc' => __pl('btn_hover_delay_desc'), 'min' => 0, 'step' => 100, 'max' => 5000, 'css' => ['{{element}} button' => '-webkit-transition: all {{val}}ms !important; transition: all {{val}}ms !important;'], 'show' => array( 'btn_hover' => 'hover' ), ), 'btn_color_hover' => array( 'label' => __pl('color'), 'type' => 'color', 'css' => ['{{element}} button:hover' => 'color: {{val}};'], 'show' => ['btn_hover' => 'hover'], ), 'btn_bg_hover' => array( 'label' => __pl('bg_color'), 'type' => 'color', 'css' => ['{{element}} button:hover' => 'background-color: {{val}};'], 'show' => ['btn_hover' => 'hover'], ), 'btn_typo_hover' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} button:hover' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'show' => ['btn_hover' => 'hover'], ), 'btn_btype_hover' => [ 'type' => 'select', 'label' => __pl('border_type'), 'screen' => 1, 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => ['btn_hover' => 'hover'], 'css' => ['{{element}} button:hover' => 'border-style: {{val}}'], ], 'btn_bwidth_hover' => [ 'type' => 'padding', 'label' => __pl('border_width'), 'units' => ['px', 'em'], 'screen' => 1, 'show' => [ 'btn_hover' => 'hover' ], 'req' => [ '!btn_btype_hover' => '' ], 'css' => ['{{element}} button:hover' => 'border-top-width: {{val[0]}}; border-right-width: {{val[1]}}; border-bottom-width: {{val[2]}}; border-left-width: {{val[3]}}'], ], 'btn_bcolor_hover' => [ 'type' => 'color', 'label' => __pl('border_color'), 'screen' => 1, 'show' => [ 'btn_hover' => 'hover' ], 'req' => [ '!btn_btype_hover' => '' ], 'css' => ['{{element}} button:hover' => 'border-color: {{val}}'], ], 'btn_bradius_hover' => [ 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'units' => ['px', 'em'], 'show' => ['btn_hover' => 'hover'], 'css' => ['{{element}} button:hover' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], ], ], 'styles' => [ 'img_style' => __pl('service_img_style'), 'btns_style' => __pl('button_style'), ] )); // Image Portfolio pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_single_img', array( 'name' => __pl('image'), 'group' => 'other', 'not_visible' => 1, 'parent' => [PAGELAYER_SC_PREFIX.'_img_portfolio'], 'html' => '<div class="pagelayer-pf-img"> <a if-ext="{{link_type}}" class="pagelayer-ele-link" href="{{func_link}}" pagelayer-image-link-type="{{link_type}}"> <img class="pagelayer-img" src="{{func_img}}" title="{{{img-title}}}" alt="{{{img-alt}}}" /> <div if="{{overlay}}" class="pagelayer-image-overlay"> <div class="pagelayer-image-overlay-content"> <i if="{{icon}}" class="pagelayer-image-overlay-icon {{icon}}"></i> <h3 if="{{heading}}" class="pagelayer-overlay-heading">{{heading}}</h3> <div if="{{text}}" class="pagelayer-image-overlay-text">{{text}}</div> </div> </div> </a> </div>', 'params' => array( 'title' => array( 'type' => 'text', 'label' => __pl('title'), 'default' => 'Lorem', ), 'img' => array( 'label' => __pl('image_src_label'), 'type' => 'image', 'default' => PAGELAYER_URL.'/images/default-image.png', 'addAttr' => 'port-cat="all"', ), 'img-size' => array( 'label' => __pl('obj_image_size_label'), 'type' => 'select', 'default' => 'full', 'list' => array( 'full' => __pl('full'), 'large' => __pl('large'), 'medium' => __pl('medium'), 'thumbnail' => __pl('thumbnail'), 'custom' => __pl('custom') ) ), 'custom_size' => array( 'label' => __pl('image_custom_size_label'), 'type' => 'dimension', 'default' => '100,100', 'screen' => 1, 'css' => ['{{element}} .pagelayer-img' => 'width: {{val[0]}}px; height: {{val[1]}}px;'], 'req' => array( 'img-size' => 'custom' ), ), 'cat_name' => array( 'type' => 'text', 'addAttr' => 'port-cat="{{cat_name}}"', 'label' => __pl('category'), 'default' => __pl('Technology'), ), 'link_type' => array( 'label' => __pl('image_link_label'), 'type' => 'select', 'list' => array( '' => __pl('none'), 'custom_url' => __pl('custom_url'), 'media_file' => __pl('media_file'), 'lightbox' => __pl('lightbox') ) ), 'link' => array( 'type' => 'link', 'label' => __pl('image_link_label'), 'desc' => __pl('image_link_desc'), 'selector' => '.pagelayer-ele-link', 'req' => array( 'link_type' => 'custom_url' ) ), 'rel' => array( 'label' => __pl('image_rel_label'), 'type' => 'text', 'addAttr' => ['{{element}} a' => 'rel="{{rel}}"'], 'req' => array( 'link_type' => 'media_file' ) ), 'target' => array( 'label' => __pl('open_link_in_new_window'), 'type' => 'checkbox', 'addAttr' => ['{{element}} a' => 'target="_blank"'], 'req' => ['link_type' => ['custom_url', 'media_file']], // For backward compatibility of the new link property in version 1.5.8, hide it for custom_url. 'show' => ['link_type' => 'media_file'] ), ), 'overlay_style' => [ 'overlay' => array( 'label' => __pl('image_overlay_effect_label'), 'desc' => __pl('image_overlay_effect_desc'), 'type' => 'checkbox', ), 'icon' => array( 'label' => __pl('icon'), 'type' => 'icon', 'default' => 'far fa-eye', 'req' => array( 'overlay' => 'true' ) ), 'icon_color' => array( 'label' => __pl('icon_color'), 'type' => 'color', 'css' => ['{{element}} .pagelayer-image-overlay-icon' => 'color: {{val}}'], 'req' => array( 'overlay' => 'true' ) ), 'icon_size' => array( 'label' => __pl('icon_custom_size'), 'desc' => __pl('icon_custom_size_desc'), 'type' => 'spinner', 'min' => 0, 'step' => 1, 'max' => 500, 'screen' => 1, 'css' => ['{{element}} .pagelayer-image-overlay-icon' => 'font-size: {{val}}px'], 'req' => array( 'overlay' => 'true' ) ), 'heading' => array( 'label' => __pl('title'), 'type' => 'text', 'edit' => '.pagelayer-overlay-heading', 'req' => array( 'overlay' => 'true' ) ), 'heading_color' => array( 'label' => __pl('title_color'), 'type' => 'color', 'css' => ['{{element}} .pagelayer-overlay-heading, {{element}} .pagelayer-overlay-heading *' => 'color: {{val}}'], 'req' => array( 'overlay' => 'true' ) ), 'heading_typo' => array( 'type' => 'typography', 'label' => __pl('heading_typo'), 'css' => [ '{{element}} .pagelayer-overlay-heading, {{element}} .pagelayer-overlay-heading *' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', ], 'req' => array( 'overlay' => 'true' ) ), 'text' => array( 'label' => __pl('content'), 'type' => 'editor', 'default' => 'Lorem Ipsum', 'edit' => '.pagelayer-image-overlay-text', 'req' => array( 'overlay' => 'true' ) ), 'overlay_bg_type' => array( 'label' => __pl('background_type'), 'type' => 'radio', 'list' => array( '' => __pl('color'), 'gradient' => __pl('gradient') ), 'req' => array( 'overlay' => 'true' ) ), 'overlay_bg' => array( 'label' => __pl('image_overlay_background'), 'type' => 'color', 'css' => ['{{element}} .pagelayer-image-overlay' => 'background: {{val}}'], 'req' => array( 'overlay' => 'true', 'overlay_bg_type' => '' ) ), 'overlay_gradient' => [ 'type' => 'gradient', 'label' => '', 'css' => ['{{element}} .pagelayer-image-overlay' => 'background: linear-gradient({{val[0]}}deg, {{val[1]}} {{val[2]}}%, {{val[3]}} {{val[4]}}%, {{val[5]}} {{val[6]}}%);'], 'req' => array( 'overlay' => 'true', 'overlay_bg_type' => 'gradient' ) ], 'content_align' => array( 'label' => __pl('alignment'), 'type' => 'radio', 'screen' => 1, 'css' => ['{{element}} .pagelayer-image-overlay-content' => 'text-align: {{val}};'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'req' => array( 'overlay' => 'true' ) ), 'content_position' => array( 'label' => __pl('overlay_cont_pos'), 'type' => 'radio', 'screen' => 1, 'css' => ['{{element}} .pagelayer-image-overlay' => 'display:-webkit-flex;display:flex;-webkit-align-items:{{val}}; align-items:{{val}};'], 'list' => array( 'flex-start' => __pl('Top'), 'center' => __pl('Middle'), 'flex-end' => __pl('Bottom'), ), 'req' => array( 'overlay' => 'true' ) ), 'content_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'screen' => 1, 'css' => ['{{element}}:hover .pagelayer-image-overlay' => 'padding-top: {{val[0]}}px; padding-right: {{val[1]}}px; padding-bottom: {{val[2]}}px; padding-left: {{val[3]}}px;'], 'req' => array( 'overlay' => 'true' ) ), 'show_always' => array( 'label' => __pl('image_show_always'), 'type' => 'checkbox', 'screen' => 1, 'css' => ['{{element}} .pagelayer-image-overlay' => 'height:100%;'], 'req' => array( 'overlay' => 'true' ) ) ], 'styles' => [ 'overlay_style' => __pl('overlay_style') ] )); ///////////////////////////////////// // WooCommerce Shortcodes ///////////////////////////////////// if(class_exists( 'woocommerce' )){ // Product Images pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_product_images', array( 'name' => __pl('product_images'), 'group' => 'woocommerce', 'html' => '<div class="pagelayer-product-images-container product pagelayer-woo-gallery-{{gposition}}"> {{product_images_templ}} </div>', 'params' => array( 'sale_flash' => array( 'type' => 'checkbox', 'label' => __pl('sale_flash'), ), 'image_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['.woocommerce {{element}} .woocommerce-product-gallery__trigger + .woocommerce-product-gallery__wrapper' => 'border-style: {{val}}', '.woocommerce {{element}} .flex-viewport' => 'border-style: {{val}}', ], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'image_border_color' => array( 'type' => 'color', 'label' => __pl('border_color_label'), 'default' => '#42414f', 'css' => ['.woocommerce {{element}} .woocommerce-product-gallery__trigger + .woocommerce-product-gallery__wrapper' => 'border-color: {{val}};', '.woocommerce {{element}} .flex-viewport' => 'border-color: {{val}};', ], 'req' => array( '!image_border_type' => '' ), ), 'image_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'css' => ['.woocommerce {{element}} .woocommerce-product-gallery__trigger + .woocommerce-product-gallery__wrapper' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px', '.woocommerce {{element}} .flex-viewport' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px', ], 'req' => [ '!image_border_type' => '' ], ), 'image_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => [ 'px', '%' ], 'css' => ['.woocommerce {{element}} .woocommerce-product-gallery__trigger + .woocommerce-product-gallery__wrapper' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};', '.woocommerce {{element}} .flex-viewport' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};', ], ), ), 'thumbnails' => array( 'disable_gallery' => array( 'type' => 'checkbox', 'label' => __pl('disable_gallery'), 'css' => ['{{element}} ol.flex-control-thumbs' => 'display:none !important'], ), 'gposition' => array( 'label' => __pl('gallery_position'), 'type' => 'radio', 'default' => 'bottom', 'list' => array( 'left' => __pl('left'), 'top' => __pl('top'), 'right' => __pl('right'), 'bottom' => __pl('bottom') ), 'req' => array( 'disable_gallery' => '', ), ), 'thumb_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['.woocommerce {{element}} .flex-control-thumbs img' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'req' => array( 'disable_gallery' => '', ), ), 'thumb_border_color' => array( 'type' => 'color', 'label' => __pl('border_color_label'), 'default' => '#42414f', 'css' => ['.woocommerce {{element}} .flex-control-thumbs img' => 'border-color: {{val}};'], 'req' => array( 'disable_gallery' => '', '!thumb_border_type' => '' ), ), 'thumb_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'css' => ['.woocommerce {{element}} .flex-control-thumbs img' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ 'disable_gallery' => '', '!thumb_border_type' => '' ], ), 'thumb_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => [ 'px', '%' ], 'css' => ['.woocommerce {{element}} .flex-control-thumbs img' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], 'req' => array( 'disable_gallery' => '', ), ), 'thumb_space' => array( 'type' => 'slider', 'label' => __pl('horizontal_space'), 'units' => [ 'px', '%' ], 'css' => ['.woocommerce {{element}} .flex-control-thumbs li' => 'padding-right: calc({{val}} / 2); padding-left: calc({{val}} / 2); padding-bottom: {{val}}', '.woocommerce {{element}} .flex-control-thumbs' => 'margin-right: calc(-{{val}} / 2); margin-left: calc(-{{val}} / 2)' ], 'req' => array( 'disable_gallery' => '', ), ), 'thumb_vertical_space' => array( 'type' => 'slider', 'label' => __pl('vertical_space'), 'units' => ['px','%'], 'css' => ['.woocommerce {{element}} .flex-control-thumbs li' => 'padding-top: {{val}} ; padding-bottom: {{val}};', '.woocommerce {{element}} .flex-control-thumbs' => 'margin-top: calc(-{{val}} / 2); margin-bottom: calc(-{{val}} / 2)' ], 'req' => array( 'disable_gallery' => '', ), ), ), 'styles' => [ 'thumbnails' => __pl('thumbnails'), ], ) ); // Product Price pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_product_price', array( 'name' => __pl('product_price'), 'group' => 'woocommerce', 'html' => '<div class=" product pagelayer-product-price-container"> {{pagelayer-product-price}} </div>', 'params' => array( 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'css' => ['.woocommerce {{element}} .pagelayer-product-price-container' => 'text-align: {{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), ), 'price_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.woocommerce {{element}} .price .woocommerce-Price-amount' => 'color: {{val}} !important', '.woocommerce {{element}} .price' => 'color: {{val}} !important' ], ), 'price_typo' => array( 'type' => 'typography', 'label' => __pl('heading_typo'), 'css' => ['.woocommerce {{element}} .price .woocommerce-Price-amount' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', '.woocommerce {{element}} .price' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), ), 'sale_price' => array( 'sale_price_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.woocommerce {{element}} .price ins .woocommerce-Price-amount' => 'color: {{val}} !important', '.woocommerce {{element}} .price ins' => 'color: {{val}} !important' ], ), 'sale_price_typo' => array( 'type' => 'typography', 'label' => __pl('heading_typo'), 'css' => ['.woocommerce {{element}} .price ins .woocommerce-Price-amount' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', '.woocommerce {{element}} .price ins .woocommerce-Price-amount' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), 'sale_space_bottom' => array( 'type' => 'checkbox', 'label' => __pl('space_bottom'), 'addAttr' => ['{{element}} .price' => 'pagelayer-bottom="yes"'], ), 'sale_price_space' => array( 'type' => 'slider', 'label' => __pl('space'), 'units' => [ 'px', '%' ], 'step' => 0.1, 'css' => ['body:not(.rtl) {{element}} .price:not([pagelayer-bottom="yes"]) del' => 'margin-right: {{val}}', 'body.rtl {{element}} .price:not([pagelayer-bottom="yes"]) del' => 'margin-right: {{val}}', '{{element}} .price[pagelayer-bottom="yes"] del' => 'margin-bottom: {{val}}' ], ), ), 'styles' => [ 'sale_price' => __pl('sale_price'), ], ) ); // Add to cart pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_add_to_cart', array( 'name' => __pl('add_to_cart'), 'group' => 'woocommerce', 'html' => '<div class=" product pagelayer-add-to-cart-holder">{{product_add_to_cart}}<div>', 'params' => array( 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'css' => ['.woocommerce {{element}}' => 'text-align: {{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), ), 'cart_typo' => array( 'type' => 'typography', 'label' => __pl('heading_typo'), 'css' => ['.woocommerce {{element}} .cart button' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'cart_colors' => array( 'type' => 'radio', 'label' => __pl('color'), 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'cart_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.woocommerce {{element}} .cart button' => 'color: {{val}} !important'], 'show' => ['cart_colors' => ''], ), 'cart_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['.woocommerce {{element}} .cart button' => 'background-color: {{val}} !important'], 'show' => ['cart_colors' => ''], ), 'cart_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['.woocommerce {{element}} .cart button' => 'border-color: {{val}} !important'], 'show' => ['cart_colors' => ''], ), 'cart_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.woocommerce {{element}} .cart button:hover' => 'color: {{val}} !important'], 'show' => ['cart_colors' => 'hover'], ), 'cart_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['.woocommerce {{element}} .cart button:hover' => 'background-color: {{val}} !important'], 'show' => ['cart_colors' => 'hover'], ), 'cart_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['.woocommerce {{element}} .cart button:hover' => 'border-color: {{val}} !important'], 'show' => ['cart_colors' => 'hover'], ), 'cart_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['.woocommerce {{element}} .cart button' => 'border-style: {{val}}', ], 'list' => [ '' => __pl('default'), 'none' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'cart_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'css' => ['.woocommerce {{element}} .cart button' => 'border-top-width: {{val[0]}}px !important; border-right-width: {{val[1]}}px !important; border-bottom-width: {{val[2]}}px !important; border-left-width: {{val[3]}}px !important', ], 'req' => [ '!cart_border_type' => ['', 'none'], ], ), 'cart_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => [ 'px', '%' ], 'css' => ['.woocommerce {{element}} .cart button' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}} !important; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}} !important;-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}} !important;', ], ), 'cart_border_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'units' => [ 'px', '%', 'em' ], 'css' => ['.woocommerce {{element}} .cart button' => 'padding: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}} !important;'], ), ), 'cart_quantity' => array( 'quantity_space' => array( 'type' => 'slider', 'label' => __pl('space'), 'units' => [ 'px', 'em' ], 'step' => 0.1, 'css' => ['body:not(.rtl) {{element}} .quantity + .button' => 'margin-left: {{val}}', 'body.rtl {{element}} .quantity + .button' => 'margin-right: {{val}}' ], ), 'quantity_width' => array( 'type' => 'slider', 'label' => __pl('Width'), 'units' => [ 'px', 'em' ], 'step' => 0.1, 'css' => ['.woocommerce {{element}} .quantity .qty' => 'width: {{val}} !important'], ), 'quantity_typo' => array( 'type' => 'typography', 'label' => __pl('heading_typo'), 'css' => ['.woocommerce {{element}} .quantity .qty' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'quantity_colors' => array( 'type' => 'radio', 'label' => __pl('colors'), 'list' => array( '' => __pl('normal'), 'focus' => __pl('focus'), ), ), 'quantity_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.woocommerce {{element}} .quantity .qty' => 'color: {{val}} !important'], 'show' => ['quantity_colors' => ''], ), 'quantity_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['.woocommerce {{element}} .quantity .qty' => 'background-color: {{val}} !important'], 'show' => ['quantity_colors' => ''], ), 'quantity_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['.woocommerce {{element}} .quantity .qty' => 'border-color: {{val}} !important'], 'show' => ['quantity_colors' => ''], ), 'quantity_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.woocommerce {{element}} .quantity .qty:focus' => 'color: {{val}} !important'], 'show' => ['quantity_colors' => 'focus'], ), 'quantity_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['.woocommerce {{element}} .quantity .qty:focus' => 'background-color: {{val}} !important'], 'show' => ['quantity_colors' => 'focus'], ), 'quantity_border_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.woocommerce {{element}} .quantity .qty:focus' => 'border-color: {{val}} !important'], 'show' => ['quantity_colors' => 'focus'], ), 'quantity_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['.woocommerce {{element}} .quantity .qty' => 'border-style: {{val}} !important', ], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'quantity_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'css' => ['.woocommerce {{element}} .quantity .qty' => 'border-top-width: {{val[0]}}px !important; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px !important; border-left-width: {{val[3]}}px !important', ], 'req' => [ '!quantity_border_type' => '' ], ), 'quantity_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => [ 'px', '%' ], 'css' => ['.woocommerce {{element}} .quantity .qty' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}} !important; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}} !important;-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}} !important;', ], ), 'quantity_border_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'units' => [ 'px', '%', 'em' ], 'css' => ['.woocommerce {{element}} .quantity .qty' => 'padding: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}} !important;'], ), ), 'cart_variations' => array( 'variations_space' => array( 'type' => 'slider', 'label' => __pl('space'), 'units' => [ 'px', 'em' ], 'step' => 0.1, 'css' => ['.woocommerce {{element}} form.cart .variations' => 'margin-bottom: {{val}} !important'], ), 'variations_space_between' => array( 'type' => 'slider', 'label' => __pl('space_between'), 'units' => [ 'px', 'em' ], 'step' => 0.1, 'css' => ['.woocommerce {{element}} form.cart table.variations tr:not(:last-child)' => 'margin-bottom: {{val}} !important'], ), 'variations_label' => array( 'type' => 'heading', 'label' => __pl('label'), ), 'variations_label_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['.woocommerce {{element}} form.cart table.variations label' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'variations_label_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.woocommerce {{element}} form.cart table.variations label' => 'color: {{val}} !important'], ), 'sel_label' => array( 'type' => 'heading', 'label' => __pl('select'), ), 'variations_sel_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['.woocommerce {{element}} form.cart table.variations td.value select' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'variations_sel_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.woocommerce {{element}} form.cart table.variations td.value select' => 'color: {{val}} !important'], ), 'variations_sel_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['.woocommerce {{element}} form.cart table.variations td.value select' => 'background-color: {{val}} !important'], ), 'variations_border_sel_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['.woocommerce {{element}} form.cart table.variations td.value:before' => 'border-color: {{val}} !important'], ), 'variations_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => [ 'px', '%' ], 'css' => ['.woocommerce {{element}} form.cart table.variations td.value select' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}} !important; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}} !important;-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}} !important;', ], ), ), 'styles' => [ 'cart_quantity' => __pl('quantity'), 'cart_variations' => __pl('variations'), ], ) ); // Product Rating pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_product_rating', array( 'name' => __pl('product_rating'), 'group' => 'woocommerce', 'html' => '<div class=" product pagelayer-product-rating">{{product_rating}}</div>', 'params' => array( 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'css' => ['.woocommerce {{element}}' => 'text-align: {{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), ), 'star_color' => array( 'type' => 'color', 'label' => __pl('star_color'), 'css' => ['.woocommerce {{element}} .star-rating' => 'color: {{val}}'], ), 'star_emp_color' => array( 'type' => 'color', 'label' => __pl('empty_star_color'), 'css' => ['.woocommerce {{element}} .star-rating::before' => 'color: {{val}}'], ), 'review_link_color' => array( 'type' => 'color', 'label' => __pl('link_color'), 'css' => ['.woocommerce {{element}} .woocommerce-review-link' => 'color: {{val}}'], ), 'typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['.woocommerce {{element}} .woocommerce-review-link' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'star_size' => array( 'type' => 'slider', 'label' => __pl('star_size'), 'units' => [ 'px', 'em' ], 'step' => 0.1, 'css' => ['.woocommerce {{element}} .star-rating' => 'font-size:{{val}}'], ), 'space_between' => array( 'type' => 'slider', 'label' => __pl('space_between'), 'units' => [ 'px', 'em' ], 'step' => 0.1, 'css' => [ '.woocommerce:not(.rtl) {{element}} .star-rating' => 'margin-right: {{val}}', '.woocommerce.rtl {{element}} .star-rating' => 'margin-left: {{val}}' ], ), ), 'review_link' => array( 'disable_review_link' => array( 'type' => 'checkbox', 'label' => __pl('disable_link'), 'css' => ['.woocommerce {{element}} .woocommerce-review-link' => 'display:none !important'], ), 'link_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), 'req' => array( 'disable_review_link' => '', ), ), 'link_color' => array( 'type' => 'color', 'label' => __pl('link_color'), 'css' => ['.woocommerce {{element}} .woocommerce-review-link' => 'color: {{val}}; transition: all 0.5s ;'], 'req' => array( 'disable_review_link' => '', ), 'show' => ['link_hover' => ''], ), 'link_hover_color' => array( 'type' => 'color', 'label' => __pl('link_color'), 'css' => ['.woocommerce {{element}} .woocommerce-review-link:hover' => 'color: {{val}} !important;'], 'req' => array( 'disable_review_link' => '', ), 'show' => ['link_hover' => 'hover'], ), ), 'styles' => [ 'review_link' => __pl('Review Link'), ] ) ); // Product Meta pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_product_meta', array( 'name' => __pl('product_meta'), 'group' => 'woocommerce', 'html' => '<div class=" product pagelayer-product-meta pagelayer-meta-{{display}}">{{product_meta}}</div>', 'params' => array( 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'css' => ['.woocommerce {{element}} .pagelayer-product-meta' => 'text-align: {{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), ), 'display' => array( 'type' => 'radio', 'label' => __pl('display'), 'css' => ['.woocommerce {{element}} .product_meta > span' => 'display: {{val}}'], 'list' => array( 'inline-block' => __pl('inline_block'), 'block' => __pl('block'), ), ), 'space_between' => array( 'type' => 'slider', 'label' => __pl('space_between'), 'step' => 0.1, 'css' => [ '.woocommerce {{element}} .pagelayer-product-meta:not(.pagelayer-meta-block) .product_meta > span:not(:first-child)' => 'margin-left: {{val}}px', '.woocommerce {{element}} .pagelayer-product-meta.pagelayer-meta-block .product_meta > span:not(:last-child)' => 'margin-bottom: {{val}}px', ], ), 'meta_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.woocommerce {{element}} .product_meta span' => 'color: {{val}}'], ), 'typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['.woocommerce {{element}} .product_meta span' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'link_color' => array( 'type' => 'color', 'label' => __pl('link_color'), 'css' => ['.woocommerce {{element}} .product_meta a' => 'color: {{val}}'], ), 'linl_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['.woocommerce {{element}} .product_meta a' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ), ) ); // Product short description pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_product_short_desc', array( 'name' => __pl('product_short_desc'), 'group' => 'woocommerce', 'html' => '<div class=" product pagelayer-product-short-desc">{{product_short_desc}}</div>', 'params' => array( 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'css' => ['.woocommerce {{element}} .pagelayer-product-short-desc' => 'text-align: {{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), ), 'meta_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.woocommerce {{element}} .pagelayer-product-short-desc *' => 'color: {{val}}'], ), 'typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['.woocommerce {{element}} .pagelayer-product-short-desc' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ), ) ); // Products style $products_style = array( 'column_gap' => array( 'type' => 'slider', 'label' => __pl('column_gap'), 'units' => ['px', '%'], 'screen' => 1, 'default' => 20, 'step' => 0.2, 'max' => 100, 'css' => ['{{element}} ul.products li.product' => 'margin-right: {{val}}'], ), 'row_gap' => array( 'type' => 'slider', 'label' => __pl('row_gap'), 'units' => ['px', '%'], 'screen' => 1, 'default' => 20, 'step' => 0.2, 'max' => 100, 'css' => ['{{element}} ul.products li.product' => 'margin-bottom: {{val}}'], ), 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'addAttr' => ['{{element}} .pagelayer-product-related-container' => 'pagelayer-content-align="{{align}}"'], 'css' => ['{{element}} ul.products li.product' => 'text-align:{{val}}'], ), 'img_lable' => array( 'type' => 'heading', 'label' => __pl('image'), ), 'img_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .attachment-woocommerce_thumbnail' => 'border-style: {{val}}', ], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'img_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .attachment-woocommerce_thumbnail' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px' ], 'req' => [ '!img_border_type' => '' ], ), 'img_border_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .attachment-woocommerce_thumbnail' => 'border-color: {{val}}'], 'show' => ['img_border_type' => ''], ), 'img_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => [ 'px', '%' ], 'screen' => 1, 'css' => ['{{element}} .attachment-woocommerce_thumbnail' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};', ], ), 'img_spacing' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'units' => [ 'px', '%' ], 'screen' => 1, 'css' => ['{{element}} .attachment-woocommerce_thumbnail' => 'margin-bottom: {{val}}'], ), 'title_lable' => array( 'type' => 'heading', 'label' => __pl('title'), ), 'title_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => [ '{{element}} ul.products li.product .woocommerce-loop-product__title' => 'color: {{val}}', '{{element}} ul.products li.product .woocommerce-loop-category__title' => 'color: {{val}}' ], ), 'title_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} ul.products li.product .woocommerce-loop-product__title' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', '{{element}} ul.products li.product .woocommerce-loop-category__title' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), 'title_spacing' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'units' => [ 'px', '%' ], 'screen' => 1, 'css' => [ '{{element}} ul.products li.product .woocommerce-loop-product__title' => 'margin-bottom: {{val}}', '{{element}} ul.products li.product .woocommerce-loop-category__title' => 'margin-bottom: {{val}}' ], ), 'rating_lable' => array( 'type' => 'heading', 'label' => __pl('stars_rating'), ), 'star_color' => array( 'type' => 'color', 'label' => __pl('star_color'), 'css' => ['{{element}} ul.products li.product .star-rating' => 'color: {{val}}'], ), 'empty_star_color' => array( 'type' => 'color', 'label' => __pl('empty_star_color'), 'css' => ['{{element}} ul.products li.product .star-rating::before' => 'color: {{val}}'], ), 'star_size' => array( 'type' => 'slider', 'label' => __pl('star_size'), 'max' => 5, 'step' => 0.1, 'css' => ['{{element}} ul.products li.product .star-rating' => 'font-size: {{val}}em'], ), 'star_spacing' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'units' => [ 'px', '%' ], 'screen' => 1, 'css' => ['{{element}} ul.products li.product .star-rating' => 'margin-bottom: {{val}}'], ), 'price_lable' => array( 'type' => 'heading', 'label' => __pl('price_style'), ), 'price_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => [ '{{element}} ul.products li.product .price' => 'color: {{val}}', '{{element}} ul.products li.product .price ins' => 'color: {{val}}', '{{element}} ul.products li.product .price ins .amount' => 'color: {{val}}', ], ), 'price_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} ul.products li.product .price' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'reg_price_lable' => array( 'type' => 'heading', 'label' => __pl('regular_price'), ), 'reg_price_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => [ '{{element}} ul.products li.product .price del .amount' => 'color:{{val}}', '{{element}} ul.products li.product .price del' => 'color:{{val}}' ] ), 'reg_price_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} ul.products li.product .price del .amount' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', '{{element}} ul.products li.product .price del' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), 'button_lable' => array( 'type' => 'heading', 'label' => __pl('button'), ), 'button_colors'=> array( 'type' => 'radio', 'label' => '', 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'btn_color'=> array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} ul.products li.product .button' => 'color:{{val}}'], 'show' => [ 'button_colors' => '' ], ), 'btn_bg_color'=> array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} ul.products li.product .button' => 'background-color:{{val}}'], 'show' => [ 'button_colors' => '' ], ), 'btn_border_color'=> array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['{{element}} ul.products li.product .button' => 'border-color:{{val}}'], 'show' => [ 'button_colors' => '' ], ), 'btn_hover_color'=> array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} ul.products li.product .button:hover' => 'color:{{val}}'], 'show' => [ 'button_colors' => 'hover' ], ), 'btn_bg_hover_color'=> array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} ul.products li.product .button:hover' => 'background-color:{{val}}'], 'show' => [ 'button_colors' => 'hover' ], ), 'btn_border_hover_color'=> array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['{{element}} ul.products li.product .button:hover' => 'border-color:{{val}}'], 'show' => [ 'button_colors' => 'hover' ], ), 'btnb_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} ul.products li.product .button' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'btn_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} ul.products li.product .button' => 'border-style: {{val}}', ], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'btn_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} ul.products li.product .button' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px', ], 'req' => [ '!btn_border_type' => '' ], ), 'btn_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => [ 'px', '%' ], 'screen' => 1, 'css' => ['{{element}} ul.products li.product .button' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};', ], ), 'btn_text_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'units' => [ 'px', '%' ], 'screen' => 1, 'css' => ['{{element}} ul.products li.product .button' => 'padding: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};', ], ), 'btn_spacing' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'units' => [ 'px', '%' ], 'screen' => 1, 'css' => ['{{element}} ul.products li.product .button' => 'margin-top:{{val}}'], ), 'view_cart_lable' => array( 'type' => 'heading', 'label' => __pl('view_cart'), ), 'view_cart_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .added_to_cart' => 'color: {{val}}'], ), 'view_cart_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .added_to_cart' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ); // Products heading style $products_heading = array( 'heading_show'=> array( 'type' => 'checkbox', 'label' => __pl('heading_style'), 'default' => 'true', 'addAttr' => ['{{element}} .pagelayer-product-related-container' => 'pagelayer-heading-show="{{heading_show}}"'], ), 'heading_color'=> array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .products > h2' => 'color: {{val}}'], 'req' => ['heading_show' => 'true'], ), 'heading_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .products > h2' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => ['heading_show' => 'true'], ), 'heading_align'=> array( 'type' => 'radio', 'label' => __pl('alignment'), 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'css' => ['{{element}} .products > h2' => 'text-align: {{val}}'], 'req' => ['heading_show' => 'true'], ), 'heading_spacing' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'units' => [ 'px', '%' ], 'screen' => 1, 'css' => ['{{element}} .products > h2' => 'margin-bottom: {{val}}'], 'req' => ['heading_show' => 'true'], ), ); // Products box style $products_box = array( 'box_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} ul.products li.product' => 'border-style: {{val}}', ], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'box_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} ul.products li.product' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px', ], 'req' => [ '!box_border_type' => '' ], ), 'box_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => [ 'px', '%' ], 'screen' => 1, 'css' => ['{{element}} ul.products li.product' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};', ], ), 'box_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'units' => [ 'px', '%' ], 'screen' => 1, 'css' => ['{{element}} ul.products li.product' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};', ], ), 'box_colors' => array( 'type' => 'radio', 'label' => '', 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'box_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} ul.products li.product' => 'background-color: {{val}}'], 'show' => ['box_colors' => ''], ), 'box_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['{{element}} ul.products li.product' => 'border-color: {{val}}'], 'show' => ['box_colors' => ''], ), 'box_shadow' => [ 'type' => 'box_shadow', 'label' => __pl('shadow'), 'css' => ['{{element}} ul.products li.product' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}} !important;'], 'show' => ['box_colors' => ''], ], 'box_bg_hover_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} ul.products li.product:hover' => 'background-color: {{val}}'], 'show' => ['box_colors' => 'hover'], ), 'box_border_hover_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['{{element}} ul.products li.product:hover' => 'border-color: {{val}}'], 'show' => ['box_colors' => 'hover'], ), 'box_hover_shadow' => [ 'type' => 'box_shadow', 'label' => __pl('shadow'), 'css' => ['{{element}} ul.products li.product:hover' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}} !important;'], 'show' => ['box_colors' => 'hover'], ], ); // Products sale flash style $products_sale_flash = array( 'sale_flash' => array( 'type' => 'checkbox', 'label' => __pl('sale_flash'), 'default' => 'true', 'addAttr' => ['{{element}} .pagelayer-product-related-container' => 'pagelayer-sale-flash="{{sale_flash}}"'], ), 'flash_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} ul.products li.product span.onsale' => 'color: {{val}}'], 'req' => [ 'sale_flash' => 'true'], ), 'flash_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} ul.products li.product span.onsale' => 'background-color: {{val}}'], 'req' => [ 'sale_flash' => 'true'], ), 'flash_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} ul.products li.product span.onsale' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => [ 'sale_flash' => 'true'], ), 'flash_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => [ 'px', '%' ], 'screen' => 1, 'css' => ['{{element}} .ul.products li.product span.onsale' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};', ], 'req' => [ 'sale_flash' => 'true'], ), 'flash_width' => array( 'type' => 'slider', 'label' => __pl('width'), 'units' => [ 'px', '%' ], 'css' => ['{{element}} ul.products li.product span.onsale' => 'min-width: {{val}};'], 'req' => [ 'sale_flash' => 'true'], ), 'flash_height' => array( 'type' => 'slider', 'label' => __pl('height'), 'units' => [ 'px', '%' ], 'css' => ['{{element}} ul.products li.product span.onsale' => 'min-height: {{val}}; line-height: {{val}};'], 'req' => [ 'sale_flash' => 'true'], ), 'flash_distance' => array( 'type' => 'slider', 'label' => __pl('distance'), 'units' => [ 'px', '%' ], 'max' => 20, 'css' => ['{{element}} ul.products li.product span.onsale' => 'margin: {{val}};'], 'req' => [ 'sale_flash' => 'true'], ), 'flash_position' => array( 'type' => 'radio', 'label' => __pl('position'), 'list' => array( 'left' => __pl('left'), 'right' => __pl('right'), ), 'css' => ['{{element}} ul.products li.product span.onsale' => 'left:auto; right:auto; {{val}} : 0;'], 'req' => [ 'sale_flash' => 'true'], ), ); // Product related pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_product_related', array( 'name' => __pl('related_upsell_products'), 'group' => 'woocommerce', 'html' => '<div class="pagelayer-product-related-container"> {{related_products}} </div>', 'params' => array( 'select_product' => array( 'type' => 'select', 'label' => __pl('product_type'), 'default' => 'related', 'list' => array( 'related' => __pl('related'), 'upsell' => __pl('upsell'), ), ), 'posts_per_page' => array( 'type' => 'spinner', 'label' => __pl('products_per_page'), 'default' => 4, 'max' => 20, 'req' => ['select_product' => 'related'], ), 'columns' => array( 'type' => 'spinner', 'label' => __pl('columns'), 'screen' => 1, 'default' => 4, 'min' => 1, 'max' => 6, ), 'order_by' => array( 'type' => 'select', 'label' => __pl('order_by'), 'default' => 'date', 'list' => array( 'date' => __pl('date'), 'title' => __pl('title'), 'price' => __pl('price'), 'popularity' => __pl('popularity'), 'rating' => __pl('rating'), 'rand' => __pl('random'), 'menu_order' => __pl('menu_order'), ), ), 'order' => array( 'type' => 'select', 'label' => __pl('order'), 'default' => 'asc', 'list' => array( 'asc' => __pl('asc'), 'desc' => __pl('desc'), ), ), ), 'products_style' => $products_style, 'heading_style' => $products_heading, 'box_style' => $products_box, 'sale_flash_style' => $products_sale_flash, 'styles' =>[ 'products_style' => __pl('products_style'), 'heading_style' => __pl('heading_styles'), 'box_style' => __pl('box_style'), 'sale_flash_style' => __pl('sale_flash_style'), ], ) ); // woocommerce breadcrumb pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_woo_breadcrumb', array( 'name' => __pl('woo_breadcrumb'), 'group' => 'woocommerce', 'html' => '<div class="pagelayer-woo-breadcrumb-container">'. pagelayer_woo_breadcrumb() .'</div>', 'params' => array( 'color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .woocommerce-breadcrumb' => 'color:{{val}}'], ), 'link_color' => array( 'type' => 'color', 'label' => __pl('link_color'), 'css' => ['{{element}} .woocommerce-breadcrumb > a' => 'color:{{val}}'], ), 'typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .woocommerce-breadcrumb' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'css' => ['{{element}} .woocommerce-breadcrumb' => 'text-align:{{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), ), ), ) ); // Product pages pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_woo_pages', array( 'name' => __pl('woo_pages'), 'group' => 'woocommerce', 'html' => '<div class="pagelayer-product-pages-container">{{page_content}}</div>', 'params' => array( 'pages' => array( 'type' => 'select', 'label' => __pl('pages'), 'css' => ['{{element}} .woocommerce-breadcrumb' => 'color:{{val}}'], 'list' => array( '' => __pl( 'Select' ), 'woocommerce_cart' => __pl('cart_page'), //'product_page' => __pl('single_product_page'), 'woocommerce_checkout' => __pl('checkout_page'), 'woocommerce_order_tracking' => __pl('order_tracking_form'), 'woocommerce_my_account' => __pl('my_account'), ), ), ), ) ); // Product pages pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_product_categories', array( 'name' => __pl('product_categories'), 'group' => 'woocommerce', 'html' => '<div class="pagelayer-product-categories-container">{{product_categories}}</div>', 'params' => array( 'columns' => array( 'type' => 'spinner', 'label' => __pl('columns'), 'screen' => 1, 'default' => 4, 'max' => 12, ), 'number' => array( 'type' => 'spinner', 'label' => __pl('limit'), 'default' => 4, ), 'source' => array( 'type' => 'select', 'label' => __pl('source'), 'list' => array( '' => __pl('show_all'), 'by_id' => __pl('manual_selection'), 'by_parent' => __pl('by_parent'), 'current_subcategories' => __pl('current_subcategories'), ), ), 'by_id' => array( 'type' => 'multiselect', 'label' => __pl('categories'), 'list' => pagelayer_get_product_cat(), 'req' => ['source' => 'by_id'], ), 'parent' => array( 'type' => 'select', 'label' => __pl('parent'), 'list' => [ '0' => __pl('only_top_level') ] + pagelayer_get_product_cat(), 'req' => ['source' => 'by_parent'], ), 'hide_empty' => array( 'type' => 'checkbox', 'label' => __pl('hide_empty'), ), 'orderby' => array( 'type' => 'select', 'label' => __pl('order_by'), 'default' => 'name', 'list' => array( 'name' => __pl('name'), 'slug' => __pl('slug'), 'description' => __pl('description'), 'count' => __pl('count'), ), ), 'order' => array( 'type' => 'select', 'label' => __pl('order'), 'default' => 'desc', 'list' => array( 'asc' => __pl('asc'), 'desc' => __pl('desc'), ), ), ), 'products_style' => array( 'column_gap' => array( 'type' => 'slider', 'label' => __pl('column_gap'), 'units' => ['px', '%'], 'screen' => 1, 'default' => 20, 'step' => 0.2, 'max' => 100, 'css' => ['{{element}} ul.products li.product' => 'margin-right: {{val}}'], ), 'row_gap' => array( 'type' => 'slider', 'label' => __pl('row_gap'), 'units' => ['px', '%'], 'screen' => 1, 'default' => 20, 'step' => 0.2, 'max' => 100, 'css' => ['{{element}} ul.products li.product' => 'margin-bottom: {{val}}'], ), 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'css' => ['{{element}} ul.products li.product' => 'text-align:{{val}}'], ), 'img_lable' => array( 'type' => 'heading', 'label' => __pl('image'), ), 'img_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} a > img' => 'border-style: {{val}}', ], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'img_border_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} a > img' => 'border-color: {{val}}'], 'show' => ['!img_border_type' => ''], ), 'img_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} a > img' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px' ], 'req' => [ '!img_border_type' => '' ], ), 'img_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => [ 'px', '%' ], 'screen' => 1, 'css' => ['{{element}} a > img' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};', ], ), 'img_spacing' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'units' => [ 'px', '%' ], 'screen' => 1, 'css' => ['{{element}} a > img' => 'margin-bottom: {{val}}'], ), 'title_lable' => array( 'type' => 'heading', 'label' => __pl('title'), ), 'title_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .woocommerce-loop-category__title' => 'color: {{val}}'], ), 'title_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} .woocommerce-loop-category__title' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), 'title_spacing' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'units' => [ 'px', '%' ], 'screen' => 1, 'css' => [ '{{element}} .woocommerce-loop-category__title' => 'margin-bottom: {{val}}' ], ), 'count_lable' => array( 'type' => 'heading', 'label' => __pl('count'), ), 'count_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .woocommerce-loop-category__title .count' => 'color: {{val}}'], ), 'count_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} .woocommerce-loop-category__title .count' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), ), 'styles' =>[ 'products_style' => __pl('products_style'), ], ) ); // Archives Product pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_product_archives', array( 'name' => __pl('product_archives'), 'group' => 'woocommerce', 'html' => '<div class="pagelayer-product-archives-container">{{product_archives}}</div>', 'params' => array( 'allow_order' => array( 'type' => 'checkbox', 'label' => __pl('allow_order'), 'default' => 'true', ), 'show_result' => array( 'type' => 'checkbox', 'label' => __pl('show_result_counter'), 'default' => 'true', ), 'no_found' => array( 'type' => 'textarea', 'label' => __pl('no_found_msg'), 'default' => __pl('Products not found.'), ), ), 'products_style' => $products_style, 'box_style' => $products_box, 'sale_flash_style' => $products_sale_flash, 'pagination_style' => array( 'pagination_spacing' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'css' => ['{{element}} nav.woocommerce-pagination' => 'margin-top:{{val}}px'], ), 'pagination_border' => array( 'type' => 'checkbox', 'label' => __pl('border'), //'css' => ['{{element}} nav.woocommerce-pagination' => 'margin-top:{{val}}px'], ), 'pagination_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => [ '{{element}}nav.woocommerce-pagination ul' => 'border-color:{{val}}', '{{element}} nav.woocommerce-pagination ul li' => 'border-right-color: {{val}}; border-left-color: {{val}}', ], ), 'pagination_padding' => array( 'type' => 'slider', 'label' => __pl('padding'), 'screen' => 1, 'units' => [ 'em' ], 'min' => 0, 'max' => 4, 'step' => 0.1, 'css' => [ '{{element}} nav.woocommerce-pagination ul li a' => 'padding: {{val}}', '{{element}} nav.woocommerce-pagination ul li span' => 'padding: {{val}}' ], ), 'pagination_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} nav.woocommerce-pagination' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), 'pagination_colors' => array( 'type' => 'radio', 'label' => __pl('colors'), 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), 'active' => __pl('active'), ), ), 'pagination_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} nav.woocommerce-pagination ul li a' => 'color:{{val}}'], 'show' => ['pagination_colors' => 'normal'], ), 'pagination_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} nav.woocommerce-pagination ul li a' => 'background-color:{{val}}'], 'show' => ['pagination_colors' => 'normal'], ), 'pagination_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} nav.woocommerce-pagination ul li a:hover' => 'color:{{val}}'], 'show' => ['pagination_colors' => 'hover'], ), 'pagination_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} nav.woocommerce-pagination ul li a:hover' => 'background-color:{{val}}'], 'show' => ['pagination_colors' => 'hover'], ), 'pagination_color_active' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => [ '{{element}} nav.woocommerce-pagination ul li span.current' => 'color:{{val}};' ], 'show' => ['pagination_colors' => 'active'], ), 'pagination_bg_color_active' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} nav.woocommerce-pagination ul li span.current' => 'background-color:{{val}}'], 'show' => ['pagination_colors' => 'active'], ), ), 'no_found_style' => array( 'nf_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-product-no-found' => 'color:{{val}}'], ), 'nf_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} .pagelayer-product-no-found' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), ), 'styles' =>[ 'products_style' => __pl('products_style'), 'box_style' => __pl('box_style'), 'pagination_style' => __pl('pagination_style'), 'sale_flash_style' => __pl('sale_flash_style'), 'no_found_style' => __pl('no_found_style'), ], ) ); // Products pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_products', array( 'name' => __pl('products'), 'group' => 'woocommerce', 'html' => '<div class="pagelayer-products-container">{{products_content}}</div>', 'params' => array( 'columns' => array( 'type' => 'spinner', 'label' => __pl('columns'), 'screen' => 1, 'default' => 4, 'max' => 12, ), 'rows' => array( 'type' => 'spinner', 'label' => __pl('rows'), 'default' => 4, ), 'paginate' => array( 'type' => 'checkbox', 'label' => __pl('pagination'), ), 'allow_order' => array( 'type' => 'checkbox', 'label' => __pl('allow_order'), 'req' => ['paginate' => 'true'], ), 'show_result' => array( 'type' => 'checkbox', 'label' => __pl('show_result_counter'), 'req' => ['paginate' => 'true'], ), 'no_found' => array( 'type' => 'textarea', 'label' => __pl('no_found_msg'), 'default' => __pl('Products not found.'), ), ), 'query' => array( 'source' => array( 'type' => 'select', 'label' => __pl('source'), 'default' => 'recent_products', 'list' => array( 'pagelayer_current_query' => __pl('currunt_query'), 'recent_products' => __pl('recent_products'), 'sale_products' => __pl('sale_products'), 'best_selling_products' => __pl('best_selling_products'), 'top_rated_products' => __pl('top_rated_products'), 'featured_products' => __pl('featured_product'), 'by_id' => __pl('manual_selection'), ), ), 'ids' => array( 'type' => 'multiselect', 'label' => __pl('products'), 'list' => pagelayer_post_list_by_type('product'), 'req' => ['source' => 'by_id'], ), 'orderby' => array( 'type' => 'select', 'label' => __pl('order_by'), 'default' => 'date', 'list' => array( 'date' => __pl('date'), 'title' => __pl('title'), 'price' => __pl('price'), 'popularity' => __pl('popularity'), 'rating' => __pl('rating'), 'rand' => __pl('rand'), 'menu_order' => __pl('menu_order'), ), ), 'order' => array( 'type' => 'select', 'label' => __pl('order'), 'default' => 'ASC', 'list' => array( 'ASC' => __pl('ASC'), 'DESC' => __pl('DESC'), ), ), ), 'products_style' => $products_style, 'box_style' => $products_box, 'sale_flash_style' => $products_sale_flash, 'pagination_style' => array( 'pagination_spacing' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'css' => ['{{element}} nav.woocommerce-pagination' => 'margin-top:{{val}}px'], ), 'pagination_border' => array( 'type' => 'checkbox', 'label' => __pl('border'), //'css' => ['{{element}} nav.woocommerce-pagination' => 'margin-top:{{val}}px'], ), 'pagination_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => [ '{{element}}nav.woocommerce-pagination ul' => 'border-color:{{val}}', '{{element}} nav.woocommerce-pagination ul li' => 'border-right-color: {{val}}; border-left-color: {{val}}', ], ), 'pagination_padding' => array( 'type' => 'slider', 'label' => __pl('padding'), 'screen' => 1, 'units' => [ 'em' ], 'min' => 0, 'max' => 4, 'step' => 0.1, 'css' => [ '{{element}} nav.woocommerce-pagination ul li a' => 'padding: {{val}}', '{{element}} nav.woocommerce-pagination ul li span' => 'padding: {{val}}' ], ), 'pagination_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} nav.woocommerce-pagination' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), 'pagination_colors' => array( 'type' => 'radio', 'label' => __pl('colors'), 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), 'active' => __pl('active'), ), ), 'pagination_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} nav.woocommerce-pagination ul li a' => 'color:{{val}}'], 'show' => ['pagination_colors' => 'normal'], ), 'pagination_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} nav.woocommerce-pagination ul li a' => 'background-color:{{val}}'], 'show' => ['pagination_colors' => 'normal'], ), 'pagination_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} nav.woocommerce-pagination ul li a:hover' => 'color:{{val}}'], 'show' => ['pagination_colors' => 'hover'], ), 'pagination_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} nav.woocommerce-pagination ul li a:hover' => 'background-color:{{val}}'], 'show' => ['pagination_colors' => 'hover'], ), 'pagination_color_active' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => [ '{{element}} nav.woocommerce-pagination ul li span.current' => 'color:{{val}};' ], 'show' => ['pagination_colors' => 'active'], ), 'pagination_bg_color_active' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} nav.woocommerce-pagination ul li span.current' => 'background-color:{{val}}'], 'show' => ['pagination_colors' => 'active'], ), ), 'no_found_style' => array( 'nf_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-product-no-found' => 'color:{{val}}'], ), 'nf_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} .pagelayer-product-no-found' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), ), 'styles' =>[ 'query' => __pl('query'), 'products_style' => __pl('products_style'), 'box_style' => __pl('box_style'), 'pagination_style' => __pl('pagination_style'), 'sale_flash_style' => __pl('sale_flash_style'), 'no_found_style' => __pl('no_found_style'), ], ) ); // Product Archives description pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_product_archives_desc', array( 'name' => __pl('product_archives_desc'), 'group' => 'woocommerce', 'html' => '<div class="pagelayer-archives-desc-container">'. pagelayer_get_product_archives_desc() .'</div>', 'params' => array( 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'css' => ['{{element}} .pagelayer-archives-desc-container' => 'text-align:{{val}}'], ), 'color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .woocommerce-product-details__short-description' => 'color:{{val}}'], ), 'typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} .woocommerce-product-details__short-description' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), ), ) ); // Product Additional Information pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_product_addi_info', array( 'name' => __pl('product_addi_info'), 'group' => 'woocommerce', 'html' => '<div class="pagelayer-addi-info-container product">{{product_additional_info}}</div>', 'params' => array( 'color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.woocommerce {{element}} .shop_attributes' => 'color:{{val}}'], ), 'typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '.woocommerce {{element}} .shop_attributes' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), 'heading' => array( 'type' => 'checkbox', 'label' => __pl('heading_style'), 'default' => 'true', 'addAttr' => ['{{element}} .pagelayer-addi-info-container' => 'pagelayer-show-heading="{{heading}}"'], ), 'heading_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-addi-info-container h2' => 'color:{{val}}'], 'req' => ['heading' => 'true'], ), 'heading_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} .pagelayer-addi-info-container h2' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], 'req' => ['heading' => 'true'], ), ), ) ); // Product Additional Information pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_product_data_tabs', array( 'name' => __pl('product_data_tabs'), 'group' => 'woocommerce', 'html' => '<div class="pagelayer-data-tabs-container product">{{product_data_tab}}</div>', 'params' => array( 'tabs_colors' => array( 'type' => 'radio', 'label' => __pl('colors'), 'list' => array( 'normal' => __pl('normal'), 'active' => __pl('active'), ), ), 'tabs_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.woocommerce {{element}} .woocommerce-tabs ul.wc-tabs li:not(.active) a' => 'color:{{val}} !important;'], 'show' => ['tabs_colors' => 'normal'], ), 'tabs_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['.woocommerce {{element}} .woocommerce-tabs ul.wc-tabs li:not(.active)' => 'background-color:{{val}} !important;'], 'show' => ['tabs_colors' => 'normal'], ), 'tabs_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => [ '.woocommerce {{element}} .woocommerce-tabs ul.wc-tabs li:not(.active)' => 'border-color:{{val}}', '.woocommerce {{element}} .woocommerce-tabs .woocommerce-Tabs-panel' => 'border-color:{{val}}' ], 'show' => ['tabs_colors' => 'normal'], ), 'tabs_color_active' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.woocommerce {{element}} .woocommerce-tabs ul.wc-tabs li.active a' => 'color:{{val}} !important;'], 'show' => ['tabs_colors' => 'active'], ), 'tabs_bg_color_active' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['.woocommerce {{element}} .woocommerce-tabs ul.wc-tabs li.active' => 'background-color:{{val}} !important;'], 'show' => ['tabs_colors' => 'active'], ), 'tabs_border_color_active' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => [ '.woocommerce {{element}} .woocommerce-tabs .woocommerce-Tabs-panel' => 'border-color: {{val}}', '.woocommerce {{element}} .woocommerce-tabs ul.wc-tabs li.active' => 'border-color: {{val}} !important;' ], 'show' => ['tabs_colors' => 'active'], ), 'tabs_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => [ '.woocommerce {{element}} .woocommerce-tabs ul.wc-tabs li' => 'border-style: {{val}} !important', ], 'list' => [ '' => __pl('default'), 'none' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => ['tabs_colors' => 'normal'], ), 'tabs_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'css' => [ '.woocommerce {{element}} .woocommerce-tabs ul.wc-tabs li' => 'border-width: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px !important;', ], 'req' => [ '!tabs_border_type' => ['', 'none'], ], ), 'tabs_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '.woocommerce {{element}} .woocommerce-tabs ul.wc-tabs li a' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), 'border_radius' => array( 'type' => 'slider', 'label' => __pl('border_radius'), 'css' => ['.woocommerce {{element}} .woocommerce-tabs ul.wc-tabs li' => 'border-radius: {{val}}px !important;'], ), ), 'panel_style' => array( 'panel_color' => array( 'type' => 'color', 'label' => __pl('desc_color'), 'css' => ['.woocommerce {{element}} .woocommerce-tabs .woocommerce-Tabs-panel' => 'color: {{val}}'], ), 'panel_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '.woocommerce {{element}} .woocommerce-tabs .woocommerce-Tabs-panel' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), 'panel_heading' => array( 'type' => 'heading', 'label' => __pl('heading_style'), ), 'panel_heading_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.woocommerce {{element}} .woocommerce-tabs .woocommerce-Tabs-panel h2' => 'color: {{val}}'], ), 'panel_heading_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '.woocommerce {{element}} .woocommerce-tabs .woocommerce-Tabs-panel h2' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), 'panel_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['.woocommerce {{element}} .woocommerce-tabs .woocommerce-Tabs-panel' => 'border-style: {{val}}'], 'list' => [ '' => __pl('default'), 'none' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'panel_border_color' => array( 'type' => 'color', 'label' => __pl('border_color_label'), 'default' => '#42414f', 'css' => ['.woocommerce {{element}} .woocommerce-tabs .woocommerce-Tabs-panel' => 'border-color: {{val}} !important;'], 'req' => array( '!panel_border_type' => ['none'], ), ), 'panel_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'css' => ['.woocommerce {{element}} .woocommerce-tabs .woocommerce-Tabs-panel' => 'border-width: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px !important; margin-top: -{{val[0]}}px !important;'], 'req' => [ '!panel_border_type' => ['none'], ], ), 'panel_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'css' => [ '.woocommerce {{element}} .woocommerce-tabs .woocommerce-Tabs-panel' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;', '.woocommerce {{element}} .woocommerce-tabs ul.wc-tabs' => 'margin-left: {{val[0]}}px; margin-right: {{val[1]}};' ], ), 'panel_shadow' => array( 'type' => 'box_shadow', 'label' => __pl('box_shadow'), 'css' => ['.woocommerce {{element}} .woocommerce-tabs .woocommerce-Tabs-panel' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}};'], ), ), 'styles' => array( 'panel_style' => __pl('panel_style'), ), ) ); // WooCommerce Menu cart pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_woo_menu_cart', array( 'name' => __pl('woo_menu_cart'), 'group' => 'woocommerce', 'html' => '<div class="pagelayer-woo-menu-cart-container">{{cart_html}}</div>', 'params' => array( 'icon_type' => array( 'type' => 'select', 'label' => __pl('icon'), 'default' => 'fa fa-shopping-cart', 'list' => array( 'fa fa-shopping-cart' => __pl('cart'), 'fa fa-shopping-basket' => __pl('basket'), 'fa fa-shopping-bag' => __pl('bag'), ), ), 'items_indicator' => array( 'type' => 'select', 'label' => __pl('items_indicator'), 'default' => 'bubble', 'list' => array( '' => __pl('none'), 'bubble' => __pl('bubble'), 'plain' => __pl('plain'), ), 'addAttr' => [ '{{element}} .pagelayer-menu-cart-toggle' => 'pagelayer-icon="{{items_indicator}}"'], ), 'empty_indicator' => array( 'type' => 'checkbox', 'label' => __pl('empty_indicator'), 'addAttr' => ['{{element}} .pagelayer-menu-cart-toggle' => 'pagelayer-empty-indicator="{{empty_indicator}}"'], ), 'sub_total' => array( 'type' => 'checkbox', 'label' => __pl('hide_sub_total'), 'css' => ['{{element}} .pagelayer-cart-button-text' => 'display:none;'] ), 'cart_align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'left', 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'css' => [ '{{element}} .pagelayer-menu-cart-toggle' => 'text-align:{{val}}' ], ), ), 'mini_cart_style' => array( 'mini_cart_colors' => array( 'type' => 'radio', 'label' => '', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'mini_cart_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-cart-button' => 'color:{{val}}'], 'show' => ['mini_cart_colors' => 'normal'], ), 'cart_icon_color' => array( 'type' => 'color', 'label' => __pl('cart_icon_color'), 'css' => ['{{element}} .pagelayer-cart-button-icon' => 'color:{{val}}'], 'show' => ['mini_cart_colors' => 'normal'], ), 'mini_cart_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} .pagelayer-cart-button' => 'background-color:{{val}}'], 'show' => ['mini_cart_colors' => 'normal'], ), 'mini_cart_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['{{element}} .pagelayer-cart-button' => 'border-color:{{val}}'], 'show' => ['mini_cart_colors' => 'normal'], ), 'mini_cart_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-cart-button:hover' => 'color:{{val}}'], 'show' => ['mini_cart_colors' => 'hover'], ), 'cart_icon_color_hover' => array( 'type' => 'color', 'label' => __pl('cart_icon_color'), 'css' => ['{{element}} .pagelayer-cart-button-icon:hover' => 'color:{{val}}'], 'show' => ['mini_cart_colors' => 'hover'], ), 'cart_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} .pagelayer-cart-button:hover' => 'background-color:{{val}}'], 'show' => ['mini_cart_colors' => 'hover'], ), 'cart_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['{{element}} .pagelayer-cart-button:hover' => 'border-color:{{val}}'], 'show' => ['mini_cart_colors' => 'hover'], ), 'cart_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-cart-button' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'cart_border_width' => array( 'type' => 'slider', 'label' => __pl('border_width'), 'css' => ['{{element}} .pagelayer-cart-button' => 'border-width:{{val}}px'], 'req' => ['!cart_border_type' => ''], ), 'cart_border_radius' => array( 'type' => 'slider', 'label' => __pl('border_radius'), 'units' => [ 'px', 'em', '%' ], 'css' => ['{{element}} .pagelayer-cart-button' => 'border-radius:{{val}}'], ), 'cart_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} .pagelayer-cart-button' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), 'mini_cart_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'units' => [ 'px', 'em', '%' ], 'css' => ['{{element}} .pagelayer-cart-button' => 'padding: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], ), 'mini_cart_icon' => array( 'type' => 'heading', 'label' => __pl('icon'), ), 'mini_icon_size' => array( 'type' => 'slider', 'label' => __pl('size'), 'units' => [ 'px', 'em' ], 'css' => ['{{element}} .pagelayer-cart-button-icon' => 'font-size:{{val}}'], ), 'mini_icon_spacing' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'units' => [ 'px', 'em' ], 'min' => 0, 'max' => 50, 'css' => [ 'body:not(.rtl) {{element}} .pagelayer-cart-button-text' => 'margin-right: {{val}}', 'body.rtl {{element}} .pagelayer-cart-button-text' => 'margin-left: {{val}}', ], ), 'mini_bubble_icon' => array( 'type' => 'heading', 'label' => __pl('bubble'), 'req' => ['items_indicator' => 'bubble'], ), 'bubble_colors' => array( 'type' => 'radio', 'label' => '', 'default' => 'normal', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), 'req' => ['items_indicator' => 'bubble'], ), 'bubble_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} [pagelayer-icon="bubble"] .pagelayer-cart-button-icon[data-counter]:before' => 'color:{{val}}'], 'show' => ['bubble_colors' => 'normal'], ), 'bubble_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} [pagelayer-icon="bubble"] .pagelayer-cart-button-icon[data-counter]:before' => 'background-color:{{val}}'], 'show' => ['bubble_colors' => 'normal'], ), 'bubble_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} [pagelayer-icon="bubble"] .pagelayer-cart-button-icon[data-counter]:hover:before' => 'color:{{val}}'], 'show' => ['bubble_colors' => 'hover'], ), 'bubble_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} [pagelayer-icon="bubble"] .pagelayer-cart-button-icon[data-counter]:hover:before' => 'background-color:{{val}}'], 'show' => ['bubble_colors' => 'hover'], ), ), 'container_style' => array( 'container_position' => array( 'type' => 'select', 'label' => __pl('container_position'), 'default' => 'fixed_right', 'list' => array( 'fixed_right' => __pl('fixed_right'), 'fixed_left' => __pl('fixed_left'), 'dropdown' => __pl('dropdown'), ), 'addAttr' => [ '{{element}} .pagelayer-woo-menu-cart-container' => 'pagelayer-container-position="{{container_position}}"'], ), 'container_align' => array( 'type' => 'radio', 'label' => __pl('position'), 'default' => 'left', 'list' => array( 'left' => __pl('left'), 'right' => __pl('right'), ), 'css' => ['{{element}} .pagelayer-menu-cart-container' => '{{val}}:0 !important;'], 'req' => ['container_position' => 'dropdown'], ), 'cart_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-menu-cart-container' => 'color:{{val}}'] ), 'cart_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} .pagelayer-menu-cart-container' => 'background-color:{{val}}'] ), 'container_close' => array( 'type' => 'slider', 'label' => __pl('container_close_size'), 'css' => ['{{element}} .pagelayer-menu-cart-close' => 'font-size:{{val}}px;'] ), 'container_width' => array( 'type' => 'slider', 'label' => __pl('width'), 'screen' => 1, 'units' => ['px', '%'], 'css' => ['{{element}} .pagelayer-menu-cart-container' => 'width:{{val}};'] ), 'sub_total_label' => array( 'type' => 'heading', 'label' => __pl('sub_total'), ), 'sub_total_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .woocommerce-mini-cart__total' => 'color: {{val}}'], ), 'sub_total_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} .woocommerce-mini-cart__total' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), ), 'products_style' => array( 'products_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .woocommerce-mini-cart > .woocommerce-mini-cart-item' => 'color:{{val}}'] ), 'products_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} .woocommerce-mini-cart > .woocommerce-mini-cart-item' => 'background-color:{{val}}'] ), 'products_list_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'units' => [ 'px', 'em'], 'css' => ['{{element}} .woocommerce-mini-cart > .woocommerce-mini-cart-item' => 'padding: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}} !important;'], ), 'img_label' => array( 'type' => 'heading', 'label' => __pl('image'), ), 'products_img_width' => array( 'type' => 'slider', 'label' => __pl('width'), 'default' => '50px', 'units' => ['px', 'em', '%'], 'css' => ['{{element}} .woocommerce-mini-cart-item img' => 'width: {{val}}'], ), 'title_label' => array( 'type' => 'heading', 'label' => __pl('product_title'), ), 'products_title_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .woocommerce-mini-cart-item a' => 'color: {{val}}'], ), 'products_title_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} .woocommerce-mini-cart-item a' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), 'price_label' => array( 'type' => 'heading', 'label' => __pl('product_price'), ), 'products_price_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .woocommerce-mini-cart-item .quantity' => 'color: {{val}}'], ), 'products_price_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} .woocommerce-mini-cart-item .quantity' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), 'remove_label' => array( 'type' => 'heading', 'label' => __pl('remove_items'), ), 'remove_icon_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .remove_from_cart_button' => 'color: {{val}} !important'], ), 'remove_icon_size' => array( 'type' => 'slider', 'label' => __pl('size'), 'css' => ['{{element}} .remove_from_cart_button' => 'font-size: {{val}}px'], ), ), 'buttons_style' => array( 'button_display' => array( 'type' => 'select', 'label' => __pl('display'), 'default' => 'inline', 'list' => array( 'inline' => __pl('inline'), 'block' => __pl('block'), ), 'css' => ['{{element}} .woocommerce-mini-cart__buttons a' => 'display: {{val}}'], 'addAttr' => ['{{element}} .woocommerce-mini-cart__buttons' => 'pagelayer-display="{{button_display}}"'], ), 'space_between_btn' => array( 'type' => 'slider', 'label' => __pl('space_between'), 'default' => 5, 'css' => [ '{{element}} .woocommerce-mini-cart__buttons[pagelayer-display="inline"] a' => 'margin-left: {{val}}px', '{{element}} .woocommerce-mini-cart__buttons[pagelayer-display="block"] a' => 'margin-bottom: {{val}}px' ], ), 'btn_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'units' => [ 'px', 'em'], 'default' => '5,5,5,5', 'css' => ['{{element}} .woocommerce-mini-cart__buttons a' => 'padding: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}} !important;'], ), 'btn_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} .woocommerce-mini-cart__buttons' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;' ], ), 'btn_border_radius' => array( 'type' => 'slider', 'label' => __pl('border_radius'), 'units' => [ 'px', 'em'], 'default' => '50', 'css' => ['{{element}} .woocommerce-mini-cart__buttons a' => 'border-radius: {{val}} !important'], ), 'btn_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .woocommerce-mini-cart__buttons a' => 'color: {{val}}'], ), 'btn_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#585757', 'css' => ['{{element}} .woocommerce-mini-cart__buttons a' => 'background-color: {{val}}'], ), 'btn_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .woocommerce-mini-cart__buttons a' => 'border-style: {{val}} !important'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'btn_border_color' => array( 'type' => 'color', 'label' => __pl('border_color_label'), 'default' => '#42414f', 'css' => ['{{element}} .woocommerce-mini-cart__buttons a' => 'border-color: {{val}} !important'], 'req' => array( '!btn_border_type' => '' ), ), 'btn_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .woocommerce-mini-cart__buttons a' => 'border-width: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px !important'], 'req' => [ '!btn_border_type' => '' ], ), ), 'styles' => array( 'mini_cart_style' => __pl('mini_cart_style'), 'container_style' => __pl('container_style'), 'products_style' => __pl('products_style'), 'buttons_style' => __pl('buttons_style'), ), ) ); }// class_exists('woocommerce') end // Popup Settings pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_popup', array( 'name' => __pl('Popup Layout'), 'group' => 'other', 'not_visible' => 1, 'no_gt' => 1, 'icon' => 'fas fa-sort-amount-up-alt', 'overide_css_selector' => '[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-modal-content', 'hide_active' => 1, 'skip_props_cat' => ['position_styles', 'animation_styles', 'responsive_styles'], 'skip_props' => ['ele_zindex', 'ele_shadow', 'border_shadow_hover', 'hide_desktop', 'hide_tablet', 'hide_mobile', 'ele_sticky_pos'], 'params' => array( 'post_popup_width' => array( 'type' => 'slider', 'label' => __pl('width'), 'default' => '50', 'screen' => 1, 'units' => ['%', 'px'], 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-modal-content' => 'width:{{val}}'], ), 'post_popup_height' => array( 'type' => 'slider', 'label' => __pl('height'), 'screen' => 1, 'units' => ['%', 'px', 'vh'], 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-modal-content' => 'height:{{val}}'], ), 'popup_position' => array( 'type' => 'heading', 'label' => __pl('position'), ), 'popup_hori_position' => array( 'type' => 'radio', 'label' => __pl('horizontal'), 'list' => array( 'flex-start' => __pl('left'), 'center' => __pl('center'), 'flex-end' => __pl('right'), ), 'css' => ['[pagelayer-popup-id="{{ele_id}}"]' => 'justify-content:{{val}}'], ), 'popup_ver_position' => array( 'type' => 'radio', 'label' => __pl('vertical'), 'list' => array( 'flex-start' => __pl('top'), 'center' => __pl('center'), 'flex-end' => __pl('bottom'), ), 'css' => ['[pagelayer-popup-id="{{ele_id}}"]' => 'align-items:{{val}}'], ), 'popup_animation' => array( 'type' => 'select', 'label' => __pl('animation'), 'default' => '', 'addClass' => ['{{val}}',( !pagelayer_is_live() ? 'pagelayer-wow' : '' )], 'addAttr' => 'data-popup_animation="{{popup_animation}}', 'list' => $pagelayer->anim_in_options, ), 'popup_animation_delay' => [ 'type' => 'spinner', 'label' => __pl('animation_delay'), 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-modal-content' => '-webkit-animation-delay: {{val}}ms; animation-delay: {{val}}ms;'], 'default' => 600, 'min' => 0, 'max' => 90000, 'step' => 100, 'req' => [ '!popup_animation' => '' ] ], ), 'popup_styles' => array( 'popup_content_back' => array( 'type' => 'radio', 'label' => __pl('bg_color'), 'list' => array( 'color' => __pl('color'), 'gradient' => __pl('gradient'), ), ), 'popup_content_bg' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-modal-content' => 'background-color:{{val}}'], 'req' => [ 'popup_content_back' => 'color'], ), 'popup_content_bg_gradient' => [ 'type' => 'gradient', 'label' => '', 'default' => '150,#44d3f6ff,23,#72e584ff,45,#2ca4ebff,100', 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-modal-content' => 'background: linear-gradient({{val[0]}}deg, {{val[1]}} {{val[2]}}%, {{val[3]}} {{val[4]}}%, {{val[5]}} {{val[6]}}%);'], 'req' => ['popup_content_back' => 'gradient'], ], 'popup_border_type' => [ 'type' => 'select', 'label' => __pl('border_type'), 'screen' => 1, 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-modal-content' => 'border-style: {{val}}'], ], 'popup_border_width' => [ 'type' => 'padding', 'label' => __pl('border_width'), 'default' => '1,1,1,1', 'units' => ['px', 'em'], 'screen' => 1, 'req' => [ '!popup_border_type' => '' ], 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-modal-content' => 'border-top-width: {{val[0]}}; border-right-width: {{val[1]}}; border-bottom-width: {{val[2]}}; border-left-width: {{val[3]}}'], ], 'popup_border_color' => [ 'type' => 'color', 'label' => __pl('border_color'), 'default' => '#CCC', 'screen' => 1, 'req' => [ '!popup_border_type' => '' ], 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-modal-content' => 'border-color: {{val}}'], ], 'popup_border_radius' => [ 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => ['px', 'em', '%'], 'screen' => 1, 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-modal-content' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], ], 'popup_shadow' => [ 'type' => 'box_shadow', 'label' => __pl('shadow'), 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-modal-content' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}} !important;'], ] ), 'overlay' => array( 'popup_overlay' => array( 'type' => 'checkbox', 'label' => __pl('enable_overlay'), 'default' => true, 'css' => ['[pagelayer-popup-id="{{ele_id}}"]' => 'pointer-events: all'], ), 'popup_overlay_back' => array( 'type' => 'radio', 'label' => __pl('bg_color'), 'default' => 'bg_color', 'list' => array( 'bg_color' => __pl('color'), 'gradient' => __pl('gradient'), ), 'req' => [ 'popup_overlay' => 'true'], ), 'popup_overlay_bg' => array( 'type' => 'color', 'default' => '#000000cc', 'label' => __pl('bg_color'), 'css' => ['[pagelayer-popup-id="{{ele_id}}"]' => 'background-color:{{val}}'], 'req' => [ 'popup_overlay_back' => 'bg_color', 'popup_overlay' => 'true'], ), 'popup_overlay_bg_gradient' => [ 'type' => 'gradient', 'label' => '', 'default' => '150,#44d3f6ff,23,#72e584ff,45,#2ca4ebff,100', 'css' => ['[pagelayer-popup-id="{{ele_id}}"]' => 'background: linear-gradient({{val[0]}}deg, {{val[1]}} {{val[2]}}%, {{val[3]}} {{val[4]}}%, {{val[5]}} {{val[6]}}%);'], 'req' => ['popup_overlay_back' => 'gradient', 'popup_overlay' => 'true'], ], ), 'close_button' => array( 'popup_overlay_close' => array( 'type' => 'checkbox', 'label' => __pl('close_by_overlay'), 'addAttr' => 'data-overlay_close="{{popup_overlay_close}}"', 'css' => ['[pagelayer-popup-id="{{ele_id}}"]' => 'pointer-events: all'], ), 'popup_sel_close' => array( 'type' => 'checkbox', 'label' => __pl('close_by_selector'), ), 'popup_selector_close' => array( 'type' => 'text', 'label' => __pl('ele_selector'), 'addAttr' => 'data-selector_close="{{popup_selector_close}}"', 'req' => [ 'popup_sel_close' => 'true'], ), 'popup_cbtn' => array( 'type' => 'checkbox', 'label' => __pl('close_button'), 'default' => true, 'addAttr' => 'data-popup_cbtn="{{popup_cbtn}}"', 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-close' => 'display:block'], ), 'popup_cbtn_position' => array( 'type' => 'select', 'label' => __pl('position'), 'default' => 'inside', 'list' => array( 'inside' => __pl('inside'), 'outside' => __pl('outside'), ), 'show' => [ 'popup_cbtn' => 'true'], 'addAttr' => 'data-popup_cbtn_position="{{popup_cbtn_position}}"', ), 'popup_cbtn_v_position' => array( 'type' => 'slider', 'label' => __pl('verticle_postion'), 'screen' => 1, 'units' => ['%', 'px'], 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-close' => 'top:{{val}}'], 'show' => [ 'popup_cbtn' => 'true'], ), 'popup_cbtn_h_position' => array( 'type' => 'slider', 'label' => __pl('horizontal_pos'), 'screen' => 1, 'units' => ['%', 'px'], 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-close' => 'left:{{val}}'], 'show' => [ 'popup_cbtn' => 'true'], ), 'popup_cbtn_size' => array( 'type' => 'slider', 'label' => __pl('size'), 'screen' => 1, 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-close' => 'font-size:{{val}}px'], 'show' => [ 'popup_cbtn' => 'true'], ), 'popup_cbtn_colors' => array( 'type' => 'radio', 'label' => __pl('colors'), 'default' => 'normal', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), 'show' => [ 'popup_cbtn' => 'true'], ), 'popup_cbtn_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-close' => 'color:{{val}}'], 'show' => [ 'popup_cbtn_colors' => 'normal', 'popup_cbtn' => 'true'], ), 'popup_cbtn_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-close' => 'background-color:{{val}}'], 'show' => [ 'popup_cbtn_colors' => 'normal', 'popup_cbtn' => 'true'], ), 'popup_cbtn_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-close:hover' => 'color:{{val}}'], 'show' => [ 'popup_cbtn_colors' => 'hover', 'popup_cbtn' => 'true'], ), 'popup_cbtn_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-close:hover' => 'background-color:{{val}}'], 'show' => [ 'popup_cbtn_colors' => 'hover', 'popup_cbtn' => 'true'], ), 'popup_cbtn_border_type' => [ 'type' => 'select', 'label' => __pl('border_type'), 'screen' => 1, 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => [ 'popup_cbtn' => 'true'], 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-close' => 'border-style: {{val}}'], ], 'popup_cbtn_border_width' => [ 'type' => 'padding', 'label' => __pl('border_width'), 'default' => '1,1,1,1', 'units' => ['px', 'em'], 'screen' => 1, 'show' => [ 'popup_cbtn' => 'true'], 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-close' => 'border-top-width: {{val[0]}}; border-right-width: {{val[1]}}; border-bottom-width: {{val[2]}}; border-left-width: {{val[3]}}'], ], 'popup_cbtn_border_color' => [ 'type' => 'color', 'label' => __pl('border_color'), 'default' => '#CCC', 'screen' => 1, 'show' => [ 'popup_cbtn' => 'true'], 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-close' => 'border-color: {{val}}'], ], 'popup_cbtn_border_radius' => [ 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => ['px', 'em', '%'], 'screen' => 1, 'show' => [ 'popup_cbtn' => 'true'], 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-close' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], ], 'popup_cbtn_border_padding' => [ 'type' => 'padding', 'label' => __pl('padding'), 'units' => ['px', 'em', '%'], 'screen' => 1, 'show' => [ 'popup_cbtn' => 'true'], 'css' => ['[pagelayer-popup-id="{{ele_id}}"] .pagelayer-popup-close' => 'padding: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], ], ), 'action_triggers' => array( 'trig_click' => array( 'type' => 'checkbox', 'label' => __pl('trig_onclick'), 'addAttr' => 'data-trig_click="{{trig_click}}"', ), 'trig_click_ele' => array( 'type' => 'text', 'label' => __pl('ele_selector'), 'addAttr' => 'data-trig_click_ele="{{trig_click_ele}}"', 'req' => [ 'trig_click' => 'true'], ), 'trig_load' => array( 'type' => 'checkbox', 'label' => __pl('trig_onload'), 'addAttr' => 'data-trig_load="{{trig_load}}"', ), 'trig_load_sec' => array( 'type' => 'spinner', 'label' => __pl('within_sec'), 'min' => 1, 'step' => 0.1, 'req' => [ 'trig_load' => 'true'], 'addAttr' => 'data-trig_load_sec="{{trig_load_sec}}"', ), 'trig_scroll' => array( 'type' => 'checkbox', 'label' => __pl('trig_onscroll'), 'addAttr' => 'data-trig_scroll="{{trig_scroll}}"', ), 'trig_scroll_dir' => array( 'type' => 'select', 'label' => __pl('scroll_direction'), 'default' => 'down', 'list' => array( 'down' => __pl('down'), 'up' => __pl('up'), ), 'addAttr' => 'data-trig_scroll_dir="{{trig_scroll_dir}}"', 'req' => [ 'trig_scroll' => 'true'], ), 'trig_scroll_per' => array( 'type' => 'spinner', 'label' => __pl('within_per'), 'min' => 1, 'step' => 1, 'max' => 100, 'req' => ['trig_scroll' => 'true', 'trig_scroll_dir' => 'down'], 'addAttr' => 'data-trig_scroll_per="{{trig_scroll_per}}"', ), 'trig_scroll_to_ele' => array( 'type' => 'checkbox', 'label' => __pl('trig_onscroll_to_ele'), 'addAttr' => 'data-trig_scroll_to_ele="{{trig_scroll_to_ele}}"', ), 'trig_scroll_to_ele_sel' => array( 'type' => 'text', 'label' => __pl('ele_selector'), 'req' => [ 'trig_scroll_to_ele' => 'true'], 'addAttr' => 'data-trig_scroll_to_ele_sel="{{trig_scroll_to_ele_sel}}"', ), 'trig_page_exit_intent' => array( 'type' => 'checkbox', 'label' => __pl('trig_onpage_exit_intent'), 'addAttr' => 'data-trig_page_exit_intent="{{trig_page_exit_intent}}"', ), 'trig_before_load' => array( 'type' => 'checkbox', 'label' => __pl('trig_beforeLoad'), 'addAttr' => 'data-trig_before_load="{{trig_before_load}}"', 'desc' => __pl('popup_load_desc') ), ), 'advance_options' => array( 'popup_multi_time' => array( 'type' => 'checkbox', 'label' => __pl('popup_multi_time'), 'addAttr' => 'data-popup_multi_time="{{popup_multi_time}}"', ), 'popup_cookie_session' => array( 'type' => 'checkbox', 'label' => __pl('popup_cookie_session'), 'addAttr' => 'data-popup_cookie_session="{{popup_cookie_session}}"', ), 'popup_cookie_close' => array( 'type' => 'checkbox', 'label' => __pl('popup_cookie_close'), 'addAttr' => 'data-popup_cookie_close="1"', 'req' => ['popup_cookie_session' => 'true'] ), 'popup_cookie_selector' => array( 'type' => 'text', 'label' => __pl('popup_cookie_selector'), 'desc' => __pl('popup_cookie_selector_exp'), 'addAttr' => 'data-popup_cookie_selector="{{popup_cookie_selector}}"', 'req' => ['popup_cookie_session' => 'true'] ), 'popup_cookie_name' => array( 'type' => 'text', 'label' => __pl('popup_cookie_name'), 'default' => '', // Make it blank to assigned from live.php 'addAttr' => 'data-popup_cookie_name="{{popup_cookie_name}}"', 'req' => ['popup_cookie_session' => 'true'] ), 'popup_cookie_exp' => array( 'type' => 'text', 'label' => __pl('popup_cookie_exp'), 'default' => 30, 'addAttr' => 'data-popup_cookie_exp="{{popup_cookie_exp}}"', 'req' => ['popup_cookie_session' => 'true'] ), 'popup_auto_close' => array( 'type' => 'spinner', 'label' => __pl('auto_close'), 'addAttr' => 'data-popup_auto_close="{{popup_auto_close}}"', ), ), 'styles' => array( 'popup_styles' => __pl('popup_styles'), 'overlay' => __pl('overlay'), 'close_button' => __pl('close_style'), 'action_triggers' => __pl('action_triggers'), 'advance_options' => __pl('advance_options'), ), ) ); // Timeline widget pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_timeline', array( 'name' => __pl('timeline'), 'group' => 'other', 'icon' => 'fas fa-stream', 'has_group' => [ 'section' => 'params', 'prop' => 'elements' ], 'holder' => '.pagelayer-timeline', 'innerHTML' => 'text', 'html' => '<div class="pagelayer-timeline"> </div>', 'params' => array( 'elements' => array( 'type' => 'group', 'label' => __pl('timeline_item'), 'sc' => PAGELAYER_SC_PREFIX.'_timeline_item', 'item_label' => array( 'default' => __pl('timeline_item'), 'param' => 'text' ), 'count' => 2, 'text' => __pl('add_timeline_item'), ), 'timeline_centerline_bg_color' => array( 'type' => 'color', 'label' => __pl('seperator_color'), 'default' => 'grey', 'css' => ['{{element}} .pagelayer-timeline::after' => 'background-color: {{val}};'], ), 'vindent' => array( 'type' => 'spinner', 'label' => __pl('space_between_col'), 'min' => 10, 'step' => 1, 'max' => 100, 'default' => 20, 'screen' => 1, 'css' => ['{{element}} .pagelayer-timeline-container' => 'padding-top:{{val}}px; padding-bottom:{{val}}px;'], ) ), )); // Timeline items pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_timeline_item', array( 'name' => __pl('timeline_item'), 'icon' => 'fas fa-stream', 'not_visible' => 1, 'parent' => [PAGELAYER_SC_PREFIX.'_timeline'], 'html' => '<div class="pagelayer-timeline-container pagelayer-timeline-{{side}}"> <div class="pagelayer-timeline-container-left"> <div class="pagelayer-timeline-content"> <div if={{left_heading_text}} class="pagelayer-heading-holder">{{left_heading_text}}</div> <div if={{left_paragraph_text}} class="pagelayer-text-holder">{{left_paragraph_text}}</div> </div> </div> <div class="pagelayer-timeline-center-circle-container"> <div class="pagelayer-timeline-center-circle"> <i if="{{timeline_circle_icon}}" class="{{timeline_circle_icon}} pagelayer-timeline-circle-icon"></i> <div if="{{timeline_circle_text}}" class="pagelayer-text-holder pagelayer-timeline-circle-text">{{timeline_circle_text}}</div> </div> </div> <div class="pagelayer-timeline-container-right"> <div class="pagelayer-timeline-content"> <div if={{right_heading_text}} class="pagelayer-heading-holder">{{right_heading_text}}</div> <div if={{right_paragraph_text}} class="pagelayer-text-holder">{{right_paragraph_text}}</div> </div> </div> </div>', 'params' => array( 'text' => array( 'type' => 'text', 'label' => __pl('text'), 'default' => __pl('timeline_item') ), 'side' => array( 'label' => __pl('side'), 'type' => 'radio', 'default' => 'both', 'list' => array( 'left' => __pl('left'), 'right' => __pl('right'), 'both' => __pl('both') ) ), 'hindent' => array( 'type' => 'spinner', 'label' => __pl('icon_spacing'), 'screen' => 1, 'step' => 1, 'min' => 0, 'max' => 40, 'default' => 5, 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => 'margin-right:{{val}}px;', '{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => 'margin-left:{{val}}px;'], ) ), 'timeline_circle' => [ 'timeline_pos_y' => array( 'label' => __pl('verticle_postion'), 'type' => 'slider', 'step' => 1, 'min' => 0, 'max' => 80, 'default' => 20, 'screen' => 1, 'units' => ['%'], 'css' => ['{{element}} .pagelayer-timeline-center-circle' => 'top: {{val}};'], ), 'timeline_circle_radius' => array( 'type' => 'slider', 'label' => __pl('radius'), 'screen' => 1, 'step' => 1, 'min' => 20, 'max' => 70, 'default' => 40, 'units' => ['px'], 'css' => ['{{element}} .pagelayer-timeline-center-circle' => 'width:{{val}}; height:{{val}}; left:calc(50% - {{val}}/2);'], ), 'timeline_circle_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} .pagelayer-timeline-center-circle' => 'background-color: {{val}};'], ), 'timeline_circle_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'screen' => 1, 'default' => 'solid', 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'css' => ['{{element}} .pagelayer-timeline-center-circle'=> 'border-style: {{val}}'], ), 'timeline_circle_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'default' => '4,4,4,4', 'units' => ['px', 'em'], 'screen' => 1, 'req' => [ '!timeline_circle_border_type' => '' ], 'css' =>['{{element}} .pagelayer-timeline-center-circle' => 'border-top-width: {{val[0]}}; border-right-width: {{val[1]}}; border-bottom-width: {{val[2]}}; border-left-width: {{val[3]}}'], ), 'timeline_circle_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'default' => '#000', 'screen' => 1, 'req' => [ '!timeline_circle_border_type' => '' ], 'css' =>['{{element}} .pagelayer-timeline-center-circle' => 'border-color: {{val}}'], ), 'timeline_circle_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => ['px', 'em', '%'], 'screen' => 1, 'show' => ['timeline_circle_border_hover' => ''], 'req' => [ '!timeline_circle_border_type' => '' ], 'default' => '50,50,50,50', 'css' =>['{{element}} .pagelayer-timeline-center-circle' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], ), 'timeline_circle_icon' => array( 'type' => 'icon', 'label' => __pl('service_box_font_icon_label'), 'default' => '', ), 'timeline_circle_icon_size' => array( 'label' => __pl('icon_size'), 'type' => 'slider', 'step' => 1, 'min' => 5, 'max' => 40, 'default' => 10, 'screen' => 1, 'units' => ['px'], 'css' => ['{{element}} .pagelayer-timeline-center-circle .pagelayer-timeline-circle-icon' => 'font-size:{{val}}'], 'show' => ['!timeline_circle_icon' => ''], ), 'timeline_circle_icon_color' => array( 'type' => 'color', 'label' => __pl('icon_color'), 'show' => ['!timeline_circle_icon' => ''], 'css' => ['{{element}} .pagelayer-timeline-center-circle .pagelayer-timeline-circle-icon' => 'color: {{val}};'], ), 'timeline_circle_text' => array( 'type' => 'editor', 'label' => __pl('text'), 'default' => '', 'desc' => __pl('Edit the content here or edit directly in the Editor'), 'edit' => '.pagelayer-timeline-circle-text', // Edit the text and also mirror the same 'keep_prop' => 1 ) ], // timeline left part code starts 'left' => [ 'left_heading_text' => array( 'type' => 'textarea', 'label' => __pl('heading_name'), 'default' => '<h2>1998</h2>', 'desc' => __pl('Edit the heading here'), 'edit' => '.pagelayer-timeline-container-left .pagelayer-timeline-content .pagelayer-heading-holder', // Edit the text and also mirror the same 'req' => ['side' => ['both','left']], ), 'left_paragraph_text' => array( 'type' => 'editor', 'label' => __pl('text'), 'default' => 'Lorem ipsum dolor sit amet', 'desc' => __pl('Edit the content here or edit directly in the Editor'), 'edit' => '.pagelayer-timeline-container-left .pagelayer-timeline-content .pagelayer-text-holder', // Edit the text and also mirror the same 'req' => ['side' => ['both','left']] ), 'left_align' => array( 'label' => __pl('content_align'), 'type' => 'radio', 'addAttr' => 'align="{{align}}"', 'screen' => 1, 'default' => 'left', 'css' => ['{{element}} .pagelayer-timeline-container-left' => 'text-align: {{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ), 'req' => ['side' => ['both','left']] ), 'left_part_width' => array( 'type' => 'spinner', 'label' => __pl('width'), 'screen' => 1, 'step' => 1, 'min' => 0, 'max' => 100, 'default' => 90, 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => 'width:{{val}}%'], ), 'left_heading_state' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => 'normal', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), 'req' => ['side' => ['both','light']] ), 'left_color' => array( 'type' => 'color', 'label' => __pl('heading_color'), 'default' => '#111111', 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-heading-holder *' => 'color:{{val}}'], 'show' => ['left_heading_state' => 'normal'] ), 'left_heading_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-heading-holder *' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', '{{element}} .pagelayer-timeline-container-left .pagelayer-heading-holder' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'show' => ['left_heading_state' => 'normal'] ), 'left_heading_text_shadow' => array( 'type' => 'shadow', 'label' => __pl('text_shadow'), 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-heading-holder' => 'text-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}} !important;'], 'show' => ['left_heading_state' => 'normal'] ), 'left_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-heading-holder:hover *' => 'color:{{val}}', '{{element}} .pagelayer-timeline-container-left .pagelayer-heading-holder:hover' => 'color:{{val}}'], 'show' => ['left_heading_state' => 'hover'] ), 'left_heading_typo_hover' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-heading-holder:hover *' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', '{{element}} .pagelayer-timeline-container-left .pagelayer-heading-holder:hover' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'show' => ['left_heading_state' => 'hover'] ), 'left_heading_text_shadow_hover' => array( 'type' => 'shadow', 'label' => __pl('text_shadow'), 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-heading-holder:hover' => 'text-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}} !important;'], 'show' => ['left_heading_state' => 'hover'] ), 'left_bg_hover' => array( 'type' => 'radio', 'label' => __pl('row_bg_styles'), 'default' => '', 'list' => [ '' => __pl('normal'), 'hover' => __pl('hover'), ], 'req' => ['side' => ['both','left']] ), 'left_bg_type' => array( 'type' => 'radio', 'label' => __pl('background_type'), 'default' => '', 'list' => [ '' => __pl('none'), 'color' => __pl('color'), 'gradient' => __pl('gradient'), 'image' => __pl('image'), ], 'show' => ['left_bg_hover' => ''] ), 'left_bg_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => 'background-color: {{val}};'], 'show' => ['left_bg_hover' => ''], 'req' => ['left_bg_type' => 'color'] ), 'left_timeline_gradient' => array( 'type' => 'gradient', 'label' => '', 'default' => '150,#44d3f6,23,#72e584,45,#2ca4eb,100', 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => 'background: linear-gradient({{val[0]}}deg, {{val[1]}} {{val[2]}}%, {{val[3]}} {{val[4]}}%, {{val[5]}} {{val[6]}}%);'], 'show' => ['left_bg_hover' => ''], 'req' => ['left_bg_type' => 'gradient'] ), 'left_img_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '', 'desc' => __pl('fallback_color'), 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => 'background-color: {{val}};'], 'show' => ['left_bg_hover' => ''], 'req' => ['left_bg_type' => 'image'] ), 'left_bg_img' => array( 'type' => 'image', 'label' => __pl('image'), 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => 'background-image: url("{{{left_bg_img-url}}}");'], 'show' => ['left_bg_hover' => ''], 'req' => ['left_bg_type' => 'image'] ), 'left_bg_attachment' => array( 'type' => 'select', 'label' => __pl('bg_attachment'), 'list' => [ '' => __pl('default'), 'scroll' => __pl('scroll'), 'fixed' => __pl('fixed') ], 'show' => ['left_bg_hover' => ''], 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => 'background-attachment: {{val}};'], 'req' => ['left_bg_type' => 'image'] ), 'left_bg_posx' => array( 'type' => 'select', 'label' => __pl('bg_posx'), 'list' => [ '' => __pl('default'), 'center' => __pl('center'), 'left' => __pl('left'), 'right' => __pl('right'), 'custom' => __pl('custom') ], 'show' => ['left_bg_hover' => ''], 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => 'background-position-x: {{val}};'], 'req' => ['left_bg_type' => 'image'] ), 'left_bg_posx_custom' => array( 'label' => __pl('custom_x'), 'type' => 'slider', 'step' => 1, 'min' => -5000, 'max' => 5000, 'screen' => 1, 'units' => ['px', 'em', '%'], 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => 'background-position-x: {{val}};'], 'req' => array( 'left_bg_posx' => 'custom' ), ), 'left_bg_posy' => array( 'type' => 'select', 'label' => __pl('bg_posy'), 'list' => [ '' => __pl('default'), 'center' => __pl('center'), 'top' => __pl('top'), 'bottom' => __pl('bottom'), 'custom' => __pl('custom') ], 'show' => ['left_bg_hover' => ''], 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => 'background-position-y: {{val}};'], 'req' => ['left_bg_type' => 'image'] ), 'left_bg_posy_custom' => array( 'label' => __pl('custom_y'), 'type' => 'slider', 'step' => 1, 'min' => -5000, 'max' => 5000, 'screen' => 1, 'units' => ['px', 'em', '%'], 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => 'background-position-y: {{val}};'], 'req' => array( 'left_bg_posy' => 'custom' ), ), 'left_bg_repeat' => array( 'type' => 'select', 'label' => __pl('bg_repeat'), 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => 'background-repeat: {{val}};'], 'list' => [ '' => __pl('default'), 'repeat' => __pl('repeat'), 'no-repeat' => __pl('no-repeat'), 'repeat-x' => __pl('repeat-x'), 'repeat-y' => __pl('repeat-y'), ], 'show' => ['left_bg_hover' => ''], 'req' => ['left_bg_type' => 'image'] ), 'left_bg_size' => array( 'type' => 'select', 'label' => __pl('bg_size'), 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => 'background-size: {{val}};'], 'list' => [ '' => __pl('default'), 'cover' => __pl('cover'), 'contain' => __pl('contain') ], 'show' => ['left_bg_hover' => ''], 'req' => ['left_bg_type' => 'image'] ), 'left_bg_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('bg_hover_delay'), 'min' => 0, 'step' => 100, 'max' => 5000, 'default' => 400, 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => '-webkit-transition: all {{val}}ms !important; transition: all {{val}}ms !important;'], 'show' => ['left_bg_hover' => 'hover'] ), 'left_bg_type_hover' => array( 'type' => 'radio', 'label' => __pl('background_type'), 'default' => '', 'list' => [ '' => __pl('none'), 'color' => __pl('color'), 'gradient' => __pl('gradient'), 'image' => __pl('image'), ], 'show' => ['left_bg_hover' => 'hover'] ), 'left_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('color_hover'), 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content:hover' => 'background: {{val}};'], 'show' => ['left_bg_hover' => 'hover'], 'req' => ['left_bg_type_hover' => 'color'] ), 'left_bg_gradient_hover' => array( 'type' => 'gradient', 'label' => '', 'default' => '150,#44d3f6,25,#72e584,75,#2ca4eb,100', 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content:hover' => 'background: linear-gradient({{val[0]}}deg, {{val[1]}} {{val[2]}}%, {{val[3]}} {{val[4]}}%, {{val[5]}} {{val[6]}}%);'], 'show' => ['left_bg_hover' => 'hover'], 'req' => ['left_bg_type_hover' => 'gradient'] ), 'left_bg_img_hover' => array( 'type' => 'image', 'label' => __pl('image_hover'), 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content:hover' => 'background: url("{{{left_bg_img_hover-url}}}");'], 'show' => ['left_bg_hover' => 'hover'], 'req' => ['left_bg_type_hover' => 'image'] ), 'left_bg_attachment_hover' => array( 'type' => 'select', 'label' => __pl('background_attachment'), 'list' => [ '' => __pl('default'), 'scroll' => __pl('scroll'), 'fixed' => __pl('fixed') ], 'show' => ['left_bg_hover' => 'hover'], 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content:hover' => 'background-attachment: {{val}};'], 'req' => ['left_bg_type_hover' => 'image'] ), 'left_bg_posx_hover' => array( 'type' => 'select', 'label' => __pl('horizontal_pos'), 'list' => [ '' => __pl('default'), 'center' => __pl('center'), 'left' => __pl('left'), 'right' => __pl('right') ], 'show' => ['left_bg_hover' => 'hover'], 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content:hover' => 'background-position-x: {{val}};'], 'req' => ['left_bg_type_hover' => 'image'] ), 'left_bg_posy_hover' => array( 'type' => 'select', 'label' => __pl('verticle_pos'), 'list' => [ '' => __pl('default'), 'center' => __pl('center'), 'top' => __pl('top'), 'bottom' => __pl('bottom') ], 'show' => ['left_bg_hover' => 'hover'], 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content:hover' => 'background-position-y: {{val}};'], 'req' => ['left_bg_type_hover' => 'image'] ), 'left_bg_repeat_hover' => array( 'type' => 'select', 'label' => __pl('repeat'), 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content:hover' => 'background-repeat: {{val}};'], 'list' => [ '' => __pl('default'), 'repeat' => __pl('repeat'), 'no-repeat' => __pl('no-repeat'), 'repeat-x' => __pl('repeat-x'), 'repeat-y' => __pl('repeat-y'), ], 'show' => ['left_bg_hover' => 'hover'], 'req' => ['left_bg_type_hover' => 'image'] ), 'left_bg_size_hover' => array( 'type' => 'select', 'label' => __pl('size'), 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content:hover' => 'background-size: {{val}};'], 'list' => [ '' => __pl('default'), 'cover' => __pl('cover'), 'contain' => __pl('contain') ], 'show' => ['left_bg_hover' => 'hover'], 'req' => ['left_bg_type_hover' => 'image'] ), 'left_timeline_border_hover' => array( 'type' => 'radio', 'label' => '', 'default' => '', 'list' => [ '' => __pl('normal'), 'hover' => __pl('hover'), ], 'req' => ['side' => ['both','left']] ), 'left_timeline_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'screen' => 1, 'default' => 'solid', 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => ['left_timeline_border_hover' => ''], 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content '=> 'border-style: {{val}}'], ), 'left_timeline_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'default' => '1,1,1,1', 'units' => ['px', 'em'], 'screen' => 1, 'show' => [ 'left_timeline_border_hover' => '' ], 'req' => [ '!left_timeline_border_type' => '' ], 'css' =>['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => 'border-top-width: {{val[0]}}; border-right-width: {{val[1]}}; border-bottom-width: {{val[2]}}; border-left-width: {{val[3]}}'], ), 'left_timeline_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'default' => '#CCC', 'screen' => 1, 'show' => [ 'left_timeline_border_hover' => '' ], 'req' => [ '!left_timeline_border_type' => '' ], 'css' =>['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => 'border-color: {{val}}'], ), 'left_timeline_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => ['px', 'em'], 'screen' => 1, 'show' => ['left_timeline_border_hover' => ''], 'req' => [ '!left_timeline_border_type' => '' ], 'default' => '6,6,6,6', 'css' =>['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], ), 'left_timeline_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'screen' => 1, 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => ['left_timeline_border_hover' => 'hover'], 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content:hover' => 'border-style: {{val}}'], ), 'left_timeline_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'units' => ['px', 'em'], 'screen' => 1, 'show' => [ 'left_timeline_border_hover' => 'hover' ], 'req' => [ '!left_timeline_border_type_hover' => '' ], 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content:hover' => 'border-top-width: {{val[0]}}; border-right-width: {{val[1]}}; border-bottom-width: {{val[2]}}; border-left-width: {{val[3]}}'], ), 'left_timeline_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color'), 'screen' => 1, 'show' => [ 'left_timeline_border_hover' => 'hover' ], 'req' => [ '!left_timeline_border_type_hover' => '' ], 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content:hover' => 'border-color: {{val}}'], ), 'left_timeline_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'units' => ['px', 'em'], 'show' => [ 'left_timeline_border_hover' => 'hover' ], 'req' => [ '!left_timeline_border_type_hover' => '' ], 'css' => ['{{element}} .pagelayer-timeline-container-left .pagelayer-timeline-content:hover' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], ), ], // timeline right part code starts 'right' => [ 'right_heading_text' => array( 'type' => 'textarea', 'label' => __pl('heading_name'), 'default' => '<h2>1998</h2>', 'desc' => __pl('Edit the heading here'), 'edit' => '.pagelayer-timeline-container-right .pagelayer-timeline-content .pagelayer-heading-holder', // Edit the text and also mirror the same 'req' => ['side' => ['both','right']] ), 'right_paragraph_text' => array( 'type' => 'editor', 'label' => __pl('text'), 'default' => 'Lorem ipsum dolor sit amet', 'desc' => __pl('Edit the content here or edit directly in the Editor'), 'edit' => '.pagelayer-timeline-container-right .pagelayer-timeline-content .pagelayer-text-holder', // Edit the text and also mirror the same 'req' => ['side' => ['both','right']] ), 'right_align' => array( 'label' => __pl('content_align'), 'type' => 'radio', 'addAttr' => 'align="{{align}}"', 'screen' => 1, 'default' => 'left', 'css' => ['{{element}} .pagelayer-timeline-container-right' => 'text-align: {{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ), 'req' => ['side' => ['both','right']] ), 'right_part_width' => array( 'type' => 'spinner', 'label' => __pl('width'), 'default' => '400', 'screen' => 1, 'step' => 1, 'min' => 0, 'max' => 100, 'default' => 90, 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => 'width:{{val}}%'], ), 'right_heading_state' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => 'normal', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), 'req' => ['side' => ['both','right']] ), 'right_color' => array( 'type' => 'color', 'label' => __pl('heading_color'), 'default' => '#111111', 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-heading-holder *' => 'color:{{val}}'], 'show' => ['right_heading_state' => 'normal'] ), 'right_heading_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-heading-holder *' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', '{{element}} .pagelayer-timeline-container-right .pagelayer-heading-holder' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'show' => ['right_heading_state' => 'normal'] ), 'right_heading_text_shadow' => array( 'type' => 'shadow', 'label' => __pl('text_shadow'), 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-heading-holder' => 'text-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}} !important;'], 'show' => ['right_heading_state' => 'normal'] ), 'right_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-heading-holder:hover *' => 'color:{{val}}', '{{element}} .pagelayer-timeline-container-right .pagelayer-heading-holder:hover' => 'color:{{val}}'], 'show' => ['right_heading_state' => 'hover'] ), 'right_heading_typo_hover' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-heading-holder:hover *' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', '{{element}} .pagelayer-timeline-container-right .pagelayer-heading-holder:hover' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'show' => ['right_heading_state' => 'hover'] ), 'right_heading_text_shadow_hover' => array( 'type' => 'shadow', 'label' => __pl('text_shadow'), 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-heading-holder:hover' => 'text-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}} !important;'], 'show' => ['right_heading_state' => 'hover'] ), 'right_bg_hover' => array( 'type' => 'radio', 'label' => __pl('row_bg_styles'), 'default' => '', 'list' => [ '' => __pl('normal'), 'hover' => __pl('hover'), ], 'show' => ['side' => ['both','right']] ), 'right_bg_type' => array( 'type' => 'radio', 'label' => __pl('background_type'), 'default' => '', 'list' => [ '' => __pl('none'), 'color' => __pl('color'), 'gradient' => __pl('gradient'), 'image' => __pl('image'), ], 'show' => ['right_bg_hover' => ''] ), 'right_bg_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => 'background-color: {{val}};'], 'show' => ['right_bg_hover' => ''], 'req' => ['right_bg_type' => 'color'] ), 'right_bg_gradient' => array( 'type' => 'gradient', 'label' => '', 'default' => '150,#44d3f6,23,#72e584,45,#2ca4eb,100', 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => 'background: linear-gradient({{val[0]}}deg, {{val[1]}} {{val[2]}}%, {{val[3]}} {{val[4]}}%, {{val[5]}} {{val[6]}}%);'], 'show' => ['right_bg_hover' => ''], 'req' => ['right_bg_type' => 'gradient'] ), 'right_img_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '', 'desc' => __pl('fallback_color'), 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => 'background-color: {{val}};'], 'show' => ['right_bg_hover' => ''], 'req' => ['right_bg_type' => 'image'] ), 'right_bg_img' => array( 'type' => 'image', 'label' => __pl('image'), 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => 'background-image: url("{{{right_bg_img-url}}}");'], 'show' => ['right_bg_hover' => ''], 'req' => ['right_bg_type' => 'image'] ), 'right_bg_attachment' => array( 'type' => 'select', 'label' => __pl('bg_attachment'), 'list' => [ '' => __pl('default'), 'scroll' => __pl('scroll'), 'fixed' => __pl('fixed') ], 'show' => ['right_bg_hover' => ''], 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => 'background-attachment: {{val}};'], 'req' => ['right_bg_type' => 'image'] ), 'right_bg_posx' => array( 'type' => 'select', 'label' => __pl('bg_posx'), 'list' => [ '' => __pl('default'), 'center' => __pl('center'), 'left' => __pl('left'), 'right' => __pl('right'), 'custom' => __pl('custom') ], 'show' => ['right_bg_hover' => ''], 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => 'background-position-x: {{val}};'], 'req' => ['right_bg_type' => 'image'] ), 'right_bg_posx_custom' => array( 'label' => __pl('custom_x'), 'type' => 'slider', 'step' => 1, 'min' => -5000, 'max' => 5000, 'screen' => 1, 'units' => ['px', 'em', '%'], 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => 'background-position-x: {{val}};'], 'req' => array( 'right_bg_posx' => 'custom' ), ), 'right_bg_posy' => array( 'type' => 'select', 'label' => __pl('bg_posy'), 'list' => [ '' => __pl('default'), 'center' => __pl('center'), 'top' => __pl('top'), 'bottom' => __pl('bottom'), 'custom' => __pl('custom') ], 'show' => ['right_bg_hover' => ''], 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => 'background-position-y: {{val}};'], 'req' => ['right_bg_type' => 'image'] ), 'right_bg_posy_custom' => array( 'label' => __pl('custom_y'), 'type' => 'slider', 'step' => 1, 'min' => -5000, 'max' => 5000, 'screen' => 1, 'units' => ['px', 'em', '%'], 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => 'background-position-y: {{val}};'], 'req' => array( 'right_bg_posy' => 'custom' ), ), 'right_bg_repeat' => array( 'type' => 'select', 'label' => __pl('bg_repeat'), 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => 'background-repeat: {{val}};'], 'list' => [ '' => __pl('default'), 'repeat' => __pl('repeat'), 'no-repeat' => __pl('no-repeat'), 'repeat-x' => __pl('repeat-x'), 'repeat-y' => __pl('repeat-y'), ], 'show' => ['right_bg_hover' => ''], 'req' => ['right_bg_type' => 'image'] ), 'right_bg_size' => array( 'type' => 'select', 'label' => __pl('bg_size'), 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => 'background-size: {{val}};'], 'list' => [ '' => __pl('default'), 'cover' => __pl('cover'), 'contain' => __pl('contain') ], 'show' => ['right_bg_hover' => ''], 'req' => ['right_bg_type' => 'image'] ), 'right_bg_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('ele_bg_hover_delay'), 'min' => 0, 'step' => 100, 'max' => 5000, 'default' => 400, 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => '-webkit-transition: all {{val}}ms !important; transition: all {{val}}ms !important;'], 'show' => ['right_bg_hover' => 'hover'] ), 'right_bg_type_hover' => array( 'type' => 'radio', 'label' => __pl('background_type'), 'default' => '', 'list' => [ '' => __pl('none'), 'color' => __pl('color'), 'gradient' => __pl('gradient'), 'image' => __pl('image'), ], 'show' => ['right_bg_hover' => 'hover'] ), 'right_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('color_hover'), 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content:hover' => 'background: {{val}};'], 'show' => ['right_bg_hover' => 'hover'], 'req' => ['right_bg_type_hover' => 'color'] ), 'right_bg_gradient_hover' => array( 'type' => 'gradient', 'label' => '', 'default' => '150,#44d3f6,25,#72e584,75,#2ca4eb,100', 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content:hover' => 'background: linear-gradient({{val[0]}}deg, {{val[1]}} {{val[2]}}%, {{val[3]}} {{val[4]}}%, {{val[5]}} {{val[6]}}%);'], 'show' => ['right_bg_hover' => 'hover'], 'req' => ['right_bg_type_hover' => 'gradient'] ), 'bg_img_hover' => array( 'type' => 'image', 'label' => __pl('image_hover'), 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content:hover' => 'background: url("{{{bg_img_hover-url}}}");'], 'show' => ['right_bg_hover' => 'hover'], 'req' => ['right_bg_type_hover' => 'image'] ), 'right_bg_attachment_hover' => array( 'type' => 'select', 'label' => __pl('background_attachment'), 'list' => [ '' => __pl('default'), 'scroll' => __pl('scroll'), 'fixed' => __pl('fixed') ], 'show' => ['right_bg_hover' => 'hover'], 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content:hover' => 'background-attachment: {{val}};'], 'req' => ['right_bg_type_hover' => 'image'] ), 'right_bg_posx_hover' => array( 'type' => 'select', 'label' => __pl('horizontal_pos'), 'list' => [ '' => __pl('default'), 'center' => __pl('center'), 'left' => __pl('left'), 'right' => __pl('right') ], 'show' => ['right_bg_hover' => 'hover'], 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content:hover' => 'background-position-x: {{val}};'], 'req' => ['right_bg_type_hover' => 'image'] ), 'right_bg_posy_hover' => array( 'type' => 'select', 'label' => __pl('verticle_pos'), 'list' => [ '' => __pl('default'), 'center' => __pl('center'), 'top' => __pl('top'), 'bottom' => __pl('bottom') ], 'show' => ['right_bg_hover' => 'hover'], 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content:hover' => 'background-position-y: {{val}};'], 'req' => ['right_bg_type_hover' => 'image'] ), 'right_bg_repeat_hover' => array( 'type' => 'select', 'label' => __pl('repeat'), 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content:hover' => 'background-repeat: {{val}};'], 'list' => [ '' => __pl('default'), 'repeat' => __pl('repeat'), 'no-repeat' => __pl('no-repeat'), 'repeat-x' => __pl('repeat-x'), 'repeat-y' => __pl('repeat-y'), ], 'show' => ['right_bg_hover' => 'hover'], 'req' => ['right_bg_type_hover' => 'image'] ), 'right_bg_size_hover' => array( 'type' => 'select', 'label' => __pl('size'), 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content:hover' => 'background-size: {{val}};'], 'list' => [ '' => __pl('default'), 'cover' => __pl('cover'), 'contain' => __pl('contain') ], 'show' => ['right_bg_hover' => 'hover'], 'req' => ['right_bg_type_hover' => 'image'] ), 'right_timeline_border_hover' => array( 'type' => 'radio', 'label' => '', 'default' => '', 'list' => [ '' => __pl('normal'), 'hover' => __pl('hover'), ], 'req' => ['side' => ['both','right']] ), 'right_timeline_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'screen' => 1, 'default' => 'solid', 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => ['right_timeline_border_hover' => ''], 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content '=> 'border-style: {{val}}'], ), 'right_timeline_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'default' => '1,1,1,1', 'units' => ['px', 'em'], 'screen' => 1, 'show' => [ 'right_timeline_border_hover' => '' ], 'req' => [ '!right_timeline_border_type' => '' ], 'css' =>['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => 'border-top-width: {{val[0]}}; border-right-width: {{val[1]}}; border-bottom-width: {{val[2]}}; border-left-width: {{val[3]}}'], ), 'right_timeline_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'default' => '#CCC', 'screen' => 1, 'show' => [ 'right_timeline_border_hover' => '' ], 'req' => [ '!right_timeline_border_type' => '' ], 'css' =>['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => 'border-color: {{val}}'], ), 'right_timeline_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => ['px', 'em'], 'screen' => 1, 'show' => ['right_timeline_border_hover' => ''], 'req' => [ '!right_timeline_border_type' => '' ], 'default' => '6,6,6,6', 'css' =>['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], ), 'right_timeline_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'screen' => 1, 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => ['right_timeline_border_hover' => 'hover'], 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content:hover' => 'border-style: {{val}}'], ), 'right_timeline_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'units' => ['px', 'em'], 'screen' => 1, 'show' => [ 'right_timeline_border_hover' => 'hover' ], 'req' => [ '!right_timeline_border_type_hover' => '' ], 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content:hover' => 'border-top-width: {{val[0]}}; border-right-width: {{val[1]}}; border-bottom-width: {{val[2]}}; border-left-width: {{val[3]}}'], ), 'right_timeline_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color'), 'screen' => 1, 'show' => [ 'right_timeline_border_hover' => 'hover' ], 'req' => [ '!right_timeline_border_type_hover' => '' ], 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content:hover' => 'border-color: {{val}}'], ), 'right_timeline_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'units' => ['px', 'em'], 'show' => ['right_timeline_border_hover' => 'hover'], 'req' => [ '!right_timeline_border_type_hover' => '' ], 'css' => ['{{element}} .pagelayer-timeline-container-right .pagelayer-timeline-content:hover' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], ), ], 'styles' => [ 'timeline_circle' => __pl('timeline_center_circle'), 'left' => __pl('left'), 'right' => __pl('right'), ] ) ); // Before After Slider pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_before_after', array( 'name' => __pl('before_after_image'), 'group' => 'other', 'html' => '<div class="pagelayer-before-after-container" data-resize-event="{{resize_event}}"> <div class="pagelayer-before-after-slider"> <div class="pagelayer-before-image"> <img src="{{{before_image-url}}}"/> </div> <div class="pagelayer-after-image"> <img src="{{{after_image-url}}}"/> </div> <div class="pagelayer-resizer {{icon}} {{icon_size}} "></div> <button if="{{bf_button}}" class="pagelayer-before-btn">{{before_btn_text}}</button> <button if="{{bf_button}}" class="pagelayer-after-btn">{{after_btn_text}}</button> </div> </div>', 'params' => array( 'before_image' => array( 'type' => 'image', 'label' => __pl('before_image'), 'default' => PAGELAYER_URL.'/images/default-image.png', 'retina' => 1, ), 'after_image' => array( 'type' => 'image', 'label' => __pl('after_image'), 'default' => PAGELAYER_URL.'/images/default-image.png', 'retina' => 1, ), 'before_after_direction' => array( 'type' => 'select', 'label' => __pl('slider_direction'), 'default' => 'horizontal', 'addClass' => ['{{element}} .pagelayer-before-after-slider' => 'pagelayer-before-after-slider-{{val}}'], 'list' => array( 'horizontal' => __pl('horizontal'), 'vertical' => __pl('vertical'), ) ), 'offset_horizontal' => array( 'type' => 'spinner', 'label' => __pl('slider_offset'), 'min' => '1', 'max' => '99.5', 'step' => '1', 'screen' => 1, 'css' => ['{{element}} .pagelayer-after-image' => 'clip-path:polygon({{val}}% 0%, 100% 0%, 100% 100%, {{val}}% 100%);','{{element}} .pagelayer-resizer' => 'left:{{val}}%;'], 'req' => ['before_after_direction' => 'horizontal'] ), 'offset_vertical' => array( 'type' => 'spinner', 'label' => __pl('slider_offset'), 'min' => '1', 'max' => '100', 'step' => '1', 'screen' => 1, 'css' => ['{{element}} .pagelayer-before-after-slider-vertical .pagelayer-after-image' => 'clip-path:polygon(0px {{val}}%, 100% {{val}}%, 100% 100%, 0% 100%)','{{element}} .pagelayer-before-after-slider-vertical .pagelayer-resizer' => 'top:{{val}}%;'], 'req' => ['before_after_direction' => 'vertical'] ), 'resize_event' => array( 'type' => 'radio', 'label' => __pl('slider_type'), 'default' => 'drag', 'screen' => 1, 'list' => array( 'none' => __pl('none'), 'drag' => __pl('drag'), 'hover' => __pl('hover') ) ), 'custom_height' => array( 'type' => 'checkbox', 'label' => __pl('custom_height'), ), 'height' => array( 'type' => 'spinner', 'label' => __pl('slider_height'), 'min' => '0', 'max' => '1000', 'step' => 1, 'screen' => 1, 'css' => ['{{element}} .pagelayer-before-after-slider' => 'height:{{val}}px;'], 'req' => ["custom_height" => 'true'] ), 'delay_control' => array( 'type' => 'slider', 'label' => __pl('time'), 'min' => '0.0', 'max' => '1.0', 'step' => '0.1', 'css' => ['{{element}} .pagelayer-resizer,{{element}} .pagelayer-after-image' => 'transition-duration:{{val}}s;'], ) ), 'icon_style' => [ 'icon' => array( 'type' => 'icon', 'label' => __pl('icon'), 'default' => 'fas fa-arrows-alt-h', 'list' => ['arrows-alt-h', 'arrows-alt-v','arrows-alt-h', 'arrow-right', 'arrow-left', 'arrow-circle-right', 'arrow-circle-left', 'arrow-alt-circle-left','arrow-alt-circle-right'], ), 'icon_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-resizer:before' => 'color:{{val}};'], ), 'bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-resizer:before' => 'background: {{val}};'], ), 'icon_size' => array( 'type' => 'select', 'label' => __pl('icon_size'), 'default' => 'pagelayer-icon-mini', 'list' => array( 'pagelayer-icon-mini' => __pl('mini'), 'pagelayer-icon-small' => __pl('small'), 'pagelayer-icon-large' => __pl('large'), 'pagelayer-icon-extra-large' => __pl('extra_large'), 'pagelayer-icon-double-large' => __pl('double_large'), 'pagelayer-icon-custom' => __pl('custom'), ), ), 'icon_size_custom' => array( 'type' => 'spinner', 'label' => __pl('icon_size'), 'min' => '1', 'max' => '100', 'screen' => 1, 'css' => ['{{element}} .pagelayer-resizer:before' => 'font-size: {{val}}px'], 'req' => array( 'icon_size' => 'pagelayer-icon-custom' ), ), 'icon_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-resizer:before' => 'border-style: {{val}}'], 'list' => [ '' => __pl('default'), 'none' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'icon_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['{{element}} .pagelayer-resizer:before' => 'border-color: {{val}};'], 'req' => array( '!icon_border_type' => ['', 'none'], ), ), 'icon_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-resizer:before' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!icon_border_type' => ['', 'none'], ], ), 'icon_border_radius' => array( 'type' => 'slider', 'label' => __pl('border_radius'), 'step' => '1', 'screen' => 1, 'css' => ['{{element}} .pagelayer-resizer:before' => 'border-radius: {{val}}%; -webkit-border-radius: {{val}}%;-moz-border-radius: {{val}}%;'], ), 'bg_size' => array( 'type' => 'slider', 'label' => __pl('icon_bg_size'), 'step' => '1', 'screen' => 1, 'css' => ['{{element}} .pagelayer-resizer:before' => 'padding: {{val}}px;'], ), 'bg_positionHorizontalY' => array( 'type' => 'slider', 'label' => __pl('icon_position'), 'max' => '100', 'min' => '0', 'screen' => 1, 'css' => ['{{element}} .pagelayer-before-after-slider-horizontal .pagelayer-resizer:before' => 'top: {{val}}%; transform: TranslateX(-50%) TranslateY(-{{val}}%) '], 'req' => ['before_after_direction' => 'horizontal'], ), 'bg_positionVerticalX' => array( 'type' => 'slider', 'label' => __pl('icon_position'), 'max' => '100', 'min' => '0', 'screen' => 1, 'css' => ['{{element}} .pagelayer-before-after-slider-vertical .pagelayer-resizer:before' => 'left: {{val}}%; transform: TranslateX(-{{val}}%) TranslateY(-50%)'], 'req' => ['before_after_direction' => 'vertical'], ), ], 'resizer_style' => [ 'resizer' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} .pagelayer-resizer' => 'background:{{val}};'], ), 'resizer_width' => array( 'type' => 'slider', 'label' => __pl('width'), 'min' => '0', 'max' => '20', 'screen' => 1, 'css' => ['{{element}} .pagelayer-resizer' => 'width: {{val}}px;'], 'req' => ['before_after_direction' => 'horizontal'] ), 'resizer_width_vertical' => array( 'type' => 'slider', 'label' => __pl('height'), 'min' => '0', 'max' => '20', 'screen' => 1, 'css' => ['{{element}} .pagelayer-resizer' => 'height: {{val}}px;'], 'req' => ['before_after_direction' => 'vertical'] ), ], 'bf_btn_style' =>[ 'bf_button' => array( 'type' => 'checkbox', 'label' => __pl('show_btn') ), 'button_color' => array( 'type' => 'color', 'label' => __pl('color'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-before-btn, {{element}} .pagelayer-after-btn' => 'color:{{val}};'], 'req' => array( 'bf_button' => 'true' ), ), 'btn_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-before-btn, {{element}} .pagelayer-after-btn' => 'background-color:{{val}};'], 'req' => array( 'bf_button' => 'true' ), ), 'bf_btn_size' => array( 'type' => 'padding', 'label' => __pl('size'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-before-btn, {{element}} .pagelayer-after-btn' => 'padding-top:{{val[0]}}px;padding-right:{{val[1]}}px;padding-bottom:{{val[0]}}px;padding-left:{{val[1]}}px;'], 'req' => [ 'bf_button' => 'true', ] ), 'btn_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => [ '{{element}} .pagelayer-before-btn, {{element}} .pagelayer-after-btn' => 'border-style: {{val}};', ], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'req' => array( 'bf_button' => 'true' ), ), 'btn_border_color' => array( 'type' => 'color', 'label' => __pl('border_color_label'), 'css' => ['{{element}} .pagelayer-before-btn, {{element}} .pagelayer-after-btn' => 'border-color: {{val}};'], 'req' => array( '!btn_border_type' => '' ), ), 'btn_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-before-btn, {{element}} .pagelayer-after-btn' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!btn_border_type' => '' ], ), 'btn_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-before-btn, {{element}} .pagelayer-after-btn' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!btn_border_type' => '', ), ), 'btn_position' => array( 'type' => 'slider', 'label' => __pl('button_position'), 'max' => '100', 'min' => '0', 'screen' => 1, 'css' => ['{{element}} .pagelayer-before-after-slider-horizontal .pagelayer-before-btn, {{element}} .pagelayer-before-after-slider-horizontal .pagelayer-after-btn' => 'top: {{val}}%;transform: translateY(-{{val}}%);','{{element}} .pagelayer-before-after-slider-vertical .pagelayer-before-btn, {{element}} .pagelayer-before-after-slider-vertical .pagelayer-after-btn' => 'left: {{val}}%;transform: translateX(-{{val}}%);'], 'req' => array( 'bf_button' => 'true', ), ), 'before_btn_text' => array( 'type' => 'text', 'label' => __pl('before_text'), 'default' => __pl('Before'), 'req' => array( 'bf_button' => 'true' ), ), 'after_btn_text' => array( 'type' => 'text', 'label' => __pl('after_text'), 'default' => __pl('After'), 'req' => array( 'bf_button' => 'true' ), ), 'btn_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-before-btn, {{element}} .pagelayer-after-btn' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => ['bf_button' => 'true'] ), 'before_spacing' => array( 'type' => 'padding', 'label' => __pl('before_button_spacing'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-before-btn' => 'margin-top:{{val[0]}}px; margin-right:{{val[1]}}px; margin-bottom:{{val[2]}}px; margin-left:{{val[3]}}px;'], 'req' => ['bf_button' => 'true'] ), 'after_spacing' => array( 'type' => 'padding', 'label' => __pl('after_button_spacing'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-after-btn' => 'margin-top:{{val[0]}}px; margin-right:{{val[1]}}px; margin-bottom:{{val[2]}}px; margin-left:{{val[3]}}px;'], 'req' => ['bf_button' => 'true'] ) ], 'styles' => [ 'icon_style' => __pl('icon_style'), 'resizer_style' => __pl('resizer'), 'bf_btn_style' => __pl('Before After Button'), ] ) ); pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_image_map', array( 'name' => __pl('image_map'), 'group' => 'other', 'html' => ' <div class="pagelayer-imgmap-container"> <div class="pagelayer-imgmap-wrapper"> <svg class="pagelayer-imgmap-svg"> <g>{{pagelayer_map_path}}</g> </svg> <div class="pagelayer-imgmap-coordinates-wraper"></div> </div> <img class="pagelayer-img pagelayer-animation-{{anim_hover}}" src="{{map_img_id}}" title="{{{map_img-id-title}}}" alt="{{{map_img-id-alt}}}" srcset="{{pagelayer-srcset}}" /> </div>', 'params' => array( 'map_img-id' => array( 'type' => 'image', 'label' => __pl('Image'), 'desc' => __pl('image_src_desc'), 'default' => PAGELAYER_URL.'/images/default-image.png', 'retina' => 0, ), 'img_map-size' => array( 'label' => __pl('obj_image_size_label'), 'type' => 'select', 'default' => 'full', 'list' => array( 'full' => __pl('full'), 'large' => __pl('large'), 'medium' => __pl('medium'), 'thumbnail' => __pl('thumbnail'), 'custom' => __pl('custom') ) ), 'custom_size' => array( 'label' => __pl('image_custom_size_label'), 'type' => 'text', 'screen' => 1, 'default' => '100x100', 'sep' => 'x', 'css' => ['{{element}} img' => 'width: {{val[0]}}px; height: {{val[1]}}px;'], 'req' => array( 'img_map-size' => 'custom' ), ), 'align' => array( 'label' => __pl('obj_align_label'), 'type' => 'radio', 'default' => 'center', 'screen' => 1, 'css' => ['{{element}} .pagelayer-imgmap-container' => 'text-align: {{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ) ), 'max-width' => array( 'label' => __pl('max-width-percent'), 'type' => 'slider', 'min' => 0, 'max' => 100, 'screen' => 1, 'css' => ['{{element}} img' => 'max-width: {{val}}%'], ), 'pagelayer_image_map' => array( 'type' => 'hidden', 'default' => '' ), ), 'area_styles' => [ 'show_area' =>array( 'label' => __pl('show_area' ), 'desc' => __pl('show_area_to_live'), 'type' => 'checkbox', 'css' => ['{{element}} .pagelayer-imgmap-item.pagelayer-map-item-active, {{element}} .pagelayer-imgmap-hover-active .pagelayer-imgmap-item:hover' => 'opacity: 1'], ), 'area_bg' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#FFABAB', 'css' => ['{{element}} .pagelayer-imgmap-item.pagelayer-map-item-active, {{element}} .pagelayer-map-item-active_is_editable, {{element}} .pagelayer-imgmap-hover-active .pagelayer-imgmap-item:hover' => 'fill: {{val}}'], 'req' => array( 'show_area' => 'true' ) ), 'area_cord_color' => array( 'type' => 'color', 'label' => __pl('cord_color'), 'default' => '#F70E0E', 'css' => ['{{element}} .pagelayer-imgmap-item.pagelayer-map-item-active, {{element}} .pagelayer-map-item-active_is_editable, {{element}} .pagelayer-imgmap-hover-active .pagelayer-imgmap-item:hover' => 'stroke: {{val}}'], 'req' => array( 'show_area' => 'true' ) ) ], 'styles' => [ 'area_styles' => __pl('Area Style') ], ) ); freemium_functions.php 0000644 00000077004 15103567077 0011201 0 ustar 00 <?php ////////////////////////////////////////////////////////////// //=========================================================== // freemium_functions.php //=========================================================== // PAGELAYER // Inspired by the DESIRE to be the BEST OF ALL // ---------------------------------------------------------- // Started by: Pulkit Gupta // Date: 23rd Jan 2017 // Time: 23:00 hrs // Site: http://pagelayer.com/wordpress (PAGELAYER) // ---------------------------------------------------------- // Please Read the Terms of use at http://pagelayer.com/tos // ---------------------------------------------------------- //=========================================================== // (c)Pagelayer Team //=========================================================== ////////////////////////////////////////////////////////////// // Are we being accessed directly ? if(!defined('PAGELAYER_PRO_VERSION')) { exit('Hacking Attempt !'); } // Get page title - 2C function pagelayer_get_the_title( $including_context = false ) { $title = ''; if(pagelayer_is_live() || wp_doing_ajax() || pagelayer_is_gutenberg_editor()){ return 'Title'; } if ( is_singular() ) { $title = get_the_title(); if ( $including_context ) { $post_type_obj = get_post_type_object( get_post_type() ); $title = sprintf( '%s: %s', $post_type_obj->labels->singular_name, $title ); } } elseif ( is_search() ) { $title = sprintf( __( 'Search Results for: %s'), get_search_query() ); if ( get_query_var( 'paged' ) ) { $title .= sprintf( __( ' – Page %s' ), get_query_var( 'paged' ) ); } } elseif ( is_category() ) { $title = single_cat_title( '', false ); if ( $including_context ) { $title = sprintf( __( 'Category Archives: %s' ), $title ); } } elseif ( is_tag() ) { $title = single_tag_title( '', false ); if ( $including_context ) { $title = sprintf( __( 'Tag Archives: %s' ), $title ); } } elseif ( is_author() ) { $title = get_the_author() ; if ( $including_context ) { $title = sprintf( __( 'Author Archives: %s' ), $title ); } } elseif ( is_year() ) { $title = get_the_date( _x( 'Y', 'yearly archives date format' ) ); if ( $including_context ) { $title = sprintf( __( 'Yearly Archives: %s' ), $title ); } } elseif ( is_month() ) { $title = get_the_date( _x( 'F Y', 'monthly archives date format' ) ); if ( $including_context ) { $title = sprintf( __( 'Monthly Archives: %s' ), $title ); } } elseif ( is_day() ) { $title = get_the_date( _x( 'F j, Y', 'daily archives date format' ) ); if ( $including_context ) { $title = sprintf( __( 'Daily Archives: %s' ), $title ); } } elseif ( is_tax( 'post_format' ) ) { if ( is_tax( 'post_format', 'post-format-aside' ) ) { $title = _x( 'Asides', 'post format archive title' ); } elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) { $title = _x( 'Galleries', 'post format archive title' ); } elseif ( is_tax( 'post_format', 'post-format-image' ) ) { $title = _x( 'Images', 'post format archive title' ); } elseif ( is_tax( 'post_format', 'post-format-video' ) ) { $title = _x( 'Videos', 'post format archive title' ); } elseif ( is_tax( 'post_format', 'post-format-quote' ) ) { $title = _x( 'Quotes', 'post format archive title' ); } elseif ( is_tax( 'post_format', 'post-format-link' ) ) { $title = _x( 'Links', 'post format archive title' ); } elseif ( is_tax( 'post_format', 'post-format-status' ) ) { $title = _x( 'Statuses', 'post format archive title' ); } elseif ( is_tax( 'post_format', 'post-format-audio' ) ) { $title = _x( 'Audio', 'post format archive title' ); } elseif ( is_tax( 'post_format', 'post-format-chat' ) ) { $title = _x( 'Chats', 'post format archive title' ); } } elseif ( is_post_type_archive() ) { $title = post_type_archive_title( '', false ); if ( $including_context ) { $title = sprintf( __( 'Archives: %s' ), $title ); } } elseif ( is_tax() ) { $title = single_term_title( '', false ); if ( $including_context ) { $tax = get_taxonomy( get_queried_object()->taxonomy ); $title = sprintf( __( '%1$s: %2$s' ), $tax->labels->singular_name, $title ); } } elseif ( is_404() ) { $title = __( 'Page Not Found' ); } elseif ( is_archive() ) { $title = get_the_archive_title(); } elseif ( is_home() ) { $title = single_post_title('', false); } return $title; } // Get Taxonomies function pagelayer_tax_list($item = '', $page = false){ // Get types $types = pagelayer_post_types($page); // Loop thru foreach($types as $slug => $label){ // Get the items $items = get_object_taxonomies($slug, 'objects'); foreach($items as $name => $v) { if(!isset($taxonomies[$name])){ $taxonomies[$name] = array('label' => $v->labels->singular_name, 'posttypes' => array($label)); }else{ $taxonomies[$name]['posttypes'][] = $label; } } } // Make it simple foreach($taxonomies as $k => $v){ $taxonomies[$k] = $v['label'].' ('.implode(', ', $v['posttypes']).')'; } $pos = array_search($item, array_keys($taxonomies)); if(!empty($pos)) { $cut = array_splice($taxonomies, $pos, 1); $taxonomies = $cut + $taxonomies; } return $taxonomies; } ///////////////////////////////////// // Miscellaneous Shortcode Functions ///////////////////////////////////// // The types of Posts function pagelayer_post_types($page = false){ // Get the types $args = array('public' => TRUE); $types = get_post_types($args, 'objects'); // Unset Page if not required if($page == false){ unset($types['page']); } // Remove Attachment types ! unset($types['attachment']); foreach($types as $name => $type){ $return[$name] = $type->labels->singular_name; } return $return; } // Get all posts and pages list function pagelayer_get_posts($args = array()){ if(empty($args)){ $args = array_keys(pagelayer_post_types(true)); } $posts_list = array(); // Get type foreach($args as $p){ // Create post list foreach(get_posts(['post_type' => $p]) as $post){ $posts_list[$post->ID] = $post->post_title; } } return $posts_list; } // Get Menu List() function pagelayer_get_menu_list($return_def = false){ $menus = wp_get_nav_menus(); $nav_menu = array( '0' => __('-- Select Menu --') ); if(empty($menus)){ return $nav_menu; } $default = $menus[0]->term_id; foreach ( $menus as $menu ) { $nav_menu[$menu->term_id] = $menu->name; if($default > $menu->term_id){ $default = $menu->term_id; } } if($return_def){ return $default; } return $nav_menu; } // Animated Heading function pagelayer_sc_anim_heading(&$el){ $el['atts']['rotate_html'] = ''; //Creates html for rotating text if(!empty($el['atts']['rotate_text'])){ $rotate_text = ''; $rotate_text = explode(',', $el['atts']['rotate_text']); $el['atts']['rotate_html'] .= '<div class="pagelayer-animated-heading pagelayer-rotating-text pagelayer-words-wrapper">'; //print_r($rotate_text); foreach($rotate_text as $key => $val){ //print_r($key); $el['atts']['rotate_html'] .= '<span'; if( $key == 0){ $el['atts']['rotate_html'] .= ' class="pagelayer-is-visible"'; } $el['atts']['rotate_html'] .= '>' . $rotate_text[$key] . '</span>'; } $el['atts']['rotate_html'] .= '</div>'; } //Required classes for particular rotate $el['atts']['rotate_req'] = ''; $letters = ['pagelayer-aheading-rotate2', 'pagelayer-aheading-rotate3', 'pagelayer-aheading-scale']; if(!empty($el['atts']['animations'])){ if(in_array($el['atts']['animations'], $letters)){ $el['atts']['rotate_req'] = 'letters '; } if($el['atts']['animations'] == 'clip'){ $el['atts']['rotate_req'] = 'is-full-width '; } } } // Contact Form function pagelayer_sc_contact(&$el){ $recaptcha_version = get_option('pagelayer_recaptcha_version', ''); $el['atts']['grecaptcha'] = get_option('pagelayer_google_captcha'); if(!empty($el['atts']['captcha'])){ if($recaptcha_version == 'v3'){ $el['atts']['grecaptcha_v3'] = true; }else{ $el['atts']['grecaptcha_v2'] = true; } if(!wp_script_is('pagelayer_cap_script', 'registered')){ $pagelayer_cap_lang = get_option('pagelayer_google_captcha_lang'); $lang = empty($pagelayer_cap_lang) ? '' : '&hl='.$pagelayer_cap_lang; $cap_api = ($recaptcha_version == 'v3') ? $el['atts']['grecaptcha'].$lang : "explicit$lang"; wp_register_script('pagelayer_cap_script', "https://www.google.com/recaptcha/api.js?render=$cap_api", array(), PAGELAYER_PRO_VERSION, true); } wp_enqueue_script('pagelayer_cap_script'); } } // Contact Form Item function pagelayer_sc_contact_item(&$el){ $html = ''; $options = array(); $placeholder = ''; $required = ''; if(!empty($el['atts']['required'])){ $required = 'required'; } if(!empty($el['atts']['label_name']) && empty($el['atts']['label_as_holder'])){ $html = '<label for="'.pagelayer_isset($el['atts'], 'field_name').'"><span class="pagelayer-form-label">'.$el['atts']['label_name'].'</span>'; if(!empty($required)){ $html .= ' *'; } $html .= '</label>'; } if(!empty($el['atts']['label_as_holder'])){ $placeholder = $el['atts']['label_name']; }else{ if(!empty($el['atts']['placeholder'])) $placeholder = $el['atts']['placeholder']; } // File accept $file_accept = '.jpg,.jpeg,.png,.gif,.pdf,.doc,.docx,.ppt,.pptx,.odt,.avi,.ogg,.m4a,.mov,.mp3,.mp4,.mpg,.wav,.wmv'; if(!empty($el['atts']['accept_file'])){ $file_accept = $el['atts']['accept_file']; } if($el['atts']['field_type'] == 'select'){ $html .= '<select name="'.$el['atts']['field_name'].'" '.$required.'>'; if(!empty($el['atts']['label_name']) && !empty($el['atts']['label_as_holder'])){ $html .= '<option value="" disabled selected>'.$el['atts']['label_name'].'</option>'; }else{ $html .= '<option value="" disabled selected>---</option>'; } if(!empty($el['atts']['values'])){ $options = explode("\n", $el['atts']['values']); for($x = 0; $x < sizeof($options); $x++){ $html .= '<option value="'.trim($options[$x]).'" >'.trim($options[$x]).'</option>'; } } $html .= '</select>'; }elseif($el['atts']['field_type'] == 'checkbox'){ $html .= '<div class="pagelayer-radcheck-holder pagelayer-contact-checkbox" '.$required.'>'; if(!empty($el['atts']['values'])){ $options = explode("\n", $el['atts']['values']); for($x = 0; $x < sizeof($options); $x++){ $html .= '<div><input type="checkbox" id="'.$el["id"].trim($options[$x]).'" name="'.$el['atts']['field_name'].'[]" value="'.trim($options[$x]).'"/><label for="'.$el["id"].trim($options[$x]).'" class="pagelayer-form-label">'.trim($options[$x]).'</label></div>'; } } $html .= '</div>'; }elseif($el['atts']['field_type'] == 'radio'){ $html .= '<div class="pagelayer-radcheck-holder">'; if(!empty($el['atts']['values'])){ $options = explode("\n", $el['atts']['values']); for($x = 0; $x < sizeof($options); $x++){ $html .= '<div><input type="radio" name="'.$el['atts']['field_name'].'"'.$required.' value="'.trim($options[$x]).'"/><span> '.trim($options[$x]).'</span></div>'; } } $html .= '</div>'; }elseif($el['atts']['field_type'] == 'textarea'){ $html .= '<textarea name="'.$el['atts']['field_name'].'" rows="'.$el['atts']['textarea_rows'].'" '.$required.' placeholder="'.$placeholder.'"></textarea>'; }elseif($el['atts']['field_type'] == 'file'){ $html .= '<input type="'.$el['atts']['field_type'].'" '.$required.' name="'.$el['atts']['field_name'].'" accept="'.$file_accept.'" />'; }elseif($el['atts']['field_type'] == 'label'){ $html .= ''; }else{ $html .= '<input type="'.$el['atts']['field_type'].'" '.$required.' placeholder="'.$placeholder.'" name="'.$el['atts']['field_name'].'" />'; } $el['atts']['fieldhtml'] = $html; } // Featured Image Handler function pagelayer_sc_featured_img(&$el){ // Image size if(!empty($el['atts']['size'])){ $size = $el['atts']['size']; } $thumbnail_id = get_post_thumbnail_id(); $title = $alt = ''; if(!empty($thumbnail_id)){ $title = get_the_title($thumbnail_id); $alt = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); } if($size){ $src = get_the_post_thumbnail_url(null, $size); }else{ $src = get_the_post_thumbnail_url(); } // Fallback image if(empty($src) && !empty($el['atts']['img'])){ $src = !empty($el['tmp']['img-'.$size.'-url']) ? $el['tmp']['img-'.$size.'-url'] : pagelayer_isset($el['tmp'], 'img-url'); $alt = $el['tmp']['img-alt']; $title = $el['tmp']['img-title']; } $el['atts']['img_html'] = ''; if(!empty($src)){ $el['atts']['img_html'] = '<img class="pagelayer-img" src="'.$src.'" title="'.$title.'" alt="'.$alt.'" />'; }elseif(pagelayer_is_live_template()){ $el['atts']['img_html'] = '<img class="pagelayer-img" src="'.PAGELAYER_URL.'/images/default-image.png" />'; } // What is the link ? if(!empty($el['atts']['link_type'])){ // Custom url if($el['atts']['link_type'] == 'custom_url'){ // Backward compatibility for new link props pagelayer_add_link_backward($el, array( 'rel' => '', 'selector' => '.pagelayer-ele-link')); $el['atts']['func_link'] = empty($el['tmp']['link']) ? '' : $el['tmp']['link']; } // Link to the media file itself if($el['atts']['link_type'] == 'media_file' || $el['atts']['link_type'] == 'lightbox'){ $el['atts']['func_link'] = $src; } } } // Site Title Handler function pagelayer_sc_wp_title(&$el){ // Decide the image URL $el['atts']['func_image'] = pagelayer_isset($el['tmp'], 'id-' . pagelayer_isset($el['atts'], 'id-size') . '-url'); $el['atts']['func_image'] = empty($el['atts']['func_image']) ? pagelayer_isset($el['tmp'], 'id-url') : $el['atts']['func_id']; // Default Logo if(empty($el['atts']['logo_img_type'])){ // Load it $logo = pagelayer_site_logo(); // Only if we get it if(!empty($logo)){ $logo_img_size = pagelayer_isset($el['atts'], 'logo_img_size'); $el['atts']['func_image'] = pagelayer_isset($logo, $logo_img_size.'-url'); $el['atts']['func_image'] = empty($el['atts']['func_image']) ? pagelayer_isset($logo, 'url') : $el['atts']['func_image']; $el['tmp']['logo_img-title'] = pagelayer_isset($logo, 'title'); $el['tmp']['logo_img-alt'] = pagelayer_isset($logo, 'alt'); } // Custom logo }else{ $logo_img_size = pagelayer_isset($el['atts'], 'logo_img_size'); $el['atts']['func_image'] = pagelayer_isset($el['tmp'], 'logo_img-' . $logo_img_size . '-url'); $el['atts']['func_image'] = empty($el['atts']['func_image']) ? pagelayer_isset($el['tmp'], 'logo_img-url') : $el['atts']['func_image']; $el['tmp']['logo_img-title'] = pagelayer_isset($el['tmp'],'logo_img-title'); $el['tmp']['logo_img-alt'] = pagelayer_isset($el['tmp'], 'logo_img-alt'); } } // Primary menu Handler function pagelayer_sc_wp_menu(&$el){ if(!empty($el['atts']['inside_mega'])){ $el['atts']['nav_menu'] = ''; if(pagelayer_is_live()){ $el['atts']['nav_menu'] = 'Primary Menu Holder. Please select the correct menu.'; } return true; } // Setting default toggle icon. If the icon is empty. if(empty($el['atts']['menu_toggle_icon'])){ $el['atts']['menu_toggle_icon'] = 'fas fa-bars'; } // Load Pagelayer nav menu walker include_once(PAGELAYER_DIR.'/main/nav_walker.php'); $el['atts']['nav_menu'] = wp_nav_menu( array( 'menu' => wp_get_nav_menu_object(pagelayer_isset($el['atts'], 'nav_list')), 'menu_id' => pagelayer_isset($el['atts'], 'nav_list'), 'menu_class' => 'pagelayer-wp_menu-ul', 'walker' => new Pagelayer_Walker_Nav_Menu(), //'theme_location' => 'primary', 'echo' => false, ) ); } // Post Navigation Handler function pagelayer_sc_post_nav(&$el){ $in_same_term = false; $taxonomies = 'category'; $title = ''; $arrows_list = $el['atts']['arrows_list']; if(!empty($el['atts']['in_same_term'])){ $in_same_term = true; $taxonomies = $el['atts']['taxonomies']; } if(!empty($el['atts']['post_title'])){ $title = '<span class="pagelayer-post-nav-title">%title</span>'; } $next_label = '<span class="pagelayer-next-holder"> <span class="pagelayer-post-nav-link"> '.$el["atts"]["next_label"].'</span>'.$title.' </span> <span class="pagelayer-post-nav-icon fa fa-'.$arrows_list.'-right"></span>'; $prev_label = '<span class="pagelayer-post-nav-icon fa fa-'.$arrows_list.'-left"></span> <span class="pagelayer-next-holder"> <span class="pagelayer-post-nav-link"> '.$el["atts"]["prev_label"].'</span>'.$title.' </span>'; $el['atts']['next_link'] = get_next_post_link('%link', $next_label, $in_same_term, '', $taxonomies); $el['atts']['prev_link'] = get_previous_post_link('%link', $prev_label, $in_same_term, '', $taxonomies ); } // Comments Handler function pagelayer_sc_post_comment(&$el){ global $post; // Is it custom ? if($el['atts']['post_type'] == 'custom' && !empty($el['atts']['post_id'])){ $orig_post = $post; $post = get_post($el['atts']['post_id']); } $post_id = $post->ID; //echo $post_id.' - '.$el['atts']['post_id']; if ( comments_open($post_id) || get_comments_number($post_id) ) { // Handel comments template echo ob_start(); comments_template(); $el['atts']['post_comment'] = '<div class="pagelayer-comments-template">'.ob_get_clean().'</div>'; // Comments are now closed if(!comments_open($post_id)){ $el['atts']['post_comment'] = '<div class="pagelayer-comments-close"> <h2>Comments are closed!</h2> </div>'; } }else{ $el['atts']['post_comment'] = ''; } if(pagelayer_is_live_template() || $post->post_type == 'pagelayer-template'){ $el['atts']['post_comment'] = '<div class="pagelayer-comments-close"> <center><h4>Comments section !</h4></center> </div>'; } if(!empty($orig_post)){ $post = $orig_post; } } // post navigation Handler function pagelayer_sc_post_info_list(&$el){ global $post; $el['atts']['post_info_content'] =''; switch($el['atts']['type']){ case 'author': $author_id = get_the_author_meta( 'ID' ) ? get_the_author_meta( 'ID' ) : $GLOBALS['post']->post_author; $el['atts']['link'] = get_author_posts_url( $author_id ); $el['atts']['avatar_url'] = get_avatar_url( $author_id, 96 ); $el['atts']['post_info_content'] = get_the_author_meta( 'display_name', $author_id ); break; case 'date': $format = [ 'default' => 'F j, Y', '0' => 'F j, Y', '1' => 'Y-m-d', '2' => 'm/d/Y', '3' => 'd/m/Y', 'custom' => empty( $el['atts']['date_format_custom'] ) ? 'F j, Y' : $el['atts']['date_format_custom'], ]; $el['atts']['post_info_content'] = get_the_time( $format[ $el['atts']['date_format'] ] ); $el['atts']['link'] = get_day_link( get_post_time( 'Y' ), get_post_time( 'm' ), get_post_time( 'j' ) ); break; case 'time': $format = [ 'default' => 'g:i a', '0' => 'g:i a', '1' => 'g:i A', '2' => 'H:i', 'custom' => empty( $el['atts']['time_format_custom'] ) ? 'F j, Y' : $el['atts']['time_format_custom'], ]; $el['atts']['post_info_content'] = get_the_time( $format[ $el['atts']['time_format'] ] ); if(!pagelayer_is_live_template()){ $el['atts']['link'] = 'javascript:void(0)'; $el['atts']['info_link'] = 1; } break; case 'comments': $el['atts']['post_info_content'] = (int) get_comments_number(); $el['atts']['link'] = get_comments_link(); // Comments are closed then dont show ! if(pagelayer_is_live_template() || $GLOBALS['post']->post_type == 'pagelayer-template'){ $el['atts']['post_info_content'] = 1; }elseif(!comments_open($post->ID)){ $el['atts']['post_info_content'] = ''; } break; case 'terms': $taxonomy = $el['atts']['taxonomy']; $terms = wp_get_post_terms( get_the_ID(), $taxonomy ); foreach ( $terms as $term ) { $el['atts']['post_info_content'] .= ' <a href="'. get_term_link( $term ) .'"> '. $term->name .' </a>'; } if(pagelayer_is_live_template() || $GLOBALS['post']->post_type == 'pagelayer-template'){ $el['atts']['post_info_content'] .= '<a>Dummy '.ucfirst(str_replace('_', ' ', $el['atts']['taxonomy'])).'</a>'; } $el['atts']['info_link'] = ''; break; case 'custom': $el['atts']['post_info_content'] = $el['atts']['type_custom']; $el['atts']['link'] = $el['atts']['info_custom_link']; break; } } // Post Content Handler - 2C function pagelayer_sc_post_content(&$el){ static $did_posts = []; global $pagelayer; $post_obj = get_post(); if(empty( $post_obj )){ return false; } if ( post_password_required( $post_obj->ID ) && !pagelayer_is_live() ) { $el['atts']['post_content'] = get_the_password_form( $post_obj->ID ); return; } // Avoid recursion if ( isset( $did_posts[$post_obj->ID] ) || pagelayer_is_live_template($post_obj) ) { $el['atts']['post_content'] = '<div style="min-height:20px;background-color:#e3e3e3;text-align:center">Post Content Holder</div>'; return; } // Is it an attachment if(is_attachment()){ $el['atts']['post_content'] = '<center>'.wp_get_attachment_image( get_the_ID(), 'full' ).'</center>'; return; } // To prevent recursion, set it to True $did_posts[$post_obj->ID] = true; $content = $post_obj->post_content; // If we are rendering a template and this post content is being edited live, then dont_make_editable is set true in pagelayer_get_post_content. Hence we need to set it as false and revert it after rendering the posts content ! if(!empty($pagelayer->dont_make_editable)){ $reset = $pagelayer->dont_make_editable; $pagelayer->dont_make_editable = false; // While rendering post content inside the template $rendering_template_id = $pagelayer->rendering_template_id; $pagelayer->rendering_template_id = $post_obj->ID; } // Split to pages. setup_postdata( $post_obj ); $content = apply_filters( 'the_content', get_the_content() ); if(!empty($reset)){ $pagelayer->rendering_template_id = $rendering_template_id; $pagelayer->dont_make_editable = $reset; } $content .= wp_link_pages( array( 'before' => '<p class="post-nav-links pagelayer-page-links"><span class="page-links-title pagelayer-page-links-title">' . __( 'Pages:') . '</span>', 'after' => '</p>', 'echo' => 0, ) ); $el['atts']['post_content'] = $content; } // Archive Posts shows the posts as per the QUERY of the current page function pagelayer_sc_archive_posts(&$el){ global $wp_query, $pagelayer; $query_args = $wp_query->query_vars; if(pagelayer_is_live() || (wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'pagelayer_archive_posts_data')){ $query_args = ['post_type' => 'post']; $dummy_pagination = 10; } $allow_param = array('show_thumb', 'thumb_size', 'show_content', 'show_title', 'more', 'btn_type', 'size', 'icon_position', 'icon', 'show_more', 'meta_sep', 'exc_length', 'thumb_img_type', 'infinite_types' ); $param = array(); foreach($allow_param as $val){ $param[$val] = !empty($el['atts'][$val]) ? $el['atts'][$val] : ''; } if(!empty($el['atts']['meta'])){ $meta_arr = explode(',',$el['atts']['meta']); //pagelayer_print($el['atts']['meta']); foreach($meta_arr as $arr){ $param[$arr] = $arr; } } if(!empty($el['atts']['thumb_img_type'])){ $thumb_size = pagelayer_isset($el['atts'], 'thumb_size'); $img_size = pagelayer_isset($el['tmp'], 'def_thumb_img-'.$thumb_size.'-url'); $param['def_thumb_img'] = empty($img_size) ? pagelayer_isset($el['tmp'], 'def_thumb_img-url') : $img_size; } $el['atts']['pagelayer_pagination_top'] = ''; $el['atts']['pagelayer_pagination_bottom'] = ''; if(!empty($el['atts']['pagination']) && empty($el['atts']['infinite_types'])){ // Create array for pagination $pagination = array( 'prev_next' => $el['atts']['pagination'] == 'number' ? false : true, 'prev_text' => __( pagelayer_isset($el['atts'], 'pagi_prev_text') ), 'next_text' => __( pagelayer_isset($el['atts'], 'pagi_next_text') ), 'end_size' => $el['atts']['pagi_end_size'], 'mid_size' => $el['atts']['pagi_mid_size'], 'before_page_number' => pagelayer_isset($el['atts'], 'before_page_number'), 'after_page_number' => pagelayer_isset($el['atts'], 'after_page_number'), ); if(!empty($dummy_pagination)){ $pagination['total'] = 10; } if( isset($el['atts']['pagination_on']) && $el['atts']['pagination_on'] == 'top'){ $el['atts']['pagelayer_pagination_top'] = '<div class="pagelayer-pagination">'.paginate_links($pagination).'</div>'; }else{ $el['atts']['pagelayer_pagination_bottom'] = '<div class="pagelayer-pagination">'.paginate_links($pagination).'</div>'; } } if(wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'pagelayer_infinite_posts'){ $query_args['paged'] = $el['atts']['paged']; }else{ $data = array('tag' => $el['tag'], 'atts' => $el['oAtts']); $pagelayer->localScript['pagelayer_post_'.$el['id']] = $data; } $el['atts']['pagelayer_archive_posts'] = pagelayer_posts($param, $query_args); } // Flipbox handler function pagelayer_sc_flipbox(&$el){ // Flipbox front heading image if(!empty($el['atts']['heading_image'])){ $heading_image_size = pagelayer_isset($el['atts'], 'heading_image_size'); $el['atts']['func_image'] = pagelayer_isset($el['tmp'], 'heading_image-'.$heading_image_size.'-url'); $el['atts']['func_image'] = empty($el['atts']['func_image']) ? pagelayer_isset($el['tmp'], 'heading_image-url') : $el['atts']['func_image']; } $back = pagelayer_isset($el['atts'], 'back_section'); if(pagelayer_is_live() && !empty($back)){ $el['attr'][] = 'back_section="'.$back.'"'; } } // Countdown handler function pagelayer_sc_countdown(&$el){ $exp = pagelayer_isset($el['atts'], 'display_expired_text'); if(pagelayer_is_live() && !empty($exp)){ $el['attr'][] = 'display_expired_text="'.$exp.'"'; } if(!isset($el['atts']['custom_label_text'])){ $el['atts']['days_label_text'] = 'Days'; $el['atts']['hours_label_text'] = 'Hours'; $el['atts']['minutes_label_text'] = 'Minutes'; $el['atts']['seconds_label_text'] = 'Seconds'; } } // Social Share Handler function pagelayer_sc_share(&$el){ if(empty($el['atts']['icon'])){ return; } $profileName = ''; if(isset($el['atts']['custom_profile'])){ $profileName = $el['atts']['custom_profile'].'/'; } $icon_splited = explode(' fa-', $el['atts']['icon']); $el['classes'][] = ['.pagelayer-share-content' => 'pagelayer-'.$icon_splited[1]]; $icon = $icon_splited[1]; $labelList = array( 'Facebook' => array( 'icons' => array('facebook', 'facebook-f', 'facebook-messenger', 'facebook-square', 'facebook-official'), 'url' => 'https://www.facebook.com/sharer/sharer.php?u=' ), 'Twitter' => array( 'icons' => array('twitter', 'twitter-square'), 'url' => 'https://twitter.com/intent/tweet?url=' ), 'X' => array( 'icons' => array('x-twitter', 'x-twitter-square'), 'url' => 'https://x.com/intent/post?url=' ), 'Google+' => array( 'icons' => array('google-plus', 'google-plus-square', 'google-plus-g'), 'url' => 'https://plus.google.com/share?url=' ), 'Instagram' => array( 'icons' => array('instagram'), 'url' => 'https://www.instagram.com/'.$profileName, 'no' => 1 ), 'Linkedin' => array( 'icons' => array('linkedin', 'linkedin-in', 'linkedin-square'), 'url' => 'https://www.linkedin.com/shareArticle?url=' ), 'pinterest' => array( 'icons' => array('pinterest', 'pinterest-p', 'pinterest-square'), 'url' => '//www.pinterest.com/pin/create/button/?url=' ), 'Reddit' => array( 'icons' => array('reddit-alien', 'reddit-square', 'reddit'), 'url' => 'https://reddit.com/submit?url=' ), 'Skype' => array( 'icons' => array('skype'), 'url' => 'https://web.skype.com/share?', 'no' => 1 ), 'Stumbleupon' => array( 'icons' => array('stumbleupon', 'stumbleupon-circle'), 'url' => 'https://www.stumbleupon.com/submit?url=' ), 'Telegram' => array( 'icons' => array('telegram', 'telegram-plane'), 'url' => 'https://t.me/share/url?url=' ), 'Tumblr' => array( 'icons' => array('tumblr', 'tumblr-square'), 'url' => 'https://www.tumblr.com/share/link?url=' ), 'VK' => array( 'icons' => array('vk'), 'url' => 'http://vk.com/share.php?url=' ), 'Weibo' => array( 'icons' => array('weibo'), 'url' => 'http://service.weibo.com/share/share.php?url=' ), 'WhatsApp' => array( 'icons' => array('whatsapp', 'whatsapp-square'), 'url' => 'whatsapp://send?text=' ), 'WordPress' => array( 'icons' => array('wordpress', 'wordpress-simple'), 'url' => 'https://wordpress.com/press-this.php?u=' ), 'Xing' => array( 'icons' => array('xing', 'xing-square'), 'url' => 'https://www.xing.com/spi/shares/new?url=' ), 'Delicious' => array( 'icons' => array('delicious'), 'url' => 'https://delicious.com/save?v=5&noui&jump=close&url=' ), 'Dribbble' => array( 'icons' => array('dribbble', 'dribbble-square'), 'url' => 'https://dribbble.com/shots/'.$profileName, 'no' => 1 ), 'Pocket' => array( 'icons' => array('get-pocket'), 'url' => 'https://getpocket.com/edit?url=' ), 'Email' => array( 'icons' => array('envelope', 'envelope-open', 'envelope-o'), 'url' => 'mailto:?body=' ) ); if(!empty($el['atts']['text'])){ $el['atts']['icon_label'] = $el['atts']['text']; }else{ foreach($labelList as $key => $val){ if(in_array($icon, $val['icons'])){ $el['atts']['icon_label'] = $key; break; } } } foreach($labelList as $key => $val){ if(in_array($icon, $val['icons'])){ if(empty($val['no'])){ $el['atts']['social_url'] = $val['url'].$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; }else{ $el['atts']['social_url'] = $val['url']; } break; } } } // If the excerpt for current post is there only then give function pagelayer_get_the_excerpt(){ global $post; if(!empty($post->post_excerpt)){ return $post->post_excerpt; } return ''; } function pagelayer_sc_post_excerpt(&$el){ $el['tmp']['post_excerpt'] = ''; $tmp_excerpt = pagelayer_get_the_excerpt(); if(!empty($tmp_excerpt) && strlen($tmp_excerpt) > 0){ $el['tmp']['post_excerpt'] = '<div class="pagelayer-post-excerpt">'.$tmp_excerpt.'</div>'; } if(pagelayer_is_live_template()){ $el['tmp']['post_excerpt'] = '<div class="pagelayer-post-excerpt pagelayer-empty-widget"></div>'; } } function pagelayer_sc_copyright(&$el){ $el['atts']['copyright_text'] = pagelayer_get_option('pagelayer-copyright'); $el['oAtts']['copyright_text'] = $el['atts']['copyright_text']; } // Pricing Handler function pagelayer_sc_pricing(&$el){ //Backward compatibility for new link props pagelayer_add_link_backward($el, array( 'link' => 'button_url', 'rel' => '', 'target' => 'button_url_target', 'selector' => '.pagelayer-pricing-btn' )); } // Post Title function pagelayer_sc_post_title(&$el){ $el['atts']['open_html_tag'] = !empty($el['atts']['html_tag']) ? '<'.$el['atts']['html_tag'].'>' :''; $el['atts']['close_html_tag'] = !empty($el['atts']['html_tag']) ? '</'.$el['atts']['html_tag'].'>' :''; } freemium.php 0000644 00000756743 15103567077 0007127 0 ustar 00 <?php ////////////////////////////////////////////////////////////// //=========================================================== // freemium.php //=========================================================== // PAGELAYER // Inspired by the DESIRE to be the BEST OF ALL // ---------------------------------------------------------- // Started by: Pulkit Gupta // Date: 23rd Jan 2017 // Time: 23:00 hrs // Site: http://pagelayer.com/wordpress (PAGELAYER) // ---------------------------------------------------------- // Please Read the Terms of use at http://pagelayer.com/tos // ---------------------------------------------------------- //=========================================================== // (c)Pagelayer Team //=========================================================== ////////////////////////////////////////////////////////////// // Are we being accessed directly ? if(!defined('PAGELAYER_PRO_VERSION')) { exit('Hacking Attempt !'); } global $pagelayer; // Posts options style $pagelayer_posts_options = array( 'type' => array( 'type' => 'select', 'label' => __pl('type'), 'default' => 'default', 'list' => array( 'default' => __pl('default'), ), ), 'infinite_types' => array( 'type' => 'radio', 'label' => __pl('infinite_scroll'), 'addClass' => ['pagelayer-infinite-posts','{{element}} .pagelayer-posts-container' => 'pagelayer-infinite-scroll-{{val}}'], 'list' => array( '' => __pl('none'), 'button' => __pl('Button'), 'auto' => __pl('Auto'), ), 'req' => ['!enable_slider' => 'true'], ), 'alignment' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'addClass' => 'pagelayer-arc-layout-{{val}}', 'list' => array( '' => __pl('default'), 'left' => __pl('left'), 'right' => __pl('right'), 'alt' => __pl('Alternative') ), ), 'columns' => array( 'type' => 'select', 'label' => __pl('columns'), 'np' => 1, 'screen' => 1, 'css' => ['{{element}} .pagelayer-posts-container' => 'grid-template-columns: repeat({{val}},1fr);'], 'list' => array( '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', ), ), 'col_gap' => array( 'type' => 'slider', 'label' => __pl('col_gap'), 'min' => 0, 'step' => 1, 'max' => 100, 'screen' => 1, 'css' => ['{{element}} .pagelayer-posts-container' => 'grid-column-gap: {{val}}px;'], ), 'row_gap' => array( 'type' => 'slider', 'label' => __pl('row_gap'), 'min' => 0, 'step' => 1, 'max' => 100, 'screen' => 1, 'css' => ['{{element}} .pagelayer-posts-container' => 'grid-row-gap: {{val}}px;'], ), 'data_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'default' => '5,5,5,5', 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-content' => 'padding : {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], ), 'data_margin' => array( 'type' => 'padding', 'label' => __pl('margin'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-col' => 'margin :{{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], ), 'bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-wposts-col' => 'background-color:{{val}};'], ), 'box_shadow' => array( 'type' => 'box_shadow', 'label' => __pl('box_shadow'), 'css' => ['{{element}} .pagelayer-wposts-col' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}} !important;'], ), 'post_bor_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ) ), 'post_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => [ '{{element}} .pagelayer-wposts-col' => 'border-style: {{val}};', ], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'post_bor_hover' => '' ), ), 'post_border_color' => array( 'type' => 'color', 'label' => __pl('border_color_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-wposts-col' => 'border-color: {{val}};'], 'req' => array( '!post_border_type' => '' ), 'show' => array( 'post_bor_hover' => '' ), ), 'post_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-col' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!post_border_type' => '' ], 'show' => array( 'post_bor_hover' => '' ), ), 'post_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-col' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!post_border_type' => '', ), 'show' => array( 'post_bor_hover' => '', ), ), 'post_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => [ '{{element}} .pagelayer-wposts-col:hover' => 'border-style: {{val}}', ], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'post_bor_hover' => 'hover' ), ), 'post_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color_hover_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-wposts-col:hover' => 'border-color: {{val}};'], 'req' => array( '!post_border_type_hover' => '' ), 'show' => array( 'post_bor_hover' => 'hover' ), ), 'post_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width_hover'), 'screen' => 1, 'css' => [ '{{element}} .pagelayer-wposts-col:hover' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px;' ], 'req' => [ '!post_border_type_hover' => '' ], 'show' => array( 'post_bor_hover' => 'hover' ), ), 'post_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius_hover'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-col:hover' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!post_border_type_hover' => '', ), 'show' => array( 'post_bor_hover' => 'hover', ), ), 'anim_hover' => array( 'type' => 'select', 'label' => __pl('Post Animation'), 'addClass' => ['{{element}} .pagelayer-wposts-col' => 'pagelayer-animation-{{val}}'], 'list' => [ '' => __pl('none'), 'grow' => __pl('Grow'), 'shrink' => __pl('Shrink'), 'pulse' => __pl('Pulse'), 'pulse-grow' => __pl('Pulse Grow'), 'pulse-shrink' => __pl('Pulse Shrink'), 'push' => __pl('Push'), 'pop' => __pl('Pop'), 'buzz' => __pl('Buzz'), 'buzz-out' => __pl('Buzz Out'), 'float' => __pl('Float'), 'sink' => __pl('Sink'), 'bob' => __pl('Bob'), 'hang' => __pl('Hang'), 'bounce-in' => __pl('Bounce In'), 'bounce-out' => __pl('Bounce Out'), 'rotate' => __pl('Rotate'), 'grow-rotate' => __pl('Grow Rotate'), 'skew-forward' => __pl('Skew Forward'), 'skew-backward' => __pl('Skew Backward'), 'wobble-vertical' => __pl('Wobble Vertical'), 'wobble-horizontal' => __pl('Wobble Horizontal'), 'wobble-bottom-to-right' => __pl('Wobble Bottom To Right'), 'wobble-top-to-right' => __pl('Wobble Top To Right'), 'wobble-top' => __pl('Wobble Top'), 'wobble-bottom' => __pl('Wobble Bottom'), 'wobble-skew' => __pl('Wobble Skew'), ], ) ); // Posts thumb style $pagelayer_thumb_style = [ 'show_thumb' => array( 'label' => __pl('show_thumb'), 'type' => 'checkbox', 'default' => 'true', //'addAttr' => ['{{element}} a' => 'target="_blank"'], ), 'thumb_img_type' => array( 'type' => 'select', 'label' => __pl('thumb_img_type'), 'list' => array( '' => __pl('default'), 'custom' => __pl('custom') ), 'req' => ['show_thumb' => 'true'], ), 'def_thumb_img' => array( 'type' => 'image', 'label' => __pl('image'), 'req' => [ 'show_thumb' => 'true', 'thumb_img_type' => 'custom', ] ), 'thumb_size' => array( 'type' => 'select', 'label' => __pl('type'), 'default' => 'medium_large', 'list' => pagelayer_image_sizes(), 'req' => ['show_thumb' => 'true'], ), 'ratio' => array( 'type' => 'slider', 'label' => __pl('ratio'), 'min' => 0, 'step' => 0.1, 'max' => 2, 'default' => 0.7, 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-thumb' => 'padding: calc(50% * {{val}}) 0;'], 'req' => ['show_thumb' => 'true'], ), ]; // Posts type style $pagelayer_title_style = [ 'show_title' => array( 'type' => 'checkbox', 'label' => __pl('show_title'), 'default' => 'true', ), 'title_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-wposts-title' => 'color:{{val}};'], 'req' => ['show_title' => 'true'], ), 'title_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',18,,,,,,,,,', 'css' => ['{{element}} .pagelayer-wposts-title' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => ['show_title' => 'true'], ), 'title_spacing' => array( 'type' => 'dimension', 'label' => __pl('top_bottom_spacing'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-title' => 'padding-top:{{val[0]}}px; padding-bottom:{{val[1]}}px;'], 'req' => ['show_title' => 'true'], ), ]; // Posts meta options $pagelayer_meta_style = [ 'meta' => array( 'type' => 'multiselect', 'label' => __pl('meta'), 'default' => 'author,date', 'list' => array( 'date' => __pl('date'), 'author' => __pl('author'), 'comments' => __pl('comments'), 'tags' => __pl('tags'), 'category' => __pl('category'), ), ), 'meta_sep' => array( 'type' => 'text', 'label' => __pl('separator'), 'default' => ' | ', ), 'meta_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-wposts-meta *' => 'color:{{val}};'], ), 'meta_bg' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} .pagelayer-wposts-meta' => 'background-color:{{val}};'], ), 'meta_align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-meta' => 'text-align:{{val}};'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), ), 'meta_spacing' => array( 'type' => 'padding', 'label' => __pl('spacing'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-meta' => 'padding-top:{{val[0]}}px; padding-right:{{val[1]}}px; padding-bottom:{{val[2]}}px; padding-left:{{val[3]}}px;'], ), 'meta_bor_rad' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => ['px', '%'], 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-meta' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], ), 'meta_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} .pagelayer-wposts-meta *' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', '{{element}} .pagelayer-wposts-sep' => 'font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important;' ], ), 'meta_tag_pos' => array( 'type' => 'select', 'label' => __pl('position'), 'screen' => 1, 'css' => [ '{{element}} .pagelayer-wposts-post' => 'position: relative;', '{{element}} .pagelayer-wposts-meta' => 'position: {{val}};' ], 'list' => array( '' => __pl('default'), 'relative' => __pl('relative'), 'absolute' => __pl('absolute') ), ), 'meta_width' => [ 'type' => 'slider', 'label' => __pl('width'), 'screen' => 1, 'units' => ['px','%','em'], 'css' => ['{{element}} .pagelayer-wposts-meta' => 'width:{{val}};'], 'min' => 0, 'max' => 1000, 'step' => 1, 'req' => ['!meta_tag_pos' => ''] ], 'meta_vposition' => [ 'type' => 'select', 'label' => __pl('verticle_pos'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-meta' => '{{val}}:0;'], 'list' => [ '' => __pl('default'), 'top' => __pl('top'), 'bottom' => __pl('bottom') ], 'req' => ['!meta_tag_pos' => ''] ], 'meta_vposition_offset' => [ 'type' => 'slider', 'label' => __pl('ver_offset'), 'screen' => 1, 'units' => ['px','%','em'], 'css' => ['{{element}} .pagelayer-wposts-meta' => '{{meta_vposition}}:{{val}};'], 'min' => -1000, 'max' => 1000, 'step' => 1, 'req' => [ '!meta_vposition' => '', '!meta_tag_pos' => '' ] ], 'meta_hposition' => [ 'type' => 'select', 'label' => __pl('horizontal_pos'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-meta' => '{{val}}:0;'], 'list' => [ '' => __pl('default'), 'left' => __pl('left'), 'right' => __pl('right') ], 'req' => ['!meta_tag_pos' => ''] ], 'meta_hposition_offset' => [ 'type' => 'slider', 'label' => __pl('hor_offset'), 'screen' => 1, 'units' => ['px','%','em'], 'css' => ['{{element}} .pagelayer-wposts-meta' => '{{meta_hposition}}:{{val}};'], 'min' => -1000, 'max' => 1000, 'step' => 1, 'req' => [ '!meta_hposition' => '', '!meta_tag_pos' => '' ] ] ]; // Posts content style $pagelayer_content_style = [ 'show_content' => array( 'type' => 'select', 'label' => __pl('show_content'), 'default' => 'excerpt', 'list' => array( '' => __pl('none'), 'excerpt' => __pl('excerpt'), 'full' => __pl('full'), ), ), 'exc_length' => array( 'type' => 'spinner', 'label' => __pl('exc_length'), 'min' => 0, 'step' => 1, 'max' => 500, 'default' => 10, 'req' => ['show_content' => 'excerpt'] ), 'content_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#121212', 'css' => ['{{element}} .pagelayer-wposts-content' => 'color:{{val}};'], ), 'content_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-content .pagelayer-wposts-excerpt' => 'padding: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], ), 'content_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-wposts-excerpt' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'content_align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'left', 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-content' => 'text-align:{{val}};'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), ), ]; //Post Infinite Style $pagelayer_infinite_style = array( 'infinite_text' => array( 'type' => 'text', 'label' => __pl('Button Text'), 'default' => 'Load More', 'req' => ['infinite_types' => 'button'] ), 'infinite_final' => array( 'type' => 'text', 'addAttr' => ['{{element}} .pagelayer_load_button' => 'data-text="{{infinite_final}}"'], 'label' => __pl('Post End Message'), 'default' => 'No More Post', ), 'infinite_full_width' => array( 'type' => 'checkbox', 'label' => __pl('stretch'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-load' => 'width: 100% !important; text-align: center;', '{{element}} .pagelayer_load_button' =>'text-align: center;'], ), 'btn_typo' => array( 'type' => 'typography', 'label' => __pl('quote_content_typo'), 'css' => [ '{{element}} .pagelayer-btn-load-text' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', '{{element}} .pagelayer_load_button' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', ], ), 'load_align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'css' => ['{{element}} .pagelayer_load_button' => 'text-align:{{val}}'], 'req' => ['infinite_types' => 'button', 'infinite_full_width' => ''] ), 'load_margin' => array( 'type' => 'padding', 'label' => __pl('margin'), 'screen' => 1, 'css' => ['{{element}} .pagelayer_load_button' => 'margin :{{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], ), 'load_btn_icon' => array( 'type' => 'icon', 'label' => __pl('service_box_font_icon_label'), ), 'load_btn_icon_position' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'pagelayer-btn-icon-left', 'list' => array( 'pagelayer-btn-icon-left' => __pl('left'), 'pagelayer-btn-icon-right' => __pl('right') ), 'req' => array( '!load_btn_icon' => '' ), ), 'load_btn_icon_spacing' => array( 'type' => 'slider', 'label' => __pl('icon_spacing'), 'min' => 1, 'step' => 1, 'max' => 100, 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-load-icon' => 'padding: 0 {{val}}px;'], 'req' => ['!btn_icon' => ''], ), 'infinite_btn_type' => array( 'type' => 'select', 'label' => __pl('button_type_label'), 'default' => 'pagelayer-btn-default', 'list' => array( 'pagelayer-btn-default' => __pl('btn_type_default'), 'pagelayer-btn-primary' => __pl('btn_type_primary'), 'pagelayer-btn-secondary' => __pl('btn_type_secondary'), 'pagelayer-btn-success' => __pl('btn_type_success'), 'pagelayer-btn-info' => __pl('btn_type_info'), 'pagelayer-btn-warning' => __pl('btn_type_warning'), 'pagelayer-btn-danger' => __pl('btn_type_danger'), 'pagelayer-btn-dark' => __pl('btn_type_dark'), 'pagelayer-btn-light' => __pl('btn_type_light'), 'pagelayer-btn-link' => __pl('btn_type_link'), 'pagelayer-btn-anim' => __pl('btn_type_anim'), 'pagelayer-btn-custom' => __pl('btn_type_custom') ), ), 'infinite_anim_type' => array( 'type' => 'select', 'label' => __pl('type'), 'default' => 'glow', 'addClass' => ['{{element}} .pagelayer-btn-load' => 'pagelayer-btn-anim-{{val}}'], 'list' => array( 'glow' => __pl('glow_button'), 'thin' => __pl('thin_button'), 'slide' => __pl('slide_button') ), 'req' => array( 'infinite_btn_type' => 'pagelayer-btn-anim' ), ), 'infinite_direction' => array( 'type' => 'select', 'label' => __pl('animation_direction'), 'default' => 'pagelayer-btn-anim-left', 'addClass' => ['{{element}} .pagelayer-btn-load' => '{{val}}'], 'list' => array( 'pagelayer-btn-anim-left' => __pl('left'), 'pagelayer-btn-anim-right' => __pl('right'), ), 'req' => array( 'infinite_anim_type' => 'slide', 'infinite_btn_type' => 'pagelayer-btn-anim', ), ), 'infinite_btn_size' => array( 'type' => 'select', 'label' => __pl('button_size_label'), 'default' => 'pagelayer-btn-large', 'list' => array( 'pagelayer-btn-mini' => __pl('mini'), 'pagelayer-btn-small' => __pl('small'), 'pagelayer-btn-large' => __pl('large'), 'pagelayer-btn-extra-large' => __pl('extra_large'), 'pagelayer-btn-double-large' => __pl('double_large'), 'pagelayer-btn-custom' => __pl('custom'), ) ), 'infinite_btn_custom_size' => array( 'type' => 'spinner', 'label' => __pl('btn_custom_size'), 'min' => 1, 'step' => 1, 'max' => 100, 'default' => 5, 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-load' => 'padding: calc({{val}}px / 2) {{val}}px;'], 'req' => array( 'infinite_btn_size' => ['pagelayer-btn-custom','pagelayer-btn-anim'], ), ), 'infinite_btn_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), 'req' => array( 'infinite_btn_type' => ['pagelayer-btn-custom','pagelayer-btn-anim'], ), ), 'infinite_btn_bg_color' => array( 'type' => 'color', 'label' => __pl('btn_bg_color_label'), 'default' => '#818a91', 'css' => [ '{{element}} .pagelayer-btn-load' => 'background-color: {{val}};', '{{element}} .pagelayer-btn-anim-thin' => 'background-color: unset !important;', '{{element}} .pagelayer-btn-anim-thin::before' => 'background-color: {{val}};', '{{element}} .pagelayer-btn-anim-thin::after' => 'background-color: {{val}};', ], 'req' => array( 'infinite_btn_type' => ['pagelayer-btn-custom','pagelayer-btn-anim'], ), 'show' => array( 'infinite_btn_hover' => '' ), ), 'infinite_btn_color' => array( 'type' => 'color', 'label' => __pl('btn_color_label'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-btn-load' => 'color: {{val}};'], 'req' => array( 'infinite_btn_type' => ['pagelayer-btn-custom','pagelayer-btn-anim'], ), 'show' => array( 'infinite_btn_hover' => '' ), ), 'infinite_btn_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('btn_hover_delay_label'), 'desc' => __pl('btn_hover_delay_desc'), 'min' => 0, 'step' => 100, 'max' => 5000, 'default' => 400, 'css' => ['{{element}} .pagelayer-btn-load' => '-webkit-transition: all {{val}}ms !important; transition: all {{val}}ms !important;'], 'show' => array( 'infinite_btn_type' => ['pagelayer-btn-custom','pagelayer-btn-anim'], 'infinite_btn_hover' => 'hover' ), ), 'infinite_btn_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('btn_bg_color_hover_label'), 'css' => [ '{{element}} .pagelayer-btn-custom:hover, {{element}} .pagelayer-btn-anim-slide:after' => 'background-color: {{val}};', ], 'req' => array( 'infinite_btn_type' => ['pagelayer-btn-custom','pagelayer-btn-anim'], '!infinite_anim_type' => ['glow','thin'], ), 'show' => array( 'infinite_btn_hover' => 'hover', '!infinite_anim_type' => ['glow','thin'], ), ), 'infinite_btn_color_hover' => array( 'type' => 'color', 'label' => __pl('btn_color_hover_label'), 'css' => ['{{element}} .pagelayer-btn-load:hover' => 'color: {{val}};'], 'req' => array( 'infinite_btn_type' => ['pagelayer-btn-custom','pagelayer-btn-anim'], ), 'show' => array( 'infinite_btn_hover' => 'hover' ), ), 'infinite_btn_shadow' => [ 'type' => 'box_shadow', 'label' => __pl('shadow'), 'css' => ['{{element}} .pagelayer-btn-load' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}} !important;'], ], 'infinite_btn_shadow_hover' => [ 'type' => 'box_shadow', 'label' => __pl('box_shadow_hover'), 'css' => ['{{element}} .pagelayer-btn-load:hover' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}} !important;'], ], 'infinite_btn_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => [ '{{element}} .pagelayer-btn-load, {{element}} .pagelayer-btn-anim-thin:after, {{element}} .pagelayer-btn-anim-thin:before' => 'border-style: {{val}};', '{{element}} .pagelayer-btn-anim-thin' => 'border-style: unset !important;', ], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'infinite_btn_hover' => '' ), ), 'infinite_btn_border_color' => array( 'type' => 'color', 'label' => __pl('border_color_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-btn-load' => 'border-color: {{val}};'], 'req' => array( '!infinite_btn_border_type' => '' ), 'show' => array( 'infinite_btn_hover' => '' ), ), 'infinite_btn_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-load, {{element}} .pagelayer-btn-anim-thin:after, {{element}} .pagelayer-btn-anim-thin:before' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!infinite_btn_border_type' => '' ], 'show' => ['infinite_btn_hover' => ''], ), 'infinite_btn_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-load, {{element}} .pagelayer-btn-anim-glow:before' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!infinite_btn_border_type' => '', '!infinite_anim_type' => 'slide' ), 'show' => array( 'infinite_btn_hover' => '', '!infinite_anim_type' => 'slide' ), ), 'infinite_btn_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => [ '{{element}} .pagelayer-btn-load:hover, {{element}} .pagelayer-btn-anim-thin:hover:after, {{element}} .pagelayer-btn-anim-thin:hover:before' => 'border-style: {{val}}', '{{element}} .pagelayer-btn-anim-thin:hover' => 'border-style: unset !important;', ], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'infinite_btn_hover' => 'hover' ), ), 'infinite_btn_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color_hover_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-btn-load:hover' => 'border-color: {{val}};'], 'req' => array( '!btn_border_type_hover' => '' ), 'show' => array( 'infinite_btn_hover' => 'hover' ), ), 'infinite_btn_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width_hover'), 'screen' => 1, 'css' => [ '{{element}} .pagelayer-btn-load:hover, {{element}} .pagelayer-btn-anim-thin:hover:after, {{element}} .pagelayer-btn-anim-thin:hover:before' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px;' ], 'req' => [ '!infinite_btn_border_type_hover' => '' ], 'show' => array( 'infinite_btn_hover' => 'hover' ), ), 'infinite_btn_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius_hover'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-load:hover, {{element}} .pagelayer-btn-anim-glow:before' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!btn_border_type_hover' => '', '!anim_type' => 'slide' ), 'show' => array( 'infinite_btn_hover' => 'hover', '!infinite_anim_type' => 'slide' ), ), ); // Post More style $pagelayer_more_style = [ 'show_more' => array( 'type' => 'checkbox', 'label' => __pl('show'), ), 'more' => array( 'type' => 'text', 'label' => __pl('text'), 'default' => 'read more »', 'req' => ['show_more' => 'true'], ), 'more_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-wposts-more' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => ['show_more' => 'true'], ), 'full_width' => array( 'type' => 'checkbox', 'label' => __pl('stretch'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'width: 100%; text-align: center;'], 'req' => ['show_more' => 'true'], ), 'align' => array( 'type' => 'radio', 'label' => __pl('obj_align_label'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-mdiv' => 'text-align: {{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ), 'req' => array( 'full_width' => '', 'show_more' => 'true', ) ), 'icon' => array( 'type' => 'icon', 'label' => __pl('service_box_font_icon_label'), 'req' => ['show_more' => 'true'], ), 'icon_position' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'pagelayer-btn-icon-left', 'list' => array( 'pagelayer-btn-icon-left' => __pl('left'), 'pagelayer-btn-icon-right' => __pl('right') ), 'req' => [ 'show_more' => 'true', '!icon' => '' ], ), 'icon_spacing' => array( 'type' => 'slider', 'label' => __pl('icon_spacing'), 'min' => 1, 'step' => 1, 'max' => 100, 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-icon' => 'padding: 0 {{val}}px;'], 'req' => array( '!icon' => '', 'show_more' => 'true', ), ), 'btn_type' => array( 'type' => 'select', 'label' => __pl('button_type'), //'addClass' => ['{{element}} .pagelayer-btn-holder' => '{{val}}'], 'list' => array( 'pagelayer-btn-link' => __pl('btn_type_link'), 'pagelayer-btn-default' => __pl('btn_type_default'), 'pagelayer-btn-primary' => __pl('btn_type_primary'), 'pagelayer-btn-secondary' => __pl('btn_type_secondary'), 'pagelayer-btn-success' => __pl('btn_type_success'), 'pagelayer-btn-info' => __pl('btn_type_info'), 'pagelayer-btn-warning' => __pl('btn_type_warning'), 'pagelayer-btn-danger' => __pl('btn_type_danger'), 'pagelayer-btn-dark' => __pl('btn_type_dark'), 'pagelayer-btn-light' => __pl('btn_type_light'), 'pagelayer-btn-custom' => __pl('btn_type_custom') ), 'req' => ['show_more' => 'true'], ), 'size' => array( 'type' => 'select', 'label' => __pl('button_size_label'), 'list' => array( 'pagelayer-btn-mini' => __pl('mini'), 'pagelayer-btn-small' => __pl('small'), 'pagelayer-btn-large' => __pl('large'), 'pagelayer-btn-extra-large' => __pl('extra_large'), 'pagelayer-btn-double-large' => __pl('double_large'), 'pagelayer-btn-custom' => __pl('custom'), ), 'req' => ['show_more' => 'true'], ), 'btn_custom_size' => array( 'type' => 'dimension', 'label' => __pl('btn_custom_size'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-more.pagelayer-btn-holder' => 'padding: {{val[0]}}px {{val[1]}}px;'], 'req' => array( 'size' => 'pagelayer-btn-custom', 'show_more' => 'true', ), ), 'btn_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => '', 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), 'req' => array( 'btn_type' => 'pagelayer-btn-custom', 'show_more' => 'true', ), ), 'btn_bg_color' => array( 'type' => 'color', 'label' => __pl('btn_bg_color_label'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'background-color: {{val}};'], 'req' => array( 'btn_type' => 'pagelayer-btn-custom', 'show_more' => 'true', ), 'show' => array( 'btn_hover' => '' ), ), 'more_color' => array( 'type' => 'color', 'label' => __pl('color'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-more' => 'color:{{val}};'], 'req' => array( 'btn_type' => 'pagelayer-btn-custom', 'show_more' => 'true', ), 'show' => array( 'btn_hover' => '' ), ), 'btn_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('btn_hover_delay_label'), 'desc' => __pl('btn_hover_delay_desc'), 'min' => 0, 'step' => 100, 'max' => 5000, 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => '-webkit-transition: all {{val}}ms !important; transition: all {{val}}ms !important;'], 'show' => array( 'btn_hover' => 'hover' ), 'req' => ['show_more' => 'true'], ), 'btn_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('btn_bg_color_hover_label'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'background-color: {{val}};'], 'req' => array( 'btn_type' => 'pagelayer-btn-custom', 'show_more' => 'true', ), 'show' => array( 'btn_hover' => 'hover' ), ), 'more_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-wposts-more:hover' => 'color:{{val}};'], 'req' => array( 'btn_type' => 'pagelayer-btn-custom', 'show_more' => 'true', ), 'show' => array( 'btn_hover' => 'hover' ), ), ]; // Post More style $pagelayer_btn_border_style = [ 'btn_bor_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => '', //'no_val' => 1,// Dont set any value to element 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ) ), 'btn_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'btn_bor_hover' => '' ) ), 'btn_border_color' => array( 'type' => 'color', 'label' => __pl('border_color_label'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-color: {{val}};'], 'req' => array( '!btn_border_type' => '' ), 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!btn_border_type' => '' ], 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!btn_border_type' => '' ), 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'btn_bor_hover' => 'hover' ) ), 'btn_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color_hover_label'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'border-color: {{val}};'], 'req' => array( '!btn_border_type_hover' => '' ), 'show' => array( 'btn_bor_hover' => 'hover' ), ), 'btn_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width_hover'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!btn_border_type_hover' => '' ], 'show' => array( 'btn_bor_hover' => 'hover' ), ), 'btn_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius_hover'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!btn_border_type_hover' => '' ), 'show' => array( 'btn_bor_hover' => 'hover' ), ), ]; // Archives Post title pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_archive_title', array( 'name' => __pl('archive_title'), 'group' => 'archive', 'html' => '<div class="pagelayer-archive-title">'. pagelayer_get_the_title() .'</div>', 'params' => array( 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'np' => 1, 'list' => [ 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ], 'css' => ['{{element}} .pagelayer-archive-title' => 'text-align: {{val}}'], ), 'color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-archive-title' => 'color:{{val}}'], ), 'typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-archive-title' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ) ) ); // Archive Posts shows the posts as per the QUERY of the current page pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_archive_posts', array( 'name' => __pl('archive_posts'), 'group' => 'archive', 'html' => '{{pagelayer_pagination_top}} <div class="pagelayer-posts-container">{{pagelayer_archive_posts}}</div> {{pagelayer_pagination_bottom}} <div if="{{infinite_types}}" class="pagelayer_load_button" data-text={{infinite_final}}> <a class="pagelayer-btn-holder pagelayer-btn-load pagelayer-ele-link {{infinite_btn_type}} {{infinite_btn_size}} {{load_btn_icon_position}}"> <i if="{{load_btn_icon}}" class="{{load_btn_icon}} pagelayer-btn-load-icon"></i> <span if="{{infinite_text}}" class="pagelayer-btn-load-text" >{{infinite_text}}</span> <i if="{{load_btn_icon}}" class="{{load_btn_icon}} pagelayer-btn-load-icon"></i> </a> <div class="pagelayer-loader-holder" > <i class="fa fa-spinner fa-spin fa-3x fa-fw" aria-hidden="true"></i> </div> </div>', 'params' => $pagelayer_posts_options, 'thumb_style' => $pagelayer_thumb_style, 'title_style' => $pagelayer_title_style, 'meta_options' => $pagelayer_meta_style, 'content_style' => $pagelayer_content_style, 'more_style' => $pagelayer_more_style, 'infinite' => $pagelayer_infinite_style, 'paginate_links' => array( 'pagination' => array( 'type' => 'select', 'label' => __pl('pagination'), 'default' => 'number_prev_next', 'list' => array( '' => __pl('none'), 'number' => __pl('number'), 'number_prev_next' => __pl('number_prev_next'), ), ), 'pagination_on' => array( 'type' => 'select', 'label' => __pl('pagination_on'), 'list' => array( '' => __pl('bottom'), 'top' => __pl('top'), ), 'req' => ['!pagination' => ''] ), 'pagi_prev_text' => array( 'type' => 'text', 'label' => __pl('prev_text'), 'default' => 'Previous', 'req' => ['!pagination' => ['', 'number']] ), 'pagi_next_text' => array( 'type' => 'text', 'label' => __pl('next_text'), 'default' => 'Next', 'req' => ['!pagination' => ['', 'number']] ), 'pagi_end_size' => array( 'type' => 'spinner', 'label' => __pl('pagi_end_size'), 'default' => 1, 'req' => ['!pagination' => ''] ), 'pagi_mid_size' => array( 'type' => 'spinner', 'label' => __pl('pagi_mid_size'), 'default' => 2, 'req' => ['!pagination' => ''] ), 'before_page_number' => array( 'type' => 'text', 'label' => __pl('before_page_number'), 'req' => ['!pagination' => ''] ), 'after_page_number' => array( 'type' => 'text', 'label' => __pl('after_page_number'), 'req' => ['!pagination' => ''] ), ), 'paginate_links_style' => array( 'pagi_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} .pagelayer-pagination' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', ], 'req' => ['!pagination' => ''] ), 'pagi_align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'css' => ['{{element}} .pagelayer-pagination' => 'text-align:{{val}}'], 'req' => ['!pagination' => ''] ), 'pagi_colors' => array( 'type' => 'radio', 'label' => __pl('colors'), 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), 'active' => __pl('active'), ), 'req' => ['!pagination' => ''] ), 'pagi_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-pagination a.page-numbers' => 'color:{{val}}'], 'show' => [ 'pagi_colors' => 'normal'], 'req' => ['!pagination' => ''] ), 'pagi_hover_color' => array( 'type' => 'color', 'label' => __pl('current_color'), 'css' => ['{{element}} .pagelayer-pagination a.page-numbers:hover' => 'color:{{val}}'], 'show' => [ 'pagi_colors' => 'hover'], 'req' => ['!pagination' => ''] ), 'pagi_current_color' => array( 'type' => 'color', 'label' => __pl('current_color'), 'css' => ['{{element}} .pagelayer-pagination .current' => 'color:{{val}}'], 'show' => [ 'pagi_colors' => 'active'] ), 'pagi_space_between' => array( 'type' => 'slider', 'label' => __pl('space_between'), 'css' => ['{{element}} .pagelayer-pagination .page-numbers:not(:last-child)' => 'margin-right:{{val}}px'], 'req' => ['!pagination' => ''] ), 'pagi_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'css' => ['{{element}} .pagelayer-pagination' => 'padding:{{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => ['!pagination' => ''] ), ), 'styles' => array( 'thumb_style' => __pl('thumb_style'), 'title_style' => __pl('title_style'), 'meta_options' => __pl('meta_options'), 'content_style' => __pl('content_style'), 'more_style' => __pl('more_style'), 'paginate_links' => __pl('paginate_links'), 'paginate_links_style' => __pl('paginate_links_style'), 'infinite' => __pl('infinite_scroll'), ), ) ); // Site Title pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_wp_title', array( 'name' => __pl('Site Title'), 'group' => 'wordpress', 'html' => '<div class="pagelayer-wp-title-content"> <div class="pagelayer-wp-title-section"> <a href="'.get_site_url().'" class="pagelayer-wp-title-link pagelayer-ele-link"> <img if="{{site_logo}}" class="pagelayer-img pagelayer-wp-title-img" src="{{func_image}}" title="{{{logo_img-title}}}" alt="{{{logo_img-alt}}}"/> <div class="pagelayer-wp-title-holder"> <div class="pagelayer-wp-title-heading">'.get_bloginfo( 'name' ).'</div> <div if="{{site_desc}}" class="pagelayer-wp-title-desc">'.get_bloginfo( 'description' ).'</div> </div> </a> </div> <div>', 'params' => array( 'site_title_style' => array( 'type' => 'typography', 'label' => __pl('typography'), 'np' => 1, 'css' => ['{{element}} .pagelayer-wp-title-heading' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'site_title_state' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => 'normal', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'title_color' => array( 'type' => 'color', 'label' => __pl('text_color'), 'np' => 1, 'css' => ['{{element}} .pagelayer-wp-title-heading' => 'color:{{val}};'], 'show' => ['!site_title_state' => 'hover'], ), 'title_color_hover' => array( 'type' => 'color', 'label' => __pl('text_color'), 'css' => ['{{element}} .pagelayer-wp-title-heading:hover' => 'color:{{val}};'], 'show' => ['site_title_state' => 'hover'], ), 'title_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('service_icon_hover_delay'), 'min' => 0, 'step' => 100, 'max' => 5000, 'css' => ['{{element}} .pagelayer-wp-title-heading' => '-webkit-transition: all {{val}}ms; transition: all {{val}}ms;'], 'show' => ['site_title_state' => 'hover'], ), 'text-align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'center', 'screen' => 1, 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ), 'css' => ['{{element}} .pagelayer-wp-title-heading' => 'text-align:{{val}};'], ), 'title_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-wp-title-heading' => 'padding: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], ), 'disable_title' => array( 'type' => 'checkbox', 'label' => __pl('disable_title'), 'desc' => __pl('disable_title_exp'), 'np' => 1, 'css' => ['{{element}} .pagelayer-wp-title-holder' => 'display: none;'], 'req' => ['site_logo' => 'true'] ), ), 'site_description' => array( 'site_desc' => array( 'type' => 'checkbox', 'label' => __pl('site_desc'), 'np' => 1, ), 'site_desc_style' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-wp-title-desc' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => ['site_desc' => 'true'] ), 'site_desc_state' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => 'normal', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), 'req' => ['site_desc' => 'true'] ), 'desc_color' => array( 'type' => 'color', 'label' => __pl('text_color'), 'css' => ['{{element}} .pagelayer-wp-title-desc' => 'color:{{val}};'], 'show' => ['site_desc_state' => 'normal'], 'req' => ['site_desc' => 'true'] ), 'desc_color_hover' => array( 'type' => 'color', 'label' => __pl('text_color'), 'css' => ['{{element}} .pagelayer-wp-title-desc:hover' => 'color:{{val}};'], 'show' => ['site_desc_state' => 'hover'], 'req' => ['site_desc' => 'true'] ), 'desc_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('service_icon_hover_delay'), 'min' => 0, 'step' => 100, 'max' => 5000, 'css' => ['{{element}} .pagelayer-wp-title-desc' => '-webkit-transition: all {{val}}ms; transition: all {{val}}ms;'], 'show' => ['site_desc_state' => 'hover'], 'req' => ['site_desc' => 'true'] ), 'desc_text_align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'screen' => 1, 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ), 'css' => ['{{element}} .pagelayer-wp-title-desc' => 'text-align:{{val}};'], 'req' => ['site_desc' => 'true'] ), 'desc_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-wp-title-desc' => 'padding: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => ['site_desc' => 'true'] ), ), 'logo_style' => array( 'site_logo' => array( 'type' => 'checkbox', 'label' => __pl('site_logo'), 'np' => 1, //'desc' => __pl('site_logo_desc'), ), 'logo_img_type' => array( 'type' => 'select', 'label' => __pl('logo_img_type'), 'np' => 1, 'list' => array( '' => __pl('default_logo'), 'custom-logo' => __pl('custom_logo'), ), 'req' => array( 'site_logo' => 'true' ) ), 'logo_img' => array( 'type' => 'image', 'label' => __pl('logo_select'), 'np' => 1, 'ai' => false, 'req' => array( 'site_logo' => 'true', 'logo_img_type' => 'custom-logo', ) ), 'logo_img_size' => array( 'type' => 'radio', 'label' => __pl('logo_size'), 'default' => 'full', 'list' => array( 'full' => __pl('full'), 'thumbnail' => __pl('thumbnail'), 'custom' => __pl('custom'), ), 'req' => array( 'site_logo' => 'true' ) ), 'logo_img_custom_size' => array( 'type' => 'slider', 'label' => __pl('logo_custom_size'), 'min' => 10, 'max' => 100, 'default' => 20, 'screen' => 1, 'css' => ['{{element}} .pagelayer-wp-title-img' => 'width:{{val}}%; height: auto;'], 'req' => array( 'logo_img_size' => 'custom', 'site_logo' => 'true' ) ), 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'left', 'list' => array( 'left' => __pl('left'), 'top' => __pl('top'), 'right' => __pl('right') ), 'addClass' => ['{{element}} .pagelayer-wp-title-link' => 'pagelayer-wp-title-align-{{val}}'], 'req' => array( 'site_logo' => 'true' ) ), 'vertical_align' => array( 'type' => 'radio', 'label' => __pl('vertical_alignment'), 'default' => 'middle', 'list' => array( 'top' => __pl('top'), 'middle' => __pl('middle'), 'bottom' => __pl('bottom') ), 'addClass' => ['{{element}} .pagelayer-wp-title-link' => 'pagelayer-wp-title-vertical-{{val}}'], 'req' => ['site_logo' => 'true', '!align' => 'top'] ), ), 'styles' => [ 'site_description' => __pl('site_desc'), 'logo_style' => __pl('logo_style'), ] ) ); // Copyright pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_copyright', array( 'name' => __pl('copyright'), 'group' => 'other', 'icon' => 'fa fa-copyright', 'html' => '<div class="pagelayer-copyright"> <a href="'.home_url().'"> {{copyright_text}} </a> </div>', 'params' => array( 'copyright_text' => array( 'type' => 'textarea', 'label' => __pl('text'), 'default' => pagelayer_get_option('pagelayer-copyright') ), 'color' => array( 'type' => 'color', 'label' => __pl('color'), 'np' => 1, 'css' => ['{{element}} .pagelayer-copyright *, {{element}} .pagelayer-copyright' => 'color:{{val}}'] ), 'typography' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-copyright *, {{element}} .pagelayer-copyright' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'screen' => 1, 'list' => [ 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ], 'css' => ['{{element}} .pagelayer-copyright' => 'text-align: {{val}}'], ), ) ) ); // Primary Menu pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_wp_menu', array( 'name' => __pl('primary_menu'), 'group' => 'wordpress', 'html' => '<div class="pagelayer-wp-menu-holder" data-layout="{{layout}}" data-submenu_ind="{{submenu_ind}}" data-drop_breakpoint="{{drop_breakpoint}}"> <div class="pagelayer-primary-menu-bar"><i class="{{menu_toggle_icon}}"></i></div> <div class="pagelayer-wp-menu-container pagelayer-menu-type-{{layout}} pagelayer-menu-hover-{{pointer}} {{m_animation}} {{slide_style}}" data-align="{{align}}"> <div class="pagelayer-wp_menu-close"><i class="fas fa-times"></i></div> {{nav_menu}} </div> </div>', 'params' => array( 'nav_list' => array(// Never use the same name as we are replacing in IMPORT 'type' => 'menus', 'label' => __pl('select_menu'), 'np' => 1, 'default' => pagelayer_get_menu_list(true), 'list' => pagelayer_get_menu_list(), ), ), 'menu_style' => [ 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'np' => 1, 'default' => 'left', 'screen' => 1, 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'css' => ['{{element}} .pagelayer-wp_menu-ul' => 'text-align:{{val}};'], ), 'layout' => array( 'type' => 'select', 'label' => __pl('layout'), 'default' => 'horizontal', 'list' => array( 'horizontal' => __pl('horizontal'), 'vertical' => __pl('vertical'), 'dropdown' => __pl('dropdown'), ), ), 'drop_breakpoint' => array( 'type' => 'select', 'label' => __pl('drop_breakpoint'), 'np' => 1, 'list' => array( 'none' => __pl('none'), 'mobile' => __pl('mobile'), 'tablet' => __pl('tablet'), ), 'req' => [ '!layout' => 'dropdown'] ), 'pointer' => array( 'type' => 'select', 'label' => __pl('pointer'), 'default' => 'underline', 'list' => array( '' => __pl('none'), 'underline' => __pl('underline'), 'overline' => __pl('overline'), 'doubleline' => __pl('double_line'), 'framed' => __pl('Framed'), 'background' => __pl('bg_color'), 'text' => __pl('text'), ), ), 'm_animation' => array( 'type' => 'select', 'label' => __pl('animation'), 'default' => 'slide', 'list' => array( 'none' => __pl('none'), 'fade' => __pl('fade'), 'slide' => __pl('slide'), 'grow' => __pl('Grow'), 'dropin' => __pl('drop_in'), 'dropout' => __pl('Drop_out'), ), ), 'list_style' => array( 'type' => 'select', 'label' => __pl('list_style'), 'np' => 1, 'default' => 'none', 'list' => array( 'none' => __pl('none'), 'circle' => __pl('list_list_type_circle'), 'decimal' => __pl('decimal'), 'square' => __pl('list_list_type_square'), 'disc' => __pl('list_list_type_disc'), 'inherit' => __pl('inherit'), 'upper-roman' => __pl('upper_roman'), 'upper-alpha' => __pl('upper_alpha'), 'lower-roman' => __pl('lower_roman'), 'lower-alpha' => __pl('lower_alpha'), ), 'css' => ['{{element}} .pagelayer-wp-menu-container li.menu-item' => 'list-style: {{val}};'] ), 'submenu_ind' => array( 'type' => 'select', 'label' => __pl('sbmenu_indicator'), 'np' => 1, 'default' => 'caret-down', 'list' => array( '' => __pl('none'), 'caret-down' => __pl('caret_down'), 'chevron-down' => __pl('chevron'), 'angle-down' => __pl('angle'), 'plus' => __pl('Plus'), 'arrow-down' => __pl('arrow_down'), ), ), 'submenu_anim' => array( 'type' => 'select', 'label' => __pl('submenu_anim'), 'np' => 1, 'list' => array( '' => __pl('none'), 'pulse' => __pl('Pulse'), 'fade' => __pl('fade'), 'fadeindown' => __pl('fadeindown'), 'fadeinup' => __pl('fadeinup'), 'slideindown' => __pl('slideindown'), 'slideinup' => __pl('slideinup'), 'zoomin' => __pl('zoomin'), 'flip' => __pl('flip'), ), 'css' => ['{{element}} .pagelayer-active-sub-menu.pagelayer-mega-menu-item > .pagelayer-mega-menu, :not(.pagelayer-ele-wrap) > {{element}} .pagelayer-menu-type-horizontal .pagelayer-mega-menu-item:hover > .pagelayer-mega-menu, {{element}} .pagelayer-active-sub-menu:not(.pagelayer-mega-menu-item) > ul.sub-menu, {{element}} .pagelayer-menu-type-horizontal .menu-item-has-children:not(.pagelayer-mega-menu-item, .pagelayer-mega-column-item .sub-menu li):hover > ul.sub-menu, :not(.pagelayer-ele-wrap) > .pagelayer-wp_menu .pagelayer-menu-type-vertical[class*="pagelayer-submenu-position-"] .pagelayer-mega-menu-item:hover > .pagelayer-mega-menu, {{element}} .pagelayer-menu-type-vertical[class*="pagelayer-submenu-position-"] .menu-item-has-children:not(.pagelayer-mega-menu-item, .pagelayer-mega-column-item .sub-menu li):hover > ul.sub-menu' => 'animation-name: pagelayer-submenu-{{val}};animation-duration: 300ms;animation-timing-function: linear; animation-iteration-count: 1;'], ), 'menu_colors' => array( 'type' => 'radio', 'label' => __pl('Background'), 'np' => 1, //'no_val' => 1,// Dont set any value to element 'list' => [ '' => __pl('normal'), 'hover' => __pl('hover'), 'active' => __pl('active'), ], ), 'menu_color' => [ 'type' => 'color', 'label' => __pl('color'), 'np' => 1, 'css' => ['{{element}} .pagelayer-wp_menu-ul>li a:first-child' => 'color: {{val}};'], 'show' => ['menu_colors' => ''], 'screen' => 1 ], 'menu_bg_color' => [ 'type' => 'color', 'label' => __pl('p_bg_color'), 'np' => 1, 'css' => ['{{element}} .pagelayer-wp_menu-ul>li' => 'background-color: {{val}};'], 'show' => ['menu_colors' => ''], 'screen' => 1 ], 'menu_color_hover' => [ 'type' => 'color', 'label' => __pl('color'), 'np' => 1, 'css' => ['{{element}} .pagelayer-wp_menu-ul>li>a:hover' => 'color: {{val}};', '{{element}} .pagelayer-wp_menu-ul>li.pagelayer-active-sub-menu>a:hover' => 'color: {{val}};'], 'show' => ['menu_colors' => 'hover'], 'screen' => 1 ], 'menu_bg_color_hover' => [ 'type' => 'color', 'label' => __pl('p_bg_color'), 'np' => 1, 'default' => '#00ccff', 'css' => ['{{element}} .pagelayer-menu-hover-background .pagelayer-wp_menu-ul>li:hover' => 'background-color: {{val}};','{{element}} .pagelayer-wp_menu-ul>li>a:hover:before' => 'background-color: {{val}};border-color:{{val}}', '{{element}} .pagelayer-wp_menu-ul>li>a:hover:after' => 'background-color: {{val}};border-color:{{val}}', '{{element}} .pagelayer-wp_menu-ul>li.pagelayer-active-sub-menu' => 'background-color: {{val}};'], 'show' => ['menu_colors' => 'hover'], 'screen' => 1 ], 'menu_color_active' => [ 'type' => 'color', 'label' => __pl('color'), 'np' => 1, 'css' => ['{{element}} .pagelayer-wp_menu-ul>li.current-menu-item>a' => 'color: {{val}};'], 'show' => ['menu_colors' => 'active'], 'screen' => 1 ], 'menu_bg_color_active' => [ 'type' => 'color', 'label' => __pl('p_bg_color'), 'np' => 1, 'default' => '#00ccff', 'css' => ['{{element}} .pagelayer-wp_menu-ul>li.current-menu-item' => 'background-color: {{val}};'], 'show' => ['menu_colors' => 'active'], 'screen' => 1 ], 'menu_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'np' => 1, 'css' => ['{{element}} .pagelayer-wp-menu-container ul li.menu-item > a' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'menu_pointer_height' => [ 'type' => 'slider', 'label' => __pl('pointer_height'), 'screen' => 1, 'min' => 1, 'max' => 50, 'css' => ['{{element}} .pagelayer-menu-hover-underline:not(.none) .pagelayer-wp_menu-ul>li>a:before, {{element}} .pagelayer-menu-hover-doubleline:not(.none) .pagelayer-wp_menu-ul>li>a:before, {{element}} .pagelayer-menu-hover-doubleline:not(.none) .pagelayer-wp_menu-ul>li>a:after, {{element}} .pagelayer-menu-hover-overline:not(.none) .pagelayer-wp_menu-ul>li>a:before' => 'height:{{val}}px;', '{{element}} .pagelayer-menu-hover-framed .pagelayer-wp_menu-ul>li>a:hover:before' => 'border-width: {{val}}px'], 'show' => ['pointer' => ['underline', 'overline', 'doubleline', 'framed']], ], 'horizontal_padding' => [ 'type' => 'slider', 'label' => __pl('horizontal_padding'), 'default' => 10, 'screen' => 1, 'css' => ['{{element}} .pagelayer-wp_menu-ul>li>a' => 'padding-left: {{val}}px;padding-right: {{val}}px;'], ], 'vertical_padding' => [ 'type' => 'slider', 'label' => __pl('vertical_padding'), 'default' => 10, 'screen' => 1, 'css' => ['{{element}} .pagelayer-wp_menu-ul>li>a' => 'padding-top: {{val}}px;padding-bottom : {{val}}px;'], ], ], 'submenu_style' => [ 'submenu_align' => array( 'type' => 'radio', 'label' => __pl('item_alignment'), 'np' => 1, 'default' => 'left', 'screen' => 1, 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'css' => ['{{element}} ul.sub-menu li>a' => 'justify-content:{{val}} !important;'], ), 'submenu_position' => [ 'type' => 'radio', 'label' => __pl('position'), 'default' => 'left', 'list' => array( 'left' => __pl('left'), 'right' => __pl('right'), ), 'css' => ['{{element}} .pagelayer-menu-type-horizontal .sub-menu' => '{{val}}:0px;', '{{element}} .pagelayer-menu-type-horizontal .sub-menu .sub-menu' => 'left:unset;{{val}}:100% !important;top:0px;'], 'req' => ['layout' => 'horizontal'], ], 'submenu_v_position' => [ 'type' => 'radio', 'label' => __pl('position'), 'list' => array( '' => __pl('Default'), 'left' => __pl('left'), 'right' => __pl('right'), ), 'addClass' => ['{{element}} .pagelayer-menu-type-vertical' => 'pagelayer-submenu-position-{{val}}'], 'req' => ['layout' => 'vertical'], ], 'submenu_colors' => array( 'type' => 'radio', 'label' => __pl('Background'), 'np' => 1, //'no_val' => 1,// Dont set any value to element 'list' => [ '' => __pl('normal'), 'hover' => __pl('hover'), 'active' => __pl('active'), ], ), 'submenu_color' => [ 'type' => 'color', 'label' => __pl('color'), 'np' => 1, 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-wp-menu-container ul.sub-menu>li a' => 'color: {{val}};'], 'show' => ['submenu_colors' => ''], 'screen' => 1 ], 'submenu_bg_color' => [ 'type' => 'color', 'label' => __pl('bg_color'), 'np' => 1, 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-wp-menu-container ul.sub-menu' => 'background-color: {{val}};'], 'show' => ['submenu_colors' => ''], 'screen' => 1 ], 'submenu_color_hover' => [ 'type' => 'color', 'label' => __pl('color'), 'np' => 1, 'css' => ['{{element}} .pagelayer-wp-menu-container ul.sub-menu>li a:hover' => 'color: {{val}};', '{{element}} .pagelayer-wp-menu-container ul.sub-menu>li.pagelayer-active-sub-menu a:hover' => 'color: {{val}};'], 'show' => ['submenu_colors' => 'hover'], 'screen' => 1 ], 'submenu_bg_color_hover' => [ 'type' => 'color', 'label' => __pl('bg_color'), 'np' => 1, 'css' => ['{{element}} .pagelayer-wp-menu-container ul.sub-menu>li:hover' => 'background-color: {{val}};', '{{element}} .pagelayer-wp-menu-container ul.sub-menu>li.pagelayer-active-sub-menu' => 'background-color: {{val}};'], 'show' => ['submenu_colors' => 'hover'], 'screen' => 1 ], 'submenu_color_active' => [ 'type' => 'color', 'label' => __pl('color'), 'np' => 1, 'css' => ['{{element}} .pagelayer-wp-menu-container ul.sub-menu>li.current-menu-item a' => 'color: {{val}};'], 'show' => ['submenu_colors' => 'active'], 'screen' => 1 ], 'submenu_bg_color_active' => [ 'type' => 'color', 'label' => __pl('bg_color'), 'np' => 1, 'css' => ['{{element}} .pagelayer-wp-menu-container ul.sub-menu>li.current-menu-item' => 'background-color: {{val}};'], 'show' => ['submenu_colors' => 'active'], 'screen' => 1 ], 'submenu_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'np' => 1, 'css' => ['{{element}} .pagelayer-wp-menu-container ul.sub-menu li a' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'] ), 'submenu_horizontal_padding' => [ 'type' => 'slider', 'label' => __pl('horizontal_padding'), 'default' => 10, 'screen' => 1, 'css' => ['{{element}} .pagelayer-wp-menu-container ul.sub-menu li a' => 'padding-left: {{val}}px;padding-right: {{val}}px;'], ], 'submenu_vertical_padding' => [ 'type' => 'slider', 'label' => __pl('vertical_padding'), 'default' => 10, 'screen' => 1, 'css' => ['{{element}} .pagelayer-wp-menu-container ul.sub-menu li a' => 'padding-top: {{val}}px;padding-bottom : {{val}}px;'], ], 'submenu_left_margin' => [ 'type' => 'slider', 'label' => __pl('left_margin'), 'default' => 10, 'screen' => 1, 'css' => ['{{element}} .pagelayer-wp-menu-container .sub-menu a' => 'margin-left: {{val}}px;', '{{element}} .pagelayer-wp-menu-container .sub-menu .sub-menu a' => 'margin-left: calc(2 * {{val}}px);'], ], 'submenu_index' => [ 'type' => 'slider', 'label' => __pl('z-index'), 'css' => ['{{element}} .menu-item .sub-menu, {{element}} .menu-item .pagelayer-mega-menu' => 'z-index:{{val}}'], ], ], 'menu_toggle' => [ 'menu_toggle_icon' => array( 'type' => 'icon', 'label' => __pl('icon'), 'default' => 'fas fa-bars', 'addAttr' => ['{{element}} .pagelayer-primary-menu-bar i' => 'data-icon="{{menu_toggle_icon}}"'], 'desc' => __pl('menu_toggle_icon_desc') ), 'menu_toggle_align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'np' => 1, 'default' => 'center', 'screen' => 1, 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'css' => ['{{element}} .pagelayer-primary-menu-bar' => 'text-align:{{val}}'], ), 'menu_toggle_color' => array( 'type' => 'color', 'label' => __pl('color'), 'np' => 1, 'css' => ['{{element}} .pagelayer-primary-menu-bar i' => 'color:{{val}}'], ), 'menu_toggle_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'np' => 1, 'default' => '#0986c050', 'css' => ['{{element}} .pagelayer-primary-menu-bar i' => 'background-color:{{val}}'], ), 'menu_toggle_size' => array( 'type' => 'slider', 'label' => __pl('font_size'), 'default' => 30, 'screen' => 1, 'css' => ['{{element}} .pagelayer-primary-menu-bar i' => 'font-size:{{val}}px'], ), 'menu_toggle_padding' => array( 'type' => 'dimension', 'label' => __pl('padding'), 'screen' => 1, 'units' => ['px', 'em', '%'], 'css' => ['{{element}} .pagelayer-primary-menu-bar i' => 'padding:{{val[0]}} {{val[1]}};'], ), ], 'dropdown_style' => [ 'slide_style' => array( 'type' => 'select', 'label' => __pl('slide_style'), 'default' => 'pagelayer-wp_menu-right', 'list' => array( 'pagelayer-wp_menu-down' => __pl('slide-down'), 'pagelayer-wp_menu-right' => __pl('slide-right'), 'pagelayer-wp_menu-left' => __pl('slide-left'), 'pagelayer-wp_menu-full' => __pl('full_screen') ), 'req' => ['!drop_breakpoint' => 'none'] ), 'dropdown_align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'np' => 1, 'screen' => 1, 'list' => array( 'flex-start' => __pl('left'), 'center' => __pl('center'), 'flex-end' => __pl('right'), ), 'css' => ['{{element}} .pagelayer-menu-type-dropdown .pagelayer-wp_menu-ul > li > a' => 'justify-content: {{val}};'], ), 'menu_width' => [ 'type' => 'spinner', 'label' => __pl('width'), 'np' => 1, 'default' => 30, 'min' => 1, 'screen' => 1, 'css' => ['{{element}} .pagelayer-menu-type-dropdown' => 'width:{{val}}%;'], 'req' => [ '!drop_breakpoint' => 'none', '!slide_style' => ['pagelayer-wp_menu-full','pagelayer-wp_menu-down'] ] ], 'menu_down_width' => [ 'type' => 'spinner', 'label' => __pl('width'), 'default' => 100, 'min' => 1, 'screen' => 1, 'css' => ['{{element}} .pagelayer-menu-type-dropdown' => 'width:{{val}}%;'], 'req' => [ '!drop_breakpoint' => 'none', 'slide_style' => 'pagelayer-wp_menu-down' ] ], 'menu_items_width' => [ 'type' => 'spinner', 'label' => __pl('menu_items_width'), 'default' => 100, 'min' => 1, 'max' => 100, 'css' => ['{{element}} .pagelayer-menu-type-dropdown .pagelayer-wp_menu-ul' => 'width:{{val}}%;'], 'req' => [ '!drop_breakpoint' => 'none', '!slide_style' => ['pagelayer-wp_menu-down'] ] ], 'menu_posx' => array( 'type' => 'slider', 'label' => __pl('horizontal_pos'), 'screen' => 1, 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 0, 'css' => ['{{element}} .pagelayer-menu-type-dropdown .pagelayer-wp_menu-ul' => 'left: {{val}}%;'], 'req' => [ '!drop_breakpoint' => 'none', '!slide_style' => 'pagelayer-wp_menu-down' ] ), 'menu_posy' => array( 'type' => 'slider', 'label' => __pl('verticle_postion'), 'screen' => 1, 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 8, 'css' => ['{{element}} .pagelayer-menu-type-dropdown .pagelayer-wp_menu-ul' => 'top: {{val}}%; transform: translateY(-{{val}}%);'], 'req' => [ '!drop_breakpoint' => 'none', '!slide_style' => 'pagelayer-wp_menu-down' ] ), 'menu_bg' => array( 'type' => 'radio', 'label' => __pl('col_bg_styles'), 'np' => 1, 'default' => 'color', 'list' => array( '' => __pl('none'), 'color' => __pl('color'), 'gradient' => __pl('gradient'), ), 'req' => ['!drop_breakpoint' => 'none'] ), 'menu_items_bg' => array( 'type' => 'color', 'label' => __pl('color'), 'np' => 1, 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-menu-type-dropdown' => 'background-color:{{val}}'], 'req' => [ 'menu_bg' => 'color', '!drop_breakpoint' => 'none' ], ), 'menu_items_gradient' => array( 'type' => 'gradient', 'label' => '', 'default' => '150,#44d3f6,23,#72e584,45,#2ca4eb,100', 'css' => ['{{element}} .pagelayer-menu-type-dropdown' => 'background: linear-gradient({{val[0]}}deg, {{val[1]}} {{val[2]}}%, {{val[3]}} {{val[4]}}%, {{val[5]}} {{val[6]}}%);'], 'req' => [ 'menu_bg' => 'gradient', '!drop_breakpoint' => 'none' ], ), ], 'close_style' =>[ 'close_size' => array( 'type' => 'slider', 'label' => __pl('font_size'), 'np' => 1, 'default' => 25, 'screen' => 1, 'css' => ['{{element}} .pagelayer-wp_menu-close i' => 'font-size:{{val}}px'], 'req' => ['!drop_breakpoint' => 'none'], ), 'close_padding' => array( 'type' => 'slider', 'label' => __pl('padding'), 'default' => 8, 'screen' => 1, 'css' => ['{{element}} .pagelayer-wp_menu-close i' => 'padding:{{val}}px'], 'req' => ['!drop_breakpoint' => 'none'], ), 'close_pos_x' => array( 'type' => 'slider', 'label' => __pl('horizontal_pos'), 'step' => 1, 'max' => 100, 'default' => 0, 'screen' => 1, 'css' => ['{{element}} .pagelayer-wp_menu-close i' => 'left:{{val}}%;'], 'req' => ['!drop_breakpoint' => 'none'], ), 'close_pos_y' => array( 'type' => 'slider', 'label' => __pl('verticle_postion'), 'step' => 1, 'max' => 100, 'default' => 0, 'screen' => 1, 'css' => ['{{element}} .pagelayer-wp_menu-close i' => 'top:{{val}}%;'], 'req' => ['!drop_breakpoint' => 'none'], ), 'close_state' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => '', 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'close_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff68', 'css' => ['{{element}} .pagelayer-wp_menu-close i' => 'color:{{val}}'], 'req' => ['!drop_breakpoint' => 'none'], 'show' => ['close_state' => ''] ), 'close_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#00000036', 'css' => ['{{element}} .pagelayer-wp_menu-close i' => 'background-color:{{val}}'], 'req' => ['!drop_breakpoint' => 'none'], 'show' => ['close_state' => ''] ), 'close_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('delay'), 'min' => 0, 'step' => 100, 'max' => 5000, 'default' => 600, 'css' => ['{{element}} .pagelayer-wp_menu-close i' => '-webkit-transition: all {{val}}ms !important; transition: all {{val}}ms !important;'], 'show' => ['close_state' => 'hover'] ), 'close_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-wp_menu-close i:hover' => 'color:{{val}}'], 'req' => ['!drop_breakpoint' => 'none'], 'show' => ['close_state' => 'hover'] ), 'close_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#000000', 'css' => ['{{element}} .pagelayer-wp_menu-close i:hover' => 'background-color:{{val}}'], 'req' => ['!drop_breakpoint' => 'none'], 'show' => ['close_state' => 'hover'] ), ], 'styles' => [ 'menu_style' => __pl('menu_style'), 'submenu_style' => __pl('submenu_style'), 'menu_toggle' => __pl('toggle_style'), 'dropdown_style' => __pl('dropdown_style'), 'close_style' => __pl('close_style'), ] ) ); // Menu items handler // Created this shortcode only use for menus property pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_nav_menu_item', array( 'name' => __pl('Menu Items'), 'group' => 'other', 'not_visible' => 1, 'hide_active' => 1, 'parent' => [PAGELAYER_SC_PREFIX.'_wp_menu'], 'icon' => 'far fa-minus-square', 'holder' => '.pagelayer-menu-item-holder', 'has_group' => [ 'section' => 'params', 'prop' => 'element', ], 'html' => '<div class="pagelayer-menu-item-holder"></div>', 'params' => array( 'title' => array( 'type' => 'text', 'label' => __pl('title'), ), 'menu_type' => array( 'type' => 'select', 'label' => __pl('menu_type'), 'desc' => __pl('menu_type_desc'), 'list' => array( '' => __pl('flyout'), 'mega' => __pl('mega_menu'), 'column' => __pl('column_menu'), ), 'req' => ['menu_item_parent' => '0'] ), 'element' => array( 'type' => 'group', 'label' => __pl('Inner Row'), 'sc' => PAGELAYER_SC_PREFIX.'_inner_row', 'count' => 1, 'item_label' => array( 'default' => __pl('Inner Row'), ), 'text' => __pl('Add new row'), 'req' => ['menu_type' => 'mega'] ), 'columns' => array( 'type' => 'select', 'label' => __pl('columns_count'), 'screen' => 1, 'css' => ['.menu-item-{{ID}} > .sub-menu' => 'columns: {{val}}'], 'list' => array( '' => __pl('default'), 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '6', 7=> '7', 8 => '8', 9 => '9', 10 => '10' ), 'req' => ['menu_type' => 'column'] ), 'col_gap' => array( 'type' => 'slider', 'label' => __pl('col_gap'), 'min' => 0, 'max' => 100, 'screen' => 1, 'css' => ['.menu-item-{{ID}} > .sub-menu' => 'column-gap: {{val}}px;'], 'req' => ['menu_type' => 'column'] ), 'mega_width' => array( 'type' => 'select', 'label' => __pl('mega_width'), 'list' => array( '' => __pl('menu_container'), 'row_container' => __pl('row_container'), 'custom' => __pl('custom'), ), 'addAttr' => 'pagelayer-mega-width="{{mega_width}}"', 'req' => ['!menu_type' => ''] ), 'mega_custom_width' => array( 'type' => 'spinner', 'label' => __pl('mega_custom_width'), 'default' => '800', 'addAttr' => 'pagelayer-mega-custom-width="{{mega_custom_width}}"', 'req' => ['mega_width' => 'custom', '!menu_type' => ''] ), 'menu_icon' => array( 'type' => 'icon', 'label' => __pl('icon'), ), ), 'menu_setting' => array( 'disable_link' => array( 'type' => 'checkbox', 'label' => __pl('disable_link'), ), 'hide_text' => array( 'type' => 'checkbox', 'label' => __pl('hide_text'), 'css' => ['.menu-item-{{ID}} > a .pagelayer-nav-menu-title' => 'display:none'] ), 'icon_position' => array( 'type' => 'select', 'label' => __pl('icon_position'), 'list' => array( '' => __pl('left'), 'right' => __pl('right'), ), ), ), 'highlight' => array( 'highlight_label' => array( 'type' => 'text', 'label' => __pl('highlight_label'), ), 'highlight_bg' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['.menu-item-{{ID}} > a .pagelayer-menu-highlight' => 'background:{{val}}'] ), 'highlight_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['.menu-item-{{ID}} > a .pagelayer-menu-highlight' => 'color:{{val}}'] ), ), 'styles' => array( 'menu_setting' => __pl('menu_setting'), 'highlight' => __pl('highlight_label'), ), ) ); // Breadcrumb pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_breadcrumb', array( 'name' => __pl('breadcrumb'), 'group' => 'other', 'html' => '<span if="{{prefix}}" class="pagelayer-breadcrumb-prefix">{{prefix}}</span> <span class="pagelayer-breadcrumb-section">'. pagelayer_get_breadcrumb(). '</span>', //'html' => yoast_breadcrumb( '<p id="breadcrumbs">','</p>' ).pagelayer_get_breadcrumb(), 'params' => array( 'home' => array( 'type' => 'text', 'label' => __pl('home_label'), 'np' => 1, 'default' => 'Home', ), 'breadcrumb_color' => array( 'type' => 'color', 'label' => __pl('color'), 'np' => 1, 'css' => ['{{element}} .pagelayer-breadcrumb-section a' => 'color:{{val}};'] ), 'breadcrumb_hover' => array( 'type' => 'color', 'label' => __pl('hovered_color'), 'css' => ['{{element}} .pagelayer-breadcrumb-section a:hover' => 'color:{{val}};'] ), 'cur_color' => array( 'type' => 'color', 'label' => __pl('cur_color'), 'css' => ['{{element}} .pagelayer-breadcrumb-section' => 'color:{{val}};'] ), 'typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-breadcrumb-section' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'alignment' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'center', 'screen' => 1, 'css' =>'text-align:{{val}};', 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), ), ), 'prefix_style' => [ 'prefix' => array( 'type' => 'text', 'label' => __pl('breadcrumb_prefix'), ), 'search_prefix' => array( 'type' => 'text', 'label' => __pl('search_prefix'), ), '404_prefix' => array( 'type' => 'text', 'label' => __pl('404_prefix'), ), 'prefix_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-breadcrumb-prefix' => 'color:{{val}};'] ), 'prefix_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-breadcrumb-prefix' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ], 'separator_style' => [ 'separator' => array( 'type' => 'text', 'label' => __pl('separator_style'), 'default' => ' » ', ), 'separator_color' => array( 'type' => 'color', 'label' => __pl('color'), 'np' => 1, 'default' => '#333333', 'css' => ['{{element}} .pagelayer-breadcrumb-sep' => 'color:{{val}};'] ), ], 'styles' => [ 'prefix_style' => __pl('prefix_style'), 'separator_style' => __pl('separator_style'), ] ) ); // Contact Form pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_contact', array( 'name' => __pl('contact_form'), 'group' => 'other', 'has_group' => [ 'section' => 'params', 'prop' => 'elements' ], 'holder' => '.pagelayer-contact-holder', 'html' => '<div class="pagelayer-contact-form-div pagelayer-contact-form-holder"> <div class="pagelayer-message-box pagelayer-message-top"></div> <div if={{note}} class="pagelayer-contact-form-note">{{note}}</div> <form class="pagelayer-contact-form" id="{{form}}" name="{{name}}" onsubmit="return pagelayer_contact_submit(this, event)" method="POST"> <div class="pagelayer-contact-holder"> </div> <input type="hidden" name="cfa-pagelayer-id"/> <input if="{{con_post_id}}" type="hidden" name="cfa-post-id" value="{{con_post_id}}"/> <input if="{{contact_custom_templ}}" type="hidden" name="cfa-custom-template" value="{{contact_custom_templ}}"/> <input if="{{redirect_url}}" type="hidden" name="cfa-redirect" value="{{{redirect_url}}}"/> <div class="g-recaptcha pagelayer-recaptcha" data-sitekey="{{grecaptcha}}" if="{{grecaptcha_v2}}"></div> <input type="hidden" name="g-recaptcha-response" data-version="v3" class="pagelayer-g-recaptcha-v3-token" data-sitekey="{{grecaptcha}}" if="{{grecaptcha_v3}}"/> <div class="pagelayer-contact-submit-holder"> <button if="{{submit}}" type="submit" form="{{form}}" class="pagelayer-contact-submit-btn pagelayer-btn-holder pagelayer-ele-link {{type}} {{size}} {{icon_position}}"> <i class="fa fa-circle-o-notch fa-spin" style="display:none;margin-right:5px;"></i> <i if="{{icon}}" class="{{icon}} pagelayer-btn-icon pagelayer-cf-icon-left"></i> <span if="{{submit}}" class="pagelayer-btn-text">{{submit}}</span> <i if="{{icon}}" class="{{icon}} pagelayer-btn-icon pagelayer-cf-icon-right"></i> </button> </div> </form> <div class="pagelayer-message-box pagelayer-message-bottom"></div> </div>', 'params' => array( 'elements' => array( 'type' => 'group', 'label' => __pl('Label'), 'sc' => PAGELAYER_SC_PREFIX.'_contact_item', 'item_label' => array( 'default' => __pl('Label'), 'param' => 'label_name' ), 'count' => 1, 'text' => strtr(__pl('add_new_item'), array('%name%' => __pl('field_name'))), ), 'redirect_show' => array( 'type' => 'checkbox', 'label' => __pl('redirect_url'), ), 'redirect_url' => array( 'type' => 'link', 'label' => __pl('redirect_urllabel'), 'desc' => __pl('redirect_urldesc'), 'req' => array( 'redirect_show' => 'true' ) ), 'captcha' => array( 'type' => 'checkbox', 'label' => __pl('use_recaptcha'), 'default' => '', 'desc' => __pl('use_recaptcha_desc'), ), 'form' => array( 'type' => 'text', 'label' => __pl('form_id'), 'desc' => __pl('form_id_desc'), 'default' => 'contact-form', 'np' => 1 ), 'name' => array( 'type' => 'text', 'label' => __pl('form_name'), 'default' => 'Contact Form', 'desc' => __pl('form_name_desc'), 'np' => 1 ), 'form_position' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'default', 'screen' => 1, 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ), 'css' => ['{{element}} .pagelayer-contact-form' => 'text-align: {{val}}'], ), 'note' => array( 'type' => 'text', 'label' => __pl('note'), 'edit' => '.pagelayer-contact-form-note', ), 'note_color' => array( 'type' => 'color', 'label' => __pl('note_color'), 'css' => ['{{element}} .pagelayer-contact-form-note' => 'color:{{val}}'], ), ), 'label_style' =>[ 'form_label_color' => array( 'type' => 'color', 'label' => __pl('label_color'), 'default' => '', 'show' => ['field_state' => ''], 'css' => ['{{element}} label' => 'color: {{val}}'], ), 'label_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} label' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'space_label' => array( 'type' => 'padding', 'label' => __pl('space_between'), 'default' => ',,10,', 'screen' => 1, 'css' => ['{{element}} label' => 'padding-top:{{val[0]}}px; padding-right:{{val[1]}}px; padding-bottom:{{val[2]}}px; padding-left:{{val[3]}}px;'], ), 'form_placeholder_color' => array( 'type' => 'color', 'label' => __pl('placeholder_color'), 'default' => '', 'show' => ['field_state' => ''], 'css' => ['{{element}} ::placeholder' => 'color: {{val}}'], ), 'placeholder_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} ::placeholder' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ], 'input_style' => [ 'input_state' => array( 'type' => 'radio', 'label' => __pl('state'), 'np' => 1, 'default' => 'normal', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'form_input_color' => array( 'type' => 'color', 'label' => __pl('text_color'), 'css' => [ '{{element}} textarea, {{element}} input, {{element}} select, {{element}} date' => 'color: {{val}}' ], 'req' => array( 'input_state' => 'normal' ), ), 'form_input_bg' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => [ '{{element}} textarea, {{element}} input, {{element}} select, {{element}} date' => 'background-color: {{val}}', ], 'req' => array( 'input_state' => 'normal', ), ), 'input_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('input_hover_delay_label'), 'min' => 0, 'step' => 100, 'max' => 5000, 'css' => ['{{element}} textarea:hover, {{element}} input:hover, {{element}} select:hover, {{element}} date:hover' => '-webkit-transition: all {{val}}ms !important; transition: all {{val}}ms !important;'], 'show' => array( 'input_state' => 'hover' ), ), 'form_input_color_hover' => array( 'type' => 'color', 'label' => __pl('text_color'), 'css' => [ '{{element}} textarea:hover, {{element}} input:hover, {{element}} select:hover, {{element}} date:hover' => 'color: {{val}}' ], 'req' => array( 'input_state' => 'hover' ), ), 'form_input_bg_hover' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => [ '{{element}} textarea:hover, {{element}} input:hover, {{element}} select:hover, {{element}} date:hover' => 'background-color: {{val}}' ], 'req' => array( 'input_state' => 'hover' ), ), 'input_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} select, {{element}} input,{{element}} textarea' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'input_height' => array( 'type' => 'spinner', 'label' => __pl('text_field_height'), 'min' => 1, 'max' => 1000, 'step' => 1, 'screen' => 1, 'css' => [ '{{element}} input, {{element}} select, {{element}} textarea'=> 'line-height: {{val}}px; min-height: {{val}}px', ], ), 'input_padding' => array( 'type' => 'dimension', 'label' => __pl('padding'), 'screen' => 1, 'default' => '10,10', 'css' => [ '{{element}} input, {{element}} select, {{element}} textarea'=> 'padding-top:{{val[0]}}px; padding-right:{{val[1]}}px; padding-bottom:{{val[0]}}px; padding-left:{{val[1]}}px', ], ), /* 'input_state' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => '', 'list' => [ '' => __pl('normal'), 'hover' => __pl('hover'), ], ), */ ], 'form_style' => [ 'field_state' => array( 'type' => 'radio', 'label' => '', 'np' => 1, 'default' => '', 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), 'focus' => __pl('focus'), ), ), 'field_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => [ '{{element}} input, {{element}} select, {{element}} textarea' => 'border-style: {{val}}', '{{element}} input[type="checkbox"] + label:before' => 'border-style: {{val}}' ], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'field_state' => '' ), ), 'field_border_color' => array( 'type' => 'color', 'label' => __pl('service_box_icon_border_color_label'), 'default' => '#0986c0', 'css' => [ '{{element}} input, {{element}} select, {{element}} textarea' => 'border-color: {{val}};', '{{element}} input[type="checkbox"] + label:before' => 'border-color: {{val}};' ], 'req' => array( '!field_border_type' => '' ), 'show' => array( 'field_state' => '' ), ), 'field_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} input, {{element}} select, {{element}} textarea, {{element}} input[type="checkbox"] + label:before' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!field_border_type' => '' ], 'show' => array( 'field_state' => '' ), ), 'field_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} input, {{element}} select, {{element}} textarea' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!field_border_type' => '' ), 'show' => array( 'field_state' => '' ), ), 'field_shadow' => array( 'type' => 'box_shadow', 'label' => __pl('shadow'), 'screen' => 1, 'css' => [ '{{element}} input, {{element}} select, {{element}} textarea, {{element}} input[type="checkbox"] + label:before' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}} !important;' ], 'show' => ['field_state' => ''], ), 'field_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('service_btn_hover_delay'), 'min' => 0, 'step' => 100, 'max' => 5000, 'default' => 400, 'css' => ['{{element}} input, {{element}} select, {{element}} textarea' => '-webkit-transition: all {{val}}ms; transition: all {{val}}ms;'], 'show' => array( 'field_state' => 'hover' ), ), 'field_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} input:hover, {{element}} select:hover, {{element}} textarea:hover' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'field_state' => 'hover' ), ), 'field_border_color_hover' => array( 'type' => 'color', 'label' => __pl('service_box_icon_border_color_label'), 'css' => ['{{element}} input:hover, {{element}} select:hover, {{element}} textarea:hover' => 'border-color: {{val}};'], 'default' => '#0986c0', 'req' => array( '!field_border_type_hover' => '' ), 'show' => array( 'field_state' => 'hover' ), ), 'field_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} input:hover, {{element}} select:hover, {{element}} textarea:hover' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!field_border_type_hover' => '' ], 'show' => array( 'field_state' => 'hover' ), ), 'field_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} input:hover, {{element}} select:hover, {{element}} textarea:hover' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!field_border_type_hover' => '' ), 'show' => array( 'field_state' => 'hover' ), ), 'field_shadow_hover' => array( 'type' => 'box_shadow', 'label' => __pl('text_shadow'), 'screen' => 1, 'css' => [ '{{element}} input:hover, {{element}} select:hover, {{element}} textarea:hover' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}} !important;' ], 'show' => ['field_state' => 'hover'], ), 'field_border_type_focus' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} input:focus, {{element}} select:focus, {{element}} textarea:focus' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'field_state' => 'focus' ), ), 'field_border_color_focus' => array( 'type' => 'color', 'label' => __pl('service_box_icon_border_color_label'), 'css' => ['{{element}} input:focus, {{element}} select:focus, {{element}} textarea:focus' => 'border-color: {{val}};'], 'default' => '#0986c0', 'req' => array( '!field_border_type_focus' => '' ), 'show' => array( 'field_state' => 'focus' ), ), 'field_border_width_focus' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} input:focus, {{element}} select:focus, {{element}} textarea:focus' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!field_border_type_focus' => '' ], 'show' => array( 'field_state' => 'focus' ), ), 'field_border_radius_focus' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} input:focus, {{element}} select:focus, {{element}} textarea:focus' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!field_border_type_focus' => '' ), 'show' => array( 'field_state' => 'focus' ), ), 'field_shadow_focus' => array( 'type' => 'box_shadow', 'label' => __pl('text_shadow'), 'screen' => 1, 'css' => [ '{{element}} input:focus, {{element}} select:focus, {{element}} textarea:focus' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}} !important;' ], 'show' => ['field_state' => 'focus'], ), ], 'radio_style' => [ 'form_box_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '', 'css' => [ '{{element}} input[type="radio"]:checked:before' => 'color: {{val}}', '{{element}} input[type="checkbox"]:checked + label:before' => 'color: {{val}}' ], ), 'form_box_bg_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '', 'css' => [ '{{element}} input[type="radio"]:checked:before' => 'background-color: {{val}}', '{{element}} input[type="checkbox"]:checked + label:before' => 'background-color: {{val}}' ], ), 'inline_radio' => array( 'type' => 'checkbox', 'label' => __pl('inline'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-radcheck-holder' => 'display:flex; align-items:center;'] ), 'radio_padding' => array( 'type' => 'dimension', 'label' => __pl('padding'), 'screen' => 1, 'default' => '10,10', 'css' => [ '{{element}} input[type="checkbox"] + label:before, {{element}} input[type="radio"]'=> 'height:{{val[0]}}px; min-height:{{val[0]}}px; width:{{val[1]}}px;', ], ), 'radio_spacing' => array( 'type' => 'padding', 'label' => __pl('space_around'), 'screen' => 1, 'css' => [ '{{element}} .pagelayer-radcheck-holder>div'=> 'padding-top:{{val[0]}}px; padding-right:{{val[1]}}px; padding-bottom:{{val[2]}}px; padding-left:{{val[3]}}px;', ], ), ], 'button_style' => [ 'hide_btn' => array( 'type' => 'checkbox', 'label' => __pl('hide_btn'), ), 'submit' => array( 'type' => 'text', 'label' => __pl('submit_button_label'), 'default' => 'Submit', 'edit' => '.pagelayer-btn-text', 'req' => ['!hide_btn' => 'true'], ), 'btn_typo' => array( 'type' => 'typography', 'label' => __pl('quote_content_typo'), 'css' => [ '{{element}} .pagelayer-btn-text' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', '{{element}} .pagelayer-btn-holder' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', ], 'req' => ['!hide_btn' => 'true'], ), 'stretch' => array( 'type' => 'checkbox', 'label' => __pl('stretch_button_label'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-contact-submit-btn' => 'width: 100%'], 'req' => ['!hide_btn' => 'true'], ), 'btn_spacing' => array( 'type' => 'padding', 'label' => __pl('spacing'), 'css' => ['{{element}} .pagelayer-contact-submit-btn' => 'margin-top:{{val[0]}}px; margin-right:{{val[1]}}px; margin-bottom:{{val[2]}}px; margin-left:{{val[3]}}px;'], 'req' => [ '!hide_btn' => 'true', ] ), 'type' => array( 'type' => 'select', 'label' => __pl('button_type_label'), 'default' => 'pagelayer-btn-default', //'addClass' => ['{{element}} .pagelayer-btn-holder' => '{{val}}'], 'list' => array( 'pagelayer-btn-default' => __pl('btn_type_default'), 'pagelayer-btn-primary' => __pl('btn_type_primary'), 'pagelayer-btn-secondary' => __pl('btn_type_secondary'), 'pagelayer-btn-success' => __pl('btn_type_success'), 'pagelayer-btn-info' => __pl('btn_type_info'), 'pagelayer-btn-warning' => __pl('btn_type_warning'), 'pagelayer-btn-danger' => __pl('btn_type_danger'), 'pagelayer-btn-dark' => __pl('btn_type_dark'), 'pagelayer-btn-light' => __pl('btn_type_light'), 'pagelayer-btn-link' => __pl('btn_type_link'), 'pagelayer-btn-custom' => __pl('btn_type_custom') ), 'req' => ['!hide_btn' => 'true'], ), 'size' => array( 'type' => 'select', 'label' => __pl('button_size_label'), 'default' => 'pagelayer-btn-small', 'list' => array( 'pagelayer-btn-mini' => __pl('mini'), 'pagelayer-btn-small' => __pl('small'), 'pagelayer-btn-large' => __pl('large'), 'pagelayer-btn-extra-large' => __pl('extra_large'), 'pagelayer-btn-double-large' => __pl('double_large'), 'pagelayer-btn-custom' => __pl('custom'), ), 'req' => ['!hide_btn' => 'true'], ), 'btn_custom_size' => array( 'type' => 'dimension', 'label' => __pl('btn_custom_size'), 'default' => '5,10', 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'padding-top:{{val[0]}}px; padding-right:{{val[1]}}px; padding-bottom:{{val[0]}}px; padding-left:{{val[1]}}px;'], 'req' => array( 'size' => 'pagelayer-btn-custom', '!hide_btn' => 'true' ), ), 'contect_btn_align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-contact-submit-holder' => 'text-align:{{val}}'], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'req' => ['!hide_btn' => 'true'], ), 'btn_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => '', //'no_val' => 1,// Dont set any value to element 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), 'req' => array( 'type' => 'pagelayer-btn-custom', '!hide_btn' => 'true' ), ), 'btn_bg_color' => array( 'type' => 'color', 'label' => __pl('btn_bg_color_label'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-btn-holder' => 'background-color: {{val}};'], 'req' => array( 'type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => '', '!hide_btn' => 'true' ), ), 'btn_color' => array( 'type' => 'color', 'label' => __pl('btn_color_label'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-btn-holder' => 'color: {{val}};'], 'req' => array( 'type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => '', '!hide_btn' => 'true' ), ), 'btn_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('btn_hover_delay_label'), 'desc' => __pl('btn_hover_delay_desc'), 'min' => 0, 'step' => 100, 'max' => 5000, 'default' => 400, 'css' => ['{{element}} .pagelayer-btn-holder' => '-webkit-transition: all {{val}}ms !important; transition: all {{val}}ms !important;'], 'show' => array( 'btn_hover' => 'hover', '!hide_btn' => 'true' ), ), 'btn_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('btn_bg_color_hover_label'), 'default' => '', 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'background-color: {{val}};'], 'req' => array( 'type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => 'hover', '!hide_btn' => 'true' ), ), 'btn_color_hover' => array( 'type' => 'color', 'label' => __pl('btn_color_hover_label'), 'default' => '', 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'color: {{val}};'], 'req' => array( 'type' => 'pagelayer-btn-custom', ), 'show' => array( 'btn_hover' => 'hover', '!hide_btn' => 'true' ), ), ], 'icon_style' => [ 'icon' => array( 'type' => 'icon', 'label' => __pl('service_box_font_icon_label'), 'default' => '', ), 'icon_position' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'pagelayer-btn-icon-left', 'list' => array( 'pagelayer-btn-icon-left' => __pl('left'), 'pagelayer-btn-icon-right' => __pl('right') ), 'req' => array( '!icon' => '' ), ), 'icon_spacing' => array( 'type' => 'slider', 'label' => __pl('icon_spacing'), 'min' => 1, 'step' => 1, 'max' => 100, 'default' => 5, 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-icon' => 'padding: 0 {{val}}px;'], 'req' => array( '!icon' => '' ), ), ], 'border_style' => [ 'btn_bor_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'np' => 1, 'default' => '', //'no_val' => 1,// Dont set any value to element 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ) ), 'btn_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_color' => array( 'type' => 'color', 'label' => __pl('border_color_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-color: {{val}};'], 'req' => array( '!btn_border_type' => '' ), 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!btn_border_type' => '' ], 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!btn_border_type' => '' ), 'show' => array( 'btn_bor_hover' => '' ), ), 'btn_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'btn_bor_hover' => 'hover' ), ), 'btn_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color_hover_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'border-color: {{val}};'], 'req' => array( '!btn_border_type_hover' => '' ), 'show' => array( 'btn_bor_hover' => 'hover' ), ), 'btn_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width_hover'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!btn_border_type_hover' => '' ], 'show' => array( 'btn_bor_hover' => 'hover' ), ), 'btn_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius_hover'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-btn-holder:hover' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!btn_border_type_hover' => '' ), 'show' => array( 'btn_bor_hover' => 'hover' ), ), ], 'message_style' => array( 'show_msg_box' => array( 'type' => 'checkbox', 'label' => __pl('show_msg_box'), 'desc' => __pl('show_msg_box_desc') ), 'message_pos' => array( 'type' => 'radio', 'label' => __pl('position'), 'list' => array( '' => __pl('top'), 'bottom' => __pl('bottom'), ), 'addClass' => 'pagelayer-message-box-{{val}}' ), 'msg_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'css' => ['{{element}} .pagelayer-cf-msg-suc, {{element}} .pagelayer-cf-msg-err' => 'padding-top:{{val[0]}}px; padding-right:{{val[1]}}px; padding-bottom:{{val[2]}}px; padding-left:{{val[3]}}px;'], ), 'msg_margin' => array( 'type' => 'padding', 'label' => __pl('margin'), 'css' => ['{{element}} .pagelayer-cf-msg-suc, {{element}} .pagelayer-cf-msg-err' => 'margin-top:{{val[0]}}px; margin-right:{{val[1]}}px; margin-bottom:{{val[2]}}px; margin-left:{{val[3]}}px;'], ), 'msg_type' => array( 'type' => 'radio', 'label' => __pl(' '), 'list' => array( 'success' => __pl('Success'), 'failed' => __pl('failed') ) ), 'msg_success_color' => array( 'type' => 'color', 'label' => __pl('text_color'), 'css' => [ '{{element}} .pagelayer-cf-msg-suc' => 'color: {{val}}' ], 'show' => array( 'msg_type' => 'success' ), ), 'msg_success_bg' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => [ '{{element}} .pagelayer-cf-msg-suc' => 'background-color: {{val}}', ], 'show' => array( 'msg_type' => 'success' ), ), 'succ_msg_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => [ '{{element}} .pagelayer-cf-msg-suc' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'msg_type' => 'success' ) ), 'succ_msg_border_color' => array( 'type' => 'color', 'label' => __pl('service_box_icon_border_color_label'), 'default' => '#0986c0', 'css' => [ '{{element}} .pagelayer-cf-msg-suc' => 'border-color: {{val}};' ], 'req' => array( '!succ_msg_border_type' => '' ), 'show' => array( 'msg_type' => 'success' ), ), 'succ_msg_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-cf-msg-suc' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => array( '!succ_msg_border_type' => '' ), 'show' => array( 'msg_type' => 'success' ), ), 'succ_msg_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-cf-msg-suc' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!succ_msg_border_type' => '' ), 'show' => array( 'msg_type' => 'success' ), ), 'msg_failed_color' => array( 'type' => 'color', 'label' => __pl('text_color'), 'css' => [ '{{element}} .pagelayer-cf-msg-err' => 'color: {{val}}' ], 'show' => array( 'msg_type' => 'failed' ), ), 'msg_failed_bg' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => [ '{{element}} .pagelayer-cf-msg-err' => 'background-color: {{val}}', ], 'show' => array( 'msg_type' => 'failed' ), ), 'fail_msg_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => [ '{{element}} .pagelayer-cf-msg-err' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'msg_type' => 'failed' ), ), 'fail_msg_border_color' => array( 'type' => 'color', 'label' => __pl('service_box_icon_border_color_label'), 'default' => '#0986c0', 'css' => [ '{{element}} .pagelayer-cf-msg-err' => 'border-color: {{val}};' ], 'req' => array( '!fail_msg_border_type' => '' ), 'show' => array( 'msg_type' => 'failed' ), ), 'fail_msg_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-cf-msg-err' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => array( '!fail_msg_border_type' => '' ), 'show' => array( 'msg_type' => 'failed' ), ), 'fail_msg_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-cf-msg-err' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => ['!fail_msg_border_type' => ''], 'show' => ['msg_type' => 'failed'], ) ), 'mail_template' => array( 'contact_custom_templ' => array( 'type' => 'checkbox', 'label' => __pl('custom_templ'), ), 'templ_modal' => array( 'type' => 'modal', 'label' => __pl('create_mail_templ'), 'show_group' => 'contact_templ_modal', 'req' => ['contact_custom_templ' => 'true'], ), 'to_email' => array( 'type' => 'text', 'label' => __pl('to_email'), 'group' => 'contact_templ_modal', 'req' => ['contact_custom_templ' => 'true'], ), 'from_email' => array( 'type' => 'text', 'label' => __pl('from_email'), 'group' => 'contact_templ_modal', 'req' => ['contact_custom_templ' => 'true'], ), 'cont_subject' => array( 'type' => 'text', 'label' => __pl('subject'), 'group' => 'contact_templ_modal', 'req' => ['contact_custom_templ' => 'true'], ), 'cont_header' => array( 'type' => 'textarea', 'label' => __pl('additional_head'), 'group' => 'contact_templ_modal', 'req' => ['contact_custom_templ' => 'true'], ), 'cont_body' => array( 'type' => 'textarea', 'label' => __pl('message_body'), 'desc' => __pl('usr_field_desc'), 'rows' => 4, 'group' => 'contact_templ_modal', 'req' => ['contact_custom_templ' => 'true'], ), 'cont_use_html' => array( 'type' => 'checkbox', 'label' => __pl('use_html'), 'group' => 'contact_templ_modal', 'req' => ['contact_custom_templ' => 'true'], ), ), 'styles' => [ 'label_style' => __pl('label_style'), 'input_style' => __pl('input_style'), 'radio_style' => __pl('radio_style'), 'form_style' => __pl('form_style'), 'button_style' => __pl('button_style'), 'icon_style' => __pl('icon_style'), 'border_style' => __pl('btn_border_style'), 'message_style' => __pl('message_style'), 'mail_template' => __pl('mail_template'), ] ) ); pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_contact_item', array( 'name' => __pl('contact_item'), 'group' => 'other', 'not_visible' => 1, 'html' => '{{fieldhtml}}', 'parent' => [PAGELAYER_SC_PREFIX.'_contact'], 'params' => array( 'label_name' => array( 'type' => 'text', 'label' => __pl('label_name'), 'default' => 'Input Label', 'edit' => '.pagelayer-form-label', 'keep_prop' => 1, // Prevent to remove props in gutenburg 'np' => 1 ), 'field_type' => array( 'type' => 'select', 'label' => __pl('input_field_type'), 'default' => 'text', 'list' => array( 'text' => __pl('text'), 'email' => __pl('e-mail'), 'number' => __pl('number'), 'tel' => __pl('telephone'), 'checkbox' => __pl('checkbox'), 'radio' => __pl('radio'), 'textarea' => __pl('textarea'), 'select' => __pl('select'), 'date' => __pl('date'), 'file' => __pl('file'), 'label' => __pl('label'), ), 'np' => 1 ), 'values' => array( 'type' => 'textarea', 'label' => __pl('values'), 'default' => "One\nTwo", 'show' => array( 'field_type' => ['select', 'checkbox', 'radio'] ), 'np' => 1 ), 'textarea_rows' => array( 'type' => 'spinner', 'label' => __pl('row'), 'default' => 6, 'min' => 1, 'max' => 100, 'screen' => 1, 'req' => array( 'field_type' => ['textarea'] ), 'np' => 1 ), 'accept_file' => array( 'type' => 'text', 'label' => __pl('accept_file'), 'req' => array( 'field_type' => ['file'] ), 'np' => 1 ), 'required' => array( 'type' => 'checkbox', 'label' => __pl('required_label'), 'default' => '', ), 'label_as_holder' => array( 'type' => 'checkbox', 'label' => __pl('show_label_as_placeholder'), 'default' => '', 'req' => ['!field_type' => ['label']], ), 'placeholder' => array( 'type' => 'text', 'label' => __pl('placeholder'), 'default' => '', 'req' => ['!field_type' => ['label']], 'show' => ['!label_as_holder' => 'true'], ), 'field_name' => array( 'type' => 'text', 'label' => __pl('input_field_name'), 'np' => 1, 'default' => 'Fieldname', 'req' => ['!field_type' => ['label']], ), 'field_width' => array( 'type' => 'slider', 'label' => __pl('width'), 'default' => 100, 'min' => 1, 'max' => 100, 'screen' => 1, 'css' => ['{{wrap}}' => 'width:{{val}}%'], ), 'field_display' => array( 'type' => 'select', 'label' => __pl('display'), 'screen' => 1, 'default' => '', 'css' => ['{{wrap}}' => 'display:{{val}}'], 'list' => array( '' => __pl('full'), 'inline-block' => __pl('inline'), ), ), 'space_between' => array( 'type' => 'padding', 'label' => __pl('space_between'), 'default' => ',,10,', 'screen' => 1, 'css' => 'padding-top:{{val[0]}}px; padding-right:{{val[1]}}px; padding-bottom:{{val[2]}}px; padding-left:{{val[3]}}px;', ), ) ) ); // Post Title pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_post_title', array( 'name' => __pl('post_title'), 'group' => 'other', 'html' => '<div class="pagelayer-post-title"> <a class="pagelayer-ele-link" if-ext="{{link}}" href="{{{link}}}"> {{open_html_tag}}<span if="{{before}}">{{before}} </span>'.pagelayer_get_the_title(false).'<span if="{{after}}"> {{after}}</span>{{close_html_tag}} </a> </div>', 'params' => array( 'before' => array( 'type' => 'text', 'label' => __pl('before'), 'np' => 1, ), 'after' => array( 'type' => 'text', 'label' => __pl('after'), 'np' => 1, ), 'link' => array( 'type' => 'link', 'label' => __pl('image_link_label'), 'selector' => '.pagelayer-ele-link', ), 'html_tag' => array( 'type' => 'select', 'label' => __pl('html_tag'), 'default' => 'h1', 'list' => [ '' => __pl('default'), 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'h6' => 'H6', ], ), 'title_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#0986c0', 'css' => [ '{{element}} .pagelayer-post-title'=> 'color:{{val}}', '{{element}} .pagelayer-post-title *'=> 'color:{{val}}' ], ), 'typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',35,,700,,,solid,,,,', 'css' => ['{{element}} .pagelayer-post-title' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'shadow' => array( 'type' => 'shadow', 'label' => __pl('shadow'), 'css' => ['{{element}} .pagelayer-post-title' => 'text-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}};'], ), 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'screen' => 1, 'list' => [ 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ], 'css' => 'text-align: {{val}}', ), ) ) ); // Post Content pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_post_content', array( 'name' => __pl('post_content'), 'group' => 'other', 'html' => '<div class="entry-content pagelayer-post-excerpt">{{post_content}}</div>', 'params' => array( 'color' => array( 'type' => 'color', 'label' => __pl('color'), 'np' => 1, 'css' => ['{{element}} .pagelayer-post-excerpt' => 'color:{{val}}'], ), 'typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-post-excerpt' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'np' => 1, 'list' => [ 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ], 'css' => 'text-align: {{val}}' ), ) ) ); // Post Excerpt pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_post_excerpt', array( 'name' => __pl('post_excerpt'), 'group' => 'other', 'html' => '{{{post_excerpt}}}', 'params' => array( 'color' => array( 'type' => 'color', 'label' => __pl('color'), 'np' => 1, 'css' => ['{{element}} .pagelayer-post-excerpt' => 'color:{{val}}'], ), 'typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-post-excerpt' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'np' => 1, 'list' => [ 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ], 'css' => 'text-align: {{val}}', ), 'pe_margin' => array( 'type' => 'padding', 'label' => __pl('margin'), 'screen' => 1, 'units' => ['px', 'em'], 'css' => ['{{element}} .pagelayer-post-excerpt' => 'margin-top:{{val[0]}}; margin-right:{{val[1]}}; margin-bottom:{{val[2]}}; margin-left:{{val[3]}};'], ), ) ) ); // Featured Image pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_featured_img', array( 'name' => __pl('featured_img'), 'group' => 'other', 'html' => '<a if-ext="{{link_type}}" href="{{func_link}}" class="pagelayer-ele-link" pagelayer-image-link-type="{{link_type}}"> <div class="pagelayer-featured-img">{{img_html}}</div> </a> <p if="{{caption}}" class="pagelayer-featured-caption">{{caption}}</p>', 'params' => array( 'img' => array( 'label' => __pl('fallback_img'), 'type' => 'image', 'np' => 1, ), 'size' => array( 'label' => __pl('obj_image_size_label'), 'type' => 'select', 'default' => 'full', 'list' => array( 'full' => __pl('full'), 'large' => __pl('large'), 'medium' => __pl('medium'), 'thumbnail' => __pl('thumbnail'), 'custom' => __pl('custom') ) ), 'custom_size' => array( 'type' => 'dimension', 'units' => ['px', '%'], 'screen' => 1, 'label' => __pl('image_custom_size_label'), 'css' => ['{{element}} img' => 'width: {{val[0]}}; height: {{val[1]}};'], 'req' => ['size' => 'custom'] ), 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'screen' => 1, 'list' => [ 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ], 'css' => 'text-align: {{val}}', ), 'img_filter' => array( 'type' => 'filter', 'label' => __pl('filter'), 'default' => '0,100,100,0,0,100,100', 'css' => ['{{element}} img' => 'filter: blur({{val[0]}}px) brightness({{val[1]}}%) contrast({{val[2]}}%) grayscale({{val[3]}}%) hue-rotate({{val[4]}}deg) opacity({{val[5]}}%) saturate({{val[6]}}%)'], ), 'img_shadow' => array( 'type' => 'box_shadow', 'label' => __pl('shadow'), 'css' => ['{{element}} img' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}} !important;'], ), ), 'link_settings' => [ 'link_type' => array( 'label' => __pl('image_link_label'), 'type' => 'select', 'default' => '', 'list' => array( '' => __pl('none'), 'custom_url' => __pl('custom_url'), 'media_file' => __pl('media_file'), 'lightbox' => __pl('lightbox') ) ), 'link' => array( 'type' => 'link', 'label' => __pl('image_link_label'), 'desc' => __pl('image_link_desc'), 'selector' => '.pagelayer-ele-link', 'req' => array( 'link_type' => 'custom_url' ) ), 'rel' => array( 'label' => __pl('image_rel_label'), 'type' => 'text', 'default' => '', 'addAttr' => ['{{element}} a' => 'rel="{{rel}}"'], 'req' => array( 'link_type' => 'media_file' ) ), 'target' => array( 'label' => __pl('open_link_in_new_window'), 'type' => 'checkbox', 'addAttr' => ['{{element}} a' => 'target="_blank"'], 'req' => ['link_type' => ['custom_url', 'media_file']], // For backward compatibility of the new link property in version 1.5.8, hide it for custom_url. 'show' => ['link_type' => 'media_file'] ), ], 'caption_style' => [ 'caption' => array( 'label' => __pl('gallery_grid_caption_label'), 'desc' => __pl('gallery_grid_caption_desc'), 'np' => 1, 'type' => 'text', ), 'caption_color' => array( 'label' => __pl('Caption Color'), 'type' => 'color', 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-featured-caption' => 'color: {{val}}'], ), 'caption_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-featured-caption' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ], 'border_style' => [ 'f_border_hover' => array( 'type' => 'radio', 'label' => '', 'np' => 1, 'default' => '', 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'img_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} img' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'f_border_hover' => '' ), ), 'img_border_color' => array( 'type' => 'color', 'label' => __pl('service_box_icon_border_color_label'), 'default' => '#0986c0', 'css' => ['{{element}} img' => 'border-color: {{val}};'], 'req' => array( '!img_border_type' => '' ), 'show' => array( 'f_border_hover' => '' ), ), 'img_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} img' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!img_border_type' => '' ], 'show' => array( 'f_border_hover' => '' ), ), 'img_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} img' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'show' => array( 'f_border_hover' => '' ), ), 'img_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('service_btn_hover_delay'), 'min' => 0, 'step' => 100, 'max' => 2000, 'default' => 400, 'css' => ['{{element}} img' => '-webkit-transition: all {{val}}ms; transition: all {{val}}ms;'], 'show' => ['f_border_hover' => 'hover'], ), 'img_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} img:hover' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'f_border_hover' => 'hover' ), ), 'img_border_color_hover' => array( 'type' => 'color', 'label' => __pl('service_box_icon_border_color_label'), 'css' => ['{{element}} img:hover' => 'border-color: {{val}};'], 'default' => '#0986c0', 'req' => array( '!img_border_type_hover' => '' ), 'show' => array( 'f_border_hover' => 'hover' ), ), 'img_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} img:hover' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!img_border_type_hover' => '' ], 'show' => array( 'f_border_hover' => 'hover' ), ), 'img_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} img:hover' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'show' => array( 'f_border_hover' => 'hover' ), ), ], 'styles' => [ 'caption_style' => __pl('caption_style'), 'link_settings' => __pl('link_settings'), 'border_style' => __pl('border_style') ] ) ); // Post info pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_post_info', array( 'name' => __pl('post_info'), 'group' => 'other', 'has_group' => [ 'section' => 'params', 'prop' => 'elements', ], 'holder' => '.pagelayer-post-info-container', 'html' => '<div class="pagelayer-post-info-container pagelayer-post-info-{{layout}}"></div>', 'params' => array( 'elements' => array( 'type' => 'group', 'label' => __pl('post_info_list'), 'sc' => PAGELAYER_SC_PREFIX.'_post_info_list', 'item_label' => array( 'default' => __pl('info_list'), 'param' => 'type', ), 'count' => 1, 'text' => strtr(__pl('add_new_item'), array('%name%' => __pl('post_info'))), ), 'layout' => array( 'type' => 'select', 'label' => __pl('layout'), 'np' => 1, 'default' => 'vertical', 'list' => array( 'horizontal' => __pl('horizontal'), 'vertical' => __pl('vertical'), ), ), 'space_between' => array( 'type' => 'slider', 'label' => __pl('list_spacing_label'), 'default' => 15, 'screen' => 1, 'css' => ['{{element}} .pagelayer-post-info-vertical .pagelayer-post-info-list-container' => 'margin-right:{{val}}px', '{{element}} .pagelayer-post-info-horizontal .pagelayer-post-info-list-container' => 'margin-bottom:{{val}}px'] ), 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'np' => 1, 'default' => 'left', 'screen' => 1, 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'css' => ['{{element}} .pagelayer-post-info-container' => 'text-align:{{val}}'] ), ), 'icon_style' => array( 'icon_size' => array( 'type' => 'slider', 'label' => __pl('font_size'), 'units' => ['px', 'em', '%'], 'screen' => 1, 'css' => ['{{element}} .pagelayer-post-info-icon span' => 'font-size:{{val}}'], ), 'icon_colors' => array( 'type' => 'radio', 'label' => __pl('color'), 'default' => 'normal', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'icon_color_normal' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-post-info-icon span' => 'color:{{val}}'], 'show' => ['icon_colors' => 'normal'] ), 'icon_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-post-info-icon span:hover' => 'color:{{val}}'], 'show' => ['icon_colors' => 'hover'] ), ), 'text_style' => array( 'input_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-post-info-list-container a' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'text_colors' => array( 'type' => 'radio', 'label' => __pl('color'), 'default' => 'normal', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'text_color_normal' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-post-info-label' => 'color:{{val}}', '{{element}} .pagelayer-post-info-label a' => 'color:{{val}}'], 'show' => ['text_colors' => 'normal'] ), 'text_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-post-info-label:hover' => 'color:{{val}}', '{{element}} .pagelayer-post-info-label:hover a' => 'color:{{val}}'], 'show' => ['text_colors' => 'hover'] ), ), 'terms_style' => array( 'terms_text_colors' => array( 'type' => 'radio', 'label' => __pl('color'), 'default' => 'normal', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'terms_text_color_normal' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-terms *' => 'color:{{val}} !important'], 'show' => ['terms_text_colors' => 'normal'] ), 'terms_text_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-terms *:hover' => 'color:{{val}} !important'], 'show' => ['terms_text_colors' => 'hover'] ), 'terms_background_color_normal' => array( 'type' => 'color', 'label' => __pl('background_color'), 'css' => ['{{element}} .pagelayer-terms *' => 'background-color:{{val}}'], 'show' => ['terms_text_colors' => 'normal'] ), 'terms_background_color_hover' => array( 'type' => 'color', 'label' => __pl('background_color'), 'css' => ['{{element}} .pagelayer-terms *:hover' => 'background-color:{{val}}'], 'show' => ['terms_text_colors' => 'hover'] ), 'terms_text_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-terms *' => 'padding-top:{{val[0]}}px; padding-right:{{val[1]}}px; padding-bottom:{{val[2]}}px; padding-left:{{val[3]}}px;'], ), 'terms_text_margin' => array( 'type' => 'padding', 'label' => __pl('margin'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-terms *' => 'margin-top:{{val[0]}}px; margin-right:{{val[1]}}px; margin-bottom:{{val[2]}}px; margin-left:{{val[3]}}px;'], ), 'terms_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-terms *' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'show' => array( 'btn_bor_hover' => '' ), ), ), 'styles' => array( 'icon_style' => __pl('icon_style'), 'text_style' => __pl('text_style'), 'terms_style' => __pl('terms_style'), ), ) ); // Post info list pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_post_info_list', array( 'name' => __pl('post_info_list'), 'group' => 'other', 'html' => '<div class="pagelayer-post-info-list-container" if="{{post_info_content}}"> <a if-ext="{{info_link}}" href="{{link}}" class="pagelayer-post-info-list-link"> <span class="pagelayer-post-info-icon"> <span if="{{info_icon_on}}" class="{{info_icon}}"></span> <img class="pagelayer-img" if="{{info_avatar}}" src="{{avatar_url}}"></span> </span> <span if="{{info_before}}" class="pagelayer-post-info-before">{{info_before}}</span> <span class="pagelayer-post-info-label pagelayer-{{type}}">{{post_info_content}}</span> </a> </div>', 'not_visible' => 1, 'parent' => [PAGELAYER_SC_PREFIX.'_post_info'], 'params' => array( 'type' => array( 'type' => 'select', 'label' => __pl('type'), 'default' => 'author', 'np' => 1, 'list' => array( 'author' => __pl('author'), 'date' => __pl('date'), 'time' => __pl('time'), 'comments' => __pl('comments'), 'terms' => __pl('Terms'), 'custom' => __pl('custom'), ), ), 'date_format' => array( 'type' => 'select', 'label' => __pl('date_format'), 'default' => 'default', 'list' => array( 'default' => __pl('default'), '0' => 'F j, Y', '1' => 'Y-m-d', '2' => 'm/d/Y', '3' => 'd/m/Y', 'custom' => __pl('custom'), ), 'req' => ['type' => 'date'], ), 'date_format_custom' => array( 'type' => 'text', 'label' => __pl('custom_date_format'), 'default' => 's - M -Y', 'req' => ['date_format' => 'custom', 'type' => 'date'], ), 'time_format' => array( 'type' => 'select', 'label' => __pl('time_format'), 'default' => 'default', 'list' => array( 'default' => __pl('default'), '0' => 'g:i a', '1' => 'g:i A', '2' => 'H:i', 'custom' => __pl('custom'), ), 'req' => ['type' => 'time'], ), 'time_format_custom' => array( 'type' => 'text', 'label' => __pl('custom_time_format'), 'default' => 'g:i a', 'req' => ['time_format' => 'custom', 'type' => 'time'], ), 'taxonomy' => array( 'type' => 'select', 'label' => __pl('Post_taxonomy'), 'default' => 'category', 'list' => pagelayer_tax_list(), 'req' => ['type' => 'terms'], ), 'type_custom' => array( 'type' => 'text', 'label' => __pl('custom'), 'req' => ['type' => 'custom'], ), 'info_before' => array( 'type' => 'text', 'label' => __pl('before'), 'np' => 1, ), 'info_avatar' => array( 'type' => 'checkbox', 'label' => __pl('avatar_style'), 'req' => ['type' => 'author'], ), 'info_avatar_size' => array( 'type' => 'slider', 'label' => __pl('obj_size_label'), 'default' => 22, 'screen' => 1, 'css' => ['{{element}} .pagelayer-post-info-icon img' => 'height:{{val}}px;width:{{val}}px;border-radius:50%;display:inline-block;'], 'req' => ['info_avatar' => 'true', 'type' => 'author'], ), 'info_link' => array( 'type' => 'checkbox', 'label' => __pl('link_settings'), 'default' => true, 'req' => ['!type' => 'time'], ), 'info_custom_link' => array( 'type' => 'text', 'label' => __pl('custom_link'), 'default' => '#', 'req' => ['type' => 'custom'], ), 'info_icon_on' => array( 'type' => 'checkbox', 'label' => __pl('icon'), 'default' => true, 'req' => ['info_avatar' => ''], ), 'info_icon' => array( 'type' => 'icon', 'label' => __pl('icon_list'), 'default' => 'fas fa-user-circle', 'req' => ['info_icon_on' => 'true', 'info_avatar' => ''], ), ), ) ); // Post navigation pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_post_nav', array( 'name' => __pl('post_nav'), 'group' => 'other', 'html' => '<div class="pagelayer-post-nav-container"> <div class="pagelayer-prev-post"> {{prev_link}} </div> <div class="pagelayer-post-nav-separator"></div> <div class="pagelayer-next-post"> {{next_link}} </div> </div>', 'params' => array( 'in_same_term' => array( 'type' => 'checkbox', 'label' => __pl('in_same_term'), 'np' => 1, ), 'taxonomies' => array( 'type' => 'select', 'label' => __pl('Post_taxonomy'), 'default' => 'category', 'list' => pagelayer_tax_list(), 'req' => ['in_same_term' => 'true'], ), ), 'nav_label' => array( 'lables' => array( 'type' => 'checkbox', 'label' => __pl('label'), 'default' => 'true', ), 'prev_label' => array( 'type' => 'text', 'label' => __pl('prev_label'), 'np' => 1, 'default' => __pl('Previous'), 'req' => ['lables' => 'true'], ), 'next_label' => array( 'type' => 'text', 'label' => __pl('next_label'), 'np' => 1, 'default' => __pl('Next'), 'req' => ['lables' => 'true'], ), 'label_colors' => array( 'type' => 'radio', 'label' => __pl('color'), 'default' => 'normal', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), 'req' => ['lables' => 'true'], ), 'label_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-post-nav-link' => 'color:{{val}}'], 'show' => ['label_colors' => 'normal'], 'req' => ['lables' => 'true'], ), 'label_hover_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-post-nav-link:hover' => 'color:{{val}}'], 'show' => ['label_colors' => 'hover'], 'req' => ['lables' => 'true'], ), 'label_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-post-nav-link' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => ['lables' => 'true'], ), ), 'nav_title' => array( 'post_title' => array( 'type' => 'checkbox', 'label' => __pl('post_title'), 'default' => 'true', ), 'title_colors' => array( 'type' => 'radio', 'label' => __pl('color'), 'default' => 'normal', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), 'req' => ['post_title' => 'true'], ), 'title_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-post-nav-title' => 'color:{{val}}'], 'show' => ['title_colors' => 'normal'], 'req' => ['post_title' => 'true'], ), 'title_hover_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-post-nav-title:hover' => 'color:{{val}}'], 'show' => ['title_colors' => 'hover'], 'req' => ['post_title' => 'true'], ), 'title_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => ['{{element}} .pagelayer-post-nav-title' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => ['post_title' => 'true'], ), ), 'nav_icon' => array( 'arrows' => array( 'type' => 'checkbox', 'label' => __pl('arrows'), 'default' => 'true', ), 'arrows_list' => array( 'type' => 'select', 'label' => __pl('arrows_list'), 'default' => 'angle', 'list' => array( 'angle' => __pl('angle'), 'arrow' => __pl('Arrow'), 'angle-double' => __pl('angle_double'), 'arrow-circle' => __pl('arrow_circle'), 'arrow-circle-o' => __pl('arrow_circle_O'), 'chevron' => __pl('chevron'), 'chevron-circle' => __pl('chevron_circle'), 'caret' => __pl('caret'), 'long-arrow' => __pl('long_arrow'), ), 'req' => ['arrows' => 'true'], ), 'icon_colors' => array( 'type' => 'radio', 'label' => __pl('color'), 'default' => 'normal', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), 'req' => ['arrows' => 'true'], ), 'icon_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-post-nav-icon' => 'color:{{val}}'], 'show' => ['icon_colors' => 'normal'], 'req' => ['arrows' => 'true'], ), 'icon_hover_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-post-nav-icon:hover' => 'color:{{val}}'], 'show' => ['icon_colors' => 'hover'], 'req' => ['arrows' => 'true'], ), 'icon_size' => array( 'type' => 'slider', 'label' => __pl('font_size'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-post-nav-icon' => 'font-size:{{val}}px'], 'req' => ['arrows' => 'true'], ), ), 'nav_sep' => array( 'disable_sep' => array( 'type' => 'checkbox', 'label' => __pl('disable_sep'), 'css' => ['{{element}} .pagelayer-post-nav-separator' => 'display:none'], ), 'sep_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#bdbdbd', 'css' => ['{{element}} .pagelayer-post-nav-separator' => 'background-color:{{val}}'], 'req' => ['disable_sep' => ''] ), 'sep_rotate' => array( 'type' => 'slider', 'label' => __pl('Rotate'), 'default' => 20, 'max' => 360, 'screen' => 1, 'css' => ['{{element}} .pagelayer-post-nav-separator' => 'transform: rotate({{val}}deg);'], 'req' => ['disable_sep' => ''] ), 'sep_width' => array( 'type' => 'slider', 'label' => __pl('width'), 'default' => 1, 'max' => 10, 'screen' => 1, 'css' => ['{{element}} .pagelayer-post-nav-separator' => 'width: {{val}}px;'], 'req' => ['disable_sep' => ''] ), ), 'styles' => array( 'nav_label' => __pl('label_style'), 'nav_title' => __pl('title_style'), 'nav_icon' => __pl('icon_style'), 'nav_sep' => __pl('separator_style'), ), ) ); // Post comment pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_post_comment', array( 'name' => __pl('post_commment'), 'group' => 'other', 'html' => '<div class="pagelayer-post-comment-container"> {{post_comment}} </div>', 'params' => array( 'comment_skin' => array( 'type' => 'select', 'label' => __pl('skin'), 'default' => 'theme_comment', 'list' => array( 'theme_comment' => __pl('theme_tamplate'), ), ), 'post_type' => array( 'type' => 'radio', 'label' => __pl('post_type'), 'default' => 'current', 'list' => array( 'current' => __pl('current'), 'custom' => __pl('custom'), ), ), 'post_id' => array( 'type' => 'select', 'label' => __pl('post_list'), 'default' => '', 'list' => pagelayer_get_posts(), 'req' => ['post_type' => 'custom'] ), ), ) ); // Flipbox pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_flipbox', array( 'name' => __pl('Flipbox'), 'group' => 'other', 'html' => '<div class="pagelayer-flipbox-container pagelayer-flipbox-{{back_section}} pagelayer-flipbox-{{flip_animation}} pagelayer-flipbox-direction-{{animation_direction}}"> <div class="pagelayer-flipbox-overlay"></div> <div class="pagelayer-flipbox-main"> <div class="pagelayer-flipbox-flipper"> <div class="pagelayer-flipbox-box pagelayer-flipbox-front"> <div class="pagelayer-flipbox-box-overlay"> <div class="pagelayer-flipbox-box-inner"> <div class="pagelayer-flipbox-content"> <div class="pagelayer-icon-holder pagelayer-service-icon pagelayer-service-{{icon_view}}"> <i class="{{icon}} {{bg_shape}} {{icon_size}} pagelayer-animation-{{anim_hover}}"></i> </div> <div if="{{heading_image}}" class="pagelayer-flipbox-image"> <img class="pagelayer-img pagelayer-animation-{{anim_hover}}" src="{{func_image}}" title="{{{heading_image-title}}}" alt="{{{heading_image-alt}}}" /> </div> <h2 if={{front_heading}}>{{front_heading}}</h2> <p if={{front_content}}>{{front_content}}</p> </div> </div> </div> </div> <div class="pagelayer-flipbox-box pagelayer-flipbox-back" style=""> <div class="pagelayer-flipbox-box-overlay"> <div class="pagelayer-flipbox-box-inner"> <div class="pagelayer-flipbox-content"> <h2 if={{back_heading}}>{{back_heading}}</h2> <p if={{back_content}}>{{back_content}}</p> <a if="{{display_button}}" href="{{{back_button_url}}}" class="pagelayer-service-btn {{back_button_type}} pagelayer-ele-link pagelayer-button {{back_button_size}}">{{back_button_text}}</a> </div> </div> </div> </div> </div> </div> </div>', 'params' => array( 'height' => array( 'type' => 'slider', 'label' => __pl('block_height'), 'np' => 1, 'min' => 100, 'max' => 1200, 'default' => 500, 'screen' => 1, 'css' => ['{{element}} .pagelayer-flipbox-flipper' => 'height: {{val}}px;'], ), 'content_width' => array( 'type' => 'slider', 'label' => __pl('content_width'), 'min' => 50, 'max' => 100, 'default' => 100, 'screen' => 1, 'css' => ['{{element}} .pagelayer-flipbox-content' => 'width: {{val}}%; margin:0 auto;'], ), 'flip_animation' => array( 'type' => 'select', 'label' => __pl('animation_styles'), 'default' => 'flip', 'list' => array( 'flip' => __pl('flip'), 'slide' => __pl('slide'), 'push' => __pl('push'), 'zoom-in' => __pl('zoom-in'), 'zoom-out' => __pl('zoom-out'), 'fade' => __pl('fade'), ), ), 'animation_direction' => array( 'type' => 'select', 'label' => __pl('animation_direction'), 'default' => 'right', 'list' => array( 'up' => __pl('top'), 'down' => __pl('bottom'), 'right' => __pl('right'), 'left' => __pl('left'), ), 'req' => array( '!flip_animation' => ['fade','zoom-out','zoom-in'], ), ), 'animation_duration' => array( 'type' => 'spinner', 'label' => __pl('animation_duration'), 'np' => 1, 'default' => 600, 'min' => 100, 'step' => 50, 'max' => 2000, 'css' => ['{{element}} .pagelayer-flipbox-box' => 'transition: all {{val}}ms ease-in-out !important; -webkit-transition: all {{val}}ms ease-in-out !important;'] ), 'flip_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-flipbox-flipper' => 'border-style: {{val}}'], 'list' => array( '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ), ), 'flip_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-flipbox-flipper' => 'border-color: {{val}};'], 'req' => array( '!flip_border_type' => '' ), ), 'flip_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-flipbox-flipper' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => array( '!flip_border_type' => '' ), ), 'flip_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => ['px', '%'], 'screen' => 1, 'css' => ['{{element}} .pagelayer-flipbox-flipper' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], ), ), 'front_section' => array( 'heading_element' => array( 'type' => 'radio', 'label' => __pl('visual_element'), 'default' => '', 'list' => array( '' => __pl('none'), 'icon' => __pl('icon'), 'image' => __pl('image'), ), ), 'icon' => array( 'type' => 'icon', 'label' => __pl('icon'), 'default' => 'fas fa-star', 'req' => array( 'heading_element'=>'icon', ), ), 'icon_view' => array( 'type' => 'select', 'label' => __pl('iconbox_icon_view'), 'default' => 'default', 'list' =>array( 'default' => __pl('default'), 'stacked' => __pl('Stacked'), 'framed' => __pl('Framed'), ), 'req' => array( 'heading_element'=>'icon', ), ), 'bg_shape' => array( 'type' => 'select', 'label' => __pl('icon_background_shape'), 'default' => 'pagelayer-icon-circle', 'list' => array( '' => __pl('icon_shape_none'), 'pagelayer-icon-circle' => __pl('icon_shape_circle'), 'pagelayer-icon-square' => __pl('icon_shape_square'), 'pagelayer-icon-rounded' => __pl('icon_shape_rounded') ), 'req' => array( 'heading_element'=>'icon', '!icon_view' => 'default', ), ), 'icon_color_style' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-flipbox-content i' => 'position: relative; color: {{val}};', '{{element}} pagelayer-flipbox-content i:before' => 'position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);'], 'default' => '#ffffff', 'req' => array( 'heading_element'=>'icon', ), ), 'bg_color' => array( 'type' => 'color', 'label' => __pl('icon_background_color'), 'default' => '#ef9229', 'css' => ['{{element}} .pagelayer-flipbox-content i' => 'background-color: {{val}};'], 'req' => array( 'heading_element'=>'icon', '!bg_shape' => '', 'icon_view' => 'stacked', ), 'show' => array( 'icon_hover' => '' ), ), 'icon_background_size' => array( 'type' => 'spinner', 'label' => __pl('icon_background_size'), 'default' => 20, 'css' => ['{{element}} .pagelayer-flipbox-content i' => 'padding: calc(0.5em + {{val}}px);'], 'min' => 1, 'max' => 100, 'step' => 1, 'screen' => 1, 'req' => array( 'heading_element'=>'icon', ), ), 'icon_size' => array( 'type' => 'select', 'label' => __pl('size_label'), 'default' => 'pagelayer-icon-large', 'list' => array( 'pagelayer-icon-mini' => __pl('mini'), 'pagelayer-icon-small' => __pl('small'), 'pagelayer-icon-large' => __pl('large'), 'pagelayer-icon-extra-large' => __pl('extra_large'), 'pagelayer-icon-double-large' => __pl('double_large'), 'pagelayer-icon-custom' => __pl('custom'), ), 'req' => array( 'heading_element'=>'icon', ), ), 'icon_size_custom' => array( 'type' => 'spinner', 'label' => __pl('icon_custom_size'), 'min' => 1, 'step' => 1, 'max' => 100, 'default' => 26, 'screen' => 1, 'css' => ['{{element}} .pagelayer-flipbox-content i' => 'font-size: {{val}}px'], 'req' => array( 'icon_size' => 'pagelayer-icon-custom', 'heading_element' => 'icon' ), ), 'icon_rotate' => array( 'type' => 'spinner', 'label' => __pl('icon_rotate'), 'default' => 0, 'css' => ['{{element}} .pagelayer-flipbox-content i' => 'transform: rotate({{val}}deg)'], 'min' => 0, 'max' => 360, 'step' => 1, 'screen' => 1, 'req' => array( 'heading_element'=>'icon', ), ), 'icon_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-flipbox-content i' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'req' => array( 'heading_element'=>'icon', ), ), 'icon_border_color' => array( 'type' => 'color', 'label' => __pl('icon_border_color'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-flipbox-content i' => 'border-color: {{val}};'], 'req' => array( '!icon_border_type' => '', 'heading_element' => 'icon' ), ), 'icon_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-flipbox-content i' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!icon_border_type' => '', 'heading_element' => 'icon' ], ), 'icon_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-flipbox-content i' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!icon_border_type' => '', 'heading_element' => 'icon' ), ), 'heading_image'=> array( 'type' => 'image', 'label' => __pl('image'), 'default' => PAGELAYER_URL.'/images/default-image.png', 'req' => array( 'heading_element' => 'image', ), ), 'heading_image_size' => array( 'type' => 'radio', 'label' => __pl('image_size'), 'default' => 'full', 'list' => array( 'full' => __pl('full'), 'thumbnail' => __pl('thumbnail'), 'custom' => __pl('custom'), ), 'req' => array( 'heading_element' => 'image', ), ), 'heading_image_custom_size' => array( 'type' => 'slider', 'label' => __pl('img_custom_size'), 'min' => 0, 'max' => 100, 'screen' => 1, 'default' => 50, 'css' => ['{{element}} .pagelayer-flipbox-image img' => 'width:{{val}}%; height: auto;'], 'req' => array( 'heading_element' => 'image', 'heading_image_size' => 'custom', ) ), 'heading_image_spacing' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'min' => 0, 'max' => 100, 'screen' => 1, 'default' => 20, 'css' => ['{{element}} .pagelayer-flipbox-image img' => 'margin-bottom:{{val}}px;'], 'req' => array( 'heading_element' => 'image', ) ), 'front-text-align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'center', 'screen' => 1, 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ), 'css' => ['{{element}} .pagelayer-flipbox-front .pagelayer-flipbox-box-overlay' => 'text-align:{{val}} !important;'], ), 'front_heading' => array( 'type' => 'text', 'default' => 'Flipbox Heading', 'label' => __pl('heading_name'), 'np' => 1, ), 'heading_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-flipbox-front .pagelayer-flipbox-content h2' => 'color:{{val}};'], ), 'heading_typography' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => 'Poppins,40,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-flipbox-front .pagelayer-flipbox-content h2' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'front_content' => array( 'type' => 'textarea', 'label' => __pl('content'), 'np' => 1, 'default' => 'Flipbox content comes here such as It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.', ), 'front_content_color' => array( 'type' => 'color', 'label' => __pl('text_color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-flipbox-front .pagelayer-flipbox-content p' => 'color:{{val}};'], ), 'front_content_typography' => array( 'type' => 'typography', 'label' => __pl('text_style'), 'default' => ',16,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-flipbox-front .pagelayer-flipbox-content p' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'front_shadow' => array( 'type' => 'box_shadow', 'label' => __pl('shadow'), 'css' => ['{{element}} .pagelayer-flipbox-front' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}};'], ), 'front_background_type' => array( 'type' => 'radio', 'label' => __pl('background_type'), 'default' => '', 'list' => array( 'color' => __pl('color'), 'gradient' => __pl('gradient'), 'image' => __pl('image'), ), ), 'front_background_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '', 'css' => ['{{element}} .pagelayer-flipbox-front' => 'background-color:{{val}};'], 'req' => array( 'front_background_type' => 'color', ), ), 'front_background_gradient' => array( 'type' => 'gradient', 'label' => __pl('background_gradient'), 'default' => '150,#f12711,40,#f5af19,60,#f5af19,100', 'css' => ['{{element}} .pagelayer-flipbox-front' => 'background: linear-gradient({{val[0]}}deg, {{val[1]}} {{val[2]}}%, {{val[3]}} {{val[4]}}%, {{val[5]}} {{val[6]}}%) !important;'], 'req' => array( 'front_background_type' => 'gradient', ), ), 'front_background_image' => array( 'type' => 'image', 'label' => __pl('image'), 'np' => 1, 'default' => PAGELAYER_URL.'/images/default-image.png', 'css' => ['{{element}} .pagelayer-flipbox-front' => 'background-image:url("{{{front_background_image-url}}}") !important;'], 'req' => array( 'front_background_type' => 'image', ), ), 'front_background_attachment' => array( 'type' => 'select', 'label' => __pl('background_attachment'), 'list' => array( '' => __pl('default'), 'scroll' => __pl('scroll'), 'fixed' => __pl('fixed') ), 'css' => ['{{element}} .pagelayer-flipbox-front' => 'background-attachment: {{val}}'], 'req' => array( 'front_background_type' => 'image', ), ), 'front_background_posx' => array( 'type' => 'select', 'label' => __pl('ele_bg_posx'), 'list' => array( '' => __pl('default'), 'center' => __pl('center'), 'left' => __pl('left'), 'right' => __pl('right') ), 'css' => ['{{element}} .pagelayer-flipbox-front' => 'background-position-x: {{val}};'], 'req' => array( 'front_background_type' => 'image', ), ), 'front_background_posy' => array( 'type' => 'select', 'label' => __pl('ele_bg_posy'), 'list' => array( '' => __pl('default'), 'center' => __pl('center'), 'top' => __pl('top'), 'bottom' => __pl('bottom') ), 'css' => ['{{element}} .pagelayer-flipbox-front' => 'background-position-y: {{val}};'], 'req' => array( 'front_background_type' => 'image', ), ), 'front_background_repeat' => array( 'type' => 'select', 'label' => __pl('repeat'), 'css' => ['{{element}} .pagelayer-flipbox-front' => 'background-repeat: {{val}};'], 'list' => array( '' => __pl('default'), 'repeat' => __pl('repeat'), 'no-repeat' => __pl('no-repeat'), 'repeat-x' => __pl('repeat-x'), 'repeat-y' => __pl('repeat-y'), ), 'req' => array( 'front_background_type' => 'image', ), ), 'front_background_size' => array( 'type' => 'select', 'label' => __pl('ele_bg_size'), 'css' => ['{{element}} .pagelayer-flipbox-front' => 'background-size: {{val}};'], 'list' => array( '' => __pl('default'), 'cover' => __pl('cover'), 'contain' => __pl('contain') ), 'req' => array( 'front_background_type' => 'image', ), ), 'front_section_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'screen' => 1, 'default' => '100,100,100,100', 'css' => ['{{element}} .pagelayer-flipbox-front .pagelayer-flipbox-box-overlay' => 'padding: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], ), ), 'back_section' => array( 'back_section' => array( 'type' => 'checkbox', 'label' => __pl('back_side'), ), 'back-text-align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'center', 'screen' => 1, 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ), 'css' => ['{{element}} .pagelayer-flipbox-back .pagelayer-flipbox-box-overlay' => 'text-align:{{val}} !important;'], ), 'back_heading' => array( 'type' => 'text', 'label' => __pl('title'), 'np' => 1, 'default' => 'Flipbox Back Heading', ), 'back_heading_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#000000', 'css' => ['{{element}} .pagelayer-flipbox-back .pagelayer-flipbox-content h2' => 'color:{{val}};'], ), 'back_heading_typography' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => 'Poppins,40,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-flipbox-back .pagelayer-flipbox-content h2' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'back_content' => array( 'type' => 'textarea', 'label' => __pl('content'), 'np' => 1, 'default' => 'Flipbox content comes here such as It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.', ), 'back_content_color' => array( 'type' => 'color', 'label' => __pl('text_color'), 'default' => '#3c3f40', 'css' => ['{{element}} .pagelayer-flipbox-back .pagelayer-flipbox-content p' => 'color:{{val}};'], ), 'back_content_typography' => array( 'type' => 'typography', 'label' => __pl('text_style'), 'default' => ',16,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-flipbox-back .pagelayer-flipbox-content p' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'back_shadow' => array( 'type' => 'box_shadow', 'label' => __pl('shadow'), 'css' => ['{{element}} .pagelayer-flipbox-back' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}};'], ), 'display_button' => array( 'type' => 'checkbox', 'label' => __pl('button'), ), 'back_button_url' => array( 'type' => 'link', 'label' => __pl('btn_url_label'), 'selector' => '.pagelayer-service-btn', 'req' => array( '!display_button' => '', ), ), 'back_button_text' => array( 'type' => 'text', 'label' => __pl('button_text_label'), 'default' => 'Click Here!', 'req' => array( '!display_button' => '', ), ), 'back_button_typography' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',20,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-service-btn' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => array( '!display_button' => '', ), ), 'back_button_type' => array( 'type' => 'select', 'label' => __pl('type'), 'default' => 'pagelayer-btn-default', 'list' => array( 'pagelayer-btn-default' => __pl('btn_type_default'), 'pagelayer-btn-primary' => __pl('btn_type_primary'), 'pagelayer-btn-secondary' => __pl('btn_type_secondary'), 'pagelayer-btn-success' => __pl('btn_type_success'), 'pagelayer-btn-info' => __pl('btn_type_info'), 'pagelayer-btn-warning' => __pl('btn_type_warning'), 'pagelayer-btn-danger' => __pl('btn_type_danger'), 'pagelayer-btn-dark' => __pl('btn_type_dark'), 'pagelayer-btn-light' => __pl('btn_type_light'), 'pagelayer-btn-link' => __pl('btn_type_link'), 'pagelayer-btn-custom' => __pl('btn_type_custom') ), 'req' => array( '!display_button' => '', ), ), 'back_button_size' => array( 'type' => 'select', 'label' => __pl('button_size'), 'default' => 'pagelayer-btn-mini', 'list' => array( 'pagelayer-btn-mini' => __pl('mini'), 'pagelayer-btn-small' => __pl('small'), 'pagelayer-btn-large' => __pl('large'), 'pagelayer-btn-extra-large' => __pl('extra_large'), 'pagelayer-btn-double-large' => __pl('double_large'), 'pagelayer-btn-custom' => __pl('custom') ), 'req' => array( '!display_button' => '', ), ), 'back_button_custom_size' => array( 'type' => 'spinner', 'label' => __pl('btn_custom_size'), 'min' => 1, 'step' => 1, 'max' => 100, 'default' => 5, 'screen' => 1, 'css' => ['{{element}} .pagelayer-flipbox-back .pagelayer-service-btn' => 'padding: calc({{val}}px / 2) {{val}}px;'], 'req' => array( 'back_button_size' => 'pagelayer-btn-custom', ), ), 'back_btn_spacing' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'min' => 0, 'max' => 200, 'default' => 10, 'screen' => 1, 'css' => ['{{element}} .pagelayer-service-btn' => 'margin-top: {{val}}px;'], 'req' => array( '!display_button' => '', ), ), 'back_btn_state' => array( 'type' => 'radio', 'label' => __pl('button_state'), 'default' => 'normal', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), 'req' => array( 'back_button_type' => 'pagelayer-btn-custom', '!display_button' => '', ), ), 'back_button_color' => array( 'type' => 'color', 'label' => __pl('button_color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-service-btn' => 'color:{{val}};'], 'show' => array( 'back_btn_state' => 'normal', ), ), 'back_button_bg_color' => array( 'type' => 'color', 'label' => __pl('button_bg_color'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-service-btn' => 'background-color:{{val}};'], 'show' => array( 'back_btn_state' => 'normal', ), ), 'back_btn_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('btn_hover_delay'), 'min' => 0, 'step' => 100, 'max' => 5000, 'default' => 400, 'css' => ['{{element}} .pagelayer-service-btn' => '-webkit-transition: all {{val}}ms; transition: all {{val}}ms;'], 'show' => array( 'back_btn_state' => 'hover', ), ), 'back_button_color_hover' => array( 'type' => 'color', 'label' => __pl('button_color'), 'default' => '', 'css' => ['{{element}} .pagelayer-service-btn:hover' => 'color:{{val}} !important;'], 'show' => array( 'back_btn_state' => 'hover', ), ), 'back_button_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('button_bg_color'), 'default' => '', 'css' => ['{{element}} .pagelayer-service-btn:hover' => 'background-color:{{val}} !important;'], 'show' => array( 'back_btn_state' => 'hover' ), ), 'back_background_type' => array( 'type' => 'radio', 'label' => __pl('background_type'), 'default' => '', 'list' => array( 'color' => __pl('color'), 'gradient' => __pl('gradient'), 'image' => __pl('image'), ), ), 'back_background_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '', 'css' => ['{{element}} .pagelayer-flipbox-back' => 'background-color:{{val}};'], 'req' => array( 'back_background_type' => 'color', ), ), 'back_background_gradient' => array( 'type' => 'gradient', 'label' => __pl('background_gradient'), 'default' => '150,#1488CC,40,#2B32B2,60,#2B32B2,100', 'css' => ['{{element}} .pagelayer-flipbox-back' => 'background: linear-gradient({{val[0]}}deg, {{val[1]}} {{val[2]}}%, {{val[3]}} {{val[4]}}%, {{val[5]}} {{val[6]}}%) !important;'], 'req' => array( 'back_background_type' => 'gradient', ), ), 'back_background_image' => array( 'type' => 'image', 'label' => __pl('image'), 'default' => PAGELAYER_URL.'/images/default-image.png', 'css' => ['{{element}} .pagelayer-flipbox-back' => 'background-image:url("{{{back_background_image-url}}}") !important;'], 'req' => array( 'back_background_type' => 'image', ), ), 'back_background_attachment' => array( 'type' => 'select', 'label' => __pl('background_attachment'), 'list' => array( '' => __pl('default'), 'scroll' => __pl('scroll'), 'fixed' => __pl('fixed') ), 'css' => ['{{element}} .pagelayer-flipbox-back' => 'background-attachment: {{val}}'], 'req' => array( 'back_background_type' => 'image', ), ), 'back_background_posx' => array( 'type' => 'select', 'label' => __pl('ele_bg_posx'), 'list' => array( '' => __pl('default'), 'center' => __pl('center'), 'left' => __pl('left'), 'right' => __pl('right') ), 'css' => ['{{element}} .pagelayer-flipbox-back' => 'background-position-x: {{val}};'], 'req' => array( 'back_background_type' => 'image', ), ), 'back_background_posy' => array( 'type' => 'select', 'label' => __pl('ele_bg_posy'), 'list' => array( '' => __pl('default'), 'center' => __pl('center'), 'top' => __pl('top'), 'bottom' => __pl('bottom') ), 'css' => ['{{element}} .pagelayer-flipbox-back' => 'background-position-y: {{val}};'], 'req' => array( 'back_background_type' => 'image', ), ), 'back_background_repeat' => array( 'type' => 'select', 'label' => __pl('ele_bg_repeat'), 'css' => ['{{element}} .pagelayer-flipbox-back' => 'background-repeat: {{val}};'], 'list' => array( '' => __pl('default'), 'repeat' => __pl('repeat'), 'no-repeat' => __pl('no-repeat'), 'repeat-x' => __pl('repeat-x'), 'repeat-y' => __pl('repeat-y'), ), 'req' => array( 'back_background_type' => 'image', ), ), 'back_background_size' => array( 'type' => 'select', 'label' => __pl('ele_bg_size'), 'css' => ['{{element}} .pagelayer-flipbox-back' => 'background-size: {{val}};'], 'list' => array( '' => __pl('default'), 'cover' => __pl('cover'), 'contain' => __pl('contain') ), 'req' => array( 'back_background_type' => 'image', ), ), 'back_section_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'default' => '100,100,100,100', 'screen' => 1, 'css' => ['{{element}} .pagelayer-flipbox-back .pagelayer-flipbox-box-overlay' => 'padding: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], ), ), 'styles' => [ 'front_section' => __pl('front_section'), 'back_section' => __pl('back_section'), ] ) ); // Countdown Timer pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_countdown', array( 'name' => __pl('countdown_timer'), 'group' => 'other', 'html' => '<div class="pagelayer-countdown-container" pagelayer-expiry-date={{date}} pagelayer-time-type={{time_zone}}> <div class="pagelayer-countdown-expired"> <p if={{expired_text}}>{{expired_text}}</p> </div> <div class="pagelayer-countdown-counter"> <div if={{days}} class="pagelayer-countdown-days pagelayer-countdown-item pagelayer-countdown-{{display}}"> <div class="pagelayer-days-count pagelayer-countdown-count"></div> <div if={{show_label}} class="pagelayer-countdown-name"> <span if={{days_label_text}}>{{days_label_text}}</span> </div> </div> <div if={{hours}} class="pagelayer-countdown-hours pagelayer-countdown-item pagelayer-countdown-{{display}}"> <div class="pagelayer-hours-count pagelayer-countdown-count"></div> <div if={{show_label}} class="pagelayer-countdown-name"> <span if={{hours_label_text}}>{{hours_label_text}}</span> </div> </div> <div if={{minutes}} class="pagelayer-countdown-minutes pagelayer-countdown-item pagelayer-countdown-{{display}}"> <div class="pagelayer-minutes-count pagelayer-countdown-count"></div> <div if={{show_label}} class="pagelayer-countdown-name"> <span if={{minutes_label_text}} >{{minutes_label_text}}</span> </div> </div> <div if={{seconds}} class="pagelayer-countdown-seconds pagelayer-countdown-item pagelayer-countdown-{{display}}"> <div class="pagelayer-seconds-count pagelayer-countdown-count"></div> <div if={{show_label}} class="pagelayer-countdown-name"> <span if={{seconds_label_text}} >{{seconds_label_text}}</span> </div> </div> </div> </div>', 'params' => array( 'date' => array( 'type' => 'datetime', 'displayMode' => 'datetime', // date | datetime (default) 'returnMode' => 'YYYY-MM-DD H:m:s', // mysql format uses here (default: Y-m-d H:i:s ) 'label' => __pl('date_picker_label'), 'np' => 1, 'default' => '', ), 'time_zone' => array( 'type' => 'select', 'label' => __pl('time_zone'), 'default' => 'server', 'list' => array( 'server' => __pl('server_time'), 'local' => __pl('user_local') ), ), 'number_color' => array( 'type' => 'color', 'label' => __pl('color'), 'np' => 1, 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-countdown-count' => 'color:{{val}}'], ), 'number_style' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',50,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-countdown-count' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'number_spacing' => array( 'type' => 'padding', 'label' => __pl('spacing'), 'units' => ['px', 'em', '%'], 'screen' => 1, 'css' => ['{{element}} .pagelayer-countdown-count' => 'margin-top: {{val[0]}}; margin-right: {{val[1]}}; margin-bottom: {{val[2]}}; margin-left: {{val[3]}};'], ), 'days' => array( 'type' => 'checkbox', 'label' => __pl('days'), 'np' => 1, 'default' => 'true', ), 'hours' => array( 'type' => 'checkbox', 'label' => __pl('hours'), 'np' => 1, 'default' => 'true', ), 'minutes' => array( 'type' => 'checkbox', 'label' => __pl('minutes'), 'np' => 1, 'default' => 'true', ), 'seconds' => array( 'type' => 'checkbox', 'label' => __pl('seconds'), 'np' => 1, 'default' => 'true', ), ), 'expired_text' =>[ 'display_expired_text' => array( 'type' => 'checkbox', 'label' => __pl('expired_text'), ), 'expired_text' => array( 'type' => 'text', 'label' => __pl('text'), 'default' => 'Countdown Timer Expired', ), 'expired_color' => array( 'type' => 'color', 'label' => __pl('text_color'), 'default' => '#000000', 'css' => ['{{element}} .pagelayer-countdown-expired p' => 'color:{{val}};'], ), 'expired_background_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'css' => ['{{element}} .pagelayer-countdown-expired' => 'background-color:{{val}};'], ), 'expired_style' => array( 'type' => 'typography', 'label' => __pl('expired_style'), 'default' => ',50,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-countdown-expired p' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'expired_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'units' => ['px', '%'], 'screen' => 1, 'css' => ['{{element}} .pagelayer-countdown-expired' => 'padding: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], ), 'expired_align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'default' => 'center', 'screen' => 1, 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ), 'css' => ['{{element}} .pagelayer-countdown-expired' => 'text-align:{{val}};'], ), ], 'text_style' =>[ 'show_label' => array( 'type' => 'checkbox', 'label' => __pl('show_title'), 'np' => 1, 'default' => 'true', ), 'custom_label_text' => array( 'type' => 'checkbox', 'label' => __pl('custom_label_text'), 'show' => array( 'show_label' => 'true', ), ), 'days_label_text' => array( 'type' => 'text', 'label' => __pl('days'), 'default' => __pl('days'), 'show' => array( '!custom_label_text' => '', '!days' => '', ), ), 'hours_label_text' => array( 'type' => 'text', 'label' => __pl('hours'), 'default' => __pl('hours'), 'show' => array( '!custom_label_text' => '', '!hours' => '', ), ), 'minutes_label_text' => array( 'type' => 'text', 'label' => __pl('minutes'), 'default' => __pl('minutes'), 'show' => array( '!custom_label_text' => '', '!minutes' => '', ), ), 'seconds_label_text' => array( 'type' => 'text', 'label' => __pl('seconds'), 'default' => __pl('seconds'), 'show' => array( '!custom_label_text' => '', '!seconds' => '', ), ), 'font_color' => array( 'type' => 'color', 'label' => __pl('text_color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-countdown-name span' => 'color:{{val}}'], 'show' => array( 'show_label' => 'true', ), ), 'cd_text_style' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',18,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-countdown-name' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'show' => array( 'show_label' => 'true', ), ), ], 'block_styles' =>[ 'display' => array( 'type' => 'select', 'label' => __pl('display'), 'default' => 'block', 'list' => [ 'block' => __pl('block'), 'inline' => __pl('inline'), ], ), 'block_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#2b1661', 'css' => ['{{element}} .pagelayer-countdown-item' => 'background-color:{{val}}'], ), 'blocks_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'units' => ['px', 'em', '%'], 'screen' => 1, 'css' => ['{{element}} .pagelayer-countdown-item' => 'padding-top: {{val[0]}}; padding-right: {{val[1]}}; padding-bottom: {{val[2]}}; padding-left: {{val[3]}}'], ), 'blocks_space' => array( 'type' => 'padding', 'label' => __pl('block_space'), 'units' => ['px', 'em'], 'screen' => 1, 'css' => ['{{element}} .pagelayer-countdown-item' => 'margin-top: {{val[0]}}; margin-right: {{val[1]}}; margin-bottom: {{val[2]}}; margin-left: {{val[3]}}'], ), 'cd_border_state' => array( 'type' => 'radio', 'label' => __pl(''), 'default' => '', 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'cd_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-countdown-item' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'cd_border_state' => '' ), ), 'cd_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-countdown-item' => 'border-color: {{val}};'], 'req' => array( '!cd_border_type' => '' ), 'show' => array( 'cd_border_state' => '' ), ), 'cd_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-countdown-item' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!cd_border_type' => '' ], 'show' => array( 'cd_border_state' => '' ), ), 'cd_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => ['px', '%'], 'screen' => 1, 'css' => ['{{element}} .pagelayer-countdown-item' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], 'show' => array( 'cd_border_state' => '' ), ), 'cd_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-countdown-item:hover' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => array( 'cd_border_state' => 'hover' ), ), 'cd_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['{{element}} .pagelayer-countdown-item:hover' => 'border-color: {{val}};'], 'default' => '#0986c0', 'req' => array( '!cd_border_type_hover' => '' ), 'show' => array( 'cd_border_state' => 'hover' ), ), 'cd_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-countdown-item:hover' => 'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px'], 'req' => [ '!cd_border_type_hover' => '' ], 'show' => array( 'cd_border_state' => 'hover' ), ), 'cd_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'units' => ['px', '%'], 'screen' => 1, 'css' => ['{{element}} .pagelayer-countdown-item:hover' => 'border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}}; -webkit-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};-moz-border-radius: {{val[0]}} {{val[1]}} {{val[2]}} {{val[3]}};'], 'show' => array( 'cd_border_state' => 'hover' ), ), 'cd_shadow' => array( 'type' => 'box_shadow', 'label' => __pl('shadow'), 'css' => ['{{element}} .pagelayer-countdown-item' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}};'], 'show' => array( 'cd_border_state' => '', ), ), 'cd_shadow_hover' => array( 'type' => 'box_shadow', 'label' => __pl('shadow'), 'css' => ['{{element}} .pagelayer-countdown-item:hover' => 'box-shadow: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[4]}}px {{val[3]}} {{val[5]}};'], 'show' => array( 'cd_border_state' => 'hover' ), ), ], 'styles' => [ 'text_style' => __pl('title_style'), 'expired_text' => __pl('expired_text'), 'block_styles' => __pl('block_styles'), ], ) ); // Button Group pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_btn_grp', array( 'name' => __pl('btn_grp'), 'group' => 'button', 'has_group' => [ 'section' => 'params', 'prop' => 'elements' ], 'params' => array( 'elements' => array( 'type' => 'group', 'label' => __pl('buttons'), 'sc' => PAGELAYER_SC_PREFIX.'_btn', 'item_label' => array( 'default' => __pl('button'), 'param' => 'text' ), 'count' => 2, 'text' => strtr(__pl('add_new_item'), array('%name%' => __pl('button_name'))), ), 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'np' => 1, 'default' => 'center', 'screen' => 1, 'css' => [ '{{element}}' => 'text-align: {{val}}', '{{element}} .pagelayer-btn' => 'text-align: {{val}}' ], 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ) ), 'group_layout' => array( 'type' => 'radio', 'label' => __pl('layout'), 'default' => 'horizontal', 'css' => ['{{element}} > div' => 'display: inline-block;'], 'list' => array( 'horizontal' => __pl('horizontal'), '' => __pl('vertical') ) ), 'hindent' => array( 'type' => 'spinner', 'label' => __pl('space_between'), 'np' => 1, 'default' => '5', 'css' => ['{{element}} .pagelayer-btn' => 'padding-left: {{val}}px; padding-right: {{val}}px;'], 'min' => 0, 'step' => 1, 'max' => 50, 'default' => 3, 'screen' => 1, 'req' => ['group_layout' => 'horizontal'] ), 'vindent' => array( 'type' => 'spinner', 'label' => __pl('space_between'), 'np' => 1, 'default' => '5', 'css' => ['{{element}} .pagelayer-btn' => 'padding-top: {{val}}px; padding-bottom: {{val}}px;'], 'min' => 0, 'step' => 1, 'max' => 50, 'default' => 3, 'screen' => 1, 'req' => ['group_layout' => ''] ) ) ) ); // Testimonial Slider pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_testimonial_slider', array( 'name' => __pl('testimonial_slider'), 'group' => 'other', 'has_group' => [ 'section' => 'params', 'prop' => 'elements' ], 'icon' => 'pli pli-commenting-o', 'prevent_inside' => ['pl_slides'], 'child_selector' => '>.pagelayer-owl-stage-outer>.pagelayer-owl-stage>.pagelayer-owl-item', // Make it very specifc 'holder' => '.pagelayer-testimonials-holder', 'html' => '<div class="pagelayer-testimonials-holder pagelayer-owl-holder pagelayer-owl-carousel pagelayer-owl-theme"></div>', 'params' => array( 'elements' => array( 'type' => 'group', 'label' => __pl('testimonial'), 'sc' => PAGELAYER_SC_PREFIX.'_testimonial', 'item_label' => array( 'default' => __pl('testimonial'), 'param' => 'cite' ), 'count' => 3, 'text' => strtr(__pl('add_new_item'), array('%name%' => __pl('testimonial'))) ), ), 'slider_options' => $pagelayer->slider_options, 'arrow_styles' => $pagelayer->slider_arrow_styles, 'pager_styles' => $pagelayer->slider_pager_styles, 'styles' => [ 'slider_options' => __pl('slider_options'), 'arrow_styles' => __pl('arrow_styles'), 'pager_styles' => __pl('pager_styles'), ] )); // Pricing Table pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_pricing', array( 'name' => __pl('pricing_table'), 'group' => 'other', 'has_group' => [ 'section' => 'feature_style', 'prop' => 'elements' ], 'holder' => '.pagelayer-pricing-ul', 'html' => '<div class="pagelayer-pricing-details"> <div if="{{ribbon_text}}" class="pagelayer-pricing-ribbon-container"> <div class="pagelayer-pricing-ribbon"> {{ribbon_text}} </div> </div> <h3 if="{{plan_title}}" class="pagelayer-pricing-type">{{plan_title}}</h3> <h4 if="{{plan_sub_title}}" class="pagelayer-pricing-sub-title">{{plan_sub_title}}</h4> </div> <div class="pagelayer-pricing-rate-section"> <h4 if="{{original_price}}" class="pagelayer-pricing-price pagelayer-pricing-original"> <span class="pagelayer-pricing-rate"> <span if="{{currency}}">{{currency}}</span><span class="pagelayer-pricing-orig-amt">{{original_price}}</span> </span> </h4> <h2 class="pagelayer-pricing-price"> <span if="{{currency}}" class="pagelayer-pricing-currency pagelayer-pricing-currency-{{currency_position}}">{{currency}}</span><span if="{{price}}" class="pagelayer-pricing-rate pagelayer-pricing-amt">{{price}}</span> </h2> <p if="{{period}}" class="pagelayer-pricing-duration">{{period}}</p> </div> <div class="pagelayer-pricing-features"> <ul class="pagelayer-pricing-ul"></ul> <a if="{{price_button}}" href="{{{button_url}}}" class="pagelayer-pricing-btn {{button_type}} pagelayer-ele-link pagelayer-button {{button_size}}">{{button_text}}</a> <p if="{{additional_info}}" class="pagelayer-pricing-additional">{{additional_info}}</p> </div>', 'params' => array( 'plan_title' => array( 'type' => 'text', 'label' => __pl('plan_type'), 'np' => 1, 'default' => 'Standard', 'edit' => '.pagelayer-pricing-type', ), 'title_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-pricing-type' => 'color:{{val}};'], ), 'title_size' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => 'Poppins,20,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-pricing-type' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'content_align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'screen' => 1, 'css' => 'text-align: {{val}};', 'list' => array( 'left' => __pl('left'), '' => __pl('center'), 'right' => __pl('right'), ) ), ), //styles 'header_style' => [ 'header_background_color' => array( 'type' => 'color', 'label' => __pl('bg_color'), 'default' => '#d55400', 'css' => ['{{element}} .pagelayer-pricing-details' => 'background-color:{{val}} !important;'], ), 'header_padding' => array( 'label' => __pl('padding'), 'type' => 'padding', 'screen' => 1, 'default' => '10,10,10,10', 'css' => ['{{element}} .pagelayer-pricing-details' => 'padding: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], ), 'header_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-pricing-details' =>'border-style: {{val}};'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'header_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'default' => '#e5e5e8', 'css' => ['{{element}} .pagelayer-pricing-details' => 'border-color: {{val}};'], 'req' => ['!header_border_type' => ''] ), 'header_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'default' => '0,0,0,0', 'screen' => 1, 'css' => ['{{element}} .pagelayer-pricing-details' =>'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px;'], 'req' => ['!header_border_type' => ''] ), 'header_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-pricing-details' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => ['!header_border_type' => ''] ), ], 'subtitle_style' => [ 'plan_sub_title' => array( 'type' => 'text', 'label' => __pl('subtitle'), 'default' => 'For beginners', 'edit' => '.pagelayer-pricing-sub-title', ), 'subtitle_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-pricing-sub-title' => 'color:{{val}}'], ), 'subtitle_size' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => 'Poppins,18,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-pricing-sub-title' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ], 'price_style' => [ 'price' => array( 'type' => 'text', 'label' => __pl('plan_price'), 'np' => 1, 'default' => '49', 'edit' => '.pagelayer-pricing-amt', ), 'sale' => array( 'type' => 'checkbox', 'label' => __pl('sale'), ), 'original_price' => array( 'type' => 'text', 'label' => __pl('old_price'), 'default' => '100', 'edit' => '.pagelayer-pricing-orig-amt', 'keep_prop' => 1, // Prevent to remove props in gutenburg 'css' => ['{{element}} .pagelayer-pricing-original '=> 'display:inline-block;'], 'req' => array( 'sale' => 'true' ) ), 'price_size' => array( 'label' => __pl('price_size'), 'type' => 'typography', 'default' => 'Poppins,45,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-pricing-price .pagelayer-pricing-rate' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'price_sale_size' => array( 'label' => __pl('old_price_size'), 'type' => 'typography', 'default' => 'Poppins,35,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-pricing-original .pagelayer-pricing-rate' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => array( 'sale' => 'true' ) ), 'price_state' => array( 'type' => 'radio', 'label' => __pl('price_state'), 'default' => 'normal', 'list' => array( 'normal' => __pl('normal'), 'hover' => __pl('hover'), ), ), 'price_line_height' => array( 'label' => __pl('price_line_height'), 'type' => 'slider', 'min' => 0, 'max' => 500, 'default' => 30, 'css' => ['{{element}} .pagelayer-pricing-price .pagelayer-pricing-currency' => 'line-height:{{val}}%;'], ), 'price_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-pricing-price .pagelayer-pricing-rate' => 'color:{{val}}'], 'show' => ['price_state' => 'normal'], ), 'old_price_color' => array( 'type' => 'color', 'label' => __pl('old_price_color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-pricing-price.pagelayer-pricing-original .pagelayer-pricing-rate' => 'color:{{val}}'], 'show' => ['price_state' => 'normal'], 'req' => ['sale' => 'true'], ), 'old_price_line_color' => array( 'type' => 'color', 'label' => __pl('old_price_line_color'), 'default' => '#000000', 'css' => ['{{element}} .pagelayer-pricing-price.pagelayer-pricing-original' => 'color:{{val}}'], 'show' => ['price_state' => 'normal'], 'req' => ['sale' => 'true'], ), 'price_background_color' => array( 'type' => 'color', 'label' => __pl('background_color'), 'default' => '#e98b2b', 'css' => ['{{element}} .pagelayer-pricing-rate-section' => 'background-color:{{val}}'], 'show' => ['price_state' => 'normal'], ), 'price_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-pricing-price .pagelayer-pricing-rate:hover' => 'color:{{val}}'], 'show' => ['price_state' => 'hover'], ), 'old_price_color_hover' => array( 'type' => 'color', 'label' => __pl('old_price_color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-pricing-price.pagelayer-pricing-original .pagelayer-pricing-rate:hover' => 'color:{{val}}'], 'show' => ['price_state' => 'hover'], 'req' => ['sale' => 'true'], ), 'old_price_line_color_hover' => array( 'type' => 'color', 'label' => __pl('old_price_line_color'), 'css' => ['{{element}} .pagelayer-pricing-price.pagelayer-pricing-original:hover' => 'color:{{val}}'], 'show' => ['price_state' => 'hover'], 'req' => ['sale' => 'true'], ), 'price_background_color_hover' => array( 'type' => 'color', 'label' => __pl('background_color'), 'css' => ['{{element}} .pagelayer-pricing-rate-section:hover' => 'background-color:{{val}}'], 'show' => ['price_state' => 'hover'], ), 'price_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-pricing-rate-section' =>'border-style: {{val}};'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], ), 'price_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-pricing-rate-section' => 'border-color: {{val}};'], 'req' => ['!price_border_type' => ''] ), 'price_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'css' => ['{{element}} .pagelayer-pricing-rate-section' =>'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px;'], 'req' => ['!price_border_type' => ''] ), 'price_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'css' => ['{{element}} .pagelayer-pricing-rate-section' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => ['!price_border_type' => ''] ), 'price_margin' => array( 'type' => 'padding', 'label' => __pl('margin'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-pricing-rate-section' => 'margin: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], ), 'price_padding' => array( 'type' => 'padding', 'label' => __pl('padding'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-pricing-rate-section' => 'padding: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], ), ], 'currency_style' => [ 'currency' => array( 'type' => 'text', 'label' => __pl('currency'), 'np' => 1, 'default' => '$', 'edit' => '.pagelayer-pricing-currency', ), 'currency_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-pricing-price .pagelayer-pricing-currency' => 'color:{{val}}'], ), 'currency_size' => array( 'label' => __pl('currency_size'), 'type' => 'typography', 'default' => 'Poppins,35,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-pricing-price .pagelayer-pricing-currency' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'currency_position' => array( 'type' => 'radio', 'label' => __pl('position'), 'default' => 'top', 'list' => array( 'top' => __pl('top'), 'middle' => __pl('middle'), 'bottom' => __pl('bottom'), ), ), ], 'period_style' => [ 'period_inline' => array( 'type' => 'checkbox', 'label' => __pl('inline'), 'css' => ['{{element}} .pagelayer-pricing-duration' => 'display:inline-block;'], ), 'period' => array( 'type' => 'text', 'label' => __pl('period'), 'np' => 1, 'default' => 'Per Month', 'edit' => '.pagelayer-pricing-duration', ), 'period_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-pricing-duration' => 'color:{{val}}'], ), 'period_size' => array( 'type' => 'typography', 'label' => __pl('heading_typo'), 'default' => ',16,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-pricing-duration' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ], 'feature_style' => [ 'elements' => array( 'type' => 'group', 'label' => __pl('features_item'), 'sc' => PAGELAYER_SC_PREFIX.'_list_item', 'item_label' => array( 'default' => __pl('Features Item'), 'param' => 'item' ), 'count' => 3, 'text' =>strtr(__pl('add_new_item'), array('%name%' => __pl('Feature'))), ), 'features_background_color' => array( 'type' => 'color', 'label' => __pl('background_color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-pricing-features' => 'background-color:{{val}}'], ), 'features_text_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#000000', 'css' => ['{{element}} .pagelayer-pricing-ul li span' => 'color:{{val}}'], ), 'features_text_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',18,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-pricing-ul li span' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'pri_features_spacing' => array( 'label' => __pl('space_between'), 'type' => 'slider', 'screen' => 1, 'css' => ['{{element}} .pagelayer-pricing-ul > :not(:last-child) ' => 'margin-bottom:{{val}}px'], ), 'features_padding' => array( 'label' => __pl('padding'), 'type' => 'padding', 'screen' => 1, 'css' => ['{{element}} .pagelayer-pricing-features' => 'padding: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px !important;'], ), ], 'additional_info' => [ 'additional_info' => array( 'type' => 'textarea', 'label' => __pl('additional_info'), 'default' => 'Some Additional Information', 'edit' => '.pagelayer-pricing-additional', ), 'additional_text_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#000000', 'css' => ['{{element}} .pagelayer-pricing-additional' => 'color:{{val}}'], ), 'addition_text_typo' => array( 'type' => 'typography', 'label' => __pl('heading_typo'), 'default' => ',16,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-pricing-additional' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), ], 'button_style' => [ 'price_button' => array( 'type' => 'checkbox', 'label' => __pl('show_btn'), 'default' => 'true', ), 'button_type' => array( 'type' => 'select', 'label' => __pl('type'), 'default' => 'pagelayer-btn-danger', 'list' => array( 'pagelayer-btn-default' => __pl('btn_type_default'), 'pagelayer-btn-primary' => __pl('btn_type_primary'), 'pagelayer-btn-secondary' => __pl('btn_type_secondary'), 'pagelayer-btn-success' => __pl('btn_type_success'), 'pagelayer-btn-info' => __pl('btn_type_info'), 'pagelayer-btn-warning' => __pl('btn_type_warning'), 'pagelayer-btn-danger' => __pl('btn_type_danger'), 'pagelayer-btn-dark' => __pl('btn_type_dark'), 'pagelayer-btn-light' => __pl('btn_type_light'), 'pagelayer-btn-link' => __pl('btn_type_link'), 'pagelayer-btn-custom' => __pl('btn_type_custom') ), 'req' => array( 'price_button' => 'true' ), ), 'button_size' => array( 'type' => 'select', 'label' => __pl('button_size_label'), 'default' => 'pagelayer-btn-mini', 'list' => array( 'pagelayer-btn-mini' => __pl('mini'), 'pagelayer-btn-small' => __pl('small'), 'pagelayer-btn-large' => __pl('large'), 'pagelayer-btn-extra-large' => __pl('extra_large'), 'pagelayer-btn-double-large' => __pl('double_large'), 'pagelayer-btn-custom' => __pl('custom'), ), 'req' => array( 'price_button' => 'true' ) ), 'button_size_custom' => array( 'type' => 'dimension', 'label' => __pl('padding'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-pricing-btn' => 'padding:{{val[0]}}px {{val[1]}}px;'], 'req' => array( 'button_size' => 'pagelayer-btn-custom' ) ), 'button_url' => array( 'type' => 'link', 'label' => __pl('btn_url_label'), 'selector' => '.pagelayer-pricing-btn', 'np' => 1, 'req' => array( 'price_button' => 'true' ), ), 'button_text' => array( 'type' => 'text', 'label' => __pl('button_text_label'), 'np' => 1, 'default' => 'Buy This Plan', 'edit' => '.pagelayer-pricing-btn', 'req' => array( 'price_button' => 'true' ), ), 'btn_typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'css' => [ '{{element}} .pagelayer-pricing-btn' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;', ], ), 'btn_spacing' => array( 'type' => 'slider', 'label' => __pl('spacing'), 'min' => '0', 'max' => '200', 'screen' => 1, 'default' => '10', 'css' => ['{{element}} .pagelayer-pricing-btn' => 'margin-top: {{val}}px;'], 'req' => [ 'price_button' => 'true', ] ), 'btn_state' => array( 'type' => 'radio', 'label' => __pl('button_state'), 'default' => 'normal', 'list' => array( 'normal' => __pl('Normal'), 'hover' => __pl('Hover'), ), 'req' => array( 'price_button' => 'true', 'button_type' => 'pagelayer-btn-custom' ), ), 'button_color' => array( 'type' => 'color', 'label' => __pl('iconbox_button_color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-pricing-btn' => 'color:{{val}};'], 'req' => [ 'price_button' => 'true', 'button_type' => 'pagelayer-btn-custom', ], 'show' => ['btn_state' => 'normal'] ), 'button_bg_color' => array( 'type' => 'color', 'label' => __pl('button_bg_color'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-pricing-btn' => 'background-color:{{val}};'], 'req' => [ 'button_type' => 'pagelayer-btn-custom', ], 'show' => ['btn_state' => 'normal'] ), 'price_btn_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-pricing-btn' =>'border-style: {{val}};'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => ['btn_state' => 'normal'] ), 'price_btn_border_color' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['{{element}} .pagelayer-pricing-btn' => 'border-color: {{val}};'], 'req' => ['!price_btn_border_type' => ''], 'show' => ['btn_state' => 'normal'] ), 'price_btn_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'css' => ['{{element}} .pagelayer-pricing-btn' =>'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px;'], 'req' => ['!price_btn_border_type' => ''], 'show' => ['btn_state' => 'normal'] ), 'price_btn_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'css' => ['{{element}} .pagelayer-pricing-btn' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'show' => ['btn_state' => 'normal'] ), 'pricing_btn_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('btn_hover_delay'), 'min' => 0, 'step' => 100, 'max' => 5000, 'default' => 400, 'css' => ['{{element}} .pagelayer-pricing-btn' => '-webkit-transition: all {{val}}ms; transition: all {{val}}ms;'], 'show' => ['btn_state' => 'hover'], ), 'pricing_btn_color_hover' => array( 'type' => 'color', 'label' => __pl('iconbox_button_color'), 'default' => '', 'css' => ['{{element}} .pagelayer-pricing-btn:hover' => 'color:{{val}};'], 'show' => ['btn_state' => 'hover'], ), 'pricing_btn_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('button_bg_color_hover'), 'default' => '', 'css' => ['{{element}} .pagelayer-pricing-btn:hover' => 'background-color:{{val}};'], 'show' => ['btn_state' => 'hover'], ), 'price_btn_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-pricing-btn:hover' =>'border-style: {{val}};'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => ['btn_state' => 'hover'] ), 'price_btn_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color'), 'css' => ['{{element}} .pagelayer-pricing-btn:hover' => 'border-color: {{val}};'], 'req' => ['!price_btn_border_type_hover' => ''], 'show' => ['btn_state' => 'hover'] ), 'price_btn_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'css' => ['{{element}} .pagelayer-pricing-btn:hover' =>'border-top-width: {{val[0]}}px; border-right-width: {{val[1]}}px; border-bottom-width: {{val[2]}}px; border-left-width: {{val[3]}}px;'], 'req' => ['!price_btn_border_type_hover' => ''], 'show' => ['btn_state' => 'hover'] ), 'price_btn_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'css' => ['{{element}} .pagelayer-pricing-btn:hover' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'show' => ['btn_state' => 'hover'] ), ], 'ribbon_style' => [ 'ribbon' => array( 'type' => 'checkbox', 'label' => __pl('ribbion_display'), ), 'ribbon_text' => array( 'type' => 'text', 'label' => __pl('ribbion_text'), 'default' => 'Popular', 'css' => ['{{element}} .pagelayer-pricing-ribbon'=> 'display:inline-block;'], 'req' => array( 'ribbon' => 'true' ) ), 'ribbon_text_size' => array( 'type' => 'typography', 'label' => __pl('ribbon_text_size'), 'default' => ',16,,500,,,solid,,,,', 'css' => ['{{element}} .pagelayer-pricing-ribbon' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], 'req' => array( 'ribbon' => 'true' ) ), 'ribbon_text_color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-pricing-ribbon' => 'color:{{val}}'], 'req' => array( 'ribbon' => 'true' ) ), 'ribbon_background' => array( 'type' => 'color', 'label' => __pl('background_color'), 'default' => '#fd6129', 'css' => ['{{element}} .pagelayer-pricing-ribbon' => 'background-color:{{val}}'], 'req' => array( 'ribbon' => 'true' ) ), ], 'styles' => [ 'subtitle_style' => __pl('subtitle'), 'header_style' => __pl('header_style'), 'currency_style' => __pl('currency_style'), 'price_style' => __pl('price_style'), 'period_style' => __pl('period_style'), 'feature_style' => __pl('feature_style'), 'button_style' => __pl('button_style'), 'additional_info' => __pl('addition_info'), 'ribbon_style' => __pl('ribbon_style'), ], ) ); // Social Share Group pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_share_grp', array( 'name' => __pl('social_share'), 'group' => 'button', 'has_group' => [ 'section' => 'params', 'prop' => 'elements' ], 'params' => array( 'elements' => array( 'type' => 'group', 'label' => __pl('social_share_grp'), 'sc' => PAGELAYER_SC_PREFIX.'_share', 'item_label' => array( 'default' => __pl('share_item'), 'param' => 'icon' ), 'count' => 3, 'text' => strtr(__pl('add_new_item'), array('%name%' => __pl('share_name'))), ), ), 'layout_style' => [ 'type' => array( 'type' => 'select', 'label' => __pl('type'), //'css' => ['{{element}} .pagelayer-share-content:hover' => 'border-style: {{val}}'], 'addClass' => 'pagelayer-share-type-{{val}}', 'default' => 'icon-label', 'list' => [ 'icon' => __pl('icon'), 'icon-label' => __pl('icon-label'), 'label' => __pl('label'), ], ), 'count' => array( 'type' => 'radio', 'label' => __pl('count_in_line'), 'default' => '', 'screen' => 1, 'css' => ['{{element}} > div' => 'width: calc(100% / {{val}});'], 'list' => array( '' => __pl('auto'), '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', ), 'req' => array( '!type' => 'icon' ) ), 'bg_shape' => array( 'type' => 'select', 'label' => __pl('icon_background_shape'), 'np' => 1, 'default' => 'pagelayer-social-shape-square', //'css' => ['{{element}} i' => 'height:1em; width:1em; position: absolute; top: 50%; left: 50%; transform: translate(-50% , -50%);', //'{{element}} .pagelayer-icon-holder' => 'position: relative; min-height: 1em; min-width: 1em;'], 'addClass' => '{{val}}', 'list' => array( 'pagelayer-social-bg-none' => __pl('icon_shape_none'), 'pagelayer-social-shape-circle' => __pl('icon_shape_circle'), 'pagelayer-social-shape-square' => __pl('icon_shape_square'), 'pagelayer-social-shape-rounded' => __pl('icon_shape_rounded'), 'pagelayer-social-shape-boxed' => __pl('icon_shape_boxed'), 'pagelayer-social-outline-border' => __pl('icon_shape_outline') ), ), /* 'bg_size' => array( 'type' => 'spinner', 'label' => __pl('social_grp_size_label'), 'css' => ['{{element}} .pagelayer-icon-holder' => 'height: calc(1em + {{val}}px); width: calc(1em + {{val}}px);'], 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 10, 'req' => array( '!bg_shape' => '' ) ), */ 'align' => array( 'type' => 'radio', 'label' => __pl('obj_align_label'), 'np' => 1, 'default' => 'center', 'css' => 'text-align: {{val}};', 'screen' => 1, 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right') ) ), /* 'group_layout' => array( 'type' => 'radio', 'label' => __pl('layout'), 'css' => ['{{element}} > div' => 'display: inline-block;'], 'default' => 'horizontal', 'list' => array( '' => __pl('vertical'), 'horizontal' => __pl('horizontal') ) ), */ 'vspace' => array( 'type' => 'spinner', 'label' => __pl('space_between_col'), 'css' => ['{{element}} .pagelayer-share' => 'padding-top: {{val}}px; padding-bottom: {{val}}px;'], 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 2, 'screen' => 1, /* 'req' => array( 'group_layout' => 'horizontal' ) */ ), 'hspace' => array( 'type' => 'spinner', 'label' => __pl('space_between_row'), 'css' => ['{{element}} .pagelayer-share' => 'padding-left: {{val}}px; padding-right: {{val}}px;'], 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 2, 'screen' => 1, /* 'req' => array( 'group_layout' => '' ) */ ), 'height' => array( 'type' => 'slider', 'label' => __pl('height'), 'css' => ['{{element}} .pagelayer-share-content' => 'min-height: {{val}}px;'], 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 35, 'screen' => 1, ), /* 'width' => array( 'type' => 'slider', 'label' => __pl('width'), 'css' => ['{{element}} .pagelayer-share-content' => 'min-width: {{val}}px;'], 'min' => 0, 'step' => 1, 'max' => 100, ), */ ], 'icon_style' => [ 'icon_size' => array( 'type' => 'spinner', 'label' => __pl('social_grp_size_label'), 'css' => ['{{element}} i' => 'font-size: {{val}}px;', '{{element}} .pagelayer-icon-holder' => 'font-size: {{val}}px;'], 'min' => 1, 'step' => 1, 'max' => 500, 'default' => 25, 'screen' => 1, ), 'icon_space' => array( 'type' => 'spinner', 'label' => __pl('space_around'), 'css' => ['{{element}} .pagelayer-icon-holder' => 'padding-left: calc(0.5em + {{val}}px); padding-right: calc(0.5em + {{val}}px);'], 'min' => 0, 'step' => 1, 'max' => 100, 'default' => 5, 'screen' => 1, ), 'color_scheme' => array( 'type' => 'select', 'label' => __pl('color'), 'default' => 'pagelayer-scheme-official', 'addClass' => '{{val}}', 'list' => array( '' => __pl('custom'), 'pagelayer-scheme-official' => __pl('official') ) ), 'social_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'default' => '', //'no_val' => 1,// Dont set any value to element 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ) ), 'icon_color' => array( 'type' => 'color', 'label' => __pl('social_color_label'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-share-buttons i' => 'color: {{val}} !important;'], 'req' => array( 'color_scheme' => '' ), 'show' => ['social_hover' => ''] ), 'icon_bg_color' => array( 'type' => 'color', 'label' => __pl('social_bg_color_label'), 'default' => '#0986c0', 'css' => ['{{element}} .pagelayer-share-content' => 'background-color: {{val}} !important;'], 'req' => array( '!bg_shape' => '', 'color_scheme' => '' ), 'show' => ['social_hover' => ''] ), 'icon_border_type' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-share-content' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => ['social_hover' => ''] ), 'icon_border_color' => array( 'type' => 'color', 'label' => __pl('service_box_icon_border_color_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-share-content' => 'border-color: {{val}} !important;'], 'req' => array( '!icon_border_type' => '', 'color_scheme' => '' ), 'show' => ['social_hover' => ''] ), 'icon_border_width' => array( 'type' => 'padding', 'label' => __pl('border_width'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-share-content' => 'border-top-width: {{val[0]}}px !important; border-right-width: {{val[1]}}px !important; border-bottom-width: {{val[2]}}px !important; border-left-width: {{val[3]}}px !important'], 'req' => [ '!icon_border_type' => '' ], 'show' => ['social_hover' => ''] ), 'icon_border_radius' => array( 'type' => 'padding', 'label' => __pl('border_radius'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-share-content' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!icon_border_type' => '' ), 'show' => ['social_hover' => ''] ), 'social_hover_delay' => array( 'type' => 'spinner', 'label' => __pl('btn_hover_delay_label'), 'desc' => __pl('btn_hover_delay_desc'), 'min' => 0, 'step' => 100, 'max' => 5000, 'default' => 400, 'css' => ['{{element}} .pagelayer-share-content' => '-webkit-transition: all {{val}}ms; transition: all {{val}}ms;', '{{element}} .pagelayer-share-content i' => '-webkit-transition: all {{val}}ms; transition: all {{val}}ms;'], 'show' => array( 'social_hover' => 'hover' ), ), 'icon_color_hover' => array( 'type' => 'color', 'label' => __pl('social_color_label'), 'css' => ['{{element}} .pagelayer-share-buttons:hover i' => 'color: {{val}} !important;'], 'req' => array( 'color_scheme' => '' ), 'show' => ['social_hover' => 'hover'] ), 'icon_bg_color_hover' => array( 'type' => 'color', 'label' => __pl('social_bg_color_label'), 'css' => ['{{element}} .pagelayer-share-content:hover' => 'background-color: {{val}} !important;'], 'req' => array( '!bg_shape' => '', 'color_scheme' => '' ), 'show' => ['social_hover' => 'hover'] ), 'icon_border_type_hover' => array( 'type' => 'select', 'label' => __pl('border_type'), 'css' => ['{{element}} .pagelayer-share-content:hover' => 'border-style: {{val}}'], 'list' => [ '' => __pl('none'), 'solid' => __pl('solid'), 'double' => __pl('double'), 'dotted' => __pl('dotted'), 'dashed' => __pl('dashed'), 'groove' => __pl('groove'), ], 'show' => ['social_hover' => 'hover'] ), 'icon_border_color_hover' => array( 'type' => 'color', 'label' => __pl('border_color_hover_label'), 'default' => '#42414f', 'css' => ['{{element}} .pagelayer-share-content:hover' => 'border-color: {{val}} !important;'], 'req' => array( '!icon_border_type_hover' => '', 'color_scheme' => '' ), 'show' => ['social_hover' => 'hover'] ), 'icon_border_width_hover' => array( 'type' => 'padding', 'label' => __pl('border_width_hover'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-share-content:hover' => 'border-top-width: {{val[0]}}px !important; border-right-width: {{val[1]}}px !important; border-bottom-width: {{val[2]}}px !important; border-left-width: {{val[3]}}px !important'], 'req' => [ '!icon_border_type_hover' => '' ], 'show' => ['social_hover' => 'hover'] ), 'icon_border_radius_hover' => array( 'type' => 'padding', 'label' => __pl('border_radius_hover'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-share-content:hover' => 'border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px; -webkit-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;-moz-border-radius: {{val[0]}}px {{val[1]}}px {{val[2]}}px {{val[3]}}px;'], 'req' => array( '!icon_border_type_hover' => '' ), 'show' => ['social_hover' => 'hover'] ), ], 'label_style' => [ 'hide_name' => array( 'type' => 'checkbox', 'label' => __pl('hide_name'), 'screen' => 1, 'css' => ['{{element}} .pagelayer-icon-name span' => 'display: none;'], ), 'name_typo' => array( 'type' => 'typography', 'label' => __pl('quote_content_typo'), 'default' => ',15,,,,,solid,,,,', 'css' => ['{{element}} .pagelayer-icon-name' => 'font-family: {{val[0]}}; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'label_hover' => array( 'type' => 'radio', 'label' => __pl('state'), 'list' => array( '' => __pl('normal'), 'hover' => __pl('hover'), ) ), 'label_color' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-icon-name-span' => 'color: {{val}} !important;'], 'show' => ['label_hover' => ''] ), 'label_color_hover' => array( 'type' => 'color', 'label' => __pl('color'), 'css' => ['{{element}} .pagelayer-icon-name-span:hover' => 'color: {{val}} !important;'], 'show' => ['label_hover' => 'hover'] ) ], 'styles' => [ 'layout_style' => __pl('layout_style'), 'icon_style' => __pl('icon_style'), 'label_style' => __pl('label_style'), ] ) ); // Social Share Button pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_share', array( 'name' => __pl('icon'), 'group' => 'button', 'not_visible' => 1, 'parent' => [PAGELAYER_SC_PREFIX.'_share_grp'], 'html' => ' <a class="pagelayer-ele-link" title="{{icon}}" href="{{social_url}}"> <div class="pagelayer-share-content"> <div class="pagelayer-icon-holder pagelayer-share-buttons"> <i class="pagelayer-social-fa {{icon}}"></i> </div> <div class="pagelayer-icon-name"> <span class="pagelayer-icon-name-span">{{icon_label}}</span> </div> </div> </a>', 'params' => array( 'icon' => array( 'type' => 'icon', 'label' => __pl('list_icon_label'), 'default' => 'fab fa-facebook-square', 'addAttr' => ['{{element}} .pagelayer-share-content' => 'data-icon="{{icon}}"'], 'list' => ['facebook', 'facebook-f', 'facebook-square', 'facebook-messenger', 'twitter', 'twitter-square','x-twitter', 'x-twitter-square', 'google-plus', 'google-plus-square', 'google-plus-g', 'instagram', 'linkedin', 'linkedin-in', 'pinterest', 'pinterest-p', 'pinterest-square', 'reddit-alien', 'reddit-square', 'reddit', 'skype', 'stumbleupon', 'stumbleupon-circle', 'telegram', 'telegram-plane', 'tumblr', 'tumblr-square', 'vk', 'weibo', 'whatsapp', 'whatsapp-square', 'wordpress', 'wordpress-simple', 'xing', 'xing-square', 'delicious', 'dribbble', 'dribbble-square', 'snapchat-ghost','get-pocket', 'envelope', 'envelope-open', 'envelope-o'], ), 'custom_profile' => array( 'type' => 'text', 'label' => __pl('custom_profile'), 'req' => ['icon' => ['fab fa-instagram', 'fab fa-dribbble', 'fab fa-dribbble-square']] ), 'text' => array( 'type' => 'text', 'label' => __pl('custom_label_text'), 'edit' => '.pagelayer-icon-name-span', 'np' => 1, ), 'target' => array( 'label' => __pl('open_link_in_new_window'), 'type' => 'checkbox', 'addAttr' => ['{{element}} a' => 'target="_blank"'], 'np' => 1, ), ) ) ); // Animated heading pagelayer_freemium_shortcode(PAGELAYER_SC_PREFIX.'_anim_heading', array( 'name' => __pl('animated_heading'), 'group' => 'text', 'innerHTML' => 'text', 'html' => '<a if-ext="{{link}}" href="{{link}}"> <div class="pagelayer-aheading-holder {{rotate_req}} {{animations}}"> <div if="{{text}}" class="pagelayer-animated-heading pagelayer-animated-title">{{text}}</div> {{rotate_html}} <div if="{{after_text}}" class="pagelayer-animated-heading">{{after_text}}</div> <div class="pagelayer-blobs_1"></div><div class="pagelayer-blobs_2"></div><div class="pagelayer-blobs_3"></div><div class="pagelayer-blobs_4"></div><div class="pagelayer-blobs_5"></div><div class="pagelayer-blobs_6"></div><div class="pagelayer-blobs_7"></div> </div> </a>', 'params' => array( 'type' => array( 'type' => 'select', 'label' => __pl('type'), 'default' => 'effects', 'addClass' => 'pagelayer-heading-{{val}}', 'list' => array( 'effects' => __pl('effects'), 'rotating' => __pl('rotating'), ), ), 'effects' => array( 'type' => 'select', 'label' => __pl('effects'), 'default' => 'blobs', 'addClass' => 'pagelayer-hEffect-{{val}}', 'list' => array( 'none' => __pl('none'), 'blobs' => __pl('blobs'), 'stroke' => __pl('stroke'), 'shadow' => __pl('shadow'), ), 'req' => [ 'type' => 'effects' ] ), 'animations' => array( 'type' => 'select', 'label' => __pl('effects'), 'default' => 'pagelayer-aheading-rotate1', 'list' => array( 'pagelayer-aheading-rotate1' => __pl('rotate-1'), 'pagelayer-aheading-rotate2' => __pl('rotate-2'), 'pagelayer-aheading-rotate3' => __pl('rotate-3'), 'pagelayer-aheading-loading-bar' => __pl('loading-bar'), 'pagelayer-aheading-slide' => __pl('slide'), 'pagelayer-aheading-clip' => __pl('clip'), 'pagelayer-aheading-zoom' => __pl('zoom'), 'pagelayer-aheading-scale' => __pl('scale'), 'pagelayer-aheading-push' => __pl('push'), ), 'req' => [ 'type' => 'rotating' ] ), 'hide_clip' => array( 'label' => __pl('clip_hide'), 'type' => 'checkbox', 'css' => ['{{element}} .pagelayer-words-wrapper:after' => 'display:none'], 'req' => [ 'animations' => 'pagelayer-aheading-clip' ] ), 'align' => array( 'type' => 'radio', 'label' => __pl('alignment'), 'np' => 1, 'default' => 'center', 'screen' => 1, 'css' => 'text-align: {{val}};', 'list' => array( 'left' => __pl('left'), 'center' => __pl('center'), 'right' => __pl('right'), ) ), ), 'title_style' => [ 'text' => array( 'type' => 'text', 'label' => __pl('title'), 'np' => 1, 'default' => __pl('animated_heading'), 'edit' => '.pagelayer-animated-title', 'e' => [ 'v', 'f', 'r'] ), 'rotate_text' => array( 'type' => 'textarea', 'label' => __pl('rotate_text'), 'np' => 1, 'default' => __pl('rotate_default'), 'req' => [ 'type' => 'rotating' ] ), 'after_text' => array( 'type' => 'text', 'label' => __pl('after_text'), 'np' => 1, 'req' => [ 'type' => 'rotating' ] ), 'typo' => array( 'type' => 'typography', 'label' => __pl('typography'), 'default' => ',40,,700,,,solid,,,,', 'css' => ['{{element}} .pagelayer-animated-heading' => 'font-family: {{val[0]}} !important; font-size: {{val[1]}}px !important; font-style: {{val[2]}} !important; font-weight: {{val[3]}} !important; font-variant: {{val[4]}} !important; text-decoration-line: {{val[5]}} !important; text-decoration-style: {{val[6]}} !important; line-height: {{val[7]}}em !important; text-transform: {{val[8]}} !important; letter-spacing: {{val[9]}}px !important; word-spacing: {{val[10]}}px !important;'], ), 'color_type' => array( 'type' => 'radio', 'label' => __pl(''), 'np' => 1, 'default' => 'color', 'list' => array( 'color' => __pl('color'), 'gradient' => __pl('gradient'), ), ), 'color' => array( 'type' => 'color', 'label' => __pl('color'), 'default' => '#A236FA', 'css' => [ '{{element}} .pagelayer-animated-heading' => 'background:{{val}}; -webkit-background-clip: text;', '{{element}}.pagelayer-hEffect-shadow .pagelayer-animated-heading' => 'color:{{val}};', '{{element}} .pagelayer-rotating-text *' => 'background:{{val}}; -webkit-background-clip: text;', '{{element}} .pagelayer-aheading-loading-bar .pagelayer-words-wrapper:after' => 'background:{{val}};', '{{element}} .pagelayer-aheading-clip .pagelayer-words-wrapper:after' => 'background:{{val}};' ], 'req' => ['color_type' => 'color'] ), 'gradient' => array( 'type' => 'gradient', 'label' => '', 'default' => '150,#44d3f6,23,#72e584,45,#2ca4eb,100', 'css' => [ '{{element}} .pagelayer-animated-heading' => 'background: linear-gradient({{val[0]}}deg, {{val[1]}} {{val[2]}}%, {{val[3]}} {{val[4]}}%, {{val[5]}} {{val[6]}}%); -webkit-background-clip: text;', '{{element}} .pagelayer-rotating-text *' => 'background: linear-gradient({{val[0]}}deg, {{val[1]}} {{val[2]}}%, {{val[3]}} {{val[4]}}%, {{val[5]}} {{val[6]}}%); -webkit-background-clip: text;', '{{element}} .pagelayer-aheading-loading-bar .pagelayer-words-wrapper:after' => 'background: linear-gradient({{val[0]}}deg, {{val[1]}} {{val[2]}}%, {{val[3]}} {{val[4]}}%, {{val[5]}} {{val[6]}}%);', '{{element}} .pagelayer-aheading-clip .pagelayer-words-wrapper:after' => 'background: linear-gradient({{val[0]}}deg, {{val[1]}} {{val[2]}}%, {{val[3]}} {{val[4]}}%, {{val[5]}} {{val[6]}}%);' ], 'req' => [ 'color_type' => 'gradient', '!effects' => 'shadow' ] ), ], 'misc_style' => [ 'blob_1' => array( 'type' => 'color', 'label' => __pl('blob_1_color'), 'default' => '#ff1493', 'css' => ['{{element}} .pagelayer-blobs_1' => 'background:{{val}}'], 'req' => [ 'effects' => 'blobs', 'type' => 'effects' ] ), 'blob_2' => array( 'type' => 'color', 'label' => __pl('blob_2_color'), 'default' => '#ff4500', 'css' => ['{{element}} .pagelayer-blobs_2' => 'background:{{val}}'], 'req' => [ 'effects' => 'blobs', 'type' => 'effects' ] ), 'blob_3' => array( 'type' => 'color', 'label' => __pl('blob_3_color'), 'default' => '#00ff00', 'css' => ['{{element}} .pagelayer-blobs_3' => 'background:{{val}}'], 'req' => [ 'effects' => 'blobs', 'type' => 'effects' ] ), 'blob_4' => array( 'type' => 'color', 'label' => __pl('blob_4_color'), 'default' => '#ff0000', 'css' => ['{{element}} .pagelayer-blobs_4' => 'background:{{val}}'], 'req' => [ 'effects' => 'blobs', 'type' => 'effects' ] ), 'blob_5' => array( 'type' => 'color', 'label' => __pl('blob_5_color'), 'default' => '#ffff00', 'css' => ['{{element}} .pagelayer-blobs_5' => 'background:{{val}}'], 'req' => [ 'effects' => 'blobs', 'type' => 'effects' ] ), 'blob_6' => array( 'type' => 'color', 'label' => __pl('blob_6_color'), 'default' => '#00ffff', 'css' => ['{{element}} .pagelayer-blobs_6' => 'background:{{val}}'], 'req' => [ 'effects' => 'blobs', 'type' => 'effects' ] ), 'blob_7' => array( 'type' => 'color', 'label' => __pl('blob_7_color'), 'default' => '#ff8c00', 'css' => ['{{element}} .pagelayer-blobs_7' => 'background:{{val}}'], 'req' => [ 'effects' => 'blobs', 'type' => 'effects' ] ), 'stroke' => array( 'type' => 'slider', 'label' => __pl('stroke_thickness'), 'min' => 1, 'step' => 1, 'max' => 50, 'default' => 5, 'screen' => 1, 'css' => ['{{element}} .pagelayer-animated-heading' => '-webkit-text-stroke: {{val}}px transparent;'], 'req' => [ 'effects' => 'stroke' ] ), 'stroke_color' => array( 'type' => 'color', 'label' => __pl('stroke_color'), 'default' => '#ffffff', 'css' => ['{{element}} .pagelayer-animated-heading' => 'color:{{val}}'], 'req' => [ 'effects' => 'stroke' ] ), 'shadow_color' => array( 'type' => 'shadow', 'label' => __pl('shadow'), 'default' => '2,2,,#999999', 'screen' => 1, 'css' => ['{{element}} .pagelayer-animated-heading' => 'text-shadow: {{val[0]}}px {{val[1]}}px #fff, calc({{val[0]}}px * 2) calc({{val[1]}}px * 2) {{val[3]}};'], 'req' => [ 'type' => 'effects', 'effects' => 'shadow' ] ), 'rotate_color' => array( 'type' => 'color', 'label' => __pl('rotate_color'), 'css' => [ '{{element}} .pagelayer-rotating-text *' => 'background:{{val}}; -webkit-background-clip: text;', '{{element}} .pagelayer-aheading-loading-bar .pagelayer-words-wrapper:after' => 'background:{{val}};', '{{element}} .pagelayer-aheading-clip .pagelayer-words-wrapper:after' => 'background:{{val}};' ], 'req' => ['type' => 'rotating'] ), ], 'styles' => [ 'title_style' => __pl('title_style'), 'misc_style' => __pl('misc_style'), ] ) ); gravatar.php 0000644 00000006172 15104540611 0007067 0 ustar 00 <?php namespace SpeedyCache; if(!defined('ABSPATH')){ die('Hacking Attempt'); } class Gravatar{ // Gets gravatar data static function get_avatar_data($args, $id_or_email){ if(empty($args) || empty($args['found_avatar'])){ return $args; } if(empty($args['url'])){ return $args; } // Path to Gravatars $path = \SpeedyCache\Util::cache_path('gravatars'); if(!is_dir($path)){ mkdir($path, 0755, true); touch($path . 'index.html'); } $email_hash = self::get_email_hash($id_or_email); if(empty($email_hash)){ $email_hash = 'default'; } $file_name = $email_hash . 'x' . $args['size'] . '.jpg'; $file = $path . $file_name; if(file_exists($file)){ $url = self::convert_path_to_link($path) . $file_name; $args['url'] = esc_url($url); return $args; } $res = wp_remote_get($args['url']); if(empty($res) || is_wp_error($res)){ return $args; } if(empty($res['body'])){ return $args; } // If we fail to write return the same URL; if(!file_put_contents($file, $res['body'])){ return $args; } $url = self::convert_path_to_link($path) . $file_name; $args['url'] = esc_url($url); return $args; } // Gets the Email hash which is used in the URL. static function get_email_hash($id_or_email){ if(is_numeric($id_or_email)){ $user = get_user_by('id', $id_or_email); if(empty($user) || !is_a($user, 'WP_User')){ return false; } } elseif(is_a($id_or_email, 'WP_User')){ $user = $id_or_email; } elseif(is_a($id_or_email, 'WP_Post')){ $user = get_user_by('id', (int) $id_or_email->post_author); } elseif(is_a($id_or_email, 'WP_Comment')){ if(!empty($id_or_email->user_id)){ $user = get_user_by('id', (int) $id_or_email->user_id); } if(empty($user) && !empty($id_or_email->comment_author_email)){ $id_or_email = $id_or_email->comment_author_email; } if(is_a($id_or_email, 'WP_Comment')){ return false; } } if(!empty($user) && is_a($user, 'WP_User')){ $id_or_email = $user->user_email; } // We need an email which should be a string if something else is being passed then just return if(!is_string($id_or_email)){ return false; } $email_hash = md5(strtolower(trim($id_or_email))); return $email_hash; } // Deletes all the gravatar stored static function delete(){ $path = \SpeedyCache\Util::cache_path('gravatars'); if(!file_exists($path)){ return; } $files = scandir($path); if(empty($files)){ return __('No file present to delete', 'speedycache'); } foreach($files as $file){ // We dont want to delete index.html or any directory. if(file_exists($path . $file) && !is_dir($path . $file) && $file != 'index.html'){ @unlink($path . $file); } } return __('Gravatar files deleted', 'speedycache'); } static function convert_path_to_link($path){ preg_match('/\/cache\/speedycache\/.+/', $path, $out); $prefix_link = str_replace(array('http:', 'https:'), '', content_url()); return $prefix_link . $out[0]; } } util.php 0000644 00000020605 15104540611 0006232 0 ustar 00 <?php namespace SpeedyCache; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Util{ static function sanitize_get($name, $default = ''){ if(empty($_GET[$name])){ return $default; } if(is_array($_GET[$name]) || is_object($_GET[$name])){ return map_deep(wp_unslash($_GET[$name]), 'sanitize_text_field'); } return sanitize_text_field(wp_unslash($_GET[$name])); } static function sanitize_post($name, $default = ''){ if(empty($_POST[$name])){ return $default; } if(is_array($_POST[$name]) || is_object($_POST[$name])){ return map_deep(wp_unslash($_POST[$name]), 'sanitize_text_field'); } return sanitize_text_field(wp_unslash($_POST[$name])); } static function sanitize_request($name, $default = ''){ if(empty($_REQUEST[$name])){ return $default; } if(is_array($_REQUEST[$name]) || is_object($_REQUEST[$name])){ return map_deep(wp_unslash($_REQUEST[$name]), 'sanitize_text_field'); } return sanitize_text_field(wp_unslash($_REQUEST[$name])); } static function sanitize_server($name, $default = ''){ if(empty($_SERVER[$name])){ return $default; } return sanitize_text_field(wp_unslash($_SERVER[$name])); } static function pagespeed_color($score){ // The structure of this array is 0 => [Stroke Color, Background Color, Text Color] $score_color_map = array( 0 => ['#c00', '#c003', '#c00'], // Red 50 => ['#fa3', '#ffa50036', '#fa3'],// Orange 90 => ['#0c6', '#00cc663b', '#080']// Green ); if($score >= 0 && $score < 50){ return $score_color_map[0]; } if($score >= 50 && $score < 90){ return $score_color_map[50]; } return $score_color_map[90]; } static function url_to_path($url){ $url = preg_replace('/\?.*/', '', $url); // Removing any query string $dir_slug = str_replace(site_url(), '', $url); if(defined('SITEPAD')){ global $sitepad; $file_path = $sitepad['path'] . '/' .trim($dir_slug, '/'); } else { $file_path = ABSPATH . trim($dir_slug, '/'); } return wp_normalize_path($file_path); } static function path_to_url($path){ $path = wp_normalize_path($path); if(defined('SITEPAD')){ global $sitepad; $abs_path = wp_normalize_path($sitepad['path']); } else { $abs_path = wp_normalize_path(ABSPATH); } $path = str_replace($abs_path, '', $path); $url = site_url() . '/' . $path; return $url; } static function cache_path($loc = ''){ if((defined('WP_CLI') && WP_CLI) || empty($_SERVER['HTTP_HOST'])){ global $blog_id; $url = get_option('home'); if(!empty($blog_id) && is_multisite()){ switch_to_blog($blog_id); $url = get_option('home'); restore_current_blog(); } $url = wp_parse_url($url); $host = $url['host']; return trailingslashit(SPEEDYCACHE_CACHE_DIR . '/'.$host.'/'.$loc); } $host = sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST'])); return trailingslashit(SPEEDYCACHE_CACHE_DIR . '/'.$host.'/'.$loc); } // Creates a config file based on the URL of the website static function set_config_file(){ global $speedycache; $export_config['settings']['status'] = !empty($speedycache->options['status']); $export_config['settings']['gzip'] = !empty($speedycache->options['gzip']); $export_config['settings']['logged_in_user'] = !empty($speedycache->options['logged_in_user']); $export_config['settings']['mobile_theme'] = !empty($speedycache->options['mobile_theme']); $export_config['settings']['mobile'] = !empty($speedycache->options['mobile']); //$export_config['user_agents'] = speedycache_get_excluded_useragent(); $export_config['excludes'] = get_option('speedycache_exclude', []); $config = var_export($export_config, true); $url = get_site_url(); $file = parse_url(untrailingslashit($url)); $file['path'] = (!empty($file['path'])) ? str_replace( '/', '.', untrailingslashit($file['path'])) : ''; $config_file_path = WP_CONTENT_DIR .'/speedycache-config/'. strtolower($file['host']) . $file['path'] . '.php'; if(!file_exists(WP_CONTENT_DIR .'/speedycache-config/')){ if(mkdir(WP_CONTENT_DIR .'/speedycache-config/', 0755, true)){ touch(WP_CONTENT_DIR .'/speedycache-config/index.html'); } } $config_temp = file_get_contents(SPEEDYCACHE_DIR . '/assets/config-template.php'); $config_content = str_replace("'REPLACE_CONFIG'", $config, $config_temp); file_put_contents($config_file_path, $config_content); } static function dir_size($dir){ $size = 0; foreach(glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $file){ $size += is_file($file) ? filesize($file) : self::dir_size($file); } return $size; } static function cache_lifespan(){ global $speedycache; $schedule_time = 0; if(empty($speedycache->options['purge_interval'])){ return $schedule_time; } if(!empty($speedycache->options['purge_enable_exact_time']) && !empty($speedycache->options['purge_exact_time'])){ $schedule_time = DAY_IN_SECONDS; } elseif($speedycache->options['purge_interval_unit'] == 'hours'){ $schedule_time = HOUR_IN_SECONDS * $speedycache->options['purge_interval']; } elseif($speedycache->options['purge_interval_unit'] == 'days'){ $schedule_time = DAY_IN_SECONDS * $speedycache->options['purge_interval']; } return (int) $schedule_time; } static function lifespan_cron(){ global $speedycache; if(empty($speedycache->options['purge_interval'])){ return; } if(!empty(wp_next_scheduled('speedycache_purge_cache'))){ return; } if(!empty($speedycache->options['purge_enable_exact_time']) && !empty($speedycache->options['purge_exact_time'])){ // Getting the exact time of the user's timezone by using the offset and strtotime return gtm time. $future_timestamp = strtotime('today '.$speedycache->options['purge_exact_time']); $offset = get_option('gmt_offset') * HOUR_IN_SECONDS; $current_time = time() - $offset; $future_timestamp -= $offset; if(time() > $future_timestamp){ $future_timestamp = strtotime('tomorrow '.$speedycache->options['purge_exact_time']); $future_timestamp -= $offset; } $schedule_time = $future_timestamp - time(); } elseif($speedycache->options['purge_interval_unit'] == 'hours'){ $schedule_time = HOUR_IN_SECONDS * $speedycache->options['purge_interval']; } elseif($speedycache->options['purge_interval_unit'] == 'days'){ $schedule_time = DAY_IN_SECONDS * $speedycache->options['purge_interval']; } wp_schedule_event(time() + $schedule_time, 'speedycache_expired_cache_schedule', 'speedycache_purge_cache'); } static function preload_cron(){ global $speedycache; if(empty($speedycache->options['preload_interval']) || empty($speedycache->options['preload'])){ return; } if(wp_next_scheduled('speedycache_preload')){ return; } $schedule_time = HOUR_IN_SECONDS * (int) $speedycache->options['preload_interval']; wp_schedule_event(time() + $schedule_time, 'speedycache_preload_cache_schedule', 'speedycache_preload'); } static function custom_expiry_cron($schedules){ $cache_interval = self::cache_lifespan(); if(empty($cache_interval)){ return $schedules; } $schedules['speedycache_expired_cache_schedule'] = [ 'interval' => $cache_interval, 'display' => __('SpeedyCache Cache Lifespan cron', 'speedycache'), ]; return $schedules; } static function custom_preload_cron($schedules){ global $speedycache; if(empty($speedycache->options['preload_interval'])){ return $schedules; } $cache_interval = $speedycache->options['preload_interval'] * HOUR_IN_SECONDS; if(empty($cache_interval)){ return $schedules; } $schedules['speedycache_preload_cache_schedule'] = [ 'interval' => $cache_interval, 'display' => __('SpeedyCache Cache Preload cron', 'speedycache'), ]; return $schedules; } // Deletes binaries static function delete_cwebp(){ $binary_dir = wp_upload_dir()['basedir'] .'/speedycache-binary'; if(!file_exists($binary_dir)){ return; } $binaries = @scandir($binary_dir); $binaries = array_diff($binaries, ['.', '..']); if(empty($binaries)){ @rmdir($binary_dir); return; } foreach($binaries as $binary){ if(file_exists($binary_dir.'/'.$binary)){ @unlink($binary_dir.'/'.$binary); } } } } delete.php 0000644 00000033135 15104540611 0006521 0 ustar 00 <?php namespace SpeedyCache; if(!defined('ABSPATH')){ die('HACKING ATTEMPT'); } use \SpeedyCache\Util; class Delete{ static $cache_lifespan = 0; static function run($actions){ global $speedycache; // Even if the actions are empty, the cache will be deleted. self::all_cache(); self::purge_varnish(); \SpeedyCache\CDN::purge(); delete_option('speedycache_html_size'); delete_option('speedycache_assets_size'); if(empty($actions)){ return; } if(!empty($actions['minified'])){ self::minified(); } if(!empty($actions['font'])){ self::local_fonts(); } if(!empty($actions['gravatars'])){ self::gravatar(); } if(!empty($actions['domain'])){ self::all_for_domain(); } if(!empty($actions['preload'])){ if(!empty($speedycache->options['preload'])){ \SpeedyCache\Preload::build_preload_list(); } } } /** * Deletes cache of a single page * @param int $post_id */ static function cache($post_id = false){ global $speedycache; if(!isset($post_id) || $post_id === FALSE || !is_numeric($post_id)){ return; } $link = get_permalink($post_id); // If its 0 then it's a homepage if($post_id == 0){ $link = home_url(); } if(empty($link)){ return; } self::url($link); if(class_exists('\SpeedyCache\Logs')){ \SpeedyCache\Logs::log('delete'); \SpeedyCache\Logs::action(); } if(!empty($speedycache->options['preload'])){ \SpeedyCache\Preload::url($link); } delete_option('speedycache_html_size'); delete_option('speedycache_assets_size'); } /** * Deletes cache of a URL * Parses and converts a URL to cache path and purges it * @param array|string $urls */ static function url($urls){ global $speedycache; $urls = (array) $urls; $cache_paths = []; foreach($urls as $url){ $parsed_url = wp_parse_url($url); $path = !empty($parsed_url['path']) ? $parsed_url['path'] : ''; // Path to be used in glob so that we can get all the variations of file created like for language or currency $file = (empty($path) || $path == '/') ? 'index*html' : trim($path, '/') . '/index*html'; // Cache path for desktop cache $all_path = glob(Util::cache_path('all') . $file); $gz_path = glob(Util::cache_path('all') . $file .'.gz'); $all_path = array_merge( is_array($all_path) ? $all_path : [], is_array($gz_path) ? $gz_path : [] ); if(!empty($all_path)){ $cache_paths = array_merge($cache_paths, $all_path); } // Cache path for Mobile cache if(!empty($speedycache->options['mobile_theme'])){ $mobile_path = glob(Util::cache_path('mobile-cache') . $file); if(!empty($mobile_path)){ $cache_paths = array_merge($cache_paths, $mobile_path); } } } foreach($cache_paths as $cache_path){ if(!file_exists($cache_path)){ continue; } if(is_dir($cache_path)){ self::rmdir($cache_path); continue; } unlink($cache_path); } } // Delete cache of whole site static function all_cache(){ // Our cache is saved in 2 file, /all and /mobile-cache // We also need to delete Critical CSS too as it gets injected in the HTML $deletable_dirs = ['all', 'mobile-cache', 'critical-css']; foreach($deletable_dirs as $dir){ $path = Util::cache_path($dir); self::rmdir($path); } if(class_exists('\SpeedyCache\Logs')){ \SpeedyCache\Logs::log('delete'); \SpeedyCache\Logs::action(); } } // Delete minified and Critical css content. static function minified(){ $assets_cache_path = Util::cache_path('assets'); if(!file_exists($assets_cache_path)){ return; } self::rmdir($assets_cache_path); if(class_exists('\SpeedyCache\Logs')){ \SpeedyCache\Logs::log('delete'); \SpeedyCache\Logs::action(); } } // Delete local fonts static function local_fonts(){ $fonts_path = Util::cache_path('fonts'); if(!file_exists($fonts_path)){ return; } self::rmdir($fonts_path); if(class_exists('\SpeedyCache\Logs')){ \SpeedyCache\Logs::log('delete'); \SpeedyCache\Logs::action(); } } static function gravatar(){ $gravatar_path = Util::cache_path('gravatars'); if(!file_exists($gravatar_path)){ return; } self::rmdir($gravatar_path); if(class_exists('\SpeedyCache\Logs')){ \SpeedyCache\Logs::log('delete'); \SpeedyCache\Logs::action(); } } // Delete everything of the current domain, like minfied, cache, gravatar and fonts. static function all_for_domain(){ } static function rmdir($dir){ if(!file_exists($dir)){ return; } $files = array_diff(scandir($dir), ['..', '.']); foreach($files as $file){ if(is_dir($dir.'/'.$file)){ self::rmdir($dir.'/'.$file); continue; } unlink($dir.'/'.$file); } rmdir($dir); } static function purge_varnish(){ global $speedycache; if(empty($speedycache->options['purge_varnish'])){ return; } $server = !empty($speedycache->options['varniship']) ? $speedycache->options['varniship'] : '127.0.0.1'; $url = home_url(); $url = parse_url($url); if($url == FALSE){ return; } $sslverify = ($url['scheme'] === 'https') ? true : false; $request_url = $url['scheme'] .'://'. $server . '/.*'; $request_args = array( 'method' => 'PURGE', 'headers' => array( 'Host' => $url['host'], ), 'sslverify' => $sslverify, ); $res = wp_remote_request($request_url, $request_args); if(is_wp_error($res)){ $msg = $res->get_error_message(); return array($msg, 'error'); } if(is_array($res) && !empty($res['response']['code']) && '200' != $res['response']['code']){ $msg = 'Something Went Wrong Unable to Purge Varnish'; if(empty($res['response']['code']) && '501' == $res['response']['code']){ $msg = 'Your server dosen\'t allows PURGE request'; if(!empty($res['headers']['allow'])){ $msg .= 'The accepted HTTP methods are' . $res['headers']['allow']; } $msg = __('Please contact your hosting provider if, Varnish is enabled and still getting this error', 'speedycache'); } return array($msg, 'error'); } if(class_exists('\SpeedyCache\Logs')){ \SpeedyCache\Logs::log('delete'); \SpeedyCache\Logs::action(); } return array(__('Purged Varnish Cache Succesfully', 'speedycache'), 'success'); } static function expired_cache(){ global $speedycache; self::$cache_lifespan = Util::cache_lifespan(); // We don't want to clean cache if cache is disabled if(empty($speedycache->options['status']) || empty(self::$cache_lifespan)){ wp_clear_scheduled_hook('speedycache_purge_cache'); return; } $cache_path = []; $cache_path[] = Util::cache_path('all'); $cache_path[] = Util::cache_path('mobile-cache'); foreach($cache_path as $path){ if(!file_exists($path)){ continue; } self::rec_clean_expired($path); } // Assets are deleted only if the lifetime is more than 10 hours, // because only then is the entire cache deleted. // Cached assets may be used on multiple pages, // so we must ensure they are not deleted unless all cached pages are removed. if(self::$cache_lifespan > 10 * HOUR_IN_SECONDS){ self::minified(); if(!empty($speedycache->options['auto_purge_fonts'])){ self::local_fonts(); } if(!empty($speedycache->options['auto_purge_gravatar'])){ self::gravatar(); } } // We will delete it even if the cache does not gets deleted delete_option('speedycache_html_size'); delete_option('speedycache_assets_size'); if(class_exists('\SpeedyCache\Logs')){ \SpeedyCache\Logs::log('delete'); \SpeedyCache\Logs::action(); } // Preload the cached if(self::$cache_lifespan > 10 * HOUR_IN_SECONDS && !empty($speedycache->options['preload'])){ \SpeedyCache\Preload::build_preload_list(); } } // Recursively deletes expired cache static function rec_clean_expired($path){ $files = array_diff(scandir($path), array('..', '.')); if(empty($files)){ return; } foreach($files as $file){ $file_path = $path . '/'. $file; if(is_dir($file_path)){ self::rec_clean_expired($file_path); continue; } // We will delete all cache if the lifespan is greater than 10 hours to prevent nonce issues, // We could delete all the cache for lifespan above 10 hrs, but for larger sites deleting // everything colud be a overhead. if((self::$cache_lifespan >= 10 * HOUR_IN_SECONDS) || ((filemtime($file_path) + self::$cache_lifespan) < time())){ unlink($file_path); } } } // Deletes the cache of the post whose status got changed, // only deletes when the post transitions in our out of published mode static function on_status_change($new_status, $old_status, $post){ global $speedycache; if($old_status == $new_status && $old_status !== 'publish') return; if($old_status !== 'publish' && $new_status !== 'publish'){ return; } if(empty($speedycache->options['status'])){ return; } if(!empty(wp_is_post_revision($post->ID))){ return; } // Current post should not be deleted when its anything other than publish, // As in some states its URL changes to ?page_id= if($new_status == 'publish'){ self::cache($post->ID); } // Deleting the cache of home page and blog page $home_page_id = get_option('page_on_front'); self::cache($home_page_id); // For some sites home page and blog page could be same $blog_page_id = get_option('page_for_posts'); if($home_page_id !== $blog_page_id){ self::cache($blog_page_id); } // Deleting the author page cache $author_page_url = get_author_posts_url($post->post_author); self::url($author_page_url); // Deleting cache of related terms self::terms($post->ID); // Delete shop page when product status changes. if(function_exists('wc_get_page_id')){ $shop_page_id = wc_get_page_id('shop'); if($home_page_id !== $shop_page_id){ self::cache($shop_page_id); } } // This is used to delete post which may have the current post as the related post / product in them self::adjacent_posts_urls(); } // Deletes cache of the page where a comments status got change. static function on_comment_status($new_status, $old_status, $comment){ global $speedycache; if($old_status == $new_status && $old_status !== 'approved') return; if($old_status !== 'approved' && $new_status !== 'approved'){ return; } if(empty($speedycache->options['status'])){ return; } self::cache($comment->comment_parent); } static function terms($post_id){ global $speedycache; if(empty($post_id) || !is_numeric($post_id)){ return; } $post_type = get_post_type($post_id); if(empty($post_type)){ return; } // Get all taxonomies for the post type $taxonomies = get_object_taxonomies($post_type, 'objects'); // Filter to keep only public taxonomies $public_taxonomies = []; foreach($taxonomies as $taxonomy){ if($taxonomy->public){ $public_taxonomies[] = $taxonomy->name; } } if(empty($public_taxonomies)){ return; } $terms = wp_get_post_terms($post_id, $public_taxonomies); if(empty($terms) || is_wp_error($terms)){ return; } $deletable_links = []; foreach($terms as $term){ $link = get_term_link($term->term_id); if(is_wp_error($link) || empty($link)){ continue; } $deletable_links[] = $link; $ancestors = get_ancestors($term->term_id, $term->taxonomy); if(!empty($ancestors)){ foreach($ancestors as $ancestor){ $ancestor_link = get_term_link($ancestor); if(is_wp_error($ancestor_link) || empty($ancestor_link)){ continue; } $deletable_links[] = $ancestor_link; } } } if(empty($deletable_links)){ return; } $deletable_links = array_unique($deletable_links); self::url($deletable_links); if(!empty($speedycache->options['preload'])){ \SpeedyCache\Preload::url($deletable_links); } } static function adjacent_posts_urls(){ $post_urls = []; $prev_post = get_adjacent_post(); $prev_post_term = get_adjacent_post(true, ''); $next_post = get_adjacent_post(false, '', true); $next_post_term = get_adjacent_post(true, '', true); if(!empty($prev_post)){ $post_urls[] = get_permalink($prev_post); } if(!empty($prev_post_term)){ $post_urls[] = get_permalink($prev_post_term); } if(!empty($next_post)){ $post_urls[] = get_permalink($next_post); } if(!empty($next_post_term)){ $post_urls[] = get_permalink($next_post_term); } if(!empty($post_urls)){ self::url($post_urls); } } // Deletes cache of product page and its related pages when a order is made static function order($order_id){ global $speedycache; if(empty($speedycache->options['status'])){ return; } if(!function_exists('wc_get_order')){ return; } $order = wc_get_order($order_id); $items = $order->get_items(); foreach($items as $item){ $product_id = $item->get_product_id(); if(empty($product_id)){ continue; } self::cache($product_id); $categories = wp_get_post_terms($product_id, 'product_cat', array('fields' => 'ids')); foreach($categories as $category){ self::cache($category); } } $shop_page_id = wc_get_page_id('shop'); self::cache($shop_page_id); } } advanced-cache.php 0000644 00000014744 15104540611 0010072 0 ustar 00 <?php /* * SPEEDYCACHE * https://speedycache.com/ * (c) SpeedyCache Team */ if(!defined('ABSPATH')) exit; // Check request method is Head or get if(!isset($_SERVER['REQUEST_METHOD']) || $_SERVER['REQUEST_METHOD'] !== 'GET'){ return; } if(defined('WP_INSTALLING') && WP_INSTALLING){ return; } if(defined('WP_CLI') && WP_CLI){ return; } if(empty($_SERVER['REQUEST_URI']) || empty($_SERVER['HTTP_HOST']) || empty($_SERVER['HTTP_USER_AGENT'])){ return false; } if(preg_match('/(\/){2}$/', $_SERVER['REQUEST_URI'])){ return false; } function speedycache_ac_serve_cache(){ $ignored_parameters = ['fbclid', 'utm_id', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'utm_source_platform', 'gclid', 'dclid', 'msclkid', 'ref', 'fbaction_ids', 'fbc', 'fbp', 'clid', 'mc_cid', 'mc_eid', 'hsCtaTracking', 'hsa_cam', 'hsa_grp', 'hsa_mt', 'hsa_src', 'hsa_ad', 'hsa_acc', 'hsa_net', 'hsa_kw', 'test_speedycache']; $uri = ''; $parsed_uri = []; $uri = $_SERVER['REQUEST_URI']; $uri = urldecode($uri); // Users use other languages to write as well $uri = preg_replace('/\.{2,}/', '', $uri); // Cleaning the path $parsed_uri = parse_url($uri); if(!empty($parsed_uri) && !empty($parsed_uri['query'])){ parse_str($parsed_uri['query'], $parsed_query); foreach($parsed_query as $query => $value){ if(in_array($query, $ignored_parameters)){ unset($parsed_query[$query]); continue; } } $uri = $parsed_uri['path'] . (!empty($parsed_query) ? '?'.http_build_query($parsed_query) : ''); } // We dont know if the site is a /directory based so we just hit and try $site_dir = ''; $path = ''; if(!empty($parsed_uri['path'])){ $path = trim($parsed_uri['path'], '/'); } if(strpos($path, '/') !== FALSE){ $parsed_path = explode('/', $path); $site_dir = $parsed_path[0]; } elseif(!empty($path)){ $site_dir = $path; } $config_file = WP_CONTENT_DIR . '/speedycache-config/' . basename($_SERVER['HTTP_HOST']) . '.php'; if(!file_exists($config_file)){ $config_file = WP_CONTENT_DIR . '/speedycache-config/' . basename($_SERVER['HTTP_HOST']) . '.'. $site_dir . '.php'; if(!file_exists($config_file)){ return; } } if(!file_exists($config_file)){ return; } // Accessing the config file include_once $config_file; if(empty($speedycache_ac_config) || !is_array($speedycache_ac_config)){ return; } if(empty($speedycache_ac_config['settings']['status'])){ return; } // Exclude pages|useragent|cookie if(speedycache_ac_excludes($speedycache_ac_config)){ return; } if(!empty($speedycache_ac_config['user_agents']) && preg_match('/'.preg_quote($speedycache_ac_config['user_agents']).'/', $_SERVER['HTTP_USER_AGENT'])){ return; } if(empty($speedycache_ac_config['settings']['logged_in_user']) && preg_grep('/^wordpress_logged_in_/i', array_keys($_COOKIE))){ return false; } // check comment author if(preg_grep('/comment_author_/i', array_keys($_COOKIE))){ return false; } $cache_path = WP_CONTENT_DIR.'/cache/speedycache/' . basename($_SERVER['HTTP_HOST']); // For the test cache if(isset($_GET['test_speedycache'])){ $cache_path = '/test'. $uri; } else if(!empty($speedycache_ac_config['settings']['mobile']) && preg_match('/Mobile|Android|Silk\/|Kindle|BlackBerry|Opera (Mini|Mobi)/i', $_SERVER['HTTP_USER_AGENT'])) { // Check for Mobile if(!empty($speedycache_ac_config['settings']['mobile_theme'])){ $cache_path .= '/mobile-cache' . $uri; } else { return; // If just mobile is enabled then we don't want to show desktop verison of cache on mobile. } } else { // get path of file $cache_path .= '/all'. $uri; } $file_name = 'index'; if(isset($_COOKIE['wcu_current_currency'])){ $file_name .= '-' . strtolower($_COOKIE['wcu_current_currency']); $file_name = preg_replace('/\.{2,}/', '', $file_name); // Cleaning the path } $file_name .= '.html'; //check file extension $serving_gz = ''; if(isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE && !empty($speedycache_ac_config['settings']['gzip']) && @file_exists($cache_path . '/'. $file_name.'.gz')){ $serving_gz = '.gz'; // We do not want output compression to be enabled if we are gzipping the page. if(function_exists('ini_set')){ ini_set('zlib.output_compression', 0); } header('Content-Encoding: gzip'); } if(!file_exists($cache_path . '/'.$file_name . $serving_gz)){ $serving_gz = ''; } if(!file_exists($cache_path . '/'.$file_name . $serving_gz)){ return; } if(!headers_sent()){ header('x-speedycache-source: PHP'); } $cache_created_at = filemtime($cache_path. '/'.$file_name . $serving_gz); header('Last-Modified: ' . gmdate( 'D, d M Y H:i:s', $cache_created_at) . ' GMT'); $if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : 0; if($if_modified_since === $cache_created_at){ header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified', true, 304); header('Cache-Control: no-cache, must-revalidate'); header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); exit(); } readfile($cache_path. '/'.$file_name . $serving_gz); exit(); } function speedycache_ac_excludes($excludes){ if(empty($excludes) || !is_array($excludes)){ return false; } $preg_match_rule = ''; $request_url = !empty($_SERVER['REQUEST_URI']) ? urldecode(trim($_SERVER['REQUEST_URI'], '/')) : ''; foreach($excludes as $key => $value){ $value['type'] = !empty($value['type']) ? $value['type'] : 'page'; if(!empty($value['prefix']) && $value['type'] == 'page'){ $value['content'] = trim($value['content']); $value['content'] = trim($value['content'], '/'); if($value['prefix'] == 'exact' && strtolower($value['content']) == strtolower($request_url)){ return true; }else{ $preg_match_rule = preg_quote($value['content'], '/'); if($preg_match_rule){ if(preg_match('/'.$preg_match_rule.'/i', $request_url)){ return true; } } } }else if($value['type'] == 'useragent'){ if(preg_match('/'.preg_quote($value['content'], '/').'/i', $_SERVER['HTTP_USER_AGENT'])){ return true; } }else if($value['type'] == 'cookie'){ if(isset($_SERVER['HTTP_COOKIE'])){ if(preg_match('/'.preg_quote($value['content'], '/').'/i', $_SERVER['HTTP_COOKIE'])){ return true; } } } } } speedycache_ac_serve_cache(); htaccess.php 0000644 00000020731 15104540611 0007052 0 ustar 00 <?php namespace SpeedyCache; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Htaccess { static function init(){ if(!empty($_SERVER['SERVER_SOFTWARE'])){ $server_name = sanitize_text_field(wp_unslash($_SERVER['SERVER_SOFTWARE'])); if(!empty($server_name) && (preg_match('/nginx/i', $server_name) || preg_match('/iis/i', $server_name))){ return; } } if(defined('SITEPAD')){ global $sitepad; $htaccess_file = $sitepad['path'] . '/.htaccess'; }else{ $htaccess_file = ABSPATH . '/.htaccess'; } if(!file_exists($htaccess_file)){ return false; } if(!is_writable($htaccess_file)){ return; } $htaccess_content = file_get_contents($htaccess_file); $htaccess_rules = ''; self::headers($htaccess_rules); self::gzip($htaccess_rules); self::browser_cache($htaccess_rules); self::webp($htaccess_rules); self::serving_rules($htaccess_rules); // TODO: Need to add modified time here. // Cleaning stuff $htaccess_content = preg_replace("/#\s?BEGIN\s?LBCspeedycache.*?#\s?END\s?LBCspeedycache/s", '', $htaccess_content); $htaccess_content = preg_replace("/#\s?BEGIN\s?WEBPspeedycache.*?#\s?END\s?WEBPspeedycache/s", '', $htaccess_content); $htaccess_content = preg_replace("/#\s?BEGIN\s?Gzipspeedycache.*?#\s?END\s?Gzipspeedycache/s", '', $htaccess_content); $htaccess_content = preg_replace("/#\s?BEGIN\s?SpeedyCacheheaders.*?#\s?END\s?SpeedyCacheheaders/s", '', $htaccess_content); $htaccess_content = preg_replace("/#\s?BEGIN\s?speedycache.*?#\s?END\s?speedycache/s", '', $htaccess_content); $htaccess_content = $htaccess_rules ."\n" . trim($htaccess_content); file_put_contents($htaccess_file, $htaccess_content); } static function serving_rules(&$htaccess_rules){ global $speedycache; $base_cache_path = defined('SITEPAD') ? 'sitepad-data' : 'wp-content'; $platform_excludes = defined('SITEPAD') ? 'RewriteCond %{REQUEST_URI} !^/(site-admin|login|wp-register|wp-comments-post|cron|sp-json)/ [NC]' : 'RewriteCond %{REQUEST_URI} !^/(wp-(?:admin|login|register|comments-post|cron|json))/ [NC]'; $htaccess_rules .= '# BEGIN speedycache <IfModule mod_rewrite.c> RewriteEngine On'; if(!defined('SITEPAD')){ $htaccess_rules .= "\n".'RewriteBase /'; } if(!empty($speedycache->options['mobile']) && !empty($speedycache->options['mobile_theme'])){ $htaccess_rules .= ' RewriteCond %{REQUEST_METHOD} GET RewriteCond %{HTTP_USER_AGENT} !(Mediatoolkitbot|facebookexternalhit|SpeedyCacheCCSS) RewriteCond %{HTTP_USER_AGENT} (Mobile|Android|Silk\/|Kindle|Opera\sMini|BlackBerry|Opera\sMobi) [NC] RewriteCond %{QUERY_STRING} ="" '.self::cookie_excludes().' RewriteCond %{REQUEST_URI} !(\/){2}$ '.$platform_excludes.' RewriteCond %{DOCUMENT_ROOT}/'.$base_cache_path.'/cache/speedycache/%{HTTP_HOST}/mobile-cache%{REQUEST_URI}/index.html -f RewriteRule ^(.*) /'.$base_cache_path.'/cache/speedycache/%{HTTP_HOST}/mobile-cache%{REQUEST_URI}/index.html [L]'."\n"; } $htaccess_rules .= ' RewriteCond %{REQUEST_METHOD} GET RewriteCond %{HTTP_USER_AGENT} !(Mediatoolkitbot|facebookexternalhit|SpeedyCacheCCSS) RewriteCond %{QUERY_STRING} ="" '.self::cookie_excludes()."\n"; if(!empty($speedycache->options['mobile'])){ $htaccess_rules .= ' RewriteCond %{HTTP_USER_AGENT} !(Mobile|Android|Silk\/|Kindle|Opera\sMini|BlackBerry|Opera\sMobi) [NC]' . "\n"; } $htaccess_rules .= ' RewriteCond %{REQUEST_URI} !(\/){2}$ '.$platform_excludes.' RewriteCond %{DOCUMENT_ROOT}/'.$base_cache_path.'/cache/speedycache/%{HTTP_HOST}/all%{REQUEST_URI}/index.html -f RewriteRule ^(.*) /'.$base_cache_path.'/cache/speedycache/%{HTTP_HOST}/all%{REQUEST_URI}/index.html [L] </IfModule> # END speedycache' . PHP_EOL; } static function browser_cache(&$htaccess_rules){ global $speedycache; if(empty($speedycache->options['lbc'])){ return; } $htaccess_rules .= '# BEGIN LBCspeedycache <IfModule mod_expires.c> ExpiresActive on ExpiresDefault A0 ExpiresByType text/css A31536000 ExpiresByType text/javascript A31536000 ExpiresByType font/ttf A31536000 ExpiresByType font/otf A31536000 ExpiresByType font/woff A31536000 ExpiresByType font/woff2 A31536000 ExpiresByType image/jpg A31536000 ExpiresByType image/jpeg A31536000 ExpiresByType image/png A31536000 ExpiresByType image/gif A31536000 ExpiresByType image/webp A31536000 ExpiresByType image/x-icon A31536000 ExpiresByType image/svg+xml A31536000 ExpiresByType image/vnd.microsoft.icon A31536000 ExpiresByType video/ogg A31536000 ExpiresByType video/mp4 A31536000 ExpiresByType video/webm A31536000 ExpiresByType audio/ogg A31536000 ExpiresByType application/pdf A31536000 ExpiresByType application/javascript A31536000 ExpiresByType application/x-javascript A31536000 ExpiresByType application/x-font-ttf A31536000 ExpiresByType application/x-font-woff A31536000 ExpiresByType application/font-woff A31536000 ExpiresByType application/font-woff2 A31536000 ExpiresByType application/vnd.ms-fontobject A31536000 </IfModule> # END LBCspeedycache' . PHP_EOL; } static function webp(&$htaccess_rules){ $htaccess_rules .= '# BEGIN WEBPspeedycache <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} \.(jpe?g|png|gif)$ RewriteCond %{DOCUMENT_ROOT}/$1.webp -f RewriteRule ^(.+)\.(jpe?g|png|gif)$ $1.webp [T=image/webp,L] </IfModule> <IfModule mod_headers.c> Header append Vary Accept env=REDIRECT_accept </IfModule> AddType image/webp .webp # END WEBPspeedycache' . PHP_EOL; } static function gzip(&$htaccess_rules){ global $speedycache; if(empty($speedycache->options['gzip'])){ return; } $htaccess_rules .= '# BEGIN Gzipspeedycache <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE font/opentype AddOutputFilterByType DEFLATE font/otf AddOutputFilterByType DEFLATE font/ttf AddOutputFilterByType DEFLATE font/woff AddOutputFilterByType DEFLATE font/woff2 AddOutputFilterByType DEFLATE text/js AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE image/x-icon AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/vnd.ms-fontobject AddOutputFilterByType DEFLATE application/x-font AddOutputFilterByType DEFLATE application/x-font-opentype AddOutputFilterByType DEFLATE application/x-font-otf AddOutputFilterByType DEFLATE application/x-font-truetype AddOutputFilterByType DEFLATE application/x-font-ttf AddOutputFilterByType DEFLATE application/font-woff2 AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/rss+xml </IfModule> # END Gzipspeedycache'. PHP_EOL; } static function headers(&$htaccess_rules){ $url = site_url(); $parsed_url = wp_parse_url($url); $htaccess_rules .= '# BEGIN SpeedyCacheheaders FileETag None <IfModule mod_headers.c> Header unset ETag </IfModule> <FilesMatch "\.(html)$"> <IfModule mod_headers.c> Header set x-speedycache-source "Server" Header set Cache-Tag "'.$parsed_url['host'].'" Header set CDN-Cache-Control "max-age=1296000" Header set Cache-Control "public" Header unset Pragma Header unset Last-Modified </IfModule> </FilesMatch> <FilesMatch "\.(css|htc|js|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$"> <IfModule mod_headers.c> Header unset Pragma Header set Cache-Control "public" </IfModule> </FilesMatch> # END SpeedyCacheheaders'. PHP_EOL; } static function cookie_excludes(){ $cookies = []; $cookies[] = 'comment_author_'; $cookies[] = 'wordpress_logged_in_'; if(!defined('SITEPAD')){ if(is_plugin_active('woo-currency/wcu.php')){ $cookies[] = 'wcu_current_currency'; } } $cookies_to_exclude = implode('|', $cookies); $cookies_to_exclude = preg_replace("/\s/", "\s", $cookies_to_exclude); return 'RewriteCond %{HTTP:Cookie} !('.$cookies_to_exclude.')'; } } cdn.php 0000644 00000020307 15104540611 0006020 0 ustar 00 <?php namespace SpeedyCache; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class CDN{ static $allowed_types = []; static $cdn_url = ''; static $specific = []; static $excludes = []; static function rewrite(&$content){ global $speedycache; self::$cdn_url = $speedycache->cdn['cdn_url']; self::$allowed_types = $speedycache->cdn['file_types']; self::$excludes = $speedycache->cdn['excludekeywords']; self::$specific = $speedycache->cdn['keywords']; if(empty(self::$cdn_url) || empty(self::$allowed_types)){ return; } // Define the patterns to match specific URLs (e.g., images, CSS, JS) $base_dir = defined('SITEPAD') ? 'sitepad-data' : 'wp-content'; if (defined('SITEPAD')){ global $sitepad; $site_inc_url = $sitepad['url'] . '/site-inc'; } else { $site_inc_url = home_url('/wp-includes/'); } $patterns = [ '/' . preg_quote(home_url("/{$base_dir}/uploads/"), '/') . '([^"\']+)/i', '/'. preg_quote($site_inc_url, '/') . '([^"\']+)/i', '/' . preg_quote(home_url("/{$base_dir}/themes/"), '/') . '([^"\']+)/i', '/' . preg_quote(defined('SP_PLUGIN_URL') ? SP_PLUGIN_URL : home_url('/wp-content/plugins/'), '/') . '([^"\']+)/i', '/' . preg_quote(home_url("/{$base_dir}/cache/"), '/') . '([^"\']+)/i', ]; // Loop through each pattern and replace only URLs with the specified file types foreach($patterns as $pattern){ $content = preg_replace_callback($pattern, '\SpeedyCache\CDN::replace_urls', $content); } } static function replace_urls($matches) { global $speedycache; // Get the file extension $file_url = preg_replace('/\?.*$/', '', $matches[0]); if(empty($file_url)){ $file_url = $matches[0]; } $file_url = trim($file_url, '/'); if(self::is_excluded($file_url)){ return $matches[0]; } // To rewrite just some specific files only if(!empty(self::$specific) && is_array(self::$specific)){ $is_specific = false; foreach(self::$specific as $required_source){ if(preg_match('/'.preg_quote($required_source).'/i', $file_url)){ $is_specific = true; break; } } if(empty($is_specific)){ return $matches[0]; } } $file_extension = self::get_file_extension($file_url); // Check if the file extension is in the allowed list if(in_array(strtolower($file_extension), self::$allowed_types)){ $home_url = home_url(); // Rewrite the URL to use the CDN return str_replace($home_url, self::$cdn_url, $matches[0]); } // If not in the allowed list, return the original URL return $matches[0]; } static function get_file_extension($url) { $url = strtok($url, ' '); $url = strtok($url, '?'); return strtolower(pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_EXTENSION)); } static function is_excluded($url){ if(empty($url)){ return false; } // array check if just to make sure things dont break for 1.2.0 in which we rewrote the plugin if(empty(self::$excludes) || !is_array(self::$excludes)){ return false; } foreach(self::$excludes as $exclude){ if(preg_match('/'.preg_quote($exclude).'/i', $url)){ return true; } } return false; } static function purge(){ global $speedycache; // Only cloudflare and Bunny can be purged, that too we only want that to happen if CDN is enabled. if( empty($speedycache->cdn['enabled']) || empty($speedycache->cdn['cdn_key']) || empty($speedycache->cdn['cdn_type']) || $speedycache->cdn['cdn_type'] == 'other' ){ return; } if($speedycache->cdn['cdn_type'] == 'bunny'){ self::purge_bunny($speedycache->cdn); }elseif($speedycache->cdn['cdn_type'] == 'cloudflare'){ self::purge_cloudflare($speedycache->cdn); } } // Get unique pull ID to purge cache on CDN static function bunny_get_pull_id(&$cdn){ global $speedycache; $pull_zone = $cdn['cdn_url']; // bunny cdn calls it cdn url as pull zone $access_key = $cdn['cdn_key']; if(empty($access_key)){ return array('success' => false, 'message' => __('Bunny CDN Access Key not found', 'speedycache')); } $options = array( 'headers' => array( 'AccessKey' => $access_key, 'accept' => 'application/json' ) ); $res = wp_remote_get('https://api.bunny.net/pullzone', $options); if(is_wp_error($res) || empty($res)){ if(empty($res)){ return array('success' => false, 'message' => __('Bunny CDN retuned an empty response', 'speedycache')); } return array('success' => false, 'message' => 'Something Went Wrong: ' . $res->get_error_message()); } $res_code = wp_remote_retrieve_response_code($res); if(substr($res_code, 0, 1) != 2){ return array('success' => false, 'message' => __('Something Went Wrong: Getting Pull ID was unsuccessful ', 'speedycache') . $res_code); } $res_body = wp_remote_retrieve_body($res); if(empty($res_body)){ return array('success' => false, 'message' => __('Bunny CDN pull ID response body is empty', 'speedycache')); } $res_body = json_decode($res_body, true); foreach($res_body as $pull_zones){ if($pull_zones['OriginUrl'] == $cdn['origin_url']){ return $pull_zones['Id']; } } return array('success' => false, 'message' => __('Bunny Pull Zone not found', 'speedycache')); } static function purge_bunny($cdn){ if(empty($cdn['cdn_key']) || empty($cdn['cdn_url'])){ return false; } $pull_zone = $cdn['cdn_url']; // bunny cdn calls it cdn url as pull zone $access_key = $cdn['cdn_key']; $pull_id = !empty($cdn['bunny_pull_id']) ? $cdn['bunny_pull_id'] : ''; if(empty($access_key) || empty($pull_id)){ return false; } $options = array( 'headers' => array( 'AccessKey' => $access_key, 'content-type' => 'application/json' ) ); $res = wp_remote_post('https://api.bunny.net/pullzone/'.$pull_id.'/purgeCache', $options); if(is_wp_error($res) || empty($res)){ if(empty($res)){ return __('Bunny CDN retuned an empty response', 'speedycache'); } return 'Something Went Wrong: ' . $res->get_error_message(); } $res_code = wp_remote_retrieve_response_code($res); if($res_code != 204){ return esc_html__('Something Went Wrong: Purge was unsuccessful with response code of ', 'speedycache') . $res_code; } return esc_html__('Success: Bunny CDN purged successfully', 'speedycache'); } static function cloudflare_zone_id(&$cdn){ if(empty($cdn['cdn_key'])){ return false; } $api_token = $cdn['cdn_key']; $domain = parse_url(home_url(), PHP_URL_HOST); $url = 'https://api.cloudflare.com/client/v4/zones?name='.$domain; $args = [ 'headers' => [ 'Authorization' => 'Bearer ' . $api_token, 'Content-Type' => 'application/json', ], ]; $response = wp_remote_get($url, $args); if (is_wp_error($response)) { return 'Error: ' . $response->get_error_message(); } $body = json_decode(wp_remote_retrieve_body($response), true); if($body && isset($body['result'][0]['id'])){ return $body['result'][0]['id']; // This is the Zone ID } return false; } static function purge_cloudflare($cdn){ if(empty($cdn['cloudflare_zone_id']) || empty($cdn['cdn_key'])){ return; } $zone_id = $cdn['cloudflare_zone_id']; $api_token = $cdn['cdn_key']; $url = 'https://api.cloudflare.com/client/v4/zones/'.$zone_id.'/purge_cache'; $args = [ 'headers' => [ 'Authorization' => 'Bearer ' . $api_token, 'Content-Type' => 'application/json', ], 'body' => json_encode([ 'purge_everything' => true, // Set to true to purge all cache ]), ]; $response = wp_remote_post($url, $args); if (is_wp_error($response)) { return 'Error: ' . $response->get_error_message(); } $body = json_decode(wp_remote_retrieve_body($response), true); if ($body && isset($body['success']) && $body['success'] === true) { return esc_html__('Cloudflare cache purged successfully.', 'speedycache'); } return 'Failed to purge Cloudflare cache. ' . (isset($body['errors'][0]['message']) ? $body['errors'][0]['message'] : ''); } } css.php 0000644 00000014266 15104540611 0006053 0 ustar 00 <?php namespace SpeedyCache; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } use \SpeedyCache\lib\Minify; use \SpeedyCache\Util; class CSS{ static function minify(&$content){ global $speedycache; if(empty($content)){ return; } preg_match_all('/<link\s+([^>]+[\s"\'])?href\s*=\s*[\'"]\s*?(?<url>[^\'"]+\.css(?:\?[^\'"]*)?)\s*?[\'"]([^>]+)?\/?>/Umsi', $content, $tags, PREG_SET_ORDER); if(empty($tags)){ return; } if(empty($_SERVER['HTTP_HOST'])){ return; } $site_host = str_replace('www.', '', sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST']))); $site_url = site_url(); foreach($tags as $tag){ if(empty($tag['url'])){ continue; } $url = $tag['url']; if(self::is_excluded($url)) continue; // We don't want to minify already minified css if(strpos($url, '.min.css') !== FALSE){ continue; } // We wont process any css that is not present on this WordPress install if(strpos($url, $site_host) === FALSE){ continue; } $file_path = Util::url_to_path($url); if(!file_exists($file_path)){ continue; } $file_name = self::file_name($file_path); $asset_path = Util::cache_path('assets'); if(!is_dir($asset_path)){ mkdir($asset_path, 0755, true); touch($asset_path . 'index.html'); } $minified_path = $asset_path.$file_name; // If we already have a minified file then we dont need to process it again. if(!file_exists($minified_path)){ $minified = new Minify\CSS($file_path); $minified = $minified->minify(); $minified = self::fix_relative_path($minified, $url); file_put_contents($minified_path, $minified); } $minified_url = Util::path_to_url($minified_path); $content = str_replace($tag['url'], $minified_url, $content); // TODO: check if there is a preload. } } static function file_name($path){ $file_hash = md5_file($path); $file_name = substr($file_hash, 0, 16) . '-' . basename($path); return $file_name; } static function combine(&$content){ if(empty($content)){ return; } preg_match_all('/<link\s+([^>]+[\s"\'])?href\s*=\s*[\'"]\s*?(?<url>[^\'"]+\.css(?:\?[^\'"]*)?)\s*?[\'"]([^>]+)?\/?>/Umsi', $content, $tags, PREG_SET_ORDER); if(empty($tags)){ return; } if(empty($_SERVER['HTTP_HOST'])){ return; } $site_host = str_replace('www.', '', sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST']))); $site_url = site_url(); $combined_css = ''; $prev_tag = ''; $tags = array_reverse($tags); foreach($tags as $tag){ if(empty($tag['url'])){ continue; } $url = $tag['url']; if(self::is_excluded($url)) continue; // We wont process any css that is not present on this WordPress install if(strpos($url, $site_host) === FALSE){ continue; } $file_path = Util::url_to_path($url); if(!file_exists($file_path) || !is_readable($file_path)){ continue; } $new_css = file_get_contents($file_path); $new_css = self::fix_relative_path($new_css, $url); $combined_css = $new_css . "\n" . $combined_css; // Removing the CSS which has already been combined, as we will add the combined file at the top after title. if(!empty($prev_tag)){ $content = str_replace($prev_tag, '', $content); } // We remove the previous tag, in current iteration, so at last we have a tag to replace wirh the combined script. $prev_tag = $tag[0]; //TODO: Need to remove any preload added by any plugin or a theme. } if(empty($combined_css)){ return; } // Creating Combined file name $file_name = md5($combined_css); $file_name = substr($file_name, 0, 16) . '-combined.css'; $asset_path = Util::cache_path('assets'); if(!is_dir($asset_path)){ mkdir($asset_path, 0755, true); touch($asset_path . 'index.html'); } $combined_path = $asset_path.$file_name; file_put_contents($combined_path, $combined_css); $final_url = Util::path_to_url($combined_path); // Injecting the Combined CSS if(!empty($prev_tag)){ $content = str_replace($prev_tag, '<link rel="stylesheet" href="'.esc_url($final_url).'" />', $content); return; } $content = str_replace('</title>', "</title>\n".'<link rel="stylesheet" href="'.esc_url($final_url).'" />', $content); } static function is_excluded($url){ $excludes = get_option('speedycache_exclude', []); if(empty($excludes)){ return false; } foreach($excludes as $exclude){ if(empty($exclude['type'])){ continue; } if($exclude['type'] !== 'css'){ continue; } if(empty($exclude['content'])){ continue; } if(preg_match('/'.preg_quote($exclude['content'], '/').'/', $url)){ return true; } } return false; } static function fix_relative_path($content, $base_url){ // We need base url as the relative url file will be in the same folder as file at the base url or will be relative to path of the base url $content = preg_replace_callback('/url\(\s*["\']?(?!http|https|\/\/)([^"\')]+)["\']?\s*\)/i', function($matches) use ($base_url) { $relative_path = $matches[1]; $relative_path = trim($relative_path, '/'); $base_path = Util::url_to_path($base_url); if(strpos($relative_path, '..') === 0){ $parameter = ''; // Some URL's had query parameters, that were breaking when using realpath if(strpos($relative_path, '?') !== FALSE){ $parsed_path = explode('?', $relative_path); $parameter = $parsed_path[1]; $relative_path = $parsed_path[0]; $parsed_path = null; } $absolute_path = realpath(dirname($base_path) . '/' . $relative_path); $absolute_url = Util::path_to_url($absolute_path); // Appending the parameter again if(!empty($parameter)){ $absolute_url .= '?'. $parameter; } } else if(strpos($relative_path, 'wp-content') === 0){ $absolute_url = site_url() . '/'. $relative_path; } if(empty($absolute_url)){ $absolute_url = $relative_path; } return 'url("' . $absolute_url . '")'; }, $content); return $content; } } cache.php 0000644 00000036235 15104540611 0006326 0 ustar 00 <?php namespace SpeedyCache; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } use \SpeedyCache\Util; class Cache { static $cache_file_path = ''; static $ignored_parameters = ['fbclid', 'utm_id', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'utm_source_platform', 'gclid', 'dclid', 'msclkid', 'ref', 'fbaction_ids', 'fbc', 'fbp', 'clid', 'mc_cid', 'mc_eid', 'hsCtaTracking', 'hsa_cam', 'hsa_grp', 'hsa_mt', 'hsa_src', 'hsa_ad', 'hsa_acc', 'hsa_net', 'hsa_kw']; static $content = ''; static function init(){ global $speedycache; if(!defined('SPEEDYCACHE_SERVER_HOST')){ define('SPEEDYCACHE_SERVER_HOST', Util::sanitize_server('HTTP_HOST')); } if(!defined('SITEPAD')){ if(!empty($speedycache->options['dns_prefetch']) && !empty($speedycache->options['dns_urls'])){ add_filter('wp_resource_hints', '\SpeedyCache\Cache::dns_prefetch_hint', 10, 2); } } // Filter for Gravatar cache. We are updating the URL of the gravatar here so the local hosted Gravatar URL will be cached. if(!empty($speedycache->options['gravatar_cache'])){ add_filter('get_avatar_data', '\SpeedyCache\Gravatar::get_avatar_data', 10, 2); } // Loads Instant Page to improve load page speed by 1% if(defined('SPEEDYCACHE_PRO') && !empty($speedycache->options['instant_page'])){ add_action('wp_enqueue_scripts', '\SpeedyCache\Cache::instant_page'); } if(!empty($speedycache->options['disable_emojis'])){ add_action('init', '\SpeedyCache\Cache::disable_emojis'); } // Optimizes images when a page gets loaded and it finds no image optimized if(class_exists('\SpeedyCache\Image') && !empty($speedycache->image['settings']['automatic_optm'])){ add_filter('the_content', '\SpeedyCache\Image::optimize_on_fly'); } // Adds preconnect if(class_exists('\SpeedyCache\Enhanced')){ if(!defined('SITEPAD')){ if(!empty($speedycache->options['pre_connect']) && !empty($speedycache->options['pre_connect_list'])){ add_filter('wp_resource_hints', '\SpeedyCache\Enhanced::pre_connect_hint', 10, 2); } } // Adds Preload link tag to the head if(!empty($speedycache->options['preload_resources'])){ add_action('wp_head', '\SpeedyCache\Enhanced::preload_resource', 1); } } // Image URL rewrite if(class_exists('\SpeedyCache\Image') && !empty($speedycache->image['settings']['url_rewrite'])){ add_filter('the_content', 'SpeedyCache\Image::rewrite_url_to_webp', 10); } ob_start('\SpeedyCache\Cache::optimize'); } static function create(){ global $speedycache; $cache_path = self::cache_path(); if(!file_exists($cache_path)){ mkdir($cache_path, 0755, true); } $cache_path .= '/' . self::cache_file_name(); $mobile = ''; if(strpos($cache_path, 'mobile-cache') !== FALSE){ $mobile = 'Mobile: '; } $cache_path = wp_normalize_path($cache_path); file_put_contents($cache_path, self::$content . "\n<!-- ".esc_html($mobile)."Cache by SpeedyCache https://speedycache.com -->"); if(function_exists('gzencode') && !empty($speedycache->options['gzip'])){ $gzidded_content = gzencode(self::$content . "\n<!-- ".esc_html($mobile)."Cache by SpeedyCache https://speedycache.com -->"); file_put_contents($cache_path . '.gz', $gzidded_content); } delete_option('speedycache_html_size'); delete_option('speedycache_assets_size'); } static function cache_file_name(){ $file_name = 'index'; if(isset($_COOKIE['wcu_current_currency'])){ $file_name .= '-'. strtolower(sanitize_file_name($_COOKIE['wcu_current_currency'])); } return $file_name . '.html'; } static function cache_path(){ global $speedycache; if(!file_exists(SPEEDYCACHE_CACHE_DIR)){ if(mkdir(SPEEDYCACHE_CACHE_DIR, 0755, true)){ touch(SPEEDYCACHE_CACHE_DIR . '/index.html'); } } $host = $_SERVER['HTTP_HOST']; $request_uri = urldecode(esc_url_raw(wp_unslash($_SERVER['REQUEST_URI']))); $request_uri = preg_replace('/\.{2,}/', '', $request_uri); // Cleaning the path $request_uri = remove_query_arg(self::$ignored_parameters, $request_uri); // Cleaning ignored query $parsed_uri = wp_parse_url($request_uri); $path = SPEEDYCACHE_CACHE_DIR; $path .= '/' . $host; if(wp_is_mobile() && !empty($speedycache->options['mobile_theme'])){ $path .= '/mobile-cache'; } else { $path .= '/all'; } // Handling WeGlot if(function_exists('weglot_get_current_full_url')){ $weglot_url = weglot_get_current_full_url(); $weglot_path = parse_url($weglot_url, PHP_URL_PATH); $path .= $weglot_path; } else { $path .= $parsed_uri['path']; } self::$cache_file_path = $path; return $path; } static function can_cache(){ global $speedycache; if(empty($speedycache->options['status'])) return false; if(empty($_SERVER['REQUEST_METHOD']) || $_SERVER['REQUEST_METHOD'] != 'GET') return false; if(defined('WP_CLI') && !empty(WP_CLI)) return false; if(defined('REST_REQUEST') && !empty(REST_REQUEST)) return false; if(function_exists('http_response_code') && (http_response_code() > 309)) return false; if(preg_match('/\./', $_SERVER['REQUEST_URI'])) return false; if (defined('SITEPAD')) { if (preg_match('/(site-admin|login|wp-register|wp-comments-post|cron|sp-json)/', $_SERVER['REQUEST_URI'])) { return false; } } else { if (preg_match('/(wp-(?:admin|login|register|comments-post|cron|json))/', $_SERVER['REQUEST_URI'])) { return false; } } if(preg_match('/html.*\s(amp|⚡)/', substr(self::$content, 0, 300))) return false; if(wp_is_mobile() && !empty($speedycache->options['mobile']) && empty($speedycache->options['mobile_theme'])) return false; if(is_admin()) return false; // Since: 1.2.8 we will only cache the page if user is not logged-in. if(is_user_logged_in()) return false; if(!preg_match( '/<\s*\/\s*html\s*>/i', self::$content)) return false; if(is_singular() && post_password_required()) return false; if(function_exists('is_404') && is_404()) return false; if(self::is_excluded()) return false; if(function_exists('is_cart') && is_cart()) return false; if(function_exists('is_checkout') && is_checkout()) return false; if(function_exists('is_account_page') && is_account_page()) return false; if(!self::can_handle_query()) return false; return true; } static function optimize($content){ global $speedycache; self::$content = &$content; $start_time = microtime(TRUE); if(!self::can_cache()){ return self::$content; } self::clean_html(); // Minify HTML if(class_exists('\SpeedyCache\Enhanced') && !empty($speedycache->options['minify_html']) && (defined('SPEEDYCACHE_PRO_VERSION') && version_compare(SPEEDYCACHE_PRO_VERSION, '1.2.0', '>='))){ \SpeedyCache\Enhanced::init(); \SpeedyCache\Enhanced::minify_html(self::$content); } // ADD Font Rendering CSS if(!empty($speedycache->options['font_rendering'])){ self::$content = str_replace('</head>', '<style>body{text-rendering: optimizeSpeed;}</style></head>', self::$content); } // Lazy Load HTML elements if(class_exists('\SpeedyCache\Enhanced') && !empty($speedycache->options['lazy_load_html']) && !empty($speedycache->options['lazy_load_html_elements'])){ self::$content = \SpeedyCache\Enhanced::lazy_load_html(self::$content); } if(!empty($speedycache->options['combine_css'])){ \SpeedyCache\CSS::combine(self::$content); } if(!empty($speedycache->options['minify_css'])){ \SpeedyCache\CSS::minify(self::$content); } if(!empty($speedycache->options['combine_js'])){ \SpeedyCache\JS::combine_head(self::$content); } // if(class_exists('\SpeedyCache\Enhanced') && !empty($speedycache->options['combine_js'])){ // \SpeedyCache\JS::combine_body($content); // } if(!empty($speedycache->options['minify_js'])){ \SpeedyCache\JS::minify(self::$content); } // Adds Image dimensions to the Image which does not have height or width if(class_exists('\SpeedyCache\Enhanced') && !empty($speedycache->options['image_dimensions'])){ self::$content = \SpeedyCache\Enhanced::image_dimensions(self::$content); } // Google Fonts if(class_exists('\SpeedyCache\GoogleFonts') && !empty($speedycache->options['local_gfonts'])){ \SpeedyCache\GoogleFonts::get($content); self::$content = \SpeedyCache\GoogleFonts::replace(self::$content); self::$content = \SpeedyCache\GoogleFonts::add_swap(self::$content); } // Preload Critical Images if(class_exists('\SpeedyCache\Enhanced') && !empty($speedycache->options['critical_images'])){ self::$content = \SpeedyCache\Enhanced::preload_critical_images(self::$content); } // Delay JS if(!empty($speedycache->options['delay_js']) && class_exists('\SpeedyCache\ProOptimizations')){ \SpeedyCache\ProOptimizations::delay_js(self::$content); } // Defer JS if(!empty($speedycache->options['render_blocking']) && class_exists('\SpeedyCache\ProOptimizations')){ \SpeedyCache\ProOptimizations::defer_js(self::$content); } // IMG Lazy Load if(class_exists('\SpeedyCache\ProOptimizations') && !empty($speedycache->options['lazy_load'])){ \SpeedyCache\ProOptimizations::img_lazy_load(self::$content); } // For other plugins to hook into. self::$content = (string) apply_filters('speedycache_content', self::$content); // ----- DO NOT DO ANY OPTIMIZATION BELOW THIS ------ // Unused and Critical CSS if( !empty($_SERVER['HTTP_HOST']) && !empty($_SERVER['REQUEST_URI']) && !empty($_SERVER['HTTP_USER_AGENT']) && class_exists('\SpeedyCache\ProOptimizations') && speedycache_optserver('HTTP_USER_AGENT') !== 'SpeedyCacheCCSS' && !(defined('SITEPAD')) ){ $post_meta = get_post_meta(get_the_ID(), 'speedycache_post_meta', true); if(!empty($speedycache->options['critical_css']) && empty($post_meta['disable_critical_css'])){ \SpeedyCache\ProOptimizations::critical_css(); } if(empty($post_meta['disable_unused_css']) && !empty($speedycache->options['unused_css'])){ \SpeedyCache\ProOptimizations::unused_css(); } } // Rewriting to a CDN if( !empty($speedycache->cdn) && !empty($speedycache->cdn['enabled']) && !empty($speedycache->cdn['cdn_url']) && !empty($speedycache->cdn['cdn_type']) && $speedycache->cdn['cdn_type'] !== 'cloudflare' ){ \SpeedyCache\CDN::rewrite(self::$content); } self::create(); $end_time = microtime(TRUE); self::$content .= '<!-- Cached by SpeedyCache, it took '.($end_time - $start_time).'s-->'; self::$content .= '<!-- Refresh to see the cached version -->'; if(file_exists(self::$cache_file_path)){ header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime(self::$cache_file_path)) . ' GMT'); } return self::$content; } static function clean_html(){ self::$content = str_replace("\r\n", "\n", trim(self::$content)); } static function is_excluded(){ global $speedycache; $excludes = get_option('speedycache_exclude', []); if(empty($excludes)){ return false; } $is_excluded = false; foreach($excludes as $rule){ switch($rule['type']){ case 'page': $is_excluded = self::is_page_excluded($rule); break; case 'useragent': $is_excluded = self::is_useragent_excluded($rule); break; case 'cookie': $is_excluded = self::is_cookie_excluded($rule); break; } if(!empty($is_excluded)){ return true; } } return false; } static function can_handle_query(){ $uri = sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])); $uri = remove_query_arg(self::$ignored_parameters, $uri); $parsed_uri = wp_parse_url($uri); if(!empty($parsed_uri['query'])){ return false; } return true; } static function is_page_excluded($rule){ if(empty($rule['prefix'])){ return false; } if($rule['prefix'] === 'homepage'){ return is_front_page(); } if($rule['prefix'] === 'page'){ return is_page(); } if($rule['prefix'] === 'post_id' && !empty($rule['content'])){ $excluded_ids = is_array($rule['content']) ? $rule['content'] : explode(',', $rule['content']); return in_array(get_queried_object_id(), $excluded_ids); } // Excludes a page if it has the given shortcode. if($rule['prefix'] === 'shortcode' && !empty($rule['content'])){ if(self::has_shortcode($rule['content'])){ return true; } } if($rule['prefix'] === 'category'){ return is_category(); } if($rule['prefix'] === 'archive'){ return is_archive(); } if($rule['prefix'] === 'tag'){ return is_tag(); } if($rule['prefix'] === 'attachment'){ return is_attachment(); } if($rule['prefix'] === 'startwith' && !empty($rule['content'])){ return (bool) preg_match('/^'.preg_quote($rule['content'], '/').'/', trim($_SERVER['REQUEST_URI'], '/')); } if($rule['prefix'] === 'contain' && !empty($rule['content'])){ return (bool) preg_match('/'.preg_quote($rule['content'], '/').'/', trim($_SERVER['REQUEST_URI'], '/')); } if($rule['prefix'] === 'exact' && !empty($rule['content'])){ return trim($rule['content'], '/') === trim($_SERVER['REQUEST_URI'], '/'); } return false; } static function is_cookie_excluded($rule){ if(!isset($_SERVER['HTTP_COOKIE'])){ return false; } $cookie = sanitize_text_field(wp_unslash($_SERVER['HTTP_COOKIE'])); return preg_match('/'.preg_quote($rule['content'], '/').'/i', $cookie); } static function is_useragent_excluded($rule){ return preg_match('/'.preg_quote($rule['content'], '/').'/i', $_SERVER['HTTP_USER_AGENT']); } // Adds DNS prefetch static function dns_prefetch_hint($urls, $relation_type){ global $speedycache; if($relation_type !== 'dns-prefetch'){ return $urls; } foreach($speedycache->options['dns_urls'] as $url) { if(!empty($url)){ $urls[] = $url; } } return $urls; } // Depricated since 1.2.0 do not use it // Just to prevent site from breaking static function create_dir($path, $content, $type = ''){ } static function disable_emojis(){ add_filter('emoji_svg_url', '__return_false'); remove_action('wp_head', 'print_emoji_detection_script', 7); remove_action('admin_print_scripts', 'print_emoji_detection_script'); remove_action('wp_print_styles', 'print_emoji_styles'); remove_action('admin_print_styles', 'print_emoji_styles'); remove_filter('the_content_feed', 'wp_staticize_emoji'); remove_filter('comment_text_rss', 'wp_staticize_emoji'); remove_filter('wp_mail', 'wp_staticize_emoji_for_email'); } static function instant_page(){ wp_enqueue_script('speedycache_instant_page', SPEEDYCACHE_PRO_URL . '/assets/js/instantpage.js', array(), SPEEDYCACHE_PRO_VERSION, ['strategy' => 'defer', 'in_footer' => true]); } /* * @param string $shortcode shortcode tag name. * @return bool. */ static function has_shortcode($shortcode){ global $post; return \has_shortcode($post->post_content, $shortcode); } } preload.php 0000644 00000006571 15104540611 0006711 0 ustar 00 <?php namespace SpeedyCache; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Preload{ static function build_preload_list(){ global $wp_rewrite; delete_transient('speedycache_preload_transient'); if(!isset($wp_rewrite)){ $wp_rewrite = new \WP_Rewrite(); } $preload_urls = []; $preload_urls[] = home_url(); $args = [ 'fields' => 'ids', 'post_type' => ['post', 'page', 'product', 'docs'], 'posts_per_page' => 80, 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'DESC', 'has_password' => false, ]; $query = new \WP_Query($args); if($query->have_posts()){ $posts = $query->get_posts(); foreach($posts as $post_id){ $preload_urls[] = get_permalink($post_id); } } $query = null; $args = [ 'fields' => 'ids', 'post_type' => 'page', 'posts_per_page' => 10, 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'DESC', 'has_password' => false ]; $query = new \WP_Query($args); if($query->have_posts()){ $posts = $query->get_posts(); foreach($posts as $post_id){ $preload_urls[] = get_permalink($post_id); } } $preload_urls = array_unique($preload_urls); set_transient('speedycache_preload_transient', $preload_urls, HOUR_IN_SECONDS); wp_schedule_single_event(time(), 'speedycache_preload_split'); } static function cache(){ global $speedycache; $preload_urls = get_transient('speedycache_preload_transient'); $cache_urls = 0; if(empty($preload_urls) || !is_array($preload_urls)){ return; } foreach($preload_urls as $key => $url){ if($cache_urls >= 10){ break; } wp_remote_get($url, [ 'headers' => [ 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36' ], 'timeout' => 0.01, 'blocking' => false, 'sslverify' => false, ]); // Preload mobile version too if(!empty($speedycache->options['mobile_theme'])){ wp_remote_get($url, [ 'headers' => [ 'User-Agent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/114.0.5735.99 Mobile/15E148 Safari/604.1' ], 'timeout' => 0.01, 'blocking' => false, 'sslverify' => false, ]); } unset($preload_urls[$key]); // We remove from the list to be preloaded $cache_urls++; } if(empty($preload_urls)){ set_transient('speedycache_preload_transient', [], HOUR_IN_SECONDS); return; } wp_schedule_single_event(time() + 60, 'speedycache_preload_split'); set_transient('speedycache_preload_transient', $preload_urls, HOUR_IN_SECONDS); } // This will push a request to preload URLS // TODO: need to add a lock here static function url($urls){ if(!is_array($urls)){ $urls = [$urls]; } $preload_urls = get_transient('speedycache_preload_transient'); if(empty($preload_urls) || !is_array($preload_urls)){ $preload_urls = []; } $preload_urls = array_merge($preload_urls, $urls); $preload_urls = array_unique($preload_urls); set_transient('speedycache_preload_transient', $preload_urls, HOUR_IN_SECONDS); if(!wp_next_scheduled('speedycache_preload_split')){ wp_schedule_single_event(time() + 60, 'speedycache_preload_split'); } } } js.php 0000644 00000013574 15104540611 0005700 0 ustar 00 <?php namespace SpeedyCache; if(!defined('ABSPATH')){ die('HACKING ATTEMPT'); } use \SpeedyCache\Util; class JS{ // Depericated since 1.2.0 // do not use it just to prevent site from breaking. static function init(){ } static function minify(&$content){ global $speedycache; if(!class_exists('\SpeedyCache\Enhanced')){ return; } preg_match_all('/<script\s+([^>]+[\s"\'])?src\s*=\s*[\'"]\s*?(?<url>[^\'"]+\.js(?:\?[^\'"]*)?)\s*?[\'"]([^>]+)?\/?><\/script>/is', $content, $tags, PREG_SET_ORDER); if(empty($tags)){ return; } if(empty($_SERVER['HTTP_HOST'])){ return; } $site_host = str_replace('www.', '', sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST']))); $site_url = site_url(); foreach($tags as $tag){ if(empty($tag['url'])){ continue; } $url = $tag['url']; if(self::is_excluded($url)) continue; // We don't want to minify already minified js if(strpos($url, '.min.js') !== FALSE){ continue; } // We wont process any css that is not present on this WordPress install if(strpos($url, $site_host) === FALSE){ continue; } $file_path = Util::url_to_path($url); if(!file_exists($file_path)){ continue; } $file_name = self::file_name($file_path); if(empty($speedycache->enhanced)){ \SpeedyCache\Enhanced::init(); } $js = file_get_contents($file_path); $js = \SpeedyCache\Enhanced::minify_js($js); $asset_path = Util::cache_path('assets'); if(!is_dir($asset_path)){ mkdir($asset_path, 0755, true); touch($asset_path . 'index.html'); } $minified_path = $asset_path.$file_name; file_put_contents($minified_path, $js); $minified_url = Util::path_to_url($minified_path); $content = str_replace($tag['url'], $minified_url, $content); // TODO: check if there is a preload. } } static function combine_head(&$content){ global $speedycache; if (preg_match('/<head.*?>(.*?)<\/head>/is', $content, $head_section)) { $head = preg_replace( '/<!--(.*)-->/Uis', '', $head_section[1]); // Regex pattern to match script tags with src attribute in the head section preg_match_all('/<script\s+([^>]+[\s"\'])?src\s*=\s*[\'"]\s*?(?<url>[^\'"]+\.js(?:\?[^\'"]*)?)\s*?[\'"]([^>]+)?\/?><\/script>/is', $head, $tags, PREG_SET_ORDER); if(empty($tags)){ return; } if(empty($_SERVER['HTTP_HOST'])){ return; } $site_host = str_replace('www.', '', sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST']))); $site_url = site_url(); $tags = array_reverse($tags); // There is no sense in combinining just 2 files. if(count($tags) < 2){ return; } $combined_js = ''; $prev_tag = ''; foreach($tags as $tag){ if(empty($tag['url'])){ continue; } // We wont combine modules. if(!empty($tag[1]) && strpos($tag[1], 'module')){ continue; } $url = $tag['url']; if(self::is_excluded($url)) continue; // We wont process any js that is not present on this WordPress install if(strpos($url, $site_host) === FALSE){ continue; } $file_path = Util::url_to_path($url); if(!file_exists($file_path) || !is_readable($file_path)){ continue; } $combined_js = file_get_contents($file_path) . "\n" . $combined_js; // Removing the JS which has already been combined, as we will add the combined file at the top after title. if(!empty($prev_tag)){ $content = str_replace($prev_tag, '', $content); } // We remove the previous tag, in current iteration, so at last we have a tag to replace wirh the combined script. $prev_tag = $tag[0]; } if(empty($combined_js)){ return; } if(class_exists('\SpeedyCache\Enhanced') && !empty($speedycache->options['minify_js'])){ if(empty($speedycache->enhanced)){ \SpeedyCache\Enhanced::init(); } $combined_js = \SpeedyCache\Enhanced::minify_js($combined_js); } // Creating Combined file name $file_name = md5($combined_js); $file_name = substr($file_name, 0, 16) . '-combined.js'; $asset_path = Util::cache_path('assets'); if(!is_dir($asset_path)){ mkdir($asset_path, 0755, true); touch($asset_path . 'index.html'); } $combined_path = $asset_path.$file_name; file_put_contents($combined_path, $combined_js); $final_url = Util::path_to_url($combined_path); // Injecting the Combined JS if(!empty($prev_tag)){ $content = str_replace($prev_tag, '<script src="'.esc_url($final_url).'" />', $content); return; } $content = str_replace('</title>', "</title>\n".'<script src="'.esc_url($final_url).'"/>', $content); } } static function file_name($path){ $file_hash = md5_file($path); $file_name = substr($file_hash, 0, 16) . '-' . basename($path); return $file_name; } static function combine_body(&$content){ global $speedycache; \SpeedyCache\Enhanced::init(); \SpeedyCache\Enhanced::set_html($content); if(!empty($speedycache->options['minify_js'])){ $content = \SpeedyCache\Enhanced::combine_js_in_footer(true); }else{ $content = \SpeedyCache\Enhanced::combine_js_in_footer(); } } static function is_excluded($url){ $excludes = get_option('speedycache_exclude', []); // Combining JQUERY will mess up the site. if(strpos($url, 'jquery')){ return true; } if(empty($excludes)){ return false; } foreach($excludes as $exclude){ if(empty($exclude['type'])){ continue; } if($exclude['type'] !== 'js'){ continue; } if(empty($exclude['content'])){ continue; } if(preg_match('/'.preg_quote($exclude['content'], '/').'/', $url)){ return true; } } return false; } } bcloud-cron.php 0000644 00000007327 15104541006 0007471 0 ustar 00 <?php if(!defined('ABSPATH')){ die('Hacking Attempt!'); } // Cron for Calling Auto Backup add_action('backuply_auto_backup_cron', 'backuply_auto_backup_execute'); // Auto Backup using custom cron if(isset($_GET['action']) && $_GET['action'] == 'backuply_custom_cron'){ if(!backuply_verify_self(sanitize_text_field(wp_unslash($_REQUEST['backuply_key'])))){ backuply_status_log('Security Check Failed', 'error'); die(); } backuply_auto_backup_execute(); } // Adds a Wp-Cron for autobackup if(!function_exists('backuply_add_auto_backup_schedule')){ function backuply_add_auto_backup_schedule($schedule = '') { global $backuply; if(empty($schedule)){ $schedule = backuply_optpost('backuply_cron_schedule'); } if (!wp_next_scheduled( 'backuply_auto_backup_cron' ) && !empty($backuply['bcloud_key'])){ wp_schedule_event(time(), $schedule, 'backuply_auto_backup_cron'); } } } // Initiates auto backup if(!function_exists('backuply_auto_backup_execute')){ function backuply_auto_backup_execute(){ global $backuply; if(empty($backuply['bcloud_key'])){ return false; } $access_key = backuply_bcloud_isallowed(); if(empty($access_key)){ return; } //$backuply['auto_backup'] = true; backuply_create_log_file(); if($auto_backup_settings = get_option('backuply_cron_settings')){ $auto_backup_settings['auto_backup'] = true; update_option('backuply_status', $auto_backup_settings); backuply_backup_execute(); } } } // Rotate the backups if(!function_exists('backuply_backup_rotation')){ function backuply_backup_rotation() { global $backuply; if(empty($backuply['status']['backup_rotation'])) { return; } $backup_info = backuply_get_backups_info(); if(empty($backup_info)) { return; } $backup_info = array_filter($backup_info, 'backuply_bcloud_filter_backups_on_loc'); usort($backup_info, 'backuply_bcloud_oldest_backup'); if(count($backup_info) >= $backuply['status']['backup_rotation']) { if(empty($backup_info[0])) { return; } backuply_log('Deleting Files because of Backup rotation'); backuply_status_log('Deleting backup because of Backup rotation', 39); $extra_backups = count($backup_info) - $backuply['status']['backup_rotation']; if($extra_backups > 0) { for($i = 0; $i < $extra_backups; $i++) { backuply_delete_backup($backup_info[$i]->name .'.'. $backup_info[$i]->ext); } } } } } function backuply_bcloud_oldest_backup($a, $b) { return (int) $a->btime - (int) $b->btime; } // Returns backups based on location function backuply_bcloud_filter_backups_on_loc($backup) { global $backuply; if(!isset($backup->backup_location)){ return ($backup->auto_backup); } return ($backuply['status']['backup_location'] == $backup->backup_location && $backup->auto_backup); } function backuply_bcloud_isallowed(){ global $backuply; if(!empty(get_transient('bcloud_data'))){ return true; } $url = BACKUPLY_API . '/cloud/token.php'; // Check if License is present and active. if(empty($backuply['license']['license'] || empty($backuply['license']['active']))){ return false; } // Check if Bcloud key is there. if(empty($backuply['bcloud_key'])){ return false; } $args = array( 'sslverfiy' => false, 'body' => array( 'license' => $backuply['license']['license'], 'bcloud_key' => $backuply['bcloud_key'], 'url' => site_url() ), 'timeout' => 30 ); $res = wp_remote_post($url, $args); if(empty($res) && is_wp_error($res)){ return false; } if(empty($res['body'])){ return false; } $body = json_decode($res['body'], true); if(empty($body['success'])){ return false; } return true; } promo.php 0000644 00000040756 15104541006 0006421 0 ustar 00 <?php if(!defined('ABSPATH')){ die(); } echo ' <style> .backuply_button { background-color: #4CAF50; /* Green */ border: none; color: white; padding: 8px 16px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; -webkit-transition-duration: 0.4s; /* Safari */ transition-duration: 0.4s; cursor: pointer; } .backuply_button:focus{ border: none; color: white; } .backuply_button1 { color: white; background-color: #4CAF50; border:3px solid #4CAF50; } .backuply_button1:hover { box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 9px 25px 0 rgba(0,0,0,0.19); color: white; border:3px solid #4CAF50; } .backuply_button2 { color: white; background-color: #0085ba; } .backuply_button2:hover { box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 9px 25px 0 rgba(0,0,0,0.19); color: white; } .backuply_button3 { color: white; background-color: #365899; } .backuply_button3:hover { box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 9px 25px 0 rgba(0,0,0,0.19); color: white; } .backuply_button4 { color: white; background-color: rgb(66, 184, 221); } .backuply_button4:hover { box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 9px 25px 0 rgba(0,0,0,0.19); color: white; } .backuply_promo-close{ float:right; text-decoration:none; margin: 5px 10px 0px 0px; } .backuply_promo-close:hover{ color: red; } #backuply_promo li { list-style-position: inside; list-style-type: circle; } .backuply-loc-types { display:flex; flex-direction: row; align-items:center; flex-wrap: wrap; } .backuply-loc-types li{ list-style-type:none !important; margin-right: 10px; } .backuply-free-trial{ position:relative; width:99%; background-color: #000; color:#FFF; font-weight:500; border-radius:4px; padding:20px; box-sizing:border-box; margin-top: 10px; } .backuply-promo-dismiss{ position:absolute; top:10px; right:10px; color:white; } </style> <script> jQuery(document).ready( function() { (function($) { $("#backuply_promo .backuply_promo-close").click(function(){ var data; // Hide it $("#backuply_promo").hide(); // Save this preference $.post("'.admin_url('?backuply_promo=0').'&security='.wp_create_nonce('backuply_promo_nonce').'", data, function(response) { //alert(response); }); }); $("#backuply_offer .backuply_offer-close").click(function(){ var data; // Hide it $("#backuply_offer").hide(); // Save this preference $.post("'.admin_url('?backuply_offer=0').'&security='.wp_create_nonce('backuply_promo_nonce').'", data, function(response) { //alert(response); }); }); $("#backuply_holiday_promo .backuply_promo-close").click(function(){ var data; // Hide it $("#backuply_holiday_promo").hide(); // Save this preference $.post("'.admin_url('?backuply_holiday_promo=0').'&security='.wp_create_nonce('backuply_promo_nonce').'", data, function(response) { //alert(response); }); }); $("#backuply_license_notice .backuply_promo-close").click(function(){ var data; // Hide it $("#backuply_license_notice").hide(); // Save this preference $.post("'.admin_url('?backuply_license_notice=0').'&security='.wp_create_nonce('backuply_promo_nonce').'", data, function(response) { //alert(response); }); }); $("#backuply-litespeed-notice .backuply_promo-close").on("click", function(){ var data; // Hide it $("#backuply-litespeed-notice").hide(); // Save this preference $.post("'.admin_url('admin-ajax.php?action=backuply_close_litespeed_notice').'&security='.wp_create_nonce('backuply_promo_nonce').'", data, function(response) { //alert(response); }); }); })(jQuery); }); </script>'; function backuply_base_promo(){ echo '<div class="notice notice-success" id="backuply_promo" style="min-height:120px; background-color:#FFF; padding: 10px;"> <a class="backuply_promo-close" href="javascript:" aria-label="Dismiss this Notice"> <span class="dashicons dashicons-dismiss"></span> Dismiss </a> <table> <tr> <th> <img src="'.BACKUPLY_URL.'/assets/images/backuply-square.png" style="float:left; margin:10px 20px 10px 10px" width="100" /> </th> <td> <p style="font-size:16px;">You have been using Backuply for few days and we hope we were able to add some value through Backuply. </p> <p style="font-size:16px"> If you like our plugin would you please show some love by doing actions like </p> <p> <a class="backuply_button backuply_button1" target="_blank" href="https://backuply.com/pricing">Upgrade to Pro</a> <a class="backuply_button backuply_button2" target="_blank" href="https://wordpress.org/support/view/plugin-reviews/backuply">Rate it 5★\'s</a> <a class="backuply_button backuply_button3" target="_blank" href="https://www.facebook.com/backuply/">Like Us on Facebook</a> <a class="backuply_button backuply_button4" target="_blank" href="https://twitter.com/intent/tweet?text='.rawurlencode('I use @wpbackuply to backup my #WordPress site - https://backuply.com').'">Tweet about Backuply</a> </p> </td> </tr> </table> </div>'; } function backuply_holiday_offers(){ $time = date('nj'); if($time == 1225 || $time == 1224){ backuply_christmas_offer(); } if($time == 11){ backuply_newyear_offer(); } } function backuply_christmas_offer(){ echo '<div class="notice notice-success" id="backuply_holiday_promo" style="min-height:120px; background-color:#FFF; padding: 10px;"> <a class="backuply_promo-close" href="javascript:" aria-label="Dismiss this Notice"> <span class="dashicons dashicons-dismiss"></span> Dismiss </a> <table> <tr> <th> <img src="'.BACKUPLY_URL.'/assets/images/25off.png" style="float:left; margin:10px 20px 10px 10px" width="100" /> </th> <td><h2>Backuply Wishes you Merry Christmas 🎄</h2> <p style="font-size:16px">We are offering 25% off on every Backuply Plan today, so upgrade to Backuply Pro now and forget the need to create backups manully with Backuply\'s Auto Backups.</p> <a class="backuply_button backuply_button1" target="_blank" href="https://backuply.com/pricing">Upgrade to Pro</a> </td> </tr> </table> </div>'; } function backuply_newyear_offer(){ echo '<div class="notice notice-success" id="backuply_holiday_promo" style="min-height:120px; background-color:#FFF; padding: 10px;"> <a class="backuply_promo-close" href="javascript:" aria-label="Dismiss this Notice"> <span class="dashicons dashicons-dismiss"></span> Dismiss </a> <table> <tr> <th> <img src="'.BACKUPLY_URL.'/assets/images/25off.png" style="float:left; margin:10px 20px 10px 10px" width="100" /> </th> <td><h2>Backuply Wishes you a Happy New Year 🎉</h2> <p style="font-size:16px">We are offering 25% off on every Backuply Plan today, so upgrade to Backuply Pro now and forget the need to create backups manully with Backuply\'s Auto Backups.</p> <a class="backuply_button backuply_button1" target="_blank" href="https://backuply.com/pricing">Upgrade to Pro</a> </td> </tr> </table> </div>'; } function backuply_litespeed_notice(){ echo '<div class="notice notice-info" id="backuply-litespeed-notice"> <a class="backuply_promo-close" href="javascript:" aria-label="Dismiss this Notice"> <span class="dashicons dashicons-dismiss"></span> Dismiss for 30 days </a> <p>'.esc_html__('Your website is running on LiteSpeed server, it might cause issue creating a backup, please', 'backuply').' <a href="https://backuply.com/docs/common-issues/litespeed-killing-process/" target="_blank">follow this guide to fix this issue.</a></p> </div>'; } function backuply_free_trial(){ global $backuply, $error; $has_license = false; if(defined('BACKUPLY_PRO') && !empty($backuply['license']['license'])){ $has_license = true; } $verification_wait = false; if(empty($backuply['bcloud_key']) && !empty($_GET['license']) && !empty($_GET['token'])){ if($_GET['token'] !== get_transient('bcloud_trial_token')){ $error[] = 'Your Security Check failed!'; } else { delete_transient('bcloud_trial_token'); $license = sanitize_text_field($_GET['license']); if(!empty($backuply['license'])){ $error[] = __('You already have a license linked to this WordPress install, you dont need trial license you can directly add Backuply Cloud', 'backuply'); } backuply_update_trial_license($license); if(empty($error)){ $verification_wait = true; } } } $token = wp_generate_password(32,false); set_transient('bcloud_trial_token', $token, 3600); echo '<div class="notice notice-success" id="backuply_free-trial" style="min-height:120px; background-color:#FFF; padding: 10px;"> <a class="backuply_promo-close" href="javascript:" aria-label="Dismiss this Notice"> <span class="dashicons dashicons-dismiss"></span> Dismiss </a> <table> <tr> <th> <img src="'.BACKUPLY_URL.'/assets/images/backuply-square.png" style="float:left; margin:10px 20px 10px 10px" width="100" /> </th> <td> <p style="font-size:16px; font-weight:bold;">Stress free backups in Cloud</p> <p style="font-size:16px">'; if(defined('BACKUPLY_PRO')){ echo 'With Backuply Pro you get 10GB free storage on Backuply Cloud. Start backing up your website today !<br> Backuply Cloud is a secure and reliable cloud backup service that makes it easy to protect your website data.'; } else { echo 'Try Backuply Cloud for free for 30 days with 10GB of storage. With just a click store your WordPress backups on our Cloud. Backups are the best form of security, never lose your data with Backuply Cloud.'; } echo '</p> <button class="button button-primary" id="backuply-cloud-trial">Try Now</button> </td> </tr> </table> </div> <div id="bcloud-dialog" title="Backuply Cloud Trial" style="display:none;"> <div class="backuply-cloud-state"> <div class="bcloud-trial-email" '.(!empty($has_license) || !empty($verification_wait) ? esc_html('style=display:none;') : '').'> <h2>Get a Trial License</h2> <p>Click on the button below and you will be redirected <b>backuply.com</b> to register for a Trail License</p> <a href="'.BACKUPLY_API . '/cloud/new_account.php?token='.esc_attr($token).'&callback='.admin_url('admin.php?page=backuply').'" class="button button-primary backuply-email-link">Create a Trial License</a> <p><input type="checkbox" id="backuply_has_license"/>I have a License</p> </div> <div class="backuply-bcloud-trial-verify" '.(empty($verification_wait) ? esc_html('style=display:none;') : '').'> <p>A trial license has been created please go to your email and verify</p> <p>If you have completed the verification then</p> <input type="checkbox" name="backuply-verify-checkbox" id="backuply-verify-checkbox"/>I confirm that I have verified email <button class="button button-primary backuply-verify-email" disabled>Click here</button><span class="spinner"></span> </div> <div class="bcloud-trial-license" '.(empty($has_license) ? esc_html('style=display:none;') : '').'> <h2>Enter your License</h2> <p>Your License will be used to generate a key to connect to Backuply Cloud</p> <input type="text" style="width:100%" value="'.(empty($backuply['license']) || empty($backuply['license']['license']) ? '' : esc_attr($backuply['license']['license'])).'" placeholder="BAKLY-00000-11111-22222-44444" name="backuply_license"/><br/>'; if(!defined('BACKUPLY_PRO')){ echo '<p><input type="checkbox" id="backuply_no_license"/>Does not have a license</p>'; } echo '<button class="button button-primary backuply-license-link" style="margin-top:10px;">Submit</button><span class="spinner"></span> </div> </div>'; if(!empty($backuply['cron'])){ echo '<div class="backuply-cloud-trial-settings" style="display:none;"> <h3>Updating Settings</h3> <p>We have detected that you have a default storage and schedule already set. Do you want to set Backuply Cloud as your default backup location ?</p> <div style="text-align:center;"> <button class="button button-primary backuply-default-yes">Yes</button> <button class="button backuply-default-no">No</button> </div> </div>'; } echo ' <div class="backuply-cloud-state" style="text-align:center; display:none;"> <p>Integration has been successful now you can try creating Backup on Backuply Cloud</p> <a href="'.admin_url('admin.php?page=backuply').'" class="button button-primary">Start Creating Backups to Backuply Cloud</a> </div> </div> '; } function backuply_promo_scripts(){ wp_enqueue_script('backuply-promo', BACKUPLY_URL . '/assets/js/promo.js', array('jquery', 'jquery-ui-dialog'), BACKUPLY_VERSION); wp_enqueue_style('backuply-dialog', BACKUPLY_URL . '/assets/css/base-jquery-ui.css', [], BACKUPLY_VERSION); wp_localize_script('backuply-promo', 'backuply_promo', array( 'nonce' => wp_create_nonce('backuply_trial_nonce'), 'ajax' => admin_url('admin-ajax.php') )); } function backuply_update_trial_license($license){ global $backuply, $error; $resp = wp_remote_get(BACKUPLY_API.'/license.php?license='.$license.'&url='.rawurlencode(site_url()), array('timeout' => 30)); $json = json_decode($resp['body'], true); if(empty($json['license'])){ $error[] = __('There was issue fetching License details', 'backuply'); } $backuply['license'] = $json; update_option('backuply_license', $backuply['license']); } function backuply_regular_offer(){ // The time period this should be visible to the users. if(time() > strtotime('20 October 2023')){ return; } echo '<div class="notice notice-success" id="backuply_offer" style="min-height:120px; background-color:#FFF; padding: 10px;"> <a class="backuply_offer-close" href="javascript:" aria-label="Dismiss this Notice"> <span class="dashicons dashicons-dismiss"></span> Dismiss for 6 months </a> <table> <tr> <th> <img src="'.BACKUPLY_URL.'/assets/images/30off.png" style="float:left; margin:10px 20px 10px 10px" width="100" /> </th> <td><p style="font-size:16px">Backuply is offering a 30% discount on all subscription plans today! Upgrade to Backuply Pro and receive up to 100 GB of cloud storage, and forget about manually creating backups with our automatic backups feature. Use the code <strong>NEW30</strong> to receive this offer.</p> <a class="backuply_button backuply_button1" target="_blank" href="https://backuply.com/pricing">Upgrade to Pro</a> </td> </tr> </table> </div> </div>'; } function backuply_check_expires(){ global $backuply; // We do not want to show the expiry notice if the license is by SoftWP. if(!empty($backuply['license']) && !empty($backuply['license']['has_plid'])){ return; } $current_timestamp = time(); $expiration_timestamp = strtotime($backuply['license']['expires']); $time_diff = $expiration_timestamp - $current_timestamp; // Renew link $backuply_user_license = $backuply['license']['license']; $backuply_user_plan = $backuply['license']['plan']; $backuply_renew_url = 'https://www.softaculous.com/clients?ca=backuply_buy&plan=' . $backuply_user_plan . '&license=' . $backuply_user_license; if($time_diff > 0 && $time_diff <= WEEK_IN_SECONDS){ $human_time = human_time_diff($current_timestamp, $expiration_timestamp); echo '<div class="notice notice-error" id="backuply_license_notice"> <a class="backuply_promo-close" href="javascript:" aria-label="Dismiss this Notice"> <span class="dashicons dashicons-dismiss"></span> '.esc_html__('Dismiss for 60 days', 'backuply').' </a> <p>' . sprintf(esc_html__('Alert : Your Backuply license will expire in %s. Renew to keep getting updates!', 'backuply'), esc_html($human_time)).' <a href="' . esc_url($backuply_renew_url) . '" target="_blank">' . esc_html__('Click here to renew', 'backuply') . '</a> </p> </div>'; } else if($time_diff <= 0){ echo '<div class="notice notice-error" id="backuply_license_notice"> <a class="backuply_promo-close" href="javascript:" aria-label="Dismiss this Notice"> <span class="dashicons dashicons-dismiss"></span> '.esc_html__('Dismiss for 60 days', 'backuply').' </a> <p>' . esc_html__('Alert: Your Backuply license has expired. Please renew immediately to keep getting updates ', 'backuply').' <a href="' . esc_url($backuply_renew_url) . '" target="_blank">' . esc_html__('Click here to renew', 'backuply') . '</a></p> </div>'; } } redirectmanager.php 0000644 00000015627 15105331773 0010431 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SITSEO Team */ namespace SiteSEOPro; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class RedirectManager{ static function handle_404_request(){ global $siteseo, $wpdb; // Toggle if(empty($siteseo->pro['toggle_state_redirect_monitoring'])){ return; } // Disable if(!empty($siteseo->pro['guess_redirect'])){ remove_filter('template_redirect', 'redirect_guess_404_permalink'); } if(!is_404() || empty($siteseo->pro['enable_404_log'])){ return; } $log_limit = !empty($siteseo->pro['log_limits']) ? $siteseo->pro['log_limits'] : ''; $redirect_to = !empty($siteseo->pro['redirect_type']) ? $siteseo->pro['redirect_type'] : ''; $custom_url = !empty($siteseo->pro['custom_redirect_url']) ? $siteseo->pro['custom_redirect_url'] : ''; $status_code = !empty($siteseo->pro['status_code']) ? $siteseo->pro['status_code'] : ''; $disable_ip_logging = !empty($siteseo->pro['disable_ip_logging']) ? $siteseo->pro['disable_ip_logging'] : ''; $redirect_url = $redirect_to === 'homepage' ? home_url() : $custom_url; $current_url = sanitize_url($_SERVER['REQUEST_URI']); // TODO:: Need to make it more robust to make sure we always get an IP. $current_request_ip = $_SERVER['REMOTE_ADDR']; $current_request_ip = filter_var($current_request_ip, FILTER_VALIDATE_IP); if($current_request_ip){ switch($disable_ip_logging){ case 'no_ip_logging': $current_request_ip = null; break; case 'anonymize_the_last_part': // TODO:: Handle IPv6 $ip_parts = explode('.', $current_request_ip); $ip_parts[count($ip_parts) - 1] = 'xxx'; $current_request_ip = implode('.', $ip_parts); break; } } else { $current_request_ip = null; } if(!empty($siteseo->pro['enable_404_log'])){ \SiteSEOPro\Settings\Util::maybe_create_404_table(); $existing_record = $wpdb->get_row($wpdb->prepare("SELECT id, hit_count FROM `".$wpdb->prefix."siteseo_redirect_logs` WHERE url = %s", $current_url)); if($existing_record){ // hit count increase $wpdb->update($wpdb->prefix.'siteseo_redirect_logs', ['hit_count' => intval($existing_record->hit_count + 1)], ['id' => $existing_record->id], ['%d'], ['%d']); } else{ $current_records = $wpdb->get_var("SELECT COUNT(*) FROM `".$wpdb->prefix."siteseo_redirect_logs`"); if($current_records >= $log_limit){ $wpdb->query("DELETE FROM `".$wpdb->prefix."siteseo_redirect_logs` ORDER BY `timestamp` ASC LIMIT 1"); } $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? sanitize_text_field($_SERVER['HTTP_USER_AGENT']) : ''; $referer = isset($_SERVER['HTTP_REFERER']) ? sanitize_url($_SERVER['HTTP_REFERER']) : ''; $wpdb->insert($wpdb->prefix .'siteseo_redirect_logs', ['url' => $current_url, 'ip_address' => $current_request_ip, 'user_agent' => $user_agent, 'referer' => $referer, 'hit_count' => 1,'timestamp' => current_time('mysql')], ['%s', '%s', '%s', '%s', '%d', '%s']); } } // redirect here if(!empty($redirect_url)){ wp_redirect($redirect_url, intval($status_code)); exit; } } static function setup_log_scheduled(){ global $siteseo; if(empty($siteseo->pro['email_notify'])){ return; } if(!wp_next_scheduled('siteseo_send_404_report_email')){ wp_schedule_event(time(), 'weekly', 'siteseo_send_404_report_email'); } } static function send_weekly_report(){ global $siteseo, $wpdb; if(empty($siteseo->pro['email_notify'])){ return; } $site_name = get_bloginfo('name'); $site_url = get_bloginfo('url'); $admin_email = get_option('admin_email'); $user_email = !empty($siteseo->pro['send_email_to']) ? $siteseo->pro['send_email_to'] : $admin_email; $admin_user = get_user_by('email', $admin_email); $admin_name = $admin_user ? $admin_user->display_name : 'Administrator'; if(empty($user_email)){ return; } $top_errors = $wpdb->get_results("SELECT url, hit_count, COUNT(*) as count FROM `{$wpdb->prefix}siteseo_redirect_logs` GROUP BY url ORDER BY hit_count DESC LIMIT 10"); $latest_errors = $wpdb->get_results("SELECT * FROM `{$wpdb->prefix}siteseo_redirect_logs` ORDER BY `timestamp` DESC LIMIT 10"); $subject = sprintf('404 Error Report for %s - Week of %s', $site_name, gmdate('F j, Y')); $content = sprintf( '<!DOCTYPE html> <html> <body> <div style="font-family: Arial, sans-serif; line-height: 1.6;"> <p>Hello %s,</p> <p>Here\'s your weekly 404 error report for %s. We\'ve identified several broken links that may need your attention.</p> <div style="margin: 25px 0;"> <h2>Weekly 404 Error Report for %s</h2> <p>Below are the most frequent and recent 404 errors detected on your site:</p> </div> <h3>Top 404 Errors</h3> <table style="border-collapse: collapse; width: 100%%;"> <tr style="background-color: #f2f2f2;"> <th style="border:1px solid #ddd; padding:8px; text-align:left;">URL</th> <th style="border:1px solid #ddd; padding:8px; text-align:center; width:200px;">Hit Count</th> </tr>', esc_html($admin_name), esc_html($site_name), esc_html($site_name) ); foreach($top_errors as $error){ $content .= sprintf( '<tr> <td style="border:1px solid #ddd; padding:8px; text-align:left"><a href="%s">%s</a></td> <td style="border:1px solid #ddd; padding:8px; text-align:center;">%d</td> </tr>', esc_url($site_url . $error->url), esc_html($error->url), intval($error->hit_count) ); } $content .= '</table> <h3>Latest 404 Errors</h3> <table style="border-collapse: collapse; width: 100%;"> <tr style="background-color: #f2f2f2;"> <th style="border:1px solid #ddd; padding:8px; text-align:left;">URL</th> <th style="border:1px solid #ddd; padding:8px; text-align:center; width:200px;">Timestamp</th> </tr>'; foreach($latest_errors as $error){ $content .= sprintf( '<tr> <td style="border:1px solid #ddd; padding:8px; text-align:left;"><a href="%s">%s</a></td> <td style="border:1px solid #ddd; padding:8px; text-align:center;">%s</td> </tr>', esc_url($site_url . $error->url), esc_html($error->url), esc_html(gmdate('F j, Y g:i a', strtotime($error->timestamp))) ); } $content .= '</table> <div style="margin-top:30px; padding-top:20px; border-top: 1px solid #ddd;"> <p style="margin-top:20px; font-size:12px; color:#666;"> This report was automatically generated on '.gmdate('F j, Y').' </p> <p style="font-size:14px; color:#444; margin-top:15px;"> Powered by <a href="https://siteseo.io" target="_blank" style="color:#163d89;text-decoration:none;"><strong>SiteSEO</strong></a> </p> </div> </body> </html>'; // Html $headers = array( 'Content-Type: text/html; charset=UTF-8', 'From: SiteSEO <'.get_option('admin_email').'>' ); // Send email return wp_mail($user_email, $subject, $content, $headers); } } registerblocks.php 0000644 00000003114 15105331773 0010303 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEOPro; class RegisterBlocks{ static function init(){ global $siteseo; $settings = $siteseo->pro; $advanced_option = get_option('siteseo_advanced_option_name'); $settings = isset($settings['breadcrumbs_enable']) ? $settings : $advanced_option; if(!empty($settings['breadcrumbs_enable'])){ self::breadcrumbs(); } } static function breadcrumbs(){ global $siteseo; $settings = $siteseo->pro; $advanced_option = get_option('siteseo_advanced_option_name'); $settings = isset($settings['breadcrumbs_enable']) ? $settings : $advanced_option; // Register Breadcrumbs block register_block_type(SITESEO_PRO_ASSETS_PATH . '/js/breadcrumbs/build', [ 'category' => 'siteseo', 'render_callback' => '\SiteSEOPro\Breadcrumbs::render_block', 'attributes' => [ 'hideHome' => [ 'type' => 'boolean', 'default' => (!empty($settings) && !empty($settings['breadcrumbs_home']) ? true : false), ], 'homeLabel' => [ 'type' => 'string', 'default' => (!empty($settings) && !empty($settings['breadcrumb_home_label']) ? esc_html($settings['breadcrumb_home_label']) : esc_html__('Home', 'siteseo-pro')), ], 'seperator' => [ 'type' => 'string', 'default' => \SiteSEOPro\Breadcrumbs::seperator(), ], 'prefix' => [ 'type' => 'string', 'default' => (!empty($settings) && !empty($settings['breadcrumb_prefix']) ? esc_html($settings['breadcrumb_prefix']) : ''), ], ] ]); wp_set_script_translations('siteseo/breadcrumbs', 'siteseo'); } } structureddata.php 0000644 00000032126 15105331773 0010324 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SITSEO Team */ namespace SiteSEOPro; if(!defined('ABSPATH')){ die('Hacking Attempt !'); } class StructuredData{ static function enqueue_metabox(){ $post_id = get_the_ID(); wp_enqueue_style('siteseo-structured-data-metabox', SITESEO_PRO_ASSETS_URL.'/css/metabox.css'); wp_enqueue_script('siteseo-index-highlight', SITESEO_PRO_ASSETS_URL.'/js/index-highlight.js', ['jquery'], SITESEO_PRO_VERSION); wp_enqueue_script('siteseo-structured-data-metabox', SITESEO_PRO_ASSETS_URL.'/js/metabox.js', ['jquery'], SITESEO_PRO_VERSION); wp_localize_script('siteseo-structured-data-metabox', 'structuredDataMetabox', [ 'propertyTemplates' => \SiteSEOPro\StructuredData::get_schema_properties(), 'currentPostUrl' => get_permalink($post_id) ]); } static function display_metabox(){ global $post; if(is_front_page() || is_home()){ $post_id = get_option('page_on_front'); if(!$post_id && is_home()){ $post_id = get_option('page_for_posts'); } } else{ $post_id = $post ? $post->ID : 0; } if(!empty($post_id)){ $schema_type = !empty(get_post_meta($post_id, '_siteseo_structured_data_type', true)) ? get_post_meta($post_id, '_siteseo_structured_data_type', true) : ''; $schema_properties = !empty(get_post_meta($post_id, '_siteseo_structured_data_properties', true)) ? get_post_meta($post_id, '_siteseo_structured_data_properties', true) : ''; $custom_schema = !empty(get_post_meta($post_id, '_siteseo_structured_data_custom', true)) ? get_post_meta($post_id, '_siteseo_structured_data_custom', true) : ''; } $schema_types['Article'] = 'Article'; $schema_types['NewsArticle'] = 'News Article'; $schema_types['Blogposting'] = 'Blog post'; $schema_types['Product'] = 'Product'; $schema_types['Recipe'] = 'Recipe'; $schema_types['Restaurant'] = 'Restaurant'; $schema_types['Course'] = 'Course'; $schema_types['LocalBusiness'] = 'Local Business'; $schema_types['Person'] = 'Person'; $schema_types['Organization'] = 'Organization'; $schema_types['Book'] = 'Book Recording'; $schema_types['MusicRecording'] = 'Music Album'; $schema_types['SoftwareApplication'] = 'Software Application'; $schema_types['VideoObject'] = 'Video'; $schema_types['Event'] = 'Event'; $schema_types['JobPosting'] = 'Job Posting'; $schema_types['CustomSchema'] = 'Custom Schema'; $custom_schema_placeholder = json_encode([ 'type' => 'object', 'properties' => [ 'placeholder' => ['type' => 'string'], 'description' => ['type' => 'integer'] ] ], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); echo'<div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_structured_data_type">'.esc_html__('Select Schema Types','siteseo-pro').'</label> </div> <div class="siteseo-metabox-input-wrap"> <select name="siteseo_structured_data_type" class="siteseo_structured_data_type" id="siteseo_structured_data_type"> <option value="">'.esc_html__('None', 'siteseo-pro').'</option>'; foreach($schema_types as $type => $label){ echo '<option value="'.esc_attr($type).'" '.selected($schema_type, $type, false).'>'.esc_html($label).'</option>'; } echo'</select> </input> </div> </div>'; $schema_template = self::get_schema_properties(); echo'<div class="siteseo-metabox-schema" id="siteseo_schema_properties_container" class="'.(empty($schema_type) || $schema_type === 'CustomSchema' ? 'hidden' : '').'"> <div class="siteseo-schema-properties">'; if(!empty($schema_type) && isset($schema_template[$schema_type]) && $schema_type !== 'CustomSchema'){ $is_textarea = ['description', 'instructions', 'reviewBody', 'questions', 'step', 'ingredients', 'recipeInstructions', 'courseDescription', 'bookDescription', 'softwareRequirements', 'menu', 'name']; $is_date_type = ['datePublished', 'dateModified', 'uploadDate', 'startDate', 'endDate', 'foundingDate', 'releaseDate']; foreach($schema_template[$schema_type] as $property => $default){ echo '<p><h4 for="siteseo_schema_property_'.esc_attr($property).'">'.esc_html(ucfirst(preg_replace('/([a-z])([A-Z])/', '$1 $2', $property))).':</h4>'; if(in_array($property, $is_textarea)){ echo '<textarea name="schema_properties['.esc_attr($property).']" id="siteseo_schema_property_' .esc_attr($property).'" rows="3" class="widefat">'.esc_textarea(isset($schema_properties[$property]) ? $schema_properties[$property] : '').'</textarea>'; } else if(in_array($property, $is_date_type)){ echo '<input type="datetime-local" name="schema_properties['.esc_attr($property).']" id="siteseo_schema_property_'.esc_attr($property).'" value="' .esc_attr(isset($schema_properties[$property]) ? $schema_properties[$property] : '').'" class="widefat">'; } else { echo '<input type="text" name="schema_properties['.esc_attr($property).']" id="siteseo_schema_property_'.esc_attr($property).'" value="' .esc_attr(isset($schema_properties[$property]) ? $schema_properties[$property] : '').'" class="widefat">'; } echo '</p>'; } } echo '</div> </div> <div id="siteseo_custom_schema_container" class="'.($schema_type !== 'CustomSchema' ? 'hidden' : '').'"> <h4>'.esc_html__('Custom Schema', 'siteseo-pro').'</h4> <p> <textarea name="siteseo_structured_data_custom" placeholder="'.esc_attr($custom_schema_placeholder).'" rows="10" class="siteseo_structured_data_custom widefat code">'. esc_textarea($custom_schema).'</textarea> </p> <p class="description">'. // translators: %1$s and %2$s are the opening and closing <a> tags around "Read here". sprintf(esc_html__('Create your custom schema as per guidelines. %1$sRead here%2$s.', 'siteseo-pro'), '<a href="https://schema.org/docs/schemas.html" target="_blank" rel="noopener noreferrer">', '</a>').'</p> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-schema-preview"> <h4>'.esc_html__('JSON-LD Preview', 'siteseo-pro').'</h4> <a class="button" id="siteseo_validate_schema">'.esc_html__('Google Validation', 'siteseo-pro').'</a> <pre id="siteseo_schema_preview" class="siteseo_schema_preview">'; if($schema_type === 'CustomSchema' && !empty($custom_schema)){ echo '<div id="siteseo_highlighter">'.esc_html($custom_schema).'</div>'; } elseif (!empty($schema_type) && !empty($schema_properties)){ $schema_data = array( '@context' => 'https://schema.org', '@type' => $schema_type ); foreach($schema_properties as $key => $value){ if(!empty($value)){ $schema_data[$key] = $value; } } echo'<div id="siteseo_highlighter" class="siteseo_highlighter">'.esc_html(json_encode($schema_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)).'</div>'; } else{ echo'<div>'.esc_html__('No schema has been selected.', 'siteseo-pro').'</div>'; } echo'</pre> </div> </div>'; } static function get_schema_properties(){ return [ 'Article'=> [ 'headline' => '', 'author' => '', 'datePublished' => '', 'dateModified' => '', 'publisher' => '', 'description' => '', ], 'Blogposting' => [ 'headline' => '', 'author' => '', 'datePublished' => '', 'dateModified' => '', 'publisher' => '', 'description' => '', ], 'Course' => [ 'name' => '', 'Description' => '', 'provider' => '', 'availableLanguage' => '', 'coursePrerequisites' =>'', 'courseCode' => '', 'hasCourseInstance' => '', 'timeRequired' => '', 'educationalCredentialAwarded' => '', ], 'MusicRecording' => [ 'name' => '', 'byArtist' => '', 'duration' => '', 'recordingOf' => '', 'inAlbum' => '', 'datePublished' => '', 'releasedEvent' => '', 'abstract' => '', ], 'Book' => [ 'name' => '', 'author' => '', 'bookEdition' => '', 'isbn' => '', 'publisher' => '', 'datePublished' => '', 'abstract' => '', 'inLanguage' => '', ], 'Restaurant' => [ 'name' => '', 'address' => '', 'hasMenu' => '', 'telephone' => '', 'priceRange' => '', 'openingHours' => '', ], 'SoftwareApplication' => [ 'name' => '', 'applicationCategory' => '', 'applicationSubCategory' => '', 'availableOnDevice' => '', 'operatingSystem' => '', 'softwareVersion' => '', 'softwareRequirements' => '', 'downloadUrl' => '', ], 'VideoObject' => [ 'name' => '', 'description' => '', 'thumbnailUrl' => '', 'uploadDate' => '', 'embedUrl' => '', 'publisher' =>'', 'creator' => '', ], 'Event' => [ 'name' => '', 'startDate' => '', 'endDate' => '', 'location' => '', 'description' => '', 'offers' => '', 'organizer' => '', 'performer' => '', ], 'Recipe' => [ 'name' => '', 'author' => '', 'description' => '', 'cookTime' => '', 'cookingMethod' => '', 'prepTime' => '', 'totalTime' => '', 'recipeYield' => '', 'recipeCategory' => '', 'recipeCuisine' => '', 'recipeInstructions' => '', ], 'Person' =>[ 'name' => '', 'jobTitle' => '', 'email' => '', 'telephone' => '', 'address' => '', ], 'Organization' => [ 'name' => '', 'url' =>'', 'description' => '', 'email' => '', 'founder' => '', 'foundingDate' => '', 'numberOfEmployees' => '', 'location' => '', ], 'JobPosting' =>[ 'name' => '', 'industry' => '', 'title' => '', 'totalJobOpenings' => '', 'skills' => '', 'jobBenefits' => '', 'jobLocationType' => '', ], 'NewsArticle' =>[ 'headline' => '', 'author' => '', 'datePublished' => '', 'dateModified' => '', 'publisher' => '', 'description' => '', ], 'Product' =>[ 'name' => '', 'description' => '', 'brand' => '', 'category' => '', 'releaseDate' => '', 'size' => '', ], 'LocalBusiness' =>[ 'legalName' => '', 'founder' => '', 'address' => '', 'email' => '', 'numberOfEmployees' => '', 'telephone' => '', 'taxID' => '', 'vatID' => '', ], ]; } static function save_metabox($post_id, $post){ // Security Check if(!isset($_POST['siteseo_metabox_nonce']) || !wp_verify_nonce(sanitize_text_field($_POST['siteseo_metabox_nonce']), 'siteseo_metabox_nonce')){ return $post_id; } //Post type object $post_type = get_post_type_object($post->post_type); //Check permission if(!current_user_can($post_type->cap->edit_post, $post_id)){ return $post_id; } if(isset($_POST['siteseo_structured_data_type'])){ update_post_meta($post_id, '_siteseo_structured_data_type', sanitize_text_field($_POST['siteseo_structured_data_type'])); } else{ delete_post_meta($post_id, '_siteseo_structured_data_type'); } if(isset($_POST['siteseo_structured_data_custom'])){ update_post_meta($post_id, '_siteseo_structured_data_custom', wp_kses_post($_POST['siteseo_structured_data_custom'])); } else{ delete_post_meta($post_id, '_siteseo_structured_data_custom'); } if(isset($_POST['schema_properties']) && is_array($_POST['schema_properties'])){ $properties = array(); $text_area_fields = array('description', 'instructions', 'reviewBody', 'questions', 'step', 'ingredients','recipeInstructions', 'courseDescription', 'bookDescription', 'softwareRequirements', 'menu'); foreach($_POST['schema_properties'] as $key => $value){ if(in_array($key, $text_area_fields)){ $properties[$key] = sanitize_textarea_field($value); } else{ $properties[$key] = sanitize_text_field($value); } } update_post_meta($post_id, '_siteseo_structured_data_properties', $properties); } else{ delete_post_meta($post_id, '_siteseo_structured_data_properties'); } } static function render(){ global $siteseo, $post; if(empty($siteseo->pro['enable_structured_data']) || empty($siteseo->pro['toggle_state_stru_data'])){ return; // disable } if(!is_singular()){ return; } $schema_type = !empty(get_post_meta($post->ID , '_siteseo_structured_data_type', true)) ? get_post_meta($post->ID, '_siteseo_structured_data_type', true) : ''; if($schema_type === 'CustomSchema'){ $custom_schema = !empty(get_post_meta($post->ID , '_siteseo_structured_data_custom', true)) ? get_post_meta($post->ID, '_siteseo_structured_data_custom', true) : ''; if(!empty($custom_schema)){ echo'<script type="application/ld+json">'.json_encode($custom_schema, JSON_UNESCAPED_SLASHES).'</script>' . "\n"; } } else { $schema_properties = !empty(get_post_meta($post->ID, '_siteseo_structured_data_properties', true)) ? get_post_meta($post->ID, '_siteseo_structured_data_properties', true) : ''; if(!empty($schema_type) && is_array($schema_properties)){ $schema_data = array( '@context' => 'https://schema.org', '@type' => $schema_type ); foreach($schema_properties as $key => $value){ if(!empty($value)){ $schema_data[$key] = $value; } } echo'<script type="application/ld+json">'.json_encode($schema_data, JSON_UNESCAPED_SLASHES).'</script>' . "\n"; } } } } settings/license.php 0000644 00000011457 15105331773 0010554 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SITSEO Team */ namespace SiteSEOPro\Settings; // Are we being accessed directly ? if(!defined('ABSPATH')){ die('Hacking Attempt !'); } // license page display class License{ static function template(){ global $siteseo; // Add header if(function_exists('siteseo_admin_header')){ siteseo_admin_header(); } if(isset($_REQUEST['save_siteseo_pro_license'])){ self::save(); } echo '<div class="siteseo-license-tab"> <div class="siteseopro-setting-content"> <div class="siteseopro-tab-group"> <table class="wp-list-table fixed striped users siteseopro-license-table" cellspacing="1" border="0" width="78%" cellpadding="10" align="center"> <tbody> <tr> <th align="left" width="25%">' . esc_html__('Siteseo Version', 'siteseo-pro') . '</th> <td>' . (defined('SITESEO_PRO_VERSION') ? esc_html(SITESEO_PRO_VERSION) . ' (Pro Version)' : 'N/A') . '</td> </tr> <tr> <th align="left" valign="top">' . esc_html__('Siteseo License', 'siteseo-pro') . '</th> <td align="left"> <form method="post" action=""> <span style="color:red">' . (defined('SITESEO_PRO_VERSION') && empty($siteseo->license['active']) ? '<span style="color:red">Unlicensed</span> ' : '') . '</span> <input type="hidden" name="siteseo_pro_license_nonce" value="' . wp_create_nonce('siteseo_pro_license') . '"/> <input type="text" name="siteseo_pro_license" value="' . (empty($siteseo->license['license']) ? (empty($_POST['siteseo_pro_license']) ? '' : sanitize_text_field($_POST['siteseo_pro_license'])) : sanitize_text_field($siteseo->license['license'])) . '" size="30" placeholder="e.g. SITESEO-11111-22222-33333-44444" style="width:300px;"> <br><br><input name="save_siteseo_pro_license" class="siteseopro-btn siteseopro-btn-primary" value="Update License" type="submit"> </form>'; if(!empty($siteseo->license)){ $expires = $siteseo->license['expires']; $expires = substr($expires, 0, 4) . '/' . substr($expires, 4, 2) . '/' . substr($expires, 6); echo '<div style="margin-top:10px;">License Status : ' . (empty($siteseo->license['status_txt']) ? 'N.A.' : wp_kses_post($siteseo->license['status_txt'])) . ' ' . ($siteseo->license['expires'] <= gmdate('Ymd') ? 'License Expires : <span style="color:red">' . esc_attr($expires) . '</span>' : (empty($siteseo->license['has_plid']) ? 'License Expires : ' . esc_html($expires) : '')) . '</div>'; } echo '</td> </tr> <tr> <th align="left">URL</th> <td>' . esc_url(get_site_url()) . '</td> </tr> <tr> <th align="left">Path</th> <td>' . esc_html(ABSPATH) . '</td> </tr> <tr> <th align="left">Server\'s IP Address</th> <td>' . esc_html($_SERVER['SERVER_ADDR']) . '</td> </tr> <tr> <th align="left">.htaccess is writable</th> <td>' . (is_writable(ABSPATH . '.htaccess') ? '<span style="color:red">Yes</span>' : '<span style="color:green">No</span>') . '</td> </tr> </tbody> </table> </div> </div> </div>'; } static function save(){ global $siteseo, $lic_resp; if(!wp_verify_nonce($_POST['siteseo_pro_license_nonce'], 'siteseo_pro_license')){ echo '<div class="notice notice-error is-dismissible"><p>'; echo esc_html__('Security Check Failed', 'siteseo-pro'); echo '</p></div>'; return; } $license = sanitize_text_field(wp_unslash($_POST['siteseo_pro_license'])); if(empty($license)){ echo '<div style="margin-top:65px;" class="notice notice-error is-dismissible"><p>'; echo esc_html__('The license key was not submitted', 'siteseo-pro'); echo '</p></div>'; return; } siteseo_pro_load_license($license); if(is_wp_error($lic_resp) || 200 !== wp_remote_retrieve_response_code($lic_resp)){ if(is_wp_error($lic_resp)){ echo '<div style="margin-top:65px;" class="notice notice-error is-dismissible"><p>'; echo esc_html($lic_resp->get_error_message()); echo '</p></div>'; return; } else{ echo '<div style="margin-top:65px;" class="notice notice-error is-dismissible"><p>'; echo esc_html__('An error occurred, please try again. Response code: ', 'siteseo-pro') . esc_attr(wp_remote_retrieve_response_code($lic_resp)); echo '</p></div>'; return; } } else { $tmp = json_decode(wp_remote_retrieve_body($lic_resp), true); if(empty($tmp)){ echo '<div style="margin-top:65px;" class="notice notice-error is-dismissible"><p>'; echo esc_html__('The license key is invalid', 'siteseo-pro'); echo '</p></div>'; return; } echo'<div class="siteseo-notice is-success"> <p>'. esc_html__('Your license has been successfully activated!', 'siteseo-pro').' </p> </div>'; } } } settings/pro.php 0000644 00000270637 15105331773 0007741 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SITSEO Team */ namespace SiteSEOPro\Settings; // Are we being accessed directly ? if(!defined('ABSPATH')){ die('Hacking Attempt !'); } use \SiteSEOPro\Settings\PageSpeed; class Pro{ // Display page static function home(){ global $siteseo; echo '<div id="siteseo-root">'; if(function_exists('siteseo_admin_header')){ siteseo_admin_header(); } $current_tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : 'tab_siteseopro_woocommerce'; // Default tab $siteseopro_settings_tabs = [ 'tab_siteseopro_woocommerce' => esc_html__('WooCommerce', 'siteseo-pro'), 'tab_siteseopro_easydigital_downloads' => esc_html__('Easy Digital Downloads', 'siteseo-pro'), 'tab_siteseopro_pagespeed_insights' => esc_html__('PageSpeed Insights', 'siteseo-pro'), 'tab_siteseopro_dublin_core' => esc_html__('Dublin Core', 'siteseo-pro'), 'tab_siteseopro_local_business' => esc_html__('Local Business', 'siteseo-pro'), 'tab_siteseopro_structured_data' => esc_html__('Structured Data Types', 'siteseo-pro'), 'tab_siteseopro_breadcrumbs' => esc_html__('Breadcrumbs','siteseo-pro'), 'tab_siteseopro_robots_txt' => esc_html__('robots.txt','siteseo-pro'), 'tab_siteseopro_htaccess' => esc_html__('htaccess','siteseo-pro'), 'tab_siteseopro_redirect_monitor' => esc_html__('Redirections / 404 monitoring', 'siteseo-pro'), 'tab_google_news' => esc_html__('Google News', 'siteseo-pro'), 'tab_video_sitemap' => esc_html__('Video Sitemap', 'siteseo-pro'), 'tab_rss_sitemap' => esc_html__('RSS Sitemap', 'siteseo-pro'), ]; echo'<form method="post" style="margin-right:20px;" class="siteseo-option" name="siteseo-flush">'; $sitesepro_license = get_option('siteseo_license'); // TODO:: Will make it visible later. // if(empty($sitesepro_license['license'])){ // echo'<div class="siteseopro_license_notices">'; // $docs = siteseo_get_docs_links(); // echo'<div class="siteseo-notice is-success"> // <p><strong>' . __('Welcome to SiteSEO PRO!', 'siteseo-pro') . '</strong></p> // <p>' . __('Please activate your license to receive automatic updates and get premium support.', 'siteseo-pro') . '</p> // <p><a class="button button-primary" href="' . esc_url(admin_url('admin.php?page=siteseo-license')) . '">' . __('Activate License', 'siteseo-pro') . '</a></p> // </div> // </div>'; // } echo'<span id="siteseo-tab-title"><strong>'.esc_html('SiteSEO - PRO','siteseo-pro').'</strong></span>'; wp_nonce_field('sitseo_pro_settings'); echo '<div id="siteseo-tabs" class="wrap"> <div class="nav-tab-wrapper">'; foreach ($siteseopro_settings_tabs as $tab_key => $tab_caption) { $active_class = ($current_tab === $tab_key) ? ' nav-tab-active' : ''; echo '<a id="' . esc_attr($tab_key) . '-tab" class="nav-tab' . esc_attr($active_class) . '" data-tab="' . esc_attr($tab_key) . '">' . esc_html($tab_caption) . '</a>'; } echo '</div> <div class="siteseo-tab' .($current_tab == 'tab_siteseopro_woocommerce' ? ' active' : '') . '" id="tab_siteseopro_woocommerce" style="display: none;">'; self::woocommerce_tab(); echo '</div> <div class="siteseo-tab' . ($current_tab == 'tab_siteseopro_easydigital_downloads' ? ' active' : '') . '" id="tab_siteseopro_easydigital_downloads" style="display: none;">'; self::easy_digital_downloads_tab(); echo '</div> <div class="siteseo-tab' . ($current_tab == 'tab_siteseopro_pagespeed_insights' ? ' active' : '') . '" id="tab_siteseopro_pagespeed_insights" style="display: none;">'; self::pagespeed_insights_tab(); echo '</div> <div class="siteseo-tab' . ($current_tab == 'tab_siteseopro_dublin_core' ? ' active' : '') . '" id="tab_siteseopro_dublin_core" style="display: none;">'; self::dublin_core_tab(); echo '</div> <div class="siteseo-tab' . ($current_tab == 'tab_siteseopro_local_business' ? ' active' : '') . '" id="tab_siteseopro_local_business" style="display: none;">'; self::local_business_tab(); echo '</div> <div class="siteseo-tab' .($current_tab == 'tab_siteseopro_structured_data' ? ' active' : ''). '" id="tab_siteseopro_structured_data" style="display: none;">'; self::structured_data(); echo'</div> <div class="siteseo-tab' .($current_tab == 'tab_siteseopro_breadcrumbs' ? ' active' : ''). '" id="tab_siteseopro_breadcrumbs" style="display: none;">'; self::breadcrumbs(); echo'</div> <div class="siteseo-tab' .($current_tab == 'tab_siteseopro_redirect_monitor' ? ' active' : ''). '" id="tab_siteseopro_redirect_monitor" style="display: none;">'; self::redirect_monitoring(); echo '</div> <div class="siteseo-tab' .($current_tab == 'tab_siteseopro_robots_txt' ? ' active' : ''). '" id="tab_siteseopro_robots_txt" style="display: none;">'; self::robots(); echo'</div> <div class="siteseo-tab' .($current_tab == 'tab_siteseopro_htaccess' ? ' active' : ''). '" id="tab_siteseopro_htaccess" style="display: none;">'; self::htaccess(); echo'</div> <div class="siteseo-tab' .($current_tab == 'tab_google_news' ? ' active' : ''). '" id="tab_google_news" style="display: none;">'; self::google_news(); echo '</div> <div class="siteseo-tab'. ($current_tab == 'tab_video_sitemap' ? ' active' : '').'" id="tab_video_sitemap" style="display : none">'; self::video_sitemap(); echo '</div> <div class="siteseo-tab'. ($current_tab =='tab_rss_sitemap' ? 'active' : '').'" id="tab_rss_sitemap" style="display:none">'; self::rss_sitemap(); echo'</div> </div>'; siteseo_submit_button(__('Save changes', 'siteseo-pro')); echo '</form> </div>'; } static function woocommerce_tab(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $options = $siteseo->pro; // Check if settings are enable $cart_page = !empty($options['woocommerce_cart_page_no_index']); $checkout_page = !empty($options['woocommerce_checkout_page_no_index']); $account_page = !empty($options['woocommerce_customer_account_page_no_index']); $woo_og_price = !empty($options['woocommerce_product_og_price']); $woo_og_currency = !empty($options['woocommerce_product_og_currency']); $woo_meta_generator = !empty($options['woocommerce_meta_generator']); $schema_output = !empty($options['woocommerce_schema_output']); $schema_breadcrumbs = !empty($options['woocommerce_schema_breadcrumbs_output']); $toggle_state_woocommerce = !empty($options['toggle_state_woocommerce']) ? $options['toggle_state_woocommerce'] : ''; $nonce = wp_create_nonce('siteseo_pro_toggle_nonce'); echo'<h3 class="siteseo-tabs">'.esc_html('WooCommerce','siteseo-pro').'</h3>'; Util::render_toggle('woocommerce', $toggle_state_woocommerce, $nonce); if(!is_plugin_active('woocommerce/woocommerce.php')){ echo'<div class="siteseo-notice is-warning"><p>'.wp_kses_post(__('You need to enable <strong>WooCommerce</strong> to apply these settings.', 'siteseo-pro')).'</p></div>'; } echo'<table class="form-table"><tbody> <tr><th scope="row">Cart page</th> <td><label for="siteseo_woocommerce_cart_page_no_index"> <input id="siteseo_woocommerce_cart_page_no_index" name="siteseo_pro_options[woocommerce_cart_page_no_index]" type="checkbox"' . (!empty($cart_page) ? 'checked="yes"' : '') . ' value="1"/>' . esc_html__('noindex', 'siteseo-pro') . '</label> <p class="description">' . esc_html__('If your theme or plugin displays the cart across your entire WordPress site, don\'t enable this option.', 'siteseo-pro') . '</p></td></tr> <tr><th scope="row">Checkout page</th> <td><label for="siteseo_woocommerce_checkout_page_no_index"> <input id="siteseo_woocommerce_checkout_page_no_index" name="siteseo_pro_options[woocommerce_checkout_page_no_index]" type="checkbox"' . (!empty($checkout_page) ? 'checked="yes"' : '') . ' value="1"/>' . esc_html__('noindex', 'siteseo-pro') . '</label></td></tr> <tr><th scope="row">Customer account pages</th> <td><label for="siteseo_woocommerce_customer_account_page_no_index"> <input id="siteseo_woocommerce_customer_account_page_no_index" name="siteseo_pro_options[woocommerce_customer_account_page_no_index]" type="checkbox"'.(!empty($account_page) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('noindex', 'siteseo-pro') . '</label></td></tr> <tr><th scope="row">OG Price</th> <td><label for="siteseo_woocommerce_product_og_price"> <input id="siteseo_woocommerce_product_og_price" name="siteseo_pro_options[woocommerce_product_og_price]" type="checkbox"'.(!empty($woo_og_price) ? 'checked="yes"' : '').' value="1"/>' .esc_html__('Add product:price:amount meta for product', 'siteseo-pro') . '</label> <div class="siteseo-styles pre"><pre>' . esc_html('<meta property="product:price:amount" content="99" />') . '</pre></div></td></tr> <tr><th scope="row">OG Currency</th> <td><label for="siteseo_woocommerce_product_og_currency"> <input id="siteseo_woocommerce_product_og_currency" name="siteseo_pro_options[woocommerce_product_og_currency]" type="checkbox"'.(!empty($woo_og_currency) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Add product:price:currency meta for product', 'siteseo-pro'). '</label> <div class="siteseo-styles pre"><pre>' . esc_html('<meta property="product:price:currency" content="EUR" />') .'</pre></div></td></tr> <tr><th scope="row">Remove WooCommerce generator tag in your head</th> <td><label for="siteseo_woocommerce_meta_generator"> <input id="siteseo_woocommerce_meta_generator" name="siteseo_pro_options[woocommerce_meta_generator]" type="checkbox"'.(!empty($woo_meta_generator) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Remove WooCommerce meta generator', 'siteseo-pro'). '</label> <div class="siteseo-styles pre"><pre>' . esc_html('<meta name="generator" content="WooCommerce 7.5" />') . '</pre></div></td> <tr><th scope="row">Remove WooCommerce Schemas</th> <td><label for="siteseo_woocommerce_schema_output"> <input id="siteseo_woocommerce_schema_output" name="siteseo_pro_options[woocommerce_schema_output]" type="checkbox"'.(!empty($schema_output) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('Remove default JSON-LD structured data (WooCommerce 3+)', 'siteseo-pro') . '</label> <p class="description">'. // Translators: %s is automatic product schema. wp_kses_post(sprintf(__('The default product schema added by WooCommerce generates errors in Google Search Console. Disable it and create your own <a href="%s">automatic product schema</a>.', 'siteseo-pro'), esc_url(admin_url('edit.php?post_type=siteseo_schemas')))) . '</p></td></tr> <tr><th scope="row">Remove WooCommerce breadcrumbs schemas only</th> <td><label for="siteseo_woocommerce_schema_breadcrumbs_output"> <input id="siteseo_woocommerce_schema_breadcrumbs_output" name="siteseo_pro_options[woocommerce_schema_breadcrumbs_output]" type="checkbox"'.(!empty($schema_breadcrumbs) ? 'checked="yes"' : '').' value="1"/>' . esc_html__('Remove default breadcrumbs JSON-LD structured data (WooCommerce 3+)', 'siteseo-pro'). '</label><p class="description">' . esc_html__('If "Remove default JSON-LD structured data (WooCommerce 3+)" option is already checked, the breadcrumbs schema is already removed from your source code.', 'siteseo-pro') . '</p></td></tr> </tbody></table> <input type="hidden" name="woocommerce_settings" value="1"/>'; } static function easy_digital_downloads_tab() { if(!empty($_POST['submit'])){ self::save_settings(); } $options = get_option('siteseo_pro_options'); // check settings enable $option_og_price = isset($options['edd_product_og_price']) ? $options['edd_product_og_price'] : ''; $option_og_currency = isset($options['edd_product_og_currency']) ? $options['edd_product_og_currency'] : ''; $option_meta_generator = isset($options['edd_meta_generator']) ? $options['edd_meta_generator'] : ''; $toggle_state_easy_digital = isset($options['toggle_state_easy_digital']) ? $options['toggle_state_easy_digital'] : ''; $nonce = wp_create_nonce('siteseo_pro_toggle_nonce'); echo'<h3 class="siteseo-tabs">'.esc_html('Easy Digital Downloads','siteseo-pro').'</h3>'; Util::render_toggle('edd', $toggle_state_easy_digital, $nonce); echo'<p>'.esc_html__('Improve Easy Digital Downloads SEO', 'siteseo-pro').'</p>'; if(!is_plugin_active('easy-digital-downloads/easy-digital-downloads.php')){ echo '<div class="siteseo-notice is-warning"><p>'. wp_kses_post(__('You need to enable <strong>Easy Digital Downloads</strong> to apply these settings.', 'siteseo-pro')) .'</p></div>'; } echo'<table class="form-table"> <tbody> <tr><th scope="row">OG price</th> <td><label for="siteseo_edd_product_og_price"> <input id="siteseo_edd_product_og_price" name="siteseo_pro_options[edd_product_og_price]" type="checkbox" ' . (empty(!$option_og_price) ? 'checked="yes"' : '') . ' value="1"/>' . esc_html__('Add product:price:amount meta for product', 'siteseo-pro') . '</label>' . '<div class="siteseo-styles pre"><pre>' . esc_html('<meta property="product:price:amount" content="99" />') . '</pre></div> </td> </tr>' . '<tr><th scope="row">OG Currency</th>' . '<td><label for="siteseo_edd_product_og_currency">' . '<input id="siteseo_edd_product_og_currency" name="siteseo_pro_options[edd_product_og_currency]" type="checkbox"'. (!empty($option_og_currency) ? 'checked="yes"' : '') . ' value="1"/>' . esc_html__('Add product:price:currency meta for product', 'siteseo-pro') . '</label>' . '<div class="siteseo-styles pre"><pre>' . esc_html('<meta property="product:price:currency" content="EUR" />') . '</pre></div> </td> </tr>' . '<tr> <th scope="row">'.esc_html__('Remove Easy Digital Downloads generator tag in your head', 'siteseo-pro').'</th>' . '<td><label for="siteseo_edd_meta_generator">' . '<input id="siteseo_edd_meta_generator" name="siteseo_pro_options[edd_meta_generator]" type="checkbox" ' . (!empty($option_meta_generator) ? 'checked="yes"' : '') . ' value="1"/>' . esc_html__('Remove EDD meta generator', 'siteseo-pro') . '</label>' . '<div class="siteseo-styles pre"><pre>' . esc_html('<meta name="generator" content="Easy Digital Downloads v3.0" />') . '</pre></div> </td> </tr> </tbody> </table> <input type="hidden" name="digital_download_settings" value="1"/>'; } static function pagespeed_insights_tab(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } // check settings enable $check_api_key = !empty($siteseo->pro['ps_api_key']) ? $siteseo->pro['ps_api_key'] : ''; $docs = function_exists('siteseo_get_docs_links') ? siteseo_get_docs_links() : ''; echo'<h3 class="siteseo-tabs">'.esc_html('PageSpeed Insights','siteseo-pro').'</h3> <p>'.esc_html__('Check your site performance with Google PageSpeed Insights.', 'siteseo-pro').'</p> <p>'.esc_html__('Learn how your site has performed, based on data from your actual users around the world.', 'siteseo-pro').'</p> <table class="form-table"> <tbody>' . '<tr><th scope="row">'.esc_html__('Enter your own Google Page Speed API key', 'siteseo-pro').'</th>'; echo sprintf( '<td><input id="siteseo_ps_api_key" type="text" name="siteseo_pro_options[ps_api_key]" aria-label="%s" placeholder="%s" value="%s">', esc_html__('Google Page Speed Insights API key', 'siteseo-pro'), esc_html__('Enter your Page Speed Insights API key', 'siteseo-pro'), esc_html($check_api_key) ); echo '<p class="siteseo-help description"> <span class="dashicons dashicons-external"></span> <a href="' . esc_url($docs['page_speed']['api']) . '" target="_blank">' . esc_html__('Learn how to create a free Google Page Speed API key', 'siteseo-pro') . '</a> </p> <p class="siteseo-help description"> <span class="dashicons dashicons-external"></span> <a href="' . esc_url($docs['page_speed']['google']) . '" target="_blank">' . esc_html__('A Page Speed Insights key is required to avoid quota errors.', 'siteseo-pro') . '</a> </p></tr>'; echo'</th></tbody></table>'; echo '<br/><div class="siteseo-pagespeed-input-wrapper"> <input id="siteseo_ps_url" type="text" name="siteseo_pro_options[siteseo_ps_url]" placeholder="' . esc_attr__('Enter a URL to analyse with Page Speed Insights', 'siteseo-pro') . '" value="' . esc_html(get_home_url()) . '"> <button type="button" id="siteseopro-pagespeed-btn" class="siteseo-request-page-speed btn btnPrimary">' . esc_html__('Analyse performance', 'siteseo-pro') . '</button><div style="position: absolute;left:99.5%;margin-top:1%;" class="spinner"></div> <button type="button" id="siteseopro-clear-Page-speed-insights" class="btn btnTertiary">' . esc_html__('Remove last analysis', 'siteseo-pro') . '</button> </div>'; echo'<div id="siteseopro-pagespeed-results">'; $page_speed = get_option('siteseo_pro_page_speed', []); if(!empty($page_speed['mobile']) && !empty($page_speed['desktop'])){ PageSpeed::analysis(); } echo'<br/><br/></div> <input type="hidden" name="pagespeed_settings" value="1"/>'; } static function dublin_core_tab(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $dublin_core = !empty($siteseo->pro['dublin_core_enable']); $toggle_state_dublin_core = !empty($siteseo->pro['toggle_state_dublin_core']) ? $siteseo->pro['toggle_state_dublin_core'] : ''; $nonce = wp_create_nonce('siteseo_pro_toggle_nonce'); echo'<h3 class="siteseo-tabs">'.esc_html('Dublin Core','siteseo-pro').'</h3>'; Util::render_toggle('dublin', $toggle_state_dublin_core, $nonce); echo'<br/>' . esc_html__('Dublin Core is a set of meta tags to describe your content','siteseo-pro') . '<br/>' . esc_html__('These tags are automatically generated. Recognized by states / governments, they are used by directories, Bing, Baidu and Yandex.','siteseo-pro') . '<table class="form-table"> <tbody> <tr>' . '<th scope="row" style="user-select: auto;">'.esc_html__('Enable Dublin Core', 'siteseo-pro').'</th>'. '<td><label for="siteseo_dublin_core_enable">'. '<input id="siteseo_dublin_core_enable" name="siteseo_pro_options[dublin_core_enable]" type="checkbox" ' . (!empty($dublin_core) ? 'checked="yes"' : '') . ' value="1"/>' . esc_html__('Enable Dublin Core meta tags (dc.title, dc.description, dc.source, dc.language, dc.relation, dc.subject)', 'siteseo-pro') . '</label> </td> </tr> </tbody> </table> <input type="hidden" name="dublin_code_settings" value="1"/>'; } static function local_business_tab(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } // Time slots $days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; $hours = range('00', '23'); $mins = ['00', '15', '30', '45', '59']; if(isset($_POST['siteseo_pro_options']) && is_array($_POST['siteseo_pro_options'])){ $siteseo_pro_options = map_deep(wp_unslash($_POST['siteseo_pro_options']), 'sanitize_text_field'); } $business_type['LocalBusiness'] = 'Local Business (default)'; $business_type['AnimalShelter'] = 'Animal Shelter'; $business_type['ChildCare'] = 'Child Care'; $business_type['DryCleaningOrLaundry'] = 'Dry Cleaning Or Laundry'; $business_type['EmergencyService'] = 'Emergency Service'; $business_type['FireStation'] = '|-FireStation'; $business_type['Hospital'] = '|-Hospital'; $business_type['PoliceStation'] = '|-Police Station'; $business_type['EmploymentAgency'] = 'Employment Agency'; $business_type['Entertainment Business'] = 'Entertainment Business'; $business_type['AdultEntertainment'] = '|-AdultEntertainment'; $business_type['AmusementPark'] = '|-Amusement Park'; $business_type['ArtGallery'] = '|-Art Gallery'; $business_type['Casino'] = '|-Casino'; $business_type['ComedyClub'] = '|-Comedy Club'; $business_type['MovieTheater'] = '|-Movie Theater'; $business_type['NightClub'] = '|-Night Club'; $business_type['FinancialService'] = '|-Financial Service'; $business_type['AccountingService'] = '|-Accounting Service'; $business_type['AutomatedTeller'] = '|-Automated Teller'; $business_type['BankOrCreditUnion'] = '|-Bank Or CreditUnion'; $business_type['InsuranceAgency'] = '|-Insurance Agency'; $business_type['FoodEstablishment'] = 'Food Establishment'; $business_type['Bakery'] = '|-Bakery'; $business_type['BarOrPub'] = '|-Bar Or Pub'; $business_type['Brewery'] = 'Brewery'; $business_type['CafeOrCoffeeShop'] = '|-Cafe Or CoffeeShop'; $business_type['FastFoodRestaurant'] = '|-Fast Food Restaurant'; $business_type['IceCreamShop'] = '|-Ice Cream Shop'; $business_type['Restaurant'] = '|-Restaurant'; $business_type['Winery'] = '|-Winery'; $business_type['GovernmentOffice'] = 'Government Office'; $business_type['PostOffice'] = '|-PostOffice'; $business_type['HealthAndBeautyBusiness'] = 'Health And Beauty Business'; $business_type['BeautySalon'] = '|-Beauty Salon'; $business_type['DaySpa'] = '|-DaySpa'; $business_type['HairSalon'] = '|-Hair Salon'; $business_type['HealthClub'] = '|-Health Club'; $business_type['NailSalon'] = '|-Nail Salon'; $business_type['TattooParlor'] = '|-Tattoo Parlor'; $business_type['HomeAndConstructionBusiness'] = '|-Home And Construction Business'; $business_type['Electrician'] = '|-Electrician'; $business_type['HVACBusiness'] = '|-HVAC Business'; $business_type['HousePainter'] = '|-House Painter'; $business_type['Locksmith'] = '|-Locksmith'; $business_type['MovingCompany'] = '|-MovingCompany'; $business_type['Plumber'] = '|-Plumber'; $business_type['RoofingContractor'] = '|-Roofing Contractor'; $business_type['InternetCafe'] = '|-Internet Cafe'; $business_type['MedicalBusiness'] = '|-Medical Business'; $business_type['CommunityHealth'] = '|-Community Health'; $business_type['Dentist'] = '|-Dentist'; $business_type['Dermatology'] = '|-Dermatology'; $business_type['DietNutrition'] = '|-Diet Nutrition'; $business_type['Emergency'] = '|-Emergency'; $business_type['Gynecologic'] = '|-Gynecologic'; $business_type['MedicalClinic'] = '|-MedicalClinic'; $business_type['Midwifery'] = '|-Midwifery'; $business_type['Nursing'] = '|-Nursing'; $business_type['Obstetric'] = '|-Obstetric'; $business_type['Oncologic'] = '|-Oncologic'; $business_type['Optician'] = '|-Optician'; $business_type['Otolaryngologic'] = '|-Otolaryngologic'; $business_type['Pediatric'] = '|-Pediatric'; $business_type['Pharmacy'] = '|-Pharmacy'; $business_type['Physiotherapy'] = '|-Physiotherapy'; $business_type['PlasticSurgery'] = '|-PlasticSurgery'; $business_type['Podiatric'] = '|-Podiatric'; $business_type['PrimaryCare'] = '|-PrimaryCare'; $business_type['Psychiatric'] = '|-Psychiatric'; $business_type['PublicHealth'] = '|-PublicHealth'; $business_type['VeterinaryCare'] = '|-VeterinaryCare'; $business_type['LegalService'] = '|-LegalService'; $business_type['Attorney'] = '|-Attorney'; $business_type['Notary'] = '|-Notary'; $business_type['Library'] = 'Library'; $business_type['LodgingBusiness'] = 'LodgingBusiness'; $business_type['BedAndBreakfast'] = '|-Bed And Breakfast'; $business_type['Campground'] = '|-Campground'; $business_type['Hostel'] = '|-Hostel'; $business_type['Hotel'] = '|-Hotel'; $business_type['Motel'] = '|-Motel'; $business_type['Resort'] ='|-Resort'; $business_type['ProfessionalService'] ='Professional Service'; $business_type['RadioStation'] ='Radio Station'; $business_type['RealEstateAgent'] ='Real Estate Agent'; $business_type['RecyclingCenter'] ='Recycling Center'; $business_type['SelfStorage'] ='Real Self Storage'; $business_type['ShoppingCenter'] ='ShoppingCenter'; $business_type['SportsActivityLocation'] ='Sports Activity Location'; $business_type['BowlingAlley'] ='|-Bowling Alley'; $business_type['ExerciseGym'] = '|-Exercise Gym'; $business_type['GolfCourse'] = '|-Golf Course'; $business_type['HealthClub'] = '|-HealthClub'; $business_type['PublicSwimmingPool'] = '|-Public Swimming Pool'; $business_type['SkiResort'] = '|-Ski Resort'; $business_type['SportsClub'] = '|-Sports Club'; $business_type['StadiumOrArena'] = '|-Stadium Or Arena'; $business_type['TennisComplex'] = '|-Tennis Complex'; $business_type['Store'] = '|-Store'; $business_type['AutoPartsStore'] = '|-Auto Parts Store'; $business_type['BikeStore'] = '|-Bike Store'; $business_type['BookStore'] = '|-Book Store'; $business_type['ClothingStore'] = '|-Clothing Store'; $business_type['ComputerStore'] = '|-Computer Store'; $business_type['ConvenienceStore'] = '|-Convenience Store'; $business_type['DepartmentStore'] = '|-Department Store'; $business_type['ElectronicsStore'] = '|-Electronics Store'; $business_type['Florist'] = '|-Florist'; $business_type['FurnitureStore'] = '|-Furniture Store'; $business_type['GardenStore'] = '|-Garden Store'; $business_type['GroceryStore'] = '|-Grocery Store'; $business_type['HardwareStore'] = '|-Hardware Store'; $business_type['HobbyShop'] = '|-Hobby Shop'; $business_type['HomeGoodsStore'] = '|-Home Goods Store'; $business_type['JewelryStore'] = '|-Jewelry Store'; $business_type['LiquorStore'] = '|-Liquor Store'; $business_type['MensClothingStore'] = '|-Mens Clothing Store'; $business_type['MobilePhoneStore'] = '|-Mobile Phone Store'; $business_type['MovieRentalStore'] = '|-Movie Rental Store'; $business_type['MusicStore'] = '|-Music Store'; $business_type['OfficeEquipmentStore'] = '|-Office Equipment Store'; $business_type['OutletStore'] = '|-Outlet Store'; $business_type['PawnShop'] = '|-Pawn Shop'; $business_type['PetStore'] = '|-PetStore'; $business_type['ShoeStore'] = '|-Shoe Store'; $business_type['SportingGoodsStore'] = '|-Sporting Goods Store'; $business_type['TireShop'] = '|-Tire Shop'; $business_type['ToyStore'] = '|-Toy Store'; $business_type['WholesaleStore'] = '|-Whole sale Store'; $business_type['TelevisionStation'] = '|-Whole sale Store'; $business_type['TouristInformationCenter'] = 'Tourist Information Center'; $business_type['TravelAgency'] = 'Travel Agency'; $business_type['AutomotiveBusiness'] = 'Automotive Business'; $business_type['AutoBodyShop'] = '|-Auto Body Shop'; $business_type['AutoDealer'] = '|-Auto Dealer'; $business_type['AutoPartsStore'] = '|-Auto Parts Store'; $business_type['AutoRental'] = '|-Auto Rental'; $business_type['AutoRepair'] = '|-Auto Repair'; $business_type['AutoWash'] = '|-AutoWash'; $business_type['GasStation'] = '|-Gas Station'; $business_type['MotorcycleDealer'] = '|-Motorcycle Dealer'; $business_type['MotorcycleRepair'] = '|-MotorcycleRepair'; // Get saved settings $options = $siteseo->pro; $display_schema = isset($options['local_business_display_schema']) ? esc_attr($options['local_business_display_schema']) : ''; $set_street_address = isset($options['street_address']) ? esc_attr($options['street_address']): ''; $set_city = isset($options['city']) ? esc_attr($options['city']): ''; $set_state = isset($options['state']) ? esc_attr($options['state']): ''; $set_postal_code = isset($options['postal_code']) ? esc_attr($options['postal_code']) : '' ; $set_country = isset($options['country']) ? esc_attr($options['country']): ''; $set_latitude = isset($options['latitude'])? esc_attr($options['latitude']): ''; $set_longitude = isset($options['longitude']) ? esc_attr($options['longitude']) : ''; $set_place_id = isset($options['place_id']) ? esc_attr($options['place_id']) : ''; $set_url = isset($options['url']) ? esc_attr($options['url']) : ''; $set_telephone = isset($options['telephone']) ? esc_attr($options['telephone']): ''; $set_price_range = isset($options['price_range']) ? esc_attr($options['price_range']) : ''; $set_cuisine_served = isset($options['cuisine_served'])? esc_attr($options['cuisine_served']) : ''; $set_accepts_reser = isset($options['accepts_reser']) ? esc_attr($options['accepts_reser']) : ''; $set_business_type = isset($options['business_type']) ? esc_attr($options['business_type']) : 'LocalBusiness'; $toggle_state_local_buz = isset($options['toggle_state_local_buz']) ? esc_html($options['toggle_state_local_buz']): ''; $nonce = wp_create_nonce('siteseo_pro_toggle_nonce'); $docs = siteseo_get_docs_links(); // Display the settings form echo'<h3 class="siteseo-tabs">'.esc_html('Local Business','siteseo-pro').'</h3>'; Util::render_toggle('local', $toggle_state_local_buz, $nonce); echo'<p>'.esc_html__('Local Business data type for Google', 'siteseo-pro').'</p> <form method="post" action="">'; wp_nonce_field('sitseo_pro_settings', 'sitseo_pro_settings_nonce'); echo'<table class="form-table"> <tbody> <tr> <th scope="row" style="user-select: auto;">Business type</th> <td> <select id="siteseo_pro_rich_snippets_lb_type" name="siteseo_pro_options[business_type]">'; foreach ($business_type as $type_value => $type_i18n) { $selected = ($type_value == $set_business_type) ? 'selected' : ''; echo '<option value="'.esc_attr($type_value).'" '.esc_attr($selected).'>'.esc_html($type_i18n).'</option>'; } echo'</select> </td> </tr> <tr><th scope="row" style="user-select: auto;">Street Address</th> <td><input type="text" name="siteseo_pro_options[street_address]" placeholder="eg: Place Bellevue" value="'.esc_attr($set_street_address).'"> <p class="description">' . sprintf('<span class="field-required">%s</span> %s.', esc_html__('Required', 'siteseo-pro'), esc_html__('property by Google', 'siteseo-pro')) . '</p> </td> </tr> <tr><th scope="row" style="user-select: auto;">City</th> <td><input type="text" name="siteseo_pro_options[city]" placeholder="Biarritz" value="'.esc_attr($set_city).'"> <p class="description">' . sprintf('<span class="field-required">%s</span> %s.', esc_html__('Required', 'siteseo-pro'), esc_html__('property by Google', 'siteseo-pro')) . '</p> </td> </tr> <tr><th scope="row" style="user-select: auto;">State</th> <td><input type="text" name="siteseo_pro_options[state]" placeholder="eg: Nouvelle Aquitaine" value="'.esc_attr($set_state).'"> <p class="description">' . sprintf('<span class="field-required">%s</span> %s.', esc_html__('Required', 'siteseo-pro'), esc_html__('property by Google', 'siteseo-pro')) . '</p> </td> </tr> <tr><th scope="row" style="user-select: auto;">Postal code</th> <td><input type="text" name="siteseo_pro_options[postal_code]" placeholder="eg: 64200" value="'.esc_attr($set_postal_code).'"> <p class="description">' . sprintf('<span class="field-required">%s</span> %s.', esc_html__('Required', 'siteseo-pro'), esc_html__('property by Google', 'siteseo-pro')) . '</p> </td> </tr> <tr><th scope="row" style="user-select: auto;">Country</th> <td><input type="text" name="siteseo_pro_options[country]" placeholder="eg: France" value="'.esc_attr($set_country).'"> <p class="description">' . sprintf('<span class="field-required">%s</span> %s.', esc_html__('Required', 'siteseo-pro'), esc_html__('property by Google', 'siteseo-pro')) . '</p> </td> </tr> <tr><th scope="row" style="user-select: auto;">Latitude</th> <td><input type="text" name="siteseo_pro_options[latitude]" placeholder="eg: 43.4831389" value="'.esc_attr($set_latitude).'"> <p class="description">' . sprintf('<span class="field-recommended">%s</span> %s.', esc_html__('Recommended', 'siteseo-pro'), esc_html__('property by Google', 'siteseo-pro')) . '</p> </td> </tr> <tr><th scope="row" style="user-select: auto;">Longitude</th> <td><input type="text" name="siteseo_pro_options[longitude]" placeholder="eg: -1.5630987" value="'.esc_attr($set_longitude).'"> <p class="description">' . sprintf('<span class="field-recommended">%s</span> %s.', esc_html__('Recommended', 'siteseo-pro'), esc_html__('property by Google', 'siteseo-pro')) . '</p> </td> </tr> <tr><th scope="row" style="user-select: auto;">Place ID</th> <td><input type="text" name="siteseo_pro_options[place_id]" placeholder="eg: Biarrit" value="'.esc_attr($set_place_id).'"> <p class="description">' . wp_kses_post(__('<a href="https://developers.google.com/places/web-service/place-id" target="_blank">Click here to find your Google Maps Place ID</a><span class="siteseo-help dashicons dashicons-external"></span> for your Local Business. <br>This ID will be used to display the Google Maps link from the LB widget.', 'siteseo-pro')) . '</p> </td> </tr> <tr><th scope="row" style="user-select: auto;">URL</th> <td><input type="text" name="siteseo_pro_options[url]" placeholder="default:'.esc_url(get_home_url()).'" value="'.esc_attr($set_url).'"> <p class="description"> '. esc_html__('Default: homepage. Google recommends to include your business details (address, phone, website...) for your visitors too.', 'siteseo-pro') .' </p> <p class="description">' . sprintf('<span class="field-recommended">%s</span> %s.', esc_html__('Recommended', 'siteseo-pro'), esc_html__('property by Google', 'siteseo-pro')) . '</p> </td> </tr> <tr><th scope="row" style="user-select: auto;">Telephone</th> <td><input type="text" name="siteseo_pro_options[telephone]" placeholder="eg: +33559240138" value="'.esc_attr($set_telephone).'"> <p class="description">' . sprintf('<span class="field-recommended">%s</span> %s.', esc_html__('Recommended', 'siteseo-pro'), esc_html__('property by Google', 'siteseo-pro')) . '</p> </td> </tr> <tr><th scope="row" style="user-select: auto;">Price range</th> <td><input type="text" name="siteseo_pro_options[price_range]" placeholder="eg: $$, €€€, or ££££..." value="'.esc_attr($set_price_range).'"> <p class="description">' . sprintf('<span class="field-recommended">%s</span> %s.', esc_html__('Recommended', 'siteseo-pro'), esc_html__('property by Google', 'siteseo-pro')) . '</p> </td> </tr> <tr><th scope="row" style="user-select: auto;">'.esc_html__('Cuisine served', 'siteseo-pro').'</th> <td><input type="text" name="siteseo_pro_options[cuisine_served]" placeholder="French, Mediterranean, or American" value="'.esc_attr($set_cuisine_served).'"> <p class="description"> '. esc_html__('Only to be filled if the business type is: "FoodEstablishment", "Bakery", "BarOrPub", "Brewery", "CafeOrCoffeeShop", "FastFoodRestaurant", "IceCreamShop", "Restaurant" or "Winery".', 'siteseo-pro').' </p> <p class="description">' . sprintf('<span class="field-recommended">%s</span> %s.', esc_html__('Recommended', 'siteseo-pro'), esc_html__('property by Google', 'siteseo-pro')) . '</p> </td> </tr> <tr><th scope="row" style="user-select: auto;">'.esc_html__('Accepts Reservations', 'siteseo-pro').'</th> <td><input type="text" name="siteseo_pro_options[accepts_reser]" placeholder="eg.True" value="'.esc_attr($set_accepts_reser).'"> <p class="description"> '. esc_html__('Indicates whether a FoodEstablishment accepts reservations. Values can be Boolean (True or False), an URL at which reservations can be made or (for backwards compatibility) the strings Yes or No.', 'siteseo-pro').' </p> <p class="description">' . sprintf('<span class="field-recommended">%s</span> %s.', esc_html__('Recommended', 'siteseo-pro'), esc_html__('property by Google', 'siteseo-pro')) . '</p> </td> </tr> <tr><th scope="row" style="user-select: auto;">Opening hours</th> <td><div class="siteseo-notice-pro"> <p>' . wp_kses_post(__('<strong>Morning and Afternoon are just time slots</strong>', 'siteseo-pro')) . '</p> <p>' . esc_html__('Eg: if you\'re opened from 10:00 AM to 9:00 PM, check Morning and enter 10:00 / 21:00.', 'siteseo-pro') . '</p> <p>' . esc_html__('If you are open non-stop, check Morning and enter 0:00 / 23:59.', 'siteseo-pro') . '</p> </div> <ul style="list-style-type: none;">'; foreach($days as $key => $day) { $is_closed = !empty($options['opening_hours'][$key]['closed']) ? $options['opening_hours'][$key]['closed'] : 0; $open_morning = !empty($options['opening_hours'][$key]['open_morning']) ? $options['opening_hours'][$key]['open_morning'] : 0; $open_afternoon = !empty($options['opening_hours'][$key]['open_afternoon']) ? $options['opening_hours'][$key]['open_afternoon'] : 0; // Get saved start and end times $open_morning_start_hour = !empty($options['opening_hours'][$key]['open_morning_start_hour']) ? $options['opening_hours'][$key]['open_morning_start_hour'] : ''; $open_morning_start_min = !empty($options['opening_hours'][$key]['open_morning_start_min']) ? $options['opening_hours'][$key]['open_morning_start_min'] : ''; $open_morning_end_hour = !empty($options['opening_hours'][$key]['open_morning_end_hour']) ? esc_attr($options['opening_hours'][$key]['open_morning_end_hour']) : ''; $open_morning_end_min = !empty($options['opening_hours'][$key]['open_morning_end_min']) ? esc_attr($options['opening_hours'][$key]['open_morning_end_min']) : ''; $open_afternoon_start_hour = !empty($options['opening_hours'][$key]['open_afternoon_start_hour']) ? esc_attr($options['opening_hours'][$key]['open_afternoon_start_hour']) : ''; $open_afternoon_start_min = !empty($options['opening_hours'][$key]['open_afternoon_start_min']) ? esc_attr($options['opening_hours'][$key]['open_afternoon_start_min']) : ''; $open_afternoon_end_hour = !empty($options['opening_hours'][$key]['open_afternoon_end_hour']) ? esc_attr($options['opening_hours'][$key]['open_afternoon_end_hour']) : ''; $open_afternoon_end_min = !empty($options['opening_hours'][$key]['open_afternoon_end_min']) ? esc_attr($options['opening_hours'][$key]['open_afternoon_end_min']) : ''; echo'<li><h3>' . esc_html($day) . '</h3></li><hr><br> <input type="checkbox"'.(!empty($is_closed) ? 'checked="yes"' : '').' name="siteseo_pro_options[opening_hours]['.esc_attr($key).'][closed]" value="1"> Closed all the day?</input><br /><br /> <input type="checkbox"'.(!empty($open_morning) ? 'checked="yes"' : '').' name="siteseo_pro_options[opening_hours]['.esc_attr($key).'][open_morning]" value="1">Open in the morning?</input><br /><br /> <div style="display:flex;"> <select style="width:auto;" name="siteseo_pro_options[opening_hours]['.esc_attr($key).'][open_morning_start_hour]">'; foreach($hours as $hour){ $selected = ($hour == $open_morning_start_hour) ? 'selected' : ''; echo '<option value="' . esc_attr($hour) . '" ' . esc_attr($selected) . '>' . esc_html($hour) . '</option>'; } echo '</select>:<select style="width:auto;" name="siteseo_pro_options[opening_hours]['.esc_attr($key).'][open_morning_start_min]">'; foreach($mins as $min){ $selected = ($min == $open_morning_start_min) ? 'selected' : ''; echo '<option value="' . esc_attr($min) . '" ' . esc_attr($selected) . '>' . esc_html($min) . '</option>'; } echo '</select>-<select style="width:auto;" name="siteseo_pro_options[opening_hours]['.esc_attr($key).'][open_morning_end_hour]">'; foreach($hours as $hour){ $selected = ($hour == $open_morning_end_hour) ? 'selected' : ''; echo '<option value="'. esc_attr($hour) .'" '.esc_attr($selected).'>'.esc_html($hour).'</option>'; } echo '</select>:<select style="width:auto;" name="siteseo_pro_options[opening_hours]['.esc_attr($key).'][open_morning_end_min]">'; foreach($mins as $min){ $selected = ($min == $open_morning_end_min) ? 'selected' : ''; echo '<option value="' . esc_attr($min) . '" ' . esc_attr($selected) . '>' . esc_html($min) . '</option>'; } echo '</select><br><br></div>'; echo'<br><input type="checkbox"'.(!empty($open_afternoon) ? 'checked="yes"' : '').' name="siteseo_pro_options[opening_hours]['.esc_attr($key).'][open_afternoon]" value="1">Open in the afternoon?</input><br /><br /> <div style="display:flex;"><select style="width:auto;" name="siteseo_pro_options[opening_hours]['.esc_attr($key).'][open_afternoon_start_hour]">'; // Get saved start and end times foreach($hours as $hour){ $selected = ($hour == $open_afternoon_start_hour) ? 'selected' : ''; echo '<option value="' . esc_attr($hour) . '" ' . esc_attr($selected) . '>' . esc_html($hour) . '</option>'; } echo'</select>:<select style="width:auto;" name="siteseo_pro_options[opening_hours]['.esc_attr($key).'][open_afternoon_start_min]">'; foreach($mins as $min){ $selected = ($min == $open_afternoon_start_min) ? 'selected' : ''; echo '<option value="' . esc_attr($min) . '" ' . esc_attr($selected) . '>' . esc_html($min) . '</option>'; } echo'</select>-<select style="width:auto;" name="siteseo_pro_options[opening_hours]['.esc_html($key).'][open_afternoon_end_hour]">'; foreach($hours as $hour){ $selected = ($hour == $open_afternoon_end_hour) ? 'selected' : ''; echo '<option value="' . esc_attr($hour) . '" ' . esc_attr($selected) . '>' . esc_html($hour) . '</option>'; } echo'</select>:<select style="width:auto;" name="siteseo_pro_options[opening_hours]['.esc_attr($key).'][open_afternoon_end_min]">'; foreach($mins as $min){ $selected = ($min == $open_afternoon_end_min) ? 'selected' : ''; echo '<option value="' . esc_attr($min) . '" ' . esc_attr($selected) . '>' . esc_attr($min) . '</option>'; } echo'</select></div>'; } echo '<br><br><p class="description">' . sprintf('<span class="field-recommended">%s</span> %s.', esc_html__('Recommended', 'siteseo-pro'), esc_html__('property by Google', 'siteseo-pro')) . '</p></td> </tr> </tbody> </table> <input type="hidden" name="local_business_settings" value="1"/>'; } static function structured_data(){ global $siteseo; if(!empty($_POST['sumbit'])){ self::save_settings(); } $options = $siteseo->pro; //load settings $toggle_state_stru_data = isset($options['toggle_state_stru_data']) ? $options['toggle_state_stru_data'] : ''; $option_set_enable_structured_data = isset($options['enable_structured_data']) ? $options['enable_structured_data'] : ''; $option_logo_url = isset($options['structured_data_image_url']) ? $options['structured_data_image_url'] : ''; $option_desciption = isset($options['org_desciption']) ? $options['org_desciption'] : ''; $option_email_id = isset($options['org_email']) ? $options['org_email'] : ''; $option_phone = isset($options['org_phone_no']) ? $options['org_phone_no'] : ''; $option_legal_name = isset($options['org_legal']) ? $options['org_legal'] : ''; $option_establish_date = isset($options['establish_date']) ? $options['establish_date'] : ''; $option_number_emp = isset($options['number_emp']) ? $options['number_emp'] : ''; $option_vat_id = isset($options['vat_id']) ? $options['vat_id'] : ''; $option_tax_id = isset($options['tax_id']) ? $options['tax_id'] : ''; $option_iso_id = isset($options['iso_code']) ? $options['iso_code'] : ''; $option_let_code = isset($options['let_code']) ? $options['let_code'] : ''; $option_duns_number = isset($options['duns_number']) ? $options['duns_number'] : ''; $option_naics_code = isset($options['naics_code']) ? $options['naics_code'] : ''; $nonce = wp_create_nonce('siteseo_pro_toggle_nonce'); echo'<h3 class="siteseo-tabs">'.esc_html('Structured Data Types (schema.org)','siteseo-pro').'</h3>'; Util::render_toggle('structured', $toggle_state_stru_data, $nonce); echo'<table class="form-table"> <tbody> <tr> <th scope="row" style="user-select: auto;">Enable Structured Data</th> <td> <label for="siteseo_structured_data"> <input id="siteseo_structured_data" name="siteseo_pro_options[enable_structured_data]" type="checkbox" ' . (empty(empty($option_set_enable_structured_data)) ? 'checked="yes"' : '') .' value="1"/>' . esc_html__('Enable Structured Data Types metabox for your posts, pages and custom post types', 'siteseo-pro') .'</label> </td> </tr> <tr> <th scope="row" style="user-select: auto">Upload your publisher logo</th> <td> <input id="structured_data_image_url" autocomplete="off" type="text" value="'. esc_url($option_logo_url) .'" name="siteseo_pro_options[structured_data_image_url]" aria-label="'. esc_html__('Upload your publisher logo', 'siteseo-pro').'" placeholder="'. esc_html__('Select your logo', 'siteseo-pro') .'" /> <input id="siteseopro_structured_data_upload_img" class="btn btnSecondary" type="button" value="'. esc_html__('Upload an Image', 'siteseo-pro') .'" /> </td> </tr> <tr><th scope="row" style="user-select:auto"></th> <td> <p><img style="width:auto;height:auto;max-width:560px;margin-top:15px;display:inline-block;" src="'.esc_url($option_logo_url) .'" /></p> </td> </tr> <tr><th scope="row" style="user-select: auto"></th> <td> <div class="siteseo-notice-pro"> <h3> '. esc_html__('Make sure your image follow these Google guidelines', 'siteseo-pro').' </h3> <ul> <li> '. esc_html__('A logo that is representative of the organization.', 'siteseo-pro').' </li> <li> '. esc_html__('Files must be BMP, GIF, JPEG, PNG, WebP or SVG.', 'siteseo-pro') .' </li> <li> '. esc_html__('The image must be 112x112px, at minimum.', 'siteseo-pro') .' </li> <li> '. esc_html__('The image URL must be crawlable and indexable.', 'siteseo-pro') .' </li> <li> '. esc_html__('Make sure the image looks how you intend it to look on a purely white background (for example, if the logo is mostly white or gray, it may not look how you want it to look when displayed on a white background).', 'siteseo-pro') .' </li> </ul> <p> <span class="siteseo-help dashicons dashicons-external"></span> <a class="siteseo-help" href="https://developers.google.com/search/docs/appearance/structured-data/logo#structured-data-type-definitions" target="_blank"> '. esc_html__('Learn more', 'siteseo-pro') .' </a> </p> </div> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Organization Legal Name', 'siteseo-pro').'</th> <td> <input type="text" name="siteseo_pro_options[org_legal]" placeholder="'.esc_attr__('Enter Organizations legal name', 'siteseo-pro').'" value="'.esc_attr($option_legal_name).'"> <p class="description">' . esc_html__('The official registered name of your organization.', 'siteseo-pro') . '</p> </td> </tr> <tr> <th scope="row" style="user-select: auto;">'.esc_html__('Organization Description', 'siteseo-pro').'</th> <td> <input type="text" name="siteseo_pro_options[org_desciption]" placeholder="'.esc_attr__('Enter Organizations description', 'siteseo-pro').'" value="'.esc_attr($option_desciption).'"> <p class="description">' . esc_html__('A brief description of your organization.', 'siteseo-pro') . '</p> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Organization Email Address', 'siteseo-pro').' </th> <td> <input type="text" name="siteseo_pro_options[org_email]" placeholder="'.esc_attr__('Enter Organizations email Id', 'siteseo-pro').'" value="'.esc_attr($option_email_id).'"> <p class="description">' . esc_html__('The primary email address for your organization.', 'siteseo-pro') . '</p> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Organization Phone Number', 'siteseo-pro').'</th> <td> <input type="text" name="siteseo_pro_options[org_phone_no]" placeholder="'.esc_attr__('Enter Organizations contact number', 'siteseo-pro').'" value="'.esc_attr($option_phone).'"> <p class="description">' . esc_html__('The main contact number for your organization.', 'siteseo-pro') . '</p> </td> </tr> <tr> <th scope="row" style="user-select:auto;">'.esc_html__('Organization Establish Date', 'siteseo-pro').'</th> <td> <input type="date" id="org_establish_date" style="width: 560px; height: 40px;" name="siteseo_pro_options[establish_date]" placeholder="Select Organization establish date" value="'.esc_attr($option_establish_date).'"> <p class="description">' . esc_html__('The date when your organization was established.', 'siteseo-pro') . '</p> </td> </tr> <tr> <th scope="row" style="user-select:auto;">Number Of Employees</th> <td> <input type="text" name="siteseo_pro_options[number_emp]" placeholder="Enter Organizations legal name" value="'.esc_attr($option_number_emp).'"> <p class="description">' . esc_html__('The total number of employees in your organization.', 'siteseo-pro') . '</p> </td> </tr> <tr> <th scope="row" style="user-select:auto;"><h2>Organization Identifiers</h2><br/></th> <td> <p class="description">' . esc_html__('We would like to know more about your organization’s identifiers. This information will assist Google in providing accurate and relevant details about your organization.', 'siteseo-pro') . '</p> </td> </tr> <tr> <th scope="row" style="user-select:auto;">VAT ID</th> <td> <input type="text" name="siteseo_pro_options[vat_id]" placeholder="Enter Organization VAT ID" value="'.esc_attr($option_vat_id).'"> <p class="description">' . esc_html__('The VAT identification number for your organization.', 'siteseo-pro') . '</p> </td> </tr> <tr> <th scope="row" style="user-select:auto;">Tax ID</th> <td> <input type="text" name="siteseo_pro_options[tax_id]" placeholder="Enter Organization Tax ID" value="'.esc_attr($option_tax_id).'"> <p class="description">' . esc_html__('The tax identification number for your organization.', 'siteseo-pro') . '</p> </td> </tr> <tr> <th scope="row" style="user-select:auto;">ISO 6523</th> <td> <input type="text" name="siteseo_pro_options[iso_code]" placeholder="Enter Organization ISO 6523" value="'.esc_attr($option_iso_id).'"> <p class="description">' . esc_html__('The ISO 6523 identification number for your organization.', 'siteseo-pro') . '</p> </td> </tr> <tr> <th scope="row" style="user-select:auto;">LEI Code</th> <td> <input type="text" name="siteseo_pro_options[let_code]" placeholder="'.esc_html__('Enter Organization LEI Code', 'siteseo-pro').'" value="'.esc_attr($option_let_code).'"> <p class="description">' . esc_html__('The LET identification number for your organization.', 'siteseo-pro') . '</p> </td> </tr> <tr> <th scope="row" style="user-select:auto;">DUNS</th> <td> <input type="text" name="siteseo_pro_options[duns_number]" placeholder="'.esc_html__('Enter Organization DUNS code', 'siteseo-pro').'" value="'.esc_attr($option_duns_number).'"> <p class="description">' . esc_html__('The DUNS identification number for your organization.', 'siteseo-pro') . '</p> </td> </tr> <tr> <th scope="row" style="user-select:auto;">NAICS</th> <td> <input type="text" name="siteseo_pro_options[naics_code]" placeholder="'.esc_html__('Enter Organization NAICS', 'siteseo-pro').'" value="'.esc_attr($option_naics_code).'"> <p class="description">' . esc_html__('The NAICS identification number for your organization.', 'siteseo-pro') . '</p> </td> </tr> </tbody> </table> <input type="hidden" name="structured_data_settings" value="1"/>'; } static function breadcrumbs(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $options = $siteseo->pro; $advanced_option = get_option('siteseo_advanced_option_name'); $options = isset($options['breadcrumbs_enable']) ? $options : $advanced_option; $enabled = !empty($options['breadcrumbs_enable']) ? $options['breadcrumbs_enable'] : ''; $separators = ['-', '|', '/', '←', '→', '↠', '⇒', '►', '—', '•', '»', '›', '–']; $separator = !empty($options['breadcrumbs_seperator']) ? $options['breadcrumbs_seperator'] : ''; $custom_separator = !empty($options['breadcrumbs_custom_seperator']) ? $options['breadcrumbs_custom_seperator'] : ''; $hide_home = isset($options['breadcrumbs_home']) ? $options['breadcrumbs_home'] : false; $home_label = !empty($options['breadcrumb_home_label']) ? $options['breadcrumb_home_label'] : __('Home', 'siteseo-pro'); $prefix = !empty($options['breadcrumb_prefix']) ? $options['breadcrumb_prefix'] : ''; echo'<h3 class="siteseo-tabs">' . esc_html__('Breadcrumbs', 'siteseo-pro') . '</h3> <p>'.esc_html__('Breadcrumbs work as a navigation tool for users, helping them know their current location and providing quick links to their previous browsing path, which improves the user experience.', 'siteseo-pro').'</p> <table class="form-table"> <tr> <th scope="row">'.esc_html__('Enable Breadcrumbs', 'siteseo-pro').'</th> <td> <label> <input type="checkbox" value="1" id="siteseo_breadcrumbs_enable" name="siteseo_pro_options[breadcrumbs_enable]" ' . checked($enabled, true, false) . '/> </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Breadcrumbs Display Methods', 'siteseo-pro').'</th> <td> <div class="siteseo-inner-tabs-wrap"> <input type="radio" id="siteseo-breadcrumbs-gutenberg" name="siteseo-inner-tabs" checked> <input type="radio" id="siteseo-breadcrumbs-shortcode" name="siteseo-inner-tabs"> <input type="radio" id="siteseo-breadcrumbs-php" name="siteseo-inner-tabs"> <ul class="siteseo-inner-tabs"> <li class="siteseo-inner-tab"><label for="siteseo-breadcrumbs-gutenberg"><span class="dashicons dashicons-block-default"></span>'.esc_html__('Gutenberg Blocks', 'siteseo-pro').'</label></li> <li class="siteseo-inner-tab"><label for="siteseo-breadcrumbs-shortcode"><span class="dashicons dashicons-shortcode"></span>'.esc_html__('Shortcode', 'siteseo-pro').'</label></li> <li class="siteseo-inner-tab"><label for="siteseo-breadcrumbs-php"><span class="dashicons dashicons-editor-code"></span>'.esc_html__('PHP Code', 'siteseo-pro').'</label></li> </ul> <div class="siteseo-inner-tab-content"> <h4>'.esc_html__('Gutenberg Block', 'siteseo-pro').'</h4> <p>'.esc_html__('Generate Block can be accessed by going to edit post using the Gutenberg Editor, the default editor of WordPress. There search for Breadcrumbs block.', 'siteseo-pro').'</p> </div> <div class="siteseo-inner-tab-content"> <h4>'.esc_html__('Shortcode', 'siteseo-pro').'</h4> <p>'.esc_html__('WordPress shortcodes are shortcuts ([shortcode]) that insert features without coding. You can use these shortcodes with Classic Editor, Gutenberg, or any other editor. Copy the shortcode below and use it in the editor.', 'siteseo-pro').'</p> <pre>'.esc_attr('[siteseo_breadcrumbs]','siteseo-pro').'</pre> </div> <div class="siteseo-inner-tab-content"> <h4>'.esc_html__('PHP Code', 'siteseo-pro').'</h4> <p>'.esc_html__('You can add the breadcrumbs by directly adding PHP code. Make sure you are aware of what you are doing. Use the code below anywhere in your theme.', 'siteseo-pro').'</p> <pre>'.esc_html("<?php if(function_exists('siteseo_render_breadcrumbs')){ echo siteseo_render_breadcrumbs(); } ?>").'</pre> </div> </div> </td> </tr> <tr> <th scope="row">'.esc_html__('Separator', 'siteseo-pro').'</th> <td> <div class="siteseo_breadcrumbs_seperator_callback"> <div class="siteseo-seperator-btns">'; foreach($separators as $sep){ $checked = ($separator == $sep) ? 'checked' : ''; echo '<label> <input type="radio" name="siteseo_pro_options[breadcrumbs_seperator]" value="' . esc_attr($sep) . '" '.esc_attr($checked).'/> '.esc_html($sep).'</label>'; } echo '</div> <input type="text" style="width:200px" name="siteseo_pro_options[breadcrumbs_custom_seperator]" placeholder="'.esc_html__('Custom Separator', 'siteseo-pro').'" value="'.esc_attr($custom_separator).'"/> </div> </div> </td> </tr> <tr> <th scope="row">'.esc_html__('Home Settings', 'siteseo-pro').'</th> <td> <div> <label style="margin:10px 0;"> <input type="checkbox" name="siteseo_pro_options[breadcrumbs_home]" ' . checked($hide_home, true, false).'/> '.esc_html__('Hide Home', 'siteseo-pro') . ' </label> <br/><br/> <label> <input type="text" name="siteseo_pro_options[breadcrumb_home_label]" placeholder="'.esc_attr__('Homepage label', 'siteseo-pro').'" value="'.esc_attr($home_label).'"/> <p class="description">'.esc_html__('Home label', 'siteseo-pro').'</p> </label> </div> </td> </tr> <tr> <th scope="row">'.esc_html__('Prefix', 'siteseo-pro').'</th> <td> <div> <label> <input type="text" id="siteseo_breadcrumbs_prefix" name="siteseo_pro_options[breadcrumb_prefix]" placeholder="'.esc_attr__('Breadcrumb Prefix', 'siteseo-pro'). '" value="'.esc_attr($prefix).'"/> </label> </div> </td> </tr> </table><input type="hidden" name="breadcrumbs_tab" value="1"/>'; } static function robots(){ echo '<h3 class="siteseo-tabs">'.esc_html__('robots.txt','siteseo-pro').'</h3><p>'. esc_html__('Manage your robots.txt file here. Adjust settings according to your SEO requirements.', 'siteseo-pro') . '</p>'; echo '<table class="form-table">'; echo '<tr><th class="row">'.esc_html__('Preview', 'siteseo-pro').'</th><td colspan="2"> <a href="'.esc_url(home_url('/robots.txt')).'" class="btn btnSecondary" style="text-decoration:none;" target="_blank">'.esc_html__('View Robots.txt', 'siteseo-pro').'</a>'; if(file_exists(ABSPATH. 'robots.txt')){ echo '<button type="button" id="siteseopro-delete-robots-txt" class="btn btnTertiary">'.esc_html__('Delete Robots.txt', 'siteseo-pro').'</button>'; } echo '</td></tr>'; $robots_txt = ''; if(file_exists(ABSPATH. 'robots.txt')){ $robots_txt = file_get_contents(ABSPATH . 'robots.txt'); } else{ $robots_txt = get_option('siteseo_pro_virtual_robots_txt'); } echo '<tr> <th class="row">'.esc_html__('robots.txt File', 'siteseo-pro').'</th> <td colspan="2"> <textarea id="siteseo_robots_file_content" placeholder="'.esc_attr__('Enter your robots.txt rules here', 'siteseo-pro').'" rows="15" cols="50">'.esc_textarea($robots_txt).'</textarea> </td> </tr> <tr> <th class="row"></th> <td class="wrap-tags"> <button class="tag-title-btn" id="siteseo_googlebots" data-tag="User-agent: Googlebot Disallow: /"><span class="dashicons dashicons-insert"></span>'.esc_html__('BLOCK GOOGLE BOTS', 'siteseo-pro').'</button> <button class="tag-title-btn" id="siteseo_bingbots" data-tag="User-agent: Bingbot Disallow: /"><span class="dashicons dashicons-insert"></span>'.esc_html__('BLOCK BING BOTS', 'siteseo-pro').'</button> <button class="tag-title-btn" id="siteseo_yandex_bots" data-tag="User-agent: Yandex Disallow: /"><span class="dashicons dashicons-insert"></span>'.esc_html__('BLOCK YANDEX BOTS', 'siteseo-pro').'</button> <button class="tag-title-btn" id="siteseo_semrushbot" data-tag="User-agent: SemrushBot Disallow: /"><span class="dashicons dashicons-insert"></span>'.esc_html__('BLOCK SEMRUSHBOT BOTS', 'siteseo-pro').'</button> <button class="tag-title-btn" id="siteseo_rss_feeds" data-tag="User-agent: * Disallow: /feed/ Disallow: /comments/feed/"><span class="dashicons dashicons-insert"></span>'.esc_html__('BLOCK RSS FEEDS', 'siteseo-pro').'</button> <button class="tag-title-btn" id="siteseo_gptbots" data-tag="User-agent: GPTBot Disallow: / User-agent: Google-Extended Disallow: / User-agent: ClaudeBot Disallow: / User-agent: PerplexityBot Disallow: / User-agent: CCBot Disallow: /"><span class="dashicons dashicons-insert"></span>'.esc_html__('BLOCK AI BOTS', 'siteseo-pro').'</button> <button class="tag-title-btn" id="siteseo_link_sitemap" data-tag="'.esc_url(get_site_url()).'/sitemaps.xml"><span class="dashicons dashicons-insert"></span>'.esc_html__('LINK TO YOUR SITEMAP', 'siteseo-pro').'</button> <button class="tag-title-btn" id="siteseo_wp_rule" data-tag="User-agent: * Disallow: /wp-admin/ Allow: /wp-admin/admin-ajax.php"><span class="dashicons dashicons-insert"></span>'.esc_html__('DEFAULT WP RULES', 'siteseo-pro').'</button> <button class="tag-title-btn" id="siteseo_majesticsbots" data-tag="User-agent: MJ12bot Disallow: /"><span class="dashicons dashicons-insert"></span>'.esc_html__('BLOCK MAJESTICSEOBOT', 'siteseo-pro').'</button> <button class="tag-title-btn" id="siteseo_ahrefsbot" data-tag="User-agent: AhrefsBot Disallow: /"><span class="dashicons dashicons-insert"></span>'.esc_html__('BLOCK AHREFS BOT', 'siteseo-pro').'</button> <button class="tag-title-btn" id="siteseo_mangools" data-tag="User-agent: MangoolsBot Disallow: /"><span class="dashicons dashicons-insert"></span>'.esc_html__('BLOCK MANGOOLS BOT', 'siteseo-pro').'</button> <button class="tag-title-btn" id="siteseo_google_ads_bots" data-tag="User-agent: Mediapartners-Google Disallow: /"><span class="dashicons dashicons-insert"></span>'.esc_html__('BLOCK GOOGLE ADSENSE BOT', 'siteseo-pro').'</button> <button class="tag-title-btn" id="siteseo_google_img_bot" data-tag="User-agent: Googlebot-Image Disallow: /"><span class="dashicons dashicons-insert"></span>'.esc_html__('BLOCK GOOGLE IMAGE BOT', 'siteseo-pro').'</button> </td> </tr> <tr> <th></th> <td colspan="2"> <button class="btn btnSecondary" id="siteseo-update-robots">'.esc_html__('Update robots.txt', 'siteseo-pro').'</button> <span class="spinner"></span> </td> </tr> </table>'; } static function htaccess(){ global $siteseo; $home_path = get_home_path(); $htaccess_file = $home_path . '.htaccess'; if(!empty($_POST['submit'])){ self::save_settings(); } echo '<h3 class="siteseo-tabs">'.esc_html__('htaccess','siteseo-pro').'</h3> <p class="description">'.esc_html__('Edit your .htaccess file to configure advanced settings for your site','siteseo-pro').'</p>'; if(!file_exists($htaccess_file) || !is_writable($htaccess_file)){ echo '<table class="siteseo-notice-table"> <tr> <td class="siteseo-notice is-error"><p>'.esc_html__('The .htaccess file does not exist or You do not have permission to edit the .htaccess file', 'siteseo-pro').'</p> </td> </tr> </table>'; return; } echo '<table class="siteseo-notice-table" style="width: 82%;padding-left:42%"> <tr> <th class="row"></th> <td colspan="2" class="siteseo-notice is-error"> <p>'.esc_html__('Be careful editing this file. If any incorrect edits are made, your site could go down. You can restore the htaccess file by replacing it with the backup copy created by SiteSEO with name .htaccess_backup.siteseo', 'siteseo-pro').' <br/><input type="checkbox" value="1" id="siteseo_htaccess_enable"/><strong>'.esc_html__('I understand the risk and I want to edit this file','siteseo-pro').'</strong> </p> </td> </tr> </table>'; $htaccess_code = file_get_contents($htaccess_file); echo '<table class="form-table" style="width: 100%;"> <tr> <th class="row">'.esc_html__('Edit your htaccess file','siteseo-pro').'</th> <td> <textarea id="siteseo_htaccess_file" name="siteseo_advanced_option_names[htaccess_code]" rows="22" style="width: 100%;">'.esc_textarea($htaccess_code).'</textarea> </td> </tr> <tr> <th class="row"></th> <td class="wrap-tags"> <button class="tag-title-btn" id="siteseo_wp_config" data-tag="Options -Indexes"><span class="dashicons dashicons-insert"></span>'.esc_html__('BLOCK DIRECTORY BROWSING', 'siteseo-pro').'</button> <button class="tag-title-btn" data-tag="Redirect 301 /your-old-url/ https://www.example.com/your-new-url" id="siteseo_error_300"><span class="dashicons dashicons-insert"></span>'.esc_html__('301 REDIRECT', 'siteseo-pro').'</button> <button class="tag-title-btn" id="siteseo_block_dir" data-tag="<files wp-config.php> order allow,deny deny from all </files>"><span class="dashicons dashicons-insert"></span>'.esc_html__('PROTECT WP-CONFIG.PHP FILE', 'siteseo-pro').'</button> </td> </tr> <tr> <th class="row"> <td style="padding-top: 10px;"> <div style="display: flex; align-items: center;"> <button id="siteseo_htaccess_btn" class="btn btnSecondary">'.esc_html__('Update htaccess.txt', 'siteseo-pro').'</button> <span class="spinner" style="margin-left: 10px;"></span> </div> </td> </th> </tr> </table>'; } static function redirect_monitoring(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $options = $siteseo->pro; $enable_404 = isset($options['enable_404_log']) ? $options['enable_404_log'] : ''; $clean_logs = isset($options['clean_404_logs']) ? $options['clean_404_logs'] : ''; $set_log_limit = isset($options['log_limits']) ? $options['log_limits'] : '100'; $redirect_type = isset($options['redirect_type']) ? $options['redirect_type'] : ''; $custom_redirect_url = isset($options['custom_redirect_url']) ? $options['custom_redirect_url'] : ''; $disable_guess_redirect = isset($options['guess_redirect']) ? $options['guess_redirect'] : ''; $enable_email_notify = isset($options['email_notify']) ? $options['email_notify'] : ''; $email_id = isset($options['send_email_to']) ? $options['send_email_to'] : ''; $disable_ip_logging = isset($options['disable_ip_logging']) ? $options['disable_ip_logging'] : ''; $redirect_code = isset($options['status_code']) ? $options['status_code'] : ''; $toggle_state_redirect = !empty($options['toggle_state_redirect_monitoring']) ? $options['toggle_state_redirect_monitoring'] : ''; $nonce = wp_create_nonce('siteseo_pro_toggle_nonce'); $default_email_id = get_option('admin_email'); if(!empty($toggle_state_redirect) && !empty($enable_404)){ $logs_data = Util::get_logs(); } echo'<h3 class="siteseo-tabs">'.esc_html__('Redirections / 404 monitoring', 'siteseo-pro').'</h3> <p>'.esc_html__('Optimize Your Site with Smart Redirects & 404 Monitoring', 'siteseo-pro').'</p>'; Util::render_toggle('404_monitoring', $toggle_state_redirect, $nonce); echo'<table class="form-table"> <tbody> <tr>'. '<th scope="row" style="user-select: auto;">'.esc_html__('404 Log', 'siteseo-pro').'</th>'. '<td><label>'. '<input name="siteseo_pro_options[404_log]" type="checkbox" ' .(!empty($enable_404) ? 'checked="yes"' : '') . ' value="1"/>'.esc_html__('Enable 404 monitoring', 'siteseo-pro') . '</label> </td> </tr> <tr> <th scope="row">'.esc_html__('404 Cleaning', 'siteseo-pro').'</th> <td><label> <input name="siteseo_pro_options[clean_404_logs]" type="checkbox" '.(!empty($clean_logs) ? 'checked="yes"' : '').' value="1"/>'. esc_html__('Automatically delete 404 after 30 days (useful if you have a lot of 404)','siteseo-pro') .'</label> </td> </tr> <tr> <th scope="row">'.esc_html__('Log Limits', 'siteseo-pro').'</th> <td><label> <input type="number" name="siteseo_pro_options[log_limits]" value="'.esc_attr($set_log_limit).'"/> </label> </td> <tr> <th scope="row">'.esc_html__('Redirect 404 to','siteseo-pro').'</th> <td> <select name="siteseo_pro_options[redirect_to]"> <option value="homepage" '.selected($redirect_type, 'Homepage', false).'>'.esc_html__('Homepage','siteseo-pro').'</option> <option value="CustomURL" '.selected($redirect_type, 'CustomURL', false).'>'.esc_html__('Custom URL','siteseo-pro').'</option> </select> </td> </tr> <tr> <th scope="row">'.esc_html__('Redirect to specific URL ','siteseo-pro').'</th> <td><label> <input name="siteseo_pro_options[redirect_url]" type="text" value="'.esc_attr($custom_redirect_url).'" placeholder="Enter your custom URL"/> </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Status code of redirection','siteseo-pro').'</th> <td><label> <select name="siteseo_pro_options[status_code]"> <option value="301redirect" '.selected($redirect_code, '301redirect', false).'>'.esc_html__('301 redirect','siteseo-pro').'</option> <option value="302redirect" '.selected($redirect_code, '302redirect', false).'>'.esc_html__('302 redirect','siteseo-pro').'</option> <option value="307redirect" '.selected($redirect_code, '307redirect', false).'>'.esc_html__('307 redirect','siteseo-pro').'</option> </select> </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Enable email notification', 'siteseo-pro').'</th> <td> <input name="siteseo_pro_options[email_notify]" type="checkbox" ' .(!empty($enable_email_notify) ? 'checked="yes"' : '').' value="1"/>'.esc_html__('1 email per week with the top 404 errors, and the latest logged (within a limit of 10)', 'siteseo-pro') . '</label> </td> </tr> <tr> <th scope="row">'.esc_html__('Send email to', 'siteseo-pro').'</th> <td> <input name="siteseo_pro_options[email_id]" type="text" value="'.esc_attr($email_id).'" placeholder="Enter your email"/> <p>'.esc_html__('If you put empty it send default admin email', 'siteseo-pro').'</p> </td> </tr> <tr> <th scope="row">'.esc_html__('Disable guess redirect url for 404','siteseo-pro').'</th> <td> <input name="siteseo_pro_options[eanble_guess_redirect]" type="checkbox" '.(!empty($disable_guess_redirect) ? 'checked="yes"' : '').' value="1"/>'. esc_html__('Stop WordPress to attempt to guess a redirect URL for a 404 request', 'siteseo-pro') .' </td> </tr> <tr> <th scope="row">'.esc_html__('Disable ip logging','siteseo-pro').'</th> <td> <select name="siteseo_pro_options[disable_ip_logging]"> <option value="no_ip_logging" '.selected($disable_ip_logging, 'no_ip_logging', false).'>'.esc_html__('No IP logging', 'siteseo-pro').'</option> <option value="full_ip_logging" '.selected($disable_ip_logging, 'full_ip_logging', false).'>'.esc_html__('Full IP logging', 'siteseo-pro').'</option> <option value="anonymize_the_last_part" '.selected($disable_ip_logging, 'anonymize_the_last_part', false).'>'.esc_html__('Anonymize the last part', 'siteseo-pro').'</option> </td> </tr>'; if(!empty($enable_404)){ echo'<tr> <th scope="row">'.esc_html__('Redirections logs', 'siteseo-pro').'</th> <table class="wp-list-table widefat fixed striped"> <thead> <tr> <th style="width: 30px; text-align: center;"><input type="checkbox" id="select-all-logs"></th> <th>'.esc_html__('URL', 'siteseo-pro').'</th> <th>'.esc_html__('IP Address', 'siteseo-pro').'</th> <th>'.esc_html__('Time', 'siteseo-pro').'</th> <th>'.esc_html__('User Agent', 'siteseo-pro').'</th> <th>'.esc_html__('Referer', 'siteseo-pro').'</th> <th>'.esc_html__('Hit count', 'siteseo-pro').'</th> </tr> </thead> <tbody>'; if(!empty($logs_data['items'])){ foreach($logs_data['items'] as $log){ echo'<tr> <td><input type="checkbox" class="log-selector" value="'.esc_attr($log->id).'"></td> <td>'.esc_html($log->url).'</td> <td>'.esc_html($log->ip_address).'</td> <td>'.esc_html($log->timestamp).'</td> <td>'.esc_html($log->user_agent).'</td> <td>'.esc_html($log->referer).'</td> <td>'.esc_html($log->hit_count).'</td> </tr>'; } } echo'</tbody> </table> </tr></br/> <th sope="row"> <button type="button" id="siteseo-remove-selected-log" class="siteseo-request-page-speed btn btnPrimary">'. esc_html__('Remove From Logs', 'siteseo-pro').'</button> <button type="button" id="siteseo_redirect_all_logs" class="siteseo-request-page-speed btn btnPrimary">'. esc_html__('Clear All Logs', 'siteseo-pro').'</button> <button type="button" id="siteseo-export-csv" class="btn btnTertiary">'.esc_html__('Export CSV', 'siteseo-pro').'</button> </th>'; } echo'</tbody> </table> <br/><br/><input type="hidden" name="404_monitoring" value="1"/>'; } static function google_news(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $settings = $siteseo->pro; $toggle_state_google_news = !empty($settings['toggle_state_google_news']) ? $settings['toggle_state_google_news'] : ''; $nonce = wp_create_nonce('siteseo_pro_toggle_nonce'); $enable_google_news = isset($settings['google_news']) ? $settings['google_news'] : ''; $publication_name = isset($settings['publication_name']) ? $settings['publication_name'] : ''; echo'<h3 class="siteseo-tabs">'.esc_html__('Google News','siteseo-pro').'</h3> <p>'.esc_html__('Enable your google News Sitemap','siteseo-pro').'</p>'; Util::render_toggle('google_news', $toggle_state_google_news, $nonce); echo'<div class="siteseo-styles pre"><pre><span class="dashicons dashicons-external"></span><a href="'.esc_url(get_option('home')).'/news.xml" target="_blank">' . esc_url(get_option('home')) . '/news.xml</a></pre></div> <table class="form-table"> <div class="siteseo-notice"> <span id="siteseo-dash-icon" class="dashicons dashicons-info"></span> <p>'.wp_kses_post('If you have not enabled sitemap settings, this feature will not be useful. <a href="?page=siteseo-sitemaps">Click here</a> to configure the settings.', 'siteseo-pro').'</p> </div> <tbody> <tr> <th scope="row">'.esc_html__('Enable google news', 'siteseo-pro').'</th> <td> <label> <input type="checkbox" name="siteseo_pro_options[google_news]" '.(!empty($enable_google_news) ? 'checked="yes"' : '') . ' value="1"/>'.esc_html__('Enable Google News sitemap', 'siteseo-pro') . '</label> </td> </tr> <tr> <th scope="row">'.esc_html__('Enter publication name', 'siteseo-pro').'</th> <td> <input type="text" placeholder="Enter your google news publication name" name="siteseo_pro_options[publication_name]" value="'.esc_attr($publication_name).'" /> </td> </tr> <tr> <th scope="row">'.esc_html__('Select post types','siteseo-pro').'</th> <td>'; $post_types = siteseo_post_types(); $selected_types = isset($settings['post_types']) && is_array($settings['post_types']) ? $settings['post_types'] : []; foreach($post_types as $post){ $post_name = $post->name; $post_label = $post->label; $is_checked = in_array($post->name, $selected_types) ? 'checked' : ''; echo'<input type="checkbox" id="post_type_'.esc_attr($post_name).'" name="siteseo_pro_options[post_types][]" value="'.esc_attr($post_name).'" ' . esc_attr($is_checked).'/>'; echo'<label for="post_type_'.esc_attr($post_name).'">'.esc_html($post_label).'</label><br /><br />'; } echo'</td> </tr> </tbody> </table><input type="hidden" name="google_news_tab" value="1"/>'; } static function video_sitemap(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $settings = $siteseo->pro; $toggle_state_video_sitemap = !empty($settings['toggle_state_video_sitemap']) ? $settings['toggle_state_video_sitemap'] : ''; $nonce = wp_create_nonce('siteseo_pro_toggle_nonce'); $enable_video_sitemap = isset($settings['enable_video_sitemap']) ? $settings['enable_video_sitemap'] : ''; echo'<h3 class="siteseo-tabs">'.esc_html__('Video Sitemap', 'siteseo-pro').'</h3> <p>'.esc_html__('Enable your video sitemap', 'siteseo-pro').'</p>'; Util::render_toggle('video_sitemap', $toggle_state_video_sitemap, $nonce); echo'<table class="form-table"> <tbody> <div class="siteseo-notice"> <span id="siteseo-dash-icon" class="dashicons dashicons-info"></span> <p>'.wp_kses_post('If you have not enabled sitemap settings, this feature will not be useful. <a href="?page=siteseo-sitemaps">Click here</a> to configure the settings.', 'siteseo-pro').'</p> </div> <tr> <th scope="row">'.esc_html__('Enable video sitemap','siteseo-pro').'</th> <td> <label> <input type="checkbox" name="siteseo_pro_options[enable_video_sitemap]" '.(!empty($enable_video_sitemap) ? 'checked="yes"' : '') . ' value="1"/>'.esc_html__('Enable video sitemap in your metabox', 'siteseo-pro').' </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Preview', 'siteseo-pro').'</th> <td> <div class="siteseo-styles pre"><pre><span class="dashicons dashicons-external"></span><a href="'.esc_url(get_option('home')).'/video-sitemap1.xml" target="_blank">' . esc_url(get_option('home')) . '/video-sitemap1.xml</a></pre></div> </td> </tr> <tr> <th scope="row">'.esc_html__('Select post types', 'siteseo-pro').'</th> <td>'; $post_types = siteseo_post_types(); $selected_types = isset($settings['video_sitemap_posts']) && is_array($settings['video_sitemap_posts']) ? $settings['video_sitemap_posts'] : []; foreach($post_types as $post){ $post_name = $post->name; $post_label = $post->label; $is_checked = in_array($post->name, $selected_types) ? 'checked' : ''; echo'<input type="checkbox" id="post_type_'.esc_attr($post_name).'" name="siteseo_pro_options[video_sitemap_posts][]" value="'.esc_attr($post_name).'" ' . esc_attr($is_checked).'/>'; echo'<label for="post_type_'.esc_attr($post_name).'">'.esc_html($post_label).'</label><br /><br />'; } echo'</td> </tr> </tbody> </table><input type="hidden" name="video_sitemap" value="1"/>'; } static function rss_sitemap(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $settings = $siteseo->pro; $toogle_state_rss_sitemap = !empty($settings['toogle_state_rss_sitemap']) ? $settings['toogle_state_rss_sitemap'] : ''; $nonce = wp_create_nonce('siteseo_pro_toggle_nonce'); $enable_rss_sitemap = !empty($settings['enable_rss_sitemap']) ? $settings['enable_rss_sitemap'] : ''; $rss_sitemap_limt = !empty($settings['rss_sitemap_limt']) ? $settings['rss_sitemap_limt'] : '50'; echo'<h3 class="siteseo-tabs">'.esc_html__('RSS sitemap', 'siteseo-pro').'</h3> <p>'.esc_html__('Enable your rss sitemap', 'siteseo-pro').'</p>'; Util::render_toggle('rss_sitemap', $toogle_state_rss_sitemap, $nonce); echo'<table class="form-table"> <tbody> <tr> <th scope="row">'.esc_html__('Enable rss sitemap', 'siteseo-pro').'</th> <td> <label> <input type="checkbox" name="siteseo_pro_options[enable_rss_sitemap]" '.(!empty($enable_rss_sitemap) ? 'checked="yes"' : '') . ' value="1"/>'.esc_html__('Enable rss sitemap for your site', 'siteseo-pro').' </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Preview', 'siteseo-pro').'</th> <td> <div class="siteseo-styles pre"><pre><span class="dashicons dashicons-external"></span><a href="'.esc_url(get_option('home')).'/sitemap.rss" target="_blank">' . esc_url(get_option('home')) . '/sitemap.rss</a></pre></div> </td> </tr> <tr> <th scope="row">'.esc_html__('Number of Posts', 'siteseo-pro').'</th> <td> <label> <input type="number" name="siteseo_pro_options[rss_sitemap_limt]" min="10" max="1000" value="'.esc_attr($rss_sitemap_limt).'"> <p class="description">'.esc_html__('Set the number of posts to include in RSS sitemaps (maximum limit: 1000 posts)', 'siteseo-pro').'</p> </label> </td> </tr> <tr> <th scope="row">'.esc_html__('Select post types', 'siteseo-pro').'</th> <td>'; $post_types = siteseo_post_types(); $selected_types = isset($settings['rss_sitemap_posts']) && is_array($settings['rss_sitemap_posts']) ? $settings['rss_sitemap_posts'] : []; foreach($post_types as $post){ $post_name = $post->name; $post_label = $post->label; $is_checked = in_array($post->name, $selected_types) ? 'checked' : ''; echo'<input type="checkbox" id="post_type_'.esc_attr($post_name).'" name="siteseo_pro_options[rss_sitemap_posts][]" value="'.esc_attr($post_name).'" ' . esc_attr($is_checked).'/>'; echo'<label for="post_type_'.esc_attr($post_name).'">'.esc_html($post_label).'</label><br /><br />'; } echo'</td> </tr> </tbody> </table><input type="hidden" name="rss_sitemap" value="1">'; } // save settings fun static function save_settings(){ global $siteseo; check_admin_referer('sitseo_pro_settings'); if(!current_user_can('manage_options') || !is_admin()){ return; } $options = $siteseo->pro; if(empty($_POST['siteseo_pro_options'])){ return; } // WooCommerce tab if(isset($_POST['woocommerce_settings'])){ $options['woocommerce_cart_page_no_index'] = isset($_POST['siteseo_pro_options']['woocommerce_cart_page_no_index']); $options['woocommerce_checkout_page_no_index'] = isset($_POST['siteseo_pro_options']['woocommerce_checkout_page_no_index']); $options['woocommerce_customer_account_page_no_index'] = isset($_POST['siteseo_pro_options']['woocommerce_customer_account_page_no_index']); $options['woocommerce_product_og_price'] = isset($_POST['siteseo_pro_options']['woocommerce_product_og_price']); $options['woocommerce_product_og_currency'] = isset($_POST['siteseo_pro_options']['woocommerce_product_og_currency']); $options['woocommerce_meta_generator'] = isset($_POST['siteseo_pro_options']['woocommerce_meta_generator']); $options['woocommerce_schema_output'] = isset($_POST['siteseo_pro_options']['woocommerce_schema_output']); $options['woocommerce_schema_breadcrumbs_output'] = isset($_POST['siteseo_pro_options']['woocommerce_schema_breadcrumbs_output']); } // Dublin Core settings if(isset($_POST['dublin_code_settings'])){ $options['dublin_core_enable'] = isset($_POST['siteseo_pro_options']['dublin_core_enable']); } // Easy Digital Downloads if(isset($_POST['digital_download_settings'])){ $options['edd_product_og_price'] = isset($_POST['siteseo_pro_options']['edd_product_og_price']); $options['edd_product_og_currency'] = isset($_POST['siteseo_pro_options']['edd_product_og_currency']); $options['edd_meta_generator'] = isset($_POST['siteseo_pro_options']['edd_meta_generator']); } // PageSpeed Settings if(isset($_POST['pagespeed_settings'])){ $options['ps_api_key'] = !empty($_POST['siteseo_pro_options']['ps_api_key']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['ps_api_key'])) : ''; } //local Business settings if(isset($_POST['local_business_settings'])){ $options['local_business_display_schema'] = !empty($_POST['siteseo_pro_options']['local_business_display_schema']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options'] ['local_business_display_schema'])) : ''; $options['street_address'] = !empty($_POST['siteseo_pro_options']['street_address']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['street_address'])) : ''; $options['city'] = !empty($_POST['siteseo_pro_options']['city']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['city'])) : ''; $options['state'] = !empty($_POST['siteseo_pro_options']['state']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['state'])) : ''; $options['postal_code'] = !empty($_POST['siteseo_pro_options']['postal_code']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['postal_code'])) : ''; $options['country'] = !empty($_POST['siteseo_pro_options']['country']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['country'])) : ''; $options['latitude'] = !empty($_POST['siteseo_pro_options']['latitude']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['latitude'])) : ''; $options['longitude'] = !empty($_POST['siteseo_pro_options']['longitude']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['longitude'])) : ''; $options['place_id'] = !empty($_POST['siteseo_pro_options']['place_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['place_id'])) : ''; $options['url'] = !empty($_POST['siteseo_pro_options']['url']) ? sanitize_url(wp_unslash($_POST['siteseo_pro_options']['url'])) : ''; $options['telephone'] = !empty($_POST['siteseo_pro_options']['telephone']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['telephone'])) : ''; $options['price_range'] = !empty($_POST['siteseo_pro_options']['price_range']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['price_range'])) : ''; $options['cuisine_served'] = !empty($_POST['siteseo_pro_options']['cuisine_served']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['cuisine_served'])) : ''; $options['accepts_reser'] = !empty($_POST['siteseo_pro_options']['accepts_reser']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['accepts_reser'])) : ''; // business type if(!empty($_POST['siteseo_pro_options']['business_type'])){ $options['business_type'] = sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['business_type'])); } // opening hours if(!empty($_POST['siteseo_pro_options']['opening_hours'])){ $opening_hours = []; foreach($_POST['siteseo_pro_options']['opening_hours'] as $day => $hours){ $opening_hours[$day] = [ 'closed' => !empty($hours['closed']), 'open_morning' => !empty($hours['open_morning']), 'open_morning_start_hour' => sanitize_text_field($hours['open_morning_start_hour']), 'open_morning_start_min' => sanitize_text_field($hours['open_morning_start_min']), 'open_morning_end_hour' => sanitize_text_field($hours['open_morning_end_hour']), 'open_morning_end_min' => sanitize_text_field($hours['open_morning_end_min']), 'open_afternoon' => !empty($hours['open_afternoon']) ? true : false, 'open_afternoon_start_hour' => sanitize_text_field($hours['open_afternoon_start_hour']), 'open_afternoon_start_min' => sanitize_text_field($hours['open_afternoon_start_min']), 'open_afternoon_end_hour' => sanitize_text_field($hours['open_afternoon_end_hour']), 'open_afternoon_end_min' => sanitize_text_field($hours['open_afternoon_end_min']) ]; } $options['opening_hours'] = $opening_hours; } } // Strutured data settings if(isset($_POST['structured_data_settings'])){ $options['enable_structured_data'] = !empty($_POST['siteseo_pro_options']['enable_structured_data']); $options['structured_data_image_url'] = !empty($_POST['siteseo_pro_options']['structured_data_image_url']) ? sanitize_url(wp_unslash($_POST['siteseo_pro_options']['structured_data_image_url'])) : ''; $options['org_desciption'] = !empty($_POST['siteseo_pro_options']['org_desciption']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['org_desciption'])) : ''; $options['org_email'] = !empty($_POST['siteseo_pro_options']['org_email']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['org_email'])) : ''; $options['org_phone_no'] = !empty($_POST['siteseo_pro_options']['org_phone_no']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['org_phone_no'])) : ''; $options['org_legal'] = !empty($_POST['siteseo_pro_options']['org_legal']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['org_legal'])) : ''; $options['establish_date'] = !empty($_POST['siteseo_pro_options']['establish_date']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['establish_date'])) : ''; $options['number_emp'] = !empty($_POST['siteseo_pro_options']['number_emp']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['number_emp'])) : ''; $options['vat_id'] = !empty($_POST['siteseo_pro_options']['vat_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['vat_id'])) : ''; $options['tax_id'] = !empty($_POST['siteseo_pro_options']['tax_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['tax_id'])) : ''; $options['iso_code'] = !empty($_POST['siteseo_pro_options']['iso_code']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['iso_code'])) : ''; $options['let_code'] = !empty($_POST['siteseo_pro_options']['let_code']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['let_code'])) : ''; $options['duns_number'] = !empty($_POST['siteseo_pro_options']['duns_number']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['duns_number'])) : ''; $options['naics_code'] = !empty($_POST['siteseo_pro_options']['naics_code']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['naics_code'])) : ''; } if(isset($_POST['breadcrumbs_tab'])){ $options['breadcrumbs_enable'] = isset($_POST['siteseo_pro_options']['breadcrumbs_enable']); $options['breadcrumbs_seperator'] = isset($_POST['siteseo_pro_options']['breadcrumbs_seperator']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['breadcrumbs_seperator'])) : ''; $options['breadcrumbs_custom_seperator'] = isset($_POST['siteseo_pro_options']['breadcrumbs_custom_seperator']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['breadcrumbs_custom_seperator'])) : ''; $options['breadcrumbs_home'] = isset($_POST['siteseo_pro_options']['breadcrumbs_home']); $options['breadcrumb_home_label'] = isset($_POST['siteseo_pro_options']['breadcrumb_home_label']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['breadcrumb_home_label'])) : ''; $options['breadcrumb_prefix'] = isset($_POST['siteseo_pro_options']['breadcrumb_prefix']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['breadcrumb_prefix'])) : ''; } if(isset($_POST['404_monitoring'])){ $options['enable_404_log'] = isset($_POST['siteseo_pro_options']['404_log']); $options['clean_404_logs'] = isset($_POST['siteseo_pro_options']['clean_404_logs']); $options['log_limits'] = isset($_POST['siteseo_pro_options']['log_limits']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['log_limits'])) : ''; $options['email_notify'] = isset($_POST['siteseo_pro_options']['email_notify']); $options['send_email_to'] = isset($_POST['siteseo_pro_options']['email_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['email_id'])) : ''; $options['guess_redirect'] = isset($_POST['siteseo_pro_options']['eanble_guess_redirect']); $options['custom_redirect_url'] = isset($_POST['siteseo_pro_options']['redirect_url']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['redirect_url'])) : ''; $options['redirect_type'] = isset($_POST['siteseo_pro_options']['redirect_to']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['redirect_to'])) : ''; $options['disable_ip_logging'] = isset($_POST['siteseo_pro_options']['disable_ip_logging']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['disable_ip_logging'])) : ''; $options['status_code'] = isset($_POST['siteseo_pro_options']['status_code']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['status_code'])) : ''; if(!empty($options['clean_404_logs'])){ // Enabling cron for cleanup if(!wp_next_scheduled('siteseo_404_cleanup')){ wp_schedule_event(time(), 'daily', 'siteseo_404_cleanup'); } } else { wp_clear_scheduled_hook('siteseo_404_cleanup'); } } if(isset($_POST['google_news_tab'])){ $options['google_news'] = isset($_POST['siteseo_pro_options']['google_news']); $options['publication_name'] = isset($_POST['siteseo_pro_options']['publication_name']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['publication_name'])) : ''; if(isset($_POST['siteseo_pro_options']['post_types'])){ $options['post_types'] = map_deep(wp_unslash($_POST['siteseo_pro_options']['post_types']), 'sanitize_text_field'); } else{ $options['post_types'] = []; } } if(isset($_POST['video_sitemap'])){ $options['enable_video_sitemap'] = isset($_POST['siteseo_pro_options']['enable_video_sitemap']); if(isset($_POST['siteseo_pro_options']['video_sitemap_posts'])){ $options['video_sitemap_posts'] = map_deep(wp_unslash($_POST['siteseo_pro_options']['video_sitemap_posts']), 'sanitize_text_field'); } else{ $options['video_sitemap_posts'] = []; } } if(isset($_POST['rss_sitemap'])){ $options['enable_rss_sitemap'] = isset($_POST['siteseo_pro_options']['enable_rss_sitemap']); $options['rss_sitemap_limt'] = isset($_POST['siteseo_pro_options']['rss_sitemap_limt']) ? sanitize_text_field(wp_unslash($_POST['siteseo_pro_options']['rss_sitemap_limt'])) : ''; $options['rss_sitemap_limt'] = intval($options['rss_sitemap_limt']); if(isset($_POST['siteseo_pro_options']['rss_sitemap_posts'])){ $options['rss_sitemap_posts'] = map_deep(wp_unslash($_POST['siteseo_pro_options']['rss_sitemap_posts']), 'sanitize_text_field'); } else{ $options['rss_sitemap_posts'] = []; } } $siteseo->pro = $options; // Updates the global variable update_option('siteseo_pro_options', $options); } } settings/pagespeed.php 0000644 00000021747 15105331773 0011072 0 ustar 00 <?php namespace SiteSEOPro\Settings; if(!defined('ABSPATH')){ die('HACKING ATTEMPT'); } class PageSpeed{ static function analysis(){ $active_tab = isset($_POST['tab']) ? 'desktop' : 'mobile'; $page_speed = get_option('siteseo_pro_page_speed'); echo '<div class="siteseo-flex siteseo-justify-center siteseo-metabox-subtabs" style="margin:10px 0"> <input type="radio" name="ps_device_type" id="siteseo-ps-mobile-tab" value="mobile" checked/> <label for="siteseo-ps-mobile-tab" class="siteseo-ps-device-toggle"> <span style="font-size:30px;display:flex;align-items:center; justify-content:center;" class="dashicons dashicons-smartphone"></span> <span style="padding:10px;font-weight:500;font-size:1.05em;padding-left:1px;">Mobile</span> </label> <input type="radio" name="ps_device_type" id="siteseo-ps-desktop-tab" value="desktop"/> <label for="siteseo-ps-desktop-tab" class="siteseo-ps-device-toggle"> <span style="font-size:30px;display:flex; align-items:center; justify-content:center;" class="dashicons dashicons-desktop"></span> <span style="padding:10px;font-weight:500;font-size:1.05em;padding-left:5px;">Desktop</span> </label> </div>'; echo'<div id="siteseo-ps-mobile" class="siteseo-flex siteseo-direction-column tab-content">'; if(!empty($page_speed['mobile'])){ self::score_graph($page_speed, 'mobile'); echo '<div style="margin-top:1%;" class="siteseo-metabox-subtabs"> <div class="siteseo-metabox-tab-label siteseo-metabox-tab-label-active" data-tab="siteseopro_audits_tab">' . esc_html__('Audits', 'siteseo-pro') . '</div> <div class="siteseo-metabox-tab-label" data-tab="siteseopro_opportunities_tab">' . esc_html__('Opportunities', 'siteseo-pro') . '</div> <div class="siteseo-metabox-tab-label" data-tab="siteseopro_diagnostics_tab">' . esc_html__('Diagnostics', 'siteseo-pro') . '</div> </div>'; self::audit_tabs($page_speed, 'mobile'); } echo'</div>'; echo'<div id="siteseo-ps-desktop" class="siteseo-direction-column tab-content">'; if(!empty($page_speed['desktop'])){ self::score_graph($page_speed, 'desktop'); echo '<div style="margin-top:1%;" class="siteseo-metabox-subtabs"> <div class="siteseo-metabox-tab-label siteseo-metabox-tab-label-active" data-tab="siteseopro_audits_tab">' . esc_html__('Audits', 'siteseo-pro') . '</div> <div class="siteseo-metabox-tab-label" data-tab="siteseopro_opportunities_tab">' . esc_html__('Opportunities', 'siteseo-pro') . '</div> <div class="siteseo-metabox-tab-label" data-tab="siteseopro_diagnostics_tab">' . esc_html__('Diagnostics', 'siteseo-pro') . '</div> </div>'; self::audit_tabs($page_speed, 'desktop'); } echo'</div>'; } static function score_graph(&$page_speed, $device){ // Score show for mobile $score = isset($page_speed[$device]['score']) ? $page_speed[$device]['score'] : null; $pagespeed_score = $score * 100; $pagespeed_color = self::set_status_color($pagespeed_score); echo '<div class="siteseopro-flex-wrapper"> <div class="siteseo-single-chart"> <svg viewBox="0 0 36 36" class="siteseo-circular-chart orange"> <path class="siteseo-circle-bg" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"/> <path class="siteseo-circle" style="stroke:' . esc_attr($pagespeed_color) . '" stroke-dasharray="' . esc_attr($pagespeed_score) . ', 100" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"/> <text x="18" y="20.35" class="siteseo-percentage">' . esc_html($pagespeed_score) . '%</text> </svg> </div> </div>'; echo '<div class="siteseo-pro-details"> <span style="color:#008000" class="dashicons dashicons-yes"></span>Good   <span style="color:#ffA500" class="dashicons dashicons-warning"></span>Warning   <span style="color:#ff0000" class="dashicons dashicons-no"></span>Errors </div>'; if(!empty($page_speed['mobile']['fetchTime'])){ $fetch_time = $page_speed['mobile']['fetchTime']; $fetch_date = date_i18n(get_option('date_format'), strtotime($fetch_time)); $fetch_time = gmdate('H:i', strtotime($fetch_time)); echo '<div class="siteseo-pro-fechtime"><span>' . esc_html__('Captured at ', 'siteseo-pro') . esc_html($fetch_date) . ', ' . esc_html($fetch_time) . ' UTC</span></div>'; } } static function audit_tabs(&$page_speed, $device){ echo '<div class="siteseo-audit-tabs siteseopro_audits_tab siteseo-metabox-tab" style="display:' . ($device == 'mobile' ? 'block' : 'none') . ';">'; foreach($page_speed[$device] as $key => $audit){ if(isset($audit['title'])){ $get_icons_audit = self::set_dash_icons($audit['score']); $title_icon_audit = $get_icons_audit['title']; $description_icon_audit = $get_icons_audit['description']; echo '<div class="audit-item">'; echo '<div class="siteseo-audit-title">'; echo $title_icon_audit . esc_html($audit['title']) . '<span style="position: absolute; right: 0;" class="toggle-icon dashicons dashicons-arrow-up-alt2"></span></div>'; if(isset($audit['description'])){ echo '<div class="description"><hr>'; echo $description_icon_audit . wp_kses_post(self::description_handle_with_url($audit['description'])) . '</div>'; } echo '</div>'; } } echo '</div>'; echo '<div class="siteseo-audit-tabs siteseopro_opportunities_tab siteseo-metabox-tab" style="display:none;">'; foreach($page_speed[$device]['opportunities'] as $opportunity){ if(isset($opportunity['title'])){ $icons_opportunity = self::set_dash_icons($opportunity['score']); $title_icon_opportunity = $icons_opportunity['title']; $description_icon_opportunity = $icons_opportunity['description']; echo '<div class="audit-item">'; echo '<div class="siteseo-audit-title">'; echo $title_icon_opportunity . esc_html($opportunity['title']) . '<span style="position: absolute; right: 0;" class="toggle-icon dashicons dashicons-arrow-up-alt2"></span></div>'; if (isset($opportunity['description'])) { echo '<div class="description"><hr>'; echo $description_icon_opportunity . wp_kses_post(self::description_handle_with_url($opportunity['description'])) . '</div>'; } echo '</div>'; } } echo '</div>'; echo '<div class="siteseo-audit-tabs siteseopro_diagnostics_tab siteseo-metabox-tab" style="display:none;">'; if(empty($page_speed['desktop']['diagnostics'])){ echo '<table style="margin-left:30%;" class="siteseo-notice-table"><tr><td class="siteseo-notice is-success"><p>'.esc_html__('No Diagnostics Available', 'siteseo-pro').'</p></td></tr></table>'; }else{ foreach($page_speed['desktop']['diagnostics'] as $diagnostic){ if(isset($diagnostic['title'])){ $icons_diagnostic = self::set_dash_icons($diagnostic['score']); $title_icon_diagnostic = $icons_diagnostic['title']; $description_icon_diagnostic = $icons_diagnostic['description']; echo '<div class="audit-item">'; echo '<div class="siteseo-audit-title">'; echo $title_icon_diagnostic . esc_html($diagnostic['title']) . '<span style="position:absolute; right:0;" class="toggle-icon dashicons dashicons-arrow-up-alt2"></span></div>'; if(isset($diagnostic['description'])){ echo '<div class="description"><hr>'; echo $description_icon_diagnostic . wp_kses_post(self::description_handle_with_url($diagnostic['description'])) . '</div>'; } echo '</div>'; } } } echo '</div>'; } static function set_status_color($score){ if($score >= 0 && $score < 49){ $status_color = '#ff0000;'; } elseif($score >= 50 && $score < 90){ $status_color = '#ffA500'; } elseif($score >= 90 && $score <= 100){ $status_color = '#008000'; } else{ $status_color = 'grey'; } return $status_color; } static function set_dash_icons($title_score){ $dashicons_title = ''; $dashicons_desc = ''; if($title_score > 0.90){ $title_icon = '<span style="color:#008000" class="dashicons dashicons-yes"></span>'; $desc_icon = '<span style="color:#008000" class="dashicons dashicons-thumbs-up"></span>'; } else if($title_score >= 0.50 && $title_score <= 0.89){ $title_icon = '<span style="color:#ffA500" class="dashicons dashicons-warning"></span>'; $desc_icon = '<span style="color:#ffA500" class="dashicons dashicons-thumbs-down"></span>'; } else{ $title_icon = '<span style="color:#ff0000" class="dashicons dashicons-no"></span>'; $desc_icon = '<span style="color:#ff0000" class="dashicons dashicons-thumbs-down"></span>'; } return ['title' => $title_icon, 'description' => $desc_icon]; } static function description_handle_with_url($description){ preg_match('/\((https?.*)\)/', trim($description), $matches); if(empty($matches[0]) || empty($matches[1])){ return $description; } $url = $matches[1]; $description = str_replace($matches[0], '', $description); $description = preg_replace_callback('/\[(.*?)\]/', function($matches) use ($url){ return '<a href="' . esc_url($url) . '" target="_blank">' . esc_html($matches[1]) . '</a>'; }, $description); return $description; } } tags.php 0000644 00000026776 15105331773 0006242 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEOPro; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Tags{ static function woocommerce_index_tags($robots){ global $siteseo; if(!class_exists('WooCommerce') || empty($siteseo->pro['toggle_state_woocommerce'])){ return $robots; } if(!empty($siteseo->pro['woocommerce_cart_page_no_index'])){ if(is_cart() && isset($robots['index'])){ unset($robots['index']); $robots['noindex'] = true; } } if(!empty($siteseo->pro['woocommerce_checkout_page_no_index'])){ if(is_checkout() && isset($robots['index'])){ unset($robots['index']); $robots['noindex'] = true; } } if(!empty($siteseo->pro['woocommerce_customer_account_page_no_index'])){ if(is_account_page() && isset($robots['index'])){ unset($robots['index']); $robots['noindex'] = true; } } return array_filter($robots); } // WooCommerce SEO Tags static function woocommerce(){ global $siteseo; if(!class_exists('WooCommerce') || empty($siteseo->pro['toggle_state_woocommerce'])){ return; } // WooCommerce Product og price meta if(!empty($siteseo->pro['woocommerce_product_og_price'])){ if(is_product() && function_exists('wc_get_product')){ $product = wc_get_product(get_the_ID()); if(!empty($product)){ $product_price = $product->get_price(); echo '<meta property="product:price:amount" content="' . esc_attr($product_price) . '" />' . "\n"; } } } // WooCommerce og currency meta if(!empty($siteseo->pro['woocommerce_product_og_currency'])){ if(function_exists('get_woocommerce_currency')){ $currency = get_woocommerce_currency(); echo '<meta property="product:price:currency" content="' . esc_attr($currency) . '" />' . "\n"; } } // woocommerce generator tag if(!empty($siteseo->pro['woocommerce_meta_generator'])){ remove_action('get_the_generator_html', 'wc_generator_tag', 10, 2); remove_action('get_the_generator_xhtml', 'wc_generator_tag', 10, 2); } // Remove WooCommerce schema output if(!empty($siteseo->pro['woocommerce_schema_output'])){ add_filter('woocommerce_structured_data_product', '__return_false'); if(function_exists('WC')){ remove_action('wp_footer', [WC()->structured_data, 'output_structured_data'], 10); remove_action('woocommerce_email_order_details', [WC()->structured_data, 'output_email_structured_data'], 30); } } // Remove wooCommerce Breadcrumbs schema output if(!empty($siteseo->pro['woocommerce_schema_breadcrumbs_output'])){ add_filter('woocommerce_structured_data_breadcrumbs', '__return_false'); } } // Easy Digital Downloads SEO tags static function easy_digital_downloads(){ global $siteseo; if(!class_exists('Easy_Digital_Downloads') || empty($siteseo->pro['toggle_state_easy_digital'])){ return; } // OG price meta if(!empty($siteseo->pro['edd_product_og_price'])){ if(function_exists('get_the_ID') && function_exists('edd_get_download_price')){ $product_id = get_the_ID(); $price = edd_get_download_price($product_id); echo '<meta property="product:price:amount" content="' . esc_attr($price) . '" />' . "\n"; } } // OG currency meta if(!empty($siteseo->pro['edd_product_og_currency'])){ if(function_exists('edd_get_currency')){ $currency = edd_get_currency(); echo '<meta property="product:price:currency" content="' . esc_attr($currency) . '" />' . "\n"; } } // Remove header if(!empty($siteseo->pro['edd_meta_generator'])){ remove_action('wp_head', 'edd_version_in_header'); } } // Dublin Core SEO tags static function dublin_core(){ global $siteseo; if(empty($siteseo->pro['dublin_core_enable']) || empty($siteseo->pro['toggle_state_dublin_core'])){ return; } if(function_exists('siteseo_titles_the_title')){ $title = siteseo_titles_the_title(); echo '<meta name="dc.title" content="' . esc_attr($title) . '" />' . "\n"; } $description = get_option('blogdescription'); if(!empty($description)){ echo '<meta name="dc.description" content="' . esc_attr($description) . '" />' . "\n"; } $source = htmlspecialchars(urldecode(user_trailingslashit(get_home_url()))); if(!empty($source)){ echo '<meta name="dc.source" content="' . esc_attr($source) . '" />' . "\n"; echo '<meta name="dc.relation" content="' . esc_attr($source) . '" />' . "\n"; } $lang = get_locale(); if(!empty($lang)){ echo '<meta name="dc.language" content="' . esc_attr($lang) . '" />' . "\n"; } $subject = get_bloginfo('description'); if(!empty($subject)){ echo '<meta name="dc.subject" content="' . esc_attr($subject) . '" />' . "\n"; } } // local business feature static function local_business(){ global $siteseo; if(empty($siteseo->pro['toggle_state_local_buz'])){ return; } $business_name = isset($siteseo->pro['business_type']) ? $siteseo->pro['business_type'] : ''; $street = isset($siteseo->pro['street_address']) ? $siteseo->pro['street_address'] : ''; $city = isset($siteseo->pro['city']) ? $siteseo->pro['city'] : ''; $state = isset($siteseo->pro['state']) ? $siteseo->pro['state'] : ''; $place_id = isset($siteseo->pro['postal_code']) ? $siteseo->pro['postal_code'] : ''; $country = isset($siteseo->pro['country']) ? $siteseo->pro['country'] : ''; $phone = isset($siteseo->pro['telephone']) ? $siteseo->pro['telephone'] : ''; $price_range = isset($siteseo->pro['price_range']) ? $siteseo->pro['price_range'] : ''; $latitude = isset($siteseo->pro['latitude']) ? $siteseo->pro['latitude'] : ''; $longitude = isset($siteseo->pro['longitude']) ? $siteseo->pro['longitude'] : ''; $output = '<div class="siteseo-local-business" itemscope itemtype="http://schema.org/LocalBusiness"> <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"> <p><span itemprop="BusinessName">'.esc_attr($business_name).'</span><br> <span itemprop="streetAddress">'.esc_attr($street).'</span><br> <span itemprop="postalCode">'.esc_attr($place_id).'</span> <span itemprop="addressLocality">'.esc_attr($city).'</span><br> <span itemprop="addressRegion">'.esc_attr($state).'</span><br /> <span itemprop="addressCountry">'.esc_attr($country).'</span></p> </div> <p>Phone: <span itemprop="telephone">'.esc_attr($phone).'</span></p>'; if(!empty($latitude) && !empty($longitude) && !empty($place_id)){ $output .= '<a href="https://www.google.com/maps/search/?api=1' . esc_attr($place_id). '&query=' .$latitude. ',' .$longitude. '" title="' . __('View this local business on Google Maps (new window)', 'siteseo-pro') . '" target="_blank">' . __('View on Google Maps', 'siteseo-pro') . '</a><br><br>'; $output .= '<div itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates"> <meta itemprop="latitude" content="' . esc_attr($latitude) . '" /> <meta itemprop="longitude" content="' . esc_attr($longitude) . '" /> </div>'; } // Opening hours if(isset($siteseo->pro['opening_hours']) && is_array($siteseo->pro['opening_hours'])){ $output .= '<div class="siteseo-local-business"> <table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse; width: 100%;">'; $days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; foreach($days as $key => $day){ $hours = $siteseo->pro['opening_hours'][$key]; if(!empty($hours['closed'])){ $output .= '<tr> <td style="text-align: center;font-weight: bold;">' . esc_html($day) . '</td> <td style="text-align: center;">Closed</td> </tr>'; } else{ $morning = ''; $afternoon = ''; if(!empty($hours['open_morning'])){ $morning = esc_html("{$hours['open_morning_start_hour']}:{$hours['open_morning_start_min']} - {$hours['open_morning_end_hour']}:{$hours['open_morning_end_min']}"); } if(!empty($hours['open_afternoon'])){ $afternoon = esc_html("{$hours['open_afternoon_start_hour']}:{$hours['open_afternoon_start_min']} - {$hours['open_afternoon_end_hour']}:{$hours['open_afternoon_end_min']}"); } $output .= '<tr> <td style="text-align: center;font-weight: bold;">' . $day . '</td> <td style="text-align:center;">'.$morning .'</td> <td style="text-align:center;">'. $afternoon .'</td> </tr>'; } } $output .= '</table></div>'; } return $output; } // structured data schema static function structured_data(){ global $siteseo; if(empty($siteseo->pro['toggle_state_stru_data']) || empty($siteseo->pro['enable_structured_data'])){ return; } if(!is_front_page() || !is_home()){ return; } // Data load $organization_logo = !empty($siteseo->pro['structured_data_image_url']) ? $siteseo->pro['structured_data_image_url'] : ''; $org_email_id = !empty($siteseo->pro['org_email']) ? $siteseo->pro['org_email'] : ''; $org_phone = !empty($siteseo->pro['org_phone_no']) ? $siteseo->pro['org_phone_no'] : ''; $org_name = !empty($siteseo->pro['org_name']) ? $siteseo->pro['org_name'] : ''; $org_legal_name = !empty($siteseo->pro['org_legal']) ? $siteseo->pro['org_legal'] : ''; $org_establish_date = !empty($siteseo->pro['establish_date']) ? $siteseo->pro['establish_date'] : ''; $org_no_emp = !empty($siteseo->pro['number_emp']) ? $siteseo->pro['number_emp'] : ''; $org_vat_id = !empty($siteseo->pro['vat_id']) ? $siteseo->pro['vat_id'] : ''; $org_tax_id = !empty($siteseo->pro['tax_id']) ? $siteseo->pro['tax_id'] : ''; $org_iso_code = !empty($siteseo->pro['iso_code']) ? $siteseo->pro['iso_code'] : ''; $org_lei_code = !empty($siteseo->pro['let_code']) ? $siteseo->pro['let_code'] : ''; $org_dnus_code = !empty($siteseo->pro['dnus_number']) ? $siteseo->pro['dnus_number'] : ''; $org_naics = !empty($siteseo->pro['naics_code']) ? $siteseo->pro['naics_code'] : ''; // JSON-LD $json_ld = [ '@context' => 'https://schema.org', '@type' => 'Organization', 'logo' => esc_url($organization_logo) ]; // Not empty if(!empty($org_email_id)) $json_ld['email'] = esc_attr($org_email_id); if(!empty($org_legal_name)) $json_ld['legalName'] = esc_attr($org_legal_name); if(!empty($org_establish_date)) $json_ld['foundingDate'] = esc_attr($org_establish_date); if(!empty($org_no_emp)) $json_ld['numberOfEmployees'] = esc_attr($org_no_emp); if(!empty($org_vat_id)) $json_ld['VatID'] = esc_attr($org_vat_id); if(!empty($org_tax_id)) $json_ld['taxID'] = esc_attr($org_tax_id); if(!empty($org_iso_code)) $json_ld['iso6523Code'] = esc_attr($org_iso_code); if(!empty($org_lei_code)) $json_ld['leiCode'] = esc_attr($org_lei_code); if(!empty($org_dnus_code)) $json_ld['duns'] = esc_attr($org_dnus_code); if(!empty($org_naics)) $json_ld['naics'] = esc_attr($org_naics); if(!empty($org_email_id) && !empty($org_phone)){ $json_ld['contactPoint'] = [ '@type' => 'ContactPoint', 'contactType' => 'Customer Support', 'email' => $org_email_id, 'telephone' => $org_phone ]; } // JSON-LD script echo '<script type="application/ld+json" class="siteseo-schema">'; echo json_encode($json_ld, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); echo '</script>'; } static function load_data_local_business($attributes){ $data = \SiteSEOPro\Tags::local_business(); if(is_front_page() && !empty($attributes['displayOnHomepage'])){ return '<div class="local-business-block">' . $data . '</div>'; } if(!is_front_page() && empty($attributes['displayOnHomepage'])){ return '<div class="local-business-block">' . $data . '</div>'; } return ''; } } videositemap.php 0000644 00000033320 15105331773 0007754 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SITSEO Team */ namespace SiteSEOPro; if(!defined('ABSPATH')){ die('Hacking Attempt !'); } class VideoSitemap{ private static $paged = 1; static function display_metabox(){ global $post; $allowed_suggestion_tags = array( 'button' => array( 'class' => array(), 'type' => array(), ), 'span' => array( 'id' => array(), 'class' => array(), ), 'div' => array( 'class' => array(), 'style' => array(), ), 'input' => array( 'type' => array(), 'class' => true, 'placeholder' => true, ) ); $exclude_post = !empty(get_post_meta($post->ID, '_siteseo_exclude_post')) ? get_post_meta($post->ID, '_siteseo_exclude_post', true) : ''; $video_title = !empty(get_post_meta($post->ID, '_siteseo_video_title', true)) ? get_post_meta($post->ID, '_siteseo_video_title', true) : ''; $video_description = !empty(get_post_meta($post->ID, '_siteseo_video_description', true)) ? get_post_meta($post->ID, '_siteseo_video_description', true) : ''; $video_thumbnail = !empty(get_post_meta($post->ID, '_siteseo_video_thumbnail', true)) ? get_post_meta($post->ID, '_siteseo_video_thumbnail', true) : ''; $video_duration = !empty(get_post_meta($post->ID, '_siteseo_video_duration', true)) ? get_post_meta($post->ID, '_siteseo_video_duration', true) : ''; $video_rating = !empty(get_post_meta($post->ID, '_siteseo_video_rating', true)) ? get_post_meta($post->ID, '_siteseo_video_rating', true) : ''; echo'<div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_exclude_post">'.esc_html__('Exclude this post', 'siteseo-pro').'</label> </div> <div class="siteseo-metabox-input-wrap"> <input type="checkbox" name="siteseo_exclude_post" '.(!empty($exclude_post) ? 'checked' : '').'/>'.esc_html__('Exclude this post form video sitemap', 'siteseo-pro').' </div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_video_title">'.esc_html__('Video Title:', 'siteseo-pro').'</label> </div> <div class="siteseo-metabox-input-wrap"> <input type="text" id="siteseo_titles_title_meta" class="siteseo_titles_title_meta" name="siteseo_video_title" value="'.esc_attr($video_title) .'" class="widefat"> <span class="description"></span> <div class="siteseo-metabox-tags"> <button type="button" class="siteseo-metabox-tag" data-tag="%%post_title%%"><span class="dashicons dashicons-plus"></span> Post Title</button> <button type="button" class="siteseo-metabox-tag" data-tag="%%sitetitle%%"><span class="dashicons dashicons-plus"></span> Site Title</button> <button type="button" class="siteseo-metabox-tag" data-tag="%%sep%%"><span class="dashicons dashicons-plus"></span>Seperator</button>'.wp_kses(siteseo_suggestion_button_metabox(), $allowed_suggestion_tags).' </div> </div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_video_description">'.esc_html__('Video Description', 'siteseo-pro').'</label> </div> <div class="siteseo-metabox-input-wrap"> <textarea id="siteseo_titles_desc_meta" name="siteseo_video_description" class="widefat" rows="3">'.esc_textarea($video_description) .'</textarea> <div class="siteseo-metabox-tags"> <button type="button" class="siteseo-metabox-tag" data-tag="%%post_excerpt%%"> <span class="dashicons dashicons-plus"></span>Post Excerpt</button>'.wp_kses(siteseo_suggestion_button_metabox(), $allowed_suggestion_tags).' </div> </div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_video_thumbnail">'.esc_html__('Thumbnail Video:', 'siteseo-pro').'</label> </div> <div class="siteseo-metabox-input-wrap"> <input type="url" id="siteseo_video_thumbnail" name="siteseo_video_thumbnail" value="'.esc_attr($video_thumbnail).'" class="widefat"> <button type="button" class="button siteseo-video-thumbnail-upload">'.esc_html__('Upload Thumbnail', 'siteseo-pro').'</button> </div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_video_duration">'.esc_html__('Duration (seconds):', 'siteseo-pro').'</label> </div> <div class="siteseo-metabox-input-wrap"> <input type="number" name="siteseo_video_duration" value="'.esc_attr($video_duration).'" min="0"> <span class="description">'.esc_html__('Video duration in seconds (e.g., 180 for 3 minutes)', 'siteseo-pro').'</span> </div> </div> <div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_video_rating">'.esc_html__('Video Rating', 'siteseo-pro').'</label> </div> <div class="siteseo-metabox-input-wrap"> <input type="number" name="siteseo_video_rating" value="'.esc_attr($video_rating).'" > <span class="description">'.esc_html__('Allowed values are float numbers in the range 0.0 to 5.0.', 'siteseo-pro').'</span> </div> </div>'; } static function save_video_sitemap($post_id, $post){ if(!isset($_POST['siteseo_metabox_nonce']) || !wp_verify_nonce(sanitize_text_field($_POST['siteseo_metabox_nonce']), 'siteseo_metabox_nonce')){ return $post_id; } //Post type object $post_type = get_post_type_object($post->post_type); //Check permission if(!current_user_can($post_type->cap->edit_post, $post_id)){ return $post_id; } if(isset($_POST['siteseo_exclude_post'])){ update_post_meta($post_id, '_siteseo_exclude_post', sanitize_text_field($_POST['siteseo_exclude_post'])); } else{ delete_post_meta($post_id, '_siteseo_exclude_post'); } if(isset($_POST['siteseo_video_title'])){ update_post_meta($post_id, '_siteseo_video_title', sanitize_text_field($_POST['siteseo_video_title'])); } else{ delete_post_meta($post_id, '_siteseo_video_title'); } if(isset($_POST['siteseo_video_description'])){ update_post_meta($post_id, '_siteseo_video_description', sanitize_text_field($_POST['siteseo_video_description'])); } else{ delete_post_meta($post_id, '_siteseo_video_description'); } if(isset($_POST['siteseo_video_thumbnail'])){ update_post_meta($post_id, '_siteseo_video_thumbnail', sanitize_text_field($_POST['siteseo_video_thumbnail'])); } else{ delete_post_meta($post_id, '_siteseo_video_thumbnail'); } if(isset($_POST['siteseo_video_duration'])){ update_post_meta($post_id, '_siteseo_video_duration', sanitize_text_field($_POST['siteseo_video_duration'])); } else{ delete_post_meta($post_id, '_siteseo_video_duration'); } if(isset($_POST['siteseo_video_rating'])){ update_post_meta($post_id, '_siteseo_video_rating', sanitize_text_field($_POST['siteseo_video_rating'])); } else{ delete_post_meta($post_id, '_siteseo_video_rating'); } } static function render_sitemap(){ global $siteseo; if(empty($siteseo->pro['toggle_state_video_sitemap']) || empty($siteseo->pro['enable_video_sitemap'])){ return; } $selected_post_types = isset($siteseo->pro['video_sitemap_posts']) ? $siteseo->pro['video_sitemap_posts'] : []; header('Content-Type: application/xml; charset=utf-8'); $offset = (1000*(self::$paged - 1)); if(get_option('permalink_structure')){ $xsl_url = home_url('/sitemaps.xsl'); } else{ $xsl_url = home_url('/?sitemaps-stylesheet=sitemap'); } echo'<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="'.esc_url($xsl_url).'" ?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">'; if(!empty($selected_post_types)){ $args = [ 'post_type' => $selected_post_types, 'post_status' => 'publish', 'numberposts' => 1000, 'offset' => $offset, 'meta_query' => [ [ 'key' => '_siteseo_robots_index', 'compare' => 'NOT EXISTS' ], [ 'key' => '_siteseo_video_disabled', 'compare' => 'NOT EXISTS' ] ] ]; $posts = get_posts($args); foreach($posts as $post){ $exclude_post = !empty(get_post_meta($post->ID, '_siteseo_exclude_post', true)) ? get_post_meta($post->ID, '_siteseo_exclude_post', true) : ''; if(!empty($exclude_post)){ continue; } $video_urls = []; $post_content = $post->post_content; preg_match_all('#(https?://)?(www\.)?(youtube|youtu|youtube-nocookie)\.(com|be)/(watch\?v=|embed/|v/|.+\?v=)?([^&"\'\s]+)#i', $post_content, $youtube_matches); if(!empty($youtube_matches[6])){ foreach($youtube_matches[6] as $video_id){ $video_urls[] = 'https://www.youtube.com/watch?v=' . $video_id; } } preg_match_all('#(https?://)?(www\.)?vimeo\.com/([0-9]+)#i', $post_content, $vimeo_matches); if(!empty($vimeo_matches[3])){ foreach($vimeo_matches[3] as $video_id){ $video_urls[] = 'https://vimeo.com/' . $video_id; } } //(mp4, webm, etc.) preg_match_all('#https?://[^\s\'"]+\.(mp4|webm|ogg|mov|avi|wmv|flv)#i', $post_content, $direct_matches); if(!empty($direct_matches[0])){ $video_urls = array_merge($video_urls, $direct_matches[0]); } $video_urls = array_unique($video_urls); if(empty($video_urls)){ continue; } $post_title = get_the_title($post->ID); $post_excerpt = get_the_excerpt($post->ID); $post_thumbnail = get_the_post_thumbnail_url($post->ID, 'medium'); $video_thumbnail = !empty(get_post_meta($post->ID, '_siteseo_video_thumbnail', true)) ? get_post_meta($post->ID, '_siteseo_video_thumbnail', true) : ($post_thumbnail ? $post_thumbnail : ''); $get_video_title = !empty(get_post_meta($post->ID, '_siteseo_video_title', true)) ? get_post_meta($post->ID, '_siteseo_video_title', true) : $post_title; $video_title = \SiteSEO\TitlesMetas::replace_variables($get_video_title); $get_video_description = !empty(get_post_meta($post->ID, '_siteseo_video_description', true)) ? get_post_meta($post->ID, '_siteseo_video_description', true) : (!empty($post_excerpt) ? $post_excerpt : $post_title); $video_description = \SiteSEO\TitlesMetas::replace_variables($get_video_description); $video_duration = !empty(get_post_meta($post->ID, '_siteseo_video_duration', true)) ? get_post_meta($post->ID, '_siteseo_video_duration', true) : ''; $video_rating = !empty(get_post_meta($post->ID, '_siteseo_video_rating', true)) ? get_post_meta($post->ID, '_siteseo_video_rating', true) : ''; echo "\t".'<url> <loc>'.esc_url(urldecode(get_permalink($post->ID))).'</loc> <lastmod>'.esc_html(get_the_modified_date('c', $post->ID)).'</lastmod>'; foreach($video_urls as $video_url){ if(empty($video_url)) { continue; } echo'<video:video>'; if(!empty($video_thumbnail)){ echo'<video:thumbnail_loc>'.esc_url($video_thumbnail).'</video:thumbnail_loc>'; } echo'<video:title>'.esc_xml($video_title).'</video:title>'; echo'<video:description>'.esc_xml($video_description).'</video:description>'; if(strpos($video_url, 'youtube.com') !== false || strpos($video_url, 'youtu.be') !== false){ echo'<video:player_loc allow_embed="yes" autoplay="ap=1">'.esc_url($video_url).'</video:player_loc>'; } else{ echo'<video:content_loc>'.esc_url($video_url).'</video:content_loc>'; } if(!empty($video_duration)){ echo'<video:duration>'.esc_xml($video_duration).'</video:duration>'; } if(!empty($video_rating)){ echo'<video:rating>'.esc_xml($video_rating).'</video:rating>'; } echo'</video:video>'; } echo'</url>'; } } echo '</urlset>'; exit; } static function render_video_xsl(){ $video_thumbnail_txt = __('Video', 'siteseo-pro'); $video_title_txt = __('Video Title', 'siteseo-pro'); $video_description_txt = __('Description', 'siteseo-pro'); $video_duration_txt = __('Duration', 'siteseo-pro'); $video_url_txt = __('Video URL', 'siteseo-pro'); return '<!-- Video Sitemap --> <thead> <tr> <th>'.esc_xml($video_thumbnail_txt).'</th> <th>'.esc_xml($video_title_txt).'</th> <th>'.esc_xml($video_description_txt).'</th> <th>'.esc_xml($video_duration_txt).'</th> <th>'.esc_xml($video_url_txt).'</th> </tr> </thead> <tbody> <xsl:for-each select="sitemap:urlset/sitemap:url/video:video"> <tr> <td> <xsl:if test="video:thumbnail_loc"> <img class="siteseo-video-thumbnail" src="{video:thumbnail_loc}" alt="Video Thumbnail"/> </xsl:if> </td> <td> <div class="siteseo-video-title"><xsl:value-of select="video:title"/></div> <div class="siteseo-video-meta"> <xsl:if test="video:publication_date"> Published: <xsl:value-of select="video:publication_date"/> </xsl:if> <xsl:if test="video:duration"> | Duration: <xsl:value-of select="video:duration"/> sec </xsl:if> </div> </td> <td> <div class="siteseo-video-description"> <xsl:value-of select="video:description"/> </div> </td> <td> <xsl:if test="video:duration"> <xsl:value-of select="video:duration"/> sec </xsl:if> </td> <td> <div class="siteseo-video-url"> <xsl:choose> <xsl:when test="video:player_loc"> <a href="{video:player_loc}" target="_blank">Watch Video</a> </xsl:when> <xsl:when test="video:content_loc"> <a href="{video:content_loc}" target="_blank">Video File</a> </xsl:when> <xsl:otherwise> No URL available </xsl:otherwise> </xsl:choose> </div> </td> </tr> </xsl:for-each> </tbody>'; } } googlenews.php 0000644 00000007424 15105331773 0007442 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SITSEO Team */ namespace SiteSEOPro; if(!defined('ABSPATH')){ die('Hacking Attempt !'); } class GoogleNews{ static function display_metabox(){ global $post; $exclude_post = !empty(get_post_meta($post->ID, '_siteseo_exclude_google_news', true)) ? get_post_meta($post->ID, '_siteseo_exclude_google_news', true) : ''; echo'<div class="siteseo-metabox-option-wrap"> <div class="siteseo-metabox-label-wrap"> <label for="siteseo_exclude_google_news">'.esc_html__('Exclude this post', 'siteseo-pro').'</label> </div> <div class="siteseo-metabox-input-wrap"> <input type="checkbox" name="siteseo_exclude_google_news" value="1" '.(!empty($exclude_post) ? 'checked' : '').'/>'. esc_html__('Exclude this post form Google News', 'siteseo-pro').' </div> </div>'; } static function save_google_news($post_id, $post){ if(!isset($_POST['siteseo_metabox_nonce']) || !wp_verify_nonce(sanitize_text_field($_POST['siteseo_metabox_nonce']), 'siteseo_metabox_nonce')){ return $post_id; } //Post type object $post_type = get_post_type_object($post->post_type); //Check permission if(!current_user_can($post_type->cap->edit_post, $post_id)){ return $post_id; } if(isset($_POST['siteseo_exclude_google_news'])){ update_post_meta($post_id, '_siteseo_exclude_google_news', sanitize_text_field($_POST['siteseo_exclude_google_news'])); } else{ delete_post_meta($post_id, '_siteseo_exclude_google_news'); } } static function google_news_sitemap(){ global $siteseo; $settings = $siteseo->pro; if(empty($settings['toggle_state_google_news']) || empty($settings['google_news'])){ return; } $publication_name = isset($siteseo->pro['publication_name']) ? $siteseo->pro['publication_name'] : get_bloginfo('name'); $selected_post_types = isset($siteseo->pro['post_types']) ? $siteseo->pro['post_types'] : []; header('Content-Type: application/xml; charset=utf-8'); if(get_option('permalink_structure')){ $xsl_url = home_url('/sitemaps.xsl'); } else{ $xsl_url = home_url('/?sitemaps-stylesheet=sitemap'); } echo'<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="' . esc_url($xsl_url) . '" ?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">'; if(!empty($selected_post_types)){ //date $date = new \DateTime(); $last_48_hours = $date->modify('-48 hours')->format('Y-m-d\TH:i:sP'); $args = [ 'post_type' => $selected_post_types, 'post_status' => 'publish', 'posts_per_page' => 1000, 'orderby' => 'modified', 'order' => 'DESC', 'date_query' => [ 'after' => $last_48_hours, ], 'meta_query' => [ [ 'key' => '_siteseo_robots_index', 'compare' => 'NOT EXISTS' ] ] ]; $posts = get_posts($args); foreach($posts as $post){ $post_date = get_the_date('Y-m-d\TH:i:sP', $post->ID); $title = get_the_title($post->ID); $exclude_post = !empty(get_post_meta($post->ID, '_siteseo_exclude_google_news', true)) ? get_post_meta($post->ID, '_siteseo_exclude_google_news', true) : ''; if(!empty($exclude_post)){ continue; } echo "\t".'<url> <loc>'.esc_url(urldecode(get_permalink($post->ID))).'</loc> <lastmod>'.esc_html(get_the_modified_date('c', $post->ID)).'</lastmod> <news:news> <news:publication> <news:name>'.esc_html($publication_name).'</news:name> <news:language>' . esc_html(substr(get_locale(), 0, 2)) . '</news:language> </news:publication> <news:publication_date>'.esc_html($post_date).'</news:publication_date> <news:title>'.esc_html($title).'</news:title>'; echo'</news:news> </url>'; } } echo'</urlset>'; exit; } } breadcrumbs.php 0000644 00000016053 15105331773 0007560 0 ustar 00 <?php /* * SITESEO * https://siteseo.io * (c) SiteSEO Team */ namespace SiteSEOPro; if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } class Breadcrumbs{ static function enable_breadcrumbs(){ global $siteseo; $settings = $siteseo->pro; $advanced_option = get_option('siteseo_advanced_option_name'); $settings = isset($settings['breadcrumbs_enable']) ? $settings : $advanced_option; if(!empty($settings['breadcrumbs_enable'])){ add_shortcode('siteseo_breadcrumbs', '\SiteSEOPro\Breadcrumbs::render'); } } static function render(){ global $post,$siteseo; $settings = $siteseo->pro; $advanced_option = get_option('siteseo_advanced_option_name'); $settings = isset($settings['breadcrumbs_enable']) ? $settings : $advanced_option; $breadcrumbs = []; $seperator = !empty($settings['breadcrumbs_seperator']) ? $settings['breadcrumbs_seperator'] : '/'; $prefix = !empty($settings['breadcrumb_prefix']) ? $settings['breadcrumb_prefix'] : ''; if(!empty($prefix)){ $breadcrumbs[]
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Generation time: 0.11 |
proxy
|
phpinfo
|
Settings