/**
  * Generates content for a single row of the table
  *
  * @since 0.1-dev
  * @access protected
  *
  * @param object $item The current item.
  * @param string $column_name The current column name.
  */
 protected function column_default($item, $column_name)
 {
     switch ($column_name) {
         case 'name':
             return esc_html($item['name']);
         case 'created':
             if (empty($item['created'])) {
                 return '—';
             }
             return date(get_option('date_format', 'r'), $item['created']);
         case 'last_used':
             if (empty($item['last_used'])) {
                 return '—';
             }
             return date(get_option('date_format', 'r'), $item['last_used']);
         case 'last_ip':
             if (empty($item['last_ip'])) {
                 return '—';
             }
             return $item['last_ip'];
         case 'revoke':
             return get_submit_button(__('Revoke'), 'delete', 'revoke-application-password', false);
         default:
             return 'WTF^^?';
     }
 }
        public function dashboard_widget()
        {
            $projectId = 0;
            if (empty($this->gadwp->config->options['ga_dash_token'])) {
                echo '<p>' . __("This plugin needs an authorization:", 'google-analytics-dashboard-for-wp') . '</p><form action="' . menu_page_url('gadash_settings', false) . '" method="POST">' . get_submit_button(__("Authorize Plugin", 'google-analytics-dashboard-for-wp'), 'secondary') . '</form>';
                return;
            }
            if (current_user_can('manage_options')) {
                if ($this->gadwp->config->options['ga_dash_tableid_jail']) {
                    $projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
                } else {
                    echo '<p>' . __("An admin should asign a default Google Analytics Profile.", 'google-analytics-dashboard-for-wp') . '</p><form action="' . menu_page_url('gadash_settings', false) . '" method="POST">' . get_submit_button(__("Select Domain", 'google-analytics-dashboard-for-wp'), 'secondary') . '</form>';
                    return;
                }
            } else {
                if ($this->gadwp->config->options['ga_dash_tableid_jail']) {
                    $projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
                } else {
                    echo '<p>' . __("An admin should asign a default Google Analytics Profile.", 'google-analytics-dashboard-for-wp') . '</p><form action="' . menu_page_url('gadash_settings', false) . '" method="POST">' . get_submit_button(__("Select Domain", 'google-analytics-dashboard-for-wp'), 'secondary') . '</form>';
                    return;
                }
            }
            if (!$projectId) {
                echo '<p>' . __("Something went wrong while retrieving property data. You need to create and properly configure a Google Analytics account:", 'google-analytics-dashboard-for-wp') . '</p> <form action="https://deconf.com/how-to-set-up-google-analytics-on-your-website/" method="POST">' . get_submit_button(__("Find out more!", 'google-analytics-dashboard-for-wp'), 'secondary') . '</form>';
                return;
            }
            ?>
<div id="gadwp-window-1"></div>
<?php 
        }
Example #3
0
/**
 * Editor callback form.
 */
function wpcf_fields_radio_editor_callback()
{
    wpcf_admin_ajax_head('Insert checkbox', 'wpcf');
    $field = wpcf_admin_fields_get_field($_GET['field_id']);
    if (empty($field)) {
        echo '<div class="message error"><p>' . __('Wrong field specified', 'wpcf') . '</p></div>';
        wpcf_admin_ajax_footer();
        return '';
    }
    $form = array();
    $form['#form']['callback'] = 'wpcf_fields_radio_editor_submit';
    $form['display'] = array('#type' => 'radios', '#default_value' => 'db', '#name' => 'display', '#options' => array('display_from_db' => array('#title' => __('Display the value of this field from the database', 'wpcf'), '#name' => 'display', '#value' => 'db', '#inline' => true, '#after' => '<br />'), 'display_values' => array('#title' => __('Show one of these values:', 'wpcf'), '#name' => 'display', '#value' => 'value')), '#inline' => true);
    if (!empty($field['data']['options'])) {
        $form['table-open'] = array('#type' => 'markup', '#markup' => '<table style="margin-top:20px;" cellpadding="0" cellspacing="8">');
        foreach ($field['data']['options'] as $option_id => $option) {
            if ($option_id == 'default') {
                continue;
            }
            $value = isset($option['display_value']) ? $option['display_value'] : $option['value'];
            $form['display-value-' . $option_id] = array('#type' => 'textfield', '#title' => $option['title'], '#name' => 'options[' . $option_id . ']', '#value' => $value, '#inline' => true, '#pattern' => '<tr><td style="text-align:right;"><LABEL></td><td><ELEMENT></td></tr>', '#attributes' => array('style' => 'width:200px;'));
        }
        $form['table-close'] = array('#type' => 'markup', '#markup' => '</table>');
    }
    $form['submit'] = array('#type' => 'markup', '#markup' => get_submit_button());
    $f = wpcf_form('wpcf-form', $form);
    echo '<form method="post" action="">';
    echo $f->renderForm();
    echo '</form>';
    wpcf_admin_ajax_footer();
}
/**
 * Editor callback form.
 */
function wpcf_fields_checkbox_editor_callback()
{
    $form = array();
    $value_not_selected = '';
    $value_selected = '';
    if (isset($_GET['field_id'])) {
        $field = wpcf_admin_fields_get_field($_GET['field_id']);
        if (!empty($field)) {
            if (isset($field['data']['display_value_not_selected'])) {
                $value_not_selected = $field['data']['display_value_not_selected'];
            }
            if (isset($field['data']['display_value_selected'])) {
                $value_selected = $field['data']['display_value_selected'];
            }
        }
    }
    $form['#form']['callback'] = 'wpcf_fields_checkbox_editor_submit';
    $form['display'] = array('#type' => 'radios', '#default_value' => 'db', '#name' => 'display', '#options' => array('display_from_db' => array('#title' => __('Display the value of this field from the database', 'wpcf'), '#name' => 'display', '#value' => 'db', '#inline' => true, '#after' => '<br />'), 'display_values' => array('#title' => __('Show one of these two values:', 'wpcf'), '#name' => 'display', '#value' => 'value')), '#inline' => true);
    $form['display-value-1'] = array('#type' => 'textfield', '#title' => '<td style="text-align:right;">' . __('Not selected:', 'wpcf') . '</td><td>', '#name' => 'display_value_not_selected', '#value' => $value_not_selected, '#inline' => true, '#before' => '<table><tr>', '#after' => '</td></tr>');
    $form['display-value-2'] = array('#type' => 'textfield', '#title' => '<td style="text-align:right;">' . __('Selected:', 'wpcf') . '</td><td>', '#name' => 'display_value_selected', '#value' => $value_selected, '#after' => '</tr></table>');
    $form['submit'] = array('#type' => 'markup', '#markup' => get_submit_button());
    $f = wpcf_form('wpcf-form', $form);
    wpcf_admin_ajax_head('Insert checkbox', 'wpcf');
    echo '<form method="post" action="">';
    echo $f->renderForm();
    echo '</form>';
    wpcf_admin_ajax_footer();
}
    public function add_change_member_type_selectbox($where = '')
    {
        //Since wp will not pass whether it is for top/bottom, let us use static var to deremine position
        static $position;
        if (!isset($position)) {
            $position = 'top';
            //assume it will be called from top
        } else {
            $position = 'bottom';
        }
        //only admin/super admin
        if (!current_user_can('edit_users')) {
            return;
        }
        $member_types = bp_get_member_types(array(), 'objects');
        if (empty($member_types)) {
            return;
        }
        $output = '<div class="alignright" id="bp-member-type-change-action_' . $position . '">' . '<label for="new_member_type_' . $position . '" class="screen-reader-text">' . __('Change member type to…', 'bp-member-type-generator') . '</label>
					<select id="new_member_type_' . $position . '" name="new_member_type_' . $position . '">
					<option value="">' . __('Change member type to…', 'bp-member-type-generator') . '</option>';
        foreach ($member_types as $key => $type) {
            $output .= sprintf('<option value="%s">%s</option>', esc_attr($key), $type->labels['singular_name']);
        }
        $output .= '</select>';
        $output .= get_submit_button(__('Change', 'bp-member-type-generator'), 'secondary', 'change-member-type', false);
        $output .= '</div>';
        echo $output;
    }
