Ejemplo n.º 1
0
/**
 *  Main function to register all of the plugin settings
 *
 * @since 2.0.0
 */
function gce_register_settings()
{
    $gce_settings = array('general' => array('api_key' => array('id' => 'api_key', 'name' => __('Google API Key', 'gce'), 'desc' => __('If left blank all displayed Google calendars will use a public Google API key shared across all plugin users.', 'gce') . ' ' . __('Currently the shared key is limited to 500,000 requests per day and 5 requests per second.', 'gce') . '<br/>' . sprintf(__('To avoid these limits <a href="%s" target="_blank">click here for instructions on how to generate and use your own Google API key.</a>', 'gce'), gce_ga_campaign_url('http://wpdocs.philderksen.com/google-calendar-events/getting-started/api-key-settings/', 'gce_lite', 'settings_link', 'docs')), 'size' => 'regular-text', 'type' => 'text'), 'always_enqueue' => array('id' => 'always_enqueue', 'name' => __('Always Enqueue Scripts & Styles', 'gce'), 'desc' => __('Enqueue this plugin\'s scripts and styles on every post and page.', 'gce') . '<br/>' . '<p class="description">' . __('Useful if using shortcodes in widgets or other non-standard locations.', 'gce') . '</p>', 'type' => 'checkbox'), 'disable_css' => array('id' => 'disable_css', 'name' => __('Disable Plugin CSS', 'gce'), 'desc' => __("If this option is checked, this plugin's CSS file will not be referenced.", 'gce'), 'type' => 'checkbox'), 'save_settings' => array('id' => 'save_settings', 'name' => __('Save Settings', 'gce'), 'desc' => __('Save your settings when uninstalling this plugin.', 'gce') . '<br/>' . '<p class="description">' . __('Useful when upgrading or re-installing.', 'gce') . '</p>', 'type' => 'checkbox')));
    /* If the options do not exist then create them for each section */
    if (false == get_option('gce_settings_general')) {
        add_option('gce_settings_general');
    }
    /* Add the General Settings section */
    add_settings_section('gce_settings_general', __('General Settings', 'gce'), '__return_false', 'gce_settings_general');
    foreach ($gce_settings['general'] as $option) {
        add_settings_field('gce_settings_general[' . $option['id'] . ']', $option['name'], function_exists('gce_' . $option['type'] . '_callback') ? 'gce_' . $option['type'] . '_callback' : 'gce_missing_callback', 'gce_settings_general', 'gce_settings_general', gce_get_settings_field_args($option, 'general'));
    }
    /* Register all settings or we will get an error when trying to save */
    register_setting('gce_settings_general', 'gce_settings_general', 'gce_settings_sanitize');
}
Ejemplo n.º 2
0
		<td>
			<input type="text" class="regular-text" style="width: 30em;" name="gce_feed_url" id="gce_feed_url" value="<?php 
echo esc_attr($gce_feed_url);
?>
" />
			<p class="description">
				<?php 
_e('The Google Calendar ID.', 'gce');
?>
 <?php 
_e('Example', 'gce');
?>
:<br/>
				<code>umsb0ekhivs1a2ubtq6vlqvcjk@group.calendar.google.com</code><br/>
				<a href="<?php 
echo gce_ga_campaign_url('http://wpdocs.philderksen.com/google-calendar-events/getting-started/find-calendar-id/', 'gce_lite', 'settings_link', 'docs');
?>
" target="_blank"><?php 
_e('How to find your Google Calendar ID', 'gce');
?>
</a>
			</p>
		</td>
	</tr>

	<?php 
$timezone_wordpress = gce_get_wp_timezone();
$timezone_default = $timezone_wordpress ? $timezone_wordpress : 'UTC';
$timezone_setting = esc_attr(get_post_meta($post->ID, '_feed_timezone_setting', true));
?>
	<tr>
Ejemplo n.º 3
0
<div>
	<ul>
		<li>
			<div class="dashicons dashicons-arrow-right-alt2"></div>
			<a href="<?php 
echo gce_ga_campaign_url('http://wpdocs.philderksen.com/google-calendar-events/', 'gce_lite', 'sidebar_link', 'docs');
?>
" target="_blank">
				<?php 
_e('Documentation', 'gce');
?>
</a>
		</li>
		<li>
			<div class="dashicons dashicons-arrow-right-alt2"></div>
			<a href="https://wordpress.org/support/plugin/google-calendar-events" target="_blank">
				<?php 
_e('Community support forums', 'gce');
?>
</a>
		</li>
		<li>
			<div class="dashicons dashicons-arrow-right-alt2"></div>
			<a href="https://www.getdrip.com/forms/9434542/submissions/new" target="_blank">
				<?php 
_e('Get notified of important updates', 'gce');
?>
</a>
		</li>
	</ul>
 /**
  * @since 2.4.0
  */
 public function show_admin_update_notices()
 {
     $message = '';
     $settings = get_option('gce_settings_general');
     $key = isset($settings['api_key']) ? $settings['api_key'] : '';
     if (empty($key) || 'AIzaSyAssdKVved1mPVY0UJCrx96OUOF9u17AuY' == $key) {
         $message .= '<h3>' . __('Google API Key Notice', 'gce') . '</h3>' . '<p>' . __('This plugin now requires you to use your own Google API key to avoid running into limit requests.', 'gce') . '</p>' . '<p><a href="' . admin_url('edit.php?post_type=gce_feed&page=google-calendar-events_general_settings') . '" class="button-primary">' . __('Enter your Google API key', 'gce') . '</a>&nbsp;&nbsp;&nbsp;&nbsp;' . '<a href="' . gce_ga_campaign_url('http://wpdocs.philderksen.com/google-calendar-events/getting-started/api-key-settings/', 'gce_lite', 'settings_link', 'docs') . '" class="button-secondary" target="_blank">' . __('Instructions', 'gce') . '</a>' . '</p>';
     }
     $message .= '<h3>' . __('Plugin Upgrade Notice', 'gce') . '</h3>' . '<p>' . __('Simple Calendar 3.0 is a pretty major update and will be released very soon.', 'gce') . '</p>' . '<p>' . __('To make sure you\'re prepared, you can ', 'gce') . '<a href="https://wordpress.org/support/topic/simple-calendar-30-beta-now-available" target="_blank">' . __('read about (and try out) the current beta here', 'gce') . '</a></p>' . '<p><a href="https://www.getdrip.com/forms/9434542/submissions/new" class="button-secondary" target="_blank">' . __('Get notified of important updates', 'gce') . '</a></p>';
     $url = add_query_arg(array('gce_dismiss_admin_update_notices' => true));
     $dismiss_icon = sprintf('<a class="dashicons-before dashicons-dismiss gce-dismiss-notice" href="%s"></a>', $url);
     $dismiss_link = sprintf('<p><a href="%s">' . __('Dismiss this notice', 'gce') . '</a></p>', $url);
     echo '<div class="notice error gce-dismissible-notice">' . $dismiss_icon . $message . $dismiss_link . '</div>';
 }