コード例 #1
0
function wfu_clean_log_prompt()
{
    $siteurl = site_url();
    if (!current_user_can('manage_options')) {
        return wfu_manage_mainmenu();
    }
    $echo_str = "\n" . '<div class="wrap">';
    $echo_str .= "\n\t" . '<div style="margin-top:20px;">';
    $echo_str .= "\n\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=maintenance_actions" class="button" title="go back">Go back</a>';
    $echo_str .= "\n\t" . '</div>';
    $echo_str .= "\n\t" . '<h2 style="margin-bottom: 10px;">Clean Database Log</h2>';
    $echo_str .= "\n\t" . '<form enctype="multipart/form-data" name="clean_log" id="clean_log" method="post" action="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload" class="validate">';
    $nonce = wp_nonce_field('wfu_clean_log', '_wpnonce', false, false);
    $nonce_ref = wp_referer_field(false);
    $echo_str .= "\n\t\t" . $nonce;
    $echo_str .= "\n\t\t" . $nonce_ref;
    $echo_str .= "\n\t\t" . '<input type="hidden" name="action" value="clean_log">';
    $echo_str .= "\n\t\t" . '<label>Are you sure that you want to clean the database log? This will erase all file data kept by the plugin in the database. Files uploaded by the plugin will be maintained, however all relevant information, such as user data, will be erased.</label><br/>';
    $echo_str .= "\n\t\t" . '<p class="submit">';
    $echo_str .= "\n\t\t\t" . '<input type="submit" class="button-primary" name="submit" value="Yes">';
    $echo_str .= "\n\t\t\t" . '<input type="submit" class="button-primary" name="submit" value="Cancel">';
    $echo_str .= "\n\t\t" . '</p>';
    $echo_str .= "\n\t" . '</form>';
    $echo_str .= "\n" . '</div>';
    return $echo_str;
}
コード例 #2
0
ファイル: upload.php プロジェクト: iaakash/chriskeef
 public function iframe()
 {
     global $thesis, $wp_scripts;
     if (!wp_verify_nonce($_GET['window_nonce'], 'thesis_upload_iframe') && current_user_can('upload_files')) {
         wp_die(__('You are not allowed to upload files.', 'thesis'));
     }
     $file = in_array($this->args['file_type'], array('image', 'txt')) ? 'admin-post' : 'update';
     $button_text = !empty($this->args['button']) ? esc_attr($this->args['button']) : ($this->args['file_type'] == 'zip' ? sprintf(__('Add %s', 'thesis'), ucwords(esc_attr($this->args['folder']))) : ($this->args['file_type'] == 'image' ? __('Add Image', 'thesis') : ($this->args['file_type'] == 'txt' ? __('Import Data', 'thesis') : __('Upload', 'thesis'))));
     $import = !empty($_GET['import']) && $_GET['import'] == 'true' ? true : false;
     $image = !empty($_GET['height']) && !empty($_GET['width']) && !empty($_GET['url']) ? true : false;
     echo "<!DOCTYPE html>\n", "<html dir=\"ltr\" lang=\"en-US\">\n", "<head>\n", "<style type=\"text/css\">* { margin: 0; padding: 0; } body #t_canvas { padding: 0; } p.option_field { margin-bottom: 12px; }</style>\n", "<link rel=\"stylesheet\" href=\"", THESIS_CSS_URL, "/admin.css\" type=\"text/css\" media=\"all\" />\n", "<link rel=\"stylesheet\" href=\"", THESIS_CSS_URL, "/options.css\" type=\"text/css\" media=\"all\" />\n";
     do_action($this->args['prefix'] . '_thesis_iframe_head');
     echo $image && empty($import) ? "<script type=\"text/javascript\">\n" . "var thesis_image_result = { height: " . (int) $_GET['height'] . ", width: " . (int) $_GET['width'] . ", url: '" . esc_url($_GET['url']) . "' };\n" . "</script>\n" : '', "</head>\n";
     do_action("{$this->args['prefix']}_before_thesis_iframe_form");
     echo "<body>\n", "\t<div id=\"t_canvas\">\t", "\t\t<form id=\"t_iframe\" method=\"post\" action=\"", admin_url("{$file}.php?action="), esc_attr($this->args['action']), "\" enctype=\"multipart/form-data\">\n", "\t\t\t<p class=\"option_field\">\n", "\t\t\t\t<input type=\"file\" data-style=\"input\" name=\"thesis_file\" />\n", "\t\t\t</p>\n", "\t\t\t<div id=\"t_iframe_submit\">\n", "\t\t\t\t<input type=\"submit\" id=\"t_upload_button\" data-style=\"button ", esc_attr($this->args['button_context']), "\" value=\"{$button_text}\" />\n", $this->args['show_delete'] === true ? "\t\t\t\t<style type=\"text/css\">#t_canvas #t_delete_button { margin-left: 12px; }</style>\n" . "\t\t\t\t<button id=\"t_delete_button\" data-style=\"button delete\" name=\"delete_image\" value=\"1\">" . esc_attr($this->args['delete_text']) . "</button>\n" : '', "\t\t\t\t", wp_nonce_field($this->args['nonce'], 'thesis_form_nonce', false, false), "\n", "\t\t\t\t", wp_referer_field(false), "\n", "\t\t\t\t<input type=\"hidden\" value=\"", esc_attr($this->args['folder']), "\" name=\"location\" />\n", "\t\t\t</div>\n", "\t\t</form>\n";
     do_action("{$this->args['prefix']}_after_thesis_iframe_form");
     echo "\t</div>", "<script type=\"text/javascript\" src=\"", $wp_scripts->base_url, !empty($wp_scripts->registered['jquery-core']->src) ? $wp_scripts->registered['jquery-core']->src : $wp_scripts->registered['jquery']->src, "\"></script>\n", "<script type=\"text/javascript\">", !empty($_GET['action']) && $_GET['action'] == 'import_skin_window' ? "\tjQuery('#t_iframe').submit( function() {\n" . "\t\tif (confirm(\"" . __('Are you sure you want to do this? If you import from a file, you will lose the current state of your Skin unless you make a backup first.\\n\\nHit cancel to return to the manager and make a backup, or hit OK to import the Skin options!', 'thesis') . "\"))\n" . "\t\t\treturn true;\n" . "\t\telse return false;\n" . "\t});\n" : '', !!$import ? "\tparent.window.location.reload();\n" : '', $this->args['show_delete'] === true && $this->args['file_type'] == 'image' ? "\tjQuery(document).ready(function(\$){\n" . "\t\t\$('#t_delete_button').on('click', function(){\n" . "\t\t\tif (confirm('" . __('Are you sure you want to remove this image?', 'thesis') . "')) {\n" . "\t\t\t\t\$.each(['url', 'height', 'width'], function(){\n" . "\t\t\t\t\t\$(parent.window.document.getElementById('image_' + this)).val('');\n" . "\t\t\t\t});\n" . "\t\t\t\t\$('body > img').remove();\n" . "\t\t\t}\n" . "\t\t\telse\n" . "\t\t\t\treturn false;\n" . "\t\t});\n" . "\t});\n" : '', "</script>\n";
     do_action("{$this->args['prefix']}_thesis_iframe_body_bottom");
     echo "</body>\n", "</html>\n";
 }
    /**
     * Show our admin page
     *
     * @since 0.1
     *
     * @return void
     */
    public function admin_form()
    {
        // multisite and network activated?
        if ($this->is_network_activated()) {
            // only allow network admins through
            if (!is_super_admin()) {
                wp_die(__('You do not have permission to access this page.', 'civicrm-event-organiser'));
            }
        }
        // sanitise admin page url
        $url = $_SERVER['REQUEST_URI'];
        $url_array = explode('&', $url);
        if (is_array($url_array)) {
            $url = $url_array[0];
        }
        // get all participant roles
        $roles = $this->plugin->civi->get_participant_roles_select($event = null);
        // get all event types
        $types = $this->plugin->civi->get_event_types_select();
        // open admin page
        echo '

		<div class="wrap" id="civi_eo_admin_wrapper">

		<h1>' . __('CiviCRM Event Organiser', 'civicrm-event-organiser') . '</h1>

		<form method="post" action="' . htmlentities($url . '&updated=true') . '">

		' . wp_nonce_field('civi_eo_admin_action', 'civi_eo_nonce', true, false) . '
		' . wp_referer_field(false) . '

		';
        // open div
        echo '<div id="civi_eo_admin_options">

		<hr>';
        // show table
        echo '
		<h3>' . __('General Settings', 'civicrm-event-organiser') . '</h3>

		<p>' . __('The following options configure some CiviCRM and Event Organiser defaults.', 'civicrm-event-organiser') . '</p>

		<table class="form-table">

		';
        // did we get any roles?
        if ($roles != '') {
            echo '
			<tr valign="top">
				<th scope="row"><label for="civi_eo_event_default_role">' . __('Default CiviCRM Participant Role for Events', 'civicrm-event-organiser') . '</label></th>
				<td><select id="civi_eo_event_default_role" name="civi_eo_event_default_role">' . $roles . '</select></td>
			</tr>
			';
        }
        // did we get any types?
        if ($types != '') {
            echo '
			<tr valign="top">
				<th scope="row"><label for="civi_eo_event_default_type">' . __('Default CiviCRM Event Type', 'civicrm-event-organiser') . '</label></th>
				<td><select id="civi_eo_event_default_type" name="civi_eo_event_default_type">' . $types . '</select></td>
			</tr>
			';
        }
        // close table
        echo '
		</table>

		<hr>';
        // show blurb
        echo '
		<h3>' . __('Synchronisation', 'civicrm-event-organiser') . '</h3>

		<p><strong>' . __('Please note: the following are not settings as such. Ticking a checkbox below and submitting the form will cause the checked sync procedure to run. It is recommended that only one procedure is run in any one go.', 'civicrm-event-organiser') . '</strong></p>

		<p>' . __('Things can be a little complicated on initial setup because there can be data in WordPress or CiviCRM or both.', 'civicrm-event-organiser') . '</p>

		<p>' . __('The most robust procedure for setting up the sync between Event Organiser events and CiviEvents is to sync in the following order:', 'civicrm-event-organiser') . '</p>

		<ol>
			<li>' . __('Only sync Event Categories with CiviCRM Event Types', 'civicrm-event-organiser') . '</li>
			<li>' . __('Only sync EO Venues with CiviCRM Locations', 'civicrm-event-organiser') . '</li>
			<li>' . __('Only sync EO Events with CiviEvents.', 'civicrm-event-organiser') . '</li>
		</ol>

		<p>' . __('Your set up may require some direct manipulation of the data, but the following procedures should help get things moving.', 'civicrm-event-organiser') . '</p>

		<hr>';
        // show table
        echo '
		<h3>' . __('Event Type Synchronisation', 'civicrm-event-organiser') . '</h3>

		<p>' . __('At present, there is no CiviCRM hook that fires when a CiviEvent event type is deleted.', 'civicrm-event-organiser') . '<br />
		<strong>' . __('Event types should always be deleted from the Event Category screen.', 'civicrm-event-organiser') . '</strong></p>

		<table class="form-table">

			<tr valign="top">
				<th scope="row"><label for="civi_eo_tax_eo_to_civi">' . __('Synchronise Event Organiser Categories to CiviCRM Event Types', 'civicrm-event-organiser') . '</label></th>
				<td><input id="civi_eo_tax_eo_to_civi" name="civi_eo_tax_eo_to_civi" value="1" type="checkbox" /></td>
			</tr>

			<tr valign="top">
				<th scope="row"><label for="civi_eo_tax_civi_to_eo">' . __('Synchronise CiviCRM Event Types to Event Organiser Categories', 'civicrm-event-organiser') . '</label></th>
				<td><input id="civi_eo_tax_civi_to_eo" name="civi_eo_tax_civi_to_eo" value="1" type="checkbox" /></td>
			</tr>

		</table>

		<hr>';
        // show table
        echo '
		<h3>' . __('Venue Synchronisation', 'civicrm-event-organiser') . '</h3>

		<table class="form-table">

			<tr valign="top">
				<th scope="row"><label for="civi_eo_eo_to_civi">' . __('Synchronise Event Organiser Venues to CiviEvent Locations', 'civicrm-event-organiser') . '</label></th>
				<td><input id="civi_eo_eo_to_civi" name="civi_eo_eo_to_civi" value="1" type="checkbox" /></td>
			</tr>

			<tr valign="top">
				<th scope="row"><label for="civi_eo_civi_to_eo">' . __('Synchronise CiviEvent Locations to Event Organiser Venues', 'civicrm-event-organiser') . '</label></th>
				<td><input id="civi_eo_civi_to_eo" name="civi_eo_civi_to_eo" value="1" type="checkbox" /></td>
			</tr>

		</table>

		<hr>';
        // show table
        echo '
		<h3>' . __('Event Synchronisation', 'civicrm-event-organiser') . '</h3>

		<table class="form-table">

			<tr valign="top">
				<th scope="row"><label for="civi_eo_event_eo_to_civi">' . __('Synchronise Event Organiser Events to CiviEvents', 'civicrm-event-organiser') . '</label></th>
				<td><input id="civi_eo_event_eo_to_civi" name="civi_eo_event_eo_to_civi" value="1" type="checkbox" /></td>
			</tr>

			<tr valign="top">
				<th scope="row"><label for="civi_eo_event_civi_to_eo">' . __('Synchronise CiviEvents to Event Organiser Events', 'civicrm-event-organiser') . '</label></th>
				<td><input id="civi_eo_event_civi_to_eo" name="civi_eo_event_civi_to_eo" value="1" type="checkbox" /></td>
			</tr>

		</table>

		<hr>';
        // close div
        echo '

		</div>';
        // show submit button
        echo '

		<p class="submit">
			<input type="submit" name="civi_eo_submit" value="' . __('Submit', 'civicrm-event-organiser') . '" class="button-primary" />
		</p>

		';
        // close form
        echo '

		</form>

		</div>
		' . "\n\n\n\n";
    }
コード例 #4
0
/**
 * Retrieve or display nonce hidden field for forms.
 *
 * The nonce field is used to validate that the contents of the form came from
 * the location on the current site and not somewhere else. The nonce does not
 * offer absolute protection, but should protect against most cases. It is very
 * important to use nonce field in forms.
 *
 * If you set $echo to true and set $referer to true, then you will need to
 * retrieve the {@link wp_referer_field() wp referer field}. If you have the
 * $referer set to true and are echoing the nonce field, it will also echo the
 * referer field.
 *
 * The $action and $name are optional, but if you want to have better security,
 * it is strongly suggested to set those two parameters. It is easier to just
 * call the function without any parameters, because validation of the nonce
 * doesn't require any parameters, but since crackers know what the default is
 * it won't be difficult for them to find a way around your nonce and cause
 * damage.
 *
 * The input name will be whatever $name value you gave. The input value will be
 * the nonce creation value.
 *
 * @package WordPress
 * @subpackage Security
 * @since 2.0.4
 *
 * @param string $action Optional. Action name.
 * @param string $name Optional. Nonce name.
 * @param bool $referer Optional, default true. Whether to set the referer field for validation.
 * @param bool $echo Optional, default true. Whether to display or return hidden form field.
 * @return string Nonce field.
 */
function wp_nonce_field($action = -1, $name = "_wpnonce", $referer = true, $echo = true)
{
    $name = attribute_escape($name);
    $nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce($action) . '" />';
    if ($echo) {
        echo $nonce_field;
    }
    if ($referer) {
        wp_referer_field($echo, 'previous');
    }
    return $nonce_field;
}
 /**
  * @global string $tab
  *
  * @param string $which
  */
 protected function display_tablenav($which)
 {
     if ($GLOBALS['tab'] === 'featured') {
         return;
     }
     if ('top' == $which) {
         wp_referer_field();
         ?>
         <div class="tablenav top">
             <div class="alignleft actions">
                 <?php 
         /**
          * Fires before the Plugin Install table header pagination is displayed.
          *
          * @since 2.7.0
          */
         do_action('install_plugins_table_header');
         ?>
             </div>
             <?php 
         $this->pagination($which);
         ?>
             <br class="clear"/>
         </div>
     <?php 
     } else {
         ?>
         <div class="tablenav bottom">
             <?php 
         $this->pagination($which);
         ?>
             <br class="clear"/>
         </div>
         <?php 
     }
 }
コード例 #6
0
ファイル: single_tpl.php プロジェクト: joaosigno/dazake-job
$existing = get_book($id);
$meta = get_book_meta($existing->id);
$tags = join(get_book_tags($existing->id), ',');
echo '
			<div class="wrap dk_single">
				<h2>' . __("Edit book", NRTD) . '</h2>
				<a href = "' . DK_BOOKSHELF_URL . '" >' . __('My bookshelf', NRTD) . ' &raquo;</a>
				<a href = "' . get_page_link(intval($_GET['page_id'])) . '" >' . __("Manage books", NRTD) . ' &raquo;</a>

				<form method="post" action="' . get_option('siteurl') . '/wp-content/plugins/dk_books/functions/edit.php">
			';
if (function_exists('wp_nonce_field')) {
    wp_nonce_field('now-reading-edit');
}
if (function_exists('wp_referer_field')) {
    wp_referer_field();
}
echo '
				<div class="book-image">
					<img style="" id="book-image-0" alt="Book Cover" src="' . $existing->image . '" />
				</div>

				<h3><cite>' . $existing->title . '</cite><br /> by ' . $existing->author . '</h3>


				<table class="form-table" cellspacing="2" cellpadding="5">

				<input type="hidden" name="action" value="update" />
				<input type="hidden" name="count" value="1" />
				<input type="hidden" name="id[]" value="' . $existing->id . '" />
