コード例 #1
0
ファイル: mobile.php プロジェクト: niamherinoc/rctractors
function __wps__mobile_menu() {

		global $wpdb;
		
    	// See if the user has posted Mobile settings
		if( isset($_POST[ 'symposium_update' ]) && $_POST[ 'symposium_update' ] == '__wps__mobile_menu' ) {
    	    	        
			update_option(WPS_OPTIONS_PREFIX.'_mobile_topics', $_POST['mobile_topics']);
			update_option(WPS_OPTIONS_PREFIX.'_mobile_notice', stripslashes($_POST['mobile_notice']));
			update_option(WPS_OPTIONS_PREFIX.'_mobile_useragent', isset($_POST['mobile_useragent']) ? $_POST['mobile_useragent'] : '');
			echo "<div class='updated slideaway'><p>".__('Saved', WPS_TEXT_DOMAIN).".</p></div>";

	    }
	 
	 	// Check for default values
	 	if (!get_option(WPS_OPTIONS_PREFIX.'_mobile_notice'))
	 		update_option(WPS_OPTIONS_PREFIX.'_mobile_notice', "<a href='/m'>Go Mobile!</a>");
	    // Get values from database  
		$mobile_topics = get_option(WPS_OPTIONS_PREFIX.'_mobile_topics');
		$mobile_notice = get_option(WPS_OPTIONS_PREFIX.'_mobile_notice');
		$mobile_useragent = get_option(WPS_OPTIONS_PREFIX.'_mobile_useragent');

	  	echo '<div class="wrap">';

		  	echo '<div id="icon-themes" class="icon32"><br /></div>';
		  	echo '<h2>'.sprintf(__('%s Options', WPS_TEXT_DOMAIN), WPS_WL).'</h2><br />';
		
			__wps__show_tabs_header('mobile');

			?>
	
					<form method="post" action=""> 
					<input type="hidden" name="symposium_update" value="__wps__mobile_menu">
		
					<table class="form-table"> 
		
						<tr><td colspan="2"><h2><?php _e('Options', WPS_TEXT_DOMAIN) ?></h2></td></tr>

						<tr valign="top"> 
						<td scope="row"><label for="mobile_notice"><?php _e('Mobile/Tablet notice', WPS_TEXT_DOMAIN); ?></label></td> 
						<td><input name="mobile_notice" type="text" id="mobile_notice"  value="<?php echo $mobile_notice; ?>" style="width:300px" /> <br />
						<span class="description">
							<?php echo __('Text shown at the top of relevant page if a mobile/tablet is detected (HTML/links permitted).<br />Enter \'hide\' to avoid displaying.', WPS_TEXT_DOMAIN); ?>
						</span></td> 
						</tr> 
	
						<tr valign="top"> 
						<td scope="row"><label for="mobile_topics"><?php _e('Maximum number of topics', WPS_TEXT_DOMAIN); ?></label></td> 
						<td><input name="mobile_topics" type="text" id="mobile_topics"  value="<?php echo $mobile_topics; ?>" style="width:50px" /> 
						<span class="description"><?php echo __('Threads view is also limited to last 7 days', WPS_TEXT_DOMAIN); ?></td> 
						</tr> 

						<tr valign="top"> 
						<td scope="row"><label for="mobile_useragent"><?php _e('Display user agent', WPS_TEXT_DOMAIN); ?></label></td>
						<td>
						<input type="checkbox" name="mobile_useragent" id="mobile_useragent" <?php if ($mobile_useragent == "on") { echo "CHECKED"; } ?>/>
						<span class="description"><?php echo __('For admin use only to check mobile device user agent', WPS_TEXT_DOMAIN); ?></span></td> 
						</tr> 
					
					</table>
		 					
				<p class="submit" style="margin-left:6px;">
				<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes', WPS_TEXT_DOMAIN); ?>" />
				</p>
				</form>

				<table class="form-table"><tr><td colspan="2">
				<h2><?php _e('Installation steps', WPS_TEXT_DOMAIN) ?></h2>

				<div style="margin:10px">
				<p><?php _e("To install the Mobile/SEO/Accessibility plugin on your site:", WPS_TEXT_DOMAIN) ?></p>

				<ol>
					<li>In the directory where WordPress is installed, create a folder for your mobile version, for example '/m'.</li>
					<li>For example, for /m create <?php echo str_replace('//', '/', $_SERVER['DOCUMENT_ROOT'].'/'); ?>m to create <?php echo str_replace('//', '/', get_bloginfo('wpurl').'/'); ?>m</li>
					<li>Unzip <strong>mobile-files.zip</strong> (it can be found in your <?php echo WPS_WL; ?> plugin folder).</li>
					<li>Copy the <strong>extracted contents</strong> into the folder from step 2.</li>
				</ol>
				</div>
				</td></tr></table>

				<table class="form-table"><tr><td colspan="2">
				<h2><?php echo sprintf(__('Mobile version of %s', WPS_TEXT_DOMAIN), WPS_WL); ?></h2>
		
				<div style="margin:10px">
				<p>On your mobile device/phone browse to (for example) <a target='_blank' href='<?php echo str_replace('http:/', 'http://', str_replace('//', '/', get_bloginfo('wpurl').'/')); ?>m'><?php echo str_replace('http:/', 'http://', str_replace('//', '/', get_bloginfo('wpurl').'/')); ?>m</a></p>
				</div>

				</td></tr></table>

				<table class="form-table"><tr><td colspan="2">
				<h2><?php echo sprintf(__('Accessible version of %s', WPS_TEXT_DOMAIN), WPS_WL); ?></h2>
		
				<div style="margin:10px">
				<p>To force the mobile version to show in a normal browser, add ?a=1. For example, <a target='_blank' href='<?php echo get_bloginfo('wpurl'); ?>/m?a=1'><?php echo get_bloginfo('wpurl'); ?>/m?a=1</a></p>
				</div>
				</td></tr></table>

				<table class="form-table"><tr><td colspan="2">
				<h2><?php echo __('Search Engines', WPS_TEXT_DOMAIN); ?></h2>
		
				<div style="margin:10px">
				<p>Submit the URL (for example) <?php echo get_bloginfo('wpurl'); ?>/m to search engines. When people visit the link indexed they will automatically be redirected to the full site (unless on a mobile device).</p>
				</div>
				</td></tr></table>

			<?php __wps__show_tabs_header_end(); ?>
		</div>
	<?php
}
コード例 #2
0
	<td><input name="gallery_page_length" type="text" id="gallery_page_length" style="width:50px" value="<?php echo $gallery_page_length; ?>" /> 
	<span class="description"><?php echo __('Number of albums to show on the gallery page (shortcode)', WPS_TEXT_DOMAIN); ?></td> 
	</tr> 
	
	<tr valign="top"> 
	<td scope="row"><label for="gallery_preview"><?php _e('Preview photos', WPS_TEXT_DOMAIN); ?></label></td> 
	<td><input name="gallery_preview" type="text" id="gallery_preview" style="width:50px" value="<?php echo $gallery_preview; ?>" /> 
	<span class="description"><?php echo __('Number of photos to show on one row as an album preview on the gallery page (shortcode)', WPS_TEXT_DOMAIN); ?></td> 
	</tr> 
	
	<?php
	echo '</table>';

	?>
	<table style="margin-left:10px; margin-top:10px;">						
		<tr><td colspan="2"><h2>Shortcodes</h2></td></tr>
		<tr><td width="165px">[<?php echo WPS_SHORTCODE_PREFIX; ?>-galleries]</td>
			<td><?php echo __('Displays a gallery of all the user albums.', WPS_TEXT_DOMAIN); ?></td></tr>
	</table>
	<?php 	
	 					
	echo '<p class="submit" style="margin-left:6px;">';
	echo '<input type="submit" name="Submit" class="button-primary" value="'.__('Save Changes', WPS_TEXT_DOMAIN).'" />';
	echo '</p>';
	echo '</form>';
					  