Example #6
0
 /**
  * Generate HTML on the featured image size
  *
  * @param $content
  * @param $ID
  *
  * @return string
  */
 public static function admin_post_thumbnail_html($content, $ID)
 {
     $content .= '<span class="spinner"></span>';
     $content .= get_submit_button('Regenerate image sizes', 'primary', 'sis_featured', false, array('id' => 'sis_featured_regenerate', 'data-nonce' => wp_create_nonce('sis-regenerate-featured-' . $ID)));
     $content .= '<div class="sis_message"></div>';
     return $content;
 }
Example #7
0
 function buttons()
 {
     $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'display';
     $html = "";
     $html .= '<a href="' . get_home_url() . '?apollo=true&TB_iframe=true&width=640&height=632" class="preview thickbox thickbox-preview" title="Be sure to save your settings first">Preview</a>';
     $html .= '<a id="clear" href="?page=apollo_general_settings&tab=' . $active_tab . '&refresh" class="clear-settings">Clear Settings</a>';
     $html .= get_submit_button("Save Changes", "primary", "submit", false);
     $html = '<span>' . $html . '</span>';
     return $html;
 }
Example #8
0
 public function render()
 {
     printf('<div class="puc-debug-bar-panel" id="puc-debug-bar-panel_%1$s" data-slug="%1$s" data-nonce="%2$s">', esc_attr($this->updateChecker->slug), esc_attr(wp_create_nonce('puc-ajax')));
     $responseBox = '<div class="puc-ajax-response" style="display: none;"></div>';
     echo '<h3>Configuration</h3>';
     echo '<table class="puc-debug-data">';
     $this->row('Plugin file', htmlentities($this->updateChecker->pluginFile));
     $this->row('Slug', htmlentities($this->updateChecker->slug));
     $this->row('DB option', htmlentities($this->updateChecker->optionName));
     $requestInfoButton = function_exists('get_submit_button') ? get_submit_button('Request Info', 'secondary', 'puc-request-info-button', false) : '';
     $this->row('Metadata URL', htmlentities($this->updateChecker->metadataUrl) . ' ' . $requestInfoButton . $responseBox);
     if ($this->updateChecker->checkPeriod > 0) {
         $this->row('Automatic checks', 'Every ' . $this->updateChecker->checkPeriod . ' hours');
     } else {
         $this->row('Automatic checks', 'Disabled');
     }
     if (isset($this->updateChecker->throttleRedundantChecks)) {
         if ($this->updateChecker->throttleRedundantChecks && $this->updateChecker->checkPeriod > 0) {
             $this->row('Throttling', sprintf('Enabled. If an update is already available, check for updates every %1$d hours instead of every %2$d hours.', $this->updateChecker->throttledCheckPeriod, $this->updateChecker->checkPeriod));
         } else {
             $this->row('Throttling', 'Disabled');
         }
     }
     echo '</table>';
     echo '<h3>Status</h3>';
     echo '<table class="puc-debug-data">';
     $state = $this->updateChecker->getUpdateState();
     $checkNowButton = function_exists('get_submit_button') ? get_submit_button('Check Now', 'secondary', 'puc-check-now-button', false) : '';
     if (isset($state, $state->lastCheck)) {
         $this->row('Last check', $this->formatTimeWithDelta($state->lastCheck) . ' ' . $checkNowButton . $responseBox);
     } else {
         $this->row('Last check', 'Never');
     }
     $nextCheck = wp_next_scheduled($this->updateChecker->getCronHookName());
     $this->row('Next automatic check', $this->formatTimeWithDelta($nextCheck));
     if (isset($state, $state->checkedVersion)) {
         $this->row('Checked version', htmlentities($state->checkedVersion));
         $this->row('Cached update', $state->update);
     }
     $this->row('Update checker class', htmlentities(get_class($this->updateChecker)));
     echo '</table>';
     $update = $this->updateChecker->getUpdate();
     if ($update !== null) {
         echo '<h3>An Update Is Available</h3>';
         echo '<table class="puc-debug-data">';
         $fields = array('version', 'download_url', 'slug', 'homepage', 'upgrade_notice');
         foreach ($fields as $field) {
             $this->row(ucwords(str_replace('_', ' ', $field)), htmlentities($update->{$field}));
         }
         echo '</table>';
     } else {
         echo '<h3>No updates currently available</h3>';
     }
     echo '</div>';
 }
