230500
This commit is contained in:
2210
backup/wp/wp-content/plugins/pagelayer/main/ajax.php
Normal file
2210
backup/wp/wp-content/plugins/pagelayer/main/ajax.php
Normal file
File diff suppressed because it is too large
Load Diff
539
backup/wp/wp-content/plugins/pagelayer/main/blocks.php
Normal file
539
backup/wp/wp-content/plugins/pagelayer/main/blocks.php
Normal file
@@ -0,0 +1,539 @@
|
||||
<?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_VERSION')) {
|
||||
exit('Hacking Attempt !');
|
||||
}
|
||||
|
||||
if( version_compare( get_bloginfo( 'version' ), '5.8', '>=' ) ){
|
||||
add_filter( 'block_categories_all', 'pagelayer_block_category', 999999999);
|
||||
}else{
|
||||
add_filter( 'block_categories', 'pagelayer_block_category', 999999999 );
|
||||
}
|
||||
|
||||
function pagelayer_block_category( $categories ) {
|
||||
|
||||
// Create a custom category and add it at the beginning of the list
|
||||
array_unshift($categories, array(
|
||||
'slug' => 'pagelayer',
|
||||
'title' => 'Pagelayer',
|
||||
));
|
||||
|
||||
return $categories;
|
||||
}
|
||||
|
||||
function pagelayer_block_name_by_tag($tag){
|
||||
return 'pagelayer/' . str_replace('_', '-', $tag);
|
||||
}
|
||||
|
||||
add_action('template_redirect', 'pagelayer_block_init');
|
||||
function pagelayer_block_init(){
|
||||
global $pagelayer;
|
||||
|
||||
if(!function_exists('register_block_type') || !pagelayer_has_blocks()){
|
||||
return;
|
||||
}
|
||||
|
||||
// Load shortcode
|
||||
pagelayer_load_shortcodes();
|
||||
|
||||
$pl_blocks_styles = $pagelayer->styles;
|
||||
$pl_attrs = [];
|
||||
|
||||
foreach ($pagelayer->shortcodes as $block => $pl_props) {
|
||||
|
||||
if(!empty($pl_props['no_gt']) || $pl_props['group'] == 'woocommerce'){
|
||||
continue;
|
||||
}
|
||||
|
||||
// Create attribute Object
|
||||
$attributes = [];
|
||||
$pagelayer_tabs = ['settings', 'options'];
|
||||
|
||||
foreach($pagelayer_tabs as $tab){
|
||||
$section_close = false; // First section always open
|
||||
|
||||
foreach($pl_props[$tab] as $section => $props){
|
||||
$props = array_key_exists($section, $pl_props) ? $pl_props[$section] : $pl_blocks_styles[$section];
|
||||
|
||||
// Reset / Create the cache
|
||||
foreach($props as $x => $prop){
|
||||
$attributes[$x] = [
|
||||
'type' => $prop['type']
|
||||
];
|
||||
|
||||
if ($prop['type'] === 'image') {
|
||||
$attributes['pagelayer-srcset'] = [
|
||||
'type' => 'string'
|
||||
];
|
||||
}
|
||||
|
||||
// Are we to set this value?
|
||||
if (isset($prop['default']) && !empty($prop['default'])) {
|
||||
$tmp_val = $prop['default'];
|
||||
|
||||
// If there is a unit and there is no unit suffix in atts value
|
||||
if(isset($prop['units'])){
|
||||
if (is_numeric($tmp_val)) {
|
||||
$tmp_val = $tmp_val . $prop['units'][0];
|
||||
} else {
|
||||
$sep = isset($prop['sep']) ? $prop['sep'] : ',';
|
||||
$tmp2 = explode($sep, $tmp_val);
|
||||
foreach ($tmp2 as $k => $value) {
|
||||
if (is_numeric($value)) {
|
||||
$tmp2[$k] = $value . $prop['units'][0];
|
||||
}
|
||||
}
|
||||
$tmp_val = implode($sep, $tmp2);
|
||||
}
|
||||
}
|
||||
|
||||
$attributes[$x]['default'] = $tmp_val;
|
||||
}
|
||||
|
||||
$modes = ['tablet', 'mobile'];
|
||||
|
||||
// Do we have screen?
|
||||
if (array_key_exists('screen', $prop)) {
|
||||
foreach ($modes as $m) {
|
||||
$prop_name = $x . '_' . $m;
|
||||
|
||||
$attributes[$prop_name] = [
|
||||
'type' => $prop['type']
|
||||
];
|
||||
|
||||
// TODO:
|
||||
// if (array_key_exists('default', $props[$prop_name])) {
|
||||
// $attributes[$prop_name]['default'] = $props[$x]['default'];
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Register blocks
|
||||
register_block_type(
|
||||
pagelayer_block_name_by_tag($block),
|
||||
array(
|
||||
'attributes' => $attributes,
|
||||
'render_callback' => 'pagelayer_block_renderer',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function pagelayer_block_renderer($attributes, $content, $_this){
|
||||
global $pagelayer;
|
||||
|
||||
$parsed_block = $_this->parsed_block;
|
||||
$block_name = $parsed_block['blockName'];
|
||||
$tag = '';
|
||||
$inner_blocks = array(
|
||||
'blocks' => $parsed_block['innerBlocks'],
|
||||
'content' => $parsed_block['innerContent']
|
||||
);
|
||||
$attributes['is_not_sc'] = 1;
|
||||
|
||||
if ( is_string( $block_name ) && 0 === strpos( $block_name, 'pagelayer/' ) ) {
|
||||
$tag = substr( $block_name, 10 );
|
||||
}
|
||||
|
||||
// Convert as pagelayer shortcode
|
||||
$tag = str_replace('-', '_', $tag);
|
||||
|
||||
if( empty($tag) || !array_key_exists($tag, $pagelayer->shortcodes) ){
|
||||
return '';
|
||||
}
|
||||
|
||||
return pagelayer_render_shortcode($attributes, $content, $tag, $inner_blocks);
|
||||
}
|
||||
|
||||
add_action('enqueue_block_editor_assets', 'pagelayer_enqueue_block_assets');
|
||||
function pagelayer_enqueue_block_assets(){
|
||||
global $pagelayer;
|
||||
|
||||
wp_enqueue_style( 'pagelayer-block-icon', PAGELAYER_CSS . '/pagelayer-icons.css', array('wp-edit-blocks'), PAGELAYER_VERSION );
|
||||
|
||||
// Load styles and javascript
|
||||
pagelayer_enqueue_frontend(true);
|
||||
|
||||
wp_enqueue_style( 'pagelayer-block-editor', PAGELAYER_CSS . '/pagelayer-blocks.css', array('wp-edit-blocks'), PAGELAYER_VERSION );
|
||||
|
||||
// Components
|
||||
wp_enqueue_script( 'pagelayer-blocks', PAGELAYER_JS . '/blocks/index.js', [ 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n' ], PAGELAYER_VERSION, true );
|
||||
|
||||
// Load shortcode
|
||||
pagelayer_load_shortcodes();
|
||||
|
||||
// Load fonts
|
||||
pagelayer_load_font_options();
|
||||
|
||||
$shortcodes = array();
|
||||
|
||||
foreach($pagelayer->shortcodes as $block => $pl_props) {
|
||||
|
||||
if(!empty($pl_props['no_gt']) || $pl_props['group'] == 'woocommerce'){
|
||||
continue;
|
||||
}
|
||||
|
||||
$shortcodes[$block] = $pl_props;
|
||||
}
|
||||
|
||||
wp_localize_script( 'pagelayer-blocks', 'pagelayer_config',
|
||||
array(
|
||||
'pagelayer_shortcodes' => $shortcodes,
|
||||
'pagelayer_styles' => $pagelayer->styles,
|
||||
'pagelayer_groups' => $pagelayer->groups,
|
||||
'internal_linking_nonce' => wp_create_nonce('internal-linking'),
|
||||
'pagelayer_fonts' => $pagelayer->fonts,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Load global JS
|
||||
add_action( 'admin_print_scripts', 'pagelayer_block_global_js');
|
||||
function pagelayer_block_global_js(){
|
||||
global $pagelayer, $post;
|
||||
|
||||
// For gutenberg
|
||||
if(!pagelayer_is_gutenberg_editor()){
|
||||
return;
|
||||
}
|
||||
|
||||
// Load global colors and fonts
|
||||
pagelayer_load_global_palette();
|
||||
|
||||
$pagelayer_recaptch_lang = get_option('pagelayer_google_captcha_lang');
|
||||
|
||||
// Get CAPTCHA site key
|
||||
$pagelayer_recaptch_site_key = get_option('pagelayer_google_captcha');
|
||||
$pro_url = defined('POPULARFX_PRO_URL') ? POPULARFX_PRO_URL : PAGELAYER_PRO_URL;
|
||||
$pro_txt = defined('POPULARFX_PRO_URL') ? 'PopularFX Pro' : 'Pagelayer Pro';
|
||||
|
||||
echo '<script type="text/javascript" id="pagelayer-block-global-js">
|
||||
pagelayer_ajax_url = "'.admin_url( 'admin-ajax.php' ).'?";
|
||||
pagelayer_url = "'.PAGELAYER_URL.'";
|
||||
pagelayer_ver = "'.PAGELAYER_VERSION.'";
|
||||
pagelayer_global_nonce = "'.wp_create_nonce('pagelayer_global').'";
|
||||
pagelayer_server_time = '.time().';
|
||||
pagelayer_pro = '.(int)defined('PAGELAYER_PREMIUM').';
|
||||
pagelayer_is_live = 1;
|
||||
pagelayer_pro_url = "'. $pro_url .'";
|
||||
pagelayer_pro_txt = "'. $pro_txt .'";
|
||||
pagelayer_facebook_id = "'.get_option('pagelayer-fbapp-id').'";
|
||||
pagelayer_settings = '.json_encode($pagelayer->settings).';
|
||||
pagelayer_recaptch_lang = "'.(!empty($pagelayer_recaptch_lang) ? $pagelayer_recaptch_lang : '').'";
|
||||
pagelayer_global_colors = '.json_encode($pagelayer->global_colors).';
|
||||
pagelayer_global_fonts = '.json_encode($pagelayer->global_fonts).';
|
||||
pagelayer_ajax_nonce = "'.wp_create_nonce('pagelayer_ajax').'";
|
||||
pagelayer_post_permalink = "'.get_permalink($post->ID).'";
|
||||
pagelayer_author = '.json_encode(pagelayer_author_data($post->ID)).';
|
||||
pagelayer_postID = "'.$post->ID.'";
|
||||
pagelayer_site_logo = '.json_encode(pagelayer_site_logo()).';
|
||||
pagelayer_recaptch_site_key = "'.(!empty($pagelayer_recaptch_site_key) ? $pagelayer_recaptch_site_key : '').'";
|
||||
pagelayer_global_colors = '.json_encode($pagelayer->global_colors).';
|
||||
pagelayer_global_fonts = '.json_encode($pagelayer->global_fonts).';
|
||||
pagelayer_loaded_icons = '.json_encode(pagelayer_enabled_icons()).';
|
||||
pagelayer_customizer_url = "'.admin_url("/customize.php?return=").urlencode($_SERVER['HTTP_REFERER']).'";
|
||||
pagelayerCacheBlockTags = {};
|
||||
</script>';
|
||||
|
||||
echo '<style id="pagelayer-block-global-style">
|
||||
@media (min-width: '.($pagelayer->settings['tablet_breakpoint'] + 1).'px){
|
||||
.pagelayer-hide-desktop{
|
||||
filter:blur(3px);
|
||||
}
|
||||
.pagelayer-hide-desktop *{
|
||||
filter:blur(2px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: '.$pagelayer->settings['tablet_breakpoint'].'px) and (min-width: '.($pagelayer->settings['mobile_breakpoint'] + 1).'px){
|
||||
.pagelayer-hide-tablet{
|
||||
filter:blur(3px);
|
||||
}
|
||||
.pagelayer-hide-tablet *{
|
||||
filter:blur(2px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: '.$pagelayer->settings['mobile_breakpoint'].'px){
|
||||
.pagelayer-hide-mobile{
|
||||
filter:blur(3px);
|
||||
}
|
||||
|
||||
.pagelayer-hide-mobile *{
|
||||
filter:blur(2px);
|
||||
}
|
||||
}
|
||||
</style>';
|
||||
|
||||
}
|
||||
|
||||
// Schema for save contact form template via react
|
||||
add_action( 'init', 'pagelayer_register_metadata' );
|
||||
function pagelayer_register_metadata() {
|
||||
|
||||
register_meta(
|
||||
'post',
|
||||
'pagelayer_contact_templates',
|
||||
array(
|
||||
'type' => 'object',
|
||||
'description' => 'Contacts Data',
|
||||
'single' => true,
|
||||
'show_in_rest' => array(
|
||||
'schema' => array(
|
||||
'additionalProperties' => true,
|
||||
'items' => array(
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'auth_callback' => function() {
|
||||
return current_user_can('edit_posts');
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
register_meta(
|
||||
'post',
|
||||
'_pagelayer_content',
|
||||
array(
|
||||
'type' => 'string',
|
||||
'description' => 'Menu Content',
|
||||
'single' => true,
|
||||
'show_in_rest' => true,
|
||||
'auth_callback' => function() {
|
||||
return current_user_can('edit_posts');
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
add_filter( 'the_post', 'pagelayer_blocks_the_post' );
|
||||
function pagelayer_blocks_the_post( $post ) {
|
||||
|
||||
if(!pagelayer_is_gutenberg_editor() || !has_blocks( $post ) ){
|
||||
return;
|
||||
}
|
||||
|
||||
// call block register
|
||||
// It is being used to load the runtime font family
|
||||
pagelayer_block_init();
|
||||
|
||||
$post->post_content = pagelayer_add_tmp_atts($post->post_content);
|
||||
}
|
||||
|
||||
// Add tmp attribute to block code
|
||||
function pagelayer_add_tmp_atts($content){
|
||||
|
||||
$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_serialize_block($block);
|
||||
$output .= serialize_block($_block);
|
||||
continue;
|
||||
}
|
||||
|
||||
$output .= serialize_block($block);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function pagelayer_serialize_block($block){
|
||||
global $pagelayer;
|
||||
|
||||
// Load shortcode
|
||||
pagelayer_load_shortcodes();
|
||||
|
||||
// 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];
|
||||
$el = array(
|
||||
'atts' => $block['attrs'],
|
||||
'tmp' => []
|
||||
);
|
||||
|
||||
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($el['atts'][$prop])){
|
||||
continue;
|
||||
}
|
||||
|
||||
// Load any attachment values - This should go on top in the newer version @TODO
|
||||
if(in_array($param['type'], ['image', 'video', 'audio', 'media'])){
|
||||
$attachment = ($param['type'] == 'image') ? pagelayer_image(@$el['atts'][$prop]) : pagelayer_attachment(@$el['atts'][$prop]);
|
||||
|
||||
if(!empty($attachment)){
|
||||
foreach($attachment as $k => $v){
|
||||
$el['tmp'][$prop.'-'.$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Load any attachment values - This should go on top in the newer version @TODO
|
||||
if($param['type'] == 'multi_image'){
|
||||
|
||||
$img_ids = pagelayer_maybe_explode(',', $el['atts'][$prop]);
|
||||
$img_urls = [];
|
||||
|
||||
// Make the image URL
|
||||
foreach($img_ids as $k => $v){
|
||||
$image = pagelayer_image($v);
|
||||
$img_urls['i'.$v] = @$image['url'];
|
||||
}
|
||||
|
||||
$el['tmp'][$prop.'-urls'] = json_encode($img_urls);
|
||||
}
|
||||
|
||||
// Load permalink values
|
||||
if($param['type'] == 'link'){
|
||||
|
||||
$link = $el['atts'][$prop];
|
||||
|
||||
if( is_array($el['atts'][$prop]) ){
|
||||
|
||||
// Link is required for check IF and IF-EXT in html
|
||||
if(!isset($el['atts'][$prop]['link']) || strlen(trim($el['atts'][$prop]['link'])) < 1){
|
||||
$link = '';
|
||||
unset($el['atts'][$prop]);
|
||||
continue;
|
||||
}
|
||||
|
||||
$link = $el['atts'][$prop]['link'];
|
||||
}
|
||||
|
||||
$el['tmp'][$prop] = pagelayer_permalink($link);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$func = null;
|
||||
|
||||
if(substr($pl_tag, 0, 3) == 'pl_'){
|
||||
$func = 'pagelayer_sc_block_'.substr($pl_tag, 3);
|
||||
}
|
||||
|
||||
if(function_exists($func)){
|
||||
call_user_func_array($func, array(&$el));
|
||||
}
|
||||
|
||||
if(!empty($el['tmp'])){
|
||||
$_tmp = $el['tmp'];
|
||||
$block['attrs']['tmpAtts'] = array_filter($_tmp);
|
||||
}
|
||||
|
||||
// If block saved by Pagelayer Editor
|
||||
if(strpos($block['blockName'], '_') !== false){
|
||||
$block['blockName'] = str_replace('_', '-', $block['blockName']);
|
||||
}
|
||||
}
|
||||
|
||||
// This have innerBlocks
|
||||
if(!empty($block['innerBlocks'])){
|
||||
foreach($block['innerBlocks'] as $key => $inner_block){
|
||||
$block['innerBlocks'][$key] = pagelayer_serialize_block($inner_block);
|
||||
}
|
||||
}
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
||||
// TODO: create a seprate file or use all the functions from pagelayer editor files
|
||||
//Grid Gallery Handler
|
||||
function pagelayer_sc_block_grid_gallery(&$el){
|
||||
|
||||
if(empty($el['atts']['ids'])){
|
||||
$el['atts']['ids'] = '';
|
||||
}
|
||||
|
||||
$ids = pagelayer_maybe_explode(',', $el['atts']['ids']);
|
||||
$urls = [];
|
||||
$all_urls = [];
|
||||
$size = $el['atts']['size'];
|
||||
|
||||
// Make the image URL
|
||||
foreach($ids as $k => $v){
|
||||
|
||||
$image = pagelayer_image($v);
|
||||
|
||||
$urls['i'.$v] = @$image['url'];
|
||||
$links['i'.$v] = @$image['link'];
|
||||
$titles['i'.$v] = @$image['title'];
|
||||
$captions['i'.$v] = @$image['caption'];
|
||||
|
||||
foreach($image as $kk => $vv){
|
||||
$si = strstr($kk, '-url', true);
|
||||
if(!empty($si)){
|
||||
$all_urls['i'.$v][$si] = $vv;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Make the TMP vars
|
||||
if(!empty($urls)){
|
||||
$el['tmp']['ids-urls'] = json_encode($urls);
|
||||
$el['tmp']['ids-all-urls'] = json_encode($all_urls);
|
||||
$el['tmp']['ids-all-links'] = json_encode($links);
|
||||
$el['tmp']['ids-all-titles'] = json_encode($titles);
|
||||
$el['tmp']['ids-all-captions'] = json_encode($captions);
|
||||
}
|
||||
}
|
||||
169
backup/wp/wp-content/plugins/pagelayer/main/class.php
Normal file
169
backup/wp/wp-content/plugins/pagelayer/main/class.php
Normal file
@@ -0,0 +1,169 @@
|
||||
<?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_VERSION')) {
|
||||
exit('Hacking Attempt !');
|
||||
}
|
||||
|
||||
// PageLayer Class
|
||||
class PageLayer{
|
||||
|
||||
// All Settings
|
||||
var $settings = array();
|
||||
|
||||
// Cache
|
||||
var $cache = array();
|
||||
|
||||
// Common Styles Params
|
||||
var $styles = array();
|
||||
|
||||
// All Shortcodes
|
||||
var $shortcodes = array();
|
||||
|
||||
// All Shortcodes Groups
|
||||
var $groups = array();
|
||||
|
||||
// Builder definition
|
||||
var $builder = array();
|
||||
|
||||
// The Lang Strings
|
||||
var $l = array();
|
||||
|
||||
// Runtime fonts
|
||||
var $runtime_fonts = array();
|
||||
var $fonts_sent = array();
|
||||
var $system_fonts = array();
|
||||
var $typo_props = array();
|
||||
|
||||
// Array of all the template paths
|
||||
var $all_template_paths = array();
|
||||
|
||||
// Tabs visible in the left panel
|
||||
var $tabs = ['settings', 'options'];
|
||||
|
||||
// Tabs visible in the left panel
|
||||
var $screens = ['desktop' => '', 'tablet' => 'tablet', 'mobile' => 'mobile'];
|
||||
|
||||
// Icons set
|
||||
var $icons = ['font-awesome5'];
|
||||
|
||||
// For exporting templates
|
||||
var $media_to_export = array();
|
||||
|
||||
// For global widget
|
||||
var $global_widgets = array();
|
||||
|
||||
// For global section
|
||||
var $global_sections = array();
|
||||
|
||||
// For saved sections
|
||||
var $saved_sections = array();
|
||||
|
||||
// For saved default params
|
||||
var $default_params = array();
|
||||
|
||||
// Youtube API
|
||||
var $append_yt_api = false;
|
||||
|
||||
var $css = array();
|
||||
var $css_settings = array();
|
||||
|
||||
// Customizer options
|
||||
var $customizer_mods = array();
|
||||
var $customizer_params = array();
|
||||
|
||||
var $data_attr = array();
|
||||
var $sc_audio_enqueued = 0;
|
||||
|
||||
var $support = 'http://pagelayer.deskuss.com';
|
||||
|
||||
// Global colors and typographies
|
||||
var $global_colors = array();
|
||||
var $global_fonts = array();
|
||||
|
||||
function __construct() {
|
||||
|
||||
// Load the langs
|
||||
$this->l = @file_get_contents(PAGELAYER_DIR.'/languages/en.json');
|
||||
$this->l = @json_decode($this->l, true);
|
||||
|
||||
// Add after plugins_loaded
|
||||
add_action('plugins_loaded', [ $this, 'load_extra_languages' ], 11);
|
||||
|
||||
// Array of font options
|
||||
$this->css_settings = ['body' => ['name' => 'Body', 'key' => 'pagelayer_body_typography'],
|
||||
'header' => ['name' => 'Site Header', 'sel' => '> header'],
|
||||
'main' => ['name' => 'Site Main', 'sel' => '.site-main'],
|
||||
'footer' => ['name' => 'Site Footer', 'sel' => '> footer'],
|
||||
'entry-header' => ['name' => 'Content Header', 'sel' => '.entry-header'],
|
||||
'entry-content' => ['name' => 'Content', 'sel' => '.entry-content'],
|
||||
'entry-footer' => ['name' => 'Content Footer', 'sel' => '.entry-footer'],
|
||||
'p' => ['name' => 'Paragraph'],
|
||||
'aside' => ['name' => 'Sidebar'],
|
||||
'a' => ['name' => 'Link'],
|
||||
'a-hover' => ['name' => 'Link Hover', 'sel' => 'a:hover'],
|
||||
'h1' => ['name' => 'H1', 'key' => 'pagelayer_h1_typography'],
|
||||
'h2' => ['name' => 'H2', 'key' => 'pagelayer_h2_typography'],
|
||||
'h3' => ['name' => 'H3', 'key' => 'pagelayer_h3_typography'],
|
||||
'h4' => ['name' => 'H4', 'key' => 'pagelayer_h4_typography'],
|
||||
'h5' => ['name' => 'H5', 'key' => 'pagelayer_h5_typography'],
|
||||
'h6' => ['name' => 'H6', 'key' => 'pagelayer_h6_typography'],
|
||||
'b' => ['name' => 'Bold', 'sel' => 'strong, body.pagelayer-body b'],
|
||||
'i' => ['name' => 'Italics', 'sel' => 'em, body.pagelayer-body i:not(.fa, .fas, .far, .fab)'],
|
||||
];
|
||||
|
||||
$this->system_fonts = ['Arial', 'Arial Black', 'Courier', 'Georgia', 'Helvetica', 'impact', 'Tahoma', 'Times New Roman', 'Trebuchet MS', 'Verdana'];
|
||||
$this->customizer_mods = get_option('pagelayer_customizer_mods', []);
|
||||
$this->support = (defined('SITEPAD') ? 'http://sitepad.deskuss.com' : $this->support);
|
||||
$this->typo_props = ['font-family', 'font-size', 'font-style', 'font-weight', 'font-variant', 'text-decoration-line', 'text-decoration-style', 'line-height', 'text-transform', 'letter-spacing', 'word-spacing'];
|
||||
|
||||
}
|
||||
|
||||
function default_font_styles( $args = array()){
|
||||
|
||||
$default_font_styles = [
|
||||
'font-family' => 'Open Sans',
|
||||
'font-size' => '',
|
||||
'font-style' => '',
|
||||
'font-variant' => '',
|
||||
'font-weight' => '',
|
||||
'letter-spacing' => '',
|
||||
'line-height' => '',
|
||||
'text-decoration-line' => '',
|
||||
'text-decoration-style' => '',
|
||||
'text-transform' => '',
|
||||
'word-spacing' => ''
|
||||
];
|
||||
|
||||
return array_merge($default_font_styles, $args);
|
||||
}
|
||||
|
||||
function load_extra_languages(){
|
||||
|
||||
if(defined('SITEPAD')){
|
||||
$this->l['email_desc'] = 'To change the email, visit your '.BRAND_SM.' Dashboard -> Settings -> Editor Settings';
|
||||
$this->l['CMA_desc'] = 'To change text, visit your '.BRAND_SM.' Dashboard -> Settings -> Editor Settings';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
296
backup/wp/wp-content/plugins/pagelayer/main/custom_fonts.php
Normal file
296
backup/wp/wp-content/plugins/pagelayer/main/custom_fonts.php
Normal file
@@ -0,0 +1,296 @@
|
||||
<?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_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');
|
||||
function pagelayer_remove_screen_options() {
|
||||
if(get_post_type() == PAGELAYER_FONT_POST_TYPE) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,785 @@
|
||||
<?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_VERSION')) {
|
||||
exit('Hacking Attempt !');
|
||||
}
|
||||
|
||||
/**
|
||||
* Override customize controls class
|
||||
*
|
||||
*/
|
||||
class Pagelayer_Customize_Control extends WP_Customize_Control{
|
||||
|
||||
public $show_filter = '';
|
||||
public $li_class = '';
|
||||
|
||||
/**
|
||||
* Refresh the parameters passed to the JavaScript via JSON.
|
||||
*
|
||||
* @see WP_Customize_Control::to_json()
|
||||
*/
|
||||
public function to_json() {
|
||||
|
||||
parent::to_json();
|
||||
|
||||
if(!empty($this->show_filter)){
|
||||
$this->json['show_filter'] = $this->show_filter;
|
||||
}
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
$id = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id );
|
||||
$class = 'pagelayer-customize-control customize-control customize-control-' . $this->type;
|
||||
|
||||
$class .= ' '.$this->li_class;
|
||||
|
||||
printf( '<li id="%s" class="%s">', esc_attr( $id ), esc_attr( $class ) );
|
||||
$this->render_content();
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Padding control to separate general and style controls
|
||||
*
|
||||
*/
|
||||
class Pagelayer_Padding_Control extends Pagelayer_Customize_Control {
|
||||
|
||||
/**
|
||||
* The type of control being rendered
|
||||
*/
|
||||
public $type = 'pagelayer-padding-control';
|
||||
public $responsive;
|
||||
public $units;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct( $manager, $id, $args = array(), $options = array() ) {
|
||||
parent::__construct( $manager, $id, $args );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the control in the customizer
|
||||
*/
|
||||
public function render_content() {
|
||||
|
||||
$units = (array) $this->units;
|
||||
|
||||
// Output the label and description if they were passed in.
|
||||
if ( isset( $this->label ) && '' !== $this->label ) {
|
||||
echo '<span class="customize-control-title pagelayer-customize-control-title">' . sanitize_text_field( $this->label );
|
||||
|
||||
if(!empty($this->responsive )){
|
||||
echo '<span class="pagelayer-devices">
|
||||
<button type="button" class="active-device" aria-pressed="true" data-device="desktop">
|
||||
<i class="dashicons dashicons-desktop"></i>
|
||||
</button>
|
||||
<button type="button"aria-pressed="false" data-device="tablet">
|
||||
<i class="dashicons dashicons-tablet"></i>
|
||||
</button>
|
||||
<button type="button" aria-pressed="false" data-device="mobile">
|
||||
<i class="dashicons dashicons-smartphone"></i>
|
||||
</button>
|
||||
</span>';
|
||||
}
|
||||
|
||||
if(!empty($units)){
|
||||
?>
|
||||
<span class="pagelayer-units">
|
||||
<input type="hidden" class="pagelayer-unit-input" value="<?php echo esc_attr($this->value('unit')); ?>" <?php $this->link('unit'); ?>></input>
|
||||
<?php
|
||||
foreach($units as $unit){
|
||||
echo '<span data-unit="'.$unit.'"> '.$unit.' </span>';
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
<?php
|
||||
}
|
||||
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
$settings = array();
|
||||
|
||||
foreach ( $this->settings as $key => $setting ){
|
||||
$key = str_replace(['_mobile', '_tablet'], '', $key);
|
||||
|
||||
if(in_array($key, $settings)){
|
||||
continue;
|
||||
}
|
||||
|
||||
$settings[] = $key;
|
||||
}
|
||||
|
||||
$screens = array('');
|
||||
|
||||
if(!empty($this->responsive)){
|
||||
$screens = array('', '_tablet', '_mobile');
|
||||
}
|
||||
|
||||
echo '<div class="pagelayer-paddings-holder">';
|
||||
|
||||
foreach($screens as $screen){
|
||||
|
||||
$show_device = '';
|
||||
if(count($screens) > 1){
|
||||
$show_device = 'data-show-device="'.(empty($screen) ? '_desktop' : $screen).'"';
|
||||
}
|
||||
|
||||
echo '<div class="pagelayer-control-padding" '.$show_device.'>';
|
||||
foreach($settings as $setting){
|
||||
|
||||
// Skip units for responsive
|
||||
if($setting == 'unit'){
|
||||
continue;
|
||||
}
|
||||
|
||||
$setting_name = $setting.$screen;
|
||||
?>
|
||||
<input type="number" class="pagelayer-padding-input" value="<?php echo esc_attr($this->value($setting_name)); ?>" <?php $this->link($setting_name); ?>></input>
|
||||
<?php
|
||||
}
|
||||
|
||||
echo '<i class="dashicons dashicons-admin-links"></i></div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Typography control controls
|
||||
*
|
||||
*/
|
||||
class Pagelayer_typo_Control extends Pagelayer_Customize_Control {
|
||||
|
||||
/**
|
||||
* The type of control being rendered
|
||||
*/
|
||||
public $type = 'pagelayer-typo-control';
|
||||
public $responsive;
|
||||
public $style;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct( $manager, $id, $args = array(), $options = array() ) {
|
||||
parent::__construct( $manager, $id, $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the control in the customizer
|
||||
*/
|
||||
public function render_content() {
|
||||
global $pagelayer;
|
||||
|
||||
// Output the label and description if they were passed in.
|
||||
if ( isset( $this->label ) && '' !== $this->label ) {
|
||||
echo '<span class="customize-control-title">' . sanitize_text_field( $this->label ) .'</span>';
|
||||
}
|
||||
|
||||
$settings = $pagelayer->font_settings;
|
||||
|
||||
echo '<div class="pagelayer-typography-holder">';
|
||||
|
||||
$global_font = $this->value('global-font');
|
||||
|
||||
if(!empty($global_font) && !isset($pagelayer->global_fonts[$global_font])){
|
||||
$global_font = 'primary';
|
||||
}
|
||||
|
||||
echo '<div class="pagelayer-control-typography">';
|
||||
?>
|
||||
<div class="pagelayer-control-typo-holder <?php echo (!empty($global_font) ? 'pagelayer-global-on' : ''); ?>">
|
||||
<div class="pagelayer-control-typo-icons-holder">
|
||||
<span class="pagelayer-control-typo-icon dashicons dashicons-edit"></span>
|
||||
</div>
|
||||
<div class="pagelayer-control-typo">
|
||||
<div class="pagelayer-global-setting-font">
|
||||
<b><?php _e('Global Fonts'); ?></b>
|
||||
<span class="pagelayer-control-global-typo-icon dashicons dashicons-admin-site-alt3"></span>
|
||||
<span class="dashicons dashicons-admin-generic"></span>
|
||||
<input class="pagelayer-global-font-input" type="hidden" <?php $this->link('global-font'); ?> value="<?php echo esc_attr($global_font); ?>" data-key="<?php echo esc_attr($global_font); ?>">
|
||||
|
||||
<div class="pagelayer-global-font-list"></div>
|
||||
</div>
|
||||
<?php foreach($settings as $sk => $sval){ ?>
|
||||
<div class="pagelayer-control-typo-fields">
|
||||
<label class="pagelayer-control-typo-fields-label"><?php echo $sval['label']?>
|
||||
<?php
|
||||
$screens = array('');
|
||||
if(!empty($sval['responsive'])){
|
||||
|
||||
$screens = array('desktop', 'tablet', 'mobile');
|
||||
|
||||
?>
|
||||
<span class="pagelayer-devices">
|
||||
<button type="button" class="active-device" aria-pressed="true" data-device="desktop">
|
||||
<i class="dashicons dashicons-desktop"></i>
|
||||
</button>
|
||||
<button type="button"aria-pressed="false" data-device="tablet">
|
||||
<i class="dashicons dashicons-tablet"></i>
|
||||
</button>
|
||||
<button type="button" aria-pressed="false" data-device="mobile">
|
||||
<i class="dashicons dashicons-smartphone"></i>
|
||||
</button>
|
||||
</span>
|
||||
<?php } ?>
|
||||
<span class="pagelayer-typo-global-default dashicons dashicons-undo" title="<?php _e('Restore Global'); ?>"></span>
|
||||
</label>
|
||||
<?php
|
||||
foreach($screens as $screen){
|
||||
|
||||
$show_device = '';
|
||||
$field_name = $sk;
|
||||
|
||||
if(count($screens) > 1){
|
||||
$show_device = 'data-show-device="_'.$screen.'"';
|
||||
$field_name = $sk.($screen == 'desktop' ? '' : '_'.$screen);
|
||||
}
|
||||
|
||||
$field_val = esc_attr($this->value($field_name));
|
||||
|
||||
if(isset($sval['choices'])){ ?>
|
||||
|
||||
<select name="<?php echo $field_name; ?>" <?php $this->link($field_name); ?> data-font-key="<?php echo $sk;?>" data-default-value="<?php echo $field_val; ?>" <?php echo $show_device; ?>>
|
||||
<?php
|
||||
// This add this js
|
||||
//echo pagelayer_create_font_options($sval['choices'], $this->value($field_name));
|
||||
?>
|
||||
</select>
|
||||
<?php } else { ?>
|
||||
<input name="<?php echo $field_name; ?>" type="number" <?php $this->link($field_name); ?> <?php echo $show_device; ?>>
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
echo '</div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Alpha Color Picker Custom Control
|
||||
*
|
||||
* @author Braad Martin <http://braadmartin.com>
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
||||
* @link https://github.com/BraadMartin/components/tree/master/customizer/alpha-color-picker
|
||||
*/
|
||||
class Pagelayer_Customize_Alpha_Color_Control extends Pagelayer_Customize_Control {
|
||||
/**
|
||||
* The type of control being rendered
|
||||
*/
|
||||
public $type = 'pagelayer-alpha-color';
|
||||
/**
|
||||
* Add support for palettes to be passed in.
|
||||
*
|
||||
* Supported palette values are true, false, or an array of RGBa and Hex colors.
|
||||
*/
|
||||
public $palette;
|
||||
/**
|
||||
* Add support for showing the opacity value on the slider handle.
|
||||
*/
|
||||
public $show_opacity;
|
||||
/**
|
||||
* Enqueue our scripts and styles
|
||||
*/
|
||||
public function enqueue() {
|
||||
wp_enqueue_script( 'wp-color-picker' );
|
||||
wp_enqueue_style( 'wp-color-picker' );
|
||||
}
|
||||
/**
|
||||
* Render the control in the customizer
|
||||
*/
|
||||
public function render_content() {
|
||||
global $pagelayer;
|
||||
|
||||
$setvalue = $this->value();
|
||||
|
||||
// Process the palette
|
||||
if ( is_array( $this->palette ) ) {
|
||||
$palette = implode( '|', $this->palette );
|
||||
} else {
|
||||
// Default to true.
|
||||
$palette = ( false === $this->palette || 'false' === $this->palette ) ? 'false' : 'true';
|
||||
}
|
||||
|
||||
// Support passing show_opacity as string or boolean. Default to true.
|
||||
$show_opacity = ( false === $this->show_opacity || 'false' === $this->show_opacity ) ? 'false' : 'true';
|
||||
|
||||
// Output the label and description if they were passed in.
|
||||
if ( isset( $this->label ) && '' !== $this->label ) {
|
||||
echo '<span class="customize-control-title">' . sanitize_text_field( $this->label ) . '</span>';
|
||||
}
|
||||
if ( isset( $this->description ) && '' !== $this->description ) {
|
||||
echo '<span class="description pagelayer-customize-description">' . sanitize_text_field( $this->description ) . '</span>';
|
||||
} ?>
|
||||
|
||||
<span class="pagelayer-control-global-color-icon dashicons dashicons-admin-site-alt3"></span>
|
||||
<div class="pagelayer-global-color-list">
|
||||
<div class="pagelayer-global-setting-color">
|
||||
<b>Global Colors</b>
|
||||
<span class="dashicons dashicons-admin-generic"></span></div>
|
||||
<?php
|
||||
$gkey = '';
|
||||
if( !empty($setvalue) && $setvalue[0] == '$'){
|
||||
$gkey = substr($setvalue, 1);
|
||||
$gkey = isset($pagelayer->global_colors[$gkey]) ? $gkey : 'primary';
|
||||
}
|
||||
|
||||
foreach($pagelayer->global_colors as $cid => $color){
|
||||
|
||||
$active_class = '';
|
||||
if($cid == $gkey){
|
||||
$active_class = 'pagelayer-global-selected';
|
||||
}
|
||||
?>
|
||||
<div class="pagelayer-global-color-list-item <?php echo $active_class; ?>" data-global-id="<?php echo $cid; ?>">
|
||||
<span class="pagelayer-global-color-pre" style="background:<?php echo $color['value']; ?>;"></span>
|
||||
<span class="pagelayer-global-color-title"><?php echo $color['title'];?></span>
|
||||
<span class="pagelayer-global-color-code"><?php echo $color['value']; ?></span>
|
||||
</div>
|
||||
<?php }?>
|
||||
</div>
|
||||
<input class="pagelayer-alpha-color-control" type="text" data-show-opacity="<?php echo $show_opacity; ?>" data-palette="<?php echo esc_attr( $palette ); ?>" data-default-color="<?php echo esc_attr( $this->settings['default']->default ); ?>" <?php $this->link(); ?> />
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Global color palette control
|
||||
class Pagelayer_Color_Repeater_Control extends Pagelayer_Customize_Control {
|
||||
/**
|
||||
* The type of control being rendered
|
||||
*/
|
||||
public $type = 'pagelayer-alpha-color';
|
||||
/**
|
||||
* Button labels
|
||||
*/
|
||||
public $button_label = '';
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct( $manager, $id, $args = array(), $options = array() ) {
|
||||
parent::__construct( $manager, $id, $args );
|
||||
|
||||
if(empty($this->button_label)){
|
||||
$this->button_label = __( 'Add New Color', 'pagelayer' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the control in the customizer
|
||||
*/
|
||||
public function render_content() {
|
||||
|
||||
$values = $this->value();
|
||||
|
||||
$decode_values = json_decode($values, true);
|
||||
|
||||
$skip_keys = array('primary', 'secondary', 'text', 'accent');
|
||||
?>
|
||||
<div class="pagelayer-color-palette-control">
|
||||
<?php if( !empty( $this->label ) ) { ?>
|
||||
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
||||
<?php } ?>
|
||||
<?php if( !empty( $this->description ) ) { ?>
|
||||
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
||||
<?php } ?>
|
||||
<input type="hidden" class="pagelayer-color-palette-data" <?php $this->link(); ?>>
|
||||
<?php
|
||||
foreach( $decode_values as $kk => $val){ ?>
|
||||
|
||||
<div class="pagelayer-color-holder">
|
||||
<span class="pagelayer-color-title" contenteditable="true"><?php _e($val['title']); ?></span>
|
||||
<span class="pagelayer-color-controls <?php echo (in_array($kk, $skip_keys)? 'pagelayer-prevent-delete' : ''); ?>">
|
||||
<?php echo esc_attr($val['value']) ?>
|
||||
</span>
|
||||
<?php if(!in_array($kk, $skip_keys)){ ?>
|
||||
<span class="customize-control-color-repeater-delete"><span class="dashicons dashicons-no-alt"></span></span>
|
||||
<?php }?>
|
||||
<input class="pagelayer-alpha-color-control" type="text" data-show-opacity="true" data-palette="true" data-default-color="<?php echo esc_attr($val['value']); ?>" data-id="<?php echo esc_attr($kk); ?>" data-title="<?php echo esc_attr($val['title']); ?>" value="<?php echo esc_attr($val['value']); ?>" />
|
||||
</div>
|
||||
|
||||
<?php }?>
|
||||
<button class="button customize-control-color-repeater-add" type="button"><?php echo $this->button_label; ?></button>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
// Global color palette control
|
||||
class Pagelayer_Font_Repeater_Control extends Pagelayer_Customize_Control {
|
||||
/**
|
||||
* The type of control being rendered
|
||||
*/
|
||||
public $type = 'pagelayer-global-font';
|
||||
/**
|
||||
* Button labels
|
||||
*/
|
||||
public $button_label = '';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct( $manager, $id, $args = array(), $options = array() ) {
|
||||
parent::__construct( $manager, $id, $args );
|
||||
|
||||
if(empty($this->button_label)){
|
||||
$this->button_label = __( 'Add New Font', 'pagelayer' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the control in the customizer
|
||||
*/
|
||||
public function render_content() {
|
||||
global $pagelayer;
|
||||
|
||||
$values = $this->value();
|
||||
|
||||
$decode_values = (array) json_decode($values, true);
|
||||
|
||||
$settings = $pagelayer->font_settings;
|
||||
|
||||
$skip_keys = array('primary', 'secondary', 'text', 'accent');
|
||||
?>
|
||||
<div class="pagelayer-font-palette-control">
|
||||
<?php if( !empty( $this->label ) ) { ?>
|
||||
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
||||
<?php } ?>
|
||||
<?php if( !empty( $this->description ) ) { ?>
|
||||
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
||||
<?php } ?>
|
||||
<input type="hidden" class="pagelayer-font-palette-data" <?php $this->link(); ?>>
|
||||
<?php
|
||||
foreach( $decode_values as $kk => $val){ ?>
|
||||
|
||||
<div class="pagelayer-font-holder" data-id="<?php echo $kk; ?>">
|
||||
<span class="pagelayer-font-title" contenteditable="true"><?php _e($val['title']); ?></span>
|
||||
<?php if(!in_array($kk, $skip_keys)){ ?>
|
||||
<span class="customize-control-font-repeater-delete"><span class="dashicons dashicons-no-alt"></span></span>
|
||||
<?php }?>
|
||||
|
||||
<!-- Font Start -->
|
||||
<div class="pagelayer-control-typo-holder">
|
||||
<span class="pagelayer-control-typo-icon dashicons dashicons-edit"></span>
|
||||
<div class="pagelayer-control-typo">
|
||||
|
||||
<?php foreach($settings as $sk => $sval){ ?>
|
||||
<div class="pagelayer-control-typo-fields">
|
||||
<label class="pagelayer-control-typo-fields-label"><?php echo $sval['label']?>
|
||||
|
||||
<?php
|
||||
$screens = array('');
|
||||
if(!empty($sval['responsive'])){
|
||||
|
||||
$screens = array('desktop', 'tablet', 'mobile');
|
||||
|
||||
?>
|
||||
<span class="pagelayer-devices">
|
||||
<button type="button" class="active-device" aria-pressed="true" data-device="desktop">
|
||||
<i class="dashicons dashicons-desktop"></i>
|
||||
</button>
|
||||
<button type="button"aria-pressed="false" data-device="tablet">
|
||||
<i class="dashicons dashicons-tablet"></i>
|
||||
</button>
|
||||
<button type="button" aria-pressed="false" data-device="mobile">
|
||||
<i class="dashicons dashicons-smartphone"></i>
|
||||
</button>
|
||||
</span>
|
||||
<?php } ?>
|
||||
</label>
|
||||
|
||||
<?php
|
||||
foreach($screens as $screen){
|
||||
|
||||
$show_device = '';
|
||||
$field_name = $sk;
|
||||
$field_val = (empty($val['value'][$sk]) ? '' : $val['value'][$sk]);
|
||||
|
||||
if(count($screens) > 1){
|
||||
$field_name = $sk.'['.$screen.']';
|
||||
$show_device = 'data-show-device="_'.$screen.'"';
|
||||
|
||||
if(is_array($field_val)){
|
||||
$field_val = (empty($field_val[$screen]) ? '' : $field_val[$screen]);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($sval['choices'])){ ?>
|
||||
<select name="<?php echo $field_name; ?>" data-font-key="<?php echo $sk;?>" data-default-value="<?php echo $field_val; ?>" <?php echo $show_device;?>>
|
||||
<?php
|
||||
// This add this js
|
||||
//echo pagelayer_create_font_options($sval['choices'], $val['value'][$sk]);
|
||||
?>
|
||||
</select>
|
||||
<?php } else { ?>
|
||||
<input type="number" name="<?php echo $field_name; ?>" value="<?php echo $field_val; ?>" <?php echo $show_device;?>>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- Font End -->
|
||||
</div>
|
||||
|
||||
<?php }?>
|
||||
<button class="button customize-control-font-repeater-add" type="button"><?php echo $this->button_label; ?></button>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Customize control
|
||||
*
|
||||
*/
|
||||
class Pagelayer_Custom_Control extends Pagelayer_Customize_Control {
|
||||
|
||||
/**
|
||||
* The type of control being rendered
|
||||
*/
|
||||
public $type = 'pagelayer-customize-control';
|
||||
public $responsive;
|
||||
public $units;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct( $manager, $id, $args = array(), $options = array() ) {
|
||||
parent::__construct( $manager, $id, $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the control in the customizer
|
||||
*/
|
||||
public function render_content() {
|
||||
|
||||
$units = $this->units;
|
||||
$input_id = '_customize-input-' . $this->id;
|
||||
$description_id = '_customize-description-' . $this->id;
|
||||
$describedby_attr = ( ! empty( $this->description ) ) ? ' aria-describedby="' . esc_attr( $description_id ) . '" ' : '';
|
||||
switch ( $this->type ) {
|
||||
case 'checkbox':
|
||||
?>
|
||||
<span class="pagelayer-customize-inside-control-row">
|
||||
<label for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_html( $this->label ); ?></label>
|
||||
<input
|
||||
id="<?php echo esc_attr( $input_id ); ?>"
|
||||
class="pagelayer-customize-checkbox"
|
||||
<?php echo $describedby_attr; ?>
|
||||
type="checkbox"
|
||||
value="<?php echo esc_attr( $this->value() ); ?>"
|
||||
<?php $this->link(); ?>
|
||||
<?php checked( $this->value() ); ?>
|
||||
/>
|
||||
<?php if ( ! empty( $this->description ) ) : ?>
|
||||
<span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
<?php
|
||||
break;
|
||||
case 'radio':
|
||||
if ( empty( $this->choices ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$name = '_customize-radio-' . $this->id;
|
||||
?>
|
||||
<?php if ( ! empty( $this->label ) ) : ?>
|
||||
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $this->description ) ) : ?>
|
||||
<span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>
|
||||
<?php endif; ?>
|
||||
<span class="pagelayer-customize-inside-control-row">
|
||||
<?php foreach ( $this->choices as $value => $label ) : ?>
|
||||
|
||||
<input
|
||||
id="<?php echo esc_attr( $input_id . '-radio-' . $value ); ?>"
|
||||
class="pagelayer-customize-radio"
|
||||
type="radio"
|
||||
<?php echo $describedby_attr; ?>
|
||||
value="<?php echo esc_attr( $value ); ?>"
|
||||
name="<?php echo esc_attr( $name ); ?>"
|
||||
<?php $this->link(); ?>
|
||||
<?php checked( $this->value(), $value ); ?>
|
||||
data-label="<?php echo esc_html( $label ); ?>"
|
||||
/>
|
||||
<?php endforeach; ?>
|
||||
</span>
|
||||
<?php
|
||||
break;
|
||||
case 'divider':
|
||||
echo '<hr class="pagelayer-customize-divider">';
|
||||
break;
|
||||
case 'pl_slider':
|
||||
?>
|
||||
<div class="pagelayer-slider-custom-control">
|
||||
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?>
|
||||
<?php if(!empty($this->responsive )){?>
|
||||
<span class="pagelayer-devices">
|
||||
<button type="button" class="active-device" aria-pressed="true" data-device="desktop">
|
||||
<i class="dashicons dashicons-desktop"></i>
|
||||
</button>
|
||||
<button type="button"aria-pressed="false" data-device="tablet">
|
||||
<i class="dashicons dashicons-tablet"></i>
|
||||
</button>
|
||||
<button type="button" aria-pressed="false" data-device="mobile">
|
||||
<i class="dashicons dashicons-smartphone"></i>
|
||||
</button>
|
||||
</span>
|
||||
<?php } ?>
|
||||
</span>
|
||||
<?php
|
||||
if(!empty($units)){
|
||||
?>
|
||||
<span class="pagelayer-units">
|
||||
<input type="hidden" class="pagelayer-unit-input" value="<?php echo esc_attr($this->value('unit')); ?>" <?php $this->link('unit'); ?>></input>
|
||||
<?php
|
||||
foreach($units as $unit){
|
||||
echo '<span data-unit="'.$unit.'"> '.$unit.' </span>';
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
<?php }
|
||||
|
||||
$screens = array('');
|
||||
$set_link = 'slider';
|
||||
|
||||
if(!empty($this->responsive)){
|
||||
$screens = array('desktop' => '_desktop', 'tablet' => '_tablet', 'mobile' => '_mobile');
|
||||
}
|
||||
|
||||
foreach($screens as $screen => $_screen){
|
||||
|
||||
$show_device = empty($_screen)? '' : 'data-show-device="'.$_screen.'"';
|
||||
|
||||
echo '<div class="pagelayer-control-typography" '.$show_device.'>';
|
||||
?>
|
||||
<input class="pagelayer-slider" type="range" min="<?php echo esc_attr( $this->input_attrs['min'] ); ?>" max="<?php echo esc_attr( $this->input_attrs['max'] ); ?>" step="<?php echo esc_attr( $this->input_attrs['step'] ); ?>" value="<?php echo esc_attr( $this->value($set_link.$_screen) ); ?>" />
|
||||
<input type="number" id="<?php echo esc_attr( $this->id ); ?>" name="<?php echo esc_attr( $this->id ); ?>" value="<?php echo esc_attr( $this->value($set_link.$_screen) ); ?>" class="customize-control-slider-value" <?php $this->link($set_link.$_screen); ?> min="<?php echo esc_attr( $this->input_attrs['min'] ); ?>" max="<?php echo esc_attr( $this->input_attrs['max'] ); ?>" step="<?php echo esc_attr( $this->input_attrs['step'] ); ?>"/>
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch sanitization
|
||||
*
|
||||
* @param string Switch value
|
||||
* @return integer Sanitized value
|
||||
*/
|
||||
if ( ! function_exists( 'pagelayer_switch_sanitization' ) ) {
|
||||
function pagelayer_switch_sanitization( $input ) {
|
||||
if ( true === $input ) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Alpha Color (Hex & RGBa) sanitization
|
||||
*
|
||||
* @param string Input to be sanitized
|
||||
* @return string Sanitized input
|
||||
*/
|
||||
if ( ! function_exists( 'pagelayer_hex_rgba_sanitization' ) ) {
|
||||
function pagelayer_hex_rgba_sanitization( $input, $setting ) {
|
||||
if ( empty( $input ) || is_array( $input ) ) {
|
||||
return $setting->default;
|
||||
}
|
||||
|
||||
if ( false === strpos( $input, 'rgba' ) ) {
|
||||
// If string doesn't start with 'rgba' then santize as hex color
|
||||
$input = sanitize_hex_color( $input );
|
||||
} else {
|
||||
// Sanitize as RGBa color
|
||||
$input = str_replace( ' ', '', $input );
|
||||
sscanf( $input, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
|
||||
$input = 'rgba(' . pagelayer_in_range( $red, 0, 255 ) . ',' . pagelayer_in_range( $green, 0, 255 ) . ',' . pagelayer_in_range( $blue, 0, 255 ) . ',' . pagelayer_in_range( $alpha, 0, 1 ) . ')';
|
||||
}
|
||||
return $input;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Only allow values between a certain minimum & maxmium range
|
||||
*
|
||||
* @param number Input to be sanitized
|
||||
* @return number Sanitized input
|
||||
*/
|
||||
if ( ! function_exists( 'pagelayer_in_range' ) ) {
|
||||
function pagelayer_in_range( $input, $min, $max ){
|
||||
if ( $input < $min ) {
|
||||
$input = $min;
|
||||
}
|
||||
if ( $input > $max ) {
|
||||
$input = $max;
|
||||
}
|
||||
return $input;
|
||||
}
|
||||
}
|
||||
|
||||
// Create font options
|
||||
function pagelayer_create_font_options( $args, $set ){
|
||||
$options = '';
|
||||
foreach( $args as $value => $label ){
|
||||
$_value = $value;
|
||||
|
||||
if(is_numeric($value)){
|
||||
$_value = $label;
|
||||
}
|
||||
|
||||
// Single item
|
||||
if(is_string($label)){
|
||||
$options .= pagelayer_sel_option( $_value, $label, $set);
|
||||
continue;
|
||||
}
|
||||
if( $value == 'default'){
|
||||
$options .= pagelayer_sel_option( '', $value, $set);
|
||||
continue;
|
||||
}
|
||||
|
||||
$options .= '<optgroup label="'. $value .'">';
|
||||
$options .= pagelayer_create_font_options($label, $set);
|
||||
$options .= '</optgroup>';
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
519
backup/wp/wp-content/plugins/pagelayer/main/customizer.php
Normal file
519
backup/wp/wp-content/plugins/pagelayer/main/customizer.php
Normal file
@@ -0,0 +1,519 @@
|
||||
<?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_VERSION')) {
|
||||
exit('Hacking Attempt !');
|
||||
}
|
||||
|
||||
// Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
|
||||
add_action( 'customize_preview_init', 'pagelayer_customize_preview_js' );
|
||||
function pagelayer_customize_preview_js() {
|
||||
//wp_enqueue_script( 'pagelayer-customizer-preview', get_template_directory_uri() . '/js/customizer-preview.js', array( 'jquery', 'customize-preview' ), PAGELAYER_VERSION, true );
|
||||
}
|
||||
|
||||
// JS handlers for controls.
|
||||
add_action( 'customize_controls_enqueue_scripts', 'pagelayer_customize_scripts' );
|
||||
function pagelayer_customize_scripts(){
|
||||
wp_enqueue_script( 'wp-color-picker' );
|
||||
wp_enqueue_style( 'wp-color-picker' );
|
||||
wp_enqueue_script( 'pagelayer-customizer', PAGELAYER_JS.'/customizer.js', array( 'customize-controls' ), PAGELAYER_VERSION, true );
|
||||
}
|
||||
|
||||
// Print global Style.
|
||||
add_action( 'customize_controls_print_styles', 'pagelayer_customize_controls_print_styles' );
|
||||
function pagelayer_customize_controls_print_styles(){
|
||||
global $pagelayer;
|
||||
|
||||
$font_family = (array) $pagelayer->fonts;
|
||||
$style = array('' => 'Default', 'normal' => 'Normal', 'italic' => 'Italic', 'oblique' => 'Oblique');
|
||||
$weight = array('' => 'Default', '100' => '100', '200' => '200', '300' => '300', '400' => '400', '500' => '500', '600' => '600', '700' => '700', '800' => '800', '900' => '900', 'normal' => 'Normal', 'lighter' => 'Lighter', 'bold' => 'Bold', 'bolder' => 'Bolder', 'unset' => 'Unset');
|
||||
$variant = array('' => 'Default', 'normal' => 'Normal', 'small-caps' => 'Small Caps');
|
||||
$decoration = array('' => 'Default', 'none' => 'None', 'overline' => 'Overline', 'line-through' => 'Line-through', 'underline' => 'Underline', 'underline overline' => 'Underline Overline');
|
||||
$decoration_style = array('' => 'None', 'solid' => 'Solid', 'double' => 'Double', 'dotted' => 'Dotted', 'dashed' => 'Dashed', 'wavy' => 'Wavy');
|
||||
$transform = array('' => 'Default', 'capitalize' => 'Capitalize', 'uppercase' => 'Uppercase', 'lowercase' => 'Lowercase');
|
||||
|
||||
$pagelayer->font_settings = array(
|
||||
'font-family' => array(
|
||||
'label' => __('Family', 'pagelayer'),
|
||||
'choices' => $font_family
|
||||
),
|
||||
'font-size' => array(
|
||||
'label' => __('Size', 'pagelayer'),
|
||||
'responsive' => 1,
|
||||
),
|
||||
'font-style' => array(
|
||||
'label' => __('Style', 'pagelayer'),
|
||||
'choices' => $style,
|
||||
),
|
||||
'font-weight' => array(
|
||||
'label' => __('Weight', 'pagelayer'),
|
||||
'choices' => $weight,
|
||||
'responsive' => 1,
|
||||
),
|
||||
'font-variant' => array(
|
||||
'label' => __('Variant', 'pagelayer'),
|
||||
'choices' => $variant,
|
||||
),
|
||||
'text-decoration-line' => array(
|
||||
'label' => __('Decoration', 'pagelayer'),
|
||||
'choices' => $decoration,
|
||||
),
|
||||
'text-decoration-style' => array(
|
||||
'label' => __('Decoration Style', 'pagelayer'),
|
||||
'choices' => $decoration_style,
|
||||
),
|
||||
'line-height' => array(
|
||||
'label' => __('Line Height', 'pagelayer'),
|
||||
'responsive' => 1,
|
||||
),
|
||||
'text-transform' => array(
|
||||
'label' => __('Transform', 'pagelayer'),
|
||||
'choices' => $transform,
|
||||
),
|
||||
'letter-spacing' => array(
|
||||
'label' => __('Text Spacing', 'pagelayer'),
|
||||
'responsive' => 1,
|
||||
),
|
||||
'word-spacing' => array(
|
||||
'label' => __('Word Spacing', 'pagelayer'),
|
||||
'responsive' => 1,
|
||||
),
|
||||
);
|
||||
|
||||
$styles = '<style id="pagelayer-customize-global-style">:root{';
|
||||
|
||||
// Set global colors styles
|
||||
foreach($pagelayer->global_colors as $gk => $gv){
|
||||
$styles .= '--pagelayer-color-'.$gk.':'.$gv['value'].';';
|
||||
}
|
||||
|
||||
$styles .= '}
|
||||
</style>'.PHP_EOL;
|
||||
|
||||
// Added global JavaSript variables
|
||||
$styles .= '<script id="pagelayer-customize-global-js">
|
||||
var pagelayer_global_colors = '.json_encode($pagelayer->global_colors).';
|
||||
var pagelayer_global_fonts = '.json_encode($pagelayer->global_fonts).';
|
||||
var pagelayer_global_font_settings = '.json_encode($pagelayer->font_settings).';
|
||||
</script>'.PHP_EOL;
|
||||
|
||||
echo $styles;
|
||||
}
|
||||
|
||||
add_action( 'customize_register', 'pagelayer_customize_register', 11 );
|
||||
function pagelayer_customize_register( $wp_customize ) {
|
||||
global $pagelayer;
|
||||
|
||||
// CSS for the custom controls
|
||||
wp_register_style('pagelayer-customizer', PAGELAYER_CSS.'/customizer.css', PAGELAYER_VERSION);
|
||||
wp_enqueue_style('pagelayer-customizer');
|
||||
|
||||
// Load fonts
|
||||
pagelayer_load_font_options();
|
||||
|
||||
// Load global colors and fonts
|
||||
pagelayer_load_global_palette();
|
||||
|
||||
// Add custom controls
|
||||
include_once(PAGELAYER_DIR . '/main/customizer-controls.php');
|
||||
|
||||
$post_types = array('' => __('Global'));
|
||||
$exclude = [ 'attachment', 'pagelayer-template' ];
|
||||
$pt_objects = get_post_types(['public' => true,], 'objects');
|
||||
|
||||
foreach ( $pt_objects as $pt_slug => $type ) {
|
||||
|
||||
if ( in_array( $pt_slug, $exclude ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$post_types[$pt_slug] = $type->labels->name;
|
||||
}
|
||||
|
||||
// Pagelayer Panel
|
||||
$wp_customize->add_panel( 'pagelayer_settings', array(
|
||||
'priority' => 10,
|
||||
'title' => 'Pagelayer',
|
||||
));
|
||||
|
||||
// Global colors section
|
||||
$wp_customize->add_section( 'pagelayer_global_colors_sec', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'priority' => 10,
|
||||
'title' => __('Colors'),
|
||||
'panel' => 'pagelayer_settings',
|
||||
));
|
||||
|
||||
$wp_customize->add_setting( 'pagelayer_global_colors', array(
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'refresh',
|
||||
'default' => json_encode( $pagelayer->global_colors )
|
||||
));
|
||||
|
||||
$wp_customize->add_control( new Pagelayer_Color_Repeater_Control($wp_customize, 'pagelayer_global_colors', array(
|
||||
'priority' => 10,
|
||||
'section' => 'pagelayer_global_colors_sec',
|
||||
)));
|
||||
|
||||
// Global fonts section
|
||||
$wp_customize->add_section( 'pagelayer_global_fonts_sec', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'priority' => 10,
|
||||
'title' => __('Typography'),
|
||||
'panel' => 'pagelayer_settings',
|
||||
));
|
||||
|
||||
$wp_customize->add_setting( 'pagelayer_global_fonts', array(
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'refresh',
|
||||
'default' => json_encode($pagelayer->global_fonts),
|
||||
));
|
||||
|
||||
$wp_customize->add_control( new Pagelayer_Font_Repeater_Control($wp_customize, 'pagelayer_global_fonts', array(
|
||||
'priority' => 10,
|
||||
'section' => 'pagelayer_global_fonts_sec',
|
||||
)));
|
||||
|
||||
foreach($post_types as $sk => $sv){
|
||||
|
||||
$post_type = empty($sk) ? '' : '_'.$sk;
|
||||
$global_section = 'pagelayer_global_sec'.$post_type;
|
||||
$global_text = empty($sk) ? '' : __('Global');
|
||||
|
||||
// Global section
|
||||
$wp_customize->add_section( $global_section, array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'priority' => 10,
|
||||
'title' => sprintf( __('%s %s Styles', 'pagelayer'), $sv, $global_text),
|
||||
'panel' => 'pagelayer_settings',
|
||||
));
|
||||
|
||||
foreach($pagelayer->css_settings as $set => $setv){
|
||||
|
||||
$setting_name = $set.$sk;
|
||||
$setting = empty($setv['key']) ? 'pagelayer_'.$set.'_css'.$post_type : $setv['key'].$post_type;
|
||||
|
||||
$wp_customize->add_setting( 'pagelayer_lable_'.$setting_name, array(
|
||||
'capability' => 'edit_theme_options',
|
||||
));
|
||||
|
||||
$wp_customize->add_control( new Pagelayer_Customize_Control(
|
||||
$wp_customize, 'pagelayer_lable_'.$setting_name, array(
|
||||
'type' => 'hidden',
|
||||
'section' => $global_section,
|
||||
'description' => sprintf( __('<div class="pagelayer-customize-heading"><div>%s</div><span class="dashicons dashicons-arrow-right-alt2"></span></div>', 'pagelayer'), $sv.' '.$setv['name']),
|
||||
'li_class' => 'pagelayer-accordion-tab',
|
||||
)
|
||||
));
|
||||
|
||||
// Register the typography control for body
|
||||
pagelayer_register_typo_customizer_control($wp_customize, array(
|
||||
'control' => $setting,
|
||||
'section' => $global_section,
|
||||
'label' => __( 'Typography', 'pagelayer' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'setting_type' => 'option',
|
||||
'transport' => 'refresh',
|
||||
'default' => '',
|
||||
'units' => ['px', 'em', '%'],
|
||||
'responsive' => 1,
|
||||
));
|
||||
|
||||
$wp_customize->add_setting( $setting.'[color]', array(
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'refresh',
|
||||
));
|
||||
|
||||
$wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control(
|
||||
$wp_customize, $setting.'[color]', array(
|
||||
'section' => $global_section,
|
||||
'label' => __( 'Color', 'pagelayer' ),
|
||||
)
|
||||
));
|
||||
|
||||
$wp_customize->add_setting( $setting.'[background-color]', array(
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'refresh',
|
||||
));
|
||||
|
||||
$wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control(
|
||||
$wp_customize, $setting.'[background-color]', array(
|
||||
'section' => $global_section,
|
||||
'label' => __( 'Background Color', 'pagelayer' ),
|
||||
)
|
||||
));
|
||||
|
||||
// Register the padding control for scroll to top
|
||||
pagelayer_register_padding_customizer_control($wp_customize, array(
|
||||
'control' => $setting,
|
||||
'control_array_sufix' => 'padding',
|
||||
'section' => $global_section,
|
||||
'label' => __( 'Padding', 'pagelayer' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'setting_type' => 'option',
|
||||
'transport' => 'refresh',
|
||||
'default' => '',
|
||||
'units' => ['px', 'em', '%'],
|
||||
'setting_parts' => array('0', '1', '2', '3', 'unit'),
|
||||
'responsive' => 1,
|
||||
));
|
||||
|
||||
// Register the padding control for scroll to top
|
||||
pagelayer_register_padding_customizer_control($wp_customize, array(
|
||||
'control' => $setting,
|
||||
'control_array_sufix' => 'margin',
|
||||
'section' => $global_section,
|
||||
'label' => __( 'Margin', 'pagelayer' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'setting_type' => 'option',
|
||||
'transport' => 'refresh',
|
||||
'default' => '',
|
||||
'units' => ['px', 'em', '%'],
|
||||
'setting_parts' => array('0', '1', '2', '3', 'unit'),
|
||||
'responsive' => 1,
|
||||
));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Typography control.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function pagelayer_register_typo_customizer_control($wp_customize, $args, $screen_array = false){
|
||||
|
||||
$settings_for_control = array();
|
||||
$settings = array('font-family', 'font-size', 'font-style', 'font-weight', 'font-variant', 'text-decoration-line', 'text-decoration-style', 'line-height', 'text-transform', 'letter-spacing', 'word-spacing', 'global-font');
|
||||
$screens = array('');
|
||||
$control_array_sufix = '';
|
||||
|
||||
if(!empty($args['responsive'])){
|
||||
$screens = array('desktop' => '', 'tablet' => '_tablet', 'mobile' => '_mobile');
|
||||
}
|
||||
|
||||
if(!empty($args['control_array_sufix'])){
|
||||
$control_array_sufix = '['.$args['control_array_sufix'].']';
|
||||
}
|
||||
|
||||
// Register settings
|
||||
foreach($screens as $_screen => $screen){
|
||||
foreach($settings as $setting){
|
||||
|
||||
// Skip units for responsive
|
||||
if($setting == 'unit' && !empty($screen)){
|
||||
continue;
|
||||
}
|
||||
|
||||
$setting_name = $args['control'];
|
||||
|
||||
if($screen_array && count($screens) > 1){
|
||||
$setting_name .= $control_array_sufix.'['.$_screen.']';
|
||||
}else{
|
||||
$setting_name .= $screen.$control_array_sufix;
|
||||
}
|
||||
|
||||
$setting_name .= '['.$setting.']';
|
||||
$settings_for_control[$setting.$screen] = $setting_name;
|
||||
|
||||
$setting_args = array(
|
||||
'capability' => $args['capability'],
|
||||
'transport' => $args['transport'],
|
||||
);
|
||||
|
||||
if(!empty($args['setting_type'])){
|
||||
$setting_args['type'] = $args['setting_type'];
|
||||
}
|
||||
|
||||
if(!empty($args['default'])){
|
||||
$setting_args['default'] = $args['default'];
|
||||
}
|
||||
|
||||
$wp_customize->add_setting( $setting_name, $setting_args);
|
||||
}
|
||||
}
|
||||
|
||||
$args['settings'] = $settings_for_control;
|
||||
|
||||
$wp_customize->add_control( new Pagelayer_typo_Control(
|
||||
$wp_customize, $args['control']. @$args['control_array_sufix'], $args
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the padding control.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function pagelayer_register_padding_customizer_control($wp_customize, $args, $screen_array = false){
|
||||
|
||||
$settings_for_control = array();
|
||||
$screens = array('');
|
||||
$control_array_sufix = '';
|
||||
|
||||
if(empty($args['setting_parts'])){
|
||||
$settings = array('top', 'right', 'bottom', 'left', 'unit');
|
||||
}else{
|
||||
$settings = $args['setting_parts'];
|
||||
}
|
||||
|
||||
if(!empty($args['responsive'])){
|
||||
$screens = array('desktop' => '', 'tablet' => '_tablet', 'mobile' => '_mobile');
|
||||
}
|
||||
|
||||
if(!empty($args['control_array_sufix'])){
|
||||
$control_array_sufix = '['.$args['control_array_sufix'].']';
|
||||
}
|
||||
|
||||
// Register settings
|
||||
foreach($screens as $_screen => $screen){
|
||||
foreach($settings as $setting){
|
||||
|
||||
// Skip units for responsive
|
||||
if($setting == 'unit' && (!empty($screen) || $screen_array)){
|
||||
continue;
|
||||
}
|
||||
|
||||
$setting_name = $args['control'];
|
||||
|
||||
if($screen_array && count($screens) > 1){
|
||||
$setting_name .= $control_array_sufix.'['.$_screen.']';
|
||||
}else{
|
||||
$setting_name .= $screen.$control_array_sufix;
|
||||
}
|
||||
|
||||
$setting_name .= '['.$setting.']';
|
||||
$settings_for_control[$setting.$screen] = $setting_name;
|
||||
|
||||
$setting_args = array(
|
||||
'capability' => $args['capability'],
|
||||
'transport' => $args['transport'],
|
||||
);
|
||||
|
||||
if(!empty($args['default'])){
|
||||
$setting_args['default'] = $args['default'];
|
||||
}
|
||||
|
||||
if(!empty($args['setting_type'])){
|
||||
$setting_args['type'] = $args['setting_type'];
|
||||
}
|
||||
|
||||
if(!empty($args['sanitize_callback'])){
|
||||
$setting_args['sanitize_callback'] = $args['sanitize_callback'];
|
||||
}
|
||||
|
||||
$wp_customize->add_setting( $setting_name, $setting_args);
|
||||
}
|
||||
}
|
||||
|
||||
// If we save responsive values in same variables
|
||||
if($screen_array && !empty($args['units'])){
|
||||
$setting_name = $args['control'].$control_array_sufix.'[unit]';
|
||||
$settings_for_control['unit'] = $setting_name;
|
||||
$setting_args = array(
|
||||
'capability' => $args['capability'],
|
||||
'transport' => $args['transport'],
|
||||
);
|
||||
|
||||
if(!empty($args['setting_type'])){
|
||||
$setting_args['type'] = $args['setting_type'];
|
||||
}
|
||||
|
||||
$wp_customize->add_setting( $setting_name, $setting_args);
|
||||
}
|
||||
|
||||
$args['settings'] = $settings_for_control;
|
||||
$wp_customize->add_control( new Pagelayer_Padding_Control(
|
||||
$wp_customize, $args['control']. @$args['control_array_sufix'], $args
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the slider control.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function pagelayer_register_slider_custoze_control($wp_customize, $args){
|
||||
|
||||
$settings_for_control = array();
|
||||
$setting = 'slider';
|
||||
$screens = array('');
|
||||
|
||||
if(!empty($args['responsive'])){
|
||||
$screens = array('desktop' => '_desktop', 'tablet' => '_tablet', 'mobile' => '_mobile');
|
||||
}
|
||||
|
||||
// Register settings
|
||||
foreach($screens as $screen => $_screen){
|
||||
|
||||
$setting_name = $args['control'];
|
||||
|
||||
if(count($screens) > 1){
|
||||
$setting_name .= '['.$screen.']';
|
||||
}
|
||||
|
||||
$settings_for_control[$setting.$_screen] = $setting_name;
|
||||
|
||||
$setting_args = array(
|
||||
'capability' => $args['capability'],
|
||||
'transport' => $args['transport'],
|
||||
);
|
||||
|
||||
if(!empty($args['default'])){
|
||||
$setting_args['default'] = $args['default'];
|
||||
}
|
||||
|
||||
if(!empty($args['setting_type'])){
|
||||
$setting_args['type'] = $args['setting_type'];
|
||||
}
|
||||
|
||||
if(!empty($args['sanitize_callback'])){
|
||||
$setting_args['sanitize_callback'] = $args['sanitize_callback'];
|
||||
}
|
||||
|
||||
$wp_customize->add_setting($setting_name, $setting_args);
|
||||
}
|
||||
|
||||
// Register setting for units
|
||||
if(!empty($args['units'])){
|
||||
$setting_name = $args['control'].'[unit]';
|
||||
$settings_for_control['unit'] = $setting_name;
|
||||
$setting_args = array(
|
||||
'capability' => $args['capability'],
|
||||
'transport' => $args['transport'],
|
||||
);
|
||||
|
||||
if(!empty($args['setting_type'])){
|
||||
$setting_args['type'] = $args['setting_type'];
|
||||
}
|
||||
|
||||
$wp_customize->add_setting( $setting_name, $setting_args);
|
||||
}
|
||||
|
||||
$args['settings'] = $settings_for_control;
|
||||
$args['type'] = 'pl_slider';
|
||||
|
||||
$wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, $args['control'], $args ));
|
||||
}
|
||||
88
backup/wp/wp-content/plugins/pagelayer/main/font-options.php
Normal file
88
backup/wp/wp-content/plugins/pagelayer/main/font-options.php
Normal file
File diff suppressed because one or more lines are too long
3783
backup/wp/wp-content/plugins/pagelayer/main/functions.php
Normal file
3783
backup/wp/wp-content/plugins/pagelayer/main/functions.php
Normal file
File diff suppressed because it is too large
Load Diff
261
backup/wp/wp-content/plugins/pagelayer/main/getting_started.php
Normal file
261
backup/wp/wp-content/plugins/pagelayer/main/getting_started.php
Normal file
@@ -0,0 +1,261 @@
|
||||
<?php
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//===========================================================
|
||||
// getting_started.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_VERSION')) {
|
||||
exit('Hacking Attempt !');
|
||||
}
|
||||
|
||||
$app = (!defined('SITEPAD') ? 'Pagelayer' : BRAND_SM);
|
||||
?>
|
||||
|
||||
<link rel="stylesheet" href="<?php echo PAGELAYER_CSS.'/font-awesome5.min.css';?>">
|
||||
|
||||
<div class="pagelayer-getting-started">
|
||||
<div class="pagelayer-getting-started-container">
|
||||
<div class="pagelayer-getting-started-block">
|
||||
<div class="pagelayer-getting-started-logo">
|
||||
<?php echo (!defined('SITEPAD')) ? '<img src="'.PAGELAYER_URL.'/images/pagelayer-logo-256.png'.'"/>' : '<img src="'.BRAND_SM_LOGO.'" style="width:auto"/>' ?>
|
||||
</div>
|
||||
<div class="pagelayer-getting-started-desc">
|
||||
<h1><?php echo __pl('welcome_to').$app;?></h1>
|
||||
<h6><?php echo (!defined('SITEPAD')) ? __pl('choose_pagelayer') : __pl('choose_sitepad');?></h6>
|
||||
</div>
|
||||
<div class="pagelayer-getting-started-video">
|
||||
<?php echo (!defined('SITEPAD')) ? '<iframe width="700" height="400" src="https://www.youtube.com/embed/t8Iz-v-qce8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>' : '<iframe height="400" width="700" src="https://www.youtube.com/embed/8e3ROkKoFwA" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';?>
|
||||
</div>
|
||||
<div class="pagelayer-getting-started-desc">
|
||||
<h6><?php echo (!defined('SITEPAD')) ? __pl('pagelayer_desc') : __pl('sitepad_desc');?></h6>
|
||||
<div class="pagelayer-getting-started-btn">
|
||||
<a href="<?php echo admin_url('/post-new.php?post_type=page')?>" class="button button-primary btn-sc"><?php echo __pl('first_page');?></a>
|
||||
<a href="<?php echo (!defined('SITEPAD')) ? PAGELAYER_WWW_URL.'getting-started' : "https://sitepad.com/docs/getting-started/"; ?>" class="button button-secondary btn-sc" target="_blank"><?php echo __pl('watch_guide');?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pagelayer-features">
|
||||
<div class="pagelayer-getting-started-desc">
|
||||
<h1><?php echo $app.' '.__pl('feature_style');?></h1>
|
||||
<h6><?php echo $app.__pl('brand_feature_text');?></h6>
|
||||
<div class="pagelayer-features-list">
|
||||
<?php $style = (defined('SITEPAD')) ? 'style="width:30%; height: 265px"' : ''; ?>
|
||||
<div class="feature-block-card" <?php echo $style; ?>>
|
||||
<div class="feature-block">
|
||||
<?php echo (!defined('SITEPAD')) ? '<i class="fas fa-mouse-pointer" aria-hidden="true">' : '<i class="fas fa-paper-plane" aria-hidden="true">' ?></i>
|
||||
</div>
|
||||
<div class="feature-block-content">
|
||||
<h5><?php echo (!defined('SITEPAD')) ? __pl('dragdrop') : __pl('oneclick')?></h5>
|
||||
<p><?php echo (!defined('SITEPAD')) ? __pl('dragdrop_desc') : __pl('oneclick_desc');?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="feature-block-card" <?php echo $style; ?>>
|
||||
<div class="feature-block">
|
||||
<?php echo (!defined('SITEPAD')) ? '<i class="fa fa-th-list" aria-hidden="true">' : '<i class="fas fa-random" aria-hidden="true">' ?></i>
|
||||
</div>
|
||||
<div class="feature-block-content">
|
||||
<h5><?php echo (!defined('SITEPAD')) ? __pl('widgets') : __pl('static_pages')?></h5>
|
||||
<p><?php echo (!defined('SITEPAD')) ? __pl('widgets_desc') : __pl('static_pages_desc');?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="feature-block-card" <?php echo $style; ?>>
|
||||
<div class="feature-block">
|
||||
<?php echo (!defined('SITEPAD')) ? '<i class="fa fa-pencil" aria-hidden="true">' : '<i class="fas fa-mobile-alt" aria-hidden="true">' ?></i>
|
||||
</div>
|
||||
<div class="feature-block-content">
|
||||
<h5><?php echo (!defined('SITEPAD')) ? __pl('inline_edit') : __pl('responsive_styles')?></h5>
|
||||
<p><?php echo (!defined('SITEPAD')) ? __pl('inline_edit_desc') : __pl('responsive_desc');?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="feature-block-card" <?php echo $style; ?>>
|
||||
<div class="feature-block">
|
||||
<?php echo (!defined('SITEPAD')) ? '<i class="fa fa-clone" aria-hidden="true">' : '<i class="fas fa-share-square" aria-hidden="true">' ?></i>
|
||||
</div>
|
||||
<div class="feature-block-content">
|
||||
<h5><?php echo (!defined('SITEPAD')) ? __pl('duplicate') : __pl('social_media')?></h5>
|
||||
<p><?php echo (!defined('SITEPAD')) ? __pl('duplicate_desc') : __pl('social_media_desc');?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="feature-block-card" <?php echo $style; ?>>
|
||||
<div class="feature-block">
|
||||
<?php echo (!defined('SITEPAD')) ? '<i class="fa fa-snowflake-o fa-spin" aria-hidden="true">' : '<i class="fas fa-check" aria-hidden="true">' ?></i>
|
||||
</div>
|
||||
<div class="feature-block-content">
|
||||
<h5><?php echo (!defined('SITEPAD')) ? __pl('animation') : __pl('easy_use')?></h5>
|
||||
<p><?php echo (!defined('SITEPAD')) ? __pl('animation_desc') : __pl('easy_use_desc');?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="feature-block-card" <?php echo $style; ?>>
|
||||
<div class="feature-block">
|
||||
<?php echo (!defined('SITEPAD')) ? '<i class="fa fa-text-width" aria-hidden="true">' : '<i class="fas fa-cog" aria-hidden="true">' ?></i>
|
||||
</div>
|
||||
<div class="feature-block-content">
|
||||
<h5><?php echo (!defined('SITEPAD')) ? __pl('style_option') : __pl('cpanel_integrate')?></h5>
|
||||
<p><?php echo (!defined('SITEPAD')) ? __pl('style_option_desc') : __pl('cpanel_integrate_desc');?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="feature-block-card" <?php echo $style; ?>>
|
||||
<div class="feature-block">
|
||||
<?php echo (!defined('SITEPAD')) ? '<i class="fa fa-paint-brush" aria-hidden="true">' : '<i class="fas fa-th-large" aria-hidden="true">' ?></i>
|
||||
</div>
|
||||
<div class="feature-block-content">
|
||||
<h5><?php echo (!defined('SITEPAD')) ? __pl('real_design') : __pl('multisites')?></h5>
|
||||
<p><?php echo (!defined('SITEPAD')) ? __pl('real_design_desc') : __pl('multisites_desc');?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="feature-block-card" <?php echo $style; ?>>
|
||||
<div class="feature-block">
|
||||
<?php echo (!defined('SITEPAD')) ? '<i class="fa fa-font" aria-hidden="true">' : '<i class="fas fa-copy" aria-hidden="true">' ?></i>
|
||||
</div>
|
||||
<div class="feature-block-content">
|
||||
<h5><?php echo (!defined('SITEPAD')) ? __pl('typography') : __pl('replicate_obj')?></h5>
|
||||
<p><?php echo (!defined('SITEPAD')) ? __pl('typography_desc') : __pl('replicate_obj_desc');?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="feature-block-card" <?php echo $style; ?>>
|
||||
<div class="feature-block">
|
||||
<?php echo (!defined('SITEPAD')) ? '<i class="fa fa-cubes" aria-hidden="true">' : '<i class="fas fa-shopping-cart" aria-hidden="true">' ?></i>
|
||||
</div>
|
||||
<div class="feature-block-content">
|
||||
<h5><?php echo (!defined('SITEPAD')) ? __pl('easy_customize') : __pl('whmcs')?></h5>
|
||||
<p><?php echo (!defined('SITEPAD')) ? __pl('easy_customize_desc') : __pl('whmcs_desc');?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pagelayer-getting-started-btn">
|
||||
<a href=" <?php echo (!defined('SITEPAD')) ? PAGELAYER_WWW_URL : "http://sitepad.com/"?>" class="button button-secondary btn-sc" target="_blank" style="margin-top:20px;"><?php echo __pl('why').' '.$app.'?';?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
||||
.pagelayer-getting-started{
|
||||
padding-top: 50px;
|
||||
}
|
||||
|
||||
.pagelayer-getting-started-container{
|
||||
margin: 0 auto;
|
||||
max-width: 1000px;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pagelayer-getting-started-block{
|
||||
background-color: #fff;
|
||||
border: 2px solid #e1e1e1;
|
||||
border-radius: 2px;
|
||||
margin-bottom: 30px;
|
||||
position: relative;
|
||||
padding-top: 40px;
|
||||
}
|
||||
|
||||
.pagelayer-getting-started-logo img{
|
||||
width: 10%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.pagelayer-getting-started-desc{
|
||||
padding: 40px;
|
||||
}
|
||||
|
||||
.pagelayer-getting-started-desc h1{
|
||||
color: #222;
|
||||
font-size: 24px;
|
||||
margin: 0 0 24px 0;
|
||||
}
|
||||
|
||||
.pagelayer-getting-started-desc h6{
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
line-height: 1.6;
|
||||
margin: 0 85px 0 85px;
|
||||
}
|
||||
|
||||
.pagelayer-getting-started-btn{
|
||||
max-width: 600px;
|
||||
margin: 0 auto 0 auto;
|
||||
margin-top: 36px !important;
|
||||
}
|
||||
|
||||
.btn-sc{
|
||||
font-size: 14px !important;
|
||||
min-height: 46px !important;
|
||||
line-height: 3.14285714 ! important;
|
||||
padding: 0px 36px !important;
|
||||
}
|
||||
|
||||
.button-primary{
|
||||
margin-right: 20px !important;
|
||||
border-radius: 3px !important;
|
||||
}
|
||||
|
||||
.pagelayer-features{
|
||||
background-color: #fff;
|
||||
border: 2px solid #e1e1e1;
|
||||
border-radius: 2px 2px 0 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.feature-block-card{
|
||||
width: 25%;
|
||||
display: inline-block;
|
||||
margin: 60px 10px 0 10px;
|
||||
vertical-align: top;
|
||||
box-shadow: 0px 0px 20px 0px rgba(0,0,0,.1);
|
||||
padding: 20px;
|
||||
height: 220px;
|
||||
}
|
||||
|
||||
.feature-block{
|
||||
background: linear-gradient(to right, rgb(116, 116, 191), rgb(52, 138, 199));
|
||||
border-radius: 50%;
|
||||
width: 54px;
|
||||
height: 54px;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.feature-block i{
|
||||
font-size: 30px;
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
top: 13px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.feature-block-content h5{
|
||||
color: #222;
|
||||
font-size: 20px;
|
||||
margin: 10px 0 0 0;
|
||||
}
|
||||
|
||||
.feature-block-content p{
|
||||
color: #222;
|
||||
font-size: 16px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.fa-spin{
|
||||
-webkit-animation: fa-spin 2s infinite linear;
|
||||
animation: fa-spin 2s infinite linear;
|
||||
}
|
||||
</style>
|
||||
1653
backup/wp/wp-content/plugins/pagelayer/main/import.php
Normal file
1653
backup/wp/wp-content/plugins/pagelayer/main/import.php
Normal file
File diff suppressed because it is too large
Load Diff
200
backup/wp/wp-content/plugins/pagelayer/main/license.php
Normal file
200
backup/wp/wp-content/plugins/pagelayer/main/license.php
Normal file
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//===========================================================
|
||||
// license.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_VERSION')) {
|
||||
exit('Hacking Attempt !');
|
||||
}
|
||||
|
||||
include_once(PAGELAYER_DIR.'/main/settings.php');
|
||||
|
||||
// The License Page
|
||||
function pagelayer_license(){
|
||||
|
||||
global $pl_error;
|
||||
|
||||
if(!empty($_REQUEST['install_pro'])){
|
||||
pagelayer_install_pro();
|
||||
return;
|
||||
}
|
||||
|
||||
if(isset($_REQUEST['save_pl_license'])){
|
||||
check_admin_referer('pagelayer-options');
|
||||
}
|
||||
|
||||
// Is there a license key ?
|
||||
if(isset($_POST['save_pl_license'])){
|
||||
|
||||
$license = pagelayer_optpost('pagelayer_license');
|
||||
|
||||
// Check if its a valid license
|
||||
if(empty($license)){
|
||||
$pl_error['lic_invalid'] = __('The license key was not submitted', 'pagelayer');
|
||||
return pagelayer_license_T();
|
||||
}
|
||||
|
||||
$resp = wp_remote_get(PAGELAYER_API.'license.php?license='.$license, array('timeout' => 30));
|
||||
|
||||
if(is_array($resp)){
|
||||
$json = json_decode($resp['body'], true);
|
||||
//print_r($json);
|
||||
}else{
|
||||
|
||||
$pl_error['resp_invalid'] = __('The response was malformed<br>'.var_export($resp, true), 'pagelayer');
|
||||
return pagelayer_license_T();
|
||||
|
||||
}
|
||||
|
||||
// Save the License
|
||||
if(empty($json['license'])){
|
||||
|
||||
$pl_error['lic_invalid'] = __('The license key is invalid', 'pagelayer');
|
||||
return pagelayer_license_T();
|
||||
|
||||
}else{
|
||||
|
||||
update_option('pagelayer_license', $json);
|
||||
|
||||
// Load license
|
||||
pagelayer_load_license();
|
||||
|
||||
// Mark as saved
|
||||
$GLOBALS['pl_saved'] = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pagelayer_license_T();
|
||||
|
||||
}
|
||||
|
||||
// The License Page - THEME
|
||||
function pagelayer_license_T(){
|
||||
|
||||
global $pagelayer, $pl_error;
|
||||
|
||||
pagelayer_page_header('Pagelayer License');
|
||||
|
||||
// Saved ?
|
||||
if(!empty($GLOBALS['pl_saved'])){
|
||||
echo '<div class="notice notice-success"><p>'. __('The settings were saved successfully', 'pagelayer'). '</p></div><br />';
|
||||
}
|
||||
|
||||
// If the license is active and you are the free version, then suggest to install the pro
|
||||
if(!empty($pagelayer->license['status']) && !defined('PAGELAYER_PREMIUM') && empty($_REQUEST['install_pro'])){
|
||||
echo '<div class="updated"><p>'. __('You have activated the license, but are using the Free version ! <a href="'.admin_url('admin.php?page=pagelayer_license&install_pro=1').'" class="button button-primary">Install Pro Now</a>', 'pagelayer'). '</p></div><br />';
|
||||
}
|
||||
|
||||
if(date('Ymd') <= 20200331 && !defined('PAGELAYER_PREMIUM')){
|
||||
echo '<div class="updated"><p><span style="font-size: 14px"><b>Promotional Offer</b></span> : If you buy <a href="'.PAGELAYER_PRO_URL.'"><b>Pagelayer Pro</b></a> before <b>31st March, 2020</b> then you will get an additional year free and your license will expire on <b>31st March, 2022</b></p></div><br />.';
|
||||
}
|
||||
|
||||
// Any errors ?
|
||||
if(!empty($pl_error)){
|
||||
pagelayer_report_error($pl_error);echo '<br />';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="postbox">
|
||||
|
||||
<button class="handlediv button-link" aria-expanded="true" type="button">
|
||||
<span class="screen-reader-text"><?php _e('Toggle panel: System Information');?></span>
|
||||
<span class="toggle-indicator" aria-hidden="true"></span>
|
||||
</button>
|
||||
|
||||
<h2 class="hndle ui-sortable-handle">
|
||||
<span><?php echo __('System Information', 'pagelayer'); ?></span>
|
||||
</h2>
|
||||
|
||||
<div class="inside">
|
||||
|
||||
<form action="" method="post" enctype="multipart/form-data">
|
||||
<?php wp_nonce_field('pagelayer-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%">'.__('Pagelayer Version', 'pagelayer').'</th>
|
||||
<td>'.PAGELAYER_VERSION.(defined('PAGELAYER_PREMIUM') ? ' (PRO Version)' : '').'</td>
|
||||
</tr>';
|
||||
|
||||
echo '
|
||||
<tr>
|
||||
<th align="left" valign="top">'.__('Pagelayer License', 'pagelayer').'</th>
|
||||
<td align="left">
|
||||
'.(defined('PAGELAYER_PREMIUM') && empty($pagelayer->license) ? '<span style="color:red">Unlicensed</span> ' : '').'
|
||||
<input type="text" name="pagelayer_license" value="'.(empty($pagelayer->license) ? '' : $pagelayer->license['license']).'" size="30" placeholder="e.g. PAGEL-11111-22222-33333-44444" style="width:300px;" />
|
||||
<input name="save_pl_license" class="button button-primary" value="Update License" type="submit" />';
|
||||
|
||||
if(!empty($pagelayer->license)){
|
||||
|
||||
$expires = $pagelayer->license['expires'];
|
||||
$expires = substr($expires, 0, 4).'/'.substr($expires, 4, 2).'/'.substr($expires, 6);
|
||||
|
||||
echo '<div style="margin-top:10px;">License Status : '.(empty($pagelayer->license['status_txt']) ? 'N.A.' : $pagelayer->license['status_txt']).'
|
||||
License Expires : '.($pagelayer->license['expires'] <= date('Ymd') ? '<span style="color:red">'.$expires.'</span>' : $expires).'
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
||||
echo
|
||||
'</td>
|
||||
</tr>';
|
||||
|
||||
echo '<tr>
|
||||
<th align="left">'.__('URL', 'pagelayer').'</th>
|
||||
<td>'.get_site_url().'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left">'.__('Path', 'pagelayer').'</th>
|
||||
<td>'.ABSPATH.'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left">'.__('Server\'s IP Address', 'pagelayer').'</th>
|
||||
<td>'.$_SERVER['SERVER_ADDR'].'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left">'.__('wp-config.php is writable', 'pagelayer').'</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', 'pagelayer').'</th>
|
||||
<td>'.(is_writable(ABSPATH.'/.htaccess') ? '<span style="color:red">Yes</span>' : '<span style="color:green">No</span>').'</td>
|
||||
</tr>';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
pagelayer_page_footer();
|
||||
|
||||
}
|
||||
283
backup/wp/wp-content/plugins/pagelayer/main/live-body.php
Normal file
283
backup/wp/wp-content/plugins/pagelayer/main/live-body.php
Normal file
@@ -0,0 +1,283 @@
|
||||
<?php
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//===========================================================
|
||||
// live.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_VERSION')) {
|
||||
exit('Hacking Attempt !');
|
||||
}
|
||||
|
||||
|
||||
function pagelayer_live_body(){
|
||||
|
||||
global $post, $pagelayer;
|
||||
|
||||
$icons = pagelayer_enabled_icons();
|
||||
$icons_list = array();
|
||||
|
||||
// Load all icons
|
||||
foreach($icons as $icon){
|
||||
$icons_list[] = $icon.'.min.css';
|
||||
}
|
||||
|
||||
$css_url = admin_url('admin-ajax.php?action=pagelayer_givecss&pagelayer_nonce=1&');
|
||||
if(pagelayer_enable_giver()){
|
||||
$css_url = PAGELAYER_CSS.'/givecss.php?';
|
||||
}
|
||||
|
||||
$dark_mode = get_option('pagelayer_enable_dark_mode');
|
||||
$body_class = '';
|
||||
if(!empty($dark_mode)){
|
||||
$body_class = 'pagelayer-dark';
|
||||
};
|
||||
|
||||
if(defined('SITEPAD')){
|
||||
$body_class .= ' sitepad-body';
|
||||
}
|
||||
|
||||
$shortcut_groups = [
|
||||
'general_shortcuts' => [
|
||||
'undo' => 'Ctrl+Z',
|
||||
'redo' => 'Ctrl+Y',
|
||||
'save_post' => 'Ctrl+S',
|
||||
'copy_widget' => 'Ctrl+C',
|
||||
'paste_widget' => 'Ctrl+V',
|
||||
'duplicate_widget' => 'Ctrl+D',
|
||||
'delete_widget' => 'Delete'
|
||||
]
|
||||
];
|
||||
|
||||
echo '
|
||||
<html>
|
||||
<head>
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="'.$css_url.'give=pagelayer-editor.css,trumbowyg.min.css,pagelayer-icons.css,'.implode(',' ,$icons_list).'&ver='.PAGELAYER_VERSION.'">';
|
||||
|
||||
do_action('pagelayer_live_body_head');
|
||||
|
||||
// Brand Name
|
||||
$brand = strtoupper($pagelayer->BRAND_TEXT);
|
||||
$brand = str_split($brand);
|
||||
|
||||
echo '
|
||||
<style>
|
||||
/*Set responsive variables*/
|
||||
.pagelayer-screen-tablet{
|
||||
width: '. $pagelayer->settings['tablet_breakpoint'] .'px;
|
||||
}
|
||||
.pagelayer-screen-mobile{
|
||||
width: '. $pagelayer->settings['mobile_breakpoint'] .'px;
|
||||
}
|
||||
.pagelayer-errorBox-support{
|
||||
text-decoration:none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="pagelayer-normalize pagelayer-body '.$body_class.'">
|
||||
<div class="pagelayer-errorBox">
|
||||
<div class="pagelayer-errorBox-close"><i class="fas fa-times"></i></div>
|
||||
<div class="pagelayer-errorBox-main">
|
||||
<h2><i class="fas fa-times"></i>'.__pl('error').'</h2>
|
||||
<div class="pagelayer-errorBox-content"></div>
|
||||
</div>
|
||||
<div class="pagelayer-errorBox-resolve">
|
||||
<p>'.__pl('error_submitting').'</p>
|
||||
<button type="button" class="pagelayer-errorBox-copy" onclick="pagelayer_copy_error(event)">'.__pl('copy').'</button>
|
||||
<a type="button" class="pagelayer-errorBox-support" href="'. $pagelayer->support .'" target="_bank">'.__pl('support').'</a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="pagelayer-loader-wrapper">
|
||||
<div class="pagelayer-animation-section">
|
||||
<div class="pagelayer-loader">
|
||||
<div class="pagelayer-percent-parent">
|
||||
<div class="pagelayer-percent">10<sup>%</sup></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pagelayer-txt-loading">';
|
||||
|
||||
foreach($brand as $k => $v){
|
||||
echo '<span data-text-preloader="'.$v.'" class="letters-loading">'.$v.'</span>';
|
||||
}
|
||||
|
||||
echo '</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="pagelayer-normalize pagelayer-body-table" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top" width="270" class="pagelayer-leftbar-table">
|
||||
<table class="pagelayer-normalize" cellpadding="0" cellspacing="0">
|
||||
<tr class="pagelayer-close-bar">
|
||||
<td>
|
||||
<div class="pagelayer-close-bar-icons">
|
||||
<i class="pagelayer-leftbar-minimize fa fa-minus"></i>
|
||||
<i class="pagelayer-leftbar-close fa fa-close"></i>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr height="45">
|
||||
<td class="pagelayer-topbar-holder" valign="middle" align="center">
|
||||
<span class="pagelayer-options-icon pli pli-menu"></span>
|
||||
<div class="pagelayer-elpd-header" style="display:none">
|
||||
<div class="pagelayer-elpd-close"><i class="pli pli-cross" aria-hidden="true"></i></div>
|
||||
<div class="pagelayer-elpd-title pagelayer-topbar-mover">Edit</div>
|
||||
</div>
|
||||
<div class="pagelayer-logo">
|
||||
<img src="'.$pagelayer->LOGO.'" width="28" /><span class="pagelayer-logo-text pagelayer-topbar-mover">'.$pagelayer->BRAND_TEXT.(defined('PAGELAYER_PREMIUM') && strtolower($pagelayer->BRAND_TEXT) == 'pagelayer' ? '<sup style="margin: 3px; font-size: 12px; letter-spacing: 1px; font-family: "Roboto";">Pro</sup>' : '').'</span>
|
||||
<span class="pagelayer-settings-icon pli pli-service" aria-hidden="true"></span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr height="*" valign="top">
|
||||
<td style="position: relative;"><div class="pagelayer-leftbar-holder"></div></td>
|
||||
</tr>
|
||||
<tr height="35" class="pagelayer-bottombar-row">
|
||||
<td><div class="pagelayer-bottombar-holder"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="pagelayer-leftbar-toggle">‹</div>
|
||||
</td>
|
||||
<td class="pagelayer-iframe" valign="top">
|
||||
<div class="pagelayer-iframe-top-bar">';
|
||||
do_action('pagelayer_iframe_top_bar');
|
||||
echo '
|
||||
</div>
|
||||
<div class="pagelayer-iframe-holder">
|
||||
<iframe src="'.(pagelayer_shortlink(0).'&pagelayer-iframe=1&'.$_SERVER['QUERY_STRING']).'" class="pagelayer-normalize skip-lazy" id="pagelayer-iframe"></iframe>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="pagelayer-pro-notice">';
|
||||
pagelayer_show_pro_div('Premium Feature<span class="pli pli-cross pagelayer-pro-x"></span>', '', 0);
|
||||
echo '</div>
|
||||
<div class="pagelayer-editor-notice"></div>
|
||||
<div class="pagelayer-props-modal">
|
||||
<div class="pagelayer-props-holder">
|
||||
<div class="pagelayer-props-wrap">
|
||||
<div class="pagelayer-props-loading-screen"></div>
|
||||
<i class="pagelayer-props-modal-close pli pli-cross" aria-hidden="true"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var pagelayer_iframe_cw = document.getElementById("pagelayer-iframe").contentWindow;
|
||||
var start_time = new Date().getTime();
|
||||
|
||||
// Show loading progress
|
||||
function loader(ran) {
|
||||
var inner = document.getElementsByClassName("pagelayer-percent")[0];
|
||||
var w = 0;
|
||||
var t = setInterval(function() {
|
||||
w = w + 1;
|
||||
inner.innerHTML = (w+"<sup>%</sup>");
|
||||
if (w === ran || inner.getAttribute("loaded") == "1"){
|
||||
clearInterval(t);
|
||||
w = 0;
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
loader(90);
|
||||
|
||||
function $p(sel){
|
||||
return pagelayer_iframe_cw.pagelayer.$$(sel);
|
||||
}
|
||||
|
||||
// Load the window if necessary i.e. an error in the JS of the iframe
|
||||
function onIframeLoad(){
|
||||
setTimeout(function(){
|
||||
force_pagelayer_start();
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
function force_pagelayer_start(){
|
||||
try{
|
||||
if(pagelayer_iframe_cw.pagelayer.loaded == 1){
|
||||
return;
|
||||
}
|
||||
pagelayer_iframe_cw.pagelayer_start();
|
||||
var end_time = new Date().getTime();
|
||||
var diff = (end_time - start_time) / 1000;
|
||||
console.log("['.$pagelayer->BRAND_TEXT.'] Live Body had to load after : "+diff+" seconds");
|
||||
|
||||
// If this fails, lets just hide the loader
|
||||
}catch(e){
|
||||
alert("Fatal error within the '.$pagelayer->BRAND_TEXT.' iFrame as pagelayer object not found ! Please contact '.$pagelayer->BRAND_TEXT.' support");
|
||||
document.getElementById("pagelayer-loader-wrapper").remove();
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("pagelayer-iframe").onload = onIframeLoad;
|
||||
|
||||
// ErrorBox content copy function
|
||||
function pagelayer_copy_error(){
|
||||
var tempInput = document.createElement("textarea");
|
||||
tempInput.value = document.querySelector(".pagelayer-errorBox-content").innerText;
|
||||
document.body.appendChild(tempInput);
|
||||
tempInput.select();
|
||||
document.execCommand("copy");
|
||||
document.body.removeChild(tempInput);
|
||||
alert("'.__pl('copy_success').'");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="pagelayer-editor-modal pagelayer-shortcuts-modal">
|
||||
<div class="pagelayer-editor-modal-wrap">
|
||||
<div class="pagelayer-editor-modal-header">
|
||||
<h2>'.__pl('keyboard_shortcuts').'</h2>
|
||||
<span class="pagelayer-editor-modal-close-icon"><i class="fas fa-times"></i></span>
|
||||
</div>
|
||||
<div class="pagelayer-editor-modal-body">';
|
||||
foreach($shortcut_groups as $grp_name => $group){
|
||||
|
||||
if(empty($group)) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<div class="pagelayer-edt-modal-block">'. (!empty($grp_name) ? '<h3>'.__pl($grp_name).'</h3>' :'' ) .'<ul>';
|
||||
|
||||
foreach($group as $desc => $shortcut) {
|
||||
echo '<li><span class="pagelayer-keyboard-shortcut-desc">'.__pl($desc).'</span>
|
||||
<span class="pagelayer-keyboard-shortcut-keys">';
|
||||
|
||||
//Considering the whole shortcut as a single key
|
||||
$key = '<span>'.$shortcut.'</span>';
|
||||
|
||||
//replacing "+" and "," from the string to put it inside <span>
|
||||
$key = preg_replace('/\+/', '</span> + <span>', $key);
|
||||
$key = preg_replace('/\,/', '</span><span style="display:block; margin-top:10px;">', $key);
|
||||
|
||||
echo $key.'</span></li>';
|
||||
}
|
||||
|
||||
echo '</ul></div>';
|
||||
}
|
||||
|
||||
echo '</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>';
|
||||
|
||||
die();
|
||||
|
||||
}
|
||||
409
backup/wp/wp-content/plugins/pagelayer/main/live.php
Normal file
409
backup/wp/wp-content/plugins/pagelayer/main/live.php
Normal file
@@ -0,0 +1,409 @@
|
||||
<?php
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//===========================================================
|
||||
// live.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_VERSION')) {
|
||||
exit('Hacking Attempt !');
|
||||
}
|
||||
|
||||
|
||||
class PageLayer_LiveEditor{
|
||||
|
||||
// The constructor
|
||||
function __construct() {
|
||||
|
||||
global $pagelayer;
|
||||
|
||||
// Convert the post to a PageLayer Post first
|
||||
$this->check_post();
|
||||
|
||||
// Add the shortcodes
|
||||
// TODO : Make a json file
|
||||
add_action('wp_head', array($this, 'wp_head'), 999);
|
||||
|
||||
// Add the Body Class Filter
|
||||
//add_filter('body_class', array($this, 'body_class'));
|
||||
|
||||
// Add the content handler
|
||||
add_filter('the_content', array($this, 'the_content'), 999999);
|
||||
|
||||
// Skip do_blocks for invalid blocks
|
||||
add_filter( 'pre_render_block', array($this, 'pre_do_render_block'), 10, 3 );
|
||||
|
||||
// Skip do_shortcode for invalid shortcodes
|
||||
add_filter( 'pre_do_shortcode_tag', array($this, 'pre_do_shortcode_tag'), 10, 4 );
|
||||
|
||||
// Build the Shortcodes MD5 for cache
|
||||
$scmd5 = md5(json_encode($pagelayer->shortcodes).json_encode($pagelayer->groups).json_encode($pagelayer->styles));
|
||||
|
||||
// Enqueue our Editor's JS
|
||||
wp_register_script('pagelayer-editor', admin_url( 'admin-ajax.php?action=pagelayer_givejs' ).'&give=pagelayer-editor.js,widgets.js,'.(defined('PAGELAYER_PREMIUM') ? 'premium.js,' : '').'properties.js,base-64.min.js,slimscroll.js,vanilla-picker.min.js,trumbowyg.js,trumbowyg.fontfamily.js,trumbowyg-pagelayer.js,tlite.min.js,pagelayer-pen.js,&pagelayer_nonce=1&scmd5='.$scmd5, array('jquery'), PAGELAYER_VERSION);
|
||||
|
||||
wp_enqueue_script('pagelayer-editor');
|
||||
|
||||
$css_url = admin_url('admin-ajax.php?action=pagelayer_givecss&pagelayer_nonce=1&');
|
||||
if(pagelayer_enable_giver()){
|
||||
$css_url = PAGELAYER_CSS.'/givecss.php?';
|
||||
}
|
||||
|
||||
// Enqueue the Editor's CSS
|
||||
wp_register_style('pagelayer-editor', $css_url.'give=pagelayer-editor-frontend.css,pagelayer-pen.css,'.(defined('PAGELAYER_PREMIUM') ? ',owl.theme.default.min.css,owl.carousel.min.css' : ''), array(), PAGELAYER_VERSION);
|
||||
wp_enqueue_style('pagelayer-editor');
|
||||
|
||||
// Enqueue the DateTime picker CSS
|
||||
/* wp_register_style('datetime-picker', PAGELAYER_CSS.'/datetime-picker.css', array(), PAGELAYER_VERSION);
|
||||
wp_enqueue_style('datetime-picker'); */
|
||||
|
||||
// Enqueue the media library
|
||||
if(!did_action('wp_enqueue_media')){
|
||||
wp_enqueue_media();
|
||||
}
|
||||
|
||||
// Force the Frontend CSS and JS if not already loaded
|
||||
pagelayer_enqueue_frontend(true);
|
||||
|
||||
// Hide Admin Bar
|
||||
show_admin_bar(false);
|
||||
remove_action('wp_head', '_admin_bar_bump_cb');
|
||||
|
||||
// Load custom widgets
|
||||
do_action('pagelayer_custom_editor_enqueue');
|
||||
|
||||
// Add the footer scripts
|
||||
add_action('wp_footer', array($this, 'wp_footer'), 1);
|
||||
|
||||
}
|
||||
|
||||
// Add our body class
|
||||
function body_class($classes){
|
||||
return array_merge($classes, array('pagelayer-body'));
|
||||
}
|
||||
|
||||
// Header function to add certain things
|
||||
function wp_head(){
|
||||
|
||||
global $pagelayer, $post, $wp_query, $_wp_post_type_features;
|
||||
|
||||
// Export the post props
|
||||
$_post = clone $post;
|
||||
|
||||
unset($_post->post_content);
|
||||
|
||||
// Add template type
|
||||
if(!empty($pagelayer->template_editor)){
|
||||
$_post->pagelayer_template_type = get_post_meta($_post->ID, 'pagelayer_template_type', true);
|
||||
}
|
||||
|
||||
$returnURL = ($_post->post_type == 'post' ? admin_url('edit.php') : admin_url('edit.php?post_type='.$_post->post_type) );
|
||||
|
||||
// Get CAPTCHA site key
|
||||
$pagelayer_recaptch_site_key = get_option('pagelayer_google_captcha');
|
||||
|
||||
$pro_url = defined('POPULARFX_PRO_URL') ? POPULARFX_PRO_URL : PAGELAYER_PRO_URL;
|
||||
$pro_txt = defined('POPULARFX_PRO_URL') ? 'PopularFX Pro' : 'Pagelayer Pro';
|
||||
$post_type = get_post_type_object($post->post_type);
|
||||
$post_type_name = (!empty($post_type->labels->singular_name)) ? $post_type->labels->singular_name : ucfirst($post_type->name);
|
||||
|
||||
// Create list of nav menus and it's items list
|
||||
$pagelayer_menus_items_list = array();
|
||||
$menus = wp_get_nav_menus();
|
||||
|
||||
foreach($menus as $menu){
|
||||
|
||||
if(!is_nav_menu($menu)){
|
||||
continue;
|
||||
}
|
||||
|
||||
$pagelayer_menus_items_list[$menu->term_id] = wp_get_nav_menu_items($menu->term_id, array('post_status' => 'any'));
|
||||
}
|
||||
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
pagelayer_ver = "'.PAGELAYER_VERSION.'";
|
||||
pagelayer_block_prefix = "'.PAGELAYER_BLOCK_PREFIX.'";
|
||||
pagelayer_pro = '.(int)defined('PAGELAYER_PREMIUM').';
|
||||
pagelayer_pro_url = "'.PAGELAYER_PRO_URL.'";
|
||||
pagelayer_pro_txt = "'.addslashes('This feature is a part of <a href="'.$pro_url.'" target="_blank">'.$pro_txt.'</a>. You will need purchase <a href="'.$pro_url.'" target="_blank">'.$pro_txt.'</a> to use this feature.').'";
|
||||
pagelayer_api_url = "'.PAGELAYER_API.'";
|
||||
pagelayer_ajax_url = "'.admin_url( 'admin-ajax.php' ).'?&";
|
||||
pagelayer_post_props = "'.admin_url( 'admin.php?page=pagelayer_meta_setting&post=' ).$post->ID.'";
|
||||
pagelayer_ajax_nonce = "'.wp_create_nonce('pagelayer_ajax').'";
|
||||
pagelayer_media_ajax_nonce = "'.wp_create_nonce('media-form').'";
|
||||
pagelayer_internal_linking_nonce = "'.wp_create_nonce('internal-linking').'";
|
||||
pagelayer_preview_nonce = "'. wp_create_nonce( 'post_preview_' . $post->ID ).'";
|
||||
pagelayer_url = "'.PAGELAYER_URL.'";
|
||||
pagelayer_postID = "'.$post->ID.'";
|
||||
pagelayer_permalink_structure = "'.(empty(get_option('permalink_structure')) ? 0 : 1).'";
|
||||
pagelayer_post_permalink = "'.get_permalink($post->ID).'";
|
||||
pagelayer_tabs = '.json_encode($pagelayer->tabs).';
|
||||
pagelayer_isDirty = false;
|
||||
pagelayer_returnURL = "'.$returnURL.'";
|
||||
pagelayer_theme_vars = '.json_encode( pagelayer_template_vars() ).';
|
||||
pagelayer_revision_obj = '.json_encode( pagelayer_get_post_revision_by_id( $post->ID ) ).';
|
||||
pagelayer_author = '.json_encode(pagelayer_author_data($post->ID)).';
|
||||
pagelayer_site_logo = '.json_encode(pagelayer_site_logo()).';
|
||||
pagelayer_support_FI = "'. ( current_theme_supports('post-thumbnails') ) .'";
|
||||
pagelayer_editable = ".'.(!empty($pagelayer->template_editor) ? $pagelayer->template_editor : 'pagelayer-editable-area').'";
|
||||
pagelayer_recaptch_site_key = "'.(!empty($pagelayer_recaptch_site_key) ? $pagelayer_recaptch_site_key : '').'";
|
||||
pagelayer_post = '. @json_encode($_post) .';
|
||||
pagelayer_loaded_icons = '.json_encode(pagelayer_enabled_icons()).';
|
||||
pagelayer_social_urls = '.json_encode(pagelayer_get_social_urls()).';
|
||||
pagelayer_global_widgets = '.json_encode($pagelayer->global_widgets).';
|
||||
pagelayer_saved_sections = '.json_encode($pagelayer->saved_sections).';
|
||||
pagelayer_global_sections = '.json_encode($pagelayer->global_sections).';
|
||||
pagelayer_brand = "'.addslashes($pagelayer->BRAND_TEXT).'";
|
||||
pagelayer_post_type_features = '.json_encode(@$_wp_post_type_features[$post->post_type]).';
|
||||
pagelayer_post_categories = '.json_encode(pagelayer_post_cats($post)).';
|
||||
pagelayer_post_tags = '.json_encode(pagelayer_post_tags($post)).';
|
||||
pagelayer_shortcodes.pl_post_props.name = "'.ucfirst($post_type_name).' '. __pl('Settings').'";
|
||||
pagelayer_shortcodes.pl_post_props.params.post_author.list = '.json_encode(pagelayer_post_authors_by_type($post->post_type)).';
|
||||
pagelayer_shortcodes.pl_post_props.pageParent.post_parent.list = '.json_encode(pagelayer_parent_post_prop($post)).';
|
||||
pagelayer_gmaps_key = "'.get_option('pagelayer-gmaps-api-key').'";
|
||||
pagelayer_ajax_post_data = {};
|
||||
pagelayer_menus_items_list = '.json_encode($pagelayer_menus_items_list).';
|
||||
pagelayer_customizer_values = '.json_encode(pagelayer_get_customizer_options()).';
|
||||
pagelayer_global_colors = '.json_encode($pagelayer->global_colors).';
|
||||
pagelayer_global_fonts = '.json_encode($pagelayer->global_fonts).';
|
||||
pagelayer_customizer_url = "'.admin_url("/customize.php?return=").urlencode($_SERVER['HTTP_REFERER']).'";
|
||||
pagelayer_support_url = "'.$pagelayer->support .'";';
|
||||
|
||||
if(defined('PAGELAYER_PREMIUM')){
|
||||
echo 'pagelayer_shortcodes.pl_popup.advance_options.popup_cookie_name.default = "popup_cookie_'.rand(100, 999).'";';
|
||||
}
|
||||
|
||||
// Detect JS via givejs for better performance
|
||||
if(empty($pagelayer->settings['enable_giver'])){
|
||||
echo '
|
||||
jQuery(document).ready(function(){
|
||||
var test_giver = -1;
|
||||
|
||||
return jQuery.ajax({
|
||||
url: "'.PAGELAYER_JS.'/givejs.php?test=1",
|
||||
type: "GET",
|
||||
dataType: "text",
|
||||
success:function(data){
|
||||
|
||||
if(data !== "1"){
|
||||
return;
|
||||
}
|
||||
|
||||
test_giver = 1;
|
||||
},
|
||||
complete:function(data){
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: pagelayer_ajax_url+"&action=pagelayer_set_jscss_giver",
|
||||
data: {
|
||||
pagelayer_nonce: pagelayer_ajax_nonce,
|
||||
set : test_giver
|
||||
},
|
||||
error: function(errorThrown){
|
||||
console.log("Error saving giver data");
|
||||
console.log(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
';
|
||||
}
|
||||
|
||||
echo '
|
||||
</script>';
|
||||
|
||||
echo '<style>
|
||||
@media (min-width: '.($pagelayer->settings['tablet_breakpoint'] + 1).'px){
|
||||
.pagelayer-hide-desktop{
|
||||
display:initial;
|
||||
filter:blur(3px);
|
||||
}
|
||||
.pagelayer-hide-desktop *{
|
||||
filter:blur(2px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: '.$pagelayer->settings['tablet_breakpoint'].'px) and (min-width: '.($pagelayer->settings['mobile_breakpoint'] + 1).'px){
|
||||
.pagelayer-hide-tablet{
|
||||
display:initial;
|
||||
filter:blur(3px);
|
||||
}
|
||||
.pagelayer-hide-tablet *{
|
||||
filter:blur(2px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: '.$pagelayer->settings['mobile_breakpoint'].'px){
|
||||
.pagelayer-hide-mobile{
|
||||
display:initial;
|
||||
filter:blur(3px);
|
||||
}
|
||||
|
||||
.pagelayer-hide-mobile *{
|
||||
filter:blur(2px);
|
||||
}
|
||||
}
|
||||
</style>';
|
||||
do_action('pagelayer_editor_wp_head');
|
||||
|
||||
}
|
||||
|
||||
// Footer function to add certain things
|
||||
function wp_footer(){
|
||||
|
||||
global $pagelayer;
|
||||
|
||||
echo '<script>
|
||||
pagelayer_default_params = '.json_encode($pagelayer->default_params, JSON_FORCE_OBJECT).';
|
||||
pagelayer.el = '.json_encode($pagelayer->data_attr, JSON_FORCE_OBJECT).';
|
||||
</script>';
|
||||
|
||||
wp_enqueue_script('heartbeat');
|
||||
_wp_footer_scripts();
|
||||
}
|
||||
|
||||
// Convert to Pagelayer post
|
||||
function check_post(){
|
||||
|
||||
global $post;
|
||||
|
||||
// Is this a Pagelayer post
|
||||
$data = get_post_meta($post->ID, 'pagelayer-data', true);
|
||||
|
||||
if(empty($data)){
|
||||
|
||||
// Is it a Gutenburg Post ?
|
||||
if(!empty($post->post_content)){
|
||||
|
||||
// Add our surrounding tag
|
||||
$post->post_content = '<!-- '.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl_row -->
|
||||
<!-- '.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl_col {col=12} -->
|
||||
'.$post->post_content.'
|
||||
<!-- /'.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl_col -->
|
||||
<!-- /'.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl_row -->';
|
||||
|
||||
// Regular post, but its empty so we will add our blocks !
|
||||
}else{
|
||||
|
||||
// Add our surrounding tag
|
||||
$post->post_content = '<!-- '.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl_row {"stretch":"auto","col_gap":"10","width_content":"auto","row_height":"default","overlay_hover_delay":"400","row_shape_top_color":"#227bc3","row_shape_top_width":"100","row_shape_top_height":"100","row_shape_bottom_color":"#e44993","row_shape_bottom_width":"100","row_shape_bottom_height":"100","pagelayer-id":""} -->
|
||||
<!-- '.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl_col {"overlay_hover_delay":"400","pagelayer-id":""} -->
|
||||
<!-- /'.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl_col -->
|
||||
<!-- /'.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl_row -->';
|
||||
|
||||
// Update the post
|
||||
$new_post = array(
|
||||
'ID' => $post->ID,
|
||||
'post_content' => $post->post_content,
|
||||
);
|
||||
|
||||
// Update the post into the database
|
||||
wp_update_post($new_post);
|
||||
|
||||
// Convert to pagelayer accessed post
|
||||
if(!add_post_meta($post->ID, 'pagelayer-data', time(), true)){
|
||||
update_post_meta($post->ID, 'pagelayer-data', time());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Add certain things
|
||||
function the_content($content) {
|
||||
|
||||
global $post, $pagelayer;
|
||||
|
||||
if(empty($pagelayer->dont_make_editable)){
|
||||
$content = '<div class="pagelayer-editable-area">'.$content.'</div>';
|
||||
}
|
||||
|
||||
// Check if we're inside the main loop in a single post page.
|
||||
if ( is_single() && in_the_loop() && is_main_query() ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
return $content;
|
||||
|
||||
}
|
||||
|
||||
// Skip do_shortcode for invalid shortcodes
|
||||
function pre_do_shortcode_tag($return, $tag, $attr, $m){
|
||||
|
||||
if(!empty($pagelayer->dont_make_editable) || ! doing_filter('the_content')){
|
||||
return $return;
|
||||
}
|
||||
|
||||
$prefixes = ['pl_'];
|
||||
|
||||
$prefixes = apply_filters( 'pagelayer_valid_shortcode_tag', $prefixes);
|
||||
|
||||
$vailid = false;
|
||||
|
||||
foreach($prefixes as $prefix) {
|
||||
if (strpos($tag, $prefix) === 0) {
|
||||
$vailid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($vailid){
|
||||
return $return;
|
||||
}
|
||||
|
||||
return $m[0];
|
||||
}
|
||||
|
||||
// Skip do_blocks for invalid blocks
|
||||
function pre_do_render_block($return, $parsed_block = [], $parent_block = null){
|
||||
|
||||
if(!empty($pagelayer->dont_make_editable) || ! doing_filter('the_content') || empty($parsed_block['blockName'])){
|
||||
return $return;
|
||||
}
|
||||
|
||||
$prefixes = ['pagelayer/'];
|
||||
|
||||
$prefixes = apply_filters( 'pagelayer_valid_block_tag', $prefixes);
|
||||
|
||||
$vailid = false;
|
||||
|
||||
foreach($prefixes as $prefix) {
|
||||
if (strpos($parsed_block['blockName'], $prefix) === 0) {
|
||||
$vailid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($vailid){
|
||||
return $return;
|
||||
}
|
||||
|
||||
$serialize_block = serialize_block($parsed_block);
|
||||
|
||||
$parsed_block['blockName'] = 'pagelayer/pl_missing';
|
||||
$parsed_block['innerHTML'] = $serialize_block;
|
||||
$parsed_block['attrs'] = [];
|
||||
|
||||
return render_block($parsed_block);
|
||||
}
|
||||
|
||||
}
|
||||
303
backup/wp/wp-content/plugins/pagelayer/main/nav_walker.php
Normal file
303
backup/wp/wp-content/plugins/pagelayer/main/nav_walker.php
Normal file
@@ -0,0 +1,303 @@
|
||||
<?php
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//===========================================================
|
||||
// nav_walker.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_VERSION')) {
|
||||
exit('Hacking Attempt !');
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Pagelayer_Walker_Nav_Menu' ) ) {
|
||||
|
||||
class Pagelayer_Walker_Nav_Menu extends Walker_Nav_Menu{
|
||||
|
||||
|
||||
// Starts the list before the elements are added.
|
||||
public function start_lvl( &$output, $depth = 0, $args = null ) {
|
||||
if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
|
||||
$t = '';
|
||||
$n = '';
|
||||
} else {
|
||||
$t = "\t";
|
||||
$n = "\n";
|
||||
}
|
||||
$indent = str_repeat( $t, $depth );
|
||||
|
||||
// Default class.
|
||||
$classes = array( 'sub-menu' );
|
||||
|
||||
// Filters the CSS class(es) applied to a menu list element.
|
||||
$class_names = implode( ' ', apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth ) );
|
||||
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
|
||||
|
||||
$output .= "{$n}{$indent}<ul$class_names>{$n}";
|
||||
}
|
||||
|
||||
// Ends the list of after the elements are added.
|
||||
public function end_lvl( &$output, $depth = 0, $args = null ) {
|
||||
if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
|
||||
$t = '';
|
||||
$n = '';
|
||||
} else {
|
||||
$t = "\t";
|
||||
$n = "\n";
|
||||
}
|
||||
$indent = str_repeat( $t, $depth );
|
||||
$output .= "$indent</ul>{$n}";
|
||||
}
|
||||
|
||||
// Starts the element output.
|
||||
public function start_el( &$output, $item, $depth = 0, $args = null, $id = 0 ) {
|
||||
if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
|
||||
$t = '';
|
||||
$n = '';
|
||||
} else {
|
||||
$t = "\t";
|
||||
$n = "\n";
|
||||
}
|
||||
$indent = ( $depth ) ? str_repeat( $t, $depth ) : '';
|
||||
|
||||
// Menu setting keys
|
||||
$keys = array('_pagelayer_content');
|
||||
|
||||
foreach($keys as $key){
|
||||
$menu_item_setting = get_post_meta( $item->ID, $key, true );
|
||||
|
||||
if(!empty($menu_item_setting)){
|
||||
$item->$key = $menu_item_setting;
|
||||
}
|
||||
}
|
||||
|
||||
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
|
||||
$classes[] = 'menu-item-' . $item->ID;
|
||||
|
||||
// Get custom setting data
|
||||
$item_content = $this->get_item_data($item, '_pagelayer_content');
|
||||
|
||||
$settings = array();
|
||||
$pagelayer_has_content = 0;
|
||||
|
||||
if(!empty($item_content) && has_blocks($item_content)){
|
||||
|
||||
$blocks = parse_blocks($item_content);
|
||||
|
||||
$attrs = array();
|
||||
|
||||
foreach($blocks as $index => $block){
|
||||
if($block['blockName'] != 'pagelayer/pl_nav_menu_item'){
|
||||
continue;
|
||||
}
|
||||
|
||||
// Overrig the menu ID to apply css and others
|
||||
foreach($item as $kk => $vv){
|
||||
if($kk == '_pagelayer_content'){
|
||||
continue;
|
||||
}
|
||||
|
||||
$block['attrs'][$kk] = $vv;
|
||||
}
|
||||
|
||||
$settings = $block['attrs'];
|
||||
|
||||
// Add settings to $item
|
||||
foreach($settings as $skey => $sval){
|
||||
|
||||
if(isset($item->$skey)){
|
||||
continue;
|
||||
}
|
||||
|
||||
$item->$skey = $sval;
|
||||
}
|
||||
|
||||
if(!empty($block['innerBlocks'])){
|
||||
$pagelayer_has_content = $this->has_block_content($block['innerBlocks']);
|
||||
}
|
||||
|
||||
$blocks[$index] = $block;
|
||||
}
|
||||
|
||||
$item_content = serialize_blocks($blocks);
|
||||
}
|
||||
|
||||
$pagelayer_has_content = pagelayer_is_live() ? 1 : $pagelayer_has_content;
|
||||
|
||||
// Get menu type
|
||||
$menu_type = $this->get_item_data($item, 'menu_type');
|
||||
|
||||
if(!empty($menu_type) && $menu_type == 'mega' && $depth == 0 && !empty($pagelayer_has_content)){
|
||||
$classes[] = 'pagelayer-mega-menu-item';
|
||||
}
|
||||
|
||||
if(!empty($menu_type) && $menu_type == 'column' && $depth == 0){
|
||||
$classes[] = 'pagelayer-mega-column-item';
|
||||
}
|
||||
|
||||
$menu_icon_class = $this->get_item_data($item, 'icon_position');
|
||||
if(!empty($menu_icon_class)){
|
||||
$classes[] = 'pagelayer-nav-menu-icon-'.$menu_icon_class;
|
||||
}
|
||||
|
||||
// Filters the arguments for a single nav menu item.
|
||||
$args = apply_filters( 'nav_menu_item_args', $args, $item, $depth );
|
||||
|
||||
// Filters the CSS classes applied to a menu item's list item element.
|
||||
$class_names = implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) );
|
||||
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
|
||||
|
||||
// Filters the ID applied to a menu item's list item element.
|
||||
$id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth );
|
||||
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
|
||||
|
||||
$output .= $indent . '<li' . $id . $class_names . '>';
|
||||
|
||||
$atts = array();
|
||||
$atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : '';
|
||||
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
|
||||
if ( '_blank' === $item->target && empty( $item->xfn ) ) {
|
||||
$atts['rel'] = 'noopener';
|
||||
} else {
|
||||
$atts['rel'] = $item->xfn;
|
||||
}
|
||||
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
|
||||
$atts['aria-current'] = $item->current ? 'page' : '';
|
||||
|
||||
// Filters the HTML attributes applied to a menu item's anchor element.
|
||||
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth );
|
||||
|
||||
$attributes = '';
|
||||
foreach ( $atts as $attr => $value ) {
|
||||
if ( is_scalar( $value ) && '' !== $value && false !== $value ) {
|
||||
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
|
||||
|
||||
// Get disable links
|
||||
$disable_link = $this->get_item_data($item, 'disable_link');
|
||||
if ( 'href' === $attr && !empty($disable_link) ) {
|
||||
$value = 'javascript:void(0)';
|
||||
}
|
||||
$attributes .= ' ' . $attr . '="' . $value . '"';
|
||||
}
|
||||
}
|
||||
|
||||
/** This filter is documented in wp-includes/post-template.php */
|
||||
$title = $this->get_item_data($item, 'title');
|
||||
$title = apply_filters( 'the_title', $title, $item->ID );
|
||||
|
||||
// Filters a menu item's title.
|
||||
$title = apply_filters( 'nav_menu_item_title', $title, $item, $args, $depth );
|
||||
|
||||
$item_output = $args->before;
|
||||
$item_output .= '<a' . $attributes . '>';
|
||||
|
||||
// Add menu icon
|
||||
$menu_icon = $this->get_item_data($item, 'menu_icon');
|
||||
if (!empty($menu_icon)) {
|
||||
$item_output .= '<i class="pagelayer-menu-icon '.$menu_icon.'"></i>';
|
||||
}
|
||||
|
||||
$item_output .= '<span class="pagelayer-nav-menu-title">' . $args->link_before . $title . $args->link_after .'</span>';
|
||||
|
||||
// Add highlight lable
|
||||
$highlight_label = $this->get_item_data($item, 'highlight_label');
|
||||
if (!empty($highlight_label)) {
|
||||
$item_output .= '<span class="pagelayer-menu-highlight">'.$highlight_label.'</span>';
|
||||
}
|
||||
|
||||
$item_output .= '</a>';
|
||||
$item_output .= $args->after;
|
||||
|
||||
$mega_class = 'pagelayer-mega-editor-'.$item->ID;
|
||||
|
||||
$item_output .= '<div class="pagelayer-mega-menu '.$mega_class.'">';
|
||||
|
||||
// Add mega menu
|
||||
if(!empty($item_content)){
|
||||
$item_content = pagelayer_the_content($item_content, true);
|
||||
|
||||
// Change the pagelayer ID
|
||||
$item_output .= pagelayer_change_id($item_content);
|
||||
}
|
||||
|
||||
$item_output .= '</div>';
|
||||
|
||||
// Filters a menu item's starting output.
|
||||
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
|
||||
}
|
||||
|
||||
// Ends the element output, if needed.
|
||||
public function end_el( &$output, $item, $depth = 0, $args = null ) {
|
||||
if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
|
||||
$t = '';
|
||||
$n = '';
|
||||
} else {
|
||||
$t = "\t";
|
||||
$n = "\n";
|
||||
}
|
||||
$output .= "</li>{$n}";
|
||||
}
|
||||
|
||||
// Get the post value
|
||||
public function get_item_data( $item, $name ) {
|
||||
|
||||
if(pagelayer_is_live() && isset($_REQUEST['pagelayer_nav_items']) && isset($_REQUEST['pagelayer_nav_items'][$item->ID][$name]) ){
|
||||
$data = $_REQUEST['pagelayer_nav_items'][$item->ID][$name];
|
||||
|
||||
// If Title is empty
|
||||
if(empty($data) && $name == 'title'){
|
||||
$_item = clone $item;
|
||||
$_item->post_title = '';
|
||||
$_item = wp_setup_nav_menu_item($_item);
|
||||
return $_item->title;
|
||||
}
|
||||
|
||||
if(!empty($data) && $name == '_pagelayer_content'){
|
||||
$data = base64_decode($data);
|
||||
}
|
||||
|
||||
return stripslashes_deep($data);
|
||||
}
|
||||
|
||||
return @$item->$name;
|
||||
}
|
||||
|
||||
// Check the block has inner block
|
||||
public function has_block_content( $blocks ) {
|
||||
|
||||
$tags = array('pagelayer/pl_row', 'pagelayer/pl_inner_row', 'pagelayer/pl_col', 'pagelayer/pl_inner_col');
|
||||
$has_content = 0;
|
||||
|
||||
foreach($blocks as $block){
|
||||
if(!in_array( $block['blockName'], $tags) || !empty($has_content)){
|
||||
$has_content = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if(empty($block['innerBlocks']) ){
|
||||
continue;
|
||||
}
|
||||
|
||||
$has_content = $this->has_block_content($block['innerBlocks']);
|
||||
}
|
||||
|
||||
return $has_content;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
108
backup/wp/wp-content/plugins/pagelayer/main/parse-shortcodes.php
Normal file
108
backup/wp/wp-content/plugins/pagelayer/main/parse-shortcodes.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?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_VERSION')) {
|
||||
exit('Hacking Attempt !');
|
||||
}
|
||||
|
||||
function pagelayer_do_shortcode_to_block( $content, $ignore_html = false ) {
|
||||
global $shortcode_tags;
|
||||
|
||||
if ( false === strpos( $content, '[' ) ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
// Find all registered tag names in $content.
|
||||
preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches );
|
||||
$tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
|
||||
|
||||
if( empty( $tagnames ) ){
|
||||
return $content;
|
||||
}
|
||||
|
||||
$content = do_shortcodes_in_html_tags( $content, $ignore_html, $tagnames );
|
||||
|
||||
$pattern = get_shortcode_regex( $tagnames );
|
||||
$content = preg_replace_callback( "/$pattern/", 'pagelayer_do_shortcode_tag', $content );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
function pagelayer_do_shortcode_tag($m){
|
||||
|
||||
// Allow [[foo]] syntax for escaping a tag.
|
||||
if ( '[' === $m[1] && ']' === $m[6] ) {
|
||||
return substr( $m[0], 1, -1 );
|
||||
}
|
||||
|
||||
$tag = $m[2];
|
||||
$attr = shortcode_parse_atts( $m[3] );
|
||||
$content = isset( $m[5] ) ? $m[5] : null;
|
||||
|
||||
$output = $m[1] . pagelayer_shortcode_to_block( $attr, $content, $tag ) . $m[6];
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function pagelayer_shortcode_to_block($attr, $content, $tag){
|
||||
|
||||
if($tag == 'pl_post_props'){
|
||||
return '';
|
||||
}
|
||||
|
||||
if($tag == 'pl_inner_col'){
|
||||
$tag = 'pl_col';
|
||||
}
|
||||
|
||||
if($tag == 'pl_inner_row'){
|
||||
$tag = 'pl_row';
|
||||
}
|
||||
|
||||
$block_name = 'pagelayer/'.str_replace('_', '-', $tag);
|
||||
|
||||
$func = 'pagelayer_fix_block_'.$tag;
|
||||
|
||||
// Is there a function of the tag ?
|
||||
if(function_exists($func)){
|
||||
call_user_func_array($func, array(&$block_name, &$attr, &$content));
|
||||
}
|
||||
|
||||
$content = pagelayer_do_shortcode_to_block($content);
|
||||
|
||||
return get_comment_delimited_block_content( $block_name, $attr, $content );
|
||||
}
|
||||
|
||||
function pagelayer_fix_block_pl_accordion_item(&$block_name, &$attr, &$content){
|
||||
|
||||
if(pagelayer_has_blocks($content) || false !== strpos( $content, '[pl_' )){
|
||||
return;
|
||||
}
|
||||
|
||||
pagelayer_content_to_block($content);
|
||||
}
|
||||
|
||||
function pagelayer_content_to_block(&$content){
|
||||
|
||||
$content = '<!-- '.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl-row {"stretch":"auto"} -->
|
||||
<!-- '.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl-col {"overlay_hover_delay":"400"} -->
|
||||
<!-- '.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl-text -->'.$content.'<!-- /'.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl-text -->
|
||||
<!-- /'.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl-col -->
|
||||
<!-- /'.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl-row -->';
|
||||
}
|
||||
546
backup/wp/wp-content/plugins/pagelayer/main/post_metas.php
Normal file
546
backup/wp/wp-content/plugins/pagelayer/main/post_metas.php
Normal file
@@ -0,0 +1,546 @@
|
||||
<?php
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//===========================================================
|
||||
// post_metas.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_VERSION')) {
|
||||
exit('Hacking Attempt !');
|
||||
}
|
||||
|
||||
// Show the post props
|
||||
function pagelayer_meta_page(){
|
||||
global $post_type, $post_type_object, $post, $wp_meta_boxes, $current_screen, $user_ID, $post_ID;
|
||||
|
||||
$post_ID = (int) @$_GET['post'];
|
||||
|
||||
if(empty($post_ID)){
|
||||
return;
|
||||
}
|
||||
|
||||
$post = get_post($post_ID);
|
||||
|
||||
if(empty($post)){
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'edit_post', $post_ID ) ) {
|
||||
wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
|
||||
}
|
||||
|
||||
$post_type = $post->post_type;
|
||||
$post_type_object = get_post_type_object( $post_type );
|
||||
$user_ID = get_current_user_id();
|
||||
|
||||
// Set current screen
|
||||
set_current_screen($post_type);
|
||||
|
||||
// Flag that we're not loading the block editor.
|
||||
$current_screen = get_current_screen();
|
||||
$current_screen->is_block_editor = 0;
|
||||
|
||||
$form_extra = '';
|
||||
$form_action = 'editpost';
|
||||
$nonce_action = 'update-post_' . $post_ID;
|
||||
$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr( $post_ID ) . "' />";
|
||||
|
||||
// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
|
||||
$lib = ABSPATH . 'site-admin/includes/meta-boxes.php';
|
||||
$lib = file_exists($lib) ? $lib : ABSPATH . 'wp-admin/includes/meta-boxes.php';
|
||||
require_once $lib;
|
||||
|
||||
register_and_do_post_meta_boxes( $post );
|
||||
|
||||
$locations = array( 'side', 'normal', 'advanced' );
|
||||
$priorities = array( 'high', 'sorted', 'core', 'default', 'low' );
|
||||
$to_remove_box = array('submitdiv', 'categorydiv', 'tagsdiv-post_tag', 'pageparentdiv', 'postimagediv', 'revisionsdiv', 'commentsdiv', 'formatdiv', 'postexcerpt', 'commentstatusdiv', 'slugdiv', 'authordiv');
|
||||
|
||||
// Remove meta boxes from pagelayer settings
|
||||
$to_remove_box = apply_filters('pagelayer_remove_meta_boxes', $to_remove_box);
|
||||
|
||||
// Remove Meta Boxes
|
||||
foreach( $locations as $location ){
|
||||
foreach( $priorities as $priority ){
|
||||
if( isset( $wp_meta_boxes[ $current_screen->id ][ $location ][ $priority ] ) ){
|
||||
foreach( $to_remove_box as $to_remove ) {
|
||||
if(array_key_exists($to_remove, $wp_meta_boxes[ $current_screen->id ][ $location ][ $priority ])){
|
||||
remove_meta_box($to_remove, $current_screen, $location);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add format div again to change the position
|
||||
if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) {
|
||||
add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'normal', 'default', array( '__back_compat_meta_box' => true ) );
|
||||
}
|
||||
|
||||
// TO show all hidden meta boxes
|
||||
add_filter( 'hidden_meta_boxes', function( $hidden, $screen, $use_defaults ){
|
||||
return array();
|
||||
}, 999, 3);
|
||||
|
||||
$props_tabs = array(
|
||||
'advanced_props' => array(
|
||||
'label' => __('Advanced'),
|
||||
'icon' => 'dashicons dashicons-welcome-add-page',
|
||||
'class' => 'pagelayer-active-item',
|
||||
),
|
||||
'hf_code' => array(
|
||||
'label' => __('Header, Body and Footer'),
|
||||
'icon' => 'dashicons dashicons-editor-code',
|
||||
),
|
||||
);
|
||||
|
||||
$props_tabs = apply_filters('pagelayer_post_props_tabs', $props_tabs);
|
||||
|
||||
?>
|
||||
<style type="text/css">
|
||||
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;
|
||||
}
|
||||
|
||||
.postbox{
|
||||
border: 0;
|
||||
border-bottom: 1px solid #ccd0d4;
|
||||
}
|
||||
|
||||
.pagelayer-side-meta .meta-box-sortables{
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-gap: 10px;
|
||||
grid-auto-rows: auto;
|
||||
}
|
||||
|
||||
.pagelayer-side-meta .postbox.closed{
|
||||
height:max-content;
|
||||
}
|
||||
|
||||
#major-publishing-actions{
|
||||
display:none;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1170px) {
|
||||
.pagelayer-side-meta .meta-box-sortables{
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 782px){
|
||||
.auto-fold #wpcontent {
|
||||
padding-left:4px;
|
||||
}
|
||||
.pagelayer-side-meta .meta-box-sortables{
|
||||
grid-template-columns: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.pagelayer-modal{
|
||||
overflow: hidden;
|
||||
position: fixed;
|
||||
top:0;
|
||||
left:0;
|
||||
display: flex;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
pointer-events: auto;
|
||||
background-color: #292e37;
|
||||
background-clip: padding-box;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color : 333;
|
||||
z-index: 999999;
|
||||
}
|
||||
|
||||
.pagelayer-tab-wrap,
|
||||
.pagelayer-modal-holder{
|
||||
position: relative;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-ms-flex-wrap: wrap;
|
||||
flex-wrap: wrap;
|
||||
height: calc(100% - 60px);
|
||||
}
|
||||
|
||||
.pagelayer-tab-wrap{
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.pagelayer-modal-sidebar{
|
||||
max-width: 256px;
|
||||
min-width: 200px;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
color: #fff;
|
||||
padding: 30px 20px;
|
||||
height: calc(100% + 40px);
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
.pagelayer-sidebar-items{
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.pagelayer-active-item,
|
||||
.pagelayer-sidebar-items:hover{
|
||||
background-color: #474c54;
|
||||
transition:300ms;
|
||||
}
|
||||
|
||||
.pagelayer-modal-content{
|
||||
-webkit-box-flex: 1;
|
||||
-ms-flex: 1 1 auto;
|
||||
flex: 1 1 auto;
|
||||
height: 100%;
|
||||
background-color: #ffffff;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.pagelayer-form{
|
||||
height:100%;
|
||||
flex-grow:1;
|
||||
}
|
||||
|
||||
.pagelayer-modal-holder{
|
||||
flex-wrap: nowrap !important;
|
||||
}
|
||||
|
||||
.pagelayer-modal-header{
|
||||
padding: 20px 40px 20px 20px;
|
||||
border-bottom: 1px solid #f1f1f1;
|
||||
}
|
||||
|
||||
.pagelayer-modal-header h2{
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.pagelayer-modal-body{
|
||||
background-color: #f1f1f1;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
.pagelayer-inner-body{
|
||||
overflow:auto;
|
||||
padding:20px;
|
||||
height:calc(100% - 90px);
|
||||
}
|
||||
|
||||
.pagelayer-inner-footer{
|
||||
padding: 20px;
|
||||
background-color: #ffffff;
|
||||
position:absolute;
|
||||
bottom:-65px;
|
||||
left:0;
|
||||
max-height:65px;
|
||||
width:100%;
|
||||
border-top: 1px solid #f1f1f1;
|
||||
}
|
||||
|
||||
.pagelayer-meta-tabs{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.pagelayer-tab-items{
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.pagelayer-meta-tabs .pagelayer-tab-items{
|
||||
padding:20px 10px;
|
||||
}
|
||||
|
||||
.pagelayer-meta-tabs .pagelayer-active-item,
|
||||
.pagelayer-meta-tabs .pagelayer-tab-items:hover{
|
||||
background-color: #f1f1f1;
|
||||
transform: scale(1.02);
|
||||
color: #3e8ef7;
|
||||
}
|
||||
|
||||
.pagelayer-hidden{
|
||||
display:none;
|
||||
}
|
||||
|
||||
.pagelayer-show{
|
||||
display:block;
|
||||
}
|
||||
|
||||
.pagelayer-save-btn{
|
||||
border: #398439 1px solid;
|
||||
color: #fff;
|
||||
background: #449d44;
|
||||
padding: 5px 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.pagelayer-block{
|
||||
display:block;
|
||||
}
|
||||
|
||||
.pagelayer-textarea{
|
||||
width:70%;
|
||||
}
|
||||
|
||||
.pagelayer-h-full{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.pagelayer-post-title{
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function(){
|
||||
|
||||
// Prevent the click Inside the meta pages
|
||||
pagelayer_prevent_click_metas();
|
||||
|
||||
jQuery('.pagelayer-modal .pagelayer-tab-items').on('click', function(){
|
||||
var jEle = jQuery(this);
|
||||
var show_panel = jEle.attr('data-tab');
|
||||
var holder = jEle.closest('.pagelayer-tab-wrap');
|
||||
|
||||
// Hide all tab panels
|
||||
holder.find('[tab-panel]').hide();
|
||||
jEle.closest('.pagelayer-tab-holder').find('.pagelayer-tab-items').removeClass('pagelayer-active-item');
|
||||
|
||||
// Show and active the click panel
|
||||
jEle.addClass('pagelayer-active-item');
|
||||
holder.find('[tab-panel="'+show_panel+'"]').first().show();
|
||||
});
|
||||
|
||||
// Do active tab
|
||||
jQuery('.pagelayer-modal .pagelayer-tab-items.pagelayer-active-item').first().click();
|
||||
|
||||
});
|
||||
|
||||
// Prevent the click Inside the meta pages
|
||||
function pagelayer_prevent_click_metas(){
|
||||
jQuery(document).on("submit", function(event){
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
jQuery(document).on("click", function(event){
|
||||
var target = jQuery(event.target);
|
||||
if (target.closest("a").length > 0) {
|
||||
event.preventDefault();
|
||||
var href = target.closest("a").attr("href");
|
||||
|
||||
if(!href.match(/(http|https):\/\//g)){
|
||||
return;
|
||||
}
|
||||
|
||||
var exp = new RegExp("(http|https):\/\/"+window.location.hostname, "g");
|
||||
|
||||
// Open new window
|
||||
if(href.match(exp)){
|
||||
|
||||
// Reload same window
|
||||
window.parent.location.assign(href);
|
||||
}else{
|
||||
window.open(href, "_blank");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="pagelayer-modal">
|
||||
<div class="pagelayer-modal-holder">
|
||||
<form name="post" action="post.php" method="post" onsubmit="return pagelayer_post_edit(this, event)" id="post" class="pagelayer-form pagelayer-tab-wrap" <?php $referer = wp_get_referer(); ?>>
|
||||
|
||||
<?php wp_nonce_field( $nonce_action ); ?>
|
||||
<input type="hidden" name="is_pagelayer_editor" value="1" />
|
||||
<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID; ?>" />
|
||||
<input type="hidden" id="hiddenaction" name="action1" value="<?php echo esc_attr( $form_action ); ?>" />
|
||||
<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ); ?>" />
|
||||
<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
|
||||
<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />
|
||||
<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status ); ?>" />
|
||||
<input type="hidden" id="referredby" name="referredby" value="<?php echo $referer ? esc_url( $referer ) : ''; ?>" />
|
||||
<?php if ( ! empty( $active_post_lock ) ) { ?>
|
||||
<input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" />
|
||||
<?php
|
||||
}
|
||||
if ( 'draft' !== get_post_status( $post ) ) {
|
||||
wp_original_referer_field( true, 'previous' );
|
||||
}
|
||||
|
||||
echo $form_extra;
|
||||
|
||||
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
||||
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
||||
|
||||
?>
|
||||
<!-- Start Tabs-->
|
||||
<div class="pagelayer-modal-sidebar pagelayer-tab-holder">
|
||||
|
||||
<?php foreach($props_tabs as $key => $props_tab){?>
|
||||
<div class="pagelayer-sidebar-items pagelayer-tab-items <?php echo ( !empty($props_tab['class']) ? $props_tab['class'] : '' );?>" data-tab="<?php echo $key; ?>" <?php echo ( !empty($props_tab['attr']) ? $props_tab['attr'] : '' );?>>
|
||||
<span class="<?php echo $props_tab['icon']; ?>"></span> <?php echo $props_tab['label']; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<!-- End Tabs-->
|
||||
<div class="pagelayer-modal-content" tab-panel="advanced_props">
|
||||
<div class="pagelayer-modal-header">
|
||||
<h2><?php _e('Advanced Props') ?></h2>
|
||||
</div>
|
||||
<div class="pagelayer-modal-body">
|
||||
<div class="pagelayer-inner-body metabox-holder">
|
||||
<?php
|
||||
do_meta_boxes( $post_type, 'side', $post );
|
||||
do_meta_boxes( $post_type, 'normal', $post );
|
||||
do_meta_boxes( $post_type, 'advanced', $post );
|
||||
?>
|
||||
</div>
|
||||
<div class="pagelayer-inner-footer">
|
||||
<input type="submit" class="pagelayer-save-btn" name="pagelayer_submit2" value="<?php _e('Save Changes'); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pagelayer-modal-content pagelayer-hidden" tab-panel="hf_code">
|
||||
<?php pagelayer_post_hf_code(); ?>
|
||||
</div>
|
||||
|
||||
<?php apply_filters('pagelayer_post_props_tabs_panel', '');?>
|
||||
<!-- End Tab panels -->
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
// Post Title
|
||||
function pagelayer_post_title(){
|
||||
global $post_type, $post_type_object, $post, $wp_meta_boxes, $current_screen, $user_ID, $post_ID;
|
||||
|
||||
if ( !post_type_supports( $post_type, 'title' ) ) {
|
||||
return '';
|
||||
}
|
||||
?>
|
||||
<div id="titlediv">
|
||||
<label for="title"><?php _e('Post Title') ?></label>
|
||||
<div id="titlewrap">
|
||||
<?php
|
||||
$title_placeholder = apply_filters( 'enter_title_here', __( 'Add title' ), $post );
|
||||
?>
|
||||
<label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo $title_placeholder; ?></label>
|
||||
<input type="text" name="post_title" size="30" value="<?php echo esc_attr( $post->post_title ); ?>" id="title" spellcheck="true" autocomplete="off" />
|
||||
</div>
|
||||
<?php
|
||||
//do_action( 'edit_form_before_permalink', $post );
|
||||
?>
|
||||
<div class="inside">
|
||||
<?php
|
||||
$viewable = is_post_type_viewable( $post_type_object );
|
||||
|
||||
if ( $viewable ) :
|
||||
$sample_permalink_html = $post_type_object->public ? get_sample_permalink_html( $post->ID ) : '';
|
||||
|
||||
// As of 4.4, the Get Shortlink button is hidden by default.
|
||||
if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) {
|
||||
$shortlink = wp_get_shortlink( $post->ID, 'post' );
|
||||
|
||||
if ( ! empty( $shortlink ) && $shortlink !== $permalink && home_url( '?page_id=' . $post->ID ) !== $permalink ) {
|
||||
$sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" />' .
|
||||
'<button type="button" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val());">' .
|
||||
__( 'Get Shortlink' ) .
|
||||
'</button>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $post_type_object->public
|
||||
&& ! ( 'pending' === get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) )
|
||||
) {
|
||||
$has_sample_permalink = $sample_permalink_html && 'auto-draft' !== $post->post_status;
|
||||
?>
|
||||
<div id="edit-slug-box" class="hide-if-no-js">
|
||||
<?php
|
||||
if ( $has_sample_permalink ) {
|
||||
echo $sample_permalink_html;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
|
||||
?>
|
||||
</div><!-- /titlediv -->
|
||||
<?php
|
||||
}
|
||||
|
||||
// Header body and footer code
|
||||
function pagelayer_post_hf_code(){
|
||||
global $post_type, $post_type_object, $post, $wp_meta_boxes, $current_screen, $user_ID, $post_ID;
|
||||
|
||||
?>
|
||||
<div class="pagelayer-modal-header">
|
||||
<h2><?php _e('Header, Body and Footer Code') ?></h2>
|
||||
</div>
|
||||
<div class="pagelayer-modal-body">
|
||||
<div class="pagelayer-inner-body">
|
||||
<p> <?php _e('You can add custom code like HTML, JavaScript, CSS etc. for the current post.') ?> </p>
|
||||
|
||||
<!-- Header Code-->
|
||||
<label class="pagelayer-block"><?php _e('Header Code'); ?> :- </label>
|
||||
<textarea name="pagelayer_header_code" placeholder="Enter your code to add in header" rows="10" class="pagelayer-textarea"><?php echo get_post_meta( $post_ID, 'pagelayer_header_code', true ); ?></textarea>
|
||||
<p> <?php echo __('This code will be printed in <code><head></code> Section.') ?> </p>
|
||||
|
||||
<!-- Body Open Code-->
|
||||
<label class="pagelayer-block"><?php _e('Body Open Code'); ?> :- </label>
|
||||
<textarea name="pagelayer_body_open_code" placeholder="Enter your code to add in body open" rows="10" class="pagelayer-textarea"><?php echo get_post_meta( $post_ID, 'pagelayer_body_open_code', true ); ?></textarea>
|
||||
<p> <?php echo __('This code will be printed begning of the <code><body></code> Section.') ?> </p>
|
||||
|
||||
<!-- Header Code-->
|
||||
<label class="pagelayer-block"><?php _e('Footer Code'); ?> :- </label>
|
||||
<textarea name="pagelayer_footer_code" placeholder="Enter your code to add in Footer" rows="10" class="pagelayer-textarea"><?php echo get_post_meta( $post_ID, 'pagelayer_footer_code', true ); ?></textarea>
|
||||
<p> <?php echo __('This code will be printed before closing the <code></body></code> Section.') ?> </p>
|
||||
</div>
|
||||
<div class="pagelayer-inner-footer">
|
||||
<input type="submit" class="pagelayer-save-btn" name="pagelayer_submit" value="<?php _e('Save Codes'); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
213
backup/wp/wp-content/plugins/pagelayer/main/replace-media.php
Normal file
213
backup/wp/wp-content/plugins/pagelayer/main/replace-media.php
Normal file
@@ -0,0 +1,213 @@
|
||||
<?php
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//===========================================================
|
||||
// template.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_VERSION')) {
|
||||
exit('Hacking Attempt !');
|
||||
}
|
||||
|
||||
//function is called first to select the route
|
||||
function pagelayer_replace_page(){
|
||||
|
||||
global $pl_error;
|
||||
|
||||
if(!current_user_can('upload_files')){
|
||||
wp_die(esc_html__('You do not have permission to upload files.', 'pagelayer'));
|
||||
}
|
||||
|
||||
$post_id = (int) $_GET['id'];
|
||||
|
||||
if(empty($post_id)){
|
||||
wp_die(esc_html__('ID not found .', 'pagelayer'));
|
||||
}
|
||||
|
||||
// Load the attachment
|
||||
$post = get_post($post_id);
|
||||
|
||||
if(empty($post) || is_wp_error($post)){
|
||||
wp_die(esc_html__('ID not found .', 'pagelayer'));
|
||||
}
|
||||
|
||||
// Process the POST !
|
||||
if(isset($_FILES['userfile'])){
|
||||
|
||||
if(!check_admin_referer()){
|
||||
wp_die('Invalid Nonce');
|
||||
}
|
||||
|
||||
/** Check if file is uploaded properly **/
|
||||
if(!is_uploaded_file($_FILES['userfile']['tmp_name'])){
|
||||
$pl_error['upload_error'] = __('No file was uploaded ! Please try again.');
|
||||
pagelayer_media_replace_theme();
|
||||
return;
|
||||
}
|
||||
|
||||
if(isset($_FILES['userfile']['error']) && $_FILES['userfile']['error'] > 0){
|
||||
$pl_error['upload_error'] = __('There was some error uploading the file ! Please try again.');
|
||||
pagelayer_media_replace_theme();
|
||||
return;
|
||||
}
|
||||
|
||||
$filedata = wp_check_filetype_and_ext($_FILES['userfile']['tmp_name'], $_FILES['userfile']['name']);
|
||||
|
||||
if ($filedata['ext'] == false){
|
||||
$pl_error['ext_error'] = __('The File type could not be determined. Please upload a permitted file type.');
|
||||
pagelayer_media_replace_theme();
|
||||
return;
|
||||
}
|
||||
|
||||
$result = pagelayer_replace_attachment($_FILES['userfile']['tmp_name'], $post_id, $err);
|
||||
|
||||
if(empty($result)){
|
||||
$pl_error['replace_error'] = $err;
|
||||
pagelayer_media_replace_theme();
|
||||
return;
|
||||
}
|
||||
|
||||
$redirect_success = admin_url('post.php');
|
||||
$redirect_success = add_query_arg(array(
|
||||
'action' => 'edit',
|
||||
'post' => $post_id,
|
||||
), $redirect_success);
|
||||
|
||||
echo '<meta http-equiv="refresh" content="0;url='.$redirect_success.'" />';
|
||||
|
||||
}
|
||||
|
||||
// Show the theme
|
||||
pagelayer_media_replace_theme();
|
||||
|
||||
}
|
||||
|
||||
// Theme of the page
|
||||
function pagelayer_media_replace_theme(){
|
||||
|
||||
global $pl_error;
|
||||
|
||||
pagelayer_report_error($pl_error);echo '<br />';
|
||||
|
||||
$id = (int) $_GET['id'];
|
||||
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h1><?php echo esc_html__("Replace Media File", 'pagelayer'); ?></h1>
|
||||
<form enctype="multipart/form-data" method="POST">
|
||||
<div class="editor-wrapper">
|
||||
<section class="image_chooser wrapper">
|
||||
<input type="hidden" name="ID" id="ID" value="<?php echo $id ?>" />
|
||||
<p><?php echo esc_html__("Choose a file to upload from your computer", 'pagelayer'); ?></p>
|
||||
<div class="drop-wrapper">
|
||||
<p><input type="file" name="userfile" id="userfile" /></p>
|
||||
<?php wp_nonce_field(); ?>
|
||||
</div>
|
||||
</section>
|
||||
<section class="form_controls wrapper">
|
||||
<input id="submit" type="submit" class="button button-primary" name="submit" value="<?php echo esc_attr__("Upload", 'pagelayer');?>" />
|
||||
</section>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
// Replace the uploaded media with the new one
|
||||
function pagelayer_replace_attachment($file, $post_id, &$error = ''){
|
||||
|
||||
if(function_exists('wp_get_original_image_path')){
|
||||
$targetFile = wp_get_original_image_path($post_id);
|
||||
}else{
|
||||
$targetFile = trim(get_attached_file($post_id, apply_filters( 'pagelayer_unfiltered_get_attached_file', true )));
|
||||
}
|
||||
|
||||
$fileparts = pathinfo($targetFile);
|
||||
$filePath = isset($fileparts['dirname']) ? trailingslashit($fileparts['dirname']) : '';
|
||||
$fileName = isset($fileparts['basename']) ? $fileparts['basename'] : '';
|
||||
$filedata = wp_check_filetype_and_ext($targetFile, $fileName);
|
||||
$fileMime = (isset($filedata['type'])) ? $filedata['type'] : false;
|
||||
|
||||
if(empty($targetFile)){
|
||||
return false;
|
||||
}
|
||||
|
||||
if(empty($filePath)){
|
||||
$error = 'No folder for the target found !';
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove the files of the original attachment
|
||||
pagelayer_remove_attahment_files($post_id);
|
||||
|
||||
$result_moved = move_uploaded_file($file, $targetFile);
|
||||
|
||||
if (false === $result_moved){
|
||||
$error = sprintf( esc_html__('The uploaded file could not be moved to %1$s. This is most likely an issue with permissions, or upload failed.', 'pagelayer'), $targetFile );
|
||||
return false;
|
||||
}
|
||||
|
||||
$permissions = fileperms($targetFile) & 0777;
|
||||
if ($permissions > 0){
|
||||
chmod( $targetFile, $permissions ); // restore permissions
|
||||
}
|
||||
|
||||
$updated = update_attached_file($post_id, $targetFile);
|
||||
|
||||
$target_url = wp_get_attachment_url($post_id);
|
||||
|
||||
// Run the filter, so other plugins can hook if needed.
|
||||
$filtered = apply_filters( 'wp_handle_upload', array(
|
||||
'file' => $targetFile,
|
||||
'url' => $target_url,
|
||||
'type' => $fileMime,
|
||||
), 'sideload');
|
||||
|
||||
// Check if file changed during filter. Set changed to attached file meta properly.
|
||||
if (isset($filtered['file']) && $filtered['file'] != $targetFile ){
|
||||
update_attached_file($post_id, $filtered['file']);
|
||||
}
|
||||
|
||||
$metadata = wp_generate_attachment_metadata($post_id, $targetFile);
|
||||
wp_update_attachment_metadata($post_id, $metadata);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
function pagelayer_remove_attahment_files($post_id){
|
||||
|
||||
$meta = wp_get_attachment_metadata( $post_id );
|
||||
|
||||
if (function_exists('wp_get_original_image_path')){ // WP 5.3+
|
||||
$fullfilepath = wp_get_original_image_path($post_id);
|
||||
}else{
|
||||
$fullFilePath = trim(get_attached_file($post_id, apply_filters( 'pagelayer_unfiltered_get_attached_file', true )));
|
||||
}
|
||||
|
||||
$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
|
||||
$file = $fullFilePath;
|
||||
$result = wp_delete_attachment_files($post_id, $meta, $backup_sizes, $file );
|
||||
|
||||
// If attached file is not the same path as file, this indicates a -scaled images is in play.
|
||||
$attached_file = get_attached_file($post_id);
|
||||
|
||||
if ($file !== $attached_file && file_exists($attached_file)){
|
||||
@unlink($attached_file);
|
||||
}
|
||||
}
|
||||
910
backup/wp/wp-content/plugins/pagelayer/main/settings.php
Normal file
910
backup/wp/wp-content/plugins/pagelayer/main/settings.php
Normal file
@@ -0,0 +1,910 @@
|
||||
<?php
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//===========================================================
|
||||
// settings.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_VERSION')) {
|
||||
exit('Hacking Attempt !');
|
||||
}
|
||||
|
||||
// The Pagelayer Settings Header
|
||||
function pagelayer_page_header($title = 'Pagelayer Editor'){
|
||||
|
||||
wp_enqueue_script( 'pagelayer-admin', PAGELAYER_JS.'/pagelayer-admin.js', array('jquery'), PAGELAYER_VERSION);
|
||||
wp_enqueue_style( 'pagelayer-admin', PAGELAYER_CSS.'/pagelayer-admin.css', array(), PAGELAYER_VERSION);
|
||||
|
||||
$promos = apply_filters('pagelayer_review_link', true);
|
||||
|
||||
echo '<div style="margin: 0px;">
|
||||
<div class="metabox-holder">
|
||||
<div class="postbox-container">
|
||||
<div class="wrap" style="margin-top:0px;">
|
||||
<h1 style="padding:0px"><!--This is to fix promo--></h1>
|
||||
<table cellpadding="2" cellspacing="1" width="100%" class="fixed" border="0">
|
||||
<tr>
|
||||
<td valign="top"><h1>'.$title.'</h1></td>
|
||||
'.($promos ? '<td align="right"><a target="_blank" class="button button-primary" href="https://wordpress.org/support/view/plugin-reviews/pagelayer">Review Pagelayer</a></td>' : '').'
|
||||
<td align="right" width="40"><a target="_blank" href="https://twitter.com/pagelayer"><img src="'.PAGELAYER_URL.'/images/twitter.png" /></a></td>
|
||||
<td align="right" width="40"><a target="_blank" href="https://www.facebook.com/pagelayer/"><img src="'.PAGELAYER_URL.'/images/facebook.png" /></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr />
|
||||
|
||||
<!--Main Table-->
|
||||
<table cellpadding="8" cellspacing="1" width="100%" class="fixed">
|
||||
<tr>
|
||||
<td valign="top">';
|
||||
|
||||
}
|
||||
|
||||
// The Pagelayer Settings footer
|
||||
function pagelayer_page_footer($no_twitter = 0){
|
||||
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
$promos = apply_filters('pagelayer_right_bar_promos', true);
|
||||
|
||||
if($promos){
|
||||
|
||||
echo '
|
||||
<td width="200" valign="top" id="pagelayer-right-bar">';
|
||||
|
||||
if(!defined('PAGELAYER_PREMIUM')){
|
||||
|
||||
echo '
|
||||
<div class="postbox" style="min-width:0px !important;">
|
||||
<h2 class="hndle ui-sortable-handle">
|
||||
<span><a target="_blank" href="'.PAGELAYER_PRO_URL.'"><img src="'.PAGELAYER_URL.'/images/pagelayer_product.png" width="100%" /></a></span>
|
||||
</h2>
|
||||
<div class="inside">
|
||||
<i>Upgrade to the premium version and get the following features </i>:<br>
|
||||
<ul class="pagelayer-right-ul">
|
||||
<li>60+ Premium Widgets</li>
|
||||
<li>16+ WooCommerce Widgets</li>
|
||||
<li>400+ Premium Sections</li>
|
||||
<li>Theme Builder</li>
|
||||
<li>WooCommerce Builder</li>
|
||||
<li>Theme Creator and Exporter</li>
|
||||
<li>Form Builder</li>
|
||||
<li>Popup Builder</li>
|
||||
<li>And many more ...</li>
|
||||
</ul>
|
||||
<center><a class="button button-primary" target="_blank" href="'.PAGELAYER_PRO_URL.'">Upgrade</a></center>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
<div class="postbox" style="min-width:0px !important;">
|
||||
<h2 class="hndle ui-sortable-handle">
|
||||
<span><a target="_blank" href="https://wpcentral.co/?from=pagelayer-plugin"><img src="'.PAGELAYER_URL.'/images/wpcentral_product.png" width="100%" /></a></span>
|
||||
</h2>
|
||||
<div class="inside">
|
||||
<i>Manage all your WordPress sites from <b>1 dashboard</b> </i>:<br>
|
||||
<ul class="pagelayer-right-ul">
|
||||
<li>1-click Admin Access</li>
|
||||
<li>Update WordPress</li>
|
||||
<li>Update Themes</li>
|
||||
<li>Update Plugins</li>
|
||||
<li>Backup your WordPress Site</li>
|
||||
<li>Plugins & Theme Management</li>
|
||||
<li>Post Management</li>
|
||||
<li>And many more ...</li>
|
||||
</ul>
|
||||
<center><a class="button button-primary" target="_blank" href="https://wpcentral.co/?from=pagelayer-plugin">Visit wpCentral</a></center>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</td>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</tr>
|
||||
</table>
|
||||
<br />';
|
||||
|
||||
if(!defined('SITEPAD')){
|
||||
|
||||
if(empty($no_twitter)){
|
||||
|
||||
echo '
|
||||
<div style="width:45%;background:#FFF;padding:15px; margin:auto">
|
||||
<b>Let your followers know that you use Pagelayer to build your website :</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 easily built my #WordPress #site using @pagelayer</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>';
|
||||
|
||||
}
|
||||
|
||||
echo '<hr />
|
||||
<a href="'.PAGELAYER_WWW_URL.'" target="_blank">Pagelayer</a> v'.PAGELAYER_VERSION.' You can report any bugs <a href="http://wordpress.org/support/plugin/pagelayer" target="_blank">here</a>.';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
}
|
||||
|
||||
function pagelayer_settings_page(){
|
||||
|
||||
$_REQUEST = wp_unslash($_REQUEST);
|
||||
$post_type = array();
|
||||
$exclude = [ 'attachment', 'pagelayer-template' ];
|
||||
$pt_objects = get_post_types(['public' => true,], 'objects');
|
||||
|
||||
foreach ( $pt_objects as $pt_slug => $type ) {
|
||||
|
||||
if ( in_array( $pt_slug, $exclude ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$post_type[$pt_slug] = $type->labels->name;
|
||||
}
|
||||
|
||||
$support_ept = get_option( 'pl_support_ept', ['post', 'page']);
|
||||
|
||||
$option_name = 'pl_gen_setting';
|
||||
$new_value = '';
|
||||
|
||||
// DO an admin referrer check
|
||||
if(!empty($_POST)){
|
||||
check_admin_referer('pagelayer-options');
|
||||
}
|
||||
|
||||
// We do a $_POST check and hence we are checking the POST var here as well
|
||||
// Everywhere down as well, $_POST should be used to save data
|
||||
|
||||
if(isset($_POST['pl_support_ept'])){
|
||||
|
||||
$pl_support_ept = $_REQUEST['pl_support_ept'];
|
||||
|
||||
foreach($pl_support_ept as $k => $v){
|
||||
if(empty($post_type[$v])){
|
||||
unset($pl_support_ept[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
// Update it
|
||||
update_option('pl_support_ept', $pl_support_ept );
|
||||
|
||||
$support_ept = get_option( 'pl_support_ept');
|
||||
|
||||
$done = 1;
|
||||
}
|
||||
|
||||
if(isset($_POST['pagelayer_icons_set'])){
|
||||
$pagelayer_icons_set = $_REQUEST['pagelayer_icons_set'];
|
||||
|
||||
// Update it
|
||||
update_option('pagelayer_icons_set', $pagelayer_icons_set);
|
||||
|
||||
$done = 1;
|
||||
}
|
||||
|
||||
$socials = ['pagelayer-facebook-url','pagelayer-twitter-url','pagelayer-instagram-url','pagelayer-linkedin-url','pagelayer-youtube-url','pagelayer-gplus-url','pagelayer-copyright','pagelayer-phone','pagelayer-address'];
|
||||
|
||||
foreach( $socials as $social ){
|
||||
if(isset($_POST[$social])){
|
||||
$url = $_REQUEST[$social];
|
||||
update_option($social, $url);
|
||||
$done = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST['pagelayer_cf_to_email'])){
|
||||
|
||||
$to_email = $_REQUEST['pagelayer_cf_to_email'];
|
||||
|
||||
update_option( 'pagelayer_cf_to_email', $to_email );
|
||||
|
||||
$done = 1;
|
||||
}
|
||||
|
||||
if(isset($_POST['pagelayer-gmaps-api-key'])){
|
||||
|
||||
$maps_id = $_REQUEST['pagelayer-gmaps-api-key'];
|
||||
|
||||
update_option( 'pagelayer-gmaps-api-key', $maps_id );
|
||||
|
||||
$done = 1;
|
||||
}
|
||||
|
||||
if(defined('PAGELAYER_PREMIUM')){
|
||||
|
||||
if(isset($_POST['pagelayer_cf_subject'])){
|
||||
|
||||
$subject = $_REQUEST['pagelayer_cf_subject'];
|
||||
|
||||
update_option('pagelayer_cf_subject', $subject, 'no');
|
||||
|
||||
$done = 1;
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['pagelayer_cf_headers'])){
|
||||
|
||||
$subject = $_REQUEST['pagelayer_cf_headers'];
|
||||
|
||||
update_option('pagelayer_cf_headers', $subject, 'no');
|
||||
|
||||
$done = 1;
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['pagelayer_cf_from_email'])){
|
||||
|
||||
$subject = $_REQUEST['pagelayer_cf_from_email'];
|
||||
|
||||
update_option('pagelayer_cf_from_email', $subject, 'no');
|
||||
|
||||
$done = 1;
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['pagelayer_cf_success'])){
|
||||
|
||||
$success = $_REQUEST['pagelayer_cf_success'];
|
||||
|
||||
update_option( 'pagelayer_cf_success', $success, 'no');
|
||||
|
||||
$done = 1;
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['pagelayer_cf_failed'])){
|
||||
|
||||
$failed = $_REQUEST['pagelayer_cf_failed'];
|
||||
|
||||
update_option( 'pagelayer_cf_failed', $failed, 'no');
|
||||
|
||||
$done = 1;
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['pagelayer_recaptcha_failed'])){
|
||||
|
||||
$failed = $_REQUEST['pagelayer_recaptcha_failed'];
|
||||
|
||||
update_option( 'pagelayer_recaptcha_failed', $failed, 'no');
|
||||
|
||||
$done = 1;
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['pagelayer_google_captcha'])){
|
||||
|
||||
$captcha = $_REQUEST['pagelayer_google_captcha'];
|
||||
|
||||
update_option( 'pagelayer_google_captcha', $captcha );
|
||||
|
||||
$done = 1;
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['pagelayer_google_captcha_secret'])){
|
||||
|
||||
$captcha_secret = $_REQUEST['pagelayer_google_captcha_secret'];
|
||||
|
||||
update_option( 'pagelayer_google_captcha_secret', $captcha_secret );
|
||||
|
||||
$done = 1;
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['pagelayer_google_captcha_lang'])){
|
||||
|
||||
$captcha_secret = $_REQUEST['pagelayer_google_captcha_lang'];
|
||||
|
||||
update_option( 'pagelayer_google_captcha_lang', $captcha_secret );
|
||||
|
||||
$done = 1;
|
||||
|
||||
}
|
||||
|
||||
// Facebook APP ID
|
||||
if(isset($_POST['pagelayer-fbapp-id'])){
|
||||
$fb_app_id = $_REQUEST['pagelayer-fbapp-id'];
|
||||
|
||||
if(preg_match('/\W/is', $fb_app_id)){
|
||||
$pl_error[] = 'The Facebook App ID is not correct';
|
||||
}else{
|
||||
|
||||
// Save it
|
||||
update_option( 'pagelayer-fbapp-id', $fb_app_id );
|
||||
|
||||
$done = 1;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// reCAPTCHA Langs
|
||||
$recap_lang[''] = 'Auto Detect';
|
||||
$recap_lang['ar'] = 'Arabic';
|
||||
$recap_lang['af'] = 'Afrikaans';
|
||||
$recap_lang['am'] = 'Amharic';
|
||||
$recap_lang['hy'] = 'Armenian';
|
||||
$recap_lang['az'] = 'Azerbaijani';
|
||||
$recap_lang['eu'] = 'Basque';
|
||||
$recap_lang['bn'] = 'Bengali';
|
||||
$recap_lang['bg'] = 'Bulgarian';
|
||||
$recap_lang['ca'] = 'Catalan';
|
||||
$recap_lang['zh-HK'] = 'Chinese (Hong Kong)';
|
||||
$recap_lang['zh-CN'] = 'Chinese (Simplified)';
|
||||
$recap_lang['zh-TW'] = 'Chinese (Traditional)';
|
||||
$recap_lang['hr'] = 'Croatian';
|
||||
$recap_lang['cs'] = 'Czech';
|
||||
$recap_lang['da'] = 'Danish';
|
||||
$recap_lang['nl'] = 'Dutch';
|
||||
$recap_lang['en-GB'] = 'English (UK)';
|
||||
$recap_lang['en'] = 'English (US)';
|
||||
$recap_lang['et'] = 'Estonian';
|
||||
$recap_lang['fil'] = 'Filipino';
|
||||
$recap_lang['fi'] = 'Finnish';
|
||||
$recap_lang['fr'] = 'French';
|
||||
$recap_lang['fr-CA'] = 'French (Canadian)';
|
||||
$recap_lang['gl'] = 'Galician';
|
||||
$recap_lang['ka'] = 'Georgian';
|
||||
$recap_lang['de'] = 'German';
|
||||
$recap_lang['de-AT'] = 'German (Austria)';
|
||||
$recap_lang['de-CH'] = 'German (Switzerland)';
|
||||
$recap_lang['el'] = 'Greek';
|
||||
$recap_lang['gu'] = 'Gujarati';
|
||||
$recap_lang['iw'] = 'Hebrew';
|
||||
$recap_lang['hi'] = 'Hindi';
|
||||
$recap_lang['hu'] = 'Hungarain';
|
||||
$recap_lang['is'] = 'Icelandic';
|
||||
$recap_lang['id'] = 'Indonesian';
|
||||
$recap_lang['it'] = 'Italian';
|
||||
$recap_lang['ja'] = 'Japanese';
|
||||
$recap_lang['kn'] = 'Kannada';
|
||||
$recap_lang['ko'] = 'Korean';
|
||||
$recap_lang['lo'] = 'Laothian';
|
||||
$recap_lang['lv'] = 'Latvian';
|
||||
$recap_lang['lt'] = 'Lithuanian';
|
||||
$recap_lang['ms'] = 'Malay';
|
||||
$recap_lang['ml'] = 'Malayalam';
|
||||
$recap_lang['mr'] = 'Marathi';
|
||||
$recap_lang['mn'] = 'Mongolian';
|
||||
$recap_lang['no'] = 'Norwegian';
|
||||
$recap_lang['fa'] = 'Persian';
|
||||
$recap_lang['pl'] = 'Polish';
|
||||
$recap_lang['pt'] = 'Portuguese';
|
||||
$recap_lang['pt-BR'] = 'Portuguese (Brazil)';
|
||||
$recap_lang['pt-PT'] = 'Portuguese (Portugal)';
|
||||
$recap_lang['ro'] = 'Romanian';
|
||||
$recap_lang['ru'] = 'Russian';
|
||||
$recap_lang['sr'] = 'Serbian';
|
||||
$recap_lang['si'] = 'Sinhalese';
|
||||
$recap_lang['sk'] = 'Slovak';
|
||||
$recap_lang['sl'] = 'Slovenian';
|
||||
$recap_lang['es'] = 'Spanish';
|
||||
$recap_lang['es-419'] = 'Spanish (Latin America)';
|
||||
$recap_lang['sw'] = 'Swahili';
|
||||
$recap_lang['sv'] = 'Swedish';
|
||||
$recap_lang['ta'] = 'Tamil';
|
||||
$recap_lang['te'] = 'Telugu';
|
||||
$recap_lang['th'] = 'Thai';
|
||||
$recap_lang['tr'] = 'Turkish';
|
||||
$recap_lang['uk'] = 'Ukrainian';
|
||||
$recap_lang['ur'] = 'Urdu';
|
||||
$recap_lang['vi'] = 'Vietnamese';
|
||||
$recap_lang['zu'] = 'Zulu';
|
||||
|
||||
pagelayer_page_header('Pagelayer Settings');
|
||||
|
||||
// Media Replace.
|
||||
if(isset($_POST['submit']) || isset($_POST['pagelayer_disable_media_replace'])){
|
||||
|
||||
$disable_media = empty($_REQUEST['pagelayer_disable_media_replace']) ? 0 : 1;
|
||||
|
||||
update_option( 'pagelayer_disable_media_replace', $disable_media );
|
||||
|
||||
$done = 1;
|
||||
|
||||
}
|
||||
|
||||
// Media Replace
|
||||
$media_replace = get_option( 'pagelayer_disable_media_replace');
|
||||
|
||||
// Clone Templates.
|
||||
if(isset($_POST['submit']) || isset($_POST['pagelayer_disable_clone'])){
|
||||
|
||||
$disable_clone = empty($_REQUEST['pagelayer_disable_clone']) ? 0 : 1;
|
||||
|
||||
update_option( 'pagelayer_disable_clone', $disable_clone );
|
||||
|
||||
$done = 1;
|
||||
|
||||
}
|
||||
|
||||
// Disable Clone
|
||||
$disable_clone = get_option('pagelayer_disable_clone');
|
||||
|
||||
// Dark Mode
|
||||
if(isset($_POST['submit']) || isset($_POST['pagelayer_enable_dark_mode'])){
|
||||
|
||||
$enable_dark_mode = empty($_REQUEST['pagelayer_enable_dark_mode']) ? 0 : 1;
|
||||
|
||||
update_option( 'pagelayer_enable_dark_mode', $enable_dark_mode );
|
||||
|
||||
$done = 1;
|
||||
|
||||
}
|
||||
|
||||
// Dark Mode
|
||||
$enable_dark_mode = get_option('pagelayer_enable_dark_mode');
|
||||
|
||||
// Enable JS/CSS Giver
|
||||
if(isset($_POST['submit']) || isset($_POST['pagelayer_enable_jscss_giver'])){
|
||||
$done = 1;
|
||||
$enable_jscss_giver = empty($_REQUEST['pagelayer_enable_jscss_giver']) ? -1 : 1;
|
||||
|
||||
update_option( 'pagelayer_enable_giver', $enable_jscss_giver );
|
||||
}
|
||||
|
||||
// Enable JS/CSS Giver
|
||||
$enable_jscss_giver = get_option('pagelayer_enable_giver');
|
||||
|
||||
if(defined('PAGELAYER_PREMIUM')){
|
||||
// Enable Google Font local giver
|
||||
if(isset($_POST['submit']) || isset($_POST['pagelayer_local_gfont'])){
|
||||
$done = 1;
|
||||
$enable_gfont_downloader = empty($_REQUEST['pagelayer_local_gfont']) ? -1 : 1;
|
||||
|
||||
update_option( 'pagelayer_local_gfont', $enable_gfont_downloader );
|
||||
}
|
||||
|
||||
// Enable Google Font Downloader
|
||||
$enable_gfont_downloader = get_option('pagelayer_local_gfont');
|
||||
}
|
||||
|
||||
// User roles to allow saving js content
|
||||
if(isset($_POST['pagelayer_js_permission'])){
|
||||
update_option( 'pagelayer_js_permission', array_filter($_POST['pagelayer_js_permission']) );
|
||||
}
|
||||
|
||||
$pagelayer_js_permission = get_option('pagelayer_js_permission');
|
||||
$pagelayer_js_permission = empty($pagelayer_js_permission) ? array() : $pagelayer_js_permission;
|
||||
|
||||
// Saved ?
|
||||
if(!empty($done)){
|
||||
echo '<div class="notice notice-success"><p>'. __('The settings were saved successfully', 'pagelayer'). '</p></div><br />';
|
||||
}
|
||||
|
||||
// Any errors ?
|
||||
if(!empty($pl_error)){
|
||||
pagelayer_report_error($pl_error);echo '<br />';
|
||||
}
|
||||
|
||||
?>
|
||||
<form class="pagelayer-setting-form" method="post" action="">
|
||||
<?php wp_nonce_field('pagelayer-options'); ?>
|
||||
<div class="tabs-wrapper">
|
||||
<h2 class="nav-tab-wrapper pagelayer-wrapper">
|
||||
<a href="#general" class="nav-tab"><?php _e('General');?></a>
|
||||
<a href="#icons" class="nav-tab "><?php _e('Enable Icons');?></a>
|
||||
<a href="#social" class="nav-tab"><?php _e('Information');?></a>
|
||||
<a href="#integration" class="nav-tab"><?php _e('Integrations');?></a>
|
||||
<?php if(defined('PAGELAYER_PREMIUM')){ ?>
|
||||
<a href="#contactform" class="nav-tab "><?php _e('Contact Form');?></a>
|
||||
<a href="#captcha" class="nav-tab "><?php _e('Google Captcha');?></a>
|
||||
<?php
|
||||
}
|
||||
if(!defined('SITEPAD')){
|
||||
echo '
|
||||
<a href="#support" class="nav-tab ">'.__('Support').'</a>
|
||||
<a href="#faq" class="nav-tab ">'.__('FAQ').'</a>';
|
||||
}
|
||||
?>
|
||||
</h2>
|
||||
|
||||
<div class="pagelayer-tab-panel" id="general">
|
||||
<table>
|
||||
<?php
|
||||
if(!defined('SITEPAD')){
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Editor Enables On');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<?php
|
||||
foreach($post_type as $type => $name){
|
||||
echo '<input type="checkbox" name="pl_support_ept[]" value="'.$type.'" '. (in_array($type, $support_ept) ? "checked" : "") .'/>'.$name.'</br>';
|
||||
}
|
||||
?>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Media Replace');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<input type="checkbox" name="pagelayer_disable_media_replace" <?php echo (!empty( $media_replace) ? ' checked' : '');?> /><?php _e('Disable Media Replace') ?></br>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Disable Clone');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<input type="checkbox" name="pagelayer_disable_clone" <?php echo (!empty( $disable_clone) ? ' checked' : '');?> /><?php _e('Disable Clone') ?></br>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Dark Mode');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<input type="checkbox" name="pagelayer_enable_dark_mode" <?php echo (!empty($enable_dark_mode) ? 'checked' : '');?> /><?php _e('Enable Dark Mode') ?></br>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Enable JS/CSS Giver');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<input type="checkbox" name="pagelayer_enable_jscss_giver" <?php echo ((!empty($enable_jscss_giver) && $enable_jscss_giver == 1) ? 'checked' : '');?> /><?php _e('Enable JS/CSS Giver') ?></br>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if(defined('PAGELAYER_PREMIUM')){
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Local Google Fonts');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<input type="checkbox" name="pagelayer_local_gfont" <?php echo ((!empty($enable_gfont_downloader) && $enable_gfont_downloader == 1) ? 'checked' : '');?> /><?php _e('Enable Google Fonts load locally ') ?></br>
|
||||
<p><?php _e('If you check this option Google Fonts download on your server and load from your server.') ?></p>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<th scope="row" style="vertical-align: top"><?php _e('JS Content Permissions');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<?php
|
||||
$user_roles = wp_roles()->get_names();
|
||||
echo '<label for="pagelayer_js_permission">Select User Roles:</label><br>';
|
||||
echo '<select id="pagelayer_js_permission" name="pagelayer_js_permission[]" multiple="multiple">';
|
||||
|
||||
foreach ($user_roles as $role => $role_name) {
|
||||
if ($role == 'administrator') {
|
||||
echo '<option value="" >'. __('Default') .'</option>';
|
||||
continue;
|
||||
}
|
||||
|
||||
echo '<option value="' . $role . '" ' . (in_array($role, $pagelayer_js_permission) ? 'selected' : '') . '>' . $role_name . '</option>';
|
||||
}
|
||||
|
||||
echo '</select>';
|
||||
?>
|
||||
<br>
|
||||
<p><b><?php _e('Security Note:'); ?></b> <?php _e('For security reasons, we strongly advise against granting this permission to user roles other than administrators. Adding JavaScript content can lead to Cross Site Scripting and can introduce severe security vulnerabilities to your website, putting it at risk of attacks. Only administrators should have access to this feature to ensure the safety and integrity of your site.') ?></p>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pagelayer-tab-panel" id="icons">
|
||||
<table>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Enable Icons');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<?php
|
||||
$pagelayer_icons = get_option( 'pagelayer_icons_set');
|
||||
if(empty($pagelayer_icons)){
|
||||
$pagelayer_icons = array();
|
||||
}
|
||||
?>
|
||||
<input type="checkbox" name="pagelayer_icons_set[]" value="font-awesome5" <?php if(in_array('font-awesome5', $pagelayer_icons) || !get_option( 'pagelayer_icons_set')){echo ' checked';}?> /><?php _e('font-awesome5'); ?></br>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pagelayer-tab-panel" id="social">
|
||||
<div class="pagelayer-settings-info" style="display:flex;">
|
||||
<div style="flex:1">
|
||||
<div class="pagelayer-title">
|
||||
<h2><?php _e('Address and Phone Number');?></h2>
|
||||
</div>
|
||||
<table>
|
||||
<tr>
|
||||
<th><?php _e('Address');?></th>
|
||||
<td><textarea name="pagelayer-address"><?php echo pagelayer_get_option('pagelayer-address');?></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php _e('Phone Number');?></th>
|
||||
<td><input type="tel" name="pagelayer-phone" <?php echo 'value="'.esc_html(pagelayer_get_option('pagelayer-phone')).'"';?> /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Contact Email');?></th>
|
||||
<td>
|
||||
<?php if(defined('PAGELAYER_PREMIUM')){
|
||||
echo '<p>'.__('You can change your contact email<br> from the Contact Form Settings.').'</p>';
|
||||
}else{
|
||||
?>
|
||||
<label>
|
||||
<input name="pagelayer_cf_to_email" type="email" placeholder="email@domain.com" <?php if(get_option('pagelayer_cf_to_email')){
|
||||
echo 'value="'.esc_html(get_option('pagelayer_cf_to_email')).'"';
|
||||
}?>/>
|
||||
</label>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<?php if(defined('PAGELAYER_PREMIUM')){ ?>
|
||||
<div class="pagelayer-title">
|
||||
<h2><?php _e('Copyright');?></h2>
|
||||
</div>
|
||||
<table>
|
||||
<tr>
|
||||
<th><?php _e('Copyright Text');?></th>
|
||||
<td><textarea name="pagelayer-copyright"><?php echo pagelayer_get_option('pagelayer-copyright'); ?></textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php if(defined('PAGELAYER_PREMIUM')){ ?>
|
||||
<div style="flex:1">
|
||||
<div class="pagelayer-title">
|
||||
<h2><?php _e('Social Profile URLs');?></h2>
|
||||
</div>
|
||||
<table>
|
||||
<tr>
|
||||
<th><?php _e('Facebook');?></th>
|
||||
<td><input type="text" name="pagelayer-facebook-url" <?php echo 'value="'.esc_url(get_option('pagelayer-facebook-url')).'"';?>/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php _e('Twitter');?></th>
|
||||
<td><input type="text" name="pagelayer-twitter-url" <?php echo 'value="'.esc_url(get_option('pagelayer-twitter-url')).'"';?>/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php _e('Instagram');?></th>
|
||||
<td><input type="text" name="pagelayer-instagram-url" <?php echo 'value="'.esc_url(get_option('pagelayer-instagram-url')).'"'; ?>/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php _e('LinkedIn');?></th>
|
||||
<td><input type="text" name="pagelayer-linkedin-url" <?php echo 'value="'.esc_url(get_option('pagelayer-linkedin-url')).'"'; ?>/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php _e('YouTube');?></th>
|
||||
<td><input type="text" name="pagelayer-youtube-url" <?php echo 'value="'.esc_url(get_option('pagelayer-youtube-url')).'"'; ?>/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php _e('Google+');?></th>
|
||||
<td><input type="text" name="pagelayer-gplus-url" <?php echo 'value="'.esc_url(get_option('pagelayer-gplus-url')).'"'; ?>/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pagelayer-tab-panel" id="integration">
|
||||
<?php if(defined('PAGELAYER_PREMIUM')){ ?>
|
||||
<div style="margin:50px auto">
|
||||
<div class="pagelayer-title">
|
||||
<h2><?php _e('Facebook SDK Details');?></h2>
|
||||
</div>
|
||||
<table>
|
||||
<tr>
|
||||
<th><?php _e('App ID');?></th>
|
||||
<td><input type="text" name="pagelayer-fbapp-id" class="pagelayer-app-id" <?php if(get_option('pagelayer-fbapp-id')){
|
||||
echo 'value="'.get_option('pagelayer-fbapp-id').'"';
|
||||
}?>/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<hr>
|
||||
<?php } ?>
|
||||
<div style="margin:50px auto">
|
||||
<div class="pagelayer-title">
|
||||
<h2><?php _e('Google Maps API Key'); ?></h2>
|
||||
</div>
|
||||
<table>
|
||||
<tr>
|
||||
<th style="vertical-align:top"><?php _e('Project ID');?></th>
|
||||
<td><input type="text" name="pagelayer-gmaps-api-key" class="pagelayer-gmaps-api-key" <?php if(get_option('pagelayer-gmaps-api-key')){
|
||||
echo 'value="'.get_option('pagelayer-gmaps-api-key').'"';
|
||||
}?>/><p><?php _e('Insert google maps API key. <a href="https://pagelayer.com/docs/pagelayer-widgets/google-maps/"><strong>CLICK HERE</strong></a> to get help in getting API key.') ?></p></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php if(defined('PAGELAYER_PREMIUM')){ ?>
|
||||
<div class="pagelayer-tab-panel pagelayer-cf" id="contactform">
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan="2" style="align:middle;">
|
||||
<p><?php _e('You can use a field name with a prefix $ to print your field value e.g. if the field name is <b>fieldname</b> then use the variable <b>$fieldname</b>');?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row" width="50%">
|
||||
<?php echo '<b>'.__('To Email').' :</b><br><p>'.__('You can use comma seperated values for multiple emails').'</p>';?>
|
||||
</td>
|
||||
<td>
|
||||
<label>
|
||||
<input name="pagelayer_cf_to_email" type="text" placeholder="email@domain.com" <?php if(get_option('pagelayer_cf_to_email')){
|
||||
echo 'value="'.esc_html(get_option('pagelayer_cf_to_email')).'"';
|
||||
}?>/>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('From Email');?>:</th>
|
||||
<td>
|
||||
<label>
|
||||
<input name="pagelayer_cf_from_email" type="text" placeholder="My Site <email@domain.com>" <?php
|
||||
if(get_option('pagelayer_cf_from_email')){
|
||||
echo 'value="'.esc_html(get_option('pagelayer_cf_from_email')).'"';
|
||||
}?>/>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Subject');?>:</th>
|
||||
<td>
|
||||
<label>
|
||||
<input name="pagelayer_cf_subject" type="text" placeholder="Subject" <?php if(get_option('pagelayer_cf_subject')){
|
||||
echo 'value="'.esc_html(get_option('pagelayer_cf_subject')).'"';
|
||||
}?> />
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Additional Headers');?>: </th>
|
||||
<td>
|
||||
<label>
|
||||
<textarea rows="3" name="pagelayer_cf_headers"><?php
|
||||
if(get_option('pagelayer_cf_headers')){
|
||||
echo get_option('pagelayer_cf_headers');
|
||||
} ?></textarea>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><b><?php echo __('Messages').' : </b><p>'.__('You can edit messages used for information of your form here.');?></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Success Message');?> :</th>
|
||||
<td>
|
||||
<label>
|
||||
<input name="pagelayer_cf_success" type="text" placeholder="Success" <?php if(get_option('pagelayer_cf_success')){
|
||||
echo 'value="'.esc_html(get_option('pagelayer_cf_success')).'"';
|
||||
}?> />
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Failed Message');?> :</th>
|
||||
<td>
|
||||
<label>
|
||||
<input name="pagelayer_cf_failed" type="text" placeholder="Failed" <?php if(get_option('pagelayer_cf_failed')){
|
||||
echo 'value="'.esc_html(get_option('pagelayer_cf_failed')).'"';
|
||||
}?> />
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('reCaptcha Failed Message');?> : </th>
|
||||
<td>
|
||||
<label>
|
||||
<input name="pagelayer_recaptcha_failed" type="text" placeholder="The CAPTCHA verification failed. Please try again." <?php
|
||||
echo 'value="'.esc_html(get_option('pagelayer_recaptcha_failed', __pl('cap_ver_fail'))).'"';
|
||||
?> />
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pagelayer-tab-panel" id="captcha">
|
||||
<table>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('reCaptcha Site Key');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<input name="pagelayer_google_captcha" type="text" placeholder="Site key" <?php if(get_option('pagelayer_google_captcha')){
|
||||
echo 'value="'.esc_html(get_option('pagelayer_google_captcha')).'"';
|
||||
}?> />
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('reCaptcha Secret Key');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<input name="pagelayer_google_captcha_secret" type="text" placeholder="Secret key" <?php if(get_option('pagelayer_google_captcha_secret')){
|
||||
echo 'value="'.esc_html(get_option('pagelayer_google_captcha_secret')).'"';
|
||||
}?> />
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('reCaptcha Language');?> </th>
|
||||
<td>
|
||||
<label>
|
||||
<select name="pagelayer_google_captcha_lang">
|
||||
<?php
|
||||
foreach($recap_lang as $k => $v){
|
||||
echo '<option '.( get_option('pagelayer_google_captcha_lang', '') == $k ? 'selected="selected"' : '').' value="'.$k.'">'.$v.'</value>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="pagelayer-tab-panel" id="support">
|
||||
<h2><?php _e('Support');?></h2>
|
||||
<h3><?php _e('You can contact the Pagelayer Team via email. Our email address is <a href="mailto:support@pagelayer.com">support@pagelayer.com</a>. We will get back to you as soon as possible!');?></h3>
|
||||
</div>
|
||||
<div class="pagelayer-tab-panel" id="faq">
|
||||
<h2><?php _e('FAQ');?></h2>
|
||||
<div class="pagelayer-acc-wrapper">
|
||||
<span class="nav-tab pagelayer-acc-tab"><?php _e('1: Why choose us');?></span>
|
||||
<div class="pagelayer-acc-panel">
|
||||
<p><?php _e('Pagelayer is best live editor and easy to use and we will keep improving it !');?></P>
|
||||
</div>
|
||||
|
||||
<span class="nav-tab pagelayer-acc-tab"><?php _e('2: Support');?></span>
|
||||
<div class="pagelayer-acc-panel">
|
||||
<p><?php _e('You can contact the PageLayer Group via email. Our email address is <a href="mailto:support@pagelayer.com">support@pagelayer.com</a>. We will get back to you as soon as possible!');?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
<input type="submit" name="submit" class="button button-primary" value="Save Changes">
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
pagelayer_page_footer();
|
||||
|
||||
}
|
||||
1824
backup/wp/wp-content/plugins/pagelayer/main/shortcode_functions.php
Normal file
1824
backup/wp/wp-content/plugins/pagelayer/main/shortcode_functions.php
Normal file
File diff suppressed because it is too large
Load Diff
11384
backup/wp/wp-content/plugins/pagelayer/main/shortcodes.php
Normal file
11384
backup/wp/wp-content/plugins/pagelayer/main/shortcodes.php
Normal file
File diff suppressed because it is too large
Load Diff
1453
backup/wp/wp-content/plugins/pagelayer/main/template.php
Normal file
1453
backup/wp/wp-content/plugins/pagelayer/main/template.php
Normal file
File diff suppressed because it is too large
Load Diff
736
backup/wp/wp-content/plugins/pagelayer/main/website.php
Normal file
736
backup/wp/wp-content/plugins/pagelayer/main/website.php
Normal file
@@ -0,0 +1,736 @@
|
||||
<?php
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//===========================================================
|
||||
// license.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_VERSION')) {
|
||||
exit('Hacking Attempt !');
|
||||
}
|
||||
|
||||
include_once(PAGELAYER_DIR.'/main/settings.php');
|
||||
|
||||
function pagelayer_clear_empty_r(&$r){
|
||||
|
||||
foreach($r as $a => $b){
|
||||
if(empty($b)){
|
||||
unset($r[$a]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(is_array($b)){
|
||||
pagelayer_clear_empty_r($r[$a]);
|
||||
}
|
||||
}
|
||||
|
||||
return $r;
|
||||
|
||||
}
|
||||
|
||||
// The License Page
|
||||
function pagelayer_website_settings(){
|
||||
|
||||
global $pagelayer, $pl_error;
|
||||
|
||||
pagelayer_load_font_options();
|
||||
|
||||
if(!empty($_POST)){
|
||||
check_admin_referer('pagelayer-options');
|
||||
}
|
||||
|
||||
if(isset($_POST['submit'])){
|
||||
|
||||
foreach($pagelayer->css_settings as $set => $params){
|
||||
|
||||
foreach($pagelayer->screens as $sk => $sv){
|
||||
|
||||
$suffix = (!empty($sv) ? '_'.$sv : '');
|
||||
$key = $set.$suffix;
|
||||
$setting = empty($params['key']) ? 'pagelayer_'.$set.'_css' : $params['key'];
|
||||
|
||||
if(isset($_POST[$key])){
|
||||
|
||||
foreach($_POST[$key] as $k => $v){
|
||||
if($v == 'Default' || empty($v)){
|
||||
unset($_POST[$key][$k]);
|
||||
}
|
||||
|
||||
// For sidebar, width default should not be saved
|
||||
if($set == 'sidebar' && $k == 'width' && $v == 20){
|
||||
unset($_POST[$key][$k]);
|
||||
}
|
||||
}
|
||||
|
||||
// Padding and Margins or any array based setting
|
||||
if(!empty($_POST[$key]) && is_array($_POST[$key])){
|
||||
pagelayer_clear_empty_r($_POST[$key]);
|
||||
//pagelayer_print($_POST[$key]);
|
||||
}
|
||||
|
||||
// Are we to save ?
|
||||
if(!empty($_POST[$key])){
|
||||
update_option($setting.$suffix, (!empty($_POST[$key]) ? $_POST[$key] : []));
|
||||
}else{
|
||||
delete_option($setting.$suffix);
|
||||
}
|
||||
|
||||
}else{
|
||||
delete_option($setting.$suffix);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Blank the old color values
|
||||
delete_option('pagelayer_color');
|
||||
|
||||
// Blank the old Body font
|
||||
if(!empty($_POST['body']['font-family'])){
|
||||
update_option('pagelayer_body_font', '');
|
||||
}
|
||||
|
||||
//pagelayer_print($_POST);
|
||||
|
||||
// Content Width
|
||||
if(isset($_REQUEST['pagelayer_content_width'])){
|
||||
update_option( 'pagelayer_content_width', $_REQUEST['pagelayer_content_width'] );
|
||||
}
|
||||
|
||||
// Tablet breakpoint
|
||||
if(isset($_REQUEST['pagelayer_tablet_breakpoint'])){
|
||||
update_option( 'pagelayer_tablet_breakpoint', $_REQUEST['pagelayer_tablet_breakpoint'] );
|
||||
}
|
||||
|
||||
// Mobile breakpoint
|
||||
if(isset($_REQUEST['pagelayer_mobile_breakpoint'])){
|
||||
update_option( 'pagelayer_mobile_breakpoint', $_REQUEST['pagelayer_mobile_breakpoint'] );
|
||||
}
|
||||
|
||||
// Widget Space
|
||||
if(isset($_REQUEST['pagelayer_between_widgets'])){
|
||||
update_option( 'pagelayer_between_widgets', $_REQUEST['pagelayer_between_widgets'] );
|
||||
}
|
||||
|
||||
if(defined('PAGELAYER_PREMIUM')){
|
||||
|
||||
// Save Header code
|
||||
if(isset($_REQUEST['pagelayer_header_code'])){
|
||||
$header_code = wp_unslash($_REQUEST['pagelayer_header_code']);
|
||||
if(!pagelayer_user_can_add_js_content()){
|
||||
$header_code = sanitize_textarea_field($header_code);
|
||||
}
|
||||
|
||||
update_option( 'pagelayer_header_code', $header_code);
|
||||
}else{
|
||||
delete_option('pagelayer_header_code');
|
||||
}
|
||||
|
||||
// Save Body open code
|
||||
if(isset($_REQUEST['pagelayer_body_open_code'])){
|
||||
$body_code = wp_unslash($_REQUEST['pagelayer_body_open_code']);
|
||||
if(!pagelayer_user_can_add_js_content()){
|
||||
$body_code = sanitize_textarea_field($body_code);
|
||||
}
|
||||
|
||||
update_option( 'pagelayer_body_open_code', $body_code);
|
||||
}else{
|
||||
delete_option('pagelayer_body_open_code');
|
||||
}
|
||||
|
||||
// Save Footer code
|
||||
if(isset($_REQUEST['pagelayer_footer_code'])){
|
||||
$footer_code = wp_unslash($_REQUEST['pagelayer_footer_code']);
|
||||
if(!pagelayer_user_can_add_js_content()){
|
||||
$footer_code = sanitize_textarea_field($footer_code);
|
||||
}
|
||||
|
||||
update_option( 'pagelayer_footer_code', $footer_code);
|
||||
}else{
|
||||
delete_option('pagelayer_footer_code');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$GLOBALS['pl_saved'] = true;
|
||||
|
||||
}
|
||||
|
||||
pagelayer_website_settings_T();
|
||||
|
||||
}
|
||||
|
||||
// The License Page - THEME
|
||||
function pagelayer_website_settings_T(){
|
||||
|
||||
global $pagelayer, $pl_error;
|
||||
|
||||
pagelayer_page_header('Pagelayer Website Settings');
|
||||
|
||||
// Saved ?
|
||||
if(!empty($GLOBALS['pl_saved'])){
|
||||
echo '<div class="notice notice-success"><p>'. __('The settings were saved successfully', 'pagelayer'). '</p></div><br />';
|
||||
}
|
||||
|
||||
// Any errors ?
|
||||
if(!empty($pl_error)){
|
||||
pagelayer_report_error($pl_error);echo '<br />';
|
||||
}
|
||||
|
||||
// Reduce load
|
||||
echo '<select id="skeleton_of_fonts" style="display:none">';
|
||||
foreach($pagelayer->fonts as $subType => $fontType){
|
||||
if($subType != 'default'){
|
||||
echo '<optgroup style="text-transform: capitalize" label="'.$subType.'">';
|
||||
}
|
||||
foreach($fontType as $k => $font){
|
||||
echo '<option value="'.esc_html(is_numeric($k) ? $font : $k).'">'. esc_html(empty($font) ? 'Default': $font) .'</option>';
|
||||
}
|
||||
}
|
||||
echo '</select>';
|
||||
|
||||
?>
|
||||
|
||||
<form class="pagelayer-setting-form" method="post" action="">
|
||||
<?php wp_nonce_field('pagelayer-options'); ?>
|
||||
<script src="https://unpkg.com/vanilla-picker@2.10.1/dist/vanilla-picker.min.js"></script>
|
||||
<div class="tabs-wrapper">
|
||||
<h2 class="nav-tab-wrapper pagelayer-wrapper">
|
||||
<a href="#headings" class="nav-tab "><?php echo __pl('elem_styles');?></a>
|
||||
<a href="#website_container" class="nav-tab"><?php echo __pl('container');?></a>
|
||||
<!--<a href="#pagelayer-sidebar" class="nav-tab">Sidebar</a>-->
|
||||
<a href="#hf" class="nav-tab "><?php echo __pl('hf');?></a>
|
||||
</h2>
|
||||
|
||||
<div class="pagelayer-tab-panel" id="headings">
|
||||
|
||||
<?php
|
||||
|
||||
echo '<div style="display:inline-block;vertical-align: top;">
|
||||
<ul class="nav-tab-wrapper pagelayer-wrapper pagelayer-heading-wrapper">';
|
||||
|
||||
foreach($pagelayer->css_settings as $k => $v){
|
||||
echo '<li><a href="#tab_'.$k.'" class="nav-tab pagelayer-heading-tab" tab-class="pagelayer-heading-tab-panel">'.$v['name'].' Style</a></li>';
|
||||
}
|
||||
|
||||
echo '</ul>
|
||||
</div>
|
||||
|
||||
<div style="display:inline-block;vertical-align: top;">';
|
||||
|
||||
foreach($pagelayer->css_settings as $k => $v){
|
||||
|
||||
echo '<div class="pagelayer-heading-tab-panel" id="tab_'.$k.'">
|
||||
<center><h2>'.$v['name'].' Style</h2></center>
|
||||
|
||||
<div style="vertical-align: top;">
|
||||
<ul class="nav-tab-wrapper pagelayer-wrapper pagelayer-styles-screens">';
|
||||
|
||||
foreach($pagelayer->screens as $sk => $sv){
|
||||
echo '<li><a href="#tab_'.$k.'_'.$sk.'" class="nav-tab pagelayer-styles-screen-tab" tab-class="pagelayer-styles-screen-panel">'.ucfirst($sk).'</a></li>';
|
||||
}
|
||||
|
||||
echo '</ul>
|
||||
</div>';
|
||||
|
||||
foreach($pagelayer->screens as $sk => $sv){
|
||||
echo '<div class="pagelayer-styles-screen-panel" id="tab_'.$k.'_'.$sk.'">';
|
||||
pagelayer_website_font_settings($k.(!empty($sv) ? '_'.$sv : ''));
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="pagelayer-tab-panel" id="website_container">
|
||||
|
||||
<table>
|
||||
|
||||
<tr>
|
||||
<th><?php echo __('Content Width') ?></th>
|
||||
<td>
|
||||
<input name="pagelayer_content_width" type="number" step="1" min="320" max="5000" placeholder="1170" <?php if(get_option('pagelayer_content_width')){
|
||||
echo 'value="'.get_option('pagelayer_content_width').'"';
|
||||
}?>>
|
||||
<p><?php echo __('Set the custom width of the content area. The default width set is 1170px.') ?></p>
|
||||
</td>
|
||||
<tr>
|
||||
<tr>
|
||||
<th><?php echo __('Tablet Breakpoint') ?></th>
|
||||
<td>
|
||||
<input name="pagelayer_tablet_breakpoint" type="number" step="1" min="320" max="5000" placeholder="780" <?php if(get_option('pagelayer_tablet_breakpoint')){
|
||||
echo 'value="'.get_option('pagelayer_tablet_breakpoint').'"';
|
||||
}?>>
|
||||
<p><?php echo __('Set the breakpoint for tablet devices. The default breakpoint for tablet layout is 768px.') ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo __('Mobile Breakpoint') ?></th>
|
||||
<td>
|
||||
<input name="pagelayer_mobile_breakpoint" type="number" step="1" min="320" max="5000" placeholder="360" <?php if(get_option('pagelayer_mobile_breakpoint')){
|
||||
echo 'value="'.get_option('pagelayer_mobile_breakpoint').'"';
|
||||
}?>>
|
||||
<p><?php echo __('Set the breakpoint for mobile devices. The default breakpoint for mobile layout is 360px.') ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo __('Space Between Widgets') ?></th>
|
||||
<td>
|
||||
<input name="pagelayer_between_widgets" type="number" step="1" min="0" max="500" placeholder="15" <?php if(get_option('pagelayer_between_widgets')){
|
||||
echo 'value="'.get_option('pagelayer_between_widgets').'"';
|
||||
}?>>
|
||||
<p><?php echo __('Set the Space Between Widgets. The default Space set is 15px.') ?></p>
|
||||
</td>
|
||||
<tr>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="pagelayer-tab-panel" id="pagelayer-sidebar">
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<b><?php echo __('Sidebar Preferences');?> :</b>
|
||||
<p><?php echo __('By default, the themes sidebar will be shown. But you can customize the settings here as per your preference. Note : This will work only if your theme uses the get_sidebar() function. Also the main content element and sidebar element should be siblings. If they are not siblings, then only the <b>No Sidebar</b> option will be usable.');?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th valign="top"><?php echo __('Default');?> : </th>
|
||||
<td>
|
||||
<?php pagelayer_sidebar_select('default');?>
|
||||
<p> <?php echo __('Default layout for the Sidebar throughout the site', 'pagelayer') ?> </p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th valign="top"><?php echo __('For Pages');?> : </th>
|
||||
<td>
|
||||
<?php pagelayer_sidebar_select('page');?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th valign="top"><?php echo __('For Posts');?> : </th>
|
||||
<td>
|
||||
<?php pagelayer_sidebar_select('post');?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th valign="top"><?php echo __('For Archives');?> : </th>
|
||||
<td>
|
||||
<?php pagelayer_sidebar_select('archives');?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th valign="top"><?php echo __('Width');?> : </th>
|
||||
<td>
|
||||
<input type="number" name="sidebar[width]" min="1" step="1" value="<?php echo (!empty($_POST) ? esc_html($_POST['sidebar']['width']) : (!empty($pagelayer->css['sidebar']['width']) ? esc_html($pagelayer->css['sidebar']['width']) : '20') );?>" /><span>%</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="pagelayer-tab-panel" id="hf">
|
||||
<?php pagelayer_show_pro_notice();?>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<b><?php echo __('Header, Body and Footer code');?> :</b>
|
||||
<p><?php echo __('You can add custom code like HTML, JavaScript, CSS etc. which will be inserted throughout your site.');?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th valign="top"><?php echo __('Header Code');?> : </th>
|
||||
<td>
|
||||
<textarea name="pagelayer_header_code" style="width:80%;" rows="6"><?php echo get_option( 'pagelayer_header_code' ); ?></textarea>
|
||||
<p> <?php echo __('This code will be printed in <code><head></code> Section.') ?> </p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th valign="top"><?php echo __('Body Open Code');?> : </th>
|
||||
<td>
|
||||
<textarea name="pagelayer_body_open_code" style="width:80%;" rows="10"><?php echo get_option( 'pagelayer_body_open_code' ); ?></textarea>
|
||||
<p> <?php echo __('This code will be printed from begning of the <code><body></code> Section.') ?> </p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<th valign="top"><?php echo __('Footer Code');?> : </th>
|
||||
<td>
|
||||
<textarea name="pagelayer_footer_code" style="width:80%;" rows="6"><?php echo get_option( 'pagelayer_footer_code' ); ?></textarea>
|
||||
<p> <?php echo __('This code will be printed before closing the <code></body></code> Section.') ?> </p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php echo __pl('color_notice');?>
|
||||
<br><br>
|
||||
<center><input type="submit" name="submit" class="button button-primary button-submit" value="Save Changes" onclick="pagelayer_handle_website_submit(this)"></center>
|
||||
<br /><br />
|
||||
</form>
|
||||
|
||||
<script>
|
||||
|
||||
function pagelayer_handle_website_submit(ele){
|
||||
|
||||
var jEle = jQuery(ele);
|
||||
jEle.closest('form').find('input, select, textarea').each(function(){
|
||||
var j = jQuery(this);
|
||||
if(jEle.is(j)){
|
||||
return;
|
||||
}
|
||||
|
||||
if(j.val().length == 0){
|
||||
j.prop("disabled", true);
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Show the vanilla selector
|
||||
function pagelayer_show_vanilla(){
|
||||
jQuery('.pagelayer-show-vanilla').each(function(){
|
||||
var jEle = jQuery(this);
|
||||
var par = jEle.parent();
|
||||
var input = par.find('input');
|
||||
var sColor = '';
|
||||
|
||||
if(input.val().length > 0){
|
||||
sColor = input.val();
|
||||
jEle.find('.pagelayer-color-div').css('background', sColor);
|
||||
jEle.find('.pagelayer-color-div').removeClass('pagelayer-color-none');
|
||||
}
|
||||
|
||||
var picker = new Picker({
|
||||
parent : jEle[0],
|
||||
color : sColor,
|
||||
});
|
||||
|
||||
// You can do what you want with the chosen color using two callbacks: onChange and onDone.
|
||||
picker.onChange = function(color) {
|
||||
jEle.find('.pagelayer-color-div').css('background', color.rgbaString);
|
||||
jEle.find('.pagelayer-color-div').removeClass('pagelayer-color-none');
|
||||
input.val(color.hex);
|
||||
};
|
||||
|
||||
jEle.find('.dashicons').on('click', function(event){
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
jEle.find('.pagelayer-color-div').addClass('pagelayer-color-none');
|
||||
input.val('');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function pagelayer_handle_custom(ele){
|
||||
jEle = jQuery(ele);
|
||||
if(jEle.val().length > 1){
|
||||
jEle.siblings().show();
|
||||
}else{
|
||||
jEle.siblings().hide();
|
||||
jEle.siblings('input').val('');
|
||||
jEle.siblings().children().val('');
|
||||
}
|
||||
}
|
||||
|
||||
// Handle the font family
|
||||
function pagelayer_handle_font_family(ele){
|
||||
jEle = jQuery(ele);
|
||||
if(jEle.children().length <= 1){
|
||||
var val = jEle.val();
|
||||
jEle.html(jQuery('#skeleton_of_fonts').html());
|
||||
jEle.val(val);
|
||||
}
|
||||
}
|
||||
|
||||
function pagelayer_handle_textdecor(ele){
|
||||
jEle = jQuery(ele);
|
||||
if(jEle.val().length > 1 && jEle.val() !== 'none'){
|
||||
jEle.siblings().show();
|
||||
}else{
|
||||
jEle.siblings().hide();
|
||||
jEle.siblings().val('');
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(document).ready(function(){
|
||||
pagelayer_show_vanilla();
|
||||
jQuery('.pagelayer-show-custom').each(function(){
|
||||
pagelayer_handle_custom(jQuery(this));
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
pagelayer_page_footer();
|
||||
|
||||
}
|
||||
|
||||
function pagelayer_website_padding_field($name, $val){
|
||||
?>
|
||||
<input type="number" name="<?php echo $name;?>[0]" step="1" class="pagelayer-website-padding" <?php echo (!empty($val[0]) ? 'value="'.esc_html($val[0]).'"' : '');?> />
|
||||
<input type="number" name="<?php echo $name;?>[1]" step="1" class="pagelayer-website-padding" <?php echo (!empty($val[1]) ? 'value="'.esc_html($val[1]).'"' : '');?> />
|
||||
<input type="number" name="<?php echo $name;?>[2]" step="1" class="pagelayer-website-padding" <?php echo (!empty($val[2]) ? 'value="'.esc_html($val[2]).'"' : '');?> />
|
||||
<input type="number" name="<?php echo $name;?>[3]" step="1" class="pagelayer-website-padding" <?php echo (!empty($val[3]) ? 'value="'.esc_html($val[3]).'"' : '');?> /><span>px</span>
|
||||
<?php
|
||||
}
|
||||
|
||||
// Shows the font settings
|
||||
function pagelayer_website_font_settings($prefix){
|
||||
|
||||
global $pagelayer, $pl_error;
|
||||
|
||||
// load css from settings
|
||||
pagelayer_load_global_css();
|
||||
|
||||
if(!empty($_POST)){
|
||||
$vals = $_POST;
|
||||
}else{
|
||||
$vals = $pagelayer->css;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<table>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php echo __pl('padding');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<select class="pagelayer-show-custom" onchange="pagelayer_handle_custom(this)">
|
||||
<option value="" <?php echo (empty($vals[$prefix]['padding']) ? 'selected="seleted"' : '');?>>Default</option>
|
||||
<option value="custom" <?php echo (!empty($vals[$prefix]['padding']) ? 'selected="seleted"' : '');?>>Custom</option>
|
||||
</select>
|
||||
<span>
|
||||
<?php pagelayer_website_padding_field($prefix.'[padding]', @$vals[$prefix]['padding']);?>
|
||||
</span>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php echo __pl('margin');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<select class="pagelayer-show-custom" onchange="pagelayer_handle_custom(this)">
|
||||
<option value="" <?php echo (empty($vals[$prefix]['margin']) ? 'selected="seleted"' : '');?>>Default</option>
|
||||
<option value="custom" <?php echo (!empty($vals[$prefix]['margin']) ? 'selected="seleted"' : '');?>>Custom</option>
|
||||
</select>
|
||||
<span>
|
||||
<?php pagelayer_website_padding_field($prefix.'[margin]', @$vals[$prefix]['margin']);?>
|
||||
</span>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php echo __pl('font_family'); ?></th>
|
||||
<td>
|
||||
<label>
|
||||
<select name="<?php echo $prefix;?>[font-family]" onclick="pagelayer_handle_font_family(this)">
|
||||
<?php
|
||||
echo '<option value="'.esc_html(empty($vals[$prefix]['font-family']) ? 'Default': @$vals[$prefix]['font-family']).'">'.esc_html(empty($vals[$prefix]['font-family']) ? 'Default': @$vals[$prefix]['font-family']).'</option>';
|
||||
?>
|
||||
</select>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php echo __pl('font_size'); ?></th>
|
||||
<td>
|
||||
<label>
|
||||
<select class="pagelayer-show-custom" onchange="pagelayer_handle_custom(this)">
|
||||
<option value="" <?php echo (empty($vals[$prefix]['font-size']) ? 'selected="seleted"' : '');?>>Default</option>
|
||||
<option value="custom" <?php echo (!empty($vals[$prefix]['font-size']) ? 'selected="seleted"' : '');?>>Custom</option>
|
||||
</select>
|
||||
<input type="number" name="<?php echo $prefix;?>[font-size]" <?php echo (!empty($vals[$prefix]['font-size']) ? 'value="'.esc_html($vals[$prefix]['font-size']).'"' : '');?> /><span>px</span>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php echo __pl('font_style'); ?></th>
|
||||
<td>
|
||||
<label>
|
||||
<select name="<?php echo $prefix;?>[font-style]">
|
||||
<?php
|
||||
foreach($pagelayer->font_style as $k => $var){
|
||||
echo '<option value="'.esc_html($k).'" '.(@$vals[$prefix]['font-style'] == $k ? 'selected' : '').'>'.esc_html($var).'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php echo __pl('font_weight');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<select name="<?php echo $prefix;?>[font-weight]">
|
||||
<?php
|
||||
foreach($pagelayer->font_weight as $k => $var){
|
||||
echo '<option value="'.esc_html($k).'" '.(@$vals[$prefix]['font-weight'] == $k ? 'selected' : '').'>'.esc_html($var).'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php echo __pl('text_transform');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<select name="<?php echo $prefix;?>[text-transform]">
|
||||
<?php
|
||||
foreach($pagelayer->text_transform as $k => $var){
|
||||
echo '<option value="'.esc_html($k).'" '.(@$vals[$prefix]['text-transform'] == $k ? 'selected' : '').'>'.esc_html($var).'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php echo __pl('line_height');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<select class="pagelayer-show-custom" onchange="pagelayer_handle_custom(this)">
|
||||
<option value="" <?php echo (empty($vals[$prefix]['line-height']) ? 'selected="seleted"' : '');?>>Default</option>
|
||||
<option value="custom" <?php echo (!empty($vals[$prefix]['line-height']) ? 'selected="seleted"' : '');?>>Custom</option>
|
||||
</select>
|
||||
<input type="number" name="<?php echo $prefix;?>[line-height]" min="0.1" step="0.1" <?php echo (!empty($vals[$prefix]['line-height']) ? 'value="'.esc_html($vals[$prefix]['line-height']).'"' : '');?> />
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php echo __pl('text_spacing');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<select class="pagelayer-show-custom" onchange="pagelayer_handle_custom(this)">
|
||||
<option value="" <?php echo (empty($vals[$prefix]['letter-spacing']) ? 'selected="seleted"' : '');?>>Default</option>
|
||||
<option value="custom" <?php echo (!empty($vals[$prefix]['letter-spacing']) ? 'selected="seleted"' : '');?>>Custom</option>
|
||||
</select>
|
||||
<input type="number" name="<?php echo $prefix;?>[letter-spacing]" min="1" step="1" <?php echo (!empty($vals[$prefix]['letter-spacing']) ? 'value="'.esc_html($vals[$prefix]['letter-spacing']).'"' : '');?> /><span>px</span>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php echo __pl('word_spacing');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<select class="pagelayer-show-custom" onchange="pagelayer_handle_custom(this)">
|
||||
<option value="" <?php echo (empty($vals[$prefix]['word-spacing']) ? 'selected="seleted"' : '');?>>Default</option>
|
||||
<option value="custom" <?php echo (!empty($vals[$prefix]['word-spacing']) ? 'selected="seleted"' : '');?>>Custom</option>
|
||||
</select>
|
||||
<input type="number" name="<?php echo $prefix;?>[word-spacing]" min="1" step="1" <?php echo (!empty($vals[$prefix]['word-spacing']) ? 'value="'.esc_html($vals[$prefix]['word-spacing']).'"' : '');?> /><span>px</span>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php echo __pl('text_decoration');?></th>
|
||||
<td>
|
||||
<label>
|
||||
<table class="pagelayer-internal-table">
|
||||
<tr>
|
||||
<td>
|
||||
<select name="<?php echo $prefix;?>[text-decoration-line]" onchange="pagelayer_handle_textdecor(this)">
|
||||
<?php
|
||||
foreach($pagelayer->text_decoration_line as $k => $var){
|
||||
echo '<option value="'.esc_html($k).'" '.(@$vals[$prefix]['text-decoration-line'] == $k ? 'selected' : '').'>'.esc_html($var).'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<select name="<?php echo $prefix;?>[text-decoration-style]">
|
||||
<?php
|
||||
foreach($pagelayer->text_decoration_style as $k => $var){
|
||||
echo '<option value="'.esc_html($k).'" '.(@$vals[$prefix]['text-decoration-style'] == $k ? 'selected' : '').'>'.esc_html($var).'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Line</td>
|
||||
<td>Style</td>
|
||||
</tr>
|
||||
</table>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">Background Color</th>
|
||||
<td>
|
||||
<a href="#" class="pagelayer-show-vanilla"><div class="pagelayer-color-div pagelayer-color-none"></div><span class="dashicons dashicons-no"></span></a><input type="hidden" name="<?php echo $prefix;?>[background-color]" <?php echo (!empty($vals[$prefix]['background-color']) ? 'value="'.esc_html($vals[$prefix]['background-color']).'"' : '');?>>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">Text Color</th>
|
||||
<td>
|
||||
<a href="#" class="pagelayer-show-vanilla"><div class="pagelayer-color-div pagelayer-color-none"></div><span class="dashicons dashicons-no"></span></a><input type="hidden" name="<?php echo $prefix;?>[color]" <?php echo (!empty($vals[$prefix]['color']) ? 'value="'.esc_html($vals[$prefix]['color']).'"' : '');?>>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
function pagelayer_sidebar_select($name){
|
||||
|
||||
global $pagelayer;
|
||||
|
||||
$val = isset($pagelayer->settings['sidebar'][$name]) ? $pagelayer->settings['sidebar'][$name] : 'default';
|
||||
$val = !empty($_POST) ? @$_POST['sidebar'][$name] : $val;
|
||||
|
||||
// We dont save the value "Default" (note case sensitivity), but the theme customizer saves "default"
|
||||
// We need to keep all values blank if user is submitting values as Default
|
||||
|
||||
echo '
|
||||
<select class="pagelayer-show-custom" name="sidebar['.$name.']">
|
||||
<option value="Default" '.($val == 'default' ? 'selected="seleted"' : '').'>Default</option>
|
||||
<option value="no" '.($val == 'no' ? 'selected="seleted"' : '').'>No Sidebar</option>
|
||||
<option value="left" '.($val == 'left' ? 'selected="seleted"' : '').'>Left Sidebar</option>
|
||||
<option value="right" '.($val == 'right' ? 'selected="seleted"' : '').'>Right Sidebar</option>
|
||||
</select>
|
||||
';
|
||||
}
|
||||
741
backup/wp/wp-content/plugins/pagelayer/main/woocommerce.php
Normal file
741
backup/wp/wp-content/plugins/pagelayer/main/woocommerce.php
Normal file
@@ -0,0 +1,741 @@
|
||||
<?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_VERSION')) {
|
||||
exit('Hacking Attempt !');
|
||||
}
|
||||
|
||||
add_action( 'wp', 'pagelayer_wc_customization' );
|
||||
function pagelayer_wc_customization(){
|
||||
|
||||
$options = pagelayer_get_customize_options();
|
||||
|
||||
if(!empty($options['woo_disable_cross_sells'])){
|
||||
remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' );
|
||||
}
|
||||
|
||||
if(is_product()){
|
||||
// Disable Breadcrumb.
|
||||
if(!empty($options['woo_disable_breadcrumb'])){
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
// Checkout customization
|
||||
if(!is_checkout()){
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable order notes.
|
||||
if(!empty( $options['woo_disable_order_note'] )){
|
||||
add_filter( 'woocommerce_enable_order_notes_field', '__return_false' );
|
||||
}
|
||||
|
||||
// Disable coupon.
|
||||
if(!empty( $options['woo_disable_coupon_field'] )){
|
||||
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
|
||||
}
|
||||
}
|
||||
|
||||
add_filter('wp_nav_menu_items', 'pagelayer_add_woo_cart', 10, 2);
|
||||
add_filter('wp_page_menu', 'pagelayer_add_woo_cart', 10, 2);
|
||||
function pagelayer_add_woo_cart($items, $args) {
|
||||
|
||||
$menu_id = $args->menu->term_id;
|
||||
$locations = get_nav_menu_locations();
|
||||
|
||||
//pagelayer_print($locations);
|
||||
if(empty($locations) || !isset($locations['primary']) || $locations['primary'] != $menu_id) {
|
||||
return $items;
|
||||
}
|
||||
|
||||
$options = pagelayer_get_customize_options();
|
||||
|
||||
if(!empty($options['woo_enable_menu_cart'])) {
|
||||
$items .= '<li class="page-item pagelayer-menu-cart cart-customlocation menu-item menu-item-type-post_type menu-item-object-page"><a href=""><span class="dashicons dashicons-cart"></span><sup></sup></a></li>';
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
add_action( 'customize_controls_print_scripts', 'pagelayer_wc_add_scripts' );
|
||||
function pagelayer_wc_add_scripts(){
|
||||
?>
|
||||
<script>
|
||||
|
||||
// Script to load Shop page when user click woocommerce customizer
|
||||
jQuery( function( $ ) {
|
||||
wp.customize.panel( 'pgl_woocommerce', function( panel ) {
|
||||
panel.expanded.bind( function( isExpanded ) {
|
||||
if ( isExpanded ) {
|
||||
wp.customize.previewer.previewUrl.set( "<?php echo esc_js( wc_get_page_permalink( 'shop' ) ); ?>" );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
wp.customize.section( 'pgl_woo_cart_page', function( section ) {
|
||||
section.expanded.bind( function( isExpanded ) {
|
||||
if( isExpanded ){
|
||||
wp.customize.previewer.previewUrl.set( "<?php echo esc_js( wc_get_page_permalink( 'cart' ) ); ?>" );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
wp.customize.section( 'pgl_woo_checkout', function( section ) {
|
||||
section.expanded.bind( function( isExpanded ) {
|
||||
if ( isExpanded ) {
|
||||
wp.customize.previewer.previewUrl.set( "<?php echo esc_js( wc_get_page_permalink( 'checkout' ) ); ?>" );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
wp.customize.section( 'pgl_woo_myaccount_page', function( section ) {
|
||||
section.expanded.bind( function( isExpanded ) {
|
||||
if ( isExpanded ) {
|
||||
wp.customize.previewer.previewUrl.set( "<?php echo esc_js( wc_get_page_permalink( 'myaccount' ) ); ?>" );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
wp.customize.section( 'pgl_woo_product_catalog', function( section ) {
|
||||
section.expanded.bind( function( isExpanded ) {
|
||||
if ( isExpanded ) {
|
||||
wp.customize.previewer.previewUrl.set( "<?php echo esc_js( wc_get_page_permalink( 'shop' ) ); ?>" );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
wp.customize.section( 'pgl_woo_general', function( section ) {
|
||||
section.expanded.bind( function( isExpanded ) {
|
||||
if ( isExpanded ) {
|
||||
wp.customize.previewer.previewUrl.set( "<?php echo esc_js( wc_get_page_permalink( 'shop' ) ); ?>" );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
function pagelayer_parse_customize_styles($val, $rule, $unit = 'px'){
|
||||
|
||||
$parse = str_replace(array('{{val}}', '{{color}}', '{{unit}}'), array($val, pagelayer_sanitize_global_color($val), $unit), $rule);
|
||||
$parse = rtrim( trim($parse), ';' );
|
||||
|
||||
return $parse;
|
||||
}
|
||||
|
||||
add_action( 'wp_head', 'pagelayer_woocommerce_styles', 1000 );
|
||||
function pagelayer_woocommerce_styles(){
|
||||
global $pagelayer;
|
||||
|
||||
// Get the option defaults
|
||||
$options = pagelayer_get_customize_options();
|
||||
$modes = array('desktop', 'tablet', 'mobile');
|
||||
$css = array();
|
||||
|
||||
$woo_styles = array(
|
||||
'woo_notice_bg_color' => array(
|
||||
'.woocommerce-store-notice.demo_store' => 'background-color: {{color}}',
|
||||
),
|
||||
'woo_notice_color' => array(
|
||||
'.woocommerce-store-notice.demo_store' => 'color: {{color}}',
|
||||
),
|
||||
'woo_notice_a_color' => array(
|
||||
'.woocommerce-store-notice.demo_store a' => 'color: {{color}}',
|
||||
),
|
||||
'woo_notice_a_hover_color' => array(
|
||||
'.woocommerce-store-notice.demo_store a:hover' => 'color: {{color}}',
|
||||
),
|
||||
'woo_myaccount_padding' => array(
|
||||
'body.woocommerce-account main.site-main' => array(
|
||||
'top' => 'padding-top: {{val}}{{unit}};',
|
||||
'right' => 'padding-right: {{val}}{{unit}};',
|
||||
'bottom' => 'padding-bottom: {{val}}{{unit}};',
|
||||
'left' => 'padding-left: {{val}}{{unit}};'
|
||||
)
|
||||
),
|
||||
'woo_checkout_padding' => array(
|
||||
'body.woocommerce-checkout main.site-main' => array(
|
||||
'top' => 'padding-top: {{val}}{{unit}};',
|
||||
'right' => 'padding-right: {{val}}{{unit}};',
|
||||
'bottom' => 'padding-bottom: {{val}}{{unit}};',
|
||||
'left' => 'padding-left: {{val}}{{unit}};'
|
||||
)
|
||||
),
|
||||
'woo_cart_padding' => array(
|
||||
'body.woocommerce-cart main.site-main' => array(
|
||||
'top' => 'padding-top: {{val}}{{unit}};',
|
||||
'right' => 'padding-right: {{val}}{{unit}};',
|
||||
'bottom' => 'padding-bottom: {{val}}{{unit}};',
|
||||
'left' => 'padding-left: {{val}}{{unit}};'
|
||||
)
|
||||
),
|
||||
'woo_product_padding' => array(
|
||||
'body.single-product main.site-main' => array(
|
||||
'top' => 'padding-top: {{val}}{{unit}};',
|
||||
'right' => 'padding-right: {{val}}{{unit}};',
|
||||
'bottom' => 'padding-bottom: {{val}}{{unit}};',
|
||||
'left' => 'padding-left: {{val}}{{unit}};'
|
||||
)
|
||||
),
|
||||
'woo_product_cat_padding' => array(
|
||||
'body.post-type-archive-product .site-main' => array(
|
||||
'top' => 'padding-top: {{val}}{{unit}};',
|
||||
'right' => 'padding-right: {{val}}{{unit}};',
|
||||
'bottom' => 'padding-bottom: {{val}}{{unit}};',
|
||||
'left' => 'padding-left: {{val}}{{unit}};'
|
||||
)
|
||||
),
|
||||
'woo_menu_cart_color' => array(
|
||||
'li.cart-customlocation span.dashicons-cart' => 'color: {{color}};',
|
||||
),
|
||||
'woo_menu_cart_number_color' => array(
|
||||
'li.cart-customlocation span.dashicons-cart + sup' => 'color: {{color}};',
|
||||
)
|
||||
);
|
||||
|
||||
$woo_styles = apply_filters('pagelayer_wc_styles_array', $woo_styles);
|
||||
|
||||
// Apply customizer css
|
||||
foreach($woo_styles as $key => $rules){
|
||||
|
||||
$value = @$options[$key];
|
||||
|
||||
if(empty($value) && $value != '0'){
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach($rules as $sel => $rule){
|
||||
|
||||
// Is not reponsive or not variable value?
|
||||
if(!is_array($value)){
|
||||
$css['desktop'][$sel][] = pagelayer_parse_customize_styles($value, $rule);
|
||||
continue;
|
||||
}
|
||||
|
||||
// If unit exists
|
||||
$unit = !empty($value['unit'])? $value['unit'] : 'px';
|
||||
|
||||
// Parse in array if responsive rule in string
|
||||
$rule = (array) $rule;
|
||||
|
||||
foreach($rule as $kk => $_rule){
|
||||
|
||||
// Is not reponsive or not variable value?
|
||||
if(isset($value[$kk]) && !is_array($value[$kk])){
|
||||
|
||||
if(empty($value[$kk]) && $value[$kk] != '0'){
|
||||
continue;
|
||||
}
|
||||
|
||||
$css['desktop'][$sel][] = pagelayer_parse_customize_styles($value[$kk], $_rule, $unit);
|
||||
}
|
||||
|
||||
foreach($modes as $mode){
|
||||
|
||||
// First level responsive key
|
||||
if(isset($value[$mode])){
|
||||
|
||||
// Responsive without variable
|
||||
$mode_val = is_numeric($kk) ? $value[$mode] : $value[$mode][$kk] ;
|
||||
|
||||
if(empty($mode_val) && $mode_val != '0'){
|
||||
continue;
|
||||
}
|
||||
|
||||
$css[$mode][$sel][] = pagelayer_parse_customize_styles($mode_val, $_rule, $unit);
|
||||
|
||||
// We are already in responsive mode
|
||||
continue;
|
||||
}
|
||||
|
||||
// Second level responsive key like font size
|
||||
if(!isset($value[$kk][$mode]) || empty($value[$kk][$mode]) && $value[$kk][$mode] != '0'){
|
||||
continue;
|
||||
}
|
||||
|
||||
$css[$mode][$sel][] = pagelayer_parse_customize_styles($value[$kk][$mode], $_rule, $unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create css
|
||||
$screen_css = array('desktop' => '', 'tablet' => '', 'mobile' => '');
|
||||
foreach($css as $mode => $_css){
|
||||
foreach($_css as $selector => $val){
|
||||
$parsr_style = $selector.'{'.implode(';', $val)."}\n";
|
||||
$screen_css[$mode] .= $parsr_style;
|
||||
}
|
||||
}
|
||||
|
||||
$styles = '<style id="pagelayer-woocommerce-styles" type="text/css">'.PHP_EOL;
|
||||
$styles .= $screen_css['desktop'];
|
||||
|
||||
if(!empty($screen_css['woo_product_image_width'])){
|
||||
$styles .= '@media(min-width: 902px) {.woocommerce #content div.product div.images, .woocommerce div.product div.images, .woocommerce-page #content div.product div.images, .woocommerce-page div.product div.images{
|
||||
width: '.$options['woo_product_image_width'].'% !important;
|
||||
}
|
||||
.woocommerce #content div.product div.summary, .woocommerce div.product div.summary, .woocommerce-page #content div.product div.summary, .woocommerce-page div.product div.summary{
|
||||
width: calc(96% - '.$options['woo_product_image_width'].'%) !important;
|
||||
}}';
|
||||
}
|
||||
|
||||
if(!empty($screen_css['tablet'])){
|
||||
$styles .= '@media(max-width: ' . $pagelayer->settings['tablet_breakpoint'] . 'px) {'.$screen_css['tablet'].'}'.PHP_EOL;
|
||||
}
|
||||
|
||||
if(!empty($screen_css['mobile'])){
|
||||
$styles .= '@media(max-width: ' . $pagelayer->settings['mobile_breakpoint'] . 'px) {'.$screen_css['mobile'].'}';
|
||||
}
|
||||
|
||||
$styles .= '</style>';
|
||||
|
||||
echo $styles;
|
||||
}
|
||||
|
||||
// Get Option Values
|
||||
function pagelayer_get_customize_options(){
|
||||
return get_option('pagelayer_customizer_options', array());
|
||||
}
|
||||
|
||||
add_action( 'customize_register', 'pagelayer_woo_customize_register', 11 );
|
||||
function pagelayer_woo_customize_register( $wp_customize ) {
|
||||
|
||||
//PageLayer + WooCommerce Panel
|
||||
$wp_customize->add_panel( 'pgl_woocommerce', array(
|
||||
'priority' => 10,
|
||||
'title' => __('Pagelayer + WooCommerce'),
|
||||
) );
|
||||
|
||||
// Add Store Notice Section
|
||||
$wp_customize->get_section( 'woocommerce_store_notice' )->description = '<strong><a href="customize.php?autofocus[section]=pgl_woo_store_notice">'.__('Click here') .'</a> '. __('to change color scheme of store notice') .'</strong>';
|
||||
|
||||
// Add Store Notice Section
|
||||
$wp_customize->add_section( 'pgl_woo_store_notice', array(
|
||||
'panel' => 'pgl_woocommerce',
|
||||
'priority' => 1,
|
||||
'title' => __('Store Notice'),
|
||||
'description' => '<strong><a href="customize.php?autofocus[section]=woocommerce_store_notice">'.__('Click here') .'</a> '. __('to enable the store notice') .'</strong>',
|
||||
)
|
||||
);
|
||||
|
||||
// Adds Customizer settings
|
||||
$wp_customize->add_setting( 'pagelayer_customizer_options[woo_notice_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_notice_bg_color]', array(
|
||||
'label' => __('Background Color'),
|
||||
'section' => 'pgl_woo_store_notice',
|
||||
'priority' => 1
|
||||
) )
|
||||
);
|
||||
|
||||
// Adds Customizer settings
|
||||
$wp_customize->add_setting( 'pagelayer_customizer_options[woo_notice_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_notice_color]', array(
|
||||
'label' => __('Text Color'),
|
||||
'section' => 'pgl_woo_store_notice',
|
||||
'priority' => 1
|
||||
) )
|
||||
);
|
||||
|
||||
// Adds Customizer settings
|
||||
$wp_customize->add_setting( 'pagelayer_customizer_options[woo_notice_a_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_notice_a_color]', array(
|
||||
'label' => __('Link Color'),
|
||||
'section' => 'pgl_woo_store_notice',
|
||||
'priority' => 1
|
||||
) )
|
||||
);
|
||||
|
||||
// Adds Customizer settings
|
||||
$wp_customize->add_setting( 'pagelayer_customizer_options[woo_notice_a_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_notice_a_hover_color]', array(
|
||||
'label' => __('Link Hover Color'),
|
||||
'section' => 'pgl_woo_store_notice',
|
||||
'priority' => 1
|
||||
) )
|
||||
);
|
||||
|
||||
// Add Store Notice Section
|
||||
$wp_customize->add_section( 'pgl_woo_general', array(
|
||||
'panel' => 'pgl_woocommerce',
|
||||
'title' => __('General'),
|
||||
'priority' => 2,
|
||||
)
|
||||
);
|
||||
|
||||
// Adds Customizer settings
|
||||
$wp_customize->add_setting( 'pagelayer_customizer_options[woo_star_rating_color]', array(
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'refresh',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting( 'pagelayer_lable_menu_cart', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
));
|
||||
|
||||
$wp_customize->add_control( new Pagelayer_Customize_Control(
|
||||
$wp_customize, 'pagelayer_lable_menu_cart', array(
|
||||
'type' => 'hidden',
|
||||
'section' => 'pgl_woo_general',
|
||||
'description' => __('<div class="pagelayer-customize-heading"><div>Cart Icon on Menu</div></div>', 'pagelayer'),
|
||||
'li_class' => 'pagelayer-accordion-tab',
|
||||
'priority' => 9
|
||||
)
|
||||
));
|
||||
|
||||
// Adds Customizer settings
|
||||
$wp_customize->add_setting( 'pagelayer_customizer_options[woo_enable_menu_cart]', array(
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'refresh',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, 'pagelayer_customizer_options[woo_enable_menu_cart]', array(
|
||||
'type' => 'checkbox',
|
||||
'label' => __('Show Cart Icon On Primary Menu'),
|
||||
'section' => 'pgl_woo_general',
|
||||
'priority' => 9
|
||||
))
|
||||
);
|
||||
|
||||
// Adds Customizer settings
|
||||
$wp_customize->add_setting( 'pagelayer_customizer_options[woo_menu_cart_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_menu_cart_color]', array(
|
||||
'label' => __('Icon Color'),
|
||||
'section' => 'pgl_woo_general',
|
||||
'priority' => 10,
|
||||
) )
|
||||
);
|
||||
|
||||
// Adds Customizer settings
|
||||
$wp_customize->add_setting( 'pagelayer_customizer_options[woo_menu_cart_number_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_menu_cart_number_color]', array(
|
||||
'label' => __('Cart Numbers Color'),
|
||||
'section' => 'pgl_woo_general',
|
||||
'priority' => 10,
|
||||
) )
|
||||
);
|
||||
|
||||
// Shop Page Section
|
||||
$wp_customize->add_section( 'pgl_woo_product_catalog', array(
|
||||
'panel' => 'pgl_woocommerce',
|
||||
'title' => __('Product Catalog'),
|
||||
'priority' => 4,
|
||||
)
|
||||
);
|
||||
|
||||
// Register the WooCommerce Default Padding
|
||||
pagelayer_register_padding_customizer_control($wp_customize, array(
|
||||
'control' => 'pagelayer_customizer_options',
|
||||
'control_array_sufix' => 'woo_product_cat_padding',
|
||||
'section' => 'pgl_woo_product_catalog',
|
||||
'label' => __( 'Padding', 'pagelayer' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'setting_type' => 'option',
|
||||
'transport' => 'refresh',
|
||||
'default' => '',
|
||||
'units' => ['px', 'em', '%'],
|
||||
'responsive' => 1,
|
||||
'priority' => 1
|
||||
), true);
|
||||
|
||||
// Single Product Page Sections
|
||||
$wp_customize->add_section( 'pgl_woo_single_product', array(
|
||||
'panel' => 'pgl_woocommerce',
|
||||
'title' => __('Single Product'),
|
||||
'priority' => 5,
|
||||
)
|
||||
);
|
||||
|
||||
// Register the WooCommerce single page Padding
|
||||
pagelayer_register_padding_customizer_control($wp_customize, array(
|
||||
'control' => 'pagelayer_customizer_options',
|
||||
'control_array_sufix' => 'woo_product_padding',
|
||||
'section' => 'pgl_woo_single_product',
|
||||
'label' => __( 'Padding', 'pagelayer' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'setting_type' => 'option',
|
||||
'transport' => 'refresh',
|
||||
'default' => '',
|
||||
'units' => ['px', 'em', '%'],
|
||||
'responsive' => 1,
|
||||
'priority' => 1
|
||||
), true);
|
||||
|
||||
// Single Product Page Breadcrumb Enabler
|
||||
$wp_customize->add_setting( 'pagelayer_customizer_options[woo_disable_breadcrumb]', array(
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'refresh',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, 'pagelayer_customizer_options[woo_disable_breadcrumb]', array(
|
||||
'type' => 'checkbox',
|
||||
'label' => __('Disable Breadcrumb'),
|
||||
'section' => 'pgl_woo_single_product',
|
||||
'priority' => 5
|
||||
))
|
||||
);
|
||||
|
||||
// Cart page settings
|
||||
$wp_customize->add_section( 'pgl_woo_cart_page', array(
|
||||
'panel' => 'pgl_woocommerce',
|
||||
'title' => __('Cart'),
|
||||
'priority' => 7,
|
||||
)
|
||||
);
|
||||
|
||||
pagelayer_register_padding_customizer_control($wp_customize, array(
|
||||
'control' => 'pagelayer_customizer_options',
|
||||
'control_array_sufix' => 'woo_cart_padding',
|
||||
'section' => 'pgl_woo_cart_page',
|
||||
'label' => __( 'Padding', 'pagelayer' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'setting_type' => 'option',
|
||||
'transport' => 'refresh',
|
||||
'default' => '',
|
||||
'units' => ['px', 'em', '%'],
|
||||
'responsive' => 1,
|
||||
'priority' => 1
|
||||
), true);
|
||||
|
||||
// cross-sells disable
|
||||
$wp_customize->add_setting( 'pagelayer_customizer_options[woo_disable_cross_sells]', array(
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'refresh',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, 'pagelayer_customizer_options[woo_disable_cross_sells]', array(
|
||||
'type' => 'checkbox',
|
||||
'label' => __('Disable Cross-sells'),
|
||||
'section' => 'pgl_woo_cart_page',
|
||||
'priority' => 2
|
||||
))
|
||||
);
|
||||
|
||||
// Checkout Page Section
|
||||
$wp_customize->add_section( 'pgl_woo_checkout', array(
|
||||
'panel' => 'pgl_woocommerce',
|
||||
'title' => __('Checkout'),
|
||||
'priority' => 9,
|
||||
)
|
||||
);
|
||||
|
||||
// Checkout page settings
|
||||
pagelayer_register_padding_customizer_control($wp_customize, array(
|
||||
'control' => 'pagelayer_customizer_options',
|
||||
'control_array_sufix' => 'woo_checkout_padding',
|
||||
'section' => 'pgl_woo_checkout',
|
||||
'label' => __( 'Padding', 'pagelayer' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'setting_type' => 'option',
|
||||
'transport' => 'refresh',
|
||||
'default' => '',
|
||||
'units' => ['px', 'em', '%'],
|
||||
'responsive' => 1,
|
||||
'priority' => 1
|
||||
), true);
|
||||
|
||||
$wp_customize->add_setting( 'pagelayer_customizer_options[woo_disable_order_note]', array(
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'refresh',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, 'pagelayer_customizer_options[woo_disable_order_note]', array(
|
||||
'type' => 'checkbox',
|
||||
'label' => __('Disable Order Note'),
|
||||
'section' => 'pgl_woo_checkout',
|
||||
'priority' => 2
|
||||
))
|
||||
);
|
||||
|
||||
$wp_customize->add_setting( 'pagelayer_customizer_options[woo_disable_coupon_field]', array(
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'refresh',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, 'pagelayer_customizer_options[woo_disable_coupon_field]', array(
|
||||
'type' => 'checkbox',
|
||||
'label' => __('Disable Coupon Field'),
|
||||
'section' => 'pgl_woo_checkout',
|
||||
'priority' => 3
|
||||
))
|
||||
);
|
||||
|
||||
// My Account Page Section
|
||||
$wp_customize->add_section( 'pgl_woo_myaccount_page', array(
|
||||
'panel' => 'pgl_woocommerce',
|
||||
'title' => __('My Account'),
|
||||
'priority' => 10,
|
||||
)
|
||||
);
|
||||
|
||||
// My Account page settings
|
||||
pagelayer_register_padding_customizer_control($wp_customize, array(
|
||||
'control' => 'pagelayer_customizer_options',
|
||||
'control_array_sufix' => 'woo_myaccount_padding',
|
||||
'section' => 'pgl_woo_myaccount_page',
|
||||
'label' => __( 'Padding', 'pagelayer' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'setting_type' => 'option',
|
||||
'transport' => 'refresh',
|
||||
'default' => '',
|
||||
'units' => ['px', 'em', '%'],
|
||||
'responsive' => 1,
|
||||
'priority' => 1
|
||||
), true);
|
||||
}
|
||||
|
||||
// Get product
|
||||
function pagelayer_get_product(){
|
||||
|
||||
$_product = wc_get_product();
|
||||
|
||||
if(!empty($_product)){
|
||||
return $_product;
|
||||
}
|
||||
|
||||
$post = $GLOBALS['post'];
|
||||
|
||||
if( !wp_doing_ajax() && $post->post_type != 'pagelayer-template'){
|
||||
return false;
|
||||
}
|
||||
|
||||
$products = get_posts([
|
||||
'post_type' => 'product',
|
||||
'numberposts' => '1',
|
||||
]);
|
||||
|
||||
if(empty($products)){
|
||||
return false;
|
||||
}
|
||||
|
||||
$_product = wc_get_product($products[0]->ID);
|
||||
|
||||
return $_product;
|
||||
}
|
||||
|
||||
// Load Product configurations to edit the product template
|
||||
add_action( 'template_redirect', 'pagelayer_load_product_template');
|
||||
function pagelayer_load_product_template($post = []){
|
||||
global $pagelayer, $product;
|
||||
|
||||
if(!$post){
|
||||
$post = $GLOBALS['post'];
|
||||
}
|
||||
|
||||
if(!class_exists('woocommerce') || empty($post->post_type) || $post->post_type != 'pagelayer-template' || !isset($pagelayer->builder['singular_templates']['Products']) ){
|
||||
return false;
|
||||
}
|
||||
|
||||
$products = array_keys($pagelayer->builder['singular_templates']['Products']);
|
||||
$conditions = get_post_meta( $post->ID, 'pagelayer_template_conditions', true );
|
||||
|
||||
$is_product_temp = false;
|
||||
|
||||
foreach( $conditions as $condi ){
|
||||
if(in_array($condi['sub_template'], $products)){
|
||||
$is_product_temp = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$is_product_temp){
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add WooCommerce Class to body
|
||||
add_filter('body_class', function($classes){
|
||||
$classes[] = 'woocommerce';
|
||||
return $classes;
|
||||
});
|
||||
|
||||
$product = pagelayer_get_product();
|
||||
|
||||
//pagelayer_print($product);
|
||||
|
||||
wp_enqueue_script( 'wc-single-product' );
|
||||
wp_enqueue_style( 'wc-single-product' );
|
||||
|
||||
// Load woocomerce css and js
|
||||
if ( current_theme_supports( 'wc-product-gallery-zoom' ) ) {
|
||||
wp_enqueue_script( 'zoom' );
|
||||
}
|
||||
|
||||
if ( current_theme_supports( 'wc-product-gallery-slider' ) ) {
|
||||
wp_enqueue_script( 'flexslider' );
|
||||
}
|
||||
|
||||
if ( current_theme_supports( 'wc-product-gallery-lightbox' ) ) {
|
||||
wp_enqueue_script( 'photoswipe-ui-default' );
|
||||
wp_enqueue_style( 'photoswipe-default-skin' );
|
||||
add_action( 'wp_footer', 'woocommerce_photoswipe' );
|
||||
}
|
||||
|
||||
wp_enqueue_style( 'photoswipe' );
|
||||
wp_enqueue_style( 'photoswipe-default-skin' );
|
||||
wp_enqueue_style( 'photoswipe-default-skin' );
|
||||
wp_enqueue_style( 'woocommerce_prettyPhoto_css' );
|
||||
}
|
||||
|
||||
if(defined('PAGELAYER_PREMIUM')){
|
||||
include_once(dirname(__FILE__).'/premium-woocommerce.php');
|
||||
}
|
||||
Reference in New Issue
Block a user