コード例 #7
0
ファイル: twitter-tools.php プロジェクト: novuscory/ACH
function aktt_options_form()
{
    global $wpdb, $aktt, $wp_version;
    $categories = get_categories('hide_empty=0');
    $cat_options = '';
    foreach ($categories as $category) {
        // WP < 2.3 compatibility
        !empty($category->term_id) ? $cat_id = $category->term_id : ($cat_id = $category->cat_ID);
        !empty($category->name) ? $cat_name = $category->name : ($cat_name = $category->cat_name);
        if ($cat_id == $aktt->blog_post_category) {
            $selected = 'selected="selected"';
        } else {
            $selected = '';
        }
        $cat_options .= "\n\t<option value='{$cat_id}' {$selected}>{$cat_name}</option>";
    }
    global $current_user;
    $authors = get_editable_user_ids($current_user->ID);
    $author_options = '';
    if (count($authors)) {
        foreach ($authors as $user_id) {
            $usero = new WP_User($user_id);
            $author = $usero->data;
            // Only list users who are allowed to publish
            if (!$usero->has_cap('publish_posts')) {
                continue;
            }
            if ($author->ID == $aktt->blog_post_author) {
                $selected = 'selected="selected"';
            } else {
                $selected = '';
            }
            $author_options .= "\n\t<option value='{$author->ID}' {$selected}>{$author->user_nicename}</option>";
        }
    }
    $js_libs = array('jquery' => 'jQuery', 'prototype' => 'Prototype');
    $js_lib_options = '';
    foreach ($js_libs as $js_lib => $js_lib_display) {
        if ($js_lib == $aktt->js_lib) {
            $selected = 'selected="selected"';
        } else {
            $selected = '';
        }
        $js_lib_options .= "\n\t<option value='{$js_lib}' {$selected}>{$js_lib_display}</option>";
    }
    $digest_tweet_orders = array('ASC' => __('Oldest first (Chronological order)', 'twitter-tools'), 'DESC' => __('Newest first (Reverse-chronological order)', 'twitter-tools'));
    $digest_tweet_order_options = '';
    foreach ($digest_tweet_orders as $digest_tweet_order => $digest_tweet_order_display) {
        if ($digest_tweet_order == $aktt->digest_tweet_order) {
            $selected = 'selected="selected"';
        } else {
            $selected = '';
        }
        $digest_tweet_order_options .= "\n\t<option value='{$digest_tweet_order}' {$selected}>{$digest_tweet_order_display}</option>";
    }
    $yes_no = array('create_blog_posts', 'create_digest', 'create_digest_weekly', 'notify_twitter', 'notify_twitter_default', 'tweet_from_sidebar', 'give_tt_credit', 'exclude_reply_tweets');
    foreach ($yes_no as $key) {
        $var = $key . '_options';
        if ($aktt->{$key} == '0') {
            ${$var} = '
				<option value="0" selected="selected">' . __('No', 'twitter-tools') . '</option>
				<option value="1">' . __('Yes', 'twitter-tools') . '</option>
			';
        } else {
            ${$var} = '
				<option value="0">' . __('No', 'twitter-tools') . '</option>
				<option value="1" selected="selected">' . __('Yes', 'twitter-tools') . '</option>
			';
        }
    }
    if ($_GET['tweets-updated']) {
        print '
			<div id="message" class="updated fade">
				<p>' . __('Tweets updated.', 'twitter-tools') . '</p>
			</div>
		';
    }
    if ($_GET['tweet-checking-reset']) {
        print '
			<div id="message" class="updated fade">
				<p>' . __('Tweet checking has been reset.', 'twitter-tools') . '</p>
			</div>
		';
    }
    if (strcmp($_GET['oauth'], "success") == 0) {
        print '
			<div id="message" class="updated fade">
				<p>' . __('Yay! We connected with Twitter.', 'twitter-tools') . '</p>
			</div>

		';
    } else {
        if (strcmp($_GET['oauth'], "fail") == 0) {
            print '
			<div id="message" class="updated fade">
				<p>' . __('Authentication Failed. Please check your credentials and make sure <a href="http://www.twitter.com/" title="Twitter" target="_blank">Twitter</a> is up and running.', 'twitter-tools') . '</p>
			</div>

		';
        }
    }
    print '	
			<div class="wrap" id="aktt_options_page">
			<h2>' . __('Twitter Tools Options', 'twitter-tools') . ' &nbsp; <script type="text/javascript">var WPHC_AFF_ID = "14303"; var WPHC_POSITION = "c1"; var WPHC_PRODUCT = "Twitter Tools (' . AKTT_VERSION . ')"; var WPHC_WP_VERSION = "' . $wp_version . '";</script><script type="text/javascript" src="http://cloud.wphelpcenter.com/support-form/0001/deliver-a.js"></script></h2>';
    if (!aktt_oauth_test()) {
        print '	
			<h3>' . __('Connect to Twitter', 'twitter-tools') . '</h3>
			<p style="width: 700px;">' . __('In order to get started, we need to follow some steps to get this site registered with Twitter. This process is awkward and more complicated than it should be. We hope to have a better solution for this in a future release, but for now this system is what Twitter supports. If you have any trouble, please use the Support button above to contact <a href="http://wphelpcenter.com" target="_blank">WordPress HelpCenter</a> and provide code 14303.', 'twitter-tools') . '</p> 
			<form id="ak_twittertools" name="ak_twittertools" action="' . admin_url('options-general.php') . '" method="post">
				<fieldset class="options">
					<h4>' . __('1. Register this site as an application on ', 'twitter-tools') . '<a href="http://dev.twitter.com/apps/new" title="' . __('Twitter App Registration', 'twitter-tools') . '" target="_blank">' . __('Twitter\'s app registration page', 'twitter-tools') . '</a></h4>
					<div id="aktt_sub_instructions">
						<ul>
						<li>' . __('If you\'re not logged in, you can use your Twitter username and password', 'twitter-tools') . '</li>
						<li>' . __('Your Application\'s Name will be what shows up after "via" in your twitter stream', 'twitter-tools') . '</li>
						<li>' . __('Application Type should be set on ', 'twitter-tools') . '<strong>' . __('Browser', 'twitter-tools') . '</strong></li>
						<li>' . __('The Callback URL should be ', 'twitter-tools') . '<strong>' . get_bloginfo('url') . '</strong></li>
						<li>' . __('Default Access type should be set to ', 'twitter-tools') . '<strong>' . __('Read &amp; Write', 'twitter-tools') . '</strong> ' . __('(this is NOT the default)', 'twitter-tools') . '</li>
						</ul>
					<p>' . __('Once you have registered your site as an application, you will be provided with a consumer key and a comsumer secret.', 'twitter-tools') . '</p>
					</div>
					<h4>' . __('2. Copy and paste your consumer key and consumer secret into the fields below', 'twitter-tools') . '</h4>
				
					<div class="option">
						<label for="aktt_app_consumer_key">' . __('Twitter Consumer Key', 'twitter-tools') . '</label>
						<input type="text" size="25" name="aktt_app_consumer_key" id="aktt_app_consumer_key" value="' . esc_attr($aktt->app_consumer_key) . '" autocomplete="off">
					</div>
					<div class="option">
						<label for="aktt_app_consumer_secret">' . __('Twitter Consumer Secret', 'twitter-tools') . '</label>
						<input type="text" size="25" name="aktt_app_consumer_secret" id="aktt_app_consumer_secret" value="' . esc_attr($aktt->app_consumer_secret) . '" autocomplete="off">
					</div>
					<h4>3. Copy and paste your Access Token and Access Token Secret into the fields below</h4>
					<p>On the right hand side of your application page, click on \'My Access Token\'.</p>
					<div class="option">
						<label for="aktt_oauth_token">' . __('Access Token', 'twitter-tools') . '</label>
						<input type="text" size="25" name="aktt_oauth_token" id="aktt_oauth_token" value="' . esc_attr($aktt->oauth_token) . '" autocomplete="off">
					</div>
					<div class="option">
						<label for="aktt_oauth_token_secret">' . __('Access Token Secret', 'twitter-tools') . '</label>
						<input type="text" size="25" name="aktt_oauth_token_secret" id="aktt_oauth_token_secret" value="' . esc_attr($aktt->oauth_token_secret) . '" autocomplete="off">
					</div>
				</fieldset>
				<p class="submit">
					<input type="submit" name="submit" class="button-primary" value="' . __('Connect to Twitter', 'twitter-tools') . '" />
				</p>
				<input type="hidden" name="ak_action" value="aktt_oauth_test" class="hidden" style="display: none;" />
				' . wp_nonce_field('aktt_oauth_test', '_wpnonce', true, false) . wp_referer_field(false) . '
			</form>
				
				';
    } else {
        if (aktt_oauth_test()) {
            print '	
			<form id="ak_twittertools_disconnect" name="ak_twittertools_disconnect" action="' . admin_url('options-general.php') . '" method="post">
				<p><a href="#" id="aktt_authentication_showhide" class="auth_information_link">Account Information</a></p>
				<div id="aktt_authentication_display">
					<fieldset class="options">
						<div class="option"><span class="auth_label">' . __('Twitter Username ', 'twitter-tools') . '</span><span class="auth_code">' . $aktt->twitter_username . '</span></div>
						<div class="option"><span class="auth_label">' . __('Consumer Key ', 'twitter-tools') . '</span><span class="auth_code">' . $aktt->app_consumer_key . '</span></div>
						<div class="option"><span class="auth_label">' . __('Consumer Secret ', 'twitter-tools') . '</span><span class="auth_code">' . $aktt->app_consumer_secret . '</span></div>
						<div class="option"><span class="auth_label">' . __('Access Token ', 'twitter-tools') . '</span><span class="auth_code">' . $aktt->oauth_token . '</span></div>
						<div class="option"><span class="auth_label">' . __('Access Token Secret ', 'twitter-tools') . '</span><span class="auth_code">' . $aktt->oauth_token_secret . '</span></div>
					</fieldset>
					<p class="submit">
					<input type="submit" name="submit" class="button-primary" value="' . __('Disconnect Your WordPress and Twitter Account', 'twitter-tools') . '" />
					</p>
					<input type="hidden" name="ak_action" value="aktt_twitter_disconnect" class="hidden" style="display: none;" />
					' . wp_nonce_field('aktt_twitter_disconnect', '_wpnonce', true, false) . wp_referer_field(false) . ' 
				</div>		
			</form>
					
			<form id="ak_twittertools" name="ak_twittertools" action="' . admin_url('options-general.php') . '" method="post">
				<fieldset class="options">			
					<div class="option">
						<label for="aktt_notify_twitter">' . __('Enable option to create a tweet when you post in your blog?', 'twitter-tools') . '</label>
						<select name="aktt_notify_twitter" id="aktt_notify_twitter">' . $notify_twitter_options . '</select>
					</div>
					<div class="option">
						<label for="aktt_tweet_prefix">' . __('Tweet prefix for new blog posts:', 'twitter-tools') . '</label>
						<input type="text" size="30" name="aktt_tweet_prefix" id="aktt_tweet_prefix" value="' . esc_attr($aktt->tweet_prefix) . '" /><span>' . __('Cannot be left blank. Will result in <b>{Your prefix}: Title URL</b>', 'twitter-tools') . '</span>
					</div>
					<div class="option">
						<label for="aktt_notify_twitter_default">' . __('Set this on by default?', 'twitter-tools') . '</label>
						<select name="aktt_notify_twitter_default" id="aktt_notify_twitter_default">' . $notify_twitter_default_options . '</select><span>' . __('Also determines tweeting for posting via XML-RPC', 'twitter-tools') . '</span>
					</div>
					<div class="option">
						<label for="aktt_create_blog_posts">' . __('Create a blog post from each of your tweets?', 'twitter-tools') . '</label>
						<select name="aktt_create_blog_posts" id="aktt_create_blog_posts">' . $create_blog_posts_options . '</select>
					</div>
					<div class="option">
						<label for="aktt_blog_post_category">' . __('Category for tweet posts:', 'twitter-tools') . '</label>
						<select name="aktt_blog_post_category" id="aktt_blog_post_category">' . $cat_options . '</select>
					</div>
					<div class="option">
						<label for="aktt_blog_post_tags">' . __('Tag(s) for your tweet posts:', 'twitter-tools') . '</label>
						<input name="aktt_blog_post_tags" id="aktt_blog_post_tags" value="' . esc_attr($aktt->blog_post_tags) . '">
						<span>' . __('Separate multiple tags with commas. Example: tweets, twitter', 'twitter-tools') . '</span>
					</div>
					<div class="option">
						<label for="aktt_blog_post_author">' . __('Author for tweet posts:', 'twitter-tools') . '</label>
						<select name="aktt_blog_post_author" id="aktt_blog_post_author">' . $author_options . '</select>
					</div>
					<div class="option">
						<label for="aktt_exclude_reply_tweets">' . __('Exclude @reply tweets in your sidebar, digests and created blog posts?', 'twitter-tools') . '</label>
						<select name="aktt_exclude_reply_tweets" id="aktt_exclude_reply_tweets">' . $exclude_reply_tweets_options . '</select>
					</div>
					<div class="option">
						<label for="aktt_sidebar_tweet_count">' . __('Tweets to show in sidebar:', 'twitter-tools') . '</label>
						<input type="text" size="3" name="aktt_sidebar_tweet_count" id="aktt_sidebar_tweet_count" value="' . esc_attr($aktt->sidebar_tweet_count) . '" />
						<span>' . __('Numbers only please.', 'twitter-tools') . '</span>
					</div>
					<div class="option">
						<label for="aktt_tweet_from_sidebar">' . __('Create tweets from your sidebar?', 'twitter-tools') . '</label>
						<select name="aktt_tweet_from_sidebar" id="aktt_tweet_from_sidebar">' . $tweet_from_sidebar_options . '</select>
					</div>
					<div class="option">
						<label for="aktt_js_lib">' . __('JS Library to use?', 'twitter-tools') . '</label>
						<select name="aktt_js_lib" id="aktt_js_lib">' . $js_lib_options . '</select>
					</div>
					<div class="option">
						<label for="aktt_give_tt_credit">' . __('Give Twitter Tools credit?', 'twitter-tools') . '</label>
						<select name="aktt_give_tt_credit" id="aktt_give_tt_credit">' . $give_tt_credit_options . '</select>
					</div>
				
					<div class="aktt_experimental">
						<h4>' . __('- Experimental -', 'twitter-tools') . '</h4>
				
					<div class="option time_toggle">
						<label>' . __('Create a daily digest blog post from your tweets?', 'twitter-tools') . '</label>
						<select name="aktt_create_digest" class="toggler">' . $create_digest_options . '</select>
						<input type="hidden" class="time" id="aktt_digest_daily_time" name="aktt_digest_daily_time" value="' . esc_attr($aktt->digest_daily_time) . '" />
					</div>
					<div class="option">
						<label for="aktt_digest_title">' . __('Title for daily digest posts:', 'twitter-tools') . '</label>
						<input type="text" size="30" name="aktt_digest_title" id="aktt_digest_title" value="' . $aktt->digest_title . '" />
						<span>' . __('Include %s where you want the date. Example: Tweets on %s', 'twitter-tools') . '</span>
					</div>
					<div class="option time_toggle">
						<label>' . __('Create a weekly digest blog post from your tweets?', 'twitter-tools') . '</label>
						<select name="aktt_create_digest_weekly" class="toggler">' . $create_digest_weekly_options . '</select>
						<input type="hidden" class="time" name="aktt_digest_weekly_time" id="aktt_digest_weekly_time" value="' . esc_attr($aktt->digest_weekly_time) . '" />
						<input type="hidden" class="day" name="aktt_digest_weekly_day" value="' . $aktt->digest_weekly_day . '" />
					</div>
					<div class="option">
						<label for="aktt_digest_title_weekly">' . __('Title for weekly digest posts:', 'twitter-tools') . '</label>
						<input type="text" size="30" name="aktt_digest_title_weekly" id="aktt_digest_title_weekly" value="' . esc_attr($aktt->digest_title_weekly) . '" />
						<span>' . __('Include %s where you want the date. Example: Tweets on %s', 'twitter-tools') . '</span>
					</div>
					<div class="option">
						<label for="aktt_digest_tweet_order">' . __('Order of tweets in digest?', 'twitter-tools') . '</label>
						<select name="aktt_digest_tweet_order" id="aktt_digest_tweet_order">' . $digest_tweet_order_options . '</select>
					</div>
				
					</div>
				
				</fieldset>
				<p class="submit">
					<input type="submit" name="submit" class="button-primary" value="' . __('Update Twitter Tools Options', 'twitter-tools') . '" />
				</p>
				<input type="hidden" name="ak_action" value="aktt_update_settings" class="hidden" style="display: none;" />
				' . wp_nonce_field('aktt_settings', '_wpnonce', true, false) . wp_referer_field(false) . '
			</form>
			<h2>' . __('Update Tweets / Reset Checking and Digests', 'twitter-tools') . '</h2>
			<form name="ak_twittertools_updatetweets" action="' . admin_url('options-general.php') . '" method="get">
				<p>' . __('Use these buttons to manually update your tweets or reset the checking settings.', 'twitter-tools') . '</p>
				<p class="submit">
					<input type="submit" name="submit-button" value="' . __('Update Tweets', 'twitter-tools') . '" />
					<input type="submit" name="reset-button-1" value="' . __('Reset Tweet Checking', 'twitter-tools') . '" onclick="document.getElementById(\'ak_action_2\').value = \'aktt_reset_tweet_checking\';" />
					<input type="submit" name="reset-button-2" value="' . __('Reset Digests', 'twitter-tools') . '" onclick="document.getElementById(\'ak_action_2\').value = \'aktt_reset_digests\';" />
					<input type="hidden" name="ak_action" id="ak_action_2" value="aktt_update_tweets" />
				</p>
				' . wp_nonce_field('aktt_update_tweets', '_wpnonce', true, false) . wp_referer_field(false) . '
			</form>
	';
        }
    }
    //end elsif statement
    do_action('aktt_options_form');
    ?>
	<div id="cf">
		<div id="cf-callouts">
			<div class="cf-callout">
				<div id="cf-callout-credit" class="cf-box">
					<h3 class="cf-box-title">Plugin Developed By</h3>
					<div class="cf-box-content">
						<p class="txt-center"><a href="http://crowdfavorite.com/" title="Crowd Favorite : Elegant WordPress and Web Application Development"><img src="http://cloud.wphelpcenter.com/resources/wp-admin-0001/cf-logo.png" alt="Crowd Favorite"></a></p>
						<p>An independent development firm specializing in WordPress development and integrations, sophisticated web applications, Open Source implementations and user experience consulting. If you need it to work, trust Crowd Favorite to build it.</p>
					</div><!-- .cf-box-content -->
				</div><!-- #cf-callout-credit -->						
			</div>
			<div class="cf-callout">
				<div id="cf-callout-support" class="cf-box">
					<h3 class="cf-box-title">Professional Support From</h3>
					<div class="cf-box-content">
						<p class="txt-center"><a href="http://wphelpcenter.com/" title="WordPress HelpCenter"><img src="http://cloud.wphelpcenter.com/resources/wp-admin-0001/wphc-logo.png" alt="WordPress HelpCenter"></a></p>
						<p>Need help with WordPress right now? That's what we're here for. We can help with anything from how-to questions to server troubleshooting, theme customization to upgrades and installs. Give us a call - 303-395-1346.</p>
					</div><!-- .cf-box-content -->
				</div><!-- #cf-callout-support -->						
			</div>
		</div><!-- #cf-callouts -->
	</div><!-- #cf -->
<?php 
    print '
				
			</div>
	';
}
function aktt_excludecat_settings_form()
{
    print '
<style class="text/css">
#aktt_exclude_cat_options {
	list-style: none;
}
#aktt_exclude_cat_options li {
	float: left;
	margin: 0 0 5px 0;
	padding: 3px;
	width: 200px;
}
</style>
<script type="text/javascript">
jQuery(function() {
	jQuery("#aktt_excludecat_select").click(function() {
		jQuery("#aktt_exclude_cat_options input[type=checkbox]").attr("checked", true);
		return false;
	});
	jQuery("#aktt_excludecat_unselect").click(function() {
		jQuery("#aktt_exclude_cat_options input[type=checkbox]").attr("checked", false);
		return false;
	});
});
</script>
<div class="wrap">
	<h2>' . __('Exclude Categories for Twitter Tools', 'twitter-tools-excludecat') . '</h2>
	<form id="aktt_excludecat_settings_form" name="aktt_excludecat_settings_form" action="' . admin_url('options-general.php') . '" method="post">
		<input type="hidden" name="cf_action" value="aktt_excludecat_update_settings" />
		<fieldset class="options">
			<p>' . __('Posts in selected categories will be excluded from blog post tweets', 'twitter-tools-excludecat') . '</p>
			<p><a href="#" id="aktt_excludecat_select">' . __('Select All', 'twitter-tools-excludecat') . '</a> | <a href="#" id="aktt_excludecat_unselect">' . __('Unselect All', 'twitter-tools-excludecat') . '</a></p>
			<ul id="aktt_exclude_cat_options">
	';
    $categories = get_categories('hide_empty=0');
    $exclude_cats = get_option('aktt_excludecats');
    if (!is_array($exclude_cats)) {
        $exclude_cats = array();
    }
    foreach ($categories as $cat) {
        $id = 'aktt_exclude_cat_' . $cat->term_id;
        in_array($cat->term_id, $exclude_cats) ? $checked = ' checked="checked"' : ($checked = '');
        print '
				<li>
					<input type="checkbox" name="aktt_exclude_cats[]" value="' . $cat->term_id . '" id="' . $id . '" ' . $checked . ' />
					<label for="' . $id . '">' . htmlspecialchars($cat->name) . '</label>
				</li>
		';
    }
    print '
			</ul>
			<div class="clear"></div>
		</fieldset>
		<p class="submit">
			<input type="submit" name="submit" value="' . __('Save Settings', 'twitter-tools-excludecat') . '" class="button-primary" />
		</p>
		' . wp_nonce_field('aktt_excludecat_update_settings', '_wpnonce', true, false) . wp_referer_field(false) . '
	</form>