Example #9
0
function bizz_builder_screen_options($status, $args)
{
    if ($args->base == 'toplevel_page_bizz-layout') {
        $button = get_submit_button(__('Apply', 'bizzthemes'), 'button', 'screen-options-apply', false);
        $user = get_current_user_id();
        $usermeta = get_user_meta($user, 'templates_screen_options', true);
        $saved1 = isset($usermeta['inactive_widgets']) ? $usermeta['inactive_widgets'] : false;
        $checked1 = checked($saved1, 1, false);
        return "<h5>" . __('Show on screen', 'bizzthemes') . "</h5>\r\r\n\t\t\t\t\t<p class='cmi_custom_fields'>\r\r\n\t\t\t\t\t\t<input type='checkbox' value='1' id='templates_screen[inactive_widgets]' name='templates_screen[inactive_widgets]' {$checked1} />\r\r\n\t\t\t\t\t\t<label for='templates_screen[inactive_widgets]'>" . __('Show Inactive Widgets', 'bizzthemes') . "</label>\r\r\n\t\t\t\t\t</p>\r\r\n\t\t\t\t\t{$button}\r\r\n\t\t\t\t\t<input type='hidden' name='wp_screen_options[option]' value='templates_screen_options' />\r\r\n\t\t\t\t\t<input type='hidden' name='wp_screen_options[value]' value='yes' />\r\r\n\t\t\t\t\t";
    }
}
Example #10
0
 /**
  * Return form HTML replacing variables in a template string.
  *
  * @return string
  */
 private function printForm()
 {
     $title = apply_filters('the_title', $this->post->post_title);
     $nonce = self::NONCE . get_current_blog_id();
     $data = ['action' => esc_attr(Launcher::SLUG . '_send_mail'), 'postId' => $this->post->ID, 'postTitle' => esc_attr($title), 'recipient' => esc_attr($this->author->get('user_email')), 'messageLabel' => esc_html__('Message:', 'reject-notify'), 'button' => get_submit_button(esc_html__('Send', 'reject-notify')), 'nonce' => wp_nonce_field($nonce, self::NONCE, true, false), 'title' => sprintf(esc_html__('Send reject mail to %s', 'reject-notify'), esc_html($this->author->get('display_name'))), 'message' => vsprintf(esc_html__('Sorry %s, your post %s was rejected.', 'reject-notify'), [esc_html($this->author->get('display_name')), '&quot;' . esc_html($title) . '&quot;'])];
     $template = file_get_contents(dirname($this->path) . '/templates/form.php');
     foreach ($data as $key => $value) {
         $template = str_replace("{{{{$key}}}}", $value, $template);
     }
     return $template;
 }
Example #11
0
/**
 * Editor callback form.
 */
function wpcf_fields_url_editor_callback()
{
    $form = array();
    $form['#form']['callback'] = 'wpcf_fields_url_editor_submit';
    $form['title'] = array('#type' => 'textfield', '#title' => __('Title', 'wpcf'), '#description' => __('If set, this text will be displayed instead of raw data'), '#name' => 'title');
    $form['submit'] = array('#type' => 'markup', '#markup' => get_submit_button());
    $f = wpcf_form('wpcf-form', $form);
    wpcf_admin_ajax_head('Insert URL', 'wpcf');
    echo '<form method="post" action="">';
    echo $f->renderForm();
    echo '</form>';
    wpcf_admin_ajax_footer();
}
Example #12
0
/**
 * Editor callback form.
 */
function wpcf_fields_email_editor_callback()
{
    $last_settings = wpcf_admin_fields_get_field_last_settings($_GET['field_id']);
    $form = array();
    $form['#form']['callback'] = 'wpcf_fields_email_editor_submit';
    $form['title'] = array('#type' => 'textfield', '#title' => __('Title', 'wpcf'), '#description' => __('If set, this text will be displayed instead of raw data'), '#name' => 'title', '#value' => isset($last_settings['title']) ? $last_settings['title'] : '');
    $form['submit'] = array('#type' => 'markup', '#markup' => get_submit_button());
    $f = wpcf_form('wpcf-form', $form);
    wpcf_admin_ajax_head('Insert email', 'wpcf');
    echo '<form method="post" action="">';
    echo $f->renderForm();
    echo '</form>';
    wpcf_admin_ajax_footer();
}
Example #13
0
function mtphr_dnt_settings_display($active_tab = null)
{
    ?>
	<!-- Create a header in the default WordPress 'wrap' container -->
	<div class="wrap">

		<div id="icon-themes" class="icon32"></div>
		<h2><?php 
    _e('Ditty News Ticker Settings', 'ditty-news-ticker');
    ?>
</h2>
		<?php 
    settings_errors();
    ?>

		<?php 
    $tabs = mtphr_dnt_settings_tabs();
    $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'general';
    ?>

		<ul style="margin-bottom:20px;" class="subsubsub">
			<?php 
    $num_tabs = count($tabs);
    $count = 0;
    foreach ($tabs as $key => $tab) {
        $count++;
        $current = $key == $active_tab ? 'class="current"' : '';
        $sep = $count != $num_tabs ? ' |' : '';
        echo '<li><a href="?post_type=ditty_news_ticker&page=mtphr_dnt_settings&tab=' . $key . '" ' . $current . '>' . ucfirst($key) . '</a>' . $sep . '</li>';
    }
    ?>
		</ul>

		<br class="clear" />

		<form method="post" action="options.php">
			<?php 
    settings_fields($tabs[$active_tab]);
    do_settings_sections($tabs[$active_tab]);
    echo apply_filters('mtphr_dnt_settings_submit_button', get_submit_button());
    ?>
		</form>

	</div><!-- /.wrap -->
	<?php 
}
Example #14
0
 /**
  * Checks if there are existing settings from the Old iCal or Facebook Plugins
  * and displays a notice with a button to migrated those using AJAX
  *
  * @return string
  */
 public function notice()
 {
     if (!Tribe__Events__Aggregator__Page::instance()->is_screen()) {
         return false;
     }
     if (($this->is_facebook_migrated() || !$this->has_facebook_setting()) && ($this->is_ical_migrated() || !$this->has_ical_setting())) {
         return false;
     }
     $aggregator = Tribe__Events__Aggregator::instance();
     $html = '<p>' . esc_html__('Thanks for activating Event Aggregator! It looks like you have some settings and imports configured on our legacy importer plugins. To complete your transition, we need to transfer those options to our new system.', 'the-events-calendar');
     if (!$this->is_facebook_migrated() && $this->has_facebook_setting()) {
         $html .= '<p style="display:inline-block;">' . get_submit_button(esc_html__('Migrate Facebook Events settings', 'the-events-calendar'), 'secondary', 'tribe-migrate-facebook-settings', false) . '<span class="spinner"></span></p>';
     }
     if (!$this->is_ical_migrated() && $this->has_ical_setting()) {
         $html .= '<p style="display:inline-block;">' . get_submit_button(esc_html__('Migrate iCal Importer settings', 'the-events-calendar'), 'secondary', 'tribe-migrate-ical-settings', false) . '<span class="spinner"></span></p>';
     }
     return Tribe__Admin__Notices::instance()->render('tribe-aggregator-migrate-legacy-settings', $html);
 }
/**
 * {@internal Missing Short Description}}
 *
 * @since 2.5.0
 *
 * @param unknown_type $entry
 * @param unknown_type $count
 * @return unknown
 */
