Esempio n. 1
0
function bp_forums_filter_kses($content)
{
    global $allowedtags;
    $forums_allowedtags = $allowedtags;
    $forums_allowedtags['span'] = array();
    $forums_allowedtags['span']['class'] = array();
    $forums_allowedtags['div'] = array();
    $forums_allowedtags['div']['class'] = array();
    $forums_allowedtags['div']['id'] = array();
    $forums_allowedtags['a']['class'] = array();
    $forums_allowedtags['img'] = array();
    $forums_allowedtags['br'] = array();
    $forums_allowedtags['p'] = array();
    $forums_allowedtags['img']['src'] = array();
    $forums_allowedtags['img']['alt'] = array();
    $forums_allowedtags['img']['class'] = array();
    $forums_allowedtags['img']['width'] = array();
    $forums_allowedtags['img']['height'] = array();
    $forums_allowedtags['img']['class'] = array();
    $forums_allowedtags['img']['id'] = array();
    $forums_allowedtags['code'] = array();
    $forums_allowedtags['blockquote'] = array();
    $forums_allowedtags = apply_filters('bp_forums_allowed_tags', $forums_allowedtags);
    return nxt_kses($content, $forums_allowedtags);
}
/**
 * xprofile_filter_kses ( $content )
 *
 * Run profile field values through kses with filterable allowed tags.
 *
 * @param string $content
 * @return string $content
 */
function xprofile_filter_kses($content)
{
    global $allowedtags;
    $xprofile_allowedtags = $allowedtags;
    $xprofile_allowedtags['a']['rel'] = array();
    $xprofile_allowedtags = apply_filters('xprofile_allowed_tags', $xprofile_allowedtags);
    return nxt_kses($content, $xprofile_allowedtags);
}
Esempio n. 3
0
function bp_groups_filter_kses($content)
{
    global $allowedtags;
    $groups_allowedtags = $allowedtags;
    $groups_allowedtags['a']['class'] = array();
    $groups_allowedtags['img'] = array();
    $groups_allowedtags['img']['src'] = array();
    $groups_allowedtags['img']['alt'] = array();
    $groups_allowedtags['img']['class'] = array();
    $groups_allowedtags['img']['width'] = array();
    $groups_allowedtags['img']['height'] = array();
    $groups_allowedtags['img']['class'] = array();
    $groups_allowedtags['img']['id'] = array();
    $groups_allowedtags['code'] = array();
    $groups_allowedtags = apply_filters('bp_groups_filter_kses', $groups_allowedtags);
    return nxt_kses($content, $groups_allowedtags);
}
function of_sanitize_allowedposttags($input)
{
    global $allowedposttags;
    $output = nxtautop(nxt_kses($input, $allowedposttags));
    return $output;
}
Esempio n. 5
0
 /**
  * Tries to ping a specific service showing as much as debug output as possible
  * @since 3.1.9
  * @return null
  */
 function ShonxtingResult()
 {
     check_admin_referer('sitemap');
     if (!current_user_can("administrator")) {
         echo '<p>Please log in as admin</p>';
         return;
     }
     $service = !empty($_GET["sm_ping_service"]) ? $_GET["sm_ping_service"] : null;
     $status =& GoogleSitemapGeneratorStatus::Load();
     if (!$status) {
         die("No build status yet. Build the sitemap first.");
     }
     $url = null;
     switch ($service) {
         case "google":
             $url = $status->_googleUrl;
             break;
         case "msn":
             $url = $status->_msnUrl;
             break;
         case "ask":
             $url = $status->_askUrl;
             break;
     }
     if (empty($url)) {
         die("Invalid ping url");
     }
     echo '<html><head><title>Ping Test</title>';
     if (function_exists('nxt_admin_css')) {
         nxt_admin_css('css/global', true);
     }
     echo '</head><body><h1>Ping Test</h1>';
     echo '<p>Trying to ping: <a href="' . $url . '">' . $url . '</a>. The sections below should give you an idea whats going on.</p>';
     //Try to get as much as debug / error output as possible
     $errLevel = error_reporting(E_ALL);
     $errDisplay = ini_set("display_errors", 1);
     if (!defined('nxt_DEBUG')) {
         define('nxt_DEBUG', true);
     }
     echo '<h2>Errors, Warnings, Notices:</h2>';
     if (nxt_DEBUG == false) {
         echo "<i>nxt_DEBUG was set to false somewhere before. You might not see all debug information until you remove this declaration!</i><br />";
     }
     if (ini_get("display_errors") != 1) {
         echo "<i>Your display_errors setting currently prevents the plugin from showing errors here. Please check your webserver logfile instead.</i><br />";
     }
     $res = $this->RemoteOpen($url);
     echo '<h2>Result (text only):</h2>';
     echo nxt_kses($res, array('a' => array('href' => array()), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array()));
     echo '<h2>Result (HTML):</h2>';
     echo htmlspecialchars($res);
     //Revert back old values
     error_reporting($errLevel);
     ini_set("display_errors", $errDisplay);
     echo '</body></html>';
     exit;
 }