</div>
	';
}
コード例 #9
0
function aktt_bitly_settings_form()
{
    global $aktt_bitly_settings;
    print '
<div class="wrap">
	<h2>' . __('Bit.ly for Twitter Tools', 'twitter-tools-bitly') . '</h2>
	<form id="aktt_bitly_settings_form" class="aktt" name="aktt_bitly_settings_form" action="' . admin_url('options-general.php') . '" method="post">
		<input type="hidden" name="cf_action" value="aktt_bitly_update_settings" />
		<fieldset class="options">
	';
    foreach ($aktt_bitly_settings as $key => $config) {
        echo cf_settings_field($key, $config);
    }
    print '
		</fieldset>
		<p class="submit">
			<input type="submit" name="submit" class="button-primary" value="' . __('Save Settings', 'twitter-tools-bitly') . '" />
		</p>
		' . wp_nonce_field('aktt_bitly_save_settings', '_wpnonce', true, false) . wp_referer_field(false) . '
	</form>
</div>
	';
}
コード例 #10
0
function wfu_manage_settings($message = '')
{
    if (!current_user_can('manage_options')) {
        return;
    }
    $siteurl = site_url();
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    $echo_str = '<div class="wrap">';
    $echo_str .= "\n\t" . '<h2>Wordpress File Upload Control Panel</h2>';
    $echo_str .= "\n\t" . '<div style="margin-top:20px;">';
    $echo_str .= wfu_generate_dashboard_menu("\n\t\t", "Settings");
    $echo_str .= "\n\t\t" . '<form enctype="multipart/form-data" name="editsettings" id="editsettings" method="post" action="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=edit_settings" class="validate">';
    $nonce = wp_nonce_field('wfu_edit_admin_settings', '_wpnonce', false, false);
    $nonce_ref = wp_referer_field(false);
    $echo_str .= "\n\t\t\t" . $nonce;
    $echo_str .= "\n\t\t\t" . $nonce_ref;
    $echo_str .= "\n\t\t\t" . '<input type="hidden" name="action" value="edit_settings">';
    $echo_str .= "\n\t\t\t" . '<table class="form-table">';
    $echo_str .= "\n\t\t\t\t" . '<tbody>';
    $echo_str .= "\n\t\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<label for="wfu_hashfiles">Hash Files</label>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<input name="wfu_hashfiles" id="wfu_hashfiles" type="checkbox"' . ($plugin_options['hashfiles'] == '1' ? ' checked="checked"' : '') . ' style="width:auto;" /> Enables better control of uploaded files, but slows down performance when uploaded files are larger than 100MBytes';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>' . ($plugin_options['hashfiles'] == '1' ? 'Yes' : 'No') . '</strong></p>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<label for="wfu_basedir">Base Directory</label>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<input name="wfu_basedir" id="wfu_basedir" type="text" value="' . $plugin_options['basedir'] . '" />';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>' . $plugin_options['basedir'] . '</strong></p>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<label for="wfu_postmethod">Post Method</label>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<select name="wfu_postmethod" id="wfu_postmethod" value="' . $plugin_options['postmethod'] . '">';
    $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<option value="fopen"' . ($plugin_options['postmethod'] == 'fopen' || $plugin_options['postmethod'] == '' ? ' selected="selected"' : '') . '>Using fopen (default)</option>';
    $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<option value="curl"' . ($plugin_options['postmethod'] == 'curl' ? ' selected="selected"' : '') . '>Using cURL</option>';
    $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<option value="socket"' . ($plugin_options['postmethod'] == 'socket' ? ' selected="selected"' : '') . '>Using Sockets</option>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '</select>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>' . ($plugin_options['postmethod'] == 'fopen' || $plugin_options['postmethod'] == '' ? 'Using fopen' : ($plugin_options['postmethod'] == 'curl' ? 'Using cURL' : 'Using Sockets')) . '</strong></p>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<label for="wfu_relaxcss">Relax CSS Rules</label>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<input name="wfu_relaxcss" id="wfu_relaxcss" type="checkbox"' . ($plugin_options['relaxcss'] == '1' ? ' checked="checked"' : '') . ' style="width:auto;" /> If enabled then the textboxes and the buttons of the plugin will inherit the theme\'s styling';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>' . ($plugin_options['relaxcss'] == '1' ? 'Yes' : 'No') . '</strong></p>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<label for="wfu_admindomain">Admin Domain</label>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<select name="wfu_admindomain" id="wfu_admindomain" value="' . $plugin_options['admindomain'] . '">';
    $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<option value="siteurl"' . ($plugin_options['admindomain'] == 'siteurl' || $plugin_options['admindomain'] == '' ? ' selected="selected"' : '') . '>Using site_url (default)</option>';
    $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<option value="adminurl"' . ($plugin_options['admindomain'] == 'adminurl' ? ' selected="selected"' : '') . '>Using admin_url</option>';
    $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<option value="homeurl"' . ($plugin_options['admindomain'] == 'homeurl' ? ' selected="selected"' : '') . '>Using home_url</option>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '</select>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>' . ($plugin_options['admindomain'] == 'siteurl' || $plugin_options['admindomain'] == '' ? 'Using site_url' : ($plugin_options['admindomain'] == 'adminurl' ? 'Using admin_url' : 'Using home_url')) . '</strong></p>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<label for="wfu_mediacustom">Show Custom Fields in Media Library</label>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<input name="wfu_mediacustom" id="wfu_mediacustom" type="checkbox"' . ($plugin_options['mediacustom'] == '1' ? ' checked="checked"' : '') . ' style="width:auto;" /> If enabled and the uploaded files are added to Media Library then any user fields submitted together with the files will be shown in Media Library';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>' . ($plugin_options['mediacustom'] == '1' ? 'Yes' : 'No') . '</strong></p>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t" . '</tbody>';
    $echo_str .= "\n\t\t\t" . '</table>';
    $echo_str .= "\n\t\t\t" . '<p class="submit">';
    $echo_str .= "\n\t\t\t\t" . '<input type="submit" class="button-primary" name="submitform" value="Update" />';
    $echo_str .= "\n\t\t\t" . '</p>';
    $echo_str .= "\n\t\t" . '</form>';
    $echo_str .= "\n\t" . '</div>';
    $echo_str .= "\n" . '</div>';
    echo $echo_str;
}
コード例 #11
0
function wpt_update_settings()
{
    wpt_check_version();
    if (!empty($_POST)) {
        $nonce = $_REQUEST['_wpnonce'];
        if (!wp_verify_nonce($nonce, 'wp-to-twitter-nonce')) {
            die("Security check failed");
        }
    }
    if (isset($_POST['submit-type']) && $_POST['submit-type'] == 'clear-error') {
        update_option('wp_twitter_failure', '0');
        update_option('wp_url_failure', '0');
        update_option('jd_status_message', '');
        $message = __("WP to Twitter Errors Cleared", 'wp-to-twitter');
    }
    if (isset($_POST['oauth_settings'])) {
        $oauth_message = jd_update_oauth_settings(false, $_POST);
    }
    $wp_twitter_error = FALSE;
    $wp_supr_error = FALSE;
    $wp_bitly_error = FALSE;
    $message = "";
    // SET DEFAULT OPTIONS
    if (get_option('twitterInitialised') != '1') {
        $initial_settings = array('post' => array('post-published-update' => 1, 'post-published-text' => 'New post: #title# #url#', 'post-edited-update' => 1, 'post-edited-text' => 'Post Edited: #title# #url#'), 'page' => array('post-published-update' => 0, 'post-published-text' => 'New page: #title# #url#', 'post-edited-update' => 0, 'post-edited-text' => 'Page edited: #title# #url#'));
        update_option('wpt_post_types', $initial_settings);
        update_option('jd_twit_blogroll', '1');
        update_option('newlink-published-text', 'New link: #title# #url#');
        update_option('comment-published-update', 0);
        update_option('comment-published-text', 'New comment: #title# #url#');
        update_option('limit_categories', '0');
        update_option('jd_shortener', '1');
        update_option('jd_strip_nonan', '0');
        update_option('jd_max_tags', 3);
        update_option('jd_max_characters', 15);
        update_option('jd_replace_character', '_');
        update_option('wtt_user_permissions', 'administrator');
        $administrator = get_role('administrator');
        $administrator->add_cap('wpt_twitter_oauth');
        $administrator->add_cap('wpt_twitter_custom');
        $administrator->add_cap('wpt_twitter_switch');
        update_option('wtt_show_custom_tweet', 'administrator');
        update_option('jd_twit_remote', '0');
        update_option('jd_post_excerpt', 30);
        // Use Google Analytics with Twitter
        update_option('twitter-analytics-campaign', 'twitter');
        update_option('use-twitter-analytics', '0');
        update_option('jd_dynamic_analytics', '0');
        update_option('use_dynamic_analytics', 'category');
        // Use custom external URLs to point elsewhere.
        update_option('jd_twit_custom_url', 'external_link');
        // Error checking
        update_option('wp_twitter_failure', '0');
        update_option('wp_url_failure', '0');
        // Default publishing options.
        update_option('jd_tweet_default', '0');
        update_option('je_tweet_default_edit', '0');
        update_option('wpt_inline_edits', '0');
        // Note that default options are set.
        update_option('twitterInitialised', '1');
        //YOURLS API
        update_option('jd_keyword_format', '0');
    }
    if (get_option('twitterInitialised') == '1' && get_option('jd_post_excerpt') == "") {
        update_option('jd_post_excerpt', 30);
    }
    // notifications from oauth connection
    if (isset($_POST['oauth_settings'])) {
        if ($oauth_message == "success") {
            print '
				<div id="message" class="updated fade">
					<p>' . __('WP to Twitter is now connected with Twitter.', 'wp-to-twitter') . '</p>
				</div>

			';
        } else {
            if ($oauth_message == "fail") {
                print '
				<div id="message" class="updated fade">
					<p>' . __('WP to Twitter failed to connect with Twitter. Try enabling OAuth debugging.', 'wp-to-twitter') . '</p>
				</div>

			';
            } else {
                if ($oauth_message == "cleared") {
                    print '
				<div id="message" class="updated fade">
					<p>' . __('OAuth Authentication Data Cleared.', 'wp-to-twitter') . '</p>
				</div>

			';
                } else {
                    if ($oauth_message == 'nosync') {
                        print '
				<div id="message" class="error fade">
					<p>' . __('OAuth Authentication Failed. Your server time is not in sync with the Twitter servers. Talk to your hosting service to see what can be done.', 'wp-to-twitter') . '</p>
				</div>

			';
                    } else {
                        print '
				<div id="message" class="error fade">
					<p>' . __('OAuth Authentication response not understood.', 'wp-to-twitter') . '</p>
				</div>			
			';
                    }
                }
            }
        }
    }
    if (isset($_POST['submit-type']) && $_POST['submit-type'] == 'advanced') {
        update_option('jd_tweet_default', isset($_POST['jd_tweet_default']) ? $_POST['jd_tweet_default'] : 0);
        update_option('jd_tweet_default', isset($_POST['jd_tweet_default']) ? $_POST['jd_tweet_default'] : 0);
        update_option('wpt_inline_edits', isset($_POST['wpt_inline_edits']) ? $_POST['wpt_inline_edits'] : 0);
        update_option('jd_twit_remote', isset($_POST['jd_twit_remote']) ? $_POST['jd_twit_remote'] : 0);
        update_option('jd_twit_custom_url', $_POST['jd_twit_custom_url']);
        update_option('jd_strip_nonan', isset($_POST['jd_strip_nonan']) ? $_POST['jd_strip_nonan'] : 0);
        update_option('jd_twit_prepend', $_POST['jd_twit_prepend']);
        update_option('jd_twit_append', $_POST['jd_twit_append']);
        update_option('jd_post_excerpt', $_POST['jd_post_excerpt']);
        update_option('jd_max_tags', $_POST['jd_max_tags']);
        update_option('jd_max_characters', $_POST['jd_max_characters']);
        update_option('jd_replace_character', $_POST['jd_replace_character']);
        update_option('jd_date_format', $_POST['jd_date_format']);
        update_option('jd_dynamic_analytics', $_POST['jd-dynamic-analytics']);
        update_option('use_dynamic_analytics', isset($_POST['use-dynamic-analytics']) ? $_POST['use-dynamic-analytics'] : 0);
        update_option('use-twitter-analytics', isset($_POST['use-twitter-analytics']) ? $_POST['use-twitter-analytics'] : 0);
        update_option('twitter-analytics-campaign', $_POST['twitter-analytics-campaign']);
        update_option('jd_individual_twitter_users', $_POST['jd_individual_twitter_users']);
        $wtt_user_permissions = $_POST['wtt_user_permissions'];
        $prev = get_option('wtt_user_permissions');
        if ($wtt_user_permissions != $prev) {
            $subscriber = get_role('subscriber');
            $subscriber->remove_cap('wpt_twitter_oauth');
            $contributor = get_role('contributor');
            $contributor->remove_cap('wpt_twitter_oauth');
            $author = get_role('author');
            $author->remove_cap('wpt_twitter_oauth');
            $editor = get_role('editor');
            $editor->remove_cap('wpt_twitter_oauth');
            switch ($wtt_user_permissions) {
                case 'subscriber':
                    $subscriber->add_cap('wpt_twitter_oauth');
                    $contributor->add_cap('wpt_twitter_oauth');
                    $author->add_cap('wpt_twitter_oauth');
                    $editor->add_cap('wpt_twitter_oauth');
                    break;
                case 'contributor':
                    $contributor->add_cap('wpt_twitter_oauth');
                    $author->add_cap('wpt_twitter_oauth');
                    $editor->add_cap('wpt_twitter_oauth');
                    break;
                case 'author':
                    $author->add_cap('wpt_twitter_oauth');
                    $editor->add_cap('wpt_twitter_oauth');
                    break;
                case 'editor':
                    $editor->add_cap('wpt_twitter_oauth');
                    break;
                default:
                    $role = get_role($wtt_user_permissions);
                    $role->add_cap('wpt_twitter_oauth');
                    break;
            }
        }
        update_option('wtt_user_permissions', $wtt_user_permissions);
        $wtt_show_custom_tweet = $_POST['wtt_show_custom_tweet'];
        $prev = get_option('wtt_show_custom_tweet');
        if ($wtt_show_custom_tweet != $prev) {
            $subscriber = get_role('subscriber');
            $subscriber->remove_cap('wpt_twitter_custom');
            $contributor = get_role('contributor');
            $contributor->remove_cap('wpt_twitter_custom');
            $author = get_role('author');
            $author->remove_cap('wpt_twitter_custom');
            $editor = get_role('editor');
            $editor->remove_cap('wpt_twitter_custom');
            switch ($wtt_show_custom_tweet) {
                case 'subscriber':
                    $subscriber->add_cap('wpt_twitter_custom');
                    $contributor->add_cap('wpt_twitter_custom');
                    $author->add_cap('wpt_twitter_custom');
                    $editor->add_cap('wpt_twitter_custom');
                    break;
                case 'contributor':
                    $contributor->add_cap('wpt_twitter_custom');
                    $author->add_cap('wpt_twitter_custom');
                    $editor->add_cap('wpt_twitter_custom');
                    break;
                case 'author':
                    $author->add_cap('wpt_twitter_custom');
                    $editor->add_cap('wpt_twitter_custom');
                    break;
                case 'editor':
                    $editor->add_cap('wpt_twitter_custom');
                    break;
                default:
                    $role = get_role($wtt_show_custom_tweet);
                    $role->add_cap('wpt_twitter_custom');
                    break;
            }
        }
        update_option('wtt_show_custom_tweet', $wtt_show_custom_tweet);
        $wpt_twitter_switch = $_POST['wpt_twitter_switch'];
        $prev = get_option('wpt_twitter_switch');
        if ($wpt_twitter_switch != $prev) {
            $subscriber = get_role('subscriber');
            $subscriber->remove_cap('wpt_twitter_switch');
            $contributor = get_role('contributor');
            $contributor->remove_cap('wpt_twitter_switch');
            $author = get_role('author');
            $author->remove_cap('wpt_twitter_switch');
            $editor = get_role('editor');
            $editor->remove_cap('wpt_twitter_switch');
            switch ($wpt_twitter_switch) {
                case 'subscriber':
                    $subscriber->add_cap('wpt_twitter_switch');
                    $contributor->add_cap('wpt_twitter_switch');
                    $author->add_cap('wpt_twitter_switch');
                    $editor->add_cap('wpt_twitter_switch');
                    break;
                case 'contributor':
                    $contributor->add_cap('wpt_twitter_switch');
                    $author->add_cap('wpt_twitter_switch');
                    $editor->add_cap('wpt_twitter_switch');
                    break;
                case 'author':
                    $author->add_cap('wpt_twitter_switch');
                    $editor->add_cap('wpt_twitter_switch');
                    break;
                case 'editor':
                    $editor->add_cap('wpt_twitter_switch');
                    break;
                default:
                    $role = get_role($wpt_twitter_switch);
                    $role->add_cap('wpt_twitter_switch');
                    break;
            }
        }
        update_option('wpt_twitter_switch', $wpt_twitter_switch);
        update_option('disable_url_failure', isset($_POST['disable_url_failure']) ? $_POST['disable_url_failure'] : 0);
        update_option('disable_twitter_failure', isset($_POST['disable_twitter_failure']) ? $_POST['disable_twitter_failure'] : 0);
        update_option('disable_oauth_notice', isset($_POST['disable_oauth_notice']) ? $_POST['disable_oauth_notice'] : 0);
        update_option('wp_debug_oauth', isset($_POST['wp_debug_oauth']) ? $_POST['wp_debug_oauth'] : 0);
        update_option('wpt_http', isset($_POST['wpt_http']) ? $_POST['wpt_http'] : 0);
        update_option('jd_donations', isset($_POST['jd_donations']) ? $_POST['jd_donations'] : 0);
        $wpt_truncation_order = $_POST['wpt_truncation_order'];
        update_option('wpt_truncation_order', $wpt_truncation_order);
        $message .= __('WP to Twitter Advanced Options Updated', 'wp-to-twitter');
    }
    if (isset($_POST['submit-type']) && $_POST['submit-type'] == 'options') {
        // UPDATE OPTIONS
        $wpt_settings = get_option('wpt_post_types');
        foreach ($_POST['wpt_post_types'] as $key => $value) {
            $array = array('post-published-update' => isset($value["post-published-update"]) ? $value["post-published-update"] : "", 'post-published-text' => $value["post-published-text"], 'post-edited-update' => isset($value["post-edited-update"]) ? $value["post-edited-update"] : "", 'post-edited-text' => $value["post-edited-text"]);
            $wpt_settings[$key] = $array;
        }
        update_option('wpt_post_types', $wpt_settings);
        update_option('newlink-published-text', $_POST['newlink-published-text']);
        update_option('jd_twit_blogroll', isset($_POST['jd_twit_blogroll']) ? $_POST['jd_twit_blogroll'] : "");
        update_option('comment-published-text', $_POST['comment-published-text']);
        update_option('comment-published-update', isset($_POST['comment-published-update']) ? $_POST['comment-published-update'] : "");
        update_option('jd_shortener', $_POST['jd_shortener']);
        if (get_option('jd_shortener') == 2 && (get_option('bitlylogin') == "" || get_option('bitlyapi') == "")) {
            $message .= __('You must add your Bit.ly login and API key in order to shorten URLs with Bit.ly.', 'wp-to-twitter');
            $message .= "<br />";
        }
        if (get_option('jd_shortener') == 6 && (get_option('yourlslogin') == "" || get_option('yourlsapi') == "" || get_option('yourlsurl') == "")) {
            $message .= __('You must add your YOURLS remote URL, login, and password in order to shorten URLs with a remote installation of YOURLS.', 'wp-to-twitter');
            $message .= "<br />";
        }
        if (get_option('jd_shortener') == 5 && get_option('yourlspath') == "") {
            $message .= __('You must add your YOURLS server path in order to shorten URLs with a remote installation of YOURLS.', 'wp-to-twitter');
            $message .= "<br />";
        }
        $message .= __('WP to Twitter Options Updated', 'wp-to-twitter');
    }
    if (isset($_POST['submit-type']) && $_POST['submit-type'] == 'setcategories') {
        if (isset($_POST['jd_twit_cats'])) {
            update_option('jd_twit_cats', 1);
        } else {
            update_option('jd_twit_cats', 0);
        }
        if (is_array($_POST['categories'])) {
            $categories = $_POST['categories'];
            update_option('limit_categories', '1');
            update_option('tweet_categories', $categories);
            $message = __("Category limits updated.");
        } else {
            update_option('limit_categories', '0');
            update_option('tweet_categories', '');
            $message = __("Category limits unset.", 'wp-to-twitter');
        }
    }
    if (isset($_POST['submit-type']) && $_POST['submit-type'] == 'yourlsapi') {
        if ($_POST['yourlsapi'] != '' && isset($_POST['submit'])) {
            update_option('yourlsapi', trim($_POST['yourlsapi']));
            $message = __("YOURLS password updated. ", 'wp-to-twitter');
        } else {
            if (isset($_POST['clear'])) {
                update_option('yourlsapi', '');
                $message = __("YOURLS password deleted. You will be unable to use your remote YOURLS account to create short URLS.", 'wp-to-twitter');
            } else {
                $message = __("Failed to save your YOURLS password! ", 'wp-to-twitter');
            }
        }
        if ($_POST['yourlslogin'] != '') {
            update_option('yourlslogin', trim($_POST['yourlslogin']));
            $message .= __("YOURLS username added. ", 'wp-to-twitter');
        }
        if ($_POST['yourlsurl'] != '') {
            update_option('yourlsurl', trim($_POST['yourlsurl']));
            $message .= __("YOURLS API url added. ", 'wp-to-twitter');
        } else {
            update_option('yourlsurl', '');
            $message .= __("YOURLS API url removed. ", 'wp-to-twitter');
        }
        if ($_POST['yourlspath'] != '') {
            update_option('yourlspath', trim($_POST['yourlspath']));
            if (file_exists($_POST['yourlspath'])) {
                $message .= __("YOURLS local server path added. ", 'wp-to-twitter');
            } else {
                $message .= __("The path to your YOURLS installation is not correct. ", 'wp-to-twitter');
            }
        } else {
            update_option('yourlspath', '');
            $message .= __("YOURLS local server path removed. ", 'wp-to-twitter');
        }
        if ($_POST['jd_keyword_format'] != '') {
            update_option('jd_keyword_format', $_POST['jd_keyword_format']);
            if ($_POST['jd_keyword_format'] == 1) {
                $message .= __("YOURLS will use Post ID for short URL slug.", 'wp-to-twitter');
            } else {
                $message .= __("YOURLS will use your custom keyword for short URL slug.", 'wp-to-twitter');
            }
        } else {
            update_option('jd_keyword_format', '');
            $message .= __("YOURLS will not use Post ID for the short URL slug.", 'wp-to-twitter');
        }
    }
    if (isset($_POST['submit-type']) && $_POST['submit-type'] == 'suprapi') {
        if ($_POST['suprapi'] != '' && isset($_POST['submit'])) {
            update_option('suprapi', trim($_POST['suprapi']));
            update_option('suprlogin', trim($_POST['suprlogin']));
            $message = __("Su.pr API Key and Username Updated", 'wp-to-twitter');
        } else {
            if (isset($_POST['clear'])) {
                update_option('suprapi', '');
                update_option('suprlogin', '');
                $message = __("Su.pr API Key and username deleted. Su.pr URLs created by WP to Twitter will no longer be associated with your account. ", 'wp-to-twitter');
            } else {
                $message = __("Su.pr API Key not added - <a href='http://su.pr/'>get one here</a>! ", 'wp-to-twitter');
            }
        }
    }
    if (isset($_POST['submit-type']) && $_POST['submit-type'] == 'bitlyapi') {
        if ($_POST['bitlyapi'] != '' && isset($_POST['submit'])) {
            update_option('bitlyapi', trim($_POST['bitlyapi']));
            $message = __("Bit.ly API Key Updated.", 'wp-to-twitter');
        } else {
            if (isset($_POST['clear'])) {
                update_option('bitlyapi', '');
                $message = __("Bit.ly API Key deleted. You cannot use the Bit.ly API without an API key. ", 'wp-to-twitter');
            } else {
                $message = __("Bit.ly API Key not added - <a href='http://bit.ly/account/'>get one here</a>! An API key is required to use the Bit.ly URL shortening service.", 'wp-to-twitter');
            }
        }
        if ($_POST['bitlylogin'] != '' && isset($_POST['submit'])) {
            update_option('bitlylogin', trim($_POST['bitlylogin']));
            $message .= __(" Bit.ly User Login Updated.", 'wp-to-twitter');
        } else {
            if (isset($_POST['clear'])) {
                update_option('bitlylogin', '');
                $message = __("Bit.ly User Login deleted. You cannot use the Bit.ly API without providing your username. ", 'wp-to-twitter');
            } else {
                $message = __("Bit.ly Login not added - <a href='http://bit.ly/account/'>get one here</a>! ", 'wp-to-twitter');
            }
        }
    }
    // Check whether the server has supported for needed functions.
    if (isset($_POST['submit-type']) && $_POST['submit-type'] == 'check-support') {
        $message = jd_check_functions();
    }
    ?>
<div class="wrap" id="wp-to-twitter">
<?php 
    wpt_marginal_function();
    if ($message) {
        ?>
<div id="message" class="updated fade"><?php 
        echo $message;
        ?>
</div>
<?php 
    }
    if (get_option('wp_twitter_failure') != '0' || get_option('wp_url_failure') == '1') {
        ?>
		<div class="error">
		<?php 
        if (get_option('wp_twitter_failure') == '1') {
            _e("<p>One or more of your last posts has failed to send a status update to Twitter. The Tweet has been saved, and you can re-Tweet it at your leisure.</p>", 'wp-to-twitter');
        }
        if (get_option('jd_status_message') != '') {
            echo "<p><strong>" . get_option('jd_status_message') . "</strong></p>";
        }
        if (get_option('wp_twitter_failure') == '2') {
            echo "<p>" . __("Sorry! I couldn't get in touch with the Twitter servers to post your <strong>new link</strong>! You'll have to post it manually, I'm afraid. ", 'wp-to-twitter') . "</p>";
        }
        if (get_option('wp_url_failure') == '1') {
            _e("<p>The query to the URL shortener API failed, and your URL was not shrunk. The full post URL was attached to your Tweet. Check with your URL shortening provider to see if there are any known issues.</p>", 'wp-to-twitter');
        }
        ?>
		<?php 
        $admin_url = is_plugin_active('wp-tweets-pro/wpt-pro-functions.php') ? admin_url('admin.php?page=wp-tweets-pro') : admin_url('options-general.php?page=wp-to-twitter/wp-to-twitter.php');
        ?>
		<form method="post" action="<?php 
        echo $admin_url;
        ?>
">
		<div><input type="hidden" name="submit-type" value="clear-error" /></div>
		<?php 
        $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false);
        echo "<div>{$nonce}</div>";
        ?>
	
		<p><input type="submit" name="submit" value="<?php 
        _e("Clear 'WP to Twitter' Error Messages", 'wp-to-twitter');
        ?>
" class="button-primary" /></p>
		</form>		
		</div>
<?php 
    }
    ?>
	
<?php 
    if (isset($_GET['export']) && $_GET['export'] == "settings") {
        print_settings();
    }
    ?>
<h2><?php 
    _e("WP to Twitter Options", 'wp-to-twitter');
    ?>
</h2>
<div id="wpt_settings_page" class="postbox-container" style="width: 70%">

<?php 
    $wp_to_twitter_directory = get_bloginfo('wpurl') . '/' . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__));
    ?>
		
<div class="metabox-holder">

<?php 
    if (function_exists('wtt_connect_oauth')) {
        wtt_connect_oauth();
    }
    ?>

<?php 
    if (function_exists('wpt_pro_functions')) {
        wpt_pro_functions();
    }
    ?>
<div class="ui-sortable meta-box-sortables">
<div class="postbox">
	
	<h3><?php 
    _e('Basic Settings', 'wp-to-twitter');
    ?>
</h3>
	<div class="inside">
	<form method="post" action="">
	<?php 
    $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false);
    echo "<div>{$nonce}</div>";
    ?>
	<div>	
		<input type="submit" name="submit" value="<?php 
    _e("Save WP->Twitter Options", 'wp-to-twitter');
    ?>
" class="button-primary button-side" />	
			<?php 
    $post_types = get_post_types('', 'names');
    $wpt_settings = get_option('wpt_post_types');
    foreach ($post_types as $type) {
        if ($type == 'attachment' || $type == 'nav_menu_item' || $type == 'revision') {
        } else {
            $vowels = array('a', 'e', 'i', 'o', 'u');
            foreach ($vowels as $vowel) {
                if (strpos($type, $vowel) === 0) {
                    $word = 'an';
                    break;
                } else {
                    $word = 'a';
                }
            }
            ?>
			<fieldset class='wpt_types'>
			<legend><?php 
            _e("Settings for type '{$type}'", 'wp-to-twitter');
            ?>
</legend>
			<p>
				<input type="checkbox" name="wpt_post_types[<?php 
            echo $type;
            ?>
][post-published-update]" id="<?php 
            echo $type;
            ?>
-post-published-update" value="1" <?php 
            echo jd_checkCheckbox('wpt_post_types', $type, 'post-published-update');
            ?>
 />
				<label for="<?php 
            echo $type;
            ?>
-post-published-update"><strong><?php 
            _e("Update when {$word} {$type} is published", 'wp-to-twitter');
            ?>
</strong></label> <label for="<?php 
            echo $type;
            ?>
-post-published-text"><br /><?php 
            _e("Text for new {$type} updates:", 'wp-to-twitter');
            ?>
</label><br /><input type="text" name="wpt_post_types[<?php 
            echo $type;
            ?>
][post-published-text]" id="<?php 
            echo $type;
            ?>
