level = self::FLT_FILE; // file for beyma, fallback a hardcoded en arrakis sin hay melange config. } /** * Back - Blocks **/ public function processConfig($post, &$config) { // $config->melange_blocks_cfg = json_decode(stripslashes($post->melange_blocks_cfg ?? '')); } function admin_config() { if(!is_admin()) return; $config = \Arrakis\Config::getInstance(); $melange_config = []; $melange_config['urlbase'] = plugins_url('/melange/'); $melange_config['urlpripol'] = get_permalink($config->legal_page_privacy); $melange_config['gmaps_key'] = $config->gmaps_key; $melange_config['fonts_cfg'] = []; if(!empty($config->fonts_cfg)) { foreach($config->fonts_cfg as $font_cfg) { if(!($font_cfg->variable ?? false)) { $melange_config['fonts_cfg'][] = [ 'label' => $font_cfg->label, 'name' => $font_cfg->name, 'family' => $font_cfg->family, 'weights' => explode(chr(44), $font_cfg->weights), ]; } else { $melange_config['fonts_cfg'][] = [ 'label' => $font_cfg->label, 'name' => $font_cfg->name, 'family' => $font_cfg->family, 'weights' => explode(chr(32), '100 200 300 400 500 600 700 800'), ]; } } } $melange_config['colors_cfg'] = []; if(!empty($config->colors_cfg)) { foreach($config->colors_cfg as $color_cfg) { $melange_config['colors_cfg'][] = [ 'label' => $color_cfg->label, 'name' => $color_cfg->name, 'hexa' => $color_cfg->hexa, ]; } } $melange_config['gradients_cfg'] = []; if(!empty($config->gradients_cfg)) { foreach($config->gradients_cfg as $gradient_cfg) { $melange_config['gradients_cfg'][] = [ 'label' => $gradient_cfg->label, 'name' => $gradient_cfg->name, 'value' => $gradient_cfg->value, ]; } } $melange_config['shadows_cfg'] = []; if(!empty($config->shadows_cfg)) { foreach($config->shadows_cfg as $shadow_cfg) { $melange_config['shadows_cfg'][] = [ 'label' => $shadow_cfg->label, 'name' => $shadow_cfg->name, 'value' => $shadow_cfg->value, ]; } } $melange_config['sprites_cfg'] = []; if(!empty($config->sprites_cfg)) { foreach($config->sprites_cfg as $sprite_cfg) { $melange_config['sprites_cfg'][] = [ 'label' => $sprite_cfg->label, 'name' => $sprite_cfg->name, 'icons' => $sprite_cfg->icons, ]; } } $melange_config['blocks'] = $config->melange_blocks; // $melange_config['blocks_cfg'] = $config->melange_blocks_cfg; wp_localize_script( 'melange', 'melange_config', $melange_config ); } function editor_assets() { if(is_admin()) { $csspath = dirname(__FILE__).'/arrakis.css'; $csscode = []; $config = \Arrakis\Config::getInstance(); if(!empty($config->fonts_cfg)) { $custom_fonts_css = []; $google_fonts_css = []; foreach($config->fonts_cfg as $font_cfg) { if(!$font_cfg->google) { $weights = array_map('trim', explode(chr(44), $font_cfg->weights)); $filename = array_map('trim', explode(chr(44), $font_cfg->filename)); $combined = array_map(null, $weights, $filename); foreach($combined as [$weight, $filename]) { $custom_fonts_css[] = <<family}'; src: url('
Warning: Undefined variable $filename in /var/www/vhosts/glm-ett-empleo.com/httpdocs/wp-content/plugins/melange/melange.php on line 209
https://www.glm-ett-empleo.com/wp-content/themes/arrakis-child/fonts/') format('opentype'); font-weight: {$weight}; font-style: normal; } CSS; } // $vars[$font_cfg->name] = "'{$font_cfg->family}'"; } if($font_cfg->google) { if(!($font_cfg->variable ?? false)) { $family = $font_cfg->family; $vars[$font_cfg->name] = "'{$family}'"; $family = urlencode($font_cfg->family); $google_fonts_css[] = $family.':'.$font_cfg->weights; } } } if(!empty($custom_fonts_css)) { $csscode[] = implode(PHP_EOL, array_map('trim', $custom_fonts_css)).PHP_EOL; } if(!empty($google_fonts_css)) { $csscode[] = '@import url(\'https://fonts.googleapis.com/css?family='.implode('|', $google_fonts_css).'&display=swap\');'.PHP_EOL; } } $csscode[] = ":root {"; if(!empty($config->fonts_cfg)) { foreach($config->fonts_cfg as $font_cfg) { $csscode[] = "{$font_cfg->name}: '{$font_cfg->family}';"; } } if(is_array($config->colors_cfg)) foreach($config->colors_cfg as $color_cfg) { $csscode[] = "{$color_cfg->name}: {$color_cfg->hexa};"; } if(is_array($config->gradients_cfg)) foreach($config->gradients_cfg as $gradient_cfg) { $csscode[] = "{$gradient_cfg->name}: {$gradient_cfg->value};"; } if(is_array($config->shadows_cfg)) foreach($config->shadows_cfg as $shadow_cfg) { $csscode[] = "{$shadow_cfg->name}: {$shadow_cfg->value};"; } if(is_array($config->sprites_cfg)) foreach($config->sprites_cfg as $sprite_cfg) { if(!empty($sprite_cfg->media) && !empty($sprite_cfg->media->url)) { $sname = '--'.$sprite_cfg->name; $csscode[] = "$sname: url('{$sprite_cfg->media->url}');"; } } $csscode[] = "}"; if(is_array($config->sprites_cfg)) { // copied & pasted from config.php $irules = []; $isizes = []; foreach($config->sprites_cfg as $sprite_cfg) { $ibacks = []; if(!empty($sprite_cfg->media) && !empty($sprite_cfg->media->url)) { $sname = '--'.$sprite_cfg->name; // $vars[$sname] = "url('{$sprite_cfg->media->url}')"; // REMOVED after copied & pasted. LOOK at few lines before (end of :root) foreach($sprite_cfg->icons as $icon_cfg) { $cname = '.ico_'.$icon_cfg->name; $isize = $icon_cfg->w.'-'.$icon_cfg->h; $isizes[$isize] = $isizes[$isize] ?? []; $isizes[$isize][] = $cname; $ibacks[$cname] = $ibacks[$cname] ?? []; $ibacks[$cname] = $cname; $irules[] = $cname.' { background-position: -'.$icon_cfg->x.'px -'.$icon_cfg->y.'px; }'; // width: '.$icon_cfg->w.'px; height; '.$icon_cfg->h.'px; } array_unshift($irules, implode(chr(44).chr(32), $ibacks).' { background-image: var('.$sname.'); }'); } } foreach($isizes as $isize=>$cnames) { [$w, $h] = explode('-', $isize); array_unshift($irules, implode(chr(44).chr(32), $cnames).' { width: '.$w.'px; height: '.$h.'px; }'); } $csscode[] = implode(PHP_EOL, $irules); } file_put_contents($csspath, implode(PHP_EOL, $csscode)); wp_register_script( 'melange', plugins_url('melange/blocks/blocks.js'), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor', 'lodash') ); wp_register_style ( 'melange', plugins_url('melange/blocks.css'), array('wp-edit-blocks') ); wp_register_style ( 'arrakis', plugins_url('melange/arrakis.css'), array('wp-edit-blocks') ); wp_enqueue_script ( 'melange' ); wp_enqueue_style ( 'melange' ); wp_enqueue_style ( 'arrakis' ); } } function set_categories($categories, $block_editor_context) { $categories = array_merge($categories, array( array( 'slug' => 'melange', 'title' => 'Melange ·Basics·', 'icon' => 'dashicons-align-left', ), array( 'slug' => 'melangeLayout', 'title' => 'Melange ·Layout·', 'icon' => 'dashicons-align-left', ), )); return $categories; } function prepare_attachment_for_js($response, $attachment) { if(!empty($response['sizes']) && is_array($response['sizes'])) { // foreach($response['sizes'] as $size=>$datas) { // $response['sizes'][$size]['tag'] = wp_get_attachment_image( $attachment->ID, $size ); // $response['sizes'][$size]['srcset'] = wp_get_attachment_image_srcset( $attachment->ID, $size ); // } $response['srcset'] = wp_get_attachment_image_srcset($attachment->ID); } return $response; } static public function urlimage($file) { switch(true) { case file_exists(CHILD_PATH.'blocks/'.$file): return home_url('wp-content/themes/arrakis-child/blocks/'.$file); case file_exists(MELANGE_PATH.'blocks/'.$file): return home_url('wp-content/plugins/melange/blocks/'.$file); case file_exists(CHILD_PATH.$file): return home_url('wp-content/themes/arrakis-child/'.$file); case file_exists(THEME_PATH.$file): return home_url('wp-content/themes/arrakis/'.$file); } return ''; } /** * Back - Ajax **/ function get_posttypes() { $info = []; $cpts = get_post_types([ 'public' => true, '_builtin' => true, ], 'objects'); if(!is_wp_error($cpts)) foreach($cpts as $cpt) { $info[] = [ 'value' => $cpt->name, 'label' => $cpt->label, ]; } die(json_encode($info)); } function get_taxonomies() { $info = []; $taxs = get_taxonomies([ 'public' => true, // '_builtin' => true, ], 'objects'); if(!is_wp_error($taxs)) foreach($taxs as $tax) { $info[] = [ 'value' => $tax->name, 'label' => $tax->label, ]; } die(json_encode($info)); } function get_terms() { $tax = $_POST['tax'] ?? null; $info = []; $terms = get_terms([ 'taxonomy' => $tax, // 'public' => true, // '_builtin' => true, ], 'objects'); if(!is_wp_error($terms)) foreach($terms as $term) { $info[] = [ 'value' => $term->slug, 'label' => $term->name, ]; } die(json_encode($info)); } function get_post() { $pid = $_POST['pid'] ?? 0; $cpt = $_POST['cpt'] ?? 'posts'; $tax = $_POST['tax'] ?? null; $terms = $_POST['terms'] ?? null; $ppp = (int) $_POST['ppp'] ?? 6; $info = new stdClass(); if($pid) { $post = get_post($pid); } else { $query = [ 'post_type' => $cpt ]; if($ppp>0) { $query['posts_per_page'] = $ppp; } else { $query['nopaging'] = true; } if(!empty($tax) && !empty($term)) { $query['tax_query'] = [ ['taxonomy'=>$tax, 'terms'=>$terms, 'field'=>'slug'] ]; } $posts = get_posts($query); $post = reset($posts); } if(!empty($post) && !is_wp_error($post)) { $thid = get_post_thumbnail_id($post->ID); $pic_full = wp_get_attachment_image_src($thid, 'large'); $pic_thb = wp_get_attachment_image_src($thid, 'thumbnail'); $info->post_date = $post->post_date; $info->post_title = $post->post_title; $info->post_excerpt = $post->post_excerpt; $info->image_full = $pic_full; $info->image_thb = $pic_thb; } die(json_encode($info)); } function get_posts() { $cpt = $_POST['cpt'] ?? 'posts'; $tax = $_POST['tax'] ?? null; $terms = $_POST['terms'] ?? null; $ppp = $_POST['ppp'] ?? null; $info = []; $query = [ 'post_type' => $cpt ]; if(!empty($tax) && !empty($term)) { $query['tax_query'] = [ ['taxonomy'=>$tax, 'terms'=>$terms, 'field'=>'slug'] ]; } if(!empty($ppp)) { $query['posts_per_page'] = $ppp; } $posts = get_posts($query); if(!empty($posts) && !is_wp_error($posts)) foreach($posts as $post) { $author = get_userdata($post->post_author); $tags = get_the_terms($post, 'post_tag'); $cats = get_the_terms($post, $tax ?? 'category'); $tags = self::plain_terms($tags); $cats = self::plain_terms($cats); $thid = get_post_thumbnail_id($post->ID); $pic_full = wp_get_attachment_image_src($thid, 'large'); $pic_thb = wp_get_attachment_image_src($thid, 'thumbnail'); $info[] = [ 'ID' => $post->ID, 'author' => $author ? $author->display_name : null, 'pubdate' => $post->post_date, 'post_title' => $post->post_title, 'post_excerpt' => $post->post_excerpt, 'comments' => $post->comment_count, 'image_full' => $pic_full, 'image_thb' => $pic_thb, 'tags' => $tags, 'cats' => $cats, ]; } die(json_encode($info)); } static public function plain_terms($terms) { if($terms===FALSE || !is_array($terms)) return null; $rv = array(); foreach($terms as $term) $rv[] = $term->name; return implode(chr(44), $rv); } /** * Back - Tools **/ static function get_file($file) { $path1 = get_stylesheet_directory().'/melange/'.$file; $path2 = get_template_directory() .'/melange/'.$file; $path3 = MELANGE_PATH .'/blocks/'.$file; $path4 = MELANGE_PATH .'/core/'.$file; switch(true) { case file_exists($path1): return $path1; break; case file_exists($path2): return $path2; break; case file_exists($path3): return $path3; break; case file_exists($path4): return $path4; break; } error_log('Not found by Melange «'.$file.'» in neither «'.$path1.'», «'.$path2.'», «'.$path3.'» or «'.$path4.'»'); return null; } static public function parseAspectRatio($ratio) { if(is_string($ratio)) { $ratio = explode(':', $ratio); if(count($ratio)===2) { return doubleval($ratio[0]) / doubleval($ratio[1]); } } if(is_object($ratio)) { if($ratio->coef=="custom") { return doubleval($ratio->height) / doubleval($ratio->width); } $ratio = explode(':', $ratio->coef); if(count($ratio)===2) { return doubleval($ratio[0]) / doubleval($ratio[1]); } } return 1; } static public function data_builder($data) { $rv = []; foreach($data as $k=>$v) $rv[] = 'data-'.$k.'="'.esc_attr($v).'"'; return implode(' ', $rv); } /** * Front **/ function after_setup_theme() { class_exists('\Arrakis\Assets') && $assets = \Arrakis\Assets::getInstance(); // var_dump(MELANGE_PATH, $assets); die(); $assets && $assets->add_path(30, MELANGE_PATH.'blocks/'); $assets && $assets->add_path(31, MELANGE_PATH.'core/'); } function add_assets($html) { $assets = \Arrakis\Assets::getInstance(); $assets->add_css_var('--melange-sprites', "url('https://www.glm-ett-empleo.com/wp-content/plugins/melange/blocks/sprites.svg')"); // TODO overwrittable $required = []; $logger = \Arrakis\Logger::get('melange', true); if(FALSE!==preg_match_all('|data-require-css="([^"]+)"|', $html, $required)) { // $logger->line('required', $required); if(count($required)==2) { $files = array_pop($required); // $logger->line('files raw', $files); $semicolons = array_pad([], count($files), chr(44)); $files = array_map('explode', $semicolons, $files); // $logger->line('exploded', $files); if(!empty($files)) { $files = array_merge(...$files); // $logger->line('merged', $files); $logger->line('unique', array_unique($files)); array_map([$assets, 'add_css'], array_unique($files)); $remove = array_shift($required); // $logger->line('remove', $remove); $this->html2rem = array_merge($this->html2rem, array_unique($remove)); // $logger->line('html2rem', $this->html2rem); } } } if(FALSE!==preg_match_all('|data-require-js="([^"]+)"|', $html, $required)) { // $logger->line('required', $required); if(count($required)==2) { $files = array_pop($required); // $logger->line('files raw', $files); $semicolons = array_pad([], count($files), chr(44)); $files = array_map('explode', $semicolons, $files); // $logger->line('exploded', $files); if(!empty($files)) { $files = array_merge(...$files); // $logger->line('merged', $files); array_map([$assets, 'add_js'], array_unique($files)); $remove = array_shift($required); // $logger->line('remove', $remove); $this->html2rem = array_merge($this->html2rem, array_unique($remove)); // $logger->line('html2rem', $this->html2rem); } } } // $logger->line('flatten', $this->html2rem); if(strpos($html, 'has-text-align')!==FALSE) ($assets->add_css_file(10, 'gbb_core_basics.css')); if(strpos($html, 'wp-block-audio')!==FALSE) ($assets->add_css_file(10, 'gbb_core_audio.css')); if(strpos($html, 'wp-block-button')!==FALSE) ($assets->add_css_file(10, 'gbb_core_button.css')); if(strpos($html, 'wp-block-cover')!==FALSE) ($assets->add_css_file(10, 'gbb_core_cover.css')); if(strpos($html, 'wp-block-file')!==FALSE) ($assets->add_css_file(10, 'gbb_core_file.css')); if(strpos($html, 'wp-block-gallery')!==FALSE) ($assets->add_css_file(10, 'gbb_core_gallery.css')) && ($assets->add_js_file(10, 'gbb_core_gallery.js')); if(strpos($html, 'wp-block-image')!==FALSE) ($assets->add_css_file(10, 'gbb_core_image.css')); if(strpos($html, 'wp-block-media-text')!==FALSE) ($assets->add_css_file(10, 'gbb_core_media_text.css')); if(strpos($html, 'wp-block-pullquote')!==FALSE) ($assets->add_css_file(10, 'gbb_core_pullquote.css')); if(strpos($html, 'wp-block-quote')!==FALSE) ($assets->add_css_file(10, 'gbb_core_quote.css')); if(strpos($html, 'wp-block-video')!==FALSE) ($assets->add_css_file(10, 'gbb_core_video.css')); if(strpos($html, 'wp-block-embed-vimeo')!==FALSE) ($assets->add_css_file(10, 'gbb_core_embed_vimeo.css')); if(strpos($html, 'wp-block-embed-youtube')!==FALSE) ($assets->add_css_file(10, 'gbb_core_embed_vimeo.css')); if(strpos($html, 'wp-block-embed-twitter')!==FALSE) ($assets->add_css_file(10, 'gbb_core_embed_generic.css')); if(strpos($html, 'wp-block-embed-facebook')!==FALSE) ($assets->add_css_file(10, 'gbb_core_embed_generic.css')); if(strpos($html, 'wp-block-embed-instagram')!==FALSE) ($assets->add_css_file(10, 'gbb_core_embed_generic.css')); if(strpos($html, 'wp-block-embed-wordpress')!==FALSE) ($assets->add_css_file(10, 'gbb_core_embed_generic.css')); if(strpos($html, 'mlg_mosaic')!==FALSE) ($assets->pack_exists('lightbox') && $assets->add_pack('lightbox')); if(strpos($html, 'gbb_container')!==FALSE) ($assets->add_css_file(10, 'container.css')); if(strpos($html, 'gbb_basic_grid')!==FALSE) ($assets->add_css_file(10, 'basic-grid.css')); if(strpos($html, 'gbb_features')!==FALSE) ($assets->add_css_file(10, 'features-list.css')); if(strpos($html, 'gbb_features_grid')!==FALSE) ($assets->add_css_file(10, 'features-icons.css')); if(strpos($html, 'gbb_features_block')!==FALSE) ($assets->add_css_file(10, 'features-images.css')); if(strpos($html, 'innerblocks')!==FALSE) ($assets->add_css_file(10, 'innerblocks.css')); if(strpos($html, ' gridded')!==FALSE) ($assets->add_css_file(10, 'gridded.css')); if(strpos($html, ' flexed')!==FALSE) ($assets->add_css_file(10, 'flexed.css')); if(strpos($html, 'has-text-align-center')!==FALSE) ($assets->add_css_file(10, 'gbb_core_paragraph.css')); foreach($this->var_js as $var=>$val) { $assets->add_js_var($var, $val); } } function clean_request($html) { file_put_contents(dirname(__FILE__).'/x.tmp', $html); $html = preg_replace('|aspect-ratio:([\d\.]+)px|', 'aspect-ratio:$1', $html); file_put_contents(dirname(__FILE__).'/y.tmp', $html); $html = preg_replace('|--aratio-cell(\d+):([\d\.]+)px|', '--aratio-cell$1:$2', $html); $html = preg_replace('|--aratio:([\d\.]+)px|', '--aratio:$1', $html); $html = preg_replace('|--order:([\d\.]+)px|', '--order:$1', $html); $html = str_replace($this->html2rem, '', $html); $html = str_replace('xmlnsXlink', 'xmlns:xlink', $html); $html = str_replace('xlinkHref', 'xlink:href', $html); $html = str_replace('xmlnsxlink', 'xmlns:xlink', $html); $html = str_replace('xlinkhref', 'xlink:href', $html); return $html; } /** * Front - Ajax **/ /** * Front - ShortCodes **/ function sc_style($attrs, $content) { $title = $attrs['title'] ?? ''; $value = $attrs['value'] ?? ''; if(!empty($value)) { $value = base64_decode($value); if(!empty($value)) { $assets = \Arrakis\Assets::getInstance(); $assets->add_css_code(15, $value, $title); } } } function sc_slider($atts, $content) { $this->inl_js[] = self::get_file('sc_slider.js'); $this->inl_css[] = self::get_file('sc_slider.css'); $info = base64_decode($atts['info']); $info = json_decode($info); $data = []; if(!empty($info->transition)) $data[] = 'data-transition="'.$info->transition.'"'; if(!empty($info->autoplay)) $data[] = 'data-autoplay="'.$info->autoplay.'"'; $data = implode(' ', $data); ob_start(); ?>
Warning: Undefined variable $data in /var/www/vhosts/glm-ett-empleo.com/httpdocs/wp-content/plugins/melange/melange.php on line 667
>
slides as $slide) { // var_dump($slide); $pic = wp_get_attachment_image_src($slide->mid, 'large'); $data = []; $class = []; if(!empty($slide->vail) && !empty($slide->vailcolor)) { $data[] = 'data-vailcolor="'.$slide->vailcolor.'"'; } if(!empty($slide->textshadow)) { $class[] = 'textshadow'; } $data = implode(' ', $data); $class = implode(' ', $class); ?>
Warning: Undefined variable $data in /var/www/vhosts/glm-ett-empleo.com/httpdocs/wp-content/plugins/melange/melange.php on line 683
>text)) { ?>


Warning: Undefined variable $slide in /var/www/vhosts/glm-ett-empleo.com/httpdocs/wp-content/plugins/melange/melange.php on line 685

Warning: Attempt to read property "text" on null in /var/www/vhosts/glm-ett-empleo.com/httpdocs/wp-content/plugins/melange/melange.php on line 685

arrows) { ?> dots) { ?>


Fatal error: Uncaught Error: Call to undefined function tt() in /var/www/vhosts/glm-ett-empleo.com/httpdocs/wp-content/plugins/melange/melange.php:705 Stack trace: #0 /var/www/vhosts/glm-ett-empleo.com/httpdocs/wp-settings.php(560): include_once() #1 /var/www/vhosts/glm-ett-empleo.com/httpdocs/wp-config.php(32): require_once('...') #2 /var/www/vhosts/glm-ett-empleo.com/httpdocs/wp-load.php(50): require_once('...') #3 /var/www/vhosts/glm-ett-empleo.com/httpdocs/wp-blog-header.php(13): require_once('...') #4 /var/www/vhosts/glm-ett-empleo.com/httpdocs/index.php(17): require('...') #5 {main} thrown in /var/www/vhosts/glm-ett-empleo.com/httpdocs/wp-content/plugins/melange/melange.php on line 705