Esempio n. 6
0
/**
 * Custom kses filtering for activity content
 *
 * @since 1.1.0
 *
 * @param string $content The activity content
 *
 * @uses apply_filters() To call the 'bp_activity_allowed_tags' hook.
 * @uses nxt_kses()
 *
 * @return string $content Filtered activity content
 */
function bp_activity_filter_kses($content)
{
    global $allowedtags;
    $activity_allowedtags = $allowedtags;
    $activity_allowedtags['span'] = array();
    $activity_allowedtags['span']['class'] = array();
    $activity_allowedtags['div'] = array();
    $activity_allowedtags['div']['class'] = array();
    $activity_allowedtags['div']['id'] = array();
    $activity_allowedtags['a']['class'] = array();
    $activity_allowedtags['a']['id'] = array();
    $activity_allowedtags['a']['rel'] = array();
    $activity_allowedtags['img'] = array();
    $activity_allowedtags['img']['src'] = array();
    $activity_allowedtags['img']['alt'] = array();
    $activity_allowedtags['img']['class'] = array();
    $activity_allowedtags['img']['width'] = array();
    $activity_allowedtags['img']['height'] = array();
    $activity_allowedtags['img']['class'] = array();
    $activity_allowedtags['img']['id'] = array();
    $activity_allowedtags['img']['title'] = array();
    $activity_allowedtags['code'] = array();
    $activity_allowedtags = apply_filters('bp_activity_allowed_tags', $activity_allowedtags);
    return nxt_kses($content, $activity_allowedtags);
}
/**
 * Strips all of the HTML in the content.
 *
 * @since 2.1.0
 *
 * @param string $data Content to strip all HTML from
 * @return string Filtered content without any HTML
 */
function nxt_filter_nohtml_kses($data)
{
    return addslashes(nxt_kses(stripslashes($data), array()));
}
Esempio n. 8
0
/**
 * Display theme information in dialog box form.
 *
 * @since 2.8.0
 */
function install_theme_information()
{
    //TODO: This function needs a LOT of UI work :)
    global $tab, $themes_allowedtags;
    $api = themes_api('theme_information', array('slug' => stripslashes($_REQUEST['theme'])));
    if (is_nxt_error($api)) {
        nxt_die($api);
    }
    // Sanitize HTML
    foreach ((array) $api->sections as $section_name => $content) {
        $api->sections[$section_name] = nxt_kses($content, $themes_allowedtags);
    }
    foreach (array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key) {
        if (isset($api->{$key})) {
            $api->{$key} = nxt_kses($api->{$key}, $themes_allowedtags);
        }
    }
    iframe_header(__('Theme Install'));
    if (empty($api->download_link)) {
        echo '<div id="message" class="error"><p>' . __('<strong>ERROR:</strong> This theme is currently not available. Please try again later.') . '</p></div>';
        iframe_footer();
        exit;
    }
    if (!empty($api->tested) && version_compare($GLOBALS['nxt_version'], $api->tested, '>')) {
        echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This theme has <strong>not been tested</strong> with your current version of NXTClass.') . '</p></div>';
    } else {
        if (!empty($api->requires) && version_compare($GLOBALS['nxt_version'], $api->requires, '<')) {
            echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This theme has not been marked as <strong>compatible</strong> with your version of NXTClass.') . '</p></div>';
        }
    }
    // Default to a "new" theme
    $type = 'install';
    // Check to see if this theme is known to be installed, and has an update awaiting it.
    $update_themes = get_site_transient('update_themes');
    if (is_object($update_themes) && isset($update_themes->response)) {
        foreach ((array) $update_themes->response as $theme_slug => $theme_info) {
            if ($theme_slug === $api->slug) {
                $type = 'update_available';
                $update_file = $theme_slug;
                break;
            }
        }
    }
    $themes = get_themes();
    foreach ((array) $themes as $this_theme) {
        if (is_array($this_theme) && $this_theme['Stylesheet'] == $api->slug) {
            if ($this_theme['Version'] == $api->version) {
                $type = 'latest_installed';
            } elseif ($this_theme['Version'] > $api->version) {
                $type = 'newer_installed';
                $newer_version = $this_theme['Version'];
            }
            break;
        }
    }
    ?>

<div class='available-theme'>
<img src='<?php 
    echo esc_url($api->screenshot_url);
    ?>
' width='300' class="theme-preview-img" />
<h3><?php 
    echo $api->name;
    ?>
</h3>
<p><?php 
    printf(__('by %s'), $api->author);
    ?>
</p>
<p><?php 
    printf(__('Version: %s'), $api->version);
    ?>
</p>

<?php 
    $buttons = '<a class="button" id="cancel" href="#" onclick="tb_close();return false;">' . __('Cancel') . '</a> ';
    switch ($type) {
        default:
        case 'install':
            if (current_user_can('install_themes')) {
                $buttons .= '<a class="button-primary" id="install" href="' . nxt_nonce_url(self_admin_url('update.php?action=install-theme&theme=' . $api->slug), 'install-theme_' . $api->slug) . '" target="_parent">' . __('Install Now') . '</a>';
            }
            break;
        case 'update_available':
            if (current_user_can('update_themes')) {
                $buttons .= '<a class="button-primary" id="install"	href="' . nxt_nonce_url(self_admin_url('update.php?action=upgrade-theme&theme=' . $update_file), 'upgrade-theme_' . $update_file) . '" target="_parent">' . __('Install Update Now') . '</a>';
            }
            break;
        case 'newer_installed':
            if (current_user_can('install_themes') || current_user_can('update_themes')) {
                ?>
<p><?php 
                printf(__('Newer version (%s) is installed.'), $newer_version);
                ?>
</p><?php 
            }
            break;
        case 'latest_installed':
            if (current_user_can('install_themes') || current_user_can('update_themes')) {
                ?>
<p><?php 
                _e('This version is already installed.');
                ?>
</p><?php 
            }
            break;
    }
    ?>
<br class="clear" />
</div>

<p class="action-button">
<?php 
    echo $buttons;
    ?>
<br class="clear" />
</p>

<?php 
    iframe_footer();
    exit;
}
function bb_filter_kses($data)
{
    $allowedtags = bb_allowed_tags();
    return nxt_kses($data, $allowedtags);
}
Esempio n. 10
0
/**
 * Retrieve theme data from parsed theme file.
 *
 * The description will have the tags filtered with the following HTML elements
 * whitelisted. The <b>'a'</b> element with the <em>href</em> and <em>title</em>
 * attributes. The <b>abbr</b> element with the <em>title</em> attribute. The
 * <b>acronym</b> element with the <em>title</em> attribute allowed. The
 * <b>code</b>, <b>em</b>, and <b>strong</b> elements also allowed.
 *
 * The style.css file must contain theme name, theme URI, and description. The
 * data can also contain author URI, author, template (parent template),
 * version, status, and finally tags. Some of these are not used by NXTClass
 * administration panels, but are used by theme directory web sites which list
 * the theme.
 *
 * @since 1.5.0
 *
 * @param string $theme_file Theme file path.
 * @return array Theme data.
 */