-post-published-text" size="60" maxlength="120" value="<?php 
            if (isset($wpt_settings[$type])) {
                echo esc_attr(stripslashes($wpt_settings[$type]['post-published-text']));
            }
            ?>
" />
			</p>
			<p>
				<input type="checkbox" name="wpt_post_types[<?php 
            echo $type;
            ?>
][post-edited-update]" id="<?php 
            echo $type;
            ?>
-post-edited-update" value="1" <?php 
            echo jd_checkCheckbox('wpt_post_types', $type, 'post-edited-update');
            ?>
 />
				<label for="<?php 
            echo $type;
            ?>
-post-edited-update"><strong><?php 
            _e("Update when {$word} {$type} is edited", 'wp-to-twitter');
            ?>
</strong></label><br /><label for="<?php 
            echo $type;
            ?>
-post-edited-text"><?php 
            _e("Text for {$type} editing updates:", 'wp-to-twitter');
            ?>
</label><br /><input type="text" name="wpt_post_types[<?php 
            echo $type;
            ?>
][post-edited-text]" id="<?php 
            echo $type;
            ?>
-post-edited-text" size="60" maxlength="120" value="<?php 
            if (isset($wpt_settings[$type])) {
                echo esc_attr(stripslashes($wpt_settings[$type]['post-edited-text']));
            }
            ?>
" />	
			</p>
			</fieldset>
			<?php 
        }
    }
    ?>
			<fieldset class="comments">
			<legend><?php 
    _e('Settings for Comments', 'wp-to-twitter');
    ?>
</legend>
			<p>
				<input type="checkbox" name="comment-published-update" id="comment-published-update" value="1" <?php 
    echo jd_checkCheckbox('comment-published-update');
    ?>
 />
				<label for="comment-published-update"><strong><?php 
    _e("Update Twitter when new comments are posted", 'wp-to-twitter');
    ?>
</strong></label><br />				
				<label for="comment-published-text"><?php 
    _e("Text for new comments:", 'wp-to-twitter');
    ?>
</label> <input type="text" name="comment-published-text" id="comment-published-text" size="60" maxlength="120" value="<?php 
    echo esc_attr(stripslashes(get_option('comment-published-text')));
    ?>
" />
			</p>
			<p><?php 
    _e('In addition to the above short tags, comment templates can use <code>#commenter#</code> to post the commenter\'s provided name in the Tweet. <em>Use this feature at your own risk</em>, as it will let anybody who can post a comment on your site post a phrase in your Twitter stream.', 'wp-to-twitter');
    ?>
			</fieldset>					
			<fieldset>
			<legend><?php 
    _e('Settings for Links', 'wp-to-twitter');
    ?>
</legend>
			<p>
				<input type="checkbox" name="jd_twit_blogroll" id="jd_twit_blogroll" value="1" <?php 
    echo jd_checkCheckbox('jd_twit_blogroll');
    ?>
 />
				<label for="jd_twit_blogroll"><strong><?php 
    _e("Update Twitter when you post a Blogroll link", 'wp-to-twitter');
    ?>
</strong></label><br />				
				<label for="newlink-published-text"><?php 
    _e("Text for new link updates:", 'wp-to-twitter');
    ?>
</label> <input type="text" name="newlink-published-text" id="newlink-published-text" size="60" maxlength="120" value="<?php 
    echo esc_attr(stripslashes(get_option('newlink-published-text')));
    ?>
" /><br /><small><?php 
    _e('Available shortcodes: <code>#url#</code>, <code>#title#</code>, and <code>#description#</code>.', 'wp-to-twitter');
    ?>
</small>
			</p>
			</fieldset>
			<fieldset>	
			<legend><?php 
    _e("Choose your short URL service (account settings below)", 'wp-to-twitter');
    ?>
</legend>
			<p>
			<select name="jd_shortener" id="jd_shortener">
				<option value="3" <?php 
    jd_checkSelect('jd_shortener', '3');
    ?>
><?php 
    _e("Don't shorten URLs.", 'wp-to-twitter');
    ?>
</option>
				<option value="7" <?php 
    jd_checkSelect('jd_shortener', '7');
    ?>
><?php 
    _e("Use Su.pr for my URL shortener.", 'wp-to-twitter');
    ?>
</option> 
				<option value="2" <?php 
    jd_checkSelect('jd_shortener', '2');
    ?>
><?php 
    _e("Use Bit.ly for my URL shortener.", 'wp-to-twitter');
    ?>
</option>
				<option value="8" <?php 
    jd_checkSelect('jd_shortener', '8');
    ?>
><?php 
    _e("Use Goo.gl as a URL shortener.", 'wp-to-twitter');
    ?>
</option> 				
				<option value="5" <?php 
    jd_checkSelect('jd_shortener', '5');
    ?>
><?php 
    _e("YOURLS (installed on this server)", 'wp-to-twitter');
    ?>
</option>
				<option value="6" <?php 
    jd_checkSelect('jd_shortener', '6');
    ?>
><?php 
    _e("YOURLS (installed on a remote server)", 'wp-to-twitter');
    ?>
</option>		
				<option value="4" <?php 
    jd_checkSelect('jd_shortener', '4');
    ?>
><?php 
    _e("Use WordPress as a URL shortener.", 'wp-to-twitter');
    ?>
</option> 
			</select>
			</p>
			</fieldset>
				<div>
		<input type="hidden" name="submit-type" value="options" />
		</div>
	<input type="submit" name="submit" value="<?php 
    _e("Save WP->Twitter Options", 'wp-to-twitter');
    ?>
" class="button-primary" />	
	</div>
	</form>
</div>
</div>
</div>
<div class="ui-sortable meta-box-sortables">
<div class="postbox">
<h3><?php 
    _e('<abbr title="Uniform Resource Locator">URL</abbr> Shortener Account Settings', 'wp-to-twitter');
    ?>
</h3>
	<div class="inside">
		<div class="panel">
		<h4 class="supr"><span><?php 
    _e("Your Su.pr account details", 'wp-to-twitter');
    ?>
 <?php 
    _e('(optional)', 'wp-to-twitter');
    ?>
</span></h4>
	<form method="post" action="">
	<div>
		<p>
		<label for="suprlogin"><?php 
    _e("Your Su.pr Username:"******"text" name="suprlogin" id="suprlogin" size="40" value="<?php 
    echo esc_attr(get_option('suprlogin'));
    ?>
" />
		</p>
		<p>
		<label for="suprapi"><?php 
    _e("Your Su.pr <abbr title='application programming interface'>API</abbr> Key:", 'wp-to-twitter');
    ?>
</label>
		<input type="text" name="suprapi" id="suprapi" size="40" value="<?php 
    echo esc_attr(get_option('suprapi'));
    ?>
" />
		</p>
		<div>
		<input type="hidden" name="submit-type" value="suprapi" />
		</div>
		<?php 
    $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false);
    echo "<div>{$nonce}</div>";
    ?>
	
		<p><input type="submit" name="submit" value="Save Su.pr API Key" class="button-primary" /> <input type="submit" name="clear" value="Clear Su.pr API Key" />&raquo; <small><?php 
    _e("Don't have a Su.pr account or API key? <a href='http://su.pr/'>Get one here</a>!<br />You'll need an API key in order to associate the URLs you create with your Su.pr account.", 'wp-to-twitter');
    ?>
</small></p>
	</div>
	</form>
	</div>
	<div class="panel">
<h4 class="bitly"><span><?php 
    _e("Your Bit.ly account details", 'wp-to-twitter');
    ?>
</span></h4>
	<form method="post" action="">
	<div>
		<p>
		<label for="bitlylogin"><?php 
    _e("Your Bit.ly username:"******"text" name="bitlylogin" id="bitlylogin" value="<?php 
    echo esc_attr(get_option('bitlylogin'));
    ?>
" />
		<br /><small><?php 
    _e('This must be a standard Bit.ly account. Your Twitter or Facebook log-in will not work.', 'wp-to-twitter');
    ?>
</small></p>	
		<p>
		<label for="bitlyapi"><?php 
    _e("Your Bit.ly <abbr title='application programming interface'>API</abbr> Key:", 'wp-to-twitter');
    ?>
</label>
		<input type="text" name="bitlyapi" id="bitlyapi" size="40" value="<?php 
    echo esc_attr(get_option('bitlyapi'));
    ?>
" />
		</p>

		<div>
		<input type="hidden" name="submit-type" value="bitlyapi" />
		</div>
	<?php 
    $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false);
    echo "<div>{$nonce}</div>";
    ?>
	
		<p><input type="submit" name="submit" value="<?php 
    _e('Save Bit.ly API Key', 'wp-to-twitter');
    ?>
" class="button-primary" /> <input type="submit" name="clear" value="<?php 
    _e('Clear Bit.ly API Key', 'wp-to-twitter');
    ?>
" /><br /><small><?php 
    _e("A Bit.ly API key and username is required to shorten URLs via the Bit.ly API and WP to Twitter.", 'wp-to-twitter');
    ?>
</small></p>
	</div>
	</form>	
</div>
<div class="panel">
<h4 class="yourls"><span><?php 
    _e("Your YOURLS account details", 'wp-to-twitter');
    ?>
</span></h4>
	<form method="post" action="">
	<div>
		<p>
		<label for="yourlspath"><?php 
    _e('Path to your YOURLS config file (Local installations)', 'wp-to-twitter');
    ?>
</label> <input type="text" id="yourlspath" name="yourlspath" size="60" value="<?php 
    echo esc_attr(get_option('yourlspath'));
    ?>
"/>
		<small><?php 
    _e('Example:', 'wp-to-twitter');
    ?>
 <code>/home/username/www/www/yourls/includes/config.php</code></small>
		</p>				
		<p>
		<label for="yourlsurl"><?php 
    _e('URI to the YOURLS API (Remote installations)', 'wp-to-twitter');
    ?>
</label> <input type="text" id="yourlsurl" name="yourlsurl" size="60" value="<?php 
    echo esc_attr(get_option('yourlsurl'));
    ?>
"/>
		<small><?php 
    _e('Example:', 'wp-to-twitter');
    ?>
 <code>http://domain.com/yourls-api.php</code></small>
		</p>
		<p>
		<label for="yourlslogin"><?php 
    _e("Your YOURLS username:"******"text" name="yourlslogin" id="yourlslogin" size="30" value="<?php 
    echo esc_attr(get_option('yourlslogin'));
    ?>
" />
		</p>	
		<p>
		<label for="yourlsapi"><?php 
    _e("Your YOURLS password:"******"<em>Saved</em>", 'wp-to-twitter');
    }
    ?>
</label>
		<input type="password" name="yourlsapi" id="yourlsapi" size="30" value="" />
		</p>
		<p>
		<input type="radio" name="jd_keyword_format" id="jd_keyword_id" value="1" <?php 
    jd_checkSelect('jd_keyword_format', 1, 'checkbox');
    ?>
 /> 		<label for="jd_keyword_id"><?php 
    _e("Post ID for YOURLS url slug.", 'wp-to-twitter');
    ?>
</label><br />
		<input type="radio" name="jd_keyword_format" id="jd_keyword" value="2" <?php 
    jd_checkSelect('jd_keyword_format', 2, 'checkbox');
    ?>
 /> 		<label for="jd_keyword"><?php 
    _e("Custom keyword for YOURLS url slug.", 'wp-to-twitter');
    ?>
</label><br />
		<input type="radio" name="jd_keyword_format" id="jd_keyword_default" value="0" <?php 
    jd_checkSelect('jd_keyword_format', 0, 'checkbox');
    ?>
 /> <label for="jd_keyword_default"><?php 
    _e("Default: sequential URL numbering.", 'wp-to-twitter');
    ?>
</label>
		</p>
		<div>
		<input type="hidden" name="submit-type" value="yourlsapi" />
		</div>
	<?php 
    $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false);
    echo "<div>{$nonce}</div>";
    ?>
	
		<p><input type="submit" name="submit" value="<?php 
    _e('Save YOURLS Account Info', 'wp-to-twitter');
    ?>
" class="button-primary" /> <input type="submit" name="clear" value="<?php 
    _e('Clear YOURLS password', 'wp-to-twitter');
    ?>
" /><br /><small><?php 
    _e("A YOURLS password and username is required to shorten URLs via the remote YOURLS API and WP to Twitter.", 'wp-to-twitter');
    ?>
</small></p>
	</div>
	</form>		
	</div>
	
</div>
</div>
</div>

<div class="ui-sortable meta-box-sortables">
<div class="postbox">
	<h3><?php 
    _e('Advanced Settings', 'wp-to-twitter');
    ?>
</h3>
	<div class="inside">
	<form method="post" action="">
	<div>		
	<?php 
    $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false);
    echo "<div>{$nonce}</div>";
    ?>
	
	<input type="submit" name="submit" value="<?php 
    _e("Save Advanced WP->Twitter Options", 'wp-to-twitter');
    ?>
" class="button-primary button-side" />	
			<fieldset>
				<legend><?php 
    _e("Advanced Tweet settings", "wp-to-twitter");
    ?>
</legend>
			<p>
				 <input type="checkbox" name="jd_strip_nonan" id="jd_strip_nonan" value="1" <?php 
    echo jd_checkCheckbox('jd_strip_nonan');
    ?>
 /> <label for="jd_strip_nonan"><?php 
    _e("Strip nonalphanumeric characters from tags", 'wp-to-twitter');
    ?>
</label><br />
				<label for="jd_replace_character"><?php 
    _e("Spaces in tags replaced with:", 'wp-to-twitter');
    ?>
</label> <input type="text" name="jd_replace_character" id="jd_replace_character" value="<?php 
    echo esc_attr(get_option('jd_replace_character'));
    ?>
" size="3" /><br />
				
				<small><?php 
    _e("Default replacement is an underscore (<code>_</code>). Use <code>[ ]</code> to remove spaces entirely.", 'wp-to-twitter');
    ?>
</small>					
			</p>
			<p>
			<label for="jd_max_tags"><?php 
    _e("Maximum number of tags to include:", 'wp-to-twitter');
    ?>
</label> <input type="text" name="jd_max_tags" id="jd_max_tags" value="<?php 
    echo esc_attr(get_option('jd_max_tags'));
    ?>
" size="3" />
			<label for="jd_max_characters"><?php 
    _e("Maximum length in characters for included tags:", 'wp-to-twitter');
    ?>
</label> <input type="text" name="jd_max_characters" id="jd_max_characters" value="<?php 
    echo esc_attr(get_option('jd_max_characters'));
    ?>
" size="3" /><br />
			<small><?php 
    _e("These options allow you to restrict the length and number of WordPress tags sent to Twitter as hashtags. Set to <code>0</code> or leave blank to allow any and all tags.", 'wp-to-twitter');
    ?>
</small>			
			</p>			
			<p>
				<label for="jd_post_excerpt"><?php 
    _e("Length of post excerpt (in characters):", 'wp-to-twitter');
    ?>
</label> <input type="text" name="jd_post_excerpt" id="jd_post_excerpt" size="3" maxlength="3" value="<?php 
    echo esc_attr(get_option('jd_post_excerpt'));
    ?>
" /><br /><small><?php 
    _e("By default, extracted from the post itself. If you use the 'Excerpt' field, that will be used instead.", 'wp-to-twitter');
    ?>
</small>
			</p>				
			<p>
				<label for="jd_date_format"><?php 
    _e("WP to Twitter Date Formatting:", 'wp-to-twitter');
    ?>
</label> <input type="text" name="jd_date_format" id="jd_date_format" size="12" maxlength="12" value="<?php 
    if (get_option('jd_date_format') == '') {
        echo esc_attr(get_option('date_format'));
    } else {
        echo esc_attr(get_option('jd_date_format'));
    }
    ?>
" /> (<?php 
    if (get_option('jd_date_format') != '') {
        echo date_i18n(get_option('jd_date_format'));
    } else {
        echo "<em>" . date_i18n(get_option('date_format')) . "</em>";
    }
    ?>
)<br />
				<small><?php 
    _e("Default is from your general settings. <a href='http://codex.wordpress.org/Formatting_Date_and_Time'>Date Formatting Documentation</a>.", 'wp-to-twitter');
    ?>
</small>
			</p>
			
			<p>
				<label for="jd_twit_prepend"><?php 
    _e("Custom text before all Tweets:", 'wp-to-twitter');
    ?>
</label> <input type="text" name="jd_twit_prepend" id="jd_twit_prepend" size="20" maxlength="20" value="<?php 
    echo esc_attr(get_option('jd_twit_prepend'));
    ?>
" />
				<label for="jd_twit_append"><?php 
    _e("Custom text after all Tweets:", 'wp-to-twitter');
    ?>
</label> <input type="text" name="jd_twit_append" id="jd_twit_append" size="20" maxlength="20" value="<?php 
    echo esc_attr(get_option('jd_twit_append'));
    ?>
" />
			</p>
			<p>
				<label for="jd_twit_custom_url"><?php 
    _e("Custom field for an alternate URL to be shortened and Tweeted:", 'wp-to-twitter');
    ?>
</label> <input type="text" name="jd_twit_custom_url" id="jd_twit_custom_url" size="40" maxlength="120" value="<?php 
    echo esc_attr(get_option('jd_twit_custom_url'));
    ?>
" /><br />
				<small><?php 
    _e("You can use a custom field to send an alternate URL for your post. The value is the name of a custom field containing your external URL.", 'wp-to-twitter');
    ?>
</small>
			</p>
			<?php 
    $inputs = '';
    $default_order = array('excerpt' => 0, 'title' => 1, 'date' => 2, 'category' => 3, 'blogname' => 4, 'author' => 5, 'account' => 6, 'tags' => 7, 'modified' => 8);
    $preferred_order = get_option('wpt_truncation_order');
    if (is_array($preferred_order)) {
        $default_order = $preferred_order;
    }
    asort($default_order);
    foreach ($default_order as $k => $v) {
        $label = ucfirst($k);
        $inputs .= "<input type='text' size='2' value='{$v}' name='wpt_truncation_order[{$k}]' /> <label for='{$k}-{$v}'>{$label}</label><br />";
    }
    ?>
			<fieldset>
			<legend><?php 
    _e('Preferred status update truncation sequence', 'wp-to-twitter');
    ?>
</legend>
			<p>
			<?php 
    echo $inputs;
    ?>
			<small><?php 
    _e('This is the order in which items will be abbreviated or removed from your status update if it is too long to send to Twitter.', 'wp-to-twitter');
    ?>
</small>
			</p>
			</fieldset>
		</fieldset>	
		<fieldset>
		<legend><?php 
    _e("Special Cases when WordPress should send a Tweet", 'wp-to-twitter');
    ?>
</legend>
			<p>
				<input type="checkbox" name="jd_tweet_default" id="jd_tweet_default" value="1" <?php 
    echo jd_checkCheckbox('jd_tweet_default');
    ?>
 />
				<label for="jd_tweet_default"><?php 
    _e("Do not post Tweets by default", 'wp-to-twitter');
    ?>
</label><br />
				<input type="checkbox" name="jd_tweet_default_edit" id="jd_tweet_default_edit" value="1" <?php 
    echo jd_checkCheckbox('jd_tweet_default_edit');
    ?>
 />
				<label for="jd_tweet_default_edit"><?php 
    _e("Do not post Tweets by default (editing only)", 'wp-to-twitter');
    ?>
</label><br />				
				<small><?php 
    _e("By default, all posts meeting other requirements will be posted to Twitter. Check this to change your setting.", 'wp-to-twitter');
    ?>
</small>
			</p>
			<p>
				<input type="checkbox" name="wpt_inline_edits" id="wpt_inline_edits" value="1" <?php 
    echo jd_checkCheckbox('wpt_inline_edits');
    ?>
 />
				<label for="wpt_inline_edits"><?php 
    _e("Allow status updates from Quick Edit", 'wp-to-twitter');
    ?>
</label><br />
				<small><?php 
    _e("If checked, all posts edited individually or in bulk through the Quick Edit feature will be Tweeted.", 'wp-to-twitter');
    ?>
</small>

			</p>
			<?php 
    if (function_exists('wpt_pro_exists') && get_option('wpt_delay_tweets') > 0) {
        $r_disabled = " disabled='disabled'";
        $r_message = "<em>" . __('Delaying tweets with WP Tweets PRO moves Tweeting to an publishing-independent action.', 'wp-to-twitter') . "</em>";
    } else {
        $r_disabled = '';
        $r_message = '';
    }
    ?>
			<p>
				<input type="checkbox"<?php 
    echo $r_disabled;
    ?>
 name="jd_twit_remote" id="jd_twit_remote" value="1" <?php 
    echo jd_checkCheckbox('jd_twit_remote');
    ?>
 />
				<label for="jd_twit_remote"><?php 
    _e("Send Twitter Updates on remote publication (Post by Email or XMLRPC Client)", 'wp-to-twitter');
    ?>
</label><br />
				<?php 
    echo $r_message;
    ?>
			</p>
		</fieldset>
		<fieldset>
		<legend><?php 
    _e("Google Analytics Settings", 'wp-to-twitter');
    ?>
</legend>
				<p><?php 
    _e("You can track the response from Twitter using Google Analytics by defining a campaign identifier here. You can either define a static identifier or a dynamic identifier. Static identifiers don't change from post to post; dynamic identifiers are derived from information relevant to the specific post. Dynamic identifiers will allow you to break down your statistics by an additional variable.", "wp-to-twitter");
    ?>
</p>
				
			<p>
				<input type="checkbox" name="use-twitter-analytics" id="use-twitter-analytics" value="1" <?php 
    echo jd_checkCheckbox('use-twitter-analytics');
    ?>
 />
				<label for="use-twitter-analytics"><?php 
    _e("Use a Static Identifier with WP-to-Twitter", 'wp-to-twitter');
    ?>
</label><br />
				<label for="twitter-analytics-campaign"><?php 
    _e("Static Campaign identifier for Google Analytics:", 'wp-to-twitter');
    ?>
</label> <input type="text" name="twitter-analytics-campaign" id="twitter-analytics-campaign" size="40" maxlength="120" value="<?php 
    echo esc_attr(get_option('twitter-analytics-campaign'));
    ?>
" /><br />
			</p>
			<p>
				<input type="checkbox" name="use-dynamic-analytics" id="use-dynamic-analytics" value="1" <?php 
    echo jd_checkCheckbox('use_dynamic_analytics');
    ?>
 />
				<label for="use-dynamic-analytics"><?php 
    _e("Use a dynamic identifier with Google Analytics and WP-to-Twitter", 'wp-to-twitter');
    ?>
</label><br />
			<label for="jd-dynamic-analytics"><?php 
    _e("What dynamic identifier would you like to use?", "wp-to-twitter");
    ?>
</label> 
				<select name="jd-dynamic-analytics" id="jd-dynamic-analytics">
					<option value="post_category"<?php 
    jd_checkSelect('jd_dynamic_analytics', 'post_category');
    ?>
><?php 
    _e("Category", "wp-to-twitter");
    ?>
