| [ Index ] |
PHP Cross Reference of PageLines Framework |
[Summary view] [Print] [Text view]
1 <?php 2 3 4 class PageLinesRenderCSS { 5 6 var $lessfiles; 7 var $types; 8 var $ctimeout; 9 var $btimeout; 10 var $blog_id; 11 12 function __construct() { 13 14 global $blog_id; 15 $this->url_string = '%s/?pageless=%s'; 16 $this->ctimeout = 86400; 17 $this->btimeout = 604800; 18 $this->types = array( 'sections', 'core', 'custom' ); 19 $this->lessfiles = $this->get_core_lessfiles(); 20 self::actions(); 21 } 22 23 /** 24 * 25 * Load LESS files 26 * 27 * @package PageLines Framework 28 * @since 2.2 29 */ 30 function get_core_lessfiles(){ 31 32 $files = array( 33 'reset', 34 'pl-core', 35 'pl-wordpress', 36 'pl-plugins', 37 'grid', 38 'alerts', 39 'labels-badges', 40 'tooltip-popover', 41 'buttons', 42 'type', 43 'dropdowns', 44 'accordion', 45 'carousel', 46 'navs', 47 'modals', 48 'thumbnails', 49 'component-animations', 50 'utilities', 51 'pl-objects', 52 'pl-tables', 53 'wells', 54 'forms', 55 'breadcrumbs', 56 'close', 57 'pager', 58 'pagination', 59 'progress-bars', 60 'icons', 61 'responsive', 62 ); 63 return $files; 64 } 65 66 /** 67 * 68 * Dynamic mode, CSS is loaded to a file using wp_rewrite 69 * 70 * @package PageLines Framework 71 * @since 2.2 72 */ 73 private function actions() { 74 75 global $pagelines_template; 76 77 add_filter( 'query_vars', array( &$this, 'pagelines_add_trigger' ) ); 78 add_action( 'template_redirect', array( &$this, 'pagelines_less_trigger' ) , 15); 79 add_action( 'template_redirect', array( &$this, 'less_file_mode' ) ); 80 add_action( 'wp_enqueue_scripts', array( &$this, 'load_less_css' ) ); 81 add_action( 'pagelines_head_last', array( &$this, 'draw_inline_custom_css' ) , 25 ); 82 add_action( 'wp_head', array( &$pagelines_template, 'print_template_section_head' ), 12 ); 83 add_action( 'pl_scripts_on_ready', array( &$pagelines_template, 'print_on_ready_scripts' ), 12 ); 84 add_action( 'wp_head', array( &$this, 'do_background_image' ), 13 ); 85 add_action( 'extend_flush', array( &$this, 'flush_version' ), 1 ); 86 add_filter( 'pagelines_insert_core_less', array( &$this, 'pagelines_insert_core_less_callback' ) ); 87 add_action( 'admin_notices', array(&$this,'less_error_report') ); 88 add_action( 'wp_before_admin_bar_render', array( &$this, 'less_css_bar' ) ); 89 if ( defined( 'PL_CSS_FLUSH' ) ) 90 do_action( 'extend_flush' ); 91 do_action( 'pagelines_max_mem' ); 92 } 93 94 function less_file_mode() { 95 96 global $blog_id; 97 if ( ! get_theme_mod( 'pl_save_version' ) ) 98 return; 99 100 if( defined( 'LESS_FILE_MODE' ) && false == LESS_FILE_MODE ) 101 return; 102 103 if( defined( 'PL_NO_DYNAMIC_URL' ) && true == PL_NO_DYNAMIC_URL ) 104 return; 105 106 $folder = $this->get_css_dir( 'path' ); 107 $url = $this->get_css_dir( 'url' ); 108 109 $file = sprintf( 'compiled-css-%s.css', get_theme_mod( 'pl_save_version' ) ); 110 111 if( file_exists( trailingslashit( $folder ) . $file ) ){ 112 define( 'DYNAMIC_FILE_URL', trailingslashit( $url ) . $file ); 113 return; 114 } 115 116 if( false == $this->check_posix() ) 117 return; 118 119 $a = $this->get_compiled_core(); 120 $b = $this->get_compiled_sections(); 121 $gfonts = preg_match( '#(@import[^;]*;)#', $a['type'], $g ); 122 $out = ''; 123 if ( $gfonts ) { 124 $a['core'] = sprintf( "%s\n%s", $g[1], $a['core'] ); 125 $a['type'] = str_replace( $g[1], '', $a['type'] ); 126 } 127 $out .= $this->minify( $a['core'] ); 128 $out .= $this->minify( $b['sections'] ); 129 $out .= $this->minify( $a['type'] ); 130 $out .= $this->minify( $a['dynamic'] ); 131 $mem = ( function_exists('memory_get_usage') ) ? round( memory_get_usage() / 1024 / 1024, 2 ) : 0; 132 if ( is_multisite() ) 133 $blog = sprintf( ' on blog [%s]', $blog_id ); 134 else 135 $blog = ''; 136 $out .= sprintf( __( '%s/* CSS was compiled at %s and took %s seconds using %sMB of unicorn dust%s.*/', 'pagelines' ), "\n", date( DATE_RFC822, $a['time'] ), $a['c_time'], $mem, $blog ); 137 $this->write_css_file( $out ); 138 } 139 140 function check_posix() { 141 142 if ( true == apply_filters( 'render_css_posix_', false ) ) 143 return true; 144 145 if ( ! function_exists( 'posix_geteuid') || ! function_exists( 'posix_getpwuid' ) ) 146 return false; 147 148 $User = posix_getpwuid( posix_geteuid() ); 149 $File = posix_getpwuid( fileowner( __FILE__ ) ); 150 if( $User['name'] !== $File['name'] ) 151 return false; 152 153 return true; 154 } 155 156 function get_css_dir( $type = '' ) { 157 158 $folder = apply_filters( 'pagelines_css_upload_dir', wp_upload_dir() ); 159 160 if( 'path' == $type ) 161 return trailingslashit( $folder['basedir'] ) . 'pagelines'; 162 else 163 return trailingslashit( $folder['baseurl'] ) . 'pagelines'; 164 } 165 166 function write_css_file( $txt ){ 167 168 add_filter('request_filesystem_credentials', '__return_true' ); 169 170 $method = ''; 171 $url = 'themes.php?page=pagelines'; 172 173 $folder = $this->get_css_dir( 'path' ); 174 $file = sprintf( 'compiled-css-%s.css', get_theme_mod( 'pl_save_version' ) ); 175 176 if( !is_dir( $folder ) ) 177 wp_mkdir_p( $folder ); 178 179 include_once( ABSPATH . 'wp-admin/includes/file.php' ); 180 181 if ( is_writable( $folder ) ){ 182 $creds = request_filesystem_credentials($url, $method, false, false, null); 183 if ( ! WP_Filesystem($creds) ) 184 return false; 185 } 186 187 global $wp_filesystem; 188 if( is_object( $wp_filesystem ) ) 189 $wp_filesystem->put_contents( trailingslashit( $folder ) . $file, $txt, FS_CHMOD_FILE); 190 else 191 return false; 192 $url = $this->get_css_dir( 'url' ); 193 194 define( 'DYNAMIC_FILE_URL', sprintf( '%s/%s', $url, $file ) ); 195 } 196 197 function do_background_image() { 198 199 global $pagelines_ID; 200 if ( is_archive() || is_home() ) 201 $pagelines_ID = null; 202 $oset = array( 'post_id' => $pagelines_ID ); 203 $oid = 'page_background_image'; 204 $sel = cssgroup('page_background_image'); 205 if( !ploption('supersize_bg', $oset) && ploption( $oid . '_url', $oset )){ 206 207 $bg_repeat = (ploption($oid.'_repeat', $oset)) ? ploption($oid.'_repeat', $oset) : 'no-repeat'; 208 $bg_attach = (ploption($oid.'_attach', $oset)) ? ploption($oid.'_attach', $oset): 'scroll'; 209 $bg_pos_vert = (ploption($oid.'_pos_vert', $oset) || ploption($oid.'_pos_vert', $oset) == 0 ) ? (int) ploption($oid.'_pos_vert', $oset) : '0'; 210 $bg_pos_hor = (ploption($oid.'_pos_hor', $oset) || ploption($oid.'_pos_hor', $oset) == 0 ) ? (int) ploption($oid.'_pos_hor', $oset) : '50'; 211 $bg_selector = (ploption($oid.'_selector', $oset)) ? ploption($oid.'_selector', $oset) : $sel; 212 $bg_url = ploption($oid.'_url', $oset); 213 214 $css = sprintf('%s{ background-image:url(%s);', $bg_selector, $bg_url); 215 $css .= sprintf('background-repeat: %s;', $bg_repeat); 216 $css .= sprintf('background-attachment: %s;', $bg_attach); 217 $css .= sprintf('background-position: %s%% %s%%;}', $bg_pos_hor, $bg_pos_vert); 218 echo inline_css_markup( 'pagelines-page-bg', $css ); 219 220 } 221 } 222 223 224 function less_css_bar() { 225 foreach ( $this->types as $t ) { 226 if ( ploption( "pl_less_error_{$t}" ) ) { 227 228 global $wp_admin_bar; 229 $wp_admin_bar->add_menu( array( 230 'parent' => false, 231 'id' => 'less_error', 232 'title' => sprintf( '<span class="label label-warning pl-admin-bar-label">%s</span>', __( 'LESS Compile error!', 'pagelines' ) ), 233 'href' => admin_url( PL_SETTINGS_URL ), 234 'meta' => false 235 )); 236 $wp_admin_bar->add_menu( array( 237 'parent' => 'less_error', 238 'id' => 'less_message', 239 'title' => sprintf( __( 'Error in %s Less code: %s', 'pagelines' ), $t, ploption( "pl_less_error_{$t}" ) ), 240 'href' => admin_url( PL_SETTINGS_URL ), 241 'meta' => false 242 )); 243 } 244 } 245 } 246 247 function less_error_report() { 248 249 $default = '<div class="updated fade update-nag"><div style="text-align:left"><h4>PageLines %s LESS/CSS error.</h4>%s</div></div>'; 250 251 foreach ( $this->types as $t ) { 252 if ( ploption( "pl_less_error_{$t}" ) ) 253 printf( $default, ucfirst( $t ), ploption( "pl_less_error_{$t}" ) ); 254 } 255 } 256 257 /** 258 * 259 * Get custom CSS 260 * 261 * @package PageLines Framework 262 * @since 2.2 263 */ 264 function draw_inline_custom_css() { 265 266 $a = $this->get_compiled_custom(); 267 if ( '' != $a['custom'] ) 268 return inline_css_markup( 'pagelines-custom', rtrim( $this->minify( $a['custom'] ) ) ); 269 } 270 271 /** 272 * 273 * Draw dynamic CSS inline. 274 * 275 * @package PageLines Framework 276 * @since 2.2 277 */ 278 function draw_inline_dynamic_css() { 279 280 if( has_filter( 'disable_dynamic_css' ) ) 281 return; 282 283 $css = $this->get_dynamic_css(); 284 inline_css_markup('dynamic-css', $css['dynamic'] ); 285 } 286 287 /** 288 * 289 * Get Dynamic CSS 290 * 291 * @package PageLines Framework 292 * @since 2.2 293 * 294 */ 295 function get_dynamic_css(){ 296 297 $pagelines_dynamic_css = new PageLinesCSS; 298 299 $pagelines_dynamic_css->typography(); 300 301 $typography = $pagelines_dynamic_css->css; 302 303 unset( $pagelines_dynamic_css->css ); 304 $pagelines_dynamic_css->layout(); 305 $pagelines_dynamic_css->options(); 306 307 $out = array( 308 'type' => $typography, 309 'dynamic' => apply_filters('pl-dynamic-css', $pagelines_dynamic_css->css) 310 ); 311 return $out; 312 } 313 314 /** 315 * 316 * Enqueue the dynamic css file. 317 * 318 * @package PageLines Framework 319 * @since 2.2 320 */ 321 function load_less_css() { 322 323 wp_register_style( 'pagelines-less', $this->get_dynamic_url(), false, null, 'all' ); 324 wp_enqueue_style( 'pagelines-less' ); 325 } 326 327 function get_dynamic_url() { 328 329 global $blog_id; 330 $version = get_theme_mod( "pl_save_version" ); 331 332 if ( ! $version ) 333 $version = '1'; 334 335 if ( is_multisite() ) 336 $id = $blog_id; 337 else 338 $id = '1'; 339 340 $version = sprintf( '%s_%s', $id, $version ); 341 342 $parent = apply_filters( 'pl_parent_css_url', PL_PARENT_URL ); 343 344 if ( '' != get_option('permalink_structure') && ! $this->check_compat() ) 345 $url = sprintf( '%s/pagelines-compiled-css-%s/', $parent, $version ); 346 else { 347 348 if ( false !== ( strpos( $this->get_base_url(), '?' ) ) ) 349 $this->url_string = '%s&pageless=%s'; 350 351 $url = sprintf( $this->url_string, untrailingslashit( $this->get_base_url() ), $version ); 352 } 353 if ( defined( 'DYNAMIC_FILE_URL' ) ) 354 $url = DYNAMIC_FILE_URL; 355 356 if ( has_action( 'pl_force_ssl' ) ) 357 $url = str_replace( 'http://', 'https://', $url ); 358 359 return apply_filters( 'pl_dynamic_css_url', $url ); 360 } 361 362 function get_base_url() { 363 364 if(function_exists('icl_get_home_url')) { 365 return icl_get_home_url(); 366 } 367 368 return get_home_url(); 369 } 370 371 function check_compat() { 372 373 if( defined( 'LESS_FILE_MODE' ) && false == LESS_FILE_MODE && is_multisite() ) 374 return true; 375 376 if ( function_exists( 'icl_get_home_url' ) ) 377 return true; 378 379 if ( defined( 'PLL_INC') ) 380 return true; 381 382 if ( ! VPRO ) 383 return true; 384 385 if ( defined( 'PL_NO_DYNAMIC_URL' ) ) 386 return true; 387 388 if( site_url() !== get_home_url() ) 389 return true; 390 391 if ( 'nginx' == substr($_SERVER['SERVER_SOFTWARE'], 0, 5) ) 392 return false; 393 394 global $is_apache; 395 if ( ! $is_apache ) 396 return true; 397 } 398 399 /** 400 * 401 * Get compiled/cached CSS 402 * 403 * @package PageLines Framework 404 * @since 2.2 405 */ 406 function get_compiled_core() { 407 408 if ( is_array( $a = get_transient( 'pagelines_core_css' ) ) ) { 409 return $a; 410 } else { 411 412 $start_time = microtime(true); 413 build_pagelines_layout(); 414 415 $dynamic = $this->get_dynamic_css(); 416 417 $core_less = $this->get_core_lesscode(); 418 419 $pless = new PagelinesLess(); 420 421 $core_less = $pless->raw_less( $core_less ); 422 423 $end_time = microtime(true); 424 $a = array( 425 'dynamic' => $dynamic['dynamic'], 426 'type' => $dynamic['type'], 427 'core' => $core_less, 428 'c_time' => round(($end_time - $start_time),5), 429 'time' => time() 430 ); 431 if ( strpos( $core_less, 'PARSE ERROR' ) === false ) { 432 set_transient( 'pagelines_core_css', $a, $this->ctimeout ); 433 set_transient( 'pagelines_core_css_backup', $a, $this->btimeout ); 434 return $a; 435 } else { 436 return get_transient( 'pagelines_core_css_backup' ); 437 } 438 } 439 } 440 441 /** 442 * 443 * Get compiled/cached CSS 444 * 445 * @package PageLines Framework 446 * @since 2.2 447 */ 448 function get_compiled_sections() { 449 450 if ( is_array( $a = get_transient( 'pagelines_sections_css' ) ) ) { 451 return $a; 452 } else { 453 454 $start_time = microtime(true); 455 build_pagelines_layout(); 456 457 $sections = $this->get_all_active_sections(); 458 459 $pless = new PagelinesLess(); 460 $sections = $pless->raw_less( $sections, 'sections' ); 461 $end_time = microtime(true); 462 $a = array( 463 'sections' => $sections, 464 'c_time' => round(($end_time - $start_time),5), 465 'time' => time() 466 ); 467 if ( strpos( $sections, 'PARSE ERROR' ) === false ) { 468 set_transient( 'pagelines_sections_css', $a, $this->ctimeout ); 469 set_transient( 'pagelines_sections_css_backup', $a, $this->btimeout ); 470 return $a; 471 } else { 472 return get_transient( 'pagelines_sections_css_backup' ); 473 } 474 } 475 } 476 477 478 /** 479 * 480 * Get compiled/cached CSS 481 * 482 * @package PageLines Framework 483 * @since 2.2 484 */ 485 function get_compiled_custom() { 486 487 if ( is_array( $a = get_transient( 'pagelines_custom_css' ) ) ) { 488 return $a; 489 } else { 490 491 $start_time = microtime(true); 492 build_pagelines_layout(); 493 494 $custom = stripslashes( ploption( 'customcss' ) ); 495 496 $pless = new PagelinesLess(); 497 $custom = $pless->raw_less( $custom, 'custom' ); 498 $end_time = microtime(true); 499 $a = array( 500 'custom' => $custom, 501 'c_time' => round(($end_time - $start_time),5), 502 'time' => time() 503 ); 504 if ( strpos( $custom, 'PARSE ERROR' ) === false ) { 505 set_transient( 'pagelines_custom_css', $a, $this->ctimeout ); 506 set_transient( 'pagelines_custom_css_backup', $a, $this->btimeout ); 507 return $a; 508 } else { 509 return get_transient( 'pagelines_custom_css_backup' ); 510 } 511 } 512 } 513 514 /** 515 * 516 * Get Core LESS code 517 * 518 * @package PageLines Framework 519 * @since 2.2 520 */ 521 function get_core_lesscode() { 522 523 return $this->load_core_cssfiles( apply_filters( 'pagelines_core_less_files', $this->lessfiles ) ); 524 } 525 526 /** 527 * 528 * Helper for get_core_less_code() 529 * 530 * @package PageLines Framework 531 * @since 2.2 532 */ 533 function load_core_cssfiles( $files ) { 534 535 $code = ''; 536 foreach( $files as $less ) { 537 538 $code .= PageLinesLess::load_less_file( $less ); 539 } 540 return apply_filters( 'pagelines_insert_core_less', $code ); 541 } 542 543 /** 544 * 545 * Add rewrite. 546 * 547 * @package PageLines Framework 548 * @since 2.2 549 */ 550 function pagelines_less_rewrite( $wp_rewrite ) { 551 552 $less_rule = array( 553 '(.*)pagelines-compiled-css' => '/?pageless=1' 554 ); 555 $wp_rewrite->rules = $less_rule + $wp_rewrite->rules; 556 } 557 558 // flush_rules() if our rules are not yet included 559 function check_rules(){ 560 $rules = get_option( 'rewrite_rules' ); 561 if ( ! isset( $rules['(.*)pagelines-compiled-css'] ) ) { 562 global $wp_rewrite; 563 $wp_rewrite->flush_rules(); 564 } 565 } 566 567 function pagelines_add_trigger( $vars ) { 568 $vars[] = 'pageless'; 569 return $vars; 570 } 571 572 function pagelines_less_trigger() { 573 global $blog_id; 574 if( intval( get_query_var( 'pageless' ) ) ) { 575 header( 'Content-type: text/css' ); 576 header( 'Expires: ' ); 577 header( 'Cache-Control: max-age=604100, public' ); 578 579 $a = $this->get_compiled_core(); 580 $b = $this->get_compiled_sections(); 581 $gfonts = preg_match( '#(@import[^;]*;)#', $a['type'], $g ); 582 583 if ( $gfonts ) { 584 $a['core'] = sprintf( "%s\n%s", $g[1], $a['core'] ); 585 $a['type'] = str_replace( $g[1], '', $a['type'] ); 586 } 587 echo $this->minify( $a['core'] ); 588 echo $this->minify( $b['sections'] ); 589 echo $this->minify( $a['type'] ); 590 echo $this->minify( $a['dynamic'] ); 591 $mem = ( function_exists('memory_get_usage') ) ? round( memory_get_usage() / 1024 / 1024, 2 ) : 0; 592 if ( is_multisite() ) 593 $blog = sprintf( ' on blog [%s]', $blog_id ); 594 else 595 $blog = ''; 596 echo sprintf( __( '%s/* CSS was compiled at %s and took %s seconds using %sMB of unicorn dust%s.*/', 'pagelines' ), "\n", date( DATE_RFC822, $a['time'] ), $a['c_time'], $mem, $blog ); 597 die(); 598 } 599 } 600 601 /** 602 * 603 * Minify 604 * 605 * @package PageLines Framework 606 * @since 2.2 607 */ 608 function minify( $css ) { 609 if( is_pl_debug() ) 610 return $css; 611 612 if( ! ploption( 'pl_minify') ) 613 return $css; 614 615 $data = $css; 616 617 $data = preg_replace( '#/\*.*?\*/#s', '', $data ); 618 // remove new lines \\n, tabs and \\r 619 $data = preg_replace('/(\t|\r|\n)/', '', $data); 620 // replace multi spaces with singles 621 $data = preg_replace('/(\s+)/', ' ', $data); 622 //Remove empty rules 623 $data = preg_replace('/[^}{]+{\s?}/', '', $data); 624 // Remove whitespace around selectors and braces 625 $data = preg_replace('/\s*{\s*/', '{', $data); 626 // Remove whitespace at end of rule 627 $data = preg_replace('/\s*}\s*/', '}', $data); 628 // Just for clarity, make every rules 1 line tall 629 $data = preg_replace('/}/', "}\n", $data); 630 $data = str_replace( ';}', '}', $data ); 631 $data = str_replace( ', ', ',', $data ); 632 $data = str_replace( '; ', ';', $data ); 633 $data = str_replace( ': ', ':', $data ); 634 $data = preg_replace( '#\s+#', ' ', $data ); 635 636 if ( ! preg_last_error() ) 637 return $data; 638 else 639 return $css; 640 } 641 642 /** 643 * 644 * Flush rewrites/cached css 645 * 646 * @package PageLines Framework 647 * @since 2.2 648 */ 649 function flush_version( $rules = true ) { 650 651 $types = array( 'sections', 'core', 'custom' ); 652 653 $folder = trailingslashit( self::get_css_dir( 'path' ) ); 654 655 $file = sprintf( 'compiled-css-%s.css', get_theme_mod( 'pl_save_version' ) ); 656 657 if( is_file( $folder . $file ) ) 658 @unlink( $folder . $file ); 659 660 // Attempt to flush super-cache and w3 cache. 661 662 if( function_exists( 'prune_super_cache' ) ) { 663 global $cache_path; 664 $GLOBALS["super_cache_enabled"] = 1; 665 prune_super_cache( $cache_path . 'supercache/', true ); 666 prune_super_cache( $cache_path, true ); 667 } 668 if( class_exists('W3_Plugin_TotalCacheAdmin') ) { 669 $plugin_totalcacheadmin = & w3_instance('W3_Plugin_TotalCacheAdmin'); 670 671 $plugin_totalcacheadmin->flush_all(); 672 } 673 674 if( $rules ) 675 flush_rewrite_rules( true ); 676 set_theme_mod( 'pl_save_version', time() ); 677 678 $types = array( 'sections', 'core', 'custom' ); 679 680 foreach( $types as $t ) { 681 682 $compiled = get_transient( "pagelines_{$t}_css" ); 683 $backup = get_transient( "pagelines_{$t}_css_backup" ); 684 685 if ( ! is_array( $backup ) && is_array( $compiled ) && strpos( $compiled[$t], 'PARSE ERROR' ) === false ) 686 set_transient( "pagelines_{$t}_css_backup", $compiled, 604800 ); 687 688 delete_transient( "pagelines_{$t}_css" ); 689 } 690 } 691 692 function pagelines_insert_core_less_callback( $code ) { 693 694 global $pagelines_raw_lesscode_external; 695 $out = ''; 696 if ( is_array( $pagelines_raw_lesscode_external ) && ! empty( $pagelines_raw_lesscode_external ) ) { 697 698 foreach( $pagelines_raw_lesscode_external as $file ) { 699 700 if( is_file( $file ) ) 701 $out .= pl_file_get_contents( $file ); 702 } 703 return $code . $out; 704 } 705 return $code; 706 } 707 708 function get_all_active_sections() { 709 710 $out = ''; 711 global $load_sections; 712 $available = $load_sections->pagelines_register_sections( true, true ); 713 714 $disabled = get_option( 'pagelines_sections_disabled', array() ); 715 716 /* 717 * Filter out disabled sections 718 */ 719 foreach( $disabled as $type => $data ) 720 if ( isset( $disabled[$type] ) ) 721 foreach( $data as $class => $state ) 722 unset( $available[$type][ $class ] ); 723 724 /* 725 * We need to reorder the array so sections css is loaded in the right order. 726 * Core, then pagelines-sections, followed by anything else. 727 */ 728 $sections = array(); 729 $sections['parent'] = $available['parent']; 730 unset( $available['parent'] ); 731 $sections['child'] = (array) $available['child']; 732 unset( $available['child'] ); 733 if ( is_array( $available ) ) 734 $sections = array_merge( $sections, $available ); 735 foreach( $sections as $t ) { 736 foreach( $t as $key => $data ) { 737 if ( $data['less'] && $data['loadme'] ) { 738 if ( is_file( $data['base_dir'] . '/style.less' ) ) 739 $out .= pl_file_get_contents( $data['base_dir'] . '/style.less' ); 740 elseif( is_file( $data['base_dir'] . '/color.less' )) 741 $out .= pl_file_get_contents( $data['base_dir'] . '/color.less' ); 742 } 743 } 744 } 745 return apply_filters('pagelines_lesscode', $out); 746 } 747 748 } //end of PageLinesRenderCSS 749 750 function pagelines_insert_core_less( $file ) { 751 752 global $pagelines_raw_lesscode_external; 753 754 if( !is_array( $pagelines_raw_lesscode_external ) ) 755 $pagelines_raw_lesscode_external = array(); 756 757 $pagelines_raw_lesscode_external[] = $file; 758 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Apr 6 23:00:27 2013 | Cross-referenced by PHPXref 0.7.1 |