function file_gallery_list_meta_row($entry, &$count)
{
    static $update_nonce = false;
    if (is_protected_meta($entry['meta_key'], 'post')) {
        return;
    }
    if (!$update_nonce) {
        $update_nonce = wp_create_nonce('add-meta');
    }
    $r = '';
    ++$count;
    if ($count % 2) {
        $style = 'alternate';
    } else {
        $style = '';
    }
    if (is_serialized($entry['meta_value'])) {
        if (is_serialized_string($entry['meta_value'])) {
            // this is a serialized string, so we should display it
            $entry['meta_value'] = maybe_unserialize($entry['meta_value']);
        } else {
            // this is a serialized array/object so we should NOT display it
            --$count;
            return;
        }
    }
    $entry['meta_key'] = esc_attr($entry['meta_key']);
    $entry['meta_value'] = esc_textarea($entry['meta_value']);
    // using a <textarea />
    $entry['meta_id'] = (int) $entry['meta_id'];
    $delete_nonce = wp_create_nonce('delete-meta_' . $entry['meta_id']);
    $r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='{$style}'>";
    $r .= "\n\t\t<td class='left'><label class='screen-reader-text' for='meta[{$entry['meta_id']}][key]'>" . __('Key') . "</label><input name='meta[{$entry['meta_id']}][key]' id='meta[{$entry['meta_id']}][key]' type='text' size='20' value='{$entry['meta_key']}' />";
    $r .= "\n\t\t<div class='submit'>";
    $r .= get_submit_button(__('Delete'), 'deletemeta small', "deletemeta[{$entry['meta_id']}]", false, array('data-wp-lists' => "delete:attachment-the-list:meta-{$entry['meta_id']}::_ajax_nonce={$delete_nonce}"));
    $r .= "\n\t\t";
    $r .= get_submit_button(__('Update'), 'updatemeta small', "meta-{$entry['meta_id']}-submit", false, array('data-wp-lists' => "add:attachment-the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta={$update_nonce}"));
    $r .= "</div>";
    $r .= wp_nonce_field('change-meta', '_ajax_nonce', false, false);
    $r .= "</td>";
    $r .= "\n\t\t<td><label class='screen-reader-text' for='meta[{$entry['meta_id']}][value]'>" . __('Value') . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta[{$entry['meta_id']}][value]' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>";
    return $r;
}
Example #16
0
/**
 * Editor callback form.
 */
function wpcf_fields_numeric_editor_callback()
{
    wp_enqueue_style('wpcf-fields', WPCF_EMBEDDED_RES_RELPATH . '/css/basic.css', array(), WPCF_VERSION);
    wp_enqueue_script('jquery');
    // Get field
    $field = wpcf_admin_fields_get_field($_GET['field_id']);
    if (empty($field)) {
        _e('Wrong field specified', 'wpcf');
        die;
    }
    $last_settings = wpcf_admin_fields_get_field_last_settings($_GET['field_id']);
    $form = array();
    $form['#form']['callback'] = 'wpcf_fields_numeric_editor_submit';
    $form['format'] = array('#type' => 'textfield', '#title' => __('Output format', 'wpcf'), '#description' => __("Similar to sprintf function. Default: 'FIELD_NAME: FIELD_VALUE'.", 'wpcf'), '#name' => 'format', '#value' => isset($last_settings['format']) ? $last_settings['format'] : 'FIELD_NAME: FIELD_VALUE');
    $form['submit'] = array('#type' => 'markup', '#markup' => get_submit_button(__('Insert shortcode', 'wpcf')));
    $f = wpcf_form('wpcf-form', $form);
    wpcf_admin_ajax_head('Insert numeric', 'wpcf');
    echo '<form method="post" action="">';
    echo $f->renderForm();
    echo '</form>';
}
 /**
  * Admin page html
  *
  * @since 0.1
  */
 function admin_page()
 {
     $files = new WP_Parser_JSON_File();
     // abort if we cannot access the WP_Filesystem API
     if ($files->generate_files() === true) {
         return;
     }
     echo '<div class="wrap">';
     echo '<h2>' . __('WP Parser JSON', 'wp-parser-json') . '</h2>';
     echo '<p>' . __('Generate json files from all functions, hooks, filters, actions and classes', 'wp-parser-json') . '</p>';
     settings_errors();
     // don't show the form if the post types from WP Parser don't exist
     if (!$files->post_types_exists()) {
         return;
     }
     echo '<form method="post" action="">';
     wp_nonce_field('wp-parser-json_nonce');
     echo get_submit_button(esc_html__('Generate json files!', 'wp-parser-json'));
     echo '</form>';
     $errors = get_settings_errors();
     $settings_updated = true;
     // Check if new files were generated.
     if (!(isset($errors[0]['code']) && 'wp_parser_json_updated' === $errors[0]['code'])) {
         // Offer download link to old zip file if it exists.
         $zip_dir = plugin_dir_path(__FILE__) . 'json-files/wp-parser-json.zip';
         $version = plugin_dir_path(__FILE__) . 'json-files/version.json';
         if (file_exists($zip_dir) && file_exists($version)) {
             $version = json_decode(file_get_contents($version));
             $version = isset($version->version) ? '(WP ' . $version->version . ')' : '';
             echo '<a href="' . plugins_url('wp-parser-json') . '/json-files/wp-parser-json.zip">';
             printf(__('download %s files', 'wp-parser-json'), $version) . '</a>';
         }
         $settings_updated = false;
     }
     if ($settings_updated) {
         do_action('wp_parser_json_afer_form');
     }
     echo '</div>';
 }
Example #18
0
/**
 * Renders settings page
 */
function aviators_settings_render_settings_page()
{
    $plugins = aviator_core_get_all_plugins_list();
    $page = $_GET['page'];
    $config = aviators_settings_get_config($plugins[$page]['path'] . '/settings.json');
    $tabs = aviators_settings_get_tabs($page);
    $registered_tabs = aviators_settings_get_registered_pages($_GET['page']);
    $submit = get_submit_button();
    $active_tab = !empty($_GET['tab']) ? $_GET['tab'] : $tabs[0]->settings->slug;
    $forms = array();
    foreach ($registered_tabs as $registered_tab) {
        if ($registered_tab == $active_tab) {
            $forms[] = $_GET['page'] . '_' . $registered_tab;
        }
    }
    foreach ($tabs as $tab) {
        if ($tab->settings->slug == $active_tab) {
            $active_tab_title = $tab->settings->title;
        }
    }
    echo View::render('settings/wrapper.twig', array('active_tab_title' => $active_tab_title, 'title' => __('Settings', 'settings'), 'page_title' => $config->title, 'tabs' => aviators_settings_render_tabs(), 'forms' => $forms, 'active_tab' => $active_tab, 'submit' => $submit));
}
 private function displayStatus()
 {
     echo '<h3>Status</h3>';
     echo '<table class="puc-debug-data">';
     $state = $this->updateChecker->getUpdateState();
     $checkNowButton = '';
     if (function_exists('get_submit_button')) {
         $checkNowButton = get_submit_button('Check Now', 'secondary', 'puc-check-now-button', false, array('id' => 'puc-check-now-button-' . $this->updateChecker->slug));
     }
     if (isset($state, $state->lastCheck)) {
         $this->row('Last check', $this->formatTimeWithDelta($state->lastCheck) . ' ' . $checkNowButton . $this->responseBox);
     } else {
         $this->row('Last check', 'Never');
     }
     $nextCheck = wp_next_scheduled($this->updateChecker->scheduler->getCronHookName());
     $this->row('Next automatic check', $this->formatTimeWithDelta($nextCheck));
     if (isset($state, $state->checkedVersion)) {
         $this->row('Checked version', htmlentities($state->checkedVersion));
         $this->row('Cached update', $state->update);
     }
     $this->row('Update checker class', htmlentities(get_class($this->updateChecker)));
     echo '</table>';
 }
 public function Render()
 {
     echo '<div class="wrap">';
     echo '<form id="' . $this->ID() . ' action="" method="post">';
     $header = array();
     //Workspace Title
     $header['title'] = $this->Title();
     // $text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = ''
     $header['save'] = get_submit_button(__('Save Changes', 'clearbase'), 'primary large', 'save-changes', false, 'class="button-primary"');
     //Allow for custom header handling
     $header = apply_filters('clearbase_admin_header', $header);
     echo '<h2 class="workspace-h2">';
     echo "<ul class='header'>\n";
     foreach ($header as $id => $item) {
         echo "<li class='header-item {$id}'>{$item}</li>";
     }
     echo "</ul>";
     echo '</h2>';
     // End Render Header
     //render the settings fields
     parent::Render();
     echo '</form></div>';
 }