function get_theme_data($theme_file)
{
    $default_headers = array('Name' => 'Theme Name', 'URI' => 'Theme URI', 'Description' => 'Description', 'Author' => 'Author', 'AuthorURI' => 'Author URI', 'Version' => 'Version', 'Template' => 'Template', 'Status' => 'Status', 'Tags' => 'Tags');
    $themes_allowed_tags = array('a' => array('href' => array(), 'title' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'em' => array(), 'strong' => array());
    $theme_data = get_file_data($theme_file, $default_headers, 'theme');
    $theme_data['Name'] = $theme_data['Title'] = nxt_kses($theme_data['Name'], $themes_allowed_tags);
    $theme_data['URI'] = esc_url($theme_data['URI']);
    $theme_data['Description'] = nxttexturize(nxt_kses($theme_data['Description'], $themes_allowed_tags));
    $theme_data['AuthorURI'] = esc_url($theme_data['AuthorURI']);
    $theme_data['Template'] = nxt_kses($theme_data['Template'], $themes_allowed_tags);
    $theme_data['Version'] = nxt_kses($theme_data['Version'], $themes_allowed_tags);
    if ($theme_data['Status'] == '') {
        $theme_data['Status'] = 'publish';
    } else {
        $theme_data['Status'] = nxt_kses($theme_data['Status'], $themes_allowed_tags);
    }
    if ($theme_data['Tags'] == '') {
        $theme_data['Tags'] = array();
    } else {
        $theme_data['Tags'] = array_map('trim', explode(',', nxt_kses($theme_data['Tags'], array())));
    }
    if ($theme_data['Author'] == '') {
        $theme_data['Author'] = $theme_data['AuthorName'] = __('Anonymous');
    } else {
        $theme_data['AuthorName'] = nxt_kses($theme_data['Author'], $themes_allowed_tags);
        if (empty($theme_data['AuthorURI'])) {
            $theme_data['Author'] = $theme_data['AuthorName'];
        } else {
            $theme_data['Author'] = sprintf('<a href="%1$s" title="%2$s">%3$s</a>', $theme_data['AuthorURI'], esc_attr__('Visit author homepage'), $theme_data['AuthorName']);
        }
    }
    return $theme_data;
}
Esempio n. 11
0
function nxt_theme_update_row($theme_key, $theme)
{
    $current = get_site_transient('update_themes');
    if (!isset($current->response[$theme_key])) {
        return false;
    }
    $r = $current->response[$theme_key];
    $themes_allowedtags = array('a' => array('href' => array(), 'title' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'em' => array(), 'strong' => array());
    $theme_name = nxt_kses($theme['Name'], $themes_allowedtags);
    $details_url = self_admin_url("theme-install.php?tab=theme-information&theme={$theme_key}&TB_iframe=true&width=600&height=400");
    $nxt_list_table = _get_list_table('nxt_MS_Themes_List_Table');
    echo '<tr class="plugin-update-tr"><td colspan="' . $nxt_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
    if (!current_user_can('update_themes')) {
        printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r->new_version);
    } else {
        if (empty($r['package'])) {
            printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin.</em>'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r['new_version']);
        } else {
            printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update automatically</a>.'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r['new_version'], nxt_nonce_url(self_admin_url('update.php?action=upgrade-theme&theme=') . $theme_key, 'upgrade-theme_' . $theme_key));
        }
    }
    do_action("in_theme_update_message-{$theme_key}", $theme, $r);
    echo '</div></td></tr>';
}
/**
 * Generates the options fields that are used in the form.
 */
function optionsframework_fields()
{
    global $allowedtags;
    $optionsframework_settings = get_option('optionsframework');
    // Get the theme name so we can display it up top
    $themename = get_theme_data(STYLESHEETPATH . '/style.css');
    $themename = $themename['Name'];
    // Gets the unique option id
    if (isset($optionsframework_settings['id'])) {
        $option_name = $optionsframework_settings['id'];
    } else {
        $option_name = 'optionsframework';
    }
    $settings = get_option($option_name);
    $options = optionsframework_options();
    $counter = 0;
    $menu = '';
    $output = '';
    foreach ($options as $value) {
        $counter++;
        $val = '';
        $select_value = '';
        $checked = '';
        // Wrap all options
        if ($value['type'] != "heading" && $value['type'] != "info") {
            // Keep all ids lowercase with no spaces
            $value['id'] = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['id']));
            $id = 'section-' . $value['id'];
            $class = 'section ';
            if (isset($value['type'])) {
                $class .= ' section-' . $value['type'];
            }
            if (isset($value['class'])) {
                $class .= ' ' . $value['class'];
            }
            $output .= '<div id="' . esc_attr($id) . '" class="' . esc_attr($class) . '">' . "\n";
            $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
            $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
        }
        // Set default value to $val
        if (isset($value['std'])) {
            $val = $value['std'];
        }
        // If the option is already saved, ovveride $val
        if ($value['type'] != 'heading' && $value['type'] != 'info') {
            if (isset($settings[$value['id']])) {
                $val = $settings[$value['id']];
                // Striping slashes of non-array options
                if (!is_array($val)) {
                    $val = stripslashes($val);
                }
            }
        }
        // If there is a description save it for labels
        $explain_value = '';
        if (isset($value['desc'])) {
            $explain_value = $value['desc'];
        }
        switch ($value['type']) {
            // Basic text input
            case 'text':
                $output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="text" value="' . esc_attr($val) . '" />';
                break;
                // Textarea
            // Textarea
            case 'textarea':
                $cols = '8';
                $ta_value = '';
                if (isset($value['options'])) {
                    $ta_options = $value['options'];
                    if (isset($ta_options['cols'])) {
                        $cols = $ta_options['cols'];
                    } else {
                        $cols = '8';
                    }
                }
                $val = stripslashes($val);
                $output .= '<textarea id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" cols="' . esc_attr($cols) . '" rows="8">' . esc_textarea($val) . '</textarea>';
                break;
                // Select Box
            // Select Box
            case $value['type'] == 'select':
                $output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
                foreach ($value['options'] as $key => $option) {
                    $selected = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' selected="selected"';
                        }
                    }
                    $output .= '<option' . $selected . ' value="' . esc_attr($key) . '">' . esc_html($option) . '</option>';
                }
                $output .= '</select>';
                break;
                // Radio Box
            // Radio Box
            case "radio":
                $name = $option_name . '[' . $value['id'] . ']';
                foreach ($value['options'] as $key => $option) {
                    $id = $option_name . '-' . $value['id'] . '-' . $key;
                    $output .= '<input class="of-input of-radio" type="radio" name="' . esc_attr($name) . '" id="' . esc_attr($id) . '" value="' . esc_attr($key) . '" ' . checked($val, $key, false) . ' /><label for="' . esc_attr($id) . '">' . esc_html($option) . '</label>';
                }
                break;
                // Image Selectors
            // Image Selectors
            case "images":
                $name = $option_name . '[' . $value['id'] . ']';
                foreach ($value['options'] as $key => $option) {
                    $selected = '';
                    $checked = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' of-radio-img-selected';
                            $checked = ' checked="checked"';
                        }
                    }
                    $output .= '<input type="radio" id="' . esc_attr($value['id'] . '_' . $key) . '" class="of-radio-img-radio" value="' . esc_attr($key) . '" name="' . esc_attr($name) . '" ' . $checked . ' />';
                    $output .= '<div class="of-radio-img-label">' . esc_html($key) . '</div>';
                    $output .= '<img src="' . esc_url($option) . '" alt="' . $option . '" class="of-radio-img-img' . $selected . '" onclick="document.getElementById(\'' . esc_attr($value['id'] . '_' . $key) . '\').checked=true;" />';
                }
                break;
                // Checkbox
            // Checkbox
            case "checkbox":
                $output .= '<input id="' . esc_attr($value['id']) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" ' . checked($val, 1, false) . ' />';
                $output .= '<label class="explain" for="' . esc_attr($value['id']) . '">' . nxt_kses($explain_value, $allowedtags) . '</label>';
                break;
                // Multicheck
            // Multicheck
            case "multicheck":
                foreach ($value['options'] as $key => $option) {
                    $checked = '';
                    $label = $option;
                    $option = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($key));
                    $id = $option_name . '-' . $value['id'] . '-' . $option;
                    $name = $option_name . '[' . $value['id'] . '][' . $option . ']';
                    if (isset($val[$option])) {
                        $checked = checked($val[$option], 1, false);
                    }
                    $output .= '<input id="' . esc_attr($id) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($name) . '" ' . $checked . ' /><label for="' . esc_attr($id) . '">' . esc_html($label) . '</label>';
                }
                break;
                // Color picker
            // Color picker
            case "color":
                $output .= '<div id="' . esc_attr($value['id'] . '_picker') . '" class="colorSelector"><div style="' . esc_attr('background-color:' . $val) . '"></div></div>';
                $output .= '<input class="of-color" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" type="text" value="' . esc_attr($val) . '" />';
                break;
                // Uploader
            // Uploader
            case "upload":
                $output .= optionsframework_medialibrary_uploader($value['id'], $val, null);
                // New AJAX Uploader using Media Library
                break;
                // Typography
            // Typography
            case 'typography':
                $typography_stored = $val;
                // Font Size
                $output .= '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
                for ($i = 9; $i < 71; $i++) {
                    $size = $i . 'px';
                    $output .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
                }
                $output .= '</select>';
                // Font Face
                $output .= '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
                $faces = of_recognized_font_faces();
                foreach ($faces as $key => $face) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
                }
                $output .= '</select>';
                // Font Weight
                $output .= '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
                /* Font Style */
                $styles = of_recognized_font_styles();
                foreach ($styles as $key => $style) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
                }
                $output .= '</select>';
                // Font Color
                $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $typography_stored['color']) . '"></div></div>';
                $output .= '<input class="of-color of-typography of-typography-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($typography_stored['color']) . '" />';
                break;
                // Background
            // Background
            case 'background':
                $background = $val;
                // Background Color
                $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $background['color']) . '"></div></div>';
                $output .= '<input class="of-color of-background of-background-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($background['color']) . '" />';
                // Background Image - New AJAX Uploader using Media Library
                if (!isset($background['image'])) {
                    $background['image'] = '';
                }
                $output .= optionsframework_medialibrary_uploader($value['id'], $background['image'], null, '', 0, 'image');
                $class = 'of-background-properties';
                if ('' == $background['image']) {
                    $class .= ' hide';
                }
                $output .= '<div class="' . esc_attr($class) . '">';
                // Background Repeat
                $output .= '<select class="of-background of-background-repeat" name="' . esc_attr($option_name . '[' . $value['id'] . '][repeat]') . '" id="' . esc_attr($value['id'] . '_repeat') . '">';
                $repeats = of_recognized_background_repeat();
                foreach ($repeats as $key => $repeat) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($background['repeat'], $key, false) . '>' . esc_html($repeat) . '</option>';
                }
                $output .= '</select>';
                // Background Position
                $output .= '<select class="of-background of-background-position" name="' . esc_attr($option_name . '[' . $value['id'] . '][position]') . '" id="' . esc_attr($value['id'] . '_position') . '">';
                $positions = of_recognized_background_position();
                foreach ($positions as $key => $position) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($background['position'], $key, false) . '>' . esc_html($position) . '</option>';
                }
                $output .= '</select>';
                // Background Attachment
                $output .= '<select class="of-background of-background-attachment" name="' . esc_attr($option_name . '[' . $value['id'] . '][attachment]') . '" id="' . esc_attr($value['id'] . '_attachment') . '">';
                $attachments = of_recognized_background_attachment();
                foreach ($attachments as $key => $attachment) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($background['attachment'], $key, false) . '>' . esc_html($attachment) . '</option>';
                }
                $output .= '</select>';
                $output .= '</div>';
                break;
                // Info
            // Info
            case "info":
                $class = 'section';
                if (isset($value['type'])) {
                    $class .= ' section-' . $value['type'];
                }
                if (isset($value['class'])) {
                    $class .= ' ' . $value['class'];
                }
                $output .= '<div class="' . esc_attr($class) . '">' . "\n";
                if (isset($value['name'])) {
                    $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
                }
                if ($value['desc']) {
                    $output .= apply_filters('of_sanitize_info', $value['desc']) . "\n";
                }
                $output .= '<div class="clear"></div></div>' . "\n";
                break;
                // Heading for Navigation
            // Heading for Navigation
            case "heading":
                if ($counter >= 2) {
                    $output .= '</div>' . "\n";
                }
                $jquery_click_hook = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['name']));
                $jquery_click_hook = "of-option-" . $jquery_click_hook;
                $menu .= '<a id="' . esc_attr($jquery_click_hook) . '-tab" class="nav-tab" title="' . esc_attr($value['name']) . '" href="' . esc_attr('#' . $jquery_click_hook) . '">' . esc_html($value['name']) . '</a>';
                $output .= '<div class="group" id="' . esc_attr($jquery_click_hook) . '">';
                $output .= '<h3>' . esc_html($value['name']) . '</h3>' . "\n";
                break;
        }
        if ($value['type'] != "heading" && $value['type'] != "info") {
            if ($value['type'] != "checkbox") {
                $output .= '<br/>';
            }
            $output .= '</div>';
            if ($value['type'] != "checkbox") {
                $output .= '<div class="explain">' . nxt_kses($explain_value, $allowedtags) . '</div>' . "\n";
            }
            $output .= '<div class="clear"></div></div></div>' . "\n";
        }
    }
    $output .= '</div>';
    return array($output, $menu);
}
    function display_rows()
    {
        $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array());
        list($columns, $hidden) = $this->get_column_info();
        $style = array();
        foreach ($columns as $column_name => $column_display_name) {
            $style[$column_name] = in_array($column_name, $hidden) ? 'style="display:none;"' : '';
        }
        foreach ((array) $this->items as $plugin) {
            if (is_object($plugin)) {
                $plugin = (array) $plugin;
            }
            $title = nxt_kses($plugin['name'], $plugins_allowedtags);
            //Limit description to 400char, and remove any HTML.
            $description = strip_tags($plugin['description']);
            if (strlen($description) > 400) {
                $description = mb_substr($description, 0, 400) . '&#8230;';
            }
            //remove any trailing entities
            $description = preg_replace('/&[^;\\s]{0,6}$/', '', $description);
            //strip leading/trailing & multiple consecutive lines
            $description = trim($description);
            $description = preg_replace("|(\r?\n)+|", "\n", $description);
            //\n => <br>
            $description = nl2br($description);
            $version = nxt_kses($plugin['version'], $plugins_allowedtags);
            $name = strip_tags($title . ' ' . $version);
            $author = $plugin['author'];
            if (!empty($plugin['author'])) {
                $author = ' <cite>' . sprintf(__('By %s'), $author) . '.</cite>';
            }
            $author = nxt_kses($author, $plugins_allowedtags);
            $action_links = array();
            $action_links[] = '<a href="' . self_admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] . '&amp;TB_iframe=true&amp;width=600&amp;height=550') . '" class="thickbox" title="' . esc_attr(sprintf(__('More information about %s'), $name)) . '">' . __('Details') . '</a>';
            if (current_user_can('install_plugins') || current_user_can('update_plugins')) {
                $status = install_plugin_install_status($plugin);
                switch ($status['status']) {
                    case 'install':
                        if ($status['url']) {
                            $action_links[] = '<a class="install-now" href="' . $status['url'] . '" title="' . esc_attr(sprintf(__('Install %s'), $name)) . '">' . __('Install Now') . '</a>';
                        }
                        break;
                    case 'update_available':
                        if ($status['url']) {
                            $action_links[] = '<a href="' . $status['url'] . '" title="' . esc_attr(sprintf(__('Update to version %s'), $status['version'])) . '">' . sprintf(__('Update Now'), $status['version']) . '</a>';
                        }
                        break;
                    case 'latest_installed':
                    case 'newer_installed':
                        $action_links[] = '<span title="' . esc_attr__('This plugin is already installed and is up to date') . ' ">' . __('Installed') . '</span>';
                        break;
                }
            }
            $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin);
            ?>
		<tr>
			<td class="name column-name"<?php 
            echo $style['name'];
            ?>
