function lab_1cl_demo_installer_admin_init() { if (lab_get('page') == 'laborator_demo_content_installer' && ($pack_name = lab_get('install-pack'))) { $pack = lab_1cl_demo_installer_get_pack($pack_name); if ($pack) { if (is_plugin_active('wordpress-importer/wordpress-importer.php')) { deactivate_plugins(array('wordpress-importer/wordpress-importer.php')); update_option('lab_should_activate_wp_importer', true); wp_redirect(admin_url('admin.php?page=laborator_demo_content_installer&install-pack="' . sanitize_title($pack_name))); exit; } require 'demo-content-install-pack.php'; die; } } }
function laborator_coming_soon_mode() { global $current_user; $maintenance_mode = get_data('maintenance_mode'); $coming_soon_mode = get_data('coming_soon_mode'); $manage_options = current_user_can('manage_options'); if ($coming_soon_mode && $manage_options == false || lab_get('view-coming-soon')) { get_template_part('coming-soon-mode'); die; } if ($maintenance_mode && $manage_options == false || lab_get('view-maintenance')) { get_template_part('maintenance-mode'); die; } }
$portfolio_query_args['order'] = 'ASC'; foreach ($masonry_items_list as $item) { if (isset($item['item']) && $item['item'] instanceof WP_Post) { $portfolio_query_args['post__in'][] = $item['item']->ID; } } } // Posts per page if ($items_per_page && $items_per_page != 0) { $portfolio_query_args['posts_per_page'] = $items_per_page; } else { $portfolio_query_args['posts_per_page'] = get_option('posts_per_page'); } $portfolio_query_args['posts_per_page'] = apply_filters('lab_portfolio_items_per_page', $portfolio_query_args['posts_per_page']); // Get Category if ($category_id = lab_get('portfolio-category')) { $portfolio_query_args['portfolio_category'] = $category_id; } // Current Page if ($page > $paged) { $paged = $page; } if ($paged > 1) { $portfolio_query_args['paged'] = $paged; } // Unset unwanted query arguments like page name and id if (isset($portfolio_query_args['pagename'])) { unset($portfolio_query_args['pagename']); } if (isset($portfolio_query_args['page_id'])) { unset($portfolio_query_args['page_id']);
function laborator_custom_css_page() { if (isset($_POST['laborator_custom_css'])) { $laborator_custom_css = post('laborator_custom_css'); laborator_set_custom_css($laborator_custom_css); $success = true; } if (isset($_POST['laborator_custom_css_lg'])) { $laborator_custom_css = post('laborator_custom_css_lg'); laborator_set_custom_css($laborator_custom_css, 'lg'); $success = true; } if (isset($_POST['laborator_custom_css_md'])) { $laborator_custom_css = post('laborator_custom_css_md'); laborator_set_custom_css($laborator_custom_css, 'md'); $success = true; } if (isset($_POST['laborator_custom_css_sm'])) { $laborator_custom_css = post('laborator_custom_css_sm'); laborator_set_custom_css($laborator_custom_css, 'sm'); $success = true; } if (isset($_POST['laborator_custom_css_xs'])) { $laborator_custom_css = post('laborator_custom_css_xs'); laborator_set_custom_css($laborator_custom_css, 'xs'); $success = true; } if (isset($_POST['laborator_custom_css_less'])) { $laborator_custom_css = post('laborator_custom_css_less'); laborator_set_custom_css($laborator_custom_css, 'less'); $success = true; } if (isset($_POST['laborator_custom_css_sass'])) { $laborator_custom_css = post('laborator_custom_css_sass'); laborator_set_custom_css($laborator_custom_css, 'sass'); $success = true; } if (isset($success)) { ?> <div class="updated"> <p> <strong>Changes have been saved.</strong> </p> </div> <?php } $codemirror_path = THEMEURL . "inc/lib/laborator/custom-css-lib/codemirror-4.7/"; $custom_css = laborator_get_custom_css(); $custom_css_lg = laborator_get_custom_css('lg'); $custom_css_md = laborator_get_custom_css('md'); $custom_css_sm = laborator_get_custom_css('sm'); $custom_css_xs = laborator_get_custom_css('xs'); $custom_css_less = laborator_get_custom_css('less'); $custom_css_sass = laborator_get_custom_css('sass'); $current_tab = 'main'; if (lab_get('tab') == 'responsive') { $current_tab = 'responsive'; } if (lab_get('tab') == 'less') { $current_tab = 'less'; } if (lab_get('tab') == 'sass') { $current_tab = 'sass'; } ?> <!-- CodeMirror --> <script src="<?php echo $codemirror_path . "lib/codemirror.js"; ?> "></script> <link rel="stylesheet" href="<?php echo $codemirror_path . "lib/codemirror.css"; ?> " type="text/css"> <link rel="stylesheet" href="<?php echo $codemirror_path . "theme/neo.css"; ?> " type="text/css"> <!-- Search --> <script src="<?php echo $codemirror_path . "addon/search/searchcursor.js"; ?> "></script> <script src="<?php echo $codemirror_path . "addon/search/search.js"; ?> "></script> <!-- Dialog --> <script src="<?php echo $codemirror_path . "addon/dialog/dialog.js"; ?> "></script> <link rel="stylesheet" href="<?php echo $codemirror_path . "addon/dialog/dialog.css"; ?> " type="text/css"> <!-- Mode --> <script src="<?php echo $codemirror_path . "mode/css/css.js"; ?> "></script> <div class="wrap"> <h2 id="main-title">Custom CSS</h2> <h2 class="nav-tab-wrapper woo-nav-tab-wrapper"> <a href="?page=<?php echo lab_get('page'); ?> &tab=main" class="nav-tab<?php echo $current_tab == 'main' ? ' nav-tab-active' : ''; ?> ">General Style</a> <a href="?page=<?php echo lab_get('page'); ?> &tab=responsive" class="nav-tab<?php echo $current_tab == 'responsive' ? ' nav-tab-active' : ''; ?> ">Responsive</a> <a href="?page=<?php echo lab_get('page'); ?> &tab=less" class="nav-tab<?php echo $current_tab == 'less' ? ' nav-tab-active' : ''; ?> ">LESS</a> <a href="?page=<?php echo lab_get('page'); ?> &tab=sass" class="nav-tab<?php echo $current_tab == 'sass' ? ' nav-tab-active' : ''; ?> ">SASS</a> <a href="<?php echo home_url(); ?> " target="_blank" class="nav-tab nav-tab-right">Preview Site</a> </h2> <?php if ($current_tab == 'main') { ?> <h3>Apply your own stylesheet here</h3> <form method="post"> <textarea class="large-text code" id="laborator_custom_css" name="laborator_custom_css" rows="10" placeholder="Loading code editor..."><?php echo $custom_css; ?> </textarea> <button type="submit" class="button button-primary save" name="save_changes">Save Changes</button> </form> <script type="text/javascript"> window.onload = function() { var cmirror = CodeMirror.fromTextArea(document.getElementById("laborator_custom_css"), { lineNumbers: true, autofocus: true, mode: "css", theme: "neo", tabSize: 4, indentUnit: 4, indentWithTabs: true }), body = document.body, html = document.documentElement; var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ) - 340; cmirror.setSize("100%", height); } </script> <?php } elseif ($current_tab == 'responsive') { ?> <h3>Targeting custom screen sizes</h3> <form method="post"> <h4> <small> Minimum Screen Size: <strong>1200px</strong> </small> LG - Large Screen </h4> <textarea class="large-text code" id="laborator_custom_css_lg" name="laborator_custom_css_lg" rows="10" placeholder="Loading code editor..."><?php echo $custom_css_lg; ?> </textarea> <h4> <small> Minimum Screen Size: <strong>992px</strong> </small> MD - Medium Screen </h4> <textarea class="large-text code" id="laborator_custom_css_md" name="laborator_custom_css_md" rows="10" placeholder="Loading code editor..."><?php echo $custom_css_md; ?> </textarea> <h4> <small> Minimum Screen Size: <strong>768px</strong> </small> SM - Small Screen </h4> <textarea class="large-text code" id="laborator_custom_css_sm" name="laborator_custom_css_sm" rows="10" placeholder="Loading code editor..."><?php echo $custom_css_sm; ?> </textarea> <h4> <small> Maximum Screen Size: <strong>768px</strong> </small> XS - Extra Small Screen </h4> <textarea class="large-text code" id="laborator_custom_css_xs" name="laborator_custom_css_xs" rows="10" placeholder="Loading code editor..."><?php echo $custom_css_xs; ?> </textarea> <script type="text/javascript"> window.onload = function() { var cmirror1 = CodeMirror.fromTextArea(document.getElementById("laborator_custom_css_lg"), {lineNumbers: true, mode: "css", theme: "neo", tabSize: 4, indentUnit: 4, indentWithTabs: true}), cmirror2 = CodeMirror.fromTextArea(document.getElementById("laborator_custom_css_md"), {lineNumbers: true, mode: "css", theme: "neo", tabSize: 4, indentUnit: 4, indentWithTabs: true}), cmirror3 = CodeMirror.fromTextArea(document.getElementById("laborator_custom_css_sm"), {lineNumbers: true, mode: "css", theme: "neo", tabSize: 4, indentUnit: 4, indentWithTabs: true}), cmirror4 = CodeMirror.fromTextArea(document.getElementById("laborator_custom_css_xs"), {lineNumbers: true, mode: "css", theme: "neo", tabSize: 4, indentUnit: 4, indentWithTabs: true}); cmirror1.setSize("100%", "100%"); cmirror2.setSize("100%", "100%"); cmirror3.setSize("100%", "100%"); cmirror4.setSize("100%", "100%"); } </script> <button type="submit" class="button button-primary save" name="save_changes">Save Changes</button> </form> <?php } elseif ($current_tab == 'less') { ?> <h3>Apply your own style in <a href="http://www.lesscss.org/" target="_blank">LESS</a> language</h3> <form method="post"> <textarea class="large-text code" id="laborator_custom_css_less" name="laborator_custom_css_less" rows="10" placeholder="Loading code editor..."><?php echo $custom_css_less; ?> </textarea> <button type="submit" class="button button-primary save" name="save_changes">Save Changes</button> </form> <script src="<?php echo $codemirror_path . "mode/sass/sass.js"; ?> "></script> <script type="text/javascript"> window.onload = function() { var cmirror = CodeMirror.fromTextArea(document.getElementById("laborator_custom_css_less"), { lineNumbers: true, autofocus: true, mode: "sass", theme: "neo", tabSize: 4, indentUnit: 4, indentWithTabs: true }), body = document.body, html = document.documentElement; var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ) - 340; cmirror.setSize("100%", height); } </script> <?php } elseif ($current_tab == 'sass') { ?> <h3>Apply your own style in <a href="http://sass-lang.com/" target="_blank">SASS</a> language</h3> <form method="post"> <textarea class="large-text code" id="laborator_custom_css_sass" name="laborator_custom_css_sass" rows="10" placeholder="Loading code editor..."><?php echo $custom_css_sass; ?> </textarea> <button type="submit" class="button button-primary save" name="save_changes">Save Changes</button> </form> <script src="<?php echo $codemirror_path . "mode/sass/sass.js"; ?> "></script> <script type="text/javascript"> window.onload = function() { var cmirror = CodeMirror.fromTextArea(document.getElementById("laborator_custom_css_sass"), { lineNumbers: true, autofocus: true, mode: "sass", theme: "neo", tabSize: 4, indentUnit: 4, indentWithTabs: true }), body = document.body, html = document.documentElement; var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ) - 340; cmirror.setSize("100%", height); } </script> <?php } ?> <p class="explain"> For better experience with CSS Editor:<br /> Start Searching: <code>Ctrl-F / Cmd-F</code> <br /> Find next: <code>Ctrl-G / Cmd-G</code> <br /> Find previous: <code>Shift-Ctrl-G / Shift-Cmd-G</code> <br /> Replace: <code>Shift-Ctrl-F / Cmd-Option-F</code> <br /> Replace all: <code>Shift-Ctrl-R / Shift-Cmd-Option-F</code> </p> <p class="footer"> * The CSS written here will not be lost when you update the theme. <br /> * Please be aware as by doing customisation (in theme files) if something happens like miss-editing files the responsibility is yours and we won't support you on finding the problem, as we are only guiding you how to get the results you need. <br /> * Sometimes you need to add <code>!important</code> rule to overwrite the default value set by theme, example: <code>font-size: 18px <strong>!important</strong></code>. </p> <p class="laborator-copyrights clear">© <strong>Custom CSS</strong> plugin created by <a href="http://laborator.co/" target="_blank">Laborator.co</a></p> <style> #main-title { margin-left: 10px; margin-bottom: 5px; } form h4 { margin: 0; margin-bottom: 3px; padding: 5px 15px; text-transform: uppercase; background: #fff; border: 1px solid #e0e0e0; } form h4 small { float: right; color: #999; } form h4 small strong { color: #111; text-decoration: underline; } form .CodeMirror + h4, form textarea + h4 { margin-top: 25px !important; } .CodeMirror { border: 1px solid #e0e0e0; min-height: 150px; } .CodeMirror .CodeMirror-scroll { min-height: 150px; } .wp-core-ui .button-primary.save { margin-top: 15px; } .updated { margin-top: 15px !important; } p.footer { margin-top: 25px; font-size: 11px; color: #777; width: 70%; } p.footer code { font-size: 11px; } p.explain { float: right; font-size: 11px; width: 25%; text-align: right; } p.explain code { color: #444; font-size: 10px; text-transform: uppercase; } .nav-tab-right { float: right; top: 2px; position: relative; margin-right: -5px; } .laborator-copyrights { margin: 0; font-size: 11px; position: relative; border-top: 1px solid #ddd; padding-top: 8px; color: #888; margin-bottom: 5px; margin-top: 5px; } </style> </div> <?php }