?>

<?php __wps__show_tabs_header_end(); ?>
</div>
コード例 #3
0
ファイル: menu.php プロジェクト: niamherinoc/rctractors
function __wps__members_menu() {
	
	global $wpdb;

	// See if the user has posted notification bar settings
	if( isset($_POST[ 'symposium_update' ]) && $_POST[ 'symposium_update' ] == '__wps__members_menu' ) {

		$dir_atoz_order = (isset($_POST['dir_atoz_order'])) ? $_POST['dir_atoz_order'] : '';
		$show_dir_buttons = (isset($_POST['show_dir_buttons'])) ? $_POST['show_dir_buttons'] : '';
		$dir_page_length = (isset($_POST['dir_page_length']) && $_POST['dir_page_length'] != '') ? $_POST['dir_page_length'] : '25';
		$dir_full_ver = (isset($_POST['dir_full_ver']) && $_POST['dir_full_ver'] != '') ? $_POST['dir_full_ver'] : '';
		$dir_hide_public = (isset($_POST['dir_hide_public']) && $_POST['dir_hide_public'] != '') ? $_POST['dir_hide_public'] : '';
		
		
		update_option(WPS_OPTIONS_PREFIX.'_dir_atoz_order', $dir_atoz_order);
		update_option(WPS_OPTIONS_PREFIX.'_show_dir_buttons', $show_dir_buttons);
		update_option(WPS_OPTIONS_PREFIX.'_dir_page_length', $dir_page_length);
		update_option(WPS_OPTIONS_PREFIX.'_dir_full_ver', $dir_full_ver);
		update_option(WPS_OPTIONS_PREFIX.'dir_hide_public', $dir_hide_public);
		

		// Included roles
		if (isset($_POST['dir_level'])) {
	   		$range = array_keys($_POST['dir_level']);
	   		$level = '';
   			foreach ($range as $key) {
				$level .= $_POST['dir_level'][$key].',';
	   		}
		} else {
			$level = '';
		}

		update_option(WPS_OPTIONS_PREFIX.'_dir_level', serialize($level));
		
		// Put an settings updated message on the screen
		echo "<div class='updated slideaway'><p>".__('Saved', WPS_TEXT_DOMAIN).".</p></div>";
		
	}

	// Get values to show
	$show_dir_buttons = get_option(WPS_OPTIONS_PREFIX.'_show_dir_buttons');
	$dir_page_length = get_option(WPS_OPTIONS_PREFIX.'_dir_page_length');
	
  	echo '<div class="wrap">';
  	
	  	echo '<div id="icon-themes" class="icon32"><br /></div>';
	  	echo '<h2>'.sprintf(__('%s Options', WPS_TEXT_DOMAIN), WPS_WL).'</h2><br />';
	
		__wps__show_tabs_header('directory');
		?>

			<form method="post" action=""> 
			<input type="hidden" name="symposium_update" value="__wps__members_menu">

			<table class="form-table __wps__admin_table">

			<tr><td colspan="2"><h2><?php _e('Options', WPS_TEXT_DOMAIN) ?></h2></td></tr>
			
			<tr valign="top">
			<td scope="row"><label for="dir_atoz_order"><?php echo __('Default view', WPS_TEXT_DOMAIN); ?></label></td> 
			<td>
			<select name="dir_atoz_order">
				<option value='last_activity'<?php if (get_option(WPS_OPTIONS_PREFIX.'_dir_atoz_order') == 'last_activity') { echo ' SELECTED'; } ?>><?php echo __('Most recently active', WPS_TEXT_DOMAIN); ?></option>
				<option value='display_name'<?php if (get_option(WPS_OPTIONS_PREFIX.'_dir_atoz_order') == 'display_name') { echo ' SELECTED'; } ?>><?php echo __('Display name', WPS_TEXT_DOMAIN); ?></option>
				<option value='surname'<?php if (get_option(WPS_OPTIONS_PREFIX.'_dir_atoz_order') == 'surname') { echo ' SELECTED'; } ?>><?php echo __('Surname (if entered in display_name)', WPS_TEXT_DOMAIN); ?></option>
			</select> 
			<span class="description"><?php echo __("Initial view of the member directory", WPS_TEXT_DOMAIN); ?></span></td>
			</tr> 		

			<tr valign="top"> 
			<td scope="row"><label for="dir_hide_public"><?php echo __('Make private?', WPS_TEXT_DOMAIN) ?></label></td>
			<td>
			<input type="checkbox" name="dir_hide_public" id="dir_hide_public" <?php if (isset($dir_hide_public) && $dir_hide_public == "on") { echo "CHECKED"; } ?>/>
			<span class="description"><?php echo __('Hide from public view, requires login to see directory', WPS_TEXT_DOMAIN); ?></span></td> 
			</tr> 
			
			<tr valign="top"> 
			<td scope="row"><label for="dir_full_ver"><?php echo __('Faster search?', WPS_TEXT_DOMAIN) ?></label></td>
			<td>
			<input type="checkbox" name="dir_full_ver" id="dir_full_ver" <?php if (isset($dir_full_ver) && $dir_full_ver == "on") { echo "CHECKED"; } ?>/>
			<span class="description"><?php echo __('Improves search time, but search results are limited and cannot re-order search results', WPS_TEXT_DOMAIN); ?></span></td> 
			</tr> 
			
			<tr valign="top"> 
			<td scope="row"><label for="show_dir_buttons"><?php echo __('Include member actions?', WPS_TEXT_DOMAIN) ?></label></td>
			<td>
			<input type="checkbox" name="show_dir_buttons" id="show_dir_buttons" <?php if ($show_dir_buttons == "on") { echo "CHECKED"; } ?>/>
			<span class="description"><?php echo __('Should buttons to add as a friend, or send mail, be shown on the directory?', WPS_TEXT_DOMAIN); ?></span></td> 
			</tr> 
			
			<tr valign="top"> 
			<td scope="row"><label for="dir_page_length"><?php echo __('Page Length', WPS_TEXT_DOMAIN) ?></label></td> 
			<td><input name="dir_page_length" type="text" id="dir_page_length" style="width:50px" value="<?php echo $dir_page_length; ?>"  /> 
			<span class="description"><?php echo __('Number of members shown at a time on the directory', WPS_TEXT_DOMAIN); ?></span></td> 
			</tr> 	

			<tr valign="top"> 
			<td scope="row"><label for="dir_level"><?php echo __('Roles to include in directory', WPS_TEXT_DOMAIN) ?></label></td> 
			<td>
			<?php

				// Get list of roles
				global $wp_roles;
				$all_roles = $wp_roles->roles;

				$dir_roles = get_option(WPS_OPTIONS_PREFIX.'_dir_level');

				foreach ($all_roles as $role) {
					echo '<input type="checkbox" name="dir_level[]" value="'.$role['name'].'"';
					if (strpos(strtolower($dir_roles), strtolower($role['name']).',') !== FALSE) {
						echo ' CHECKED';
					}
					echo '> '.$role['name'].'<br />';
				}	

			?>
			</td>
			
			</tr>

			<tr><td colspan="2"><h2>Shortcodes</h2></td></tr>
			
			<tr valign="top"> 
				<td scope="row">
					[<?php echo WPS_SHORTCODE_PREFIX; ?>-members]
				</td>
				<td>
				<?php echo __('Displays a list of members, based upon roles selected above.', WPS_TEXT_DOMAIN).'<br />'; ?>
				<?php echo '<strong>'.__('Parameters', WPS_TEXT_DOMAIN).'</strong><br />'; ?>
				<?php echo __('<div style="width:75px;float:left;">roles:</div>over-ride the roles above and limit to those included (comma separated)', WPS_TEXT_DOMAIN).'<br />'; ?>
				<?php echo '<strong>'.__('Example', WPS_TEXT_DOMAIN).'</strong><br />'; ?>
				<?php echo sprintf(__('[%s-members roles="administrator,subscriber"]', WPS_TEXT_DOMAIN), WPS_SHORTCODE_PREFIX).'<br />'; ?>
				<span class="description"><?php echo __('You can use this shortcode (with different parameters) on multiple pages.', WPS_TEXT_DOMAIN); ?></span>
				</td>
			</tr>
									
			</table>
		
			<p class="submit" style="margin-left:6px;"> 
			<input type="submit" name="Submit" class="button-primary" value="<?php echo __('Save Changes', WPS_TEXT_DOMAIN); ?>" /> 
			</p> 
			</form> 

	<?php
	__wps__show_tabs_header_end();
	echo '</div>';
		
}