><strong><?php 
            echo $title;
            ?>
</strong>
				<div class="action-links"><?php 
            if (!empty($action_links)) {
                echo implode(' | ', $action_links);
            }
            ?>
</div>
			</td>
			<td class="vers column-version"<?php 
            echo $style['version'];
            ?>
><?php 
            echo $version;
            ?>
</td>
			<td class="vers column-rating"<?php 
            echo $style['rating'];
            ?>
>
				<div class="star-holder" title="<?php 
            printf(_n('(based on %s rating)', '(based on %s ratings)', $plugin['num_ratings']), number_format_i18n($plugin['num_ratings']));
            ?>
">
					<div class="star star-rating" style="width: <?php 
            echo esc_attr($plugin['rating']);
            ?>
px"></div>
					<?php 
            $color = get_user_option('admin_color');
            if (empty($color) || 'fresh' == $color) {
                $star_url = admin_url('images/gray-star.png?v=20110615');
            } else {
                $star_url = admin_url('images/star.png?v=20110615');
            }
            // 'Classic' Blue star
            ?>
					<div class="star star5"><img src="<?php 
            echo $star_url;
            ?>
" alt="<?php 
            esc_attr_e('5 stars');
            ?>
" /></div>
					<div class="star star4"><img src="<?php 
            echo $star_url;
            ?>