Example #21
0
 /**
  * Returns a submit button, with provided text and appropriate class, copied from WP Core for use on the frontend
  *
  * @see get_submit_button
  *
  * @param string $text The text of the button (defaults to 'Save Changes')
  * @param string $type The type of button. One of: primary, secondary, delete
  * @param string $name The HTML name of the submit button. Defaults to "submit". If no id attribute
  *               is given in $other_attributes below, $name will be used as the button's id.
  * @param bool $wrap True if the output button should be wrapped in a paragraph tag,
  * 			   false otherwise. Defaults to true
  * @param array|string $other_attributes Other attributes that should be output with the button,
  *                     mapping attributes to their values, such as array( 'tabindex' => '1' ).
  *                     These attributes will be output as attribute="value", such as tabindex="1".
  *                     Defaults to no other attributes. Other attributes can also be provided as a
  *                     string such as 'tabindex="1"', though the array format is typically cleaner.
  *
  * @since 3.0
  */
 public static function submit_button($text = null, $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = null)
 {
     if (function_exists('get_submit_button')) {
         return get_submit_button($text, $type, $name, $wrap, $other_attributes);
     }
     if (!is_array($type)) {
         $type = explode(' ', $type);
     }
     $button_shorthand = array('primary', 'small', 'large');
     $classes = array('button');
     foreach ($type as $t) {
         if ('secondary' === $t || 'button-secondary' === $t) {
             continue;
         }
         $classes[] = in_array($t, $button_shorthand) ? 'button-' . $t : $t;
     }
     $class = implode(' ', array_unique($classes));
     if ('delete' === $type) {
         $class = 'button-secondary delete';
     }
     $text = $text ? $text : __('Save Changes');
     // Default the id attribute to $name unless an id was specifically provided in $other_attributes
     $id = $name;
     if (is_array($other_attributes) && isset($other_attributes['id'])) {
         $id = $other_attributes['id'];
         unset($other_attributes['id']);
     }
     $attributes = '';
     if (is_array($other_attributes)) {
         foreach ($other_attributes as $attribute => $value) {
             $attributes .= $attribute . '="' . esc_attr($value) . '" ';
             // Trailing space is important
         }
     } elseif (!empty($other_attributes)) {
         // Attributes provided as a string
         $attributes = $other_attributes;
     }
     $button = '<input type="submit" name="' . esc_attr($name) . '" id="' . esc_attr($id) . '" class="' . esc_attr($class);
     $button .= '" value="' . esc_attr($text) . '" ' . $attributes . ' />';
     if ($wrap) {
         $button = '<p class="submit">' . $button . '</p>';
     }
     return $button;
 }
Example #22
0
/**
 * Echoes a submit button, with provided text and appropriate class(es).
 *
 * @since 3.1.0
 *
 * @see get_submit_button()
 *
 * @param string       $text             The text of the button (defaults to 'Save Changes')
 * @param string       $type             Optional. The type and CSS class(es) of the button. Core values
 *                                       include 'primary', 'secondary', 'delete'. Default 'primary'
 * @param string       $name             The HTML name of the submit button. Defaults to "submit". If no
 *                                       id attribute is given in $other_attributes below, $name will be
 *                                       used as the button's id.
 * @param bool         $wrap             True if the output button should be wrapped in a paragraph tag,
 *                                       false otherwise. Defaults to true
 * @param array|string $other_attributes Other attributes that should be output with the button, mapping
 *                                       attributes to their values, such as setting tabindex to 1, etc.
 *                                       These key/value attribute pairs will be output as attribute="value",
 *                                       where attribute is the key. Other attributes can also be provided
 *                                       as a string such as 'tabindex="1"', though the array format is
 *                                       preferred. Default null.
 */
function submit_button($text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null)
{
    echo get_submit_button($text, $type, $name, $wrap, $other_attributes);
}
Example #23
0
/**
 * Creates the form for external url
 *
 * @since 2.7.0
 *
 * @param string $default_view
 * @return string the form html
 */
