function run_installation_routine($url = '') { $settings = pl_get_global_settings(); // Only sets defaults if they are null set_default_settings(); if (!$settings) { $this->load_page_templates(); $this->apply_page_templates(); // Publish New Templates $tpl_handler = new PLCustomTemplates(); $tpl_handler->update_objects('publish'); } // Add Templates $id = $this->page_on_activation(); // Redirect $url = add_query_arg('pl-installed-theme', pl_theme_info('template'), get_permalink($id)); return $url; }
function run_installation_routine($url = '') { set_theme_mod('pl_installed', true); $settings = pl_get_global_settings(); // Only sets defaults if they are null set_default_settings(); if (is_file(trailingslashit(get_stylesheet_directory()) . 'pl-config.json')) { $settings_handler = new PageLinesSettings(); $settings_handler->import_from_child(); } $this->apply_page_templates(); // Publish New Templates $tpl_handler = new PLCustomTemplates(); $tpl_handler->update_objects('publish'); // Add Templates $id = $this->page_on_activation(); // Redirect $url = add_query_arg('pl-installed-theme', pl_theme_info('template'), get_permalink($id)); return $url; }
function publish($response, $data) { global $sections_data_handler, $dms_cache; $pageID = $data['pageID']; $typeID = $data['typeID']; $response['result'] = $sections_data_handler->publish_items($data['store']); $section_handler = new PLCustomSections(); $section_handler->update_objects('publish'); $tpl_handler = new PLCustomTemplates(); $tpl_handler->update_objects('publish'); $settings = array(); $settings['local'] = pl_meta($pageID, PL_SETTINGS); $settings['type'] = pl_meta($typeID, PL_SETTINGS); $settings['global'] = pl_get_global_settings(); foreach ($settings as $scope => $set) { $set = wp_parse_args($set, array('live' => array(), 'draft' => array())); $set['live'] = $set['draft']; $settings[$scope] = $set; } pl_meta_update($pageID, PL_SETTINGS, $settings['local']); pl_meta_update($typeID, PL_SETTINGS, $settings['type']); pl_update_global_settings($settings['global']); // Flush less $dms_cache->purge('live_css'); // run clean post action to trigger caches to clear. Varnish, WPE etc. do_action('clean_post_cache'); return $response; }