" alt="<?php 
            esc_attr_e('4 stars');
            ?>
" /></div>
					<div class="star star3"><img src="<?php 
            echo $star_url;
            ?>
" alt="<?php 
            esc_attr_e('3 stars');
            ?>
" /></div>
					<div class="star star2"><img src="<?php 
            echo $star_url;
            ?>
" alt="<?php 
            esc_attr_e('2 stars');
            ?>
" /></div>
					<div class="star star1"><img src="<?php 
            echo $star_url;
            ?>
" alt="<?php 
            esc_attr_e('1 star');
            ?>
" /></div>
				</div>
			</td>
			<td class="desc column-description"<?php 
            echo $style['description'];
            ?>
><?php 
            echo $description, $author;
            ?>
</td>
		</tr>
		<?php 
        }
    }
Esempio n. 14
0
/**
 * Display plugin information in dialog box form.
 *
 * @since 2.7.0
 */
function install_plugin_information()
{
    global $tab;
    $api = plugins_api('plugin_information', array('slug' => stripslashes($_REQUEST['plugin'])));
    if (is_nxt_error($api)) {
        nxt_die($api);
    }
    $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'img' => array('src' => array(), 'class' => array(), 'alt' => array()));
    //Sanitize HTML
    foreach ((array) $api->sections as $section_name => $content) {
        $api->sections[$section_name] = nxt_kses($content, $plugins_allowedtags);
    }
    foreach (array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key) {
        if (isset($api->{$key})) {
            $api->{$key} = nxt_kses($api->{$key}, $plugins_allowedtags);
        }
    }
    $section = isset($_REQUEST['section']) ? stripslashes($_REQUEST['section']) : 'description';
    //Default to the Description tab, Do not translate, API returns English.
    if (empty($section) || !isset($api->sections[$section])) {
        $section = array_shift($section_titles = array_keys((array) $api->sections));
    }
    iframe_header(__('Plugin Install'));
    echo "<div id='{$tab}-header'>\n";
    echo "<ul id='sidemenu'>\n";
    foreach ((array) $api->sections as $section_name => $content) {
        $title = $section_name;
        $title = ucwords(str_replace('_', ' ', $title));
        $class = $section_name == $section ? ' class="current"' : '';
        $href = add_query_arg(array('tab' => $tab, 'section' => $section_name));
        $href = esc_url($href);
        $san_title = esc_attr(sanitize_title_with_dashes($title));
        echo "\t<li><a name='{$san_title}' target='' href='{$href}'{$class}>{$title}</a></li>\n";
    }
    echo "</ul>\n";
    echo "</div>\n";
    ?>
	<div class="alignright fyi">
		<?php 
    if (!empty($api->download_link) && (current_user_can('install_plugins') || current_user_can('update_plugins'))) {
        ?>
		<p class="action-button">
		<?php 
        $status = install_plugin_install_status($api);
        switch ($status['status']) {
            case 'install':
                if ($status['url']) {
                    echo '<a href="' . $status['url'] . '" target="_parent">' . __('Install Now') . '</a>';
                }
                break;
            case 'update_available':
                if ($status['url']) {
                    echo '<a href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') . '</a>';
                }
                break;
            case 'newer_installed':
                echo '<a>' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>';
                break;
            case 'latest_installed':
                echo '<a>' . __('Latest Version Installed') . '</a>';
                break;
        }
        ?>
		</p>
		<?php 
    }
    ?>
		<h2 class="mainheader"><?php 
    /* translators: For Your Information */
    _e('FYI');
    ?>