function wp_media_insert_url_form($default_view = 'image')
{
    /** This filter is documented in wp-admin/includes/media.php */
    if (!apply_filters('disable_captions', '')) {
        $caption = '
		<tr class="image-only">
			<th scope="row" class="label">
				<label for="caption"><span class="alignleft">' . __('Image Caption') . '</span></label>
			</th>
			<td class="field"><textarea id="caption" name="caption"></textarea></td>
		</tr>
';
    } else {
        $caption = '';
    }
    $default_align = get_option('image_default_align');
    if (empty($default_align)) {
        $default_align = 'none';
    }
    if ('image' == $default_view) {
        $view = 'image-only';
        $table_class = '';
    } else {
        $view = $table_class = 'not-image';
    }
    return '
	<p class="media-types"><label><input type="radio" name="media_type" value="image" id="image-only"' . checked('image-only', $view, false) . ' /> ' . __('Image') . '</label> &nbsp; &nbsp; <label><input type="radio" name="media_type" value="generic" id="not-image"' . checked('not-image', $view, false) . ' /> ' . __('Audio, Video, or Other File') . '</label></p>
	<table class="describe ' . $table_class . '"><tbody>
		<tr>
			<th scope="row" class="label" style="width:130px;">
				<label for="src"><span class="alignleft">' . __('URL') . '</span></label>
				<span class="alignright"><abbr id="status_img" title="required" class="required">*</abbr></span>
			</th>
			<td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()" /></td>
		</tr>

		<tr>
			<th scope="row" class="label">
				<label for="title"><span class="alignleft">' . __('Title') . '</span></label>
				<span class="alignright"><abbr title="required" class="required">*</abbr></span>
			</th>
			<td class="field"><input id="title" name="title" value="" type="text" aria-required="true" /></td>
		</tr>

		<tr class="not-image"><td></td><td><p class="help">' . __('Link text, e.g. &#8220;Ransom Demands (PDF)&#8221;') . '</p></td></tr>

		<tr class="image-only">
			<th scope="row" class="label">
				<label for="alt"><span class="alignleft">' . __('Alternative Text') . '</span></label>
			</th>
			<td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
			<p class="help">' . __('Alt text for the image, e.g. &#8220;The Mona Lisa&#8221;') . '</p></td>
		</tr>
		' . $caption . '
		<tr class="align image-only">
			<th scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
			<td class="field">
				<input name="align" id="align-none" value="none" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'none' ? ' checked="checked"' : '') . ' />
				<label for="align-none" class="align image-align-none-label">' . __('None') . '</label>
				<input name="align" id="align-left" value="left" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'left' ? ' checked="checked"' : '') . ' />
				<label for="align-left" class="align image-align-left-label">' . __('Left') . '</label>
				<input name="align" id="align-center" value="center" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'center' ? ' checked="checked"' : '') . ' />
				<label for="align-center" class="align image-align-center-label">' . __('Center') . '</label>
				<input name="align" id="align-right" value="right" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'right' ? ' checked="checked"' : '') . ' />
				<label for="align-right" class="align image-align-right-label">' . __('Right') . '</label>
			</td>
		</tr>

		<tr class="image-only">
			<th scope="row" class="label">
				<label for="url"><span class="alignleft">' . __('Link Image To:') . '</span></label>
			</th>
			<td class="field"><input id="url" name="url" value="" type="text" /><br />

			<button type="button" class="button" value="" onclick="document.forms[0].url.value=null">' . __('None') . '</button>
			<button type="button" class="button" value="" onclick="document.forms[0].url.value=document.forms[0].src.value">' . __('Link to image') . '</button>
			<p class="help">' . __('Enter a link URL or click above for presets.') . '</p></td>
		</tr>
		<tr class="image-only">
			<td></td>
			<td>
				<input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . esc_attr__('Insert into Post') . '" />
			</td>
		</tr>
		<tr class="not-image">
			<td></td>
			<td>
				' . get_submit_button(__('Insert into Post'), 'button', 'insertonlybutton', false) . '
			</td>
		</tr>
	</tbody></table>
';
}
Example #24
0
    /**
     * Render the items per page option
     *
     * @since 3.3.0
     */
    public function render_per_page_options()
    {
        if (!$this->get_option('per_page')) {
            return;
        }
        $per_page_label = $this->get_option('per_page', 'label');
        $option = $this->get_option('per_page', 'option');
        if (!$option) {
            $option = str_replace('-', '_', "{$this->id}_per_page");
        }
        $per_page = (int) get_user_option($option);
        if (empty($per_page) || $per_page < 1) {
            $per_page = $this->get_option('per_page', 'default');
            if (!$per_page) {
                $per_page = 20;
            }
        }
        if ('edit_comments_per_page' == $option) {
            $comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all';
            /** This filter is documented in wp-admin/includes/class-wp-comments-list-table.php */
            $per_page = apply_filters('comments_per_page', $per_page, $comment_status);
        } elseif ('categories_per_page' == $option) {
            /** This filter is documented in wp-admin/includes/class-wp-terms-list-table.php */
            $per_page = apply_filters('edit_categories_per_page', $per_page);
        } else {
            /** This filter is documented in wp-admin/includes/class-wp-list-table.php */
            $per_page = apply_filters($option, $per_page);
        }
        // Back compat
        if (isset($this->post_type)) {
            /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
            $per_page = apply_filters('edit_posts_per_page', $per_page, $this->post_type);
        }
        ?>
		<div class="screen-options">
			<?php 
        if ($per_page_label) {
            ?>
				<input type="number" step="1" min="1" max="999" class="screen-per-page" name="wp_screen_options[value]"
					id="<?php 
            echo esc_attr($option);
            ?>
" maxlength="3"
					value="<?php 
            echo esc_attr($per_page);
            ?>
" />
				<label for="<?php 
            echo esc_attr($option);
            ?>
">
					<?php 
            echo esc_html($per_page_label);
            ?>
				</label>
			<?php 
        }
        echo get_submit_button(__('Apply'), 'button', 'screen-options-apply', false);
        ?>
			<input type='hidden' name='wp_screen_options[option]' value='<?php 
        echo esc_attr($option);
        ?>
' />
		</div>
		<?php 
    }
Example #25
0
 public static function actions($container, $output = 'string', $html = array())
 {
     if (empty($container->actions)) {
         return 'string' === $output ? '' : array();
     }
     $html[] = '<div class="' . self::abbr('actions') . '">';
     foreach ($container->actions as $action => $label) {
         $html[] = get_submit_button($label, 'primary', self::plugin . '[actions][' . $action . ']', false);
     }
     $html[] = '</div>';
     $html = apply_filters(self::plugin . '/fields/field-actions', $html, $container);
     if ('string' === $output) {
         return implode("\r\n", $html);
     } else {
         return $html;
     }
 }
