function sp_admin_bar_do_upgrade_check() { if (!sp_is_plugin_active('admin-bar/sp-admin-bar-plugin.php')) { return; } $options = sp_get_option('spAdminBar'); $db = $options['dbversion']; if (empty($db)) { $db = 0; } # quick bail check if ($db == SPABDBVERSION) { return; } # apply upgrades as needed if ($db < 1) { # empty since plugin did not used db on initial release } if ($db < 2) { # set autoload flag to true for autoupdates $meta = sp_get_sfmeta('autoupdate', 'admin'); if (!empty($meta[0])) { sp_update_sfmeta('autoupdate', 'admin', $meta[0]['meta_value'], $meta[0]['meta_id'], 1); } } if ($db < 3) { # permission for bypassing akismet checks sp_add_auth('bypass_akismet', __('Can bypass akismet check on posts', 'spab'), 1, 0, 0, 0, 3); sp_activate_auth('bypass_akismet'); } # save data $options['dbversion'] = SPABDBVERSION; sp_update_option('spAdminBar', $options); }
function spa_toolbox_environment_form() { #== ENVIRONMENT INFO Tab ========================================================== global $wp_version, $wpdb; include_once ABSPATH . 'wp-admin/includes/plugin.php'; $theme = wp_get_theme(); $wp_plugins = get_plugins(); $sp_plugins = sp_get_plugins(); spa_paint_open_tab(spa_text('Toolbox') . ' - ' . spa_text('Environment'), true); spa_paint_open_fieldset(spa_text('Environment'), false); echo '<div id="sp-environment-data">'; echo '<table class=:widefat">'; spa_env_open(spa_text('Simple:Press')); spa_env_info(spa_text('Version'), SPVERSION); spa_env_info(spa_text('Build'), SPBUILD); spa_env_info(spa_text('Release'), SPRELEASE); spa_env_close(); spa_env_open(spa_text('WordPress')); spa_env_info(spa_text('Version'), $wp_version); spa_env_info(spa_text('Language'), get_bloginfo('language')); spa_env_info(spa_text('Character Set'), get_bloginfo('charset')); spa_env_info(spa_text('Theme'), $theme->get('Name')); spa_env_close(); spa_env_open(spa_text('PHP')); spa_env_info(spa_text('Version'), phpversion()); spa_env_info(spa_text('Memory'), ini_get('memory_limit')); spa_env_info(spa_text('Max Upload'), ini_get('upload_max_filesize')); spa_env_info(spa_text('Timeout'), ini_get('user_ini.cache_ttl')); spa_env_close(); spa_env_open(spa_text('MySQL')); spa_env_info(spa_text('Version'), $wpdb->db_version()); spa_env_info(spa_text('Prefix'), $wpdb->prefix); spa_env_close(); spa_env_open(spa_text('Server')); spa_env_info(spa_text('Version'), $_SERVER['SERVER_SOFTWARE']); spa_env_close(); spa_env_open(spa_text('WP Plugins')); foreach (array_keys($wp_plugins) as $key) { if (is_plugin_active($key)) { $plugin = $wp_plugins[$key]; spa_env_list($plugin['Name'], $plugin['Version']); } } spa_env_close(); spa_env_open(spa_text('SP Plugins')); foreach ((array) $sp_plugins as $plugin_file => $plugin_data) { if (sp_is_plugin_active($plugin_file)) { spa_env_list($plugin_data['Name'], $plugin_data['Version']); } } spa_env_close(); echo '</table>'; echo '</div>'; spa_paint_close_fieldset(); do_action('sph_toolbox_environment_panel'); spa_paint_close_container(); spa_paint_close_tab(); }
function bulk_upgrade($plugins) { $this->init(); $this->bulk = true; $this->upgrade_strings(); $current = get_site_transient('sp_update_plugins'); add_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'), 10, 4); $this->skin->header(); # Connect to the Filesystem first $res = $this->fs_connect(array(WP_CONTENT_DIR, SFPLUGINDIR)); if (!$res) { $this->skin->footer(); return false; } $this->skin->bulk_header(); $this->maintenance_mode(false); $results = array(); $this->update_count = count($plugins); $this->update_current = 0; foreach ($plugins as $plugin) { $this->update_current++; $this->skin->plugin_info = sp_get_plugin_data(SFPLUGINDIR . $plugin, false, true); if (!isset($current->response[$plugin])) { $this->skin->set_result(false); $this->skin->before(); $this->skin->error('up_to_date'); $this->skin->after(); $results[$plugin] = false; continue; } # Get the URL to the zip file $r = $current->response[$plugin]; $this->skin->plugin_active = sp_is_plugin_active($plugin); $result = $this->run(array('package' => $r->package, 'destination' => dirname(SFPLUGINDIR . $plugin), 'clear_destination' => true, 'clear_working' => true, 'is_multi' => true, 'hook_extra' => array('plugin' => $plugin))); $results[$plugin] = $this->result; # fire action for plugin upgrdes do_action('sph_plugin_update_' . $plugin); # Prevent credentials auth screen from displaying multiple times if (false === $result) { break; } } # end foreach $plugins $this->maintenance_mode(false); $this->skin->bulk_footer(); $this->skin->footer(); # Cleanup our hooks, incase something else does a upgrade on this connection remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin')); # Force refresh of plugin update information delete_site_transient('sp_update_plugins'); return $results; }
function sp_featured_do_upgrade_check() { if (!sp_is_plugin_active('featured/sp-featured-plugin.php')) { return; } $options = sp_get_option('featured'); $db = $options['dbversion']; if (empty($db)) { $db = 0; } # quick bail check if ($db == SPFEATUREDDBVERSION) { return; } # apply upgrades as needed # db version upgrades # save data $options['dbversion'] = SPFEATUREDDBVERSION; sp_update_option('featured', $options); }
function sp_delete_sp_plugin($plugin) { $mess = ''; if (!sp_is_plugin_active($plugin)) { $parts = explode('/', $plugin); sp_remove_dir(SFPLUGINDIR . $parts[0]); do_action('sph_delete_' . trim($plugin)); do_action('sph_deleted_sp_plugin', trim($plugin)); $mess = sp_text('Plugin successfully deleted'); } else { $mess = sp_text('Plugin is active and cannot be deleted'); } return $mess; }
function sp_load_plugin_styles($ahahCall = false) { global $spCSSLoaded, $spDevice, $spPaths, $spGlobals; if (!sp_get_option('sfwpheadbypass') && $spCSSLoaded) { return; } $curTheme = $spGlobals['theme']; $curTheme = apply_filters('sph_theme', $curTheme); $vars = ''; $overlay = ''; # handle chiild themes $parentTheme = !empty($curTheme['parent']) ? sp_get_theme_data(SPTHEMEBASEDIR . $curTheme['parent'] . '/spTheme.txt') : ''; # handle color overlays if (current_theme_supports('sp-theme-child-overlays')) { # can use - so might be - a child theme overlay $overlay = !empty($curTheme['color']) ? $curTheme['color'] : ''; if (!empty($parentTheme) && !empty($curTheme['color'])) { # must be a child with an overlay selected so... # is the overlay in the child theme or not? if (file_exists(SPTHEMEBASEDIR . $curTheme['theme'] . '/styles/overlays/' . $curTheme['color'] . '.php')) { $theme = $curTheme['theme']; } elseif (!empty($curTheme['color'])) { $theme = $curTheme['parent']; } } else { $theme = $curTheme['theme']; } } else { # no support for child overlays so do it the old eway $overlay = !empty($curTheme['color']) ? $curTheme['color'] : ''; if (!empty($parentTheme) && !empty($curTheme['color'])) { $theme = $curTheme['parent']; } else { $theme = $curTheme['theme']; } } $vars = !empty($overlay) ? '?overlay=' . esc_attr($overlay) . '&theme=' . esc_attr($theme) : ''; # add device query var string $vars = !empty($vars) ? "{$vars}&device={$spDevice}" : "?device={$spDevice}"; # set the images path array sp_set_image_array($curTheme); $spCSSLoaded = true; # if called from the AHAH/AJAX init routine then leave now... if ($ahahCall) { return; } # handle RTL if (is_rtl()) { $vars = !empty($vars) ? "{$vars}&rtl=1" : '?rtl=1'; } $reset = is_rtl() ? 'reset.rtl.css' : 'reset,css'; # enqueue the main theme css if (sp_is_plugin_active('user-selection/sp-user-selection-plugin.php')) { if (!empty($parentTheme)) { $cssTheme = strpos($parentTheme['Stylesheet'], '.css') ? true : false; if ($cssTheme && file_exists(SPTHEMEBASEDIR . $curTheme['parent'] . '/styles/' . $reset)) { wp_enqueue_style('sp-parent-reset', SPTHEMEBASEURL . $curTheme['parent'] . '/styles/' . $reset); } wp_enqueue_style('sp-parent', SPTHEMEBASEURL . $curTheme['parent'] . '/styles/' . $parentTheme['Stylesheet'] . $vars); if (is_rtl() && $cssTheme && file_exists(SPTHEMEBASEDIR . $curTheme['parent'] . '/styles/rtl.css')) { wp_enqueue_style('sp-parent-rtl', SPTHEMEBASEURL . $curTheme['parent'] . '/styles/rtl.css'); } } $cssTheme = strpos(SPTHEMECSS, '.css') ? true : false; if ($cssTheme && file_exists(SPTHEMEDIR . $reset)) { wp_enqueue_style('sp-theme-reset', SPTHEMECSSEXTRA . $reset); } wp_enqueue_style('sp-theme', SPTHEMECSS . $vars); if (is_rtl() && $cssTheme && file_exists(SPTHEMEDIR . 'rtl.css')) { wp_enqueue_style('sp-theme-rtl', SPTHEMECSSEXTRA . 'rtl.css'); } } else { if (!empty($parentTheme)) { $cssTheme = strpos($parentTheme['Stylesheet'], '.css') ? true : false; if ($cssTheme && file_exists(SPTHEMEBASEDIR . $curTheme['parent'] . '/styles/' . $reset)) { sp_plugin_enqueue_style('sp-parent-reset', SPTHEMEBASEURL . $curTheme['parent'] . '/styles/' . $reset); } sp_plugin_enqueue_style('sp-parent', SPTHEMEBASEURL . $curTheme['parent'] . '/styles/' . $parentTheme['Stylesheet'] . $vars); if (is_rtl() && $cssTheme && file_exists(SPTHEMEBASEDIR . $curTheme['parent'] . '/styles/rtl.css')) { sp_plugin_enqueue_style('sp-parent-rtl', SPTHEMEBASEURL . $curTheme['parent'] . '/styles/rtl.css'); } } $cssTheme = strpos(SPTHEMECSS, '.css') ? true : false; if ($cssTheme && file_exists(SPTHEMEDIR . $reset)) { sp_plugin_enqueue_style('sp-theme-reset', SPTHEMECSSEXTRA . $reset); } sp_plugin_enqueue_style('sp-theme', SPTHEMECSS . $vars); if (is_rtl() && $cssTheme && file_exists(SPTHEMEDIR . 'rtl.css')) { sp_plugin_enqueue_style('sp-theme-rtl', SPTHEMECSSEXTRA . 'rtl.css'); } } # concat (if needed) and enqueue the plugin css do_action('sph_print_plugin_styles'); $combine_css = sp_get_option('combinecss'); if ($combine_css) { sp_combine_plugin_css_files(); } else { global $sp_plugin_styles; if (!empty($sp_plugin_styles)) { foreach ($sp_plugin_styles->queue as $handle) { wp_enqueue_style($handle, $sp_plugin_styles->registered[$handle]->src); } } } do_action('sph_styles_end'); }
function spa_save_plugin_list_actions() { check_admin_referer('forum-adminform_plugins', 'forum-adminform_plugins'); if (!sp_current_user_can('SPF Manage Plugins')) { spa_etext('Access denied - you do not have permission'); die; } if (empty($_POST['checked'])) { return spa_text('Error - no plugins selected'); } $action = ''; if (isset($_POST['action']) && $_POST['action'] != -1) { $action = $_POST['action']; } if (isset($_POST['action2']) && $_POST['action2'] != -1) { $action = $_POST['action2']; } switch ($action) { case 'activate-selected': $activate = false; foreach ($_POST['checked'] as $plugin) { $plugin = sp_filter_name_save($plugin); if (!sp_is_plugin_active($plugin)) { $activate = true; sp_activate_sp_plugin($plugin); } } if ($activate) { $msg = spa_text('Selected plugins activated'); } else { $msg = spa_text('All selected plugins already active'); } break; case 'deactivate-selected': $deactivate = false; foreach ($_POST['checked'] as $plugin) { $plugin = sp_filter_name_save($plugin); if (sp_is_plugin_active($plugin)) { $deactivate = true; sp_deactivate_sp_plugin($plugin); } } if ($deactivate) { $msg = spa_text('Selected plugins deactivated'); } else { $msg = spa_text('All selected plugins already deactived'); } break; case 'delete-selected': $active = false; foreach ($_POST['checked'] as $plugin) { $plugin = sp_filter_name_save($plugin); if (!sp_is_plugin_active($plugin)) { sp_delete_sp_plugin($plugin); } else { $active = true; } } if ($active) { $msg = spa_text('Selected plugins deleted but any active plugins were not deleted'); } else { $msg = spa_text('Selected plugins deleted'); } break; default: $msg = spa_text('Error - no action selected'); break; } return $msg; }
function spa_plugins_list_form() { global $spPaths; ?> <script type="text/javascript"> jQuery(document).ready(function() { spjAjaxForm('sppluginsform', 'sfreloadpl'); /* wp check all logic */ jQuery('thead, tfoot').find('.check-column :checkbox').click( function(e) { var c = jQuery(this).prop('checked'), kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard, toggle = e.shiftKey || kbtoggle; jQuery(this).closest( 'table' ).children( 'tbody' ).filter(':visible') .children().children('.check-column').find(':checkbox') .prop('checked', function() { if ( jQuery(this).is(':hidden') ) return false; if ( toggle ) return jQuery(this).prop( 'checked' ); else if (c) return true; return false; }); jQuery(this).closest('table').children('thead, tfoot').filter(':visible') .children().children('.check-column').find(':checkbox') .prop('checked', function() { if ( toggle ) return false; else if (c) return true; return false; }); }); }); </script> <?php # get plugins $plugins = spa_get_plugins_list_data(); # get update version info $xml = sp_load_version_xml(); # check active plugins $invalid = sp_validate_active_plugins(); if (!empty($invalid)) { foreach ($invalid as $plugin_file => $error) { echo '<div id="message" class="error"><p>' . sprintf(spa_text('The plugin %1$s has been deactivated due to error: %2$s'), esc_html($plugin_file), $error->get_error_message()) . '</p></div>'; } } $ahahURL = SFHOMEURL . 'index.php?sp_ahah=plugins-loader&sfnonce=' . wp_create_nonce('forum-ahah') . '&saveform=list'; $msg = esc_js(spa_text('Are you sure you want to delete the selected Simple Press plugins?')); ?> <form action="<?php echo $ahahURL; ?> " method="post" id="sppluginsform" name="sppluginsform" onsubmit="javascript: if (ActionType.options[ActionType.selectedIndex].value == 'delete-selected' || ActionType2.options[ActionType2.selectedIndex].value == 'delete-selected') {if (confirm('<?php echo $msg; ?> ')) {return true;} else {return false;}} else {return true;}"> <?php echo sp_create_nonce('forum-adminform_plugins'); spa_paint_options_init(); spa_paint_open_tab(spa_text('Available Plugins') . ' - ' . spa_text('Install Simple:Press Plugins'), true); spa_paint_open_panel(); spa_paint_spacer(); echo '<div class="sfoptionerror">'; echo spa_text('Plugins Folder') . ': <b>' . realpath(SF_STORE_DIR . '/' . $spPaths['plugins']) . '</b>'; echo '</div>'; spa_paint_open_fieldset(spa_text('Plugin Management'), true, 'plugins'); ?> <div class="tablenav top"> <div class="alignleft actions"> <select id="ActionType" name="action"> <option selected="selected" value="-1"><?php echo spa_text('Bulk Actions'); ?> </option> <option value="activate-selected"><?php echo spa_text('Activate'); ?> </option> <option value="deactivate-selected"><?php echo spa_text('Deactivate'); ?> </option> <?php if (!is_multisite() || is_super_admin()) { ?> <option value="delete-selected"><?php echo spa_text('Delete'); ?> </option><?php } ?> </select> <input id="doaction" class="button-secondary action" type="submit" value="<?php echo spa_text('Apply'); ?> " /> </div> <div class="tablenav-pages one-page"> <span class="displaying-num"><?php echo count($plugins) . ' ' . spa_text('plugins'); ?> </span> </div> </div> <table class="wp-list-table widefat plugins"> <thead> <tr> <td id='cb' class='manage-column column-cb check-column'> <input type="checkbox" name="cbhead" id="cbhead" /> <label class="wp-core-ui" for='cbhead'> </label> </td> <th class='manage-column check-column'></th> <th class='manage-column column-name column-primary'> <?php spa_etext('Plugin'); ?> </th> <th class='manage-column column-description'> <?php spa_etext('Description'); ?> </th> </tr> </thead> <tbody class="the-list"> <?php if (empty($plugins)) { echo '<tr><td colspan="4">' . spa_text('No plugins found.') . '</td></tr>'; } $disabled = ''; foreach ((array) $plugins as $plugin_file => $plugin_data) { # check for valid folder name $path = explode('/', $plugin_file); $bad = is_numeric(substr($path[0], -1)); $is_active = sp_is_plugin_active($plugin_file); if ($is_active) { $url = SFADMINPLUGINS . '&action=deactivate&plugin=' . esc_attr($plugin_file) . '&title=' . urlencode(esc_attr($plugin_data['Name'])) . '&sfnonce=' . wp_create_nonce('forum-adminform_plugins'); $actionlink = "<a href='{$url}' title='" . spa_text('Deactivate this Plugin') . "'>" . spa_text('Deactivate') . '</a>'; $actionlink = apply_filters('sph_plugins_active_buttons', $actionlink, $plugin_file); $actionlink .= sp_paint_plugin_tip($plugin_data['Name'], $plugin_file); $rowClass = 'active'; $icon = '<img src="' . SFADMINIMAGES . 'sp_Yes.png" title="' . spa_text('Plugin activated') . '" alt="" style="vertical-align:middle;" />'; } else { if ($bad) { $rowClass = 'inactive spWarningBG'; $actionlink = ''; $icon = '<img src="' . SFADMINIMAGES . 'sp_NoWrite.png" title="' . spa_text('Warning') . '" alt="" style="vertical-align:middle;" />'; $disabled = ' disabled="disabled" '; } else { $url = SFADMINPLUGINS . '&action=activate&plugin=' . esc_attr($plugin_file) . '&title=' . urlencode(esc_attr($plugin_data['Name'])) . '&sfnonce=' . wp_create_nonce('forum-adminform_plugins'); $actionlink = "<a href='{$url}' title='" . spa_text('Activate this Plugin') . "'>" . spa_text('Activate') . "</a>"; $url = SFADMINPLUGINS . '&action=delete&plugin=' . esc_attr($plugin_file) . '&title=' . urlencode(esc_attr($plugin_data['Name'])) . '&sfnonce=' . wp_create_nonce('forum-adminform_plugins'); $msg = esc_js(spa_text('Are you sure you want to delete this Simple Press plugin?')); if (!is_multisite() || is_super_admin()) { $actionlink .= ' | <a href="javascript: if (confirm(\'' . $msg . '\')) {window.location=\'' . $url . '\';}" title="' . spa_text('Delete this Plugin') . '">' . spa_text('Delete') . '</a>'; } $actionlink = apply_filters('sph_plugins_inactive_buttons', $actionlink, $plugin_file); $rowClass = 'inactive'; $icon = '<img src="' . SFADMINIMAGES . 'sp_No.png" title="' . spa_text('Plugin not activated') . '" alt="" style="vertical-align: middle;" />'; $disabled = ''; } } $description = $plugin_data['Description']; $plugin_name = $plugin_data['Name']; ?> <tr class='<?php echo $rowClass; ?> '> <th class='manage-column column-cb check-column' scope='row'> <?php $thisId = 'checkbox_' . rand(1, 9999999999); ?> <input id="<?php echo $thisId; ?> " type="checkbox" value="<?php echo $plugin_file; ?> " name="checked[]" <?php echo $disabled; ?> /> <label for="<?php echo $thisId; ?> "> </label> </th> <td class='manage-column check-column'> <?php echo $icon; ?> </td> <td class='manage-column column-name column-primary'> <strong><?php echo esc_html($plugin_name); ?> </strong> <div class="row-actions-visible"> <span><?php echo str_replace(' ', ' | ', $actionlink); ?> </span> </div> </td> <td class='manage-column column-description'> <div class='manage-column column-description'> <?php echo $description; ?> </div> <div class='<?php echo $rowClass; ?> second plugin-version-author-uri'> <?php $plugin_meta = array(); if (!empty($plugin_data['Version'])) { $plugin_meta[] = sprintf(spa_text('Version %s'), $plugin_data['Version']); } if (!empty($plugin_data['Author'])) { $author = $plugin_data['Author']; if (!empty($plugin_data['AuthorURI'])) { $author = '<a href="' . esc_url($plugin_data['AuthorURI']) . '" title="' . spa_text('Visit author homepage') . '">' . esc_html($plugin_data['Author']) . '</a>'; } $plugin_meta[] = sprintf(spa_text('By %s'), $author); } if (!empty($plugin_data['PluginURI'])) { $plugin_meta[] = '<a href="' . esc_url($plugin_data['PluginURI']) . '" title="' . spa_text('Visit plugin site') . '">' . esc_html(spa_text('Visit plugin site')) . '</a>'; } echo implode(' | ', $plugin_meta); ?> </div> </td> </tr> <?php # is it bad? if ($bad) { preg_match('/-?\\s*\\d+$/', $path[0], $fix); $suggest = str_replace($fix[0], '', $path[0]); ?> <tr class='<?php echo $rowClass; ?> '> <td colspan="4"> <div class="sfoptionerror"> <?php echo sprintf(spa_text('The folder name of this plugin has become corrupted - probably due to multiple downloads. Please remove the %s at the end of the folder name. The proper folder name should be %s'), "<strong>{$fix['0']}</strong>", "<strong>{$suggest}</strong>"); ?> </div> </td> </tr> <?php } # any upgrade for this plugin? in multisite only main site can update if (is_main_site() && $xml) { foreach ($xml->plugins->plugin as $latest) { if ($plugin_data['Name'] == $latest->name) { if (version_compare($latest->version, $plugin_data['Version'], '>') == 1) { ?> <tr class="plugin-update-tr"> <td class="plugin-update colspanchange" colspan="3"> <div class="update-message"> <?php echo spa_text('There is an update for the') . ' ' . $plugin_data['Name'] . ' ' . spa_text('plugin') . '. '; ?> <?php echo spa_text('Version') . ' ' . $latest->version . ' ' . spa_text('is available') . '. '; ?> <?php echo spa_text('For details and to download please visit') . ' ' . SFPLUGHOME . ' ' . spa_text('or') . ' ' . spa_text('go to the') . ' '; ?> <?php echo '<a href="' . self_admin_url('update-core.php') . '" title="" target="_parent">' . spa_text('WordPress updates page') . '</a>'; ?> </div> </td> </tr> <?php } break; } } } } do_action('sph_plugins_list_panel'); ?> </tbody> <tfoot> <tr> <td class='manage-column column-cb check-column'> <input type="checkbox" name="cbfoot" id="cbfoot" /> <label class="wp-core-ui" for='cbfoot'> </label> </td> <th class='manage-column check-column'></th> <th class='manage-column column-name column-primary'> <?php spa_etext('Plugin'); ?> </th> <th class='manage-column column-description'> <?php spa_etext('Description'); ?> </th> </tr> </tfoot> </table> <div class="tablenav bottom"> <div class="alignleft actions"> <select id="ActionType2" name="action2"> <option selected="selected" value="-1"><?php echo spa_text('Bulk Actions'); ?> </option> <option value="activate-selected"><?php echo spa_text('Activate'); ?> </option> <option value="deactivate-selected"><?php echo spa_text('Deactivate'); ?> </option> <?php if (!is_multisite() || is_super_admin()) { ?> <option value="delete-selected"><?php echo spa_text('Delete'); ?> </option><?php } ?> </select> <input id="doaction2" class="button-secondary action" type="submit" value="<?php echo spa_text('Apply'); ?> " name="" /> </div> <div class="tablenav-pages one-page"> <span class="displaying-num"><?php echo count($plugins) . ' ' . spa_text('plugins'); ?> </span> </div> </div> <?php spa_paint_close_fieldset(); spa_paint_close_panel(); spa_paint_close_container(); ?> <div class="sfform-panel-spacer"></div> <?php spa_paint_close_tab(); ?> </form> <?php }
function sp_load_plugin_styles() { $curTheme = sp_get_current_sp_theme(); # get optional color variant to pass to stylesheet $curTheme = apply_filters('sph_theme', $curTheme); # handle chiild themes $parentTheme = !empty($curTheme['parent']) ? sp_get_theme_data(SPTHEMEBASEDIR . $curTheme['parent'] . '/spTheme.txt') : ''; # handle color overlays $vars = !empty($curTheme['color']) ? '?color=' . esc_attr($curTheme['color']) : ''; # handle RTL if (is_rtl()) { $vars = !empty($vars) ? "{$vars}&rtl=1" : '?rtl=1'; } $reset = is_rtl() ? 'reset.rtl.css' : 'reset,css'; # enqueue the main theme css if (sp_is_plugin_active('user-selection/sp-user-selection-plugin.php')) { if (!empty($parentTheme)) { $cssTheme = strpos($parentTheme['Stylesheet'], '.css') ? true : false; if ($cssTheme && file_exists(SPTHEMEBASEDIR . $curTheme['parent'] . '/styles/' . $reset)) { wp_enqueue_style('sp-parent-reset', SPTHEMEBASEURL . $curTheme['parent'] . '/styles/' . $reset); } wp_enqueue_style('sp-parent', SPTHEMEBASEURL . $curTheme['parent'] . '/styles/' . $parentTheme['Stylesheet'] . $vars); if (is_rtl() && $cssTheme && file_exists(SPTHEMEBASEDIR . $curTheme['parent'] . '/styles/rtl.css')) { wp_enqueue_style('sp-parent-rtl', SPTHEMEBASEURL . $curTheme['parent'] . '/styles/rtl.css'); } } $cssTheme = strpos(SPTHEMECSS, '.css') ? true : false; if ($cssTheme && file_exists(SPTHEMEDIR . $reset)) { wp_enqueue_style('sp-theme-reset', SPTHEMECSSEXTRA . $reset); } wp_enqueue_style('sp-theme', SPTHEMECSS . $vars); if (is_rtl() && $cssTheme && file_exists(SPTHEMEDIR . 'rtl.css')) { wp_enqueue_style('sp-theme-rtl', SPTHEMECSSEXTRA . 'rtl.css'); } } else { if (!empty($parentTheme)) { $cssTheme = strpos($parentTheme['Stylesheet'], '.css') ? true : false; if ($cssTheme && file_exists(SPTHEMEBASEDIR . $curTheme['parent'] . '/styles/' . $reset)) { sp_plugin_enqueue_style('sp-parent-reset', SPTHEMEBASEURL . $curTheme['parent'] . '/styles/' . $reset); } sp_plugin_enqueue_style('sp-parent', SPTHEMEBASEURL . $curTheme['parent'] . '/styles/' . $parentTheme['Stylesheet'] . $vars); if (is_rtl() && $cssTheme && file_exists(SPTHEMEBASEDIR . $curTheme['parent'] . '/styles/rtl.css')) { sp_plugin_enqueue_style('sp-parent-rtl', SPTHEMEBASEURL . $curTheme['parent'] . '/styles/rtl.css'); } } $cssTheme = strpos(SPTHEMECSS, '.css') ? true : false; if ($cssTheme && file_exists(SPTHEMEDIR . $reset)) { sp_plugin_enqueue_style('sp-theme-reset', SPTHEMECSSEXTRA . $reset); } sp_plugin_enqueue_style('sp-theme', SPTHEMECSS . $vars); if (is_rtl() && $cssTheme && file_exists(SPTHEMEDIR . 'rtl.css')) { sp_plugin_enqueue_style('sp-theme-rtl', SPTHEMECSSEXTRA . 'rtl.css'); } } # concat (if needed) and enqueue the plugin css do_action('sph_print_plugin_styles'); $combine_css = sp_get_option('combinecss'); if ($combine_css) { sp_combine_plugin_css_files(); } else { global $sp_plugin_styles; if (!empty($sp_plugin_styles)) { foreach ($sp_plugin_styles->queue as $handle) { wp_enqueue_style($handle, $sp_plugin_styles->registered[$handle]->src); } } } do_action('sph_styles_end'); }