</h2>
		<ul>
<?php 
    if (!empty($api->version)) {
        ?>
			<li><strong><?php 
        _e('Version:');
        ?>
</strong> <?php 
        echo $api->version;
        ?>
</li>
<?php 
    }
    if (!empty($api->author)) {
        ?>
			<li><strong><?php 
        _e('Author:');
        ?>
</strong> <?php 
        echo links_add_target($api->author, '_blank');
        ?>
</li>
<?php 
    }
    if (!empty($api->last_updated)) {
        ?>
			<li><strong><?php 
        _e('Last Updated:');
        ?>
</strong> <span title="<?php 
        echo $api->last_updated;
        ?>
"><?php 
        printf(__('%s ago'), human_time_diff(strtotime($api->last_updated)));
        ?>
</span></li>
<?php 
    }
    if (!empty($api->requires)) {
        ?>
			<li><strong><?php 
        _e('Requires NXTClass Version:');
        ?>
</strong> <?php 
        printf(__('%s or higher'), $api->requires);
        ?>
</li>
<?php 
    }
    if (!empty($api->tested)) {
        ?>
			<li><strong><?php 
        _e('Compatible up to:');
        ?>
</strong> <?php 
        echo $api->tested;
        ?>
</li>
<?php 
    }
    if (!empty($api->downloaded)) {
        ?>
			<li><strong><?php 
        _e('Downloaded:');
        ?>
</strong> <?php 
        printf(_n('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded));
        ?>
</li>
<?php 
    }
    if (!empty($api->slug) && empty($api->external)) {
        ?>
			<li><a target="_blank" href="http://nxtclass.org/extend/plugins/<?php 
        echo $api->slug;
        ?>
/"><?php 
        _e('NXTClass.org Plugin Page &#187;');
        ?>
</a></li>
<?php 
    }
    if (!empty($api->homepage)) {
        ?>
			<li><a target="_blank" href="<?php 
        echo $api->homepage;
        ?>
"><?php 
        _e('Plugin Homepage  &#187;');
        ?>
</a></li>
<?php 
    }
    ?>
		</ul>
		<?php 
    if (!empty($api->rating)) {
        ?>
		<h2><?php 
        _e('Average Rating');
        ?>
</h2>
		<div class="star-holder" title="<?php 
        printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings));
        ?>
">
			<div class="star star-rating" style="width: <?php 
        echo esc_attr($api->rating);
        ?>
px"></div>
			<div class="star star5"><img src="<?php 
        echo admin_url('images/star.png?v=20110615');
        ?>
" alt="<?php 
        esc_attr_e('5 stars');
        ?>
" /></div>
			<div class="star star4"><img src="<?php 
        echo admin_url('images/star.png?v=20110615');
        ?>
" alt="<?php 
        esc_attr_e('4 stars');
        ?>
" /></div>
			<div class="star star3"><img src="<?php 
        echo admin_url('images/star.png?v=20110615');
        ?>
" alt="<?php 
        esc_attr_e('3 stars');
        ?>
" /></div>
			<div class="star star2"><img src="<?php 
        echo admin_url('images/star.png?v=20110615');
        ?>
" alt="<?php 
        esc_attr_e('2 stars');
        ?>
" /></div>
			<div class="star star1"><img src="<?php 
        echo admin_url('images/star.png?v=20110615');
        ?>
" alt="<?php 
        esc_attr_e('1 star');
        ?>
" /></div>
		</div>
		<small><?php 
        printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings));
        ?>