Example #26
0
    /**
     * Creates save, reset and upgrade buttons
     *
     * @return string
     */
    protected function save()
    {
        echo '<div class="grid col-940">
                <p class="submit">
				' . get_submit_button(__('Save Options', 'responsive'), 'primary', 'responsive_theme_options[submit]', false) . get_submit_button(__('Restore Defaults', 'responsive'), 'secondary', 'responsive_theme_options[reset]', false, $this->attributes) . '
                <a href="http://cyberchimps.com/store/responsivepro/" class="button upgrade">' . __('Upgrade', 'responsive') . '</a>
                </p>
                </div>';
    }
 /**
  * Creates save, reset and upgrade buttons
  *
  * @return string
  */
 protected function save()
 {
     $html = '<div class="col-md-12"><p class="submit">' . get_submit_button(__('Save Options', 'responsive-mobile'), 'primary', 'responsive_mobile_theme_options[submit]', false) . ' ' . get_submit_button(__('Restore Defaults', 'responsive-mobile'), 'secondary', 'responsive_mobile_theme_options[reset]', false, $this->attributes) . '</p></div>';
     return $html;
 }
    public function global_settings_page()
    {
        $share_buttons_ids = WPiDesButCommon::get_share_buttons_ids();
        $fields = array(array("label" => "Share Buttons Enabled?", "name" => 'share_buttons', "type" => "select", "section" => "Share Buttons", "group" => "Share Buttons", "value" => "", "list" => array("0" => "Disable", "1" => "Enable")), array("label" => "Share Buttons Set", "name" => 'share_buttons_set', "type" => "select", "section" => "Share Buttons Set", "group" => "Share Buttons Set", "value" => "", "list" => $share_buttons_ids), array("label" => "Share Button Above/Below Content", "name" => 'share_buttons_location', "type" => "select", "section" => "Share Buttons Location", "group" => "Share Buttons Location", "value" => "", "list" => array("above" => "Above", "below" => "Below"), "default" => "below"));
        $share_buttons = WPiTemplate::html_option("global_settings", $fields);
        $fields = array(array("label" => "Dashboard Widget Enabled?", "name" => 'dashboard_widget', "type" => "select", "section" => "general", "group" => "general", "value" => "", "list" => array("0" => "Disable", "1" => "Enable"), "default" => 1), array("label" => "Button 'Rel' Attribute Enabled?", "name" => 'button_rel', "type" => "select", "section" => "general", "group" => "general", "value" => "", "list" => array("0" => "Disable", "1" => "Enable"), "default" => 0));
        $general = WPiTemplate::html_option("global_settings", $fields);
        $news = $this->get_news();
        $help = self::help();
        $args = array(array("id" => "wpi_general", "text" => "General", "content" => $general), array("id" => "wpi_share_buttons", "text" => "Share Buttons", "content" => $share_buttons), array("id" => "wpi_news", "text" => "News", "content" => $news), array("id" => "wpi_help", "text" => "Help", "content" => $help, "active" => true));
        $tabs = WPiTemplate::create_tabs($args);
        $out = '
		<div id="wpi_admin">
		  <div id="wpi_gs_header">
			<div id="wpi_gs_heading"><img src="' . WPIDB_URL . 'images/PRALI_dg.png"/><span>PRALI</spna></div>
			<div id="wpi_gs_product_logo"><img src="' . WPIDB_URL . 'images/product_logo.png"/></div>
			<div id="wpi_gs_header_bg"></div>
			<div id="wpi_gs_header_ha"></div>
		  </div>  
		  <div id="wpi_gs_content">
			<div id="wpi_gs_content_inner">
			  <div id="wpi_gs_content_header">Global Settings</div>
			  <div id="wpi_gs_content_content"><form method="post" action="admin.php?page=global_settings">' . $tabs . get_submit_button() . '</form></div>
			</div>
		  </div>
		</div>';
        echo $out;
    }