</option>
					<option value="post_ID"<?php 
    jd_checkSelect('jd_dynamic_analytics', 'post_ID');
    ?>
><?php 
    _e("Post ID", "wp-to-twitter");
    ?>
</option>
					<option value="post_title"<?php 
    jd_checkSelect('jd_dynamic_analytics', 'post_title');
    ?>
><?php 
    _e("Post Title", "wp-to-twitter");
    ?>
</option>
					<option value="post_author"<?php 
    jd_checkSelect('jd_dynamic_analytics', 'post_author');
    ?>
><?php 
    _e("Author", "wp-to-twitter");
    ?>
</option>
				</select><br />
			</p>
		</fieldset>
		<fieldset id="indauthors">
		<legend><?php 
    _e('Individual Authors', 'wp-to-twitter');
    ?>
</legend>
			<p>
				<input type="checkbox" name="jd_individual_twitter_users" id="jd_individual_twitter_users" value="1" <?php 
    echo jd_checkCheckbox('jd_individual_twitter_users');
    ?>
 />
				<label for="jd_individual_twitter_users"><?php 
    _e("Authors have individual Twitter accounts", 'wp-to-twitter');
    ?>
</label><br /><small><?php 
    _e('Authors can add their username in their user profile. This feature can only add an @reference to the author. The @reference is placed using the <code>#account#</code> shortcode, which will pick up the main account if user accounts are not enabled.', 'wp-to-twitter');
    ?>
</small>
			</p>
		<?php 
    global $wp_roles;
    $roles = $wp_roles->get_names();
    $options = '';
    $permissions = '';
    $switcher = '';
    foreach ($roles as $role => $rolename) {
        $permissions .= $role != 'subscriber' ? "<option value='{$role}'" . wtt_option_selected(get_option('wtt_user_permissions'), $role, 'option') . ">{$rolename}</option>\n" : '';
        $options .= $role != 'subscriber' ? "<option value='{$role}'" . wtt_option_selected(get_option('wtt_show_custom_tweet'), $role, 'option') . ">{$rolename}</option>\n" : '';
        $switcher .= $role != 'subscriber' ? "<option value='{$role}'" . wtt_option_selected(get_option('wpt_twitter_switch'), $role, 'option') . ">{$rolename}</option>\n" : '';
    }
    ?>
		    <p>
			<label for="wtt_user_permissions"><?php 
    _e('Choose the lowest user group that can add their Twitter information', 'wp-to-twitter');
    ?>
</label> <select id="wtt_user_permissions" name="wtt_user_permissions">
				<?php 
    echo $permissions;
    ?>
			</select> 
			</p>
		    <p>
			<label for="wtt_show_custom_tweet"><?php 
    _e('Choose the lowest user group that can see the Custom Tweet options when posting', 'wp-to-twitter');
    ?>
</label> <select id="wtt_show_custom_tweet" name="wtt_show_custom_tweet">
				<?php 
    echo $options;
    ?>
			</select> 
			</p>
			<p>
			<label for="wpt_twitter_switch"><?php 
    _e('User groups above this can toggle the Tweet/Don\'t Tweet option, but not see other custom tweet options.', 'wp-to-twitter');
    ?>
</label> <select id="wpt_twitter_switch" name="wpt_twitter_switch">
				<?php 
    echo $switcher;
    ?>
			</select> 
			</p>
		</fieldset>
		<fieldset>
		<legend><?php 
    _e('Disable Error Messages', 'wp-to-twitter');
    ?>
</legend>
			<ul>
			<li><input type="checkbox" name="disable_url_failure" id="disable_url_failure" value="1" <?php 
    echo jd_checkCheckbox('disable_url_failure');
    ?>
 />	<label for="disable_url_failure"><?php 
    _e("Disable global URL shortener error messages.", 'wp-to-twitter');
    ?>
</label></li>
			<li><input type="checkbox" name="disable_twitter_failure" id="disable_twitter_failure" value="1" <?php 
    echo jd_checkCheckbox('disable_twitter_failure');
    ?>
 />	<label for="disable_twitter_failure"><?php 
    _e("Disable global Twitter API error messages.", 'wp-to-twitter');
    ?>
</label></li>
			<li><input type="checkbox" name="disable_oauth_notice" id="disable_oauth_notice" value="1" <?php 
    echo jd_checkCheckbox('disable_oauth_notice');
    ?>
 /> <label for="disable_oauth_notice"><?php 
    _e("Disable notification to implement OAuth", 'wp-to-twitter');
    ?>
</label></li>
			<li><input type="checkbox" name="wp_debug_oauth" id="wp_debug_oauth" value="1" <?php 
    echo jd_checkCheckbox('wp_debug_oauth');
    ?>
 />
				<label for="wp_debug_oauth"><?php 
    _e("Get Debugging Data for OAuth Connection", 'wp-to-twitter');
    ?>
</label></li>
			<li><input type="checkbox" name="wpt_http" id="wpt_http" value="1" <?php 
    echo jd_checkCheckbox('wpt_http');
    ?>
 />
				<label for="wpt_http"><?php 
    _e("Switch to <code>http</code> connection. (Default is https)", 'wp-to-twitter');
    ?>
</label></li>				
			<li><input type="checkbox" name="jd_donations" id="jd_donations" value="1" <?php 
    echo jd_checkCheckbox('jd_donations');
    ?>
 />
				<label for="jd_donations"><strong><?php 
    _e("I made a donation, so stop whinging at me, please.", 'wp-to-twitter');
    ?>
</strong></label></li>
			</ul>
		</fieldset>
		<div>
		<input type="hidden" name="submit-type" value="advanced" />
		</div>
	<input type="submit" name="submit" value="<?php 
    _e("Save Advanced WP->Twitter Options", 'wp-to-twitter');
    ?>
" class="button-primary" />	
	</div>
	</form>
</div>
</div>
</div>
<div class="ui-sortable meta-box-sortables">
	<div class="postbox categories">
	<h3><?php 
    _e('Limit Updating Categories', 'wp-to-twitter');
    ?>
</h3>
		<div class="inside">
			<p>
			<?php 
    _e('If no categories are checked, limiting by category will be ignored, and all categories will be Tweeted.', 'wp-to-twitter');
    ?>
			<?php 
    if (get_option('limit_categories') == '0') {
        _e('<em>Category limits are disabled.</em>', 'wp-to-twitter');
    }
    ?>
			</p>
	<?php 
    jd_list_categories();
    ?>

		</div>
	</div>
</div>

	<div class="postbox" id="get-support">
	<h3><?php 
    _e('Get Plug-in Support', 'wp-to-twitter');
    ?>
</h3>
		<div class="inside">
		<?php 
    if (!function_exists('wpt_pro_exists')) {
        ?>
		<p><?php 
        _e('Support requests without a donation will not be answered, but will be treated as bug reports.', 'wp-to-twitter');
        ?>
</p>
		<?php 
    }
    ?>
		<?php 
    wpt_get_support_form();
    ?>
		</div>
	</div>
	
	<form method="post" action="">
	<fieldset>
	<input type="hidden" name="submit-type" value="check-support" />
	<?php 
    $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false);
    echo "<div>{$nonce}</div>";
    ?>
	
		<p>
		<input type="submit" name="submit" value="<?php 
    _e('Check Support', 'wp-to-twitter');
    ?>
" class="button-primary" /> <?php 
    _e('Check whether your server supports <a href="http://www.joedolson.com/articles/wp-to-twitter/">WP to Twitter\'s</a> queries to the Twitter and URL shortening APIs. This test will send a status update to Twitter and shorten a URL using your selected methods.', 'wp-to-twitter');
    ?>
		</p>
	</fieldset>
	</form>		
</div>
</div>
<div class="postbox-container" style="width:20%">
<div class="metabox-holder">
	<div class="ui-sortable meta-box-sortables">
		<div class="postbox">
			<?php 
    if (!function_exists('wpt_pro_exists')) {
        ?>
			<h3><strong><?php 
        _e('Support WP to Twitter', 'wp-to-twitter');
        ?>
</strong></h3>
			<?php 
    } else {
        ?>
			<h3><strong><?php 
        _e('WP to Twitter Support', 'wp-to-twitter');
        ?>
</strong></h3>			
			<?php 
    }
    ?>
			<div class="inside resources">
			<ul>
			<li><a href="?page=wp-to-twitter/wp-to-twitter.php&amp;export=settings"><?php 
    _e("View Settings", 'wp-to-twitter');
    ?>
</a></li>
			<?php 
    if (function_exists('wpt_pro_exists')) {
        $support = admin_url('admin.php?page=wp-tweets-pro');
    } else {
        $support = admin_url('options-general.php?page=wp-to-twitter/wp-to-twitter.php');
    }
    ?>
			<li><a href="<?php 
    echo $support;
    ?>
#get-support"><?php 
    _e("Get Support", 'wp-to-twitter');
    ?>
</a></li>
			</ul>
			<?php 
    if (get_option('jd_donations') != 1 && !function_exists('wpt_pro_exists')) {
        ?>
			<div>
			<p><?php 
        _e('<a href="http://www.joedolson.com/donate.php">Make a donation today!</a> Every donation counts - donate $2, $10, or $100 and help me keep this plug-in running!', 'wp-to-twitter');
        ?>
</p>
			<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
				<div>
				<input type="hidden" name="cmd" value="_s-xclick" />
				<input type="hidden" name="hosted_button_id" value="8490399" />
				<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="Donate" />
				<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
				</div>
			</form>
			</div>		
		<?php 
    }
    ?>
			</div>
		</div>
	</div>
	<?php 
    if (!function_exists('wpt_pro_exists')) {
        ?>
	<div class="ui-sortable meta-box-sortables">
		<div class="postbox">
			<h3><strong><?php 
        _e('Upgrade Now!', 'wp-to-twitter');
        ?>
</strong></h3>
			<div class="inside purchase">
				<strong><a href="http://www.joedolson.com/articles/wp-tweets-pro/"><?php 
        _e('Upgrade to <strong>WP Tweets PRO</strong> for more control!', 'wp-to-twitter');
        ?>
</a></strong>
			<p><?php 
        _e('Extra features with the PRO upgrade:', 'wp-to-twitter');
        ?>
</p>
			<ul>
				<li><?php 
        _e('Users can post to their own Twitter accounts', 'wp-to-twitter');
        ?>
</li>
				<li><?php 
        _e('Set a timer to send your Tweet minutes or hours after you publish the post', 'wp-to-twitter');
        ?>
</li>
				<li><?php 
        _e('Automatically re-send Tweets at an assigned time after publishing', 'wp-to-twitter');
        ?>
</li>
			</ul>
			
			</div>
		</div>
	</div>
	<?php 
    }
    ?>
	<div class="ui-sortable meta-box-sortables">
		<div class="postbox">
		<h3><?php 
    _e('Shortcodes', 'wp-to-twitter');
    ?>
</h3>
		<div class="inside">
			<p><?php 
    _e("Available in post update templates:", 'wp-to-twitter');
    ?>
</p>
			<ul>
			<li><?php 
    _e("<code>#title#</code>: the title of your blog post", 'wp-to-twitter');
    ?>
</li>
			<li><?php 
    _e("<code>#blog#</code>: the title of your blog", 'wp-to-twitter');
    ?>
</li>
			<li><?php 
    _e("<code>#post#</code>: a short excerpt of the post content", 'wp-to-twitter');
    ?>
</li>
			<li><?php 
    _e("<code>#category#</code>: the first selected category for the post", 'wp-to-twitter');
    ?>
</li>
			<li><?php 
    _e("<code>#date#</code>: the post date", 'wp-to-twitter');
    ?>
</li>
			<li><?php 
    _e("<code>#modified#</code>: the post modified date", 'wp-to-twitter');
    ?>
</li>
			<li><?php 
    _e("<code>#url#</code>: the post URL", 'wp-to-twitter');
    ?>
</li>
			<li><?php 
    _e("<code>#author#</code>: the post author", 'wp-to-twitter');
    ?>
</li>
			<li><?php 
    _e("<code>#account#</code>: the twitter @reference for the account (or the author, if author settings are enabled and set.)", 'wp-to-twitter');
    ?>
</li>
			<li><?php 
    _e("<code>#tags#</code>: your tags modified into hashtags. See options in the Advanced Settings section, below.", 'wp-to-twitter');
    ?>
</li>
			</ul>
			<p><?php 
    _e("You can also create custom shortcodes to access WordPress custom fields. Use doubled square brackets surrounding the name of your custom field to add the value of that custom field to your status update. Example: <code>[[custom_field]]</code></p>", 'wp-to-twitter');
    ?>
		</div>
		</div>
	</div>
</div>
</div>
</div>
<?php 
    global $wp_version;
}
コード例 #12
0
ファイル: login.php プロジェクト: hansstam/makerfaire
switch ($sign) {
    case "1":
        $currentloginurl = basename($_SERVER['REQUEST_URI']);
        $loginmessage = 'Sign in to submit an entry. <br />If you haven\'t signed in before, <a href=\'' . $currentloginurl . '&mode=signup\'>Sign Up.</a>';
        break;
    case "2":
        $loginmessage = "Sign in to submit or manage an entry";
        break;
    case "3":
        $loginmessage = "Sign in to manage your entries";
        break;
    default:
        $loginmessage = 'Sign In';
        break;
}
if (strpos(wp_referer_field(), 'edit-entry') > 0) {
    $loginmessage = 'Sign in to submit or manage<br /> your entries.';
}
if ($mode == "reset") {
    $loginmessage = "Change your password";
}
//Wordpress header and Theme header call
get_header();
?>
<style>

</style>

<div class="clear"></div>