</small>
		<?php 
    }
    ?>
	</div>
	<div id="section-holder" class="wrap">
	<?php 
    if (!empty($api->tested) && version_compare(substr($GLOBALS['nxt_version'], 0, strlen($api->tested)), $api->tested, '>')) {
        echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of NXTClass.') . '</p></div>';
    } else {
        if (!empty($api->requires) && version_compare(substr($GLOBALS['nxt_version'], 0, strlen($api->requires)), $api->requires, '<')) {
            echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of NXTClass.') . '</p></div>';
        }
    }
    foreach ((array) $api->sections as $section_name => $content) {
        $title = $section_name;
        $title[0] = strtoupper($title[0]);
        $title = str_replace('_', ' ', $title);
        $content = links_add_base_url($content, 'http://nxtclass.org/extend/plugins/' . $api->slug . '/');
        $content = links_add_target($content, '_blank');
        $san_title = esc_attr(sanitize_title_with_dashes($title));
        $display = $section_name == $section ? 'block' : 'none';
        echo "\t<div id='section-{$san_title}' class='section' style='display: {$display};'>\n";
        echo "\t\t<h2 class='long-header'>{$title}</h2>";
        echo $content;
        echo "\t</div>\n";
    }
    echo "</div>\n";
    iframe_footer();
    exit;
}
Esempio n. 15
0
function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true)
{
    //Translate fields
    if ($translate && !empty($plugin_data['TextDomain'])) {
        if (!empty($plugin_data['DomainPath'])) {
            load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file) . $plugin_data['DomainPath']);
        } else {
            load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file));
        }
        foreach (array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field) {
            $plugin_data[$field] = translate($plugin_data[$field], $plugin_data['TextDomain']);
        }
    }
    $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'em' => array(), 'strong' => array());
    $plugin_data['AuthorName'] = $plugin_data['Author'] = nxt_kses($plugin_data['Author'], $plugins_allowedtags);
    //Apply Markup
    if ($markup) {
        if (!empty($plugin_data['PluginURI']) && !empty($plugin_data['Name'])) {
            $plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . esc_attr__('Visit plugin homepage') . '">' . $plugin_data['Name'] . '</a>';
        } else {
            $plugin_data['Title'] = $plugin_data['Name'];
        }
        if (!empty($plugin_data['AuthorURI']) && !empty($plugin_data['Author'])) {
            $plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '" title="' . esc_attr__('Visit author homepage') . '">' . $plugin_data['Author'] . '</a>';
        }
        $plugin_data['Description'] = nxttexturize($plugin_data['Description']);
        if (!empty($plugin_data['Author'])) {
            $plugin_data['Description'] .= ' <cite>' . sprintf(__('By %s'), $plugin_data['Author']) . '.</cite>';
        }
    }
    // Sanitize all displayed data. Author and AuthorName sanitized above.
    $plugin_data['Title'] = nxt_kses($plugin_data['Title'], $plugins_allowedtags);
    $plugin_data['Version'] = nxt_kses($plugin_data['Version'], $plugins_allowedtags);
    $plugin_data['Description'] = nxt_kses($plugin_data['Description'], $plugins_allowedtags);
    $plugin_data['Name'] = nxt_kses($plugin_data['Name'], $plugins_allowedtags);
    return $plugin_data;
}