Example #29
0
 /**
  * build out the various submit buttons for different parts of the admin page
  *
  * @param  string  $title     the button text to display
  * @param  string  $type      the action being taken, used in the button ID and a data attribute
  *
  * @return html               the HTML markup of the button
  */
 public static function user_action_button($title = '', $type = '')
 {
     // set all my classes in an array
     $class = array('delete', 'small', 'tempadmin-user-action', 'tempadmin-action-button-red');
     // cast my type to make sure it doesn't mess anything up
     $type = !empty($type) ? esc_sql($type) : 'unknown';
     // build the button
     $button = get_submit_button($title, $class, '', false, array('id' => 'tempadmin-user-action-' . $type, 'data-type' => $type));
     // add a hidden field to indicate which action is happening
     $hidden = '<input type="hidden" name="tempadmin-user-action" value="' . $type . '">';
     // add our nonce for non JS saving
     $nonce = wp_nonce_field('tempadmin_' . $type . '_nojs', 'tempadmin-manual-' . $type . '-nonce', true, false);
     // return them both
     return $button . $hidden . $nonce;
 }
    /**
     * {@internal Missing Short Description}}
     *
     * @since 2.5.0
     *
     * @param unknown_type $errors
     */
    function media_upload_shared_media($errors)
    {
        global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types, $blog_id;
        media_upload_header();
        if (count($this->blogs) == 0) {
            echo '<form><h3 class="media-title">' . __("You don't have access to any other sites media...", 'networksharedmedia') . '</h3></form>';
            return;
        }
        // set the first part of the form action url now, to the current active site, to prevent X-Frame-Options problems
        $form_action_url = plugins_url('media-upload.php', __FILE__);
        $nsm_blog_id = null;
        if (!array_key_exists('blog_id', $_GET)) {
            $_GET['blog_id'] = null;
        }
        foreach ($this->blogs as $blog) {
            if ($_GET['blog_id'] == $blog['blog_id']) {
                $nsm_blog_id = $blog['blog_id'];
                break;
            }
        }
        if (null == $nsm_blog_id) {
            $nsm_blog_id = $this->blogs[0]['blog_id'];
        }
        switch_to_blog($nsm_blog_id);
        ?>

<?php 
        $post_id = intval($_REQUEST['post_id']);
        // fix to make get_media_item add "Insert" button
        unset($_GET['post_id']);
        $form_action_url .= "?type={$type}&tab=library&post_id={$post_id}&blog_id={$blog_id}";
        $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
        $form_class = 'media-upload-form validate';
        $_GET['paged'] = isset($_GET['paged']) ? intval($_GET['paged']) : 0;
        if ($_GET['paged'] < 1) {
            $_GET['paged'] = 1;
        }
        $start = ($_GET['paged'] - 1) * 10;
        if ($start < 1) {
            $start = 0;
        }
        add_filter('post_limits', create_function('$a', "return 'LIMIT {$start}, 10';"));
        list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
        ?>
	
	<form id="filter" action="" method="get">
	<input type="hidden" name="type" value="<?php 
        echo esc_attr($type);
        ?>
" />
	<input type="hidden" name="tab" value="<?php 
        echo esc_attr($tab);
        ?>
" />
	<input type="hidden" name="post_id" value="<?php 
        echo (int) $post_id;
        ?>
" />
	<input type="hidden" name="blog_id" value="<?php 
        echo (int) $blog_id;
        ?>
" />
	<input type="hidden" name="post_mime_type" value="<?php 
        echo isset($_GET['post_mime_type']) ? esc_attr($_GET['post_mime_type']) : '';
        ?>
" />
	<?php 
        if (isset($_GET['chromeless'])) {
            ?>
	<input type="hidden" name="chromeless" value="<?php 
            echo (bool) $_GET['chromeless'];
            ?>
" />
	<?php 
        }
        ?>

	<style type="text/css">
		#media-upload #filter .nsm-site-select { float: none; width: 100%; margin: 0 1em 2em 1em; white-space: normal; }
	</style>

	<ul class="subsubsub nsm-site-select">
	<?php 
        if (count($this->blogs) == 1) {
            $blog = reset($this->blogs);
            echo "<li>" . __('Selected site:', 'networksharedmedia') . "</li>" . "<li><a href='" . esc_url(add_query_arg(array('blog_id' => $blog['blog_id'], 'paged' => false))) . "' class='current'>" . $blog['name'] . '</a>' . '</li>';
        } else {
            $all_blog_names = array();
            foreach ($this->blogs as $blog) {
                $all_blog_names[] = $blog['name'];
            }
            if (strlen(__('Select site:', 'networksharedmedia') . ' ' . implode(' | ', $all_blog_names)) < 71) {
                $blog_links = array();
                foreach ($this->blogs as $blog) {
                    $class = '';
                    if ($blog['blog_id'] == $blog_id) {
                        $class = ' class="current"';
                    }
                    $blog_links[] = "<li><a href='" . esc_url(add_query_arg(array('blog_id' => $blog['blog_id'], 'paged' => false))) . "'{$class}>" . $blog['name'] . '</a>';
                }
                echo "<li>" . __('Select site:', 'networksharedmedia') . " </li>" . implode(' | </li>', $blog_links) . '</li>';
                unset($blog_links);
            } else {
                $blog_options = array();
                foreach ($this->blogs as $blog) {
                    $selected = '';
                    if ($blog['blog_id'] == $blog_id) {
                        $selected = ' selected="selected"';
                    }
                    $blog_options[] = "<option value='{$blog['blog_id']}'{$selected}>" . $blog['name'] . '</option>';
                }
                echo "<li>" . __('Select site:', 'networksharedmedia') . "</li><li> <select name='blog_id'>" . implode('', $blog_options) . '</select></li><li> ' . get_submit_button(__('Select &#187;', 'networksharedmedia'), 'secondary', 'nsm-post-query-submit', false) . '</li>';
                unset($blog_options);
            }
            unset($all_blog_names);
        }
        ?>
	</ul>

	<p id="media-search" class="search-box">
		<label class="screen-reader-text" for="media-search-input"><?php 
        _e('Search Media');
        ?>
:</label>
		<input type="text" id="media-search-input" name="s" value="<?php 
        the_search_query();
        ?>
" />
		<?php 
        submit_button(__('Search Media'), 'button', '', false);
        ?>
	</p>
	
	<ul class="subsubsub">
	<?php 
        $type_links = array();
        $_num_posts = (array) wp_count_attachments();
        $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
        foreach ($matches as $_type => $reals) {
            foreach ($reals as $real) {
                if (isset($num_posts[$_type])) {
                    $num_posts[$_type] += $_num_posts[$real];
                } else {
                    $num_posts[$_type] = $_num_posts[$real];
                }
            }
        }
        // If available type specified by media button clicked, filter by that type
        if (empty($_GET['post_mime_type']) && !empty($num_posts[$type])) {
            $_GET['post_mime_type'] = $type;
            list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
        }
        if (empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all') {
            $class = ' class="current"';
        } else {
            $class = '';
        }
        $type_links[] = "<li><a href='" . esc_url(add_query_arg(array('post_mime_type' => 'all', 'paged' => false, 'm' => false))) . "'{$class}>" . __('All Types') . "</a>";
        foreach ($post_mime_types as $mime_type => $label) {
            $class = '';
            if (!wp_match_mime_types($mime_type, $avail_post_mime_types)) {
                continue;
            }
            if (isset($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type'])) {
                $class = ' class="current"';
            }
            $type_links[] = "<li><a href='" . esc_url(add_query_arg(array('post_mime_type' => $mime_type, 'paged' => false))) . "'{$class}>" . sprintf(translate_nooped_plural($label[2], $num_posts[$mime_type]), "<span id='{$mime_type}-counter'>" . number_format_i18n($num_posts[$mime_type]) . '</span>') . '</a>';
        }
        echo implode(' | </li>', apply_filters('media_upload_mime_type_links', $type_links)) . '</li>';
        unset($type_links);
        ?>
	</ul>
	
	<div class="tablenav">
	
	<?php 
        $page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('&laquo;'), 'next_text' => __('&raquo;'), 'total' => ceil($wp_query->found_posts / 10), 'current' => $_GET['paged']));
        if ($page_links) {
            echo "<div class='tablenav-pages'>{$page_links}</div>";
        }
        ?>
	
	<div class="alignleft actions">
	<?php 
        $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM {$wpdb->posts} WHERE post_type = 'attachment' ORDER BY post_date DESC";
        $arc_result = $wpdb->get_results($arc_query);
        $month_count = count($arc_result);
        if ($month_count && !(1 == $month_count && 0 == $arc_result[0]->mmonth)) {
            ?>
	<select name='m'>
	<option<?php 
            selected(@$_GET['m'], 0);
            ?>
 value='0'><?php 
            _e('Show all dates');
            ?>
</option>
	<?php 
            foreach ($arc_result as $arc_row) {
                if ($arc_row->yyear == 0) {
                    continue;
                }
                $arc_row->mmonth = zeroise($arc_row->mmonth, 2);
                if (isset($_GET['m']) && $arc_row->yyear . $arc_row->mmonth == $_GET['m']) {
                    $default = ' selected="selected"';
                } else {
                    $default = '';
                }
                echo "<option{$default} value='" . esc_attr($arc_row->yyear . $arc_row->mmonth) . "'>";
                echo esc_html($wp_locale->get_month($arc_row->mmonth) . " {$arc_row->yyear}");
                echo "</option>\n";
            }
            ?>
	</select>
	<?php 
        }
        ?>
	
	<?php 
        submit_button(__('Filter &#187;'), 'secondary', 'post-query-submit', false);
        ?>
	
	</div>
	
	<br class="clear" />
	</div>
	</form>
	
	<form enctype="multipart/form-data" method="post" action="<?php 
        echo esc_attr($form_action_url);
        ?>
" class="<?php 
        echo $form_class;
        ?>
" id="library-form">
	
	<?php 
        wp_nonce_field('media-form');
        ?>
	<?php 
        //media_upload_form( $errors );
        ?>

	<?php 
        if (isset($_GET['chromeless']) && $_GET['chromeless']) {
            // WP3.5+ Media Browser calls iframe 'chromeless' and handles inserting differently
            ?>
	<script type="text/javascript">
	/* <![CDATA[ */
	function nsm_media_send_to_editor(htmlString) {
		<?php 
            /* copied from /wp-admin/includes/media.php media_send_to_editor() */
            ?>
		var win = window.dialogArguments || opener || parent || top;
		win.send_to_editor(htmlString);
	}

	jQuery(function($){
		$('input[id^=send].button').click(function(event) {
			event.preventDefault();
			var $this = $(event.target);
			var form = $('#library-form');
			var result = $.ajax({
				url: form.attr('action'),
				type: form.attr('method'),
				data: form.serialize() + '&' + encodeURIComponent($this.attr('id') ) + '=true&chromeless=1',
				success: nsm_media_send_to_editor
			});
		});
	});
	/* ]]> */
	</script>
	<?php 
        }
        /* chromeless */
        ?>

	<script type="text/javascript">
	<!--
	jQuery(function($){
		var preloaded = $(".media-item.preloaded");
		if ( preloaded.length > 0 ) {
			preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
			updateMediaForm();
		}
	});
	-->
	</script>
	
	<div id="media-items">
	<?php 
        add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
        ?>
	<?php 
        echo $this->get_media_items(null, $errors);
        ?>
	</div>
	<p class="ml-submit"></p>
	</form>
	<?php 
    }