<div class="container">
コード例 #13
0
function wtt_connect_oauth($auth = false)
{
    if (!$auth) {
        echo '<div class="ui-sortable meta-box-sortables">';
        echo '<div class="postbox">';
    }
    $class = $auth ? 'wpt-profile' : 'wpt-settings';
    $form = !$auth ? '<form action="" method="post">' : '';
    $nonce = !$auth ? wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false) . '</form>' : '';
    if (!wtt_oauth_test($auth, 'verify')) {
        // show notification to authenticate with OAuth. No longer global; settings only.
        if (!wpt_check_oauth()) {
            $admin_url = is_plugin_active('wp-tweets-pro/wpt-pro-functions.php') ? admin_url('admin.php?page=wp-tweets-pro') : admin_url('options-general.php?page=wp-to-twitter/wp-to-twitter.php');
            $message = sprintf(__("Twitter requires authentication by OAuth. You will need to <a href='%s'>update your settings</a> to complete installation of WP to Twitter.", 'wp-to-twitter'), $admin_url);
            echo "<div class='error'><p>{$message}</p></div>";
        }
        $ack = !$auth ? get_option('app_consumer_key') : get_user_meta($auth, 'app_consumer_key', true);
        $acs = !$auth ? get_option('app_consumer_secret') : get_user_meta($auth, 'app_consumer_secret', true);
        $ot = !$auth ? get_option('oauth_token') : get_user_meta($auth, 'oauth_token', true);
        $ots = !$auth ? get_option('oauth_token_secret') : get_user_meta($auth, 'oauth_token_secret', true);
        $submit = !$auth ? '<p class="submit"><input type="submit" name="submit" class="button-primary" value="' . __('Connect to Twitter', 'wp-to-twitter') . '" /></p>' : '';
        print '
			<h3><span>' . __('Connect to Twitter', 'wp-to-twitter') . '</span></h3>
			<div class="inside ' . $class . '">
			<div class="notes">
			<h4>' . __('WP to Twitter Set-up', 'wp-to-twitter') . '</h4>
			</div>
					<h4>' . __('1. Register this site as an application on ', 'wp-to-twitter') . '<a href="https://apps.twitter.com/app/new/" target="_blank">' . __('Twitter\'s application registration page', 'wp-to-twitter') . '</a></h4>
						<ul>
						<li>' . __('If you\'re not currently logged in to Twitter, log-in to the account you want associated with this site', 'wp-to-twitter') . '</li>
						<li>' . __('Your application name cannot include the word "Twitter."', 'wp-to-twitter') . '</li>
						<li>' . __('Your Application Description can be anything.', 'wp-to-twitter') . '</li>
						<li>' . __('The WebSite and Callback URL should be ', 'wp-to-twitter') . '<strong>' . esc_url(home_url()) . '</strong></li>
						</ul>
					<p><em>' . __('Agree to the Twitter Developer Agreement and continue.', 'wp-to-twitter') . '</em></p>
					<h4>' . __('2. Switch to the "Permissions" tab in Twitter apps', 'wp-to-twitter') . '</h4>
						<ul>
						<li>' . __('Select "Read and Write" for the Application Type', 'wp-to-twitter') . '</li>
						<li>' . __('Update the application settings', 'wp-to-twitter') . '</li>
						</ul>
					<h4>' . __('3. Switch to the Keys and Access Tokens tab and regenerate your consumer key and secret, then create your access token.', 'wp-to-twitter') . '</h4>
						<ul>
						<li>' . __('Copy your API key and API secret from the "Application Settings" section.', 'wp-to-twitter') . '</li>
						<li>' . __('Copy your Access token and Access token secret from the "Your Access Token" section.', 'wp-to-twitter') . '</li>
						</ul>
			' . $form . '
				<fieldset class="options">						
					<div class="tokens">
					<p>
						<label for="wtt_app_consumer_key">' . __('API Key', 'wp-to-twitter') . '</label>
						<input type="text" size="45" name="wtt_app_consumer_key" id="wtt_app_consumer_key" value="' . esc_attr($ack) . '" />
					</p>
					<p>
						<label for="wtt_app_consumer_secret">' . __('API Secret', 'wp-to-twitter') . '</label>
						<input type="text" size="45" name="wtt_app_consumer_secret" id="wtt_app_consumer_secret" value="' . esc_attr($acs) . '" />
					</p>
					</div>
					<h4>' . __('4. Copy and paste your Access Token and Access Token Secret into the fields below', 'wp-to-twitter') . '</h4>
					<p>' . __('If the Access Level for your Access Token is not "<em>Read and write</em>", you must return to step 2 and generate a new Access Token.', 'wp-to-twitter') . '</p>
					<div class="tokens">
					<p>
						<label for="wtt_oauth_token">' . __('Access Token', 'wp-to-twitter') . '</label>
						<input type="text" size="45" name="wtt_oauth_token" id="wtt_oauth_token" value="' . esc_attr($ot) . '" />
					</p>
					<p>
						<label for="wtt_oauth_token_secret">' . __('Access Token Secret', 'wp-to-twitter') . '</label>
						<input type="text" size="45" name="wtt_oauth_token_secret" id="wtt_oauth_token_secret" value="' . esc_attr($ots) . '" />
					</p>
					</div>
				</fieldset>
				' . $submit . '
				<input type="hidden" name="oauth_settings" value="wtt_oauth_test" class="hidden" style="display: none;" />
				' . $nonce . '
			</div>	
				';
    } else {
        if (wtt_oauth_test($auth)) {
            $ack = !$auth ? esc_attr(get_option('app_consumer_key')) : esc_attr(get_user_meta($auth, 'app_consumer_key', true));
            $acs = !$auth ? esc_attr(get_option('app_consumer_secret')) : esc_attr(get_user_meta($auth, 'app_consumer_secret', true));
            $ot = !$auth ? esc_attr(get_option('oauth_token')) : esc_attr(get_user_meta($auth, 'oauth_token', true));
            $ots = !$auth ? esc_attr(get_option('oauth_token_secret')) : esc_attr(get_user_meta($auth, 'oauth_token_secret', true));
            $uname = !$auth ? esc_attr(get_option('wtt_twitter_username')) : esc_attr(get_user_meta($auth, 'wtt_twitter_username', true));
            $nonce = !$auth ? wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false) . '</form>' : '';
            if (!$auth) {
                $submit = '
					<input type="submit" name="submit" class="button-primary" value="' . __('Disconnect your WordPress and Twitter Account', 'wp-to-twitter') . '" />
					<input type="hidden" name="oauth_settings" value="wtt_twitter_disconnect" class="hidden" />
				';
            } else {
                $submit = '<input type="checkbox" name="oauth_settings" value="wtt_twitter_disconnect" id="disconnect" /> <label for="disconnect">' . __('Disconnect your WordPress and Twitter Account', 'wp-to-twitter') . '</label>';
            }
            print '
			<h3><span>' . __('Disconnect from Twitter', 'wp-to-twitter') . '</span></h3>
			<div class="inside ' . $class . '">
			' . $form . '
				<div id="wtt_authentication_display">
					<fieldset class="options">
					<ul>
						<li><strong class="auth_label">' . __('Twitter Username ', 'wp-to-twitter') . '</strong> <code class="auth_code">' . $uname . '</code></li>
						<li><strong class="auth_label">' . __('API Key ', 'wp-to-twitter') . '</strong> <code class="auth_code">' . $ack . '</code></li>
						<li><strong class="auth_label">' . __('API Secret ', 'wp-to-twitter') . '</strong> <code class="auth_code">' . $acs . '</code></li>
						<li><strong class="auth_label">' . __('Access Token ', 'wp-to-twitter') . '</strong> <code class="auth_code">' . $ot . '</code></li>
						<li><strong class="auth_label">' . __('Access Token Secret ', 'wp-to-twitter') . '</strong> <code class="auth_code">' . $ots . '</code></li>
					</ul>
					</fieldset>
					<div>
					' . $submit . '
					</div>
				</div>		
				' . $nonce . '
			</div>';
        }
    }
    if (!$auth) {
        echo "</div>";
        echo "</div>";
    }
}
コード例 #14
0
function Insert_Question_Form($atts)
{
    global $user_message;
    global $wpdb;
    $Custom_CSS = get_option('EWD_UFAQ_Custom_CSS');
    $Allow_Proposed_Answer = get_option("EWD_UFAQ_Allow_Proposed_Answer");
    $ReturnString = "";
    // Get the attributes passed by the shortcode, and store them in new variables for processing
    extract(shortcode_atts(array('success_message' => __('Thank you for submitting an FAQ.', 'EWD_UFAQ'), 'submit_faq_form_title' => __('Submit a Question', 'EWD_UFAQ'), 'submit_faq_instructions' => __('Please fill out the form below to submit a question.', 'EWD_UFAQ'), 'submit_text' => __('Send Question', 'EWD_UFAQ')), $atts));
    if (get_option("EWD_UFAQ_Thank_You_Submit_Label") != "") {
        $success_message = get_option("EWD_UFAQ_Thank_You_Submit_Label");
    }
    if (get_option("EWD_UFAQ_Submit_Question_Label") != "") {
        $submit_faq_form_title = get_option("EWD_UFAQ_Submit_Question_Label");
    }
    if (get_option("EWD_UFAQ_Please_Fill_Form_Below_Label") != "") {
        $submit_faq_instructions = get_option("EWD_UFAQ_Please_Fill_Form_Below_Label");
    }
    if (get_option("EWD_UFAQ_Send_Question_Label") != "") {
        $submit_text = get_option("EWD_UFAQ_Send_Question_Label");
    }
    $Question_Title_Label = get_option("EWD_UFAQ_Question_Title_Label");
    if ($Question_Title_Label == "") {
        $Question_Title_Label = __("Question Title", 'EWD_UFAQ');
    }
    $What_Question_Being_Answered_Label = get_option("EWD_UFAQ_What_Question_Being_Answered_Label");
    if ($What_Question_Being_Answered_Label == "") {
        $What_Question_Being_Answered_Label = __("What question is being answered?", 'EWD_UFAQ');
    }
    $Proposed_Answer_Label = get_option("EWD_UFAQ_Proposed_Answer_Label");
    if ($Proposed_Answer_Label == "") {
        $Proposed_Answer_Label = __("Proposed Answer", 'EWD_UFAQ');
    }
    $Review_Author_Label = get_option("EWD_UFAQ_Review_Author_Label");
    if ($Review_Author_Label == "") {
        $Review_Author_Label = __("Review Author", 'EWD_UFAQ');
    }
    $What_Name_With_Review_Label = get_option("EWD_UFAQ_What_Name_With_Review_Label");
    if ($What_Name_With_Review_Label == "") {
        $What_Name_With_Review_Label = __("What name should be displayed with your review?", 'EWD_UFAQ');
    }
    if (isset($_POST['Submit_Question'])) {
        $user_update = EWD_UFAQ_Submit_Question($success_message);
    }
    $ReturnString .= "<style type='text/css'>";
    $ReturnString .= $Custom_CSS;
    $ReturnString .= "</style>";
    $ReturnString .= EWD_UFAQ_Add_Modified_Styles();
    $ReturnString .= "<div class='ewd-ufaq-question-form'>";
    if (isset($_POST['Submit_Question'])) {
        $ReturnString .= "<div class='ewd-ufaq-question-update'>";
        $ReturnString .= $user_update;
        $ReturnString .= "</div>";
    }
    $ReturnString .= "<form id='question_form' method='post' action='#'>";
    $ReturnString .= wp_nonce_field();
    $ReturnString .= wp_referer_field();
    $ReturnString .= "<div class='form-field'>";
    $ReturnString .= "<div id='ewd-ufaq-review-title' class='ewd-ufaq-review-label'>";
    $ReturnString .= $Question_Title_Label . ": ";
    $ReturnString .= "</div>";
    $ReturnString .= "<div id='ewd-ufaq-review-author-input' class='ewd-ufaq-review-input'>";
    $ReturnString .= "<input type='text' name='Post_Title' id='Post_Title' />";
    $ReturnString .= "</div>";
    $ReturnString .= "<div id='ewd-ufaq-title-explanation' class='ewd-ufaq-review-explanation'>";
    $ReturnString .= "<p>" . $What_Question_Being_Answered_Label . "</p>";
    $ReturnString .= "</div>";
    $ReturnString .= "</div>";
    if ($Allow_Proposed_Answer == "Yes") {
        $ReturnString .= "<div class='ewd-ufaq-meta-field'>";
        $ReturnString .= "<label for='Post_Body'>";
        $ReturnString .= $Proposed_Answer_Label . ": ";
        $ReturnString .= "</label>";
        $ReturnString .= "<textarea name='Post_Body'></textarea>";
        $ReturnString .= "</div>";
    }
    $ReturnString .= "<div class='form-field'>";
    $ReturnString .= "<div id='ewd-urp-review-author' class='ewd-urp-review-label'>";
    $ReturnString .= $Review_Author_Label . ": ";
    $ReturnString .= "</div>";
    $ReturnString .= "<div id='ewd-urp-review-author-input' class='ewd-urp-review-input'>";
    $ReturnString .= "<input type='text' name='Post_Author' id='Post_Author' />";
    $ReturnString .= "</div>";
    $ReturnString .= "<div id='ewd-urp-author-explanation' class='ewd-urp-review-explanation'>";
    $ReturnString .= "<p>" . $What_Name_With_Review_Label . "</p>";
    $ReturnString .= "</div>";
    $ReturnString .= "</div>";
    $ReturnString .= "<p class='submit'><input type='submit' name='Submit_Question' id='submit' class='button-primary' value='" . $submit_text . "'  /></p></form>";
    $ReturnString .= "</div>";
    return $ReturnString;
}
コード例 #15
0
function jd_list_categories()
{
    $selected = "";
    $categories = get_categories('hide_empty=0');
    $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false);
    $input = "<form action=\"\" method=\"post\">\r\n\t<div>{$nonce}</div>\r\n\t<fieldset><legend>" . __('Check off categories to tweet', 'wp-to-twitter') . "</legend>";
    $input .= '
	<p>
	<input type="checkbox" name="jd_twit_cats" id="jd_twit_cats" value="1"' . jd_checkCheckbox('jd_twit_cats') . ' />
	<label for="jd_twit_cats">' . __("Do not tweet posts in checked categories (Reverses default behavior)", 'wp-to-twitter') . '</label>
	</p>';
    $input .= "\r\n\t<ul>\n";
    $tweet_categories = get_option('tweet_categories');
    foreach ($categories as $cat) {
        if (is_array($tweet_categories)) {
            if (in_array($cat->term_id, $tweet_categories)) {
                $selected = " checked=\"checked\"";
            } else {
                $selected = "";
            }
        }
        $input .= '		<li><input' . $selected . ' type="checkbox" name="categories[]" value="' . $cat->term_id . '" id="' . $cat->category_nicename . '" /> <label for="' . $cat->category_nicename . '">' . $cat->name . "</label></li>\n";
    }
    $input .= "\t</ul>\r\n\t</fieldset>\r\n\t<p>" . __('Limits are exclusive. If a post is in one category which should be posted and one category that should not, it will not be posted.', 'wp-to-twitter') . "</p>\r\n\t<div>\r\n\t<input type=\"hidden\" name=\"submit-type\" value=\"setcategories\" />\r\n\t<input type=\"submit\" name=\"submit\" class=\"button-primary\" value=\"" . __('Set Categories', 'wp-to-twitter') . "\" />\r\n\t</div>\r\n\t</form>";
    echo $input;
}
コード例 #16
0
    function inboundrocket_wb_scripts()
    {
        $this->inboundrocket_wb_styles();
        if (INBOUNDROCKET_ENABLE_DEBUG == true) {
            wp_enqueue_script("inboundrocket_wb_script", INBOUNDROCKET_WELCOME_BAR_PATH . '/js/welcome-bar.js', array('jquery'), false);
        } else {
            wp_enqueue_script("inboundrocket_wb_script", INBOUNDROCKET_WELCOME_BAR_PATH . '/js/welcome-bar.min.js', array('jquery'), false);
        }
        wp_localize_script('inboundrocket_wb_script', 'inboundrocket_wb_js', array('ajaxurl' => admin_url('admin-ajax.php'), 'nextNonce' => wp_create_nonce('wb_form_lead_submitted')));
        $this->wb_options = get_option('inboundrocket_wb_options');
        $ir_wb_cta_desktop = isset($this->wb_options['ir_wb_cta_desktop']) ? esc_attr($this->wb_options['ir_wb_cta_desktop']) : '';
        $ir_wb_cta_mobile = isset($this->wb_options['ir_wb_cta_mobile']) ? esc_attr($this->wb_options['ir_wb_cta_mobile']) : '';
        $ir_wb_email_placeholder = isset($this->wb_options['ir_wb_email_placeholder']) ? esc_attr($this->wb_options['ir_wb_email_placeholder']) : '';
        $ir_wb_button_text = isset($this->wb_options['ir_wb_button_text']) ? esc_attr($this->wb_options['ir_wb_button_text']) : '';
        $ir_wb_success_text = isset($this->wb_options['ir_wb_success_text']) ? esc_attr($this->wb_options['ir_wb_success_text']) : '';
        $ir_wb_interval = isset($this->wb_options['ir_wb_interval']) ? esc_attr($this->wb_options['ir_wb_interval']) : '';
        $ir_wb_show_every = isset($this->wb_options['ir_wb_show_every']) ? esc_attr($this->wb_options['ir_wb_show_every']) : '';
        $ir_wb_color = isset($this->wb_options['ir_wb_color']) ? esc_attr($this->wb_options['ir_wb_color']) : '';
        if ($ir_wb_color == 'red') {
            $text_style = '#ffffff';
            $button_style = '#000000';
            $bar_style = '#eb593c';
        } elseif ($ir_wb_color == 'green') {
            $text_style = '#ffffff';
            $button_style = '#000000';
            $bar_style = '#569625';
        } elseif ($ir_wb_color == 'lightblue') {
            $text_style = '#000000';
            $button_style = '#ffffff';
            $bar_style = '#def1ff';
        } elseif ($ir_wb_color == 'salmon') {
            $text_style = '#000000';
            $button_style = '#ffffff';
            $bar_style = '#f0e1d1';
        } elseif ($ir_wb_color == 'lightgrey') {
            $text_style = '#000000';
            $button_style = '#ffffff';
            $bar_style = '#ededed';
        }
        ?>
	
	
	<!-- START NORMAL welcome_bar -->
	<div class="noMobile showDesktop">
		<div class="welcome_bar" style="display: none; background-color: <?php 
        echo !empty($bar_style) ? $bar_style : '#eee';
        ?>
; color: <?php 
        echo !empty($text_style) ? $text_style : '#000000';
        ?>
;">
			<?php 
        if (!inboundrocket_check_premium_user()) {
            echo '<a href="http://inboundrocket.co/?utm_source=' . $_SERVER['HTTP_HOST'] . '&utm_medium=welcome-bar&utm_campaign=logo" title="' . __('Powered by Inbound Rocket - You write. We will turn them into leads', 'inboundrocket') . '" target="_blank" class="inboundrocket-wb-branding" style="background-color:';
            echo !empty($bar_style) ? $bar_style : '#eee';
            echo '" ><img src="' . INBOUNDROCKET_WELCOME_BAR_PATH . '/img/welcome-bar-logo.png" alt="" /></a>';
        }
        ?>
			<span id="welcome-span" data-success="<?php 
        echo !empty($ir_wb_success_text) ? $ir_wb_success_text : __('Thank you for signing up!', 'inboundrocket');
        ?>
" style=""><?php 
        echo !empty($ir_wb_cta_desktop) ? $ir_wb_cta_desktop : __('Join Our Mailing List', 'inboundrocket');
        ?>
					<form id="welcome_bar-form" method="post" action=""><?php 
        wp_nonce_field('welcome_bar_form_lead_submitted', 'welcome_bar_form_nonce');
        ?>
					<?php 
        wp_nonce_field('wb_form_lead_submitted', 'wb_form_nonce');
        ?>
					<input type="hidden" name="origin" id="origin" value="desktop">
					<input type="hidden" name="current_page" id="current_page" value="<?php 
        echo $this->inboundrocket_wb_getURL();
        ?>
">
					<?php 
        wp_referer_field(true);
        ?>
					<!--<input type="text" name="name" id="name" placeholder="Firstname and Lastname"> -->
	                <input type="email" name="emailaddress" id="emailaddress" placeholder="<?php 
        echo !empty($ir_wb_email_placeholder) ? $ir_wb_email_placeholder : __('Email Address', 'inboundrocket');
        ?>
">
	                <button type="submit" class="welcome_bar-link"><?php 
        echo !empty($ir_wb_button_text) ? $ir_wb_button_text : __('Submit', 'inboundrocket');
        ?>
</button>
            	</form>
            </span>
			<a class="close-notify" style="background-color: <?php 
        echo !empty($bar_style) ? $bar_style : '#eee';
        ?>
;" ><img src="<?php 
        echo INBOUNDROCKET_WELCOME_BAR_PATH;
        ?>
/img/welcome-bar-up-arrow.png" /></a>
			
		</div>
		<div class="welcome_bar-stub" style="display: none;"><a class="show-notify" onclick="welcome_bar_show();" style="background-color: <?php 
        echo !empty($bar_style) ? $bar_style : '#eee';
        ?>
;"><img src="<?php 
        echo INBOUNDROCKET_WELCOME_BAR_PATH;
        ?>
/img/welcome-bar-down-arrow.png" /></a></div>
	</div>
	<!-- END NORMAL welcome_bar -->

	<!-- START MOBILE welcome_bar if only email heigh 6.8em name and email 9em-->
	<div class="showMobile noDesktop">
		<div class="mwelcome_bar" data-success="<?php 
        echo !empty($ir_wb_success_text) ? $ir_wb_success_text : __('Thank you for signing up!', 'inboundrocket');
        ?>
" style="display: none; background-color: <?php 
        echo !empty($bar_style) ? $bar_style : '#eee';
        ?>
; color: <?php 
        echo !empty($text_style) ? $text_style : '#000000';
        ?>
;">	
			<span id="welcome-span" style="height: 6.8em;">
			<?php 
        echo !empty($ir_wb_cta_desktop) ? $ir_wb_cta_desktop : __('Join Our Mailing List', 'inboundrocket');
        ?>
<a class="mclose-notify" onclick="mwelcome_bar_hide();" style="background-color: <?php 
        echo !empty($bar_style) ? $bar_style : '#eee';
        ?>
;">X</a>
			<?php 
        if (!inboundrocket_check_premium_user()) {
            echo '<a href="http://inboundrocket.co/?utm_source=' . $_SERVER['HTTP_HOST'] . '&utm_medium=welcome-bar-mobile&utm_campaign=logo" title="' . __('Powered by Inbound Rocket - You write. We\'ll turn them into leads', 'inboundrocket') . '" target="_blank" class="inboundrocket-wb-mbranding" style="background-color:';
            echo !empty($bar_style) ? $bar_style : '#eee';
            echo '" ><img src="' . INBOUNDROCKET_WELCOME_BAR_PATH . '/img/welcome-bar-logo.png" alt="" /></a>';
        }
        ?>
 
			<form id="mwelcome_bar-form" method="post" action=""><?php 
        wp_nonce_field('welcome_bar_form_lead_submitted', 'welcome_bar_form_nonce');
        ?>
				<input type="hidden" name="origin" id="origin" value="mobile">
				<input type="hidden" name="current_page" id="current_page" value="<?php 
        echo $this->inboundrocket_wb_getURL();
        ?>
">
				<?php 
        wp_referer_field(true);
        ?>
				<!-- <div class="minput"><input type="text" name="name" id="name" placeholder="Firstname and Lastname"></div> -->
                <div class="minput"><input type="email" name="emailaddress" id="emailaddress" placeholder="<?php 
        echo !empty($ir_wb_email_placeholder) ? $ir_wb_email_placeholder : __('Email Address', 'inboundrocket');
        ?>
"></div>
                <div class="minput"><button type="submit" class="mwelcome_bar-link"><?php 
        echo !empty($ir_wb_button_text) ? $ir_wb_button_text : __('Submit', 'inboundrocket');
        ?>
</button></div>
            </form></span>
		</div>
		<div class="mwelcome_bar-stub" style="display: none;"><a class="mshow-notify" onclick="mwelcome_bar_show();" style="background-color: <?php 
        echo !empty($bar_style) ? $bar_style : '#eee';
        ?>
;"><img src="<?php 
        echo INBOUNDROCKET_WELCOME_BAR_PATH;
        ?>
/img/welcome-bar-down-arrow.png" /></a></div>
	</div>
	<!-- END MOBILE welcome_bar -->
		<?php 
    }
コード例 #17
0
function wppa_nonce_field($action = -1, $name = "_wpnonce", $referer = true, $echo = true, $wppa_id = '0')
{
    $name = esc_attr($name);
    $nonce_field = '<input' . ' type="hidden"' . ' id="' . $name . '-' . $wppa_id . '-' . wppa('mocc') . '"' . ' name="' . $name . '"' . ' value="' . wp_create_nonce($action) . '"' . ' />';
    if ($referer) {
        $nonce_field .= wp_referer_field(false);
    }
    if ($echo) {
        echo $nonce_field;
    }
    return $nonce_field;
}
コード例 #18
0
ファイル: class.form.php プロジェクト: realfluid/umbaugh
 /**
  * Retrieves or displays the nonce field for forms using wp_nonce_field.
  * 
  * @param string $action Action name.
  * @param string $item [optional] Item name. Use when protecting multiple items on the same page.
  * @param string $name [optional] Nonce name.
  * @param bool $referer [optional] Whether to set and display the refer field for validation.
  * @param bool $echo [optional] Whether to display or return the hidden form field.
  * 
  * @return string
  */
 public function tokenField($action, $item = FALSE, $name = '_cn_wpnonce', $referer = TRUE, $echo = TRUE)
 {
     $name = esc_attr($name);
     if ($item == FALSE) {
         $token = wp_nonce_field($this->nonceBase . '_' . $action, $name, TRUE, FALSE);
     } else {
         $token = wp_nonce_field($this->nonceBase . '_' . $action . '_' . $item, $name, TRUE, FALSE);
     }
     if ($echo) {
         echo $token;
     }
     if ($referer) {
         wp_referer_field($echo, 'previous');
     }
     return $token;
 }
コード例 #19
0
 function resetSettings()
 {
     if (!isset($_REQUEST['setting-nonce'])) {
         //nothing being submitted
         return;
     }
     if ($_REQUEST['purpose'] != "reset") {
         //not resetting
         return;
     }
     $referrer = wp_referer_field(false);
     $messageNonce = rand(1000, 9999);
     $redirect = add_query_arg("message_nonce", $messageNonce);
     $redirect = add_query_arg("action_done", "reset", $redirect);
     if (is_network_admin() and !current_user_can("manage_network_options")) {
         //Queue access denied message
     } else {
         if (is_admin() and !current_user_can("manage_options")) {
             //Queue access denied message
         } else {
             //user is authorized to do something
             if (is_network_admin()) {
                 //do network reset
             } elseif (is_admin()) {
                 $resetScope = $_REQUEST['reset-scope'];
                 switch ($resetScope) {
                     case "total":
                         //delete everything and run the plugin activated hook
                         delete_option($this->_slug("settings"));
                         delete_option($this->_slug("config"));
                         delete_option($this->_slug("messages"));
                         delete_option($this->_slug("skins"));
                 }
             }
         }
     }
     wp_redirect($redirect);
     exit;
 }
コード例 #20
0
function wp_nonce_field($action = -1, $name = "_wpnonce", $referer = true) {
	$name = attribute_escape($name);
	echo '<input type="hidden" name="' . $name . '" value="' . wp_create_nonce($action) . '" />';
	if ( $referer )
		wp_referer_field();
}
コード例 #21
0
 /**
  * 
  * A important function that sets various necessary parameters within hidden input elements that the ajax script needs to save the current page
  * @return string $output the string returned contains the html code generated within the method
  */
 function hidden_data()
 {
     $options = get_option($this->avia_superobject->option_prefix);
     $output = '	<div id="avia_hidden_data" class="avia_hidden">';
     $nonce_reset = wp_create_nonce('avia_nonce_reset_backend');
     $output .= wp_referer_field(false);
     $output .= '		<input type="hidden" name="avia-nonce-reset" value="' . $nonce_reset . '" />';
     $output .= '		<input type="hidden" name="resetaction" value="avia_ajax_reset_options_page" />';
     $output .= '		<input type="hidden" name="admin_ajax_url" value="' . admin_url("admin-ajax.php") . '" />';
     $output .= '		<input type="hidden" name="avia_options_prefix" value="' . $this->avia_superobject->option_prefix . '" />';
     //if we are viewing a page and not a meta box
     if ($this->context == 'options_page') {
         $nonce = wp_create_nonce('avia_nonce_save_backend');
         $output .= '		<input type="hidden" name="avia-nonce" value="' . $nonce . '" />';
         $output .= '		<input type="hidden" name="action" value="avia_ajax_save_options_page" />';
         $output .= '		<input type="hidden" name="avia_options_page_slug" value="' . $this->avia_superobject->page_slug . '" />';
         if (empty($options)) {
             $output .= ' <input type="hidden" name="avia_options_first_call" value="true" />';
         }
     }
     //if the code was rendered for a meta box
     if ($this->context == 'metabox') {
         $nonce = wp_create_nonce('avia_nonce_save_metabox');
         $output .= '		<input type="hidden" name="avia-nonce" value="' . $nonce . '" />';
         $output .= '		<input type="hidden" name="meta_active" value="true" />';
     }
     $output .= '	</div>';
     return $output;
 }
コード例 #22
0
 /**
  * Render members screen
  *
  * @since  0.6
  * @param  WP_Post  $post
  * @return void
  */
 public function render_screen_members($post)
 {
     if (get_post_type($post) == RUA_App::TYPE_RESTRICT) {
         if (!$this->list_members) {
             $this->list_members = new RUA_Members_List();
         }
         $this->list_members->prepare_items();
         echo "</div>";
         //post body
         echo '<br class="clear">';
         echo "</div>";
         //post stuff
         echo "</form>";
         echo "<form method='post' action='post.php'>" . "\n";
         echo '<input type="hidden" name="post_type" value="' . get_post_type() . '" />' . "\n";
         echo '<input type="hidden" name="post_ID" class="js-rua-post-id" value="' . get_the_ID() . '" />' . "\n";
         wp_referer_field();
         echo "<div>";
         echo '<div id="rua-members" style="display:none;">';
         echo '<input type="hidden" name="users" class="js-rua-user-suggest" value="" /> ';
         echo '<input type="submit" name="add_users" class="button button-primary" value="' . __("Add Members", RUA_App::DOMAIN) . '" />';
         $this->list_members->display();
     }
 }
コード例 #23
0
ファイル: livejournal.php プロジェクト: beaucollins/wp
 function next_step($next_step, $label, $id = 'ljapi-next-form')
 {
     $str = '<form action="admin.php?import=livejournal" method="post" id="' . $id . '">';
     $str .= wp_nonce_field('lj-api-import', '_wpnonce', true, false);
     $str .= wp_referer_field(false);
     $str .= '<input type="hidden" name="step" id="step" value="' . esc_attr($next_step) . '" />';
     $str .= '<p><input type="submit" class="button" value="' . esc_attr($label) . '" /> <span id="auto-message"></span></p>';
     $str .= '</form>';
     return $str;
 }
