| 1 |
<?php |
| 2 |
|
| 3 |
////////////////////////////////////////////////////////////// |
| 4 |
//=========================================================== |
| 5 |
// class.php |
| 6 |
//=========================================================== |
| 7 |
// PAGELAYER |
| 8 |
// Inspired by the DESIRE to be the BEST OF ALL |
| 9 |
// ---------------------------------------------------------- |
| 10 |
// Started by: Pulkit Gupta |
| 11 |
// Date: 23rd Jan 2017 |
| 12 |
// Time: 23:00 hrs |
| 13 |
// Site: http://pagelayer.com/wordpress (PAGELAYER) |
| 14 |
// ---------------------------------------------------------- |
| 15 |
// Please Read the Terms of use at http://pagelayer.com/tos |
| 16 |
// ---------------------------------------------------------- |
| 17 |
//=========================================================== |
| 18 |
// (c)Pagelayer Team |
| 19 |
//=========================================================== |
| 20 |
////////////////////////////////////////////////////////////// |
| 21 |
|
| 22 |
// Are we being accessed directly ? |
| 23 |
if(!defined('PAGELAYER_VERSION')) { |
| 24 |
exit('Hacking Attempt !'); |
| 25 |
} |
| 26 |
|
| 27 |
// Pagelayer Class |
| 28 |
#[AllowDynamicProperties] |
| 29 |
class PageLayer{ |
| 30 |
|
| 31 |
var $BRAND_TEXT; |
| 32 |
var $LOGO; |
| 33 |
var $action; |
| 34 |
var $license; |
| 35 |
var $allowed_mime_type; |
| 36 |
var $template_call_sidebar; |
| 37 |
var $shortcode_loaded; |
| 38 |
var $anim_in_options; |
| 39 |
var $anim_out_options; |
| 40 |
var $slider_arrow_styles; |
| 41 |
var $slider_pager_styles; |
| 42 |
var $slider_options; |
| 43 |
var $templates; |
| 44 |
var $template_header; |
| 45 |
var $template_post; |
| 46 |
var $template_editor; |
| 47 |
var $template_footer; |
| 48 |
var $template_popup_ids; |
| 49 |
var $load_live_errors; |
| 50 |
var $rendering_template_id; |
| 51 |
var $dont_make_editable; |
| 52 |
|
| 53 |
// All Settings |
| 54 |
var $settings = array(); |
| 55 |
|
| 56 |
// Cache |
| 57 |
var $cache = array(); |
| 58 |
|
| 59 |
// Common Styles Params |
| 60 |
var $styles = array(); |
| 61 |
|
| 62 |
// All Shortcodes |
| 63 |
var $shortcodes = array(); |
| 64 |
|
| 65 |
// All Shortcodes Groups |
| 66 |
var $groups = array(); |
| 67 |
|
| 68 |
// Builder definition |
| 69 |
var $builder = array(); |
| 70 |
|
| 71 |
// The Lang Strings |
| 72 |
var $l = array(); |
| 73 |
|
| 74 |
// Runtime fonts |
| 75 |
var $fonts = array(); |
| 76 |
var $runtime_fonts = array(); |
| 77 |
var $fonts_sent = array(); |
| 78 |
var $system_fonts = array(); |
| 79 |
var $typo_props = array(); |
| 80 |
|
| 81 |
// Array of all the template paths |
| 82 |
var $all_template_paths = array(); |
| 83 |
|
| 84 |
// Tabs visible in the left panel |
| 85 |
var $tabs = ['settings', 'options']; |
| 86 |
|
| 87 |
// Tabs visible in the left panel |
| 88 |
var $screens = ['desktop' => '', 'tablet' => 'tablet', 'mobile' => 'mobile']; |
| 89 |
|
| 90 |
// Icons set |
| 91 |
var $icons = ['font-awesome5']; |
| 92 |
|
| 93 |
// For exporting templates |
| 94 |
var $media_to_export = array(); |
| 95 |
|
| 96 |
// For global widget |
| 97 |
var $global_widgets = array(); |
| 98 |
|
| 99 |
// For global section |
| 100 |
var $global_sections = array(); |
| 101 |
|
| 102 |
// For saved sections |
| 103 |
var $saved_sections = array(); |
| 104 |
|
| 105 |
// For saved default params |
| 106 |
var $default_params = array(); |
| 107 |
|
| 108 |
// Youtube API |
| 109 |
var $append_yt_api = false; |
| 110 |
|
| 111 |
var $css = array(); |
| 112 |
var $css_settings = array(); |
| 113 |
|
| 114 |
// Customizer options |
| 115 |
var $customizer_mods = array(); |
| 116 |
var $customizer_params = array(); |
| 117 |
|
| 118 |
var $data_attr = array(); |
| 119 |
var $sc_audio_enqueued = 0; |
| 120 |
|
| 121 |
var $support = 'http://pagelayer.deskuss.com'; |
| 122 |
|
| 123 |
// Global colors and typographies |
| 124 |
var $global_colors = array(); |
| 125 |
var $global_fonts = array(); |
| 126 |
|
| 127 |
// Explicit property declarations to prevent PHP 8.2 dynamic property deprecation warnings |
| 128 |
var $font_style; |
| 129 |
var $text_transform; |
| 130 |
var $font_weight; |
| 131 |
var $text_decoration_line; |
| 132 |
var $text_decoration_style; |
| 133 |
var $customizer_styles_options; |
| 134 |
var $e; |
| 135 |
var $export_menus; |
| 136 |
var $export_mode; |
| 137 |
var $font_settings; |
| 138 |
var $from_header_to_footer; |
| 139 |
var $import_links; |
| 140 |
var $import_map; |
| 141 |
var $import_media; |
| 142 |
var $imported; |
| 143 |
var $imported_ids; |
| 144 |
var $imported_menus; |
| 145 |
var $imported_menus_preg; |
| 146 |
var $imported_menus_slug; |
| 147 |
var $ip_method; |
| 148 |
var $localScript; |
| 149 |
var $template_conf; |
| 150 |
var $template_sidebar; |
| 151 |
|
| 152 |
function __construct() { |
| 153 |
|
| 154 |
// Load the langs |
| 155 |
$this->l = @file_get_contents(PAGELAYER_DIR.'/languages/en.json'); |
| 156 |
$this->l = @json_decode($this->l, true); |
| 157 |
|
| 158 |
// Load the langs hook |
| 159 |
$this->l = apply_filters('pagelayer_load_languages', $this->l); |
| 160 |
|
| 161 |
// Add after plugins_loaded |
| 162 |
add_action('plugins_loaded', [ $this, 'load_extra_languages' ], 11); |
| 163 |
|
| 164 |
// Array of font options |
| 165 |
$this->css_settings = ['body' => ['name' => 'Body', 'key' => 'pagelayer_body_typography'], |
| 166 |
'header' => ['name' => 'Site Header', 'sel' => '> header'], |
| 167 |
'main' => ['name' => 'Site Main', 'sel' => '.site-main'], |
| 168 |
'footer' => ['name' => 'Site Footer', 'sel' => '> footer'], |
| 169 |
'entry-header' => ['name' => 'Content Header', 'sel' => '.entry-header'], |
| 170 |
'entry-content' => ['name' => 'Content', 'sel' => '.entry-content'], |
| 171 |
'entry-footer' => ['name' => 'Content Footer', 'sel' => '.entry-footer'], |
| 172 |
'p' => ['name' => 'Paragraph'], |
| 173 |
'aside' => ['name' => 'Sidebar'], |
| 174 |
'a' => ['name' => 'Link'], |
| 175 |
'a-hover' => ['name' => 'Link Hover', 'sel' => 'a:hover'], |
| 176 |
'h1' => ['name' => 'H1', 'key' => 'pagelayer_h1_typography'], |
| 177 |
'h2' => ['name' => 'H2', 'key' => 'pagelayer_h2_typography'], |
| 178 |
'h3' => ['name' => 'H3', 'key' => 'pagelayer_h3_typography'], |
| 179 |
'h4' => ['name' => 'H4', 'key' => 'pagelayer_h4_typography'], |
| 180 |
'h5' => ['name' => 'H5', 'key' => 'pagelayer_h5_typography'], |
| 181 |
'h6' => ['name' => 'H6', 'key' => 'pagelayer_h6_typography'], |
| 182 |
'b' => ['name' => 'Bold', 'sel' => 'strong, body.pagelayer-body b'], |
| 183 |
'i' => ['name' => 'Italics', 'sel' => 'em, body.pagelayer-body i:not(.fa, .fas, .far, .fab)'], |
| 184 |
]; |
| 185 |
|
| 186 |
$this->system_fonts = ['Arial', 'Arial Black', 'Courier', 'Georgia', 'Helvetica', 'impact', 'Tahoma', 'Times New Roman', 'Trebuchet MS', 'Verdana']; |
| 187 |
$this->customizer_mods = get_option('pagelayer_customizer_mods', []); |
| 188 |
$this->support = (defined('SITEPAD') ? 'http://sitepad.deskuss.com' : $this->support); |
| 189 |
$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']; |
| 190 |
|
| 191 |
} |
| 192 |
|
| 193 |
function default_font_styles( $args = array()){ |
| 194 |
|
| 195 |
$default_font_styles = [ |
| 196 |
'font-family' => 'Open Sans', |
| 197 |
'font-size' => '', |
| 198 |
'font-style' => '', |
| 199 |
'font-variant' => '', |
| 200 |
'font-weight' => '', |
| 201 |
'letter-spacing' => '', |
| 202 |
'line-height' => '', |
| 203 |
'text-decoration-line' => '', |
| 204 |
'text-decoration-style' => '', |
| 205 |
'text-transform' => '', |
| 206 |
'word-spacing' => '' |
| 207 |
]; |
| 208 |
|
| 209 |
return array_merge($default_font_styles, $args); |
| 210 |
} |
| 211 |
|
| 212 |
function load_extra_languages(){ |
| 213 |
|
| 214 |
if(defined('SITEPAD')){ |
| 215 |
$this->l['email_desc'] = 'To change the email, visit your '.BRAND_SM.' Dashboard -> Settings -> Editor Settings'; |
| 216 |
$this->l['CMA_desc'] = 'To change text, visit your '.BRAND_SM.' Dashboard -> Settings -> Editor Settings'; |
| 217 |
} |
| 218 |
|
| 219 |
} |
| 220 |
|
| 221 |
} |