コード例 #24
0
    function wpt_shortener_controls()
    {
        // for the moment, this just displays the fields. Eventually, a real filter.
        ?>
<div class="ui-sortable meta-box-sortables">
<div class="postbox">
	<div class="handlediv"><span class="screen-reader-text">Click to toggle</span></div>
	<h3 class='hndle'><span><?php 
        _e('<abbr title="Uniform Resource Locator">URL</abbr> Shortener Account Settings', 'wp-to-twitter');
        ?>
</span></h3>
	<div class="inside">
		<?php 
        if (get_option('jd_shortener') == 7) {
            ?>
		<div class="panel">
		<h4 class="supr"><span><?php 
            _e("Your Su.pr account details", 'wp-to-twitter');
            ?>
 <?php 
            _e('(optional)', 'wp-to-twitter');
            ?>
</span></h4>
			<form method="post" action="">
			<div><input type='hidden' name='wpt_shortener_update' value='true' /></div>
			<div>
				<p>
				<label for="suprlogin"><?php 
            _e("Your Su.pr Username:"******"text" name="suprlogin" id="suprlogin" size="40" value="<?php 
            echo esc_attr(get_option('suprlogin'));
            ?>
" />
				</p>
				<p>
				<label for="suprapi"><?php 
            _e("Your Su.pr <abbr title='application programming interface'>API</abbr> Key:", 'wp-to-twitter');
            ?>
</label>
				<input type="text" name="suprapi" id="suprapi" size="40" value="<?php 
            echo esc_attr(get_option('suprapi'));
            ?>
" />
				</p>
				<div>
				<input type="hidden" name="submit-type" value="suprapi" />
				</div>
				<?php 
            $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false);
            echo "<div>{$nonce}</div>";
            ?>
	
				<p><input type="submit" name="submit" value="Save Su.pr API Key" class="button-primary" /> <input type="submit" name="clear" value="Clear Su.pr API Key" />&raquo; <small><?php 
            _e("Don't have a Su.pr account or API key? <a href='http://su.pr/'>Get one here</a>!<br />You'll need an API key in order to associate the URLs you create with your Su.pr account.", 'wp-to-twitter');
            ?>
</small></p>
			</div>
			</form>
		</div>
	<?php 
        } else {
            if (get_option('jd_shortener') == 2) {
                ?>
	<div class="panel">
	<h4 class="bitly"><span><?php 
                _e("Your Bit.ly account details", 'wp-to-twitter');
                ?>
</span></h4>
		<form method="post" action="">
		<div><input type='hidden' name='wpt_shortener_update' value='true' /></div>
		<div>
			<p>
			<label for="bitlylogin"><?php 
                _e("Your Bit.ly username:"******"text" name="bitlylogin" id="bitlylogin" value="<?php 
                echo esc_attr(get_option('bitlylogin'));
                ?>
" />
			</p>	
			<p>
			<label for="bitlyapi"><?php 
                _e("Your Bit.ly <abbr title='application programming interface'>API</abbr> Key:", 'wp-to-twitter');
                ?>
</label>
			<input type="text" name="bitlyapi" id="bitlyapi" size="40" value="<?php 
                echo esc_attr(get_option('bitlyapi'));
                ?>
" />
			</p>
			<p><a href="http://bitly.com/a/your_api_key"><?php 
                _e('View your Bit.ly username and API key', 'wp-to-twitter');
                ?>
</a></p>
			<div>
			<input type="hidden" name="submit-type" value="bitlyapi" />
			</div>
		<?php 
                $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false);
                echo "<div>{$nonce}</div>";
                ?>
	
			<p><input type="submit" name="submit" value="<?php 
                _e('Save Bit.ly API Key', 'wp-to-twitter');
                ?>
" class="button-primary" /> <input type="submit" name="clear" value="<?php 
                _e('Clear Bit.ly API Key', 'wp-to-twitter');
                ?>
" /><br /><small><?php 
                _e("A Bit.ly API key and username is required to shorten URLs via the Bit.ly API and WP to Twitter.", 'wp-to-twitter');
                ?>
</small></p>
		</div>
		</form>	
	</div>
	<?php 
            } else {
                if (get_option('jd_shortener') == 5 || get_option('jd_shortener') == 6) {
                    ?>
	<div class="panel">
	<h4 class="yourls"><span><?php 
                    _e("Your YOURLS account details", 'wp-to-twitter');
                    ?>
</span></h4>
		<form method="post" action="">
		<div><input type='hidden' name='wpt_shortener_update' value='true' /></div>
		<div>
			<p>
			<label for="yourlspath"><?php 
                    _e('Path to your YOURLS config file (Local installations)', 'wp-to-twitter');
                    ?>
</label> <input type="text" id="yourlspath" name="yourlspath" size="60" value="<?php 
                    echo esc_attr(get_option('yourlspath'));
                    ?>
"/>
			<small><?php 
                    _e('Example:', 'wp-to-twitter');
                    ?>
 <code>/home/username/www/www/yourls/includes/config.php</code></small>
			</p>				
			<p>
			<label for="yourlsurl"><?php 
                    _e('URI to the YOURLS API (Remote installations)', 'wp-to-twitter');
                    ?>
</label> <input type="text" id="yourlsurl" name="yourlsurl" size="60" value="<?php 
                    echo esc_attr(get_option('yourlsurl'));
                    ?>
"/>
			<small><?php 
                    _e('Example:', 'wp-to-twitter');
                    ?>
 <code>http://domain.com/yourls-api.php</code></small>
			</p>
			<p>
			<label for="yourlslogin"><?php 
                    _e("Your YOURLS username:"******"text" name="yourlslogin" id="yourlslogin" size="30" value="<?php 
                    echo esc_attr(get_option('yourlslogin'));
                    ?>
" />
			</p>	
			<p>
			<label for="yourlsapi"><?php 
                    _e("Your YOURLS password:"******"<em>Saved</em>", 'wp-to-twitter');
                    }
                    ?>
</label>
			<input type="password" name="yourlsapi" id="yourlsapi" size="30" value="" />
			</p>
			<p>
			<input type="radio" name="jd_keyword_format" id="jd_keyword_id" value="1" <?php 
                    echo jd_checkSelect('jd_keyword_format', 1, 'checkbox');
                    ?>
 /> 		<label for="jd_keyword_id"><?php 
                    _e("Post ID for YOURLS url slug.", 'wp-to-twitter');
                    ?>
</label><br />
			<input type="radio" name="jd_keyword_format" id="jd_keyword" value="2" <?php 
                    echo jd_checkSelect('jd_keyword_format', 2, 'checkbox');
                    ?>
 /> 		<label for="jd_keyword"><?php 
                    _e("Custom keyword for YOURLS url slug.", 'wp-to-twitter');
                    ?>
</label><br />
			<input type="radio" name="jd_keyword_format" id="jd_keyword_default" value="0" <?php 
                    echo jd_checkSelect('jd_keyword_format', 0, 'checkbox');
                    ?>
 /> <label for="jd_keyword_default"><?php 
                    _e("Default: sequential URL numbering.", 'wp-to-twitter');
                    ?>
</label>
			</p>
			<div>
			<input type="hidden" name="submit-type" value="yourlsapi" />
			</div>
		<?php 
                    $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false);
                    echo "<div>{$nonce}</div>";
                    ?>
	
			<p><input type="submit" name="submit" value="<?php 
                    _e('Save YOURLS Account Info', 'wp-to-twitter');
                    ?>
" class="button-primary" /> <input type="submit" name="clear" value="<?php 
                    _e('Clear YOURLS password', 'wp-to-twitter');
                    ?>
" /><br /><small><?php 
                    _e("A YOURLS password and username is required to shorten URLs via the remote YOURLS API and WP to Twitter.", 'wp-to-twitter');
                    ?>
</small></p>
		</div>
		</form>		
		</div>		
    <?php 
                } else {
                    if (get_option('jd_shortener') == 10) {
                        ?>
	<div class="panel">
		<h4 class="joturl"><span><?php 
                        _e("Your jotURL account details", 'wp-to-twitter');
                        ?>
</span></h4>
		<form method="post" action="">
		<div><input type='hidden' name='wpt_shortener_update' value='true' /></div>
		<div>
		<p><label for="joturllogin"><?php 
                        _e("Your jotURL public <abbr title='application programming interface'>API</abbr> key:", 'wp-to-twitter');
                        ?>
</label> <input type="text" name="joturllogin" id="joturllogin" value="<?php 
                        echo esc_attr(get_option('joturllogin'));
                        ?>
" /></p>
		<p><label for="joturlapi"><?php 
                        _e("Your jotURL private <abbr title='application programming interface'>API</abbr> key:", 'wp-to-twitter');
                        ?>
</label> <input type="text" name="joturlapi" id="joturlapi" size="40" value="<?php 
                        echo esc_attr(get_option('joturlapi'));
                        ?>
" /></p>
		<p><label for="joturl_longurl_params"><?php 
                        _e("Parameters to add to the long URL (before shortening):", 'wp-to-twitter');
                        ?>
</label> <input type="text" name="joturl_longurl_params" id="joturl_longurl_params" size="40" value="<?php 
                        echo esc_attr(get_option('joturl_longurl_params'));
                        ?>
" /></p>		<p><label for="joturl_shorturl_params"><?php 
                        _e("Parameters to add to the short URL (after shortening):", 'wp-to-twitter');
                        ?>
</label> <input type="text" name="joturl_shorturl_params" id="joturl_shorturl_params" size="40" value="<?php 
                        echo esc_attr(get_option('joturl_shorturl_params'));
                        ?>
" /></p>
		<p><a href="https://www.joturl.com/reserved/api.html"><?php 
                        _e('View your jotURL public and private API key', 'wp-to-twitter');
                        ?>
</a></p>
		<div><input type="hidden" name="submit-type" value="joturlapi" /></div>
		<?php 
                        $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false);
                        echo "<div>{$nonce}</div>";
                        ?>
	
		<p><input type="submit" name="submit" value="<?php 
                        _e('Save jotURL settings', 'wp-to-twitter');
                        ?>
" class="button-primary" /> <input type="submit" name="clear" value="<?php 
                        _e('Clear jotURL settings', 'wp-to-twitter');
                        ?>
" /> <br />
		<small><?php 
                        _e("A jotURL public and private API key is required to shorten URLs via the jotURL API and WP to Twitter.", 'wp-to-twitter');
                        ?>
</small></p>
		</div>
		</form>
	</div>
	<?php 
                    } else {
                        ?>
	<?php 
                        _e('Your shortener does not require any account settings.', 'wp-to-twitter');
                        ?>
	<?php 
                    }
                }
            }
        }
        ?>
		</div>
</div>
</div>
	<?php 
    }
コード例 #25
0
 /**
  * Renders the Settings/Media Library Assistant "Language" tab
  *
  * @since 2.11
  *
  * @return	array	( 'message' => '', 'body' => '' )
  */
 public static function mla_render_language_tab()
 {
     $page_content = array('message' => '', 'body' => '<h2>' . __('Language', 'media-library-assistant') . '</h2>');
     /*
      * Check for submit buttons to change or reset settings.
      * Initialize page messages and content.
      */
     if (!empty($_REQUEST['mla-language-options-save'])) {
         check_admin_referer(MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME);
         $page_content = self::_save_language_settings();
     } elseif (!empty($_REQUEST['mla-language-options-reset'])) {
         check_admin_referer(MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME);
         $page_content = self::_reset_language_settings();
     } else {
         $page_content = array('message' => '', 'body' => '');
     }
     if (!empty($page_content['body'])) {
         return $page_content;
     }
     /*
      * Find WPML Media plugin status
      */
     $installed = false;
     $active = false;
     $wpml_media = SitePress::get_installed_plugins();
     if (isset($wpml_media['WPML Media'])) {
         $wpml_media = $wpml_media['WPML Media'];
         if (!empty($wpml_media['plugin'])) {
             $installed = true;
             $active = isset($wpml_media['file']) && is_plugin_active($wpml_media['file']);
         }
     }
     $wpml_media = '';
     if (!$installed) {
         $wpml_media = '<p><strong>' . __('WARNING:', 'media-library-assistant') . __(' WPML Media is not installed.', 'media-library-assistant') . '</strong></p>';
     } elseif (!$active) {
         $wpml_media = '<p><strong>' . __('WARNING:', 'media-library-assistant') . __(' WPML Media is not active.', 'media-library-assistant') . '</strong></p>';
     }
     $page_values = array('Language Options' => __('Language Options', 'media-library-assistant'), 'In this tab' => sprintf(__('In this tab you can find a number of options for controlling WPML-specific operations. Scroll down to find options for %1$s and %2$s. Be sure to click "Save Changes" at the bottom of the tab to save any changes you make.', 'media-library-assistant'), '<strong>' . __('Media/Assistant submenu table', 'media-library-assistant') . '</strong>', '<strong>' . __('Term Management', 'media-library-assistant') . '</strong>'), 'You can find' => sprintf(__('You can find more information about multilingual features in the %1$s section of the Documentation.', 'media-library-assistant'), '<a href="[+settingsURL+]?page=mla-settings-menu-documentation&amp;mla_tab=documentation#mla_language_tab" title="' . __('Language Options documentation', 'media-library-assistant') . '">' . __('WPML &amp; Polylang Multilingual Support; the MLA Language Tab', 'media-library-assistant') . '</a>'), 'WPML Status' => $wpml_media, 'settingsURL' => admin_url('options-general.php'), 'Save Changes' => __('Save Changes', 'media-library-assistant'), 'Delete Language options' => __('Delete Language options and restore default settings', 'media-library-assistant'), '_wpnonce' => wp_nonce_field(MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME, true, false), '_wp_http_referer' => wp_referer_field(false), 'Go to Top' => __('Go to Top', 'media-library-assistant'), 'form_url' => admin_url('options-general.php') . '?page=mla-settings-menu-language&mla_tab=language', 'options_list' => '');
     $options_list = '';
     foreach (MLA_WPML::$mla_language_option_definitions as $key => $value) {
         if ('language' == $value['tab']) {
             $options_list .= MLASettings::mla_compose_option_row($key, $value, MLA_WPML::$mla_language_option_definitions);
         }
     }
     $page_values['options_list'] = $options_list;
     $page_template = MLACore::mla_load_template('admin-display-language-tab.tpl');
     $page_content['body'] = MLAData::mla_parse_template($page_template, $page_values);
     return $page_content;
 }
コード例 #26
0
ファイル: wp-nonce.php プロジェクト: kamalyon/wp-nonce
 /**
  * Retrieves or displays the referer hidden form field.
  * 
  * @param string $echo Whether to display or return the referer hidden form field. Default: true
  */
 public function refererField($echo = true)
 {
     return wp_referer_field($echo);
 }
コード例 #27
0
ファイル: functions.php プロジェクト: hpilevar/WordPress
/**
 * Retrieve or display nonce hidden field for forms.
 *
 * The nonce field is used to validate that the contents of the form came from
 * the location on the current site and not somewhere else. The nonce does not
 * offer absolute protection, but should protect against most cases. It is very
 * important to use nonce field in forms.
 *
 * The $action and $name are optional, but if you want to have better security,
 * it is strongly suggested to set those two parameters. It is easier to just
 * call the function without any parameters, because validation of the nonce
 * doesn't require any parameters, but since crackers know what the default is
 * it won't be difficult for them to find a way around your nonce and cause
 * damage.
 *
 * The input name will be whatever $name value you gave. The input value will be
 * the nonce creation value.
 *
 * @since 2.0.4
 *
 * @param int|string $action  Optional. Action name. Default -1.
 * @param string     $name    Optional. Nonce name. Default '_wpnonce'.
 * @param bool       $referer Optional. Whether to set the referer field for validation. Default true.
 * @param bool       $echo    Optional. Whether to display or return hidden form field. Default true.
 * @return string Nonce field HTML markup.
 */
function wp_nonce_field($action = -1, $name = "_wpnonce", $referer = true, $echo = true)
{
    $name = esc_attr($name);
    $nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce($action) . '" />';
    if ($referer) {
        $nonce_field .= wp_referer_field(false);
    }
    if ($echo) {
        echo $nonce_field;
    }
    return $nonce_field;
}
コード例 #28
0
function wpt_update_settings()
{
    ?>
	<div class="wrap" id="wp-to-twitter">
	<?php 
    if (defined('WPT_STAGING_MODE') && WPT_STAGING_MODE == true) {
        echo "<div class='updated notice'><p>" . __('WP to Twitter is in staging mode. Tweets will be reported as if successfully sent to Twitter but will not be sent.', 'wp-to-twitter') . "</p></div>";
    }
    wpt_updated_settings();
    wpt_show_last_tweet();
    wpt_handle_errors();
    wpt_show_debug();
    ?>
	<?php 
    $elem = version_compare('4.3', get_option('version'), '>=') ? 'h1' : 'h2';
    ?>
	<<?php 
    echo $elem;
    ?>
><?php 
    _e("WP to Twitter Options", 'wp-to-twitter');
    ?>
</<?php 
    echo $elem;
    ?>
>
	
	<div class='nav-tab-wrapper'>
		<?php 
    wpt_settings_tabs();
    ?>
	</div>
	<div id="wpt_settings_page" class="postbox-container jcd-wide">
	<div class="metabox-holder">

	<?php 
    $default = get_option('wtt_twitter_username') == '' ? 'connection' : 'basic';
    $current = isset($_GET['tab']) ? $_GET['tab'] : $default;
    if ($current == 'connection') {
        if (function_exists('wtt_connect_oauth')) {
            wtt_connect_oauth();
        }
    }
    if ($current == 'pro') {
        if (function_exists('wpt_pro_functions')) {
            wpt_pro_functions();
            if (function_exists('wpt_notes')) {
                wpt_notes();
            }
        } else {
            if (!function_exists('wpt_pro_exists')) {
                ?>
				<div class="ui-sortable meta-box-sortables">
					<div class="postbox">
						<h3 class='wpt-upgrade'><span><strong><?php 
                _e('Upgrade Now!', 'wp-to-twitter');
                ?>
</strong></span>
						</h3>

						<div class="inside purchase">
							<p>
								<?php 
                _e('<strong>What can WP Tweets PRO do for you?</strong> It takes the great Tweeting abilities from WP to Twitter and puts them in high gear: publish to unique Twitter accounts for every site author; schedule up to 3 re-posts of Tweets at an interval of your choice; and, with a delay between publishing and Tweeting, verify your tweets before you share them with your followers.', 'wp-to-twitter');
                ?>
							</p>
							<p class='wpt-button'>
								<strong class='cta'><a href="https://www.joedolson.com/wp-tweets-pro/"><?php 
                _e('Upgrade to <strong>WP Tweets PRO</strong>!', 'wp-to-twitter');
                ?>
</a></strong>
							</p>	
							
							<h4><?php 
                _e('What does WP Tweets PRO do?', 'wp-to-twitter');
                ?>
</h4>
							
							<p>
								<?php 
                _e('WP Tweets PRO is packed with features to help you increase engagement with your Twitter followers. Upload images, support for Twitter Cards, and automated re-posting of your Tweets are just a few of the features available in the premium add-on to WP to Twitter.', 'wp-to-twitter');
                ?>
							</p>
							
							<h4><?php 
                _e('Guy Kawasaki recommends WP to Twitter', 'wp-to-twitter');
                ?>
</h4>
							
							<blockquote class="twitter-tweet" lang="en"><p>WP to Twitter = best Wordpress plugin according to <a href="https://twitter.com/GuyKawasaki">@GuyKawasaki</a> <a href="https://twitter.com/hashtag/SMMW15?src=hash">#SMMW15</a></p>&mdash; Cision (@Cision) <a href="https://twitter.com/Cision/status/581170603224371200">March 26, 2015</a></blockquote>
							<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
							
							<p class='wpt-button'>
								<strong class='cta'><a href="https://www.joedolson.com/wp-tweets-pro/"><?php 
                _e('Buy WP Tweets PRO today!', 'wp-to-twitter');
                ?>
</a></strong>
							</p>
							
						</div>
					</div>
				</div>
			<?php 
            }
        }
    }
    if ($current == 'basic') {
        ?>
	<div class="ui-sortable meta-box-sortables">
		<div class="postbox">
			<h3><span><?php 
        _e('Status Update Templates', 'wp-to-twitter');
        ?>
</span></h3>

			<div class="inside wpt-settings">
				<form method="post" action="">
					<?php 
        $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false);
        echo "<div>{$nonce}</div>";
        ?>
					<div>
						<?php 
        echo apply_filters('wpt_pick_shortener', '');
        ?>
						<?php 
        $post_types = get_post_types(array('public' => true), 'objects');
        $wpt_settings = get_option('wpt_post_types');
        $tabs = "<ul class='tabs' role='tablist'>";
        foreach ($post_types as $type) {
            $name = $type->labels->name;
            $slug = $type->name;
            if ($slug == 'attachment' || $slug == 'nav_menu_item' || $slug == 'revision') {
            } else {
                $tabs .= "<li><a href='#wpt_{$slug}' role='tab' id='tab_wpt_{$slug}' aria-controls='wpt_{$slug}'>{$name}</a></li>";
            }
        }
        $tabs .= "<li><a href='#wpt_links' id='tab_wpt_links' aria-controls='wpt_links'>" . __('Links', 'wp-to-twitter') . "</a></li>\r\n\t\t\t</ul>";
        echo $tabs;
        foreach ($post_types as $type) {
            $name = $type->labels->name;
            $singular = $type->labels->singular_name;
            $slug = $type->name;
            if ($slug == 'attachment' || $slug == 'nav_menu_item' || $slug == 'revision') {
                continue;
            } else {
                $vowels = array('a', 'e', 'i', 'o', 'u');
                foreach ($vowels as $vowel) {
                    if (strpos($name, $vowel) === 0) {
                        $word = 'an';
                        break;
                    } else {
                        $word = 'a';
                    }
                }
                ?>
	
								<div class='wptab wpt_types wpt_<?php 
                echo $slug;
                ?>
' aria-labelledby='tab_wpt_<?php 
                echo $slug;
                ?>
' role="tabpanel" id='wpt_<?php 
                echo $slug;
                ?>
'>
									<?php 
                // share information about any usage of pre 2.8 category filters
                if (get_option('limit_categories') != '0' && $slug == 'post') {
                    $falseness = get_option('jd_twit_cats');
                    $categories = get_option('tweet_categories');
                    if ($falseness == 1) {
                        echo "<p>" . __('These categories are currently <strong>excluded</strong> by the deprecated WP to Twitter category filters.', 'wp-to-twitter') . "</p>";
                    } else {
                        echo "<p>" . __('These categories are currently <strong>allowed</strong> by the deprecated WP to Twitter category filters.', 'wp-to-twitter') . "</p>";
                    }
                    echo "<ul>";
                    if (is_array($categories)) {
                        foreach ($categories as $cat) {
                            $category = get_the_category_by_ID($cat);
                            echo "<li>{$category}</li>";
                        }
                    }
                    echo "</ul>";
                    if (!function_exists('wpt_pro_exists')) {
                        printf(__('<a href="%s">Upgrade to WP Tweets PRO</a> to filter posts in all custom post types on any taxonomy.', 'wp-to-twitter'), "https://www.joedolson.com/wp-tweets-pro/");
                    } else {
                        _e('Updating the WP Tweets PRO taxonomy filters will overwrite your old category filters.', 'wp-to-twitter');
                    }
                }
                ?>
									<fieldset>
										<legend><span><?php 
                echo $name;
                ?>
</span></legend>
										<p>
											<input type="checkbox"
											       name="wpt_post_types[<?php 
                echo $slug;
                ?>
][post-published-update]"
											       id="<?php 
                echo $slug;
                ?>
-post-published-update"
											       value="1" <?php 
                echo jd_checkCheckbox('wpt_post_types', $slug, 'post-published-update');
                ?>
 />
											<label
												for="<?php 
                echo $slug;
                ?>
-post-published-update"><strong><?php 
                printf(__('Update when %1$s %2$s is published', 'wp-to-twitter'), $word, $singular);
                ?>
</strong></label>
											<label
												for="<?php 
                echo $slug;
                ?>
-post-published-text"><br/><?php 
                printf(__('Template for new %1$s updates', 'wp-to-twitter'), $name);
                ?>
											</label><br/><textarea class="wpt-template"
											                       name="wpt_post_types[<?php 
                echo $slug;
                ?>
][post-published-text]"
											                       id="<?php 
                echo $slug;
                ?>
-post-published-text"
											                       cols="60"
											                       rows="3"><?php 
                if (isset($wpt_settings[$slug])) {
                    echo esc_attr(stripslashes($wpt_settings[$slug]['post-published-text']));
                }
                ?>
</textarea>
										</p>

										<p>
											<input type="checkbox"
											       name="wpt_post_types[<?php 
                echo $slug;
                ?>
][post-edited-update]"
											       id="<?php 
                echo $slug;
                ?>
-post-edited-update"
											       value="1" <?php 
                echo jd_checkCheckbox('wpt_post_types', $slug, 'post-edited-update');
                ?>
 />
											<label
												for="<?php 
                echo $slug;
                ?>
-post-edited-update"><strong><?php 
                printf(__('Update when %1$s %2$s is edited', 'wp-to-twitter'), $word, $singular);
                ?>
</strong></label><br/><label
												for="<?php 
                echo $slug;
                ?>
-post-edited-text"><?php 
                printf(__('Template for %1$s editing updates', 'wp-to-twitter'), $name);
                ?>
</label><br/><textarea
												class="wpt-template"
												name="wpt_post_types[<?php 
                echo $slug;
                ?>
][post-edited-text]"
												id="<?php 
                echo $slug;
                ?>
-post-edited-text" cols="60"
												rows="3"><?php 
                if (isset($wpt_settings[$slug])) {
                    echo esc_attr(stripslashes($wpt_settings[$slug]['post-edited-text']));
                }
                ?>
</textarea>
										</p>
									</fieldset>
									<?php 
                if (function_exists('wpt_list_terms')) {
                    wpt_list_terms($slug, $name);
                }
                ?>
								</div>
							<?php 
            }
        }
        ?>
						<div class='wptab wpt_types wpt_links' id="wpt_links">
							<fieldset>
								<legend><span><?php 
        _e('Links', 'wp-to-twitter');
        ?>
</span></legend>
								<p>
									<input type="checkbox" name="jd_twit_blogroll" id="jd_twit_blogroll"
									       value="1" <?php 
        echo jd_checkCheckbox('jd_twit_blogroll');
        ?>
 />
									<label
										for="jd_twit_blogroll"><strong><?php 
        _e("Update Twitter when you post a Blogroll link", 'wp-to-twitter');
        ?>
</strong></label><br/>
									<label
										for="newlink-published-text"><?php 
        _e("Text for new link updates:", 'wp-to-twitter');
        ?>
</label>
									<input aria-describedby="newlink-published-text-label" type="text"
									       class="wpt-template" name="newlink-published-text"
									       id="newlink-published-text" size="60" maxlength="120"
									       value="<?php 
        esc_attr_e(stripslashes(get_option('newlink-published-text')));
        ?>
"/><br/><span
										id="newlink-published-text-label"><?php 
        _e('Available shortcodes: <code>#url#</code>, <code>#title#</code>, and <code>#description#</code>.', 'wp-to-twitter');
        ?>
</span>
								</p>
							</fieldset>
						</div>
						<br class='clear'/>

						<div>
							<input type="hidden" name="submit-type" value="options"/>
						</div>
						<input type="submit" name="submit"
						       value="<?php 
        _e("Save WP to Twitter Options", 'wp-to-twitter');
        ?>
"
						       class="button-primary"/>
					</div>
				</form>
			</div>
		</div>
	</div>
	
	<div class="ui-sortable meta-box-sortables">
			<div class="postbox">
				<h3><span><?php 
        _e('Tweet Template Tags', 'wp-to-twitter');
        ?>
</span></h3>

				<div class="inside">
					<ul>
						<li><?php 
        _e("<code>#title#</code>: the title of your blog post", 'wp-to-twitter');
        ?>
</li>
						<li><?php 
        _e("<code>#blog#</code>: the title of your blog", 'wp-to-twitter');
        ?>
</li>
						<li><?php 
        _e("<code>#post#</code>: a short excerpt of the post content", 'wp-to-twitter');
        ?>
</li>
						<li><?php 
        _e("<code>#category#</code>: the first selected category for the post", 'wp-to-twitter');
        ?>
</li>
						<li><?php 
        _e("<code>#cat_desc#</code>: custom value from the category description field", 'wp-to-twitter');
        ?>
</li>
						<li><?php 
        _e("<code>#date#</code>: the post date", 'wp-to-twitter');
        ?>
</li>
						<li><?php 
        _e("<code>#modified#</code>: the post modified date", 'wp-to-twitter');
        ?>
</li>
						<li><?php 
        _e("<code>#url#</code>: the post URL", 'wp-to-twitter');
        ?>
</li>
						<li><?php 
        _e("<code>#longurl#</code>: the unshortened post URL", 'wp-to-twitter');
        ?>
</li>
						<li><?php 
        _e("<code>#author#</code>: the post author (@reference if available, otherwise display name)", 'wp-to-twitter');
        ?>
</li>
						<li><?php 
        _e("<code>#displayname#</code>: post author's display name", 'wp-to-twitter');
        ?>
</li>
						<li><?php 
        _e("<code>#account#</code>: the twitter @reference for the account (or the author, if author settings are enabled and set.)", 'wp-to-twitter');
        ?>
</li>
						<li><?php 
        _e("<code>#@#</code>: the twitter @reference for the author or blank, if not set", 'wp-to-twitter');
        ?>
</li>
						<li><?php 
        _e("<code>#tags#</code>: your tags modified into hashtags. See options in the Advanced Settings section, below.", 'wp-to-twitter');
        ?>
</li>
						<?php 
        if (function_exists('wpt_pro_exists') && wpt_pro_exists() == true) {
            ?>
							<li><?php 
            _e("<code>#reference#</code>: Used only in co-tweeting. @reference to main account when posted to author account, @reference to author account in post to main account.", 'wp-to-twitter');
            ?>
</li>
						<?php 
        }
        ?>
					</ul>
					<p>
					<?php 
        _e("Create custom shortcodes and access WordPress custom fields by using square brackets and the name of your custom field.", 'wp-to-twitter');
        ?>
					<br />
					<?php 
        _e("<strong>Example:</strong> <code>[[custom_field]]</code>", 'wp-to-twitter');
        ?>
					</p>
				</div>
			</div>
		</div>	
	<?php 
    }
    if ($current == 'shortener') {
        echo apply_filters('wpt_shortener_controls', '');
    }
    if ($current == 'advanced') {
        ?>
	<div class="ui-sortable meta-box-sortables">
		<div class="postbox">
			<h3><span><?php 
        _e('Advanced Settings', 'wp-to-twitter');
        ?>
</span></h3>

			<div class="inside">
				<form method="post" action="">
					<div>
						<?php 
        $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false);
        echo "<div>{$nonce}</div>";
        ?>

						<fieldset>
							<legend><?php 
        _e('Tags', 'wp-to-twitter');
        ?>
</legend>
							<p>
								<input type="checkbox" name="jd_strip_nonan" id="jd_strip_nonan"
								       value="1" <?php 
        echo jd_checkCheckbox('jd_strip_nonan');
        ?>
 /> <label
									for="jd_strip_nonan"><?php 
        _e("Strip nonalphanumeric characters from tags", 'wp-to-twitter');
        ?>
</label>
							</p>

							<p>
								<input type="checkbox" name="wpt_tag_source" id="wpt_tag_source"
								       value="slug" <?php 
        echo jd_checkSelect('wpt_tag_source', 'slug', 'checkbox');
        ?>
 />
								<label
									for="wpt_tag_source"><?php 
        _e("Use tag slug as hashtag value", 'wp-to-twitter');
        ?>
</label><br/>
							</p>

							<p>
								<label
									for="jd_replace_character"><?php 
        _e("Spaces in tags replaced with:", 'wp-to-twitter');
        ?>
</label>
								<input type="text" name="jd_replace_character" id="jd_replace_character"
								       value="<?php 
        esc_attr_e(get_option('jd_replace_character'));
        ?>
"
								       size="3"/>
							</p>

							<p>
								<label
									for="jd_max_tags"><?php 
        _e("Maximum number of tags to include:", 'wp-to-twitter');
        ?>
</label>
								<input aria-describedby="jd_max_characters_label" type="text" name="jd_max_tags"
								       id="jd_max_tags" value="<?php 
        esc_attr_e(get_option('jd_max_tags'));
        ?>
"
								       size="3"/>
								<label
									for="jd_max_characters"><?php 
        _e("Maximum length in characters for included tags:", 'wp-to-twitter');
        ?>
</label>
								<input type="text" name="jd_max_characters" id="jd_max_characters"
								       value="<?php 
        esc_attr_e(get_option('jd_max_characters'));
        ?>
" size="3"/>
							</p>
						</fieldset>
						<fieldset>
							<legend><?php 
        _e('Template Tag Settings', 'wp-to-twitter');
        ?>
</legend>
							<p>
								<label
									for="jd_post_excerpt"><?php 
        _e("Length of post excerpt (in characters):", 'wp-to-twitter');
        ?>
</label>
								<input type="text" name="jd_post_excerpt" id="jd_post_excerpt" size="3" maxlength="3" value="<?php 
        echo esc_attr(get_option('jd_post_excerpt'));
        ?>
"/>
							</p>

							<p>
								<label
									for="jd_date_format"><?php 
        _e("WP to Twitter Date Formatting:", 'wp-to-twitter');
        ?>
</label>
								<input type="text" aria-describedby="date_format_label" name="jd_date_format"
								       id="jd_date_format" size="12" maxlength="12"
								       value="<?php 
        if (get_option('jd_date_format') == '') {
            echo esc_attr(stripslashes(get_option('date_format')));
        } else {
            echo esc_attr(get_option('jd_date_format'));
        }
        ?>
"/> <?php 
        if (get_option('jd_date_format') != '') {
            echo date_i18n(get_option('jd_date_format'));
        } else {
            echo "<em>" . date_i18n(get_option('date_format')) . "</em>";
        }
        ?>
 (<em
									id="date_format_label"><a href='http://codex.wordpress.org/Formatting_Date_and_Time'><?php 
        _e("Date Formatting", 'wp-to-twitter');
        ?>
</a></em>)
							</p>

							<p>
								<label
									for="jd_twit_prepend"><?php 
        _e("Custom text before all Tweets:", 'wp-to-twitter');
        ?>
</label>
								<input type="text" name="jd_twit_prepend" id="jd_twit_prepend" size="20"
								       value="<?php 
        esc_attr_e(stripslashes(get_option('jd_twit_prepend')));
        ?>
"/>
							</p>

							<p>
								<label
									for="jd_twit_append"><?php 
        _e("Custom text after all Tweets:", 'wp-to-twitter');
        ?>
</label>
								<input type="text" name="jd_twit_append" id="jd_twit_append" size="20"
								       value="<?php 
        esc_attr_e(stripslashes(get_option('jd_twit_append')));
        ?>
"/>
							</p>

							<p>
								<label
									for="jd_twit_custom_url"><?php 
        _e("Custom field for an alternate URL to be shortened and Tweeted:", 'wp-to-twitter');
        ?>
</label>
								<input type="text" name="jd_twit_custom_url" id="jd_twit_custom_url" size="40"
								       maxlength="120"
								       value="<?php 
        esc_attr_e(stripslashes(get_option('jd_twit_custom_url')));
        ?>
"/>
							</p>
						</fieldset>

						<?php 
        $inputs = '';
        $default_order = array('excerpt' => 0, 'title' => 1, 'date' => 2, 'category' => 3, 'blogname' => 4, 'author' => 5, 'account' => 6, 'tags' => 7, 'modified' => 8, '@' => 9, 'cat_desc' => 10);
        $preferred_order = get_option('wpt_truncation_order');
        if (!$preferred_order) {
            $preferred_order = array();
        }
        $preferred_order = array_merge($default_order, $preferred_order);
        if (is_array($preferred_order)) {
            $default_order = $preferred_order;
        }
        asort($default_order);
        foreach ($default_order as $k => $v) {
            $label = '<code>#' . $k . '#</code>';
            $inputs .= "<div class='wpt-truncate'><label for='{$k}-{$v}'>{$label}</label><br /><input type='number' size='3' value='{$v}' name='wpt_truncation_order[{$k}]' /></div> ";
        }
        ?>
						<fieldset>
							<legend><?php 
        _e('Template tag priority order', 'wp-to-twitter');
        ?>
</legend>
							<p><?php 
        _e('The order in which items will be abbreviated or removed from your Tweet if the Tweet is too long to send to Twitter.', 'wp-to-twitter');
        ?>
 <?php 
        _e('Tags with lower values will be modified first.', 'wp-to-twitter');
        ?>
</p>
							<p>
								<?php 
        echo $inputs;
        ?>
							</p>
						</fieldset>
						<fieldset>
							<legend id="special_cases"><?php 
        _e("Special Cases", 'wp-to-twitter');
        ?>
</legend>
							<p>
								<input type="checkbox" name="jd_tweet_default" id="jd_tweet_default"
								       value="1" <?php 
        echo jd_checkCheckbox('jd_tweet_default');
        ?>
 />
								<label
									for="jd_tweet_default"><?php 
        _e("Do not post Tweets by default", 'wp-to-twitter');
        ?>
</label><br/>
								<input type="checkbox" name="jd_tweet_default_edit" id="jd_tweet_default_edit"
								       value="1" <?php 
        echo jd_checkCheckbox('jd_tweet_default_edit');
        ?>
 />
								<label
									for="jd_tweet_default_edit"><?php 
        _e("Do not post Tweets by default (editing only)", 'wp-to-twitter');
        ?>
</label><br/>
								<input type="checkbox" name="wpt_inline_edits" id="wpt_inline_edits"
								       value="1" <?php 
        echo jd_checkCheckbox('wpt_inline_edits');
        ?>
 />
								<label
									for="wpt_inline_edits"><?php 
        _e("Allow status updates from Quick Edit", 'wp-to-twitter');
        ?>
</label><br/>
								<input type="checkbox" name="wpt_rate_limiting" id="wpt_rate_limiting"
								       value="1" <?php 
        echo jd_checkCheckbox('wpt_rate_limiting');
        ?>
 />
								<label
									for="wpt_rate_limiting"><?php 
        _e("Enable Rate Limiting", 'wp-to-twitter');
        ?>
</label><br/>
								<?php 
        if (get_option('wpt_rate_limiting') == 1) {
            ?>
								<input type="number" name="wpt_default_rate_limit" min="1" id="wpt_default_rate_limit"
								       value="<?php 
            echo wpt_default_rate_limit();
            ?>
" />
								<label
									for="wpt_default_rate_limit"><?php 
            _e("Default Rate Limit per category per hour", 'wp-to-twitter');
            ?>
</label><br/>							
									<?php 
        }
        ?>
							</p>
						</fieldset>
						<fieldset>
							<legend><?php 
        _e("Google Analytics Settings", 'wp-to-twitter');
        ?>
</legend>

							<p>
								<input type="radio" name="twitter-analytics" id="use-twitter-analytics"
								       value="1" <?php 
        echo jd_checkCheckbox('use-twitter-analytics');
        ?>
 />
								<label
									for="use-twitter-analytics"><?php 
        _e("Use a Static Identifier", 'wp-to-twitter');
        ?>
</label><br/>
								<label
									for="twitter-analytics-campaign"><?php 
        _e("Static Campaign identifier", 'wp-to-twitter');
        ?>
</label>
								<input type="text" name="twitter-analytics-campaign" id="twitter-analytics-campaign"
								       size="40" maxlength="120"
								       value="<?php 
        esc_attr_e(get_option('twitter-analytics-campaign'));
        ?>
"/><br/>
							</p>

							<p>
								<input type="radio" name="twitter-analytics" id="use-dynamic-analytics"
								       value="2" <?php 
        echo jd_checkCheckbox('use_dynamic_analytics');
        ?>
 />
								<label
									for="use-dynamic-analytics"><?php 
        _e("Use a dynamic identifier", 'wp-to-twitter');
        ?>
</label><br/>
								<label
									for="jd-dynamic-analytics"><?php 
        _e("What dynamic identifier would you like to use?", "wp-to-twitter");
        ?>
</label>
								<select name="jd-dynamic-analytics" id="jd-dynamic-analytics">
									<option
										value="post_category"<?php 
        echo jd_checkSelect('jd_dynamic_analytics', 'post_category');
        ?>
><?php 
        _e("Category", "wp-to-twitter");
        ?>
</option>
									<option
										value="post_ID"<?php 
        echo jd_checkSelect('jd_dynamic_analytics', 'post_ID');
        ?>
><?php 
        _e("Post ID", "wp-to-twitter");
        ?>
</option>
									<option
										value="post_title"<?php 
        echo jd_checkSelect('jd_dynamic_analytics', 'post_title');
        ?>
><?php 
        _e("Post Title", "wp-to-twitter");
        ?>
</option>
									<option
										value="post_author"<?php 
        echo jd_checkSelect('jd_dynamic_analytics', 'post_author');
        ?>
><?php 
        _e("Author", "wp-to-twitter");
        ?>
</option>
								</select><br/>
							</p>
							<p>
								<input type="radio" name="twitter-analytics" id="no-analytics"
								       value="3" <?php 
        echo jd_checkCheckbox('no-analytics');
        ?>
 /> <label
									for="no-analytics"><?php 
        _e("No Analytics", 'wp-to-twitter');
        ?>
</label>
							</p>
						</fieldset>
						<fieldset id="indauthors">
							<legend><?php 
        _e('Author Settings', 'wp-to-twitter');
        ?>
</legend>
							<p>
								<input type="checkbox" name="jd_individual_twitter_users" id="jd_individual_twitter_users"
								       value="1" <?php 
        echo jd_checkCheckbox('jd_individual_twitter_users');
        ?>
 />
								<label
									for="jd_individual_twitter_users"><?php 
        _e("Authors have individual Twitter accounts", 'wp-to-twitter');
        ?>
</label>
							</p>

						</fieldset>
						<div class='wpt-permissions'>
							<fieldset>
								<legend><?php 
        _e('Permissions', 'wp-to-twitter');
        ?>
</legend>
								<?php 
        global $wp_roles;
        $roles = $wp_roles->get_names();
        $caps = array('wpt_can_tweet' => __('Can send Tweets', 'wp-to-twitter'), 'wpt_twitter_custom' => __('See Custom Tweet Field when creating a Post', 'wp-to-twitter'), 'wpt_twitter_switch' => __('Toggle the Tweet/Don\'t Tweet option', 'wp-to-twitter'), 'wpt_tweet_now' => __('Can see Tweet Now button', 'wp-to-twitter'), 'wpt_twitter_oauth' => __('Add Twitter Information to User Profile', 'wp-to-twitter'));
        $role_tabs = $role_container = '';
        foreach ($roles as $role => $rolename) {
            if ($role == 'administrator') {
                continue;
            }
            $role_tabs .= "<li><a href='#wpt_{$role}'>{$rolename}</a></li>\n";
            $role_container .= "<div class='wptab wpt_{$role}' id='wpt_{$role}' aria-live='assertive'><fieldset id='wpt_{$role}' class='roles'><legend>{$rolename}</legend>";
            $role_container .= "<input type='hidden' value='none' name='wpt_caps[" . $role . "][none]' />\r\n\t\t\t<ul class='wpt-settings checkboxes'>";
            foreach ($caps as $cap => $name) {
                $role_container .= wpt_cap_checkbox($role, $cap, $name);
            }
            $role_container .= "\r\n\t\t\t</ul></fieldset></div>\n";
        }
        echo "\r\n\t\t<ul class='tabs'>\r\n\t\t\t{$role_tabs}\r\n\t\t</ul>\r\n\t\t{$role_container}";
        ?>
							</fieldset>
						</div>
						<fieldset>
							<legend><?php 
        _e('Error Messages and Debugging', 'wp-to-twitter');
        ?>
</legend>
							<ul>
								<li><input type="checkbox" name="wpt_permit_feed_styles" id="wpt_permit_feed_styles"
								           value="1" <?php 
        echo jd_checkCheckbox('wpt_permit_feed_styles');
        ?>
 />
									<label
										for="wpt_permit_feed_styles"><?php 
        _e("Disable Twitter Feed Stylesheet", 'wp-to-twitter');
        ?>
</label>
								</li>
								<li><input type="checkbox" name="wp_debug_oauth" id="wp_debug_oauth"
								           value="1" <?php 
        echo jd_checkCheckbox('wp_debug_oauth');
        ?>
 /> <label
										for="wp_debug_oauth"><?php 
        _e("Get Debugging Data for OAuth Connection", 'wp-to-twitter');
        ?>
</label>
								</li>
								<li><input type="checkbox" name="jd_donations" id="jd_donations"
								           value="1" <?php 
        echo jd_checkCheckbox('jd_donations');
        ?>
 /> <label
										for="jd_donations"><strong><?php 
        _e("I made a donation, so stop whinging at me, please.", 'wp-to-twitter');
        ?>
</strong></label>
								</li>
							</ul>
						</fieldset>
						<div>
							<input type="hidden" name="submit-type" value="advanced"/>
						</div>
						<input type="submit" name="submit"
						       value="<?php 
        _e("Save Advanced WP to Twitter Options", 'wp-to-twitter');
        ?>
"
						       class="button-primary"/>
					</div>
				</form>
			</div>
		</div>
	</div>
	<?php 
    }
    if ($current == 'support') {
        ?>
	<div class="postbox" id="get-support">
		<h3><span><?php 
        _e('Get Plug-in Support', 'wp-to-twitter');
        ?>
</span></h3>

		<div class="inside">
			<?php 
        wpt_get_support_form();
        ?>
		</div>
	</div>
	<?php 
    }
    ?>
	<p>
		<?php 
    _e('Check whether WP to Twitter is setup correctly for Twitter and your URL Shortener. The test sends a status update to Twitter and shortens a URL using your chosen shortener.', 'wp-to-twitter');
    ?>
	</p>
	<form method="post" action="">
		<fieldset>
			<input type="hidden" name="submit-type" value="check-support"/>
			<?php 
    $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false) . wp_referer_field(false);
    echo "<div>{$nonce}</div>";
    ?>
			<p>
				<input type="submit" name="submit" value="<?php 
    _e('Test WP to Twitter', 'wp-to-twitter');
    ?>
" class="button-primary" />
			</p>
		</fieldset>
	</form>
	</div>
	</div>
	<?php 
    wpt_sidebar();
    ?>
	</div>
	</div>
	<?php 
}
コード例 #29
0
ファイル: admin_ui.php プロジェクト: rongandat/sallumeh
/**
 * Returns nonce field HTML
 *
 * @param string $action
 * @param string $name
 * @param bool $referer
 * @internal param bool $echo
 * @return string
 */
function w3_nonce_field($action = -1, $name = '_wpnonce', $referer = true)
{
    $name = esc_attr($name);
    $return = '<input type="hidden" name="' . $name . '" value="' . wp_create_nonce($action) . '" />';
    if ($referer) {
        $return .= wp_referer_field(false);
    }
    return $return;
}
コード例 #30
0
function wp_nonce_field($action = -1)
{
    echo '<input type="hidden" name="_wpnonce" value="' . wp_create_nonce($action) . '" />';
    wp_referer_field();
}