/**
  * Create a test select field
  *
  * @covers Yoast_GA_Admin_Form:select()
  */
 public function test_select()
 {
     Yoast_GA_Admin_Form::create_form('phpunit');
     $title = 'Test select';
     $name = 'test_select';
     $values = array();
     $values[] = array('id' => 1, 'name' => 'PHP Unit');
     $values[] = array('id' => 2, 'name' => 'Tests');
     $output = null;
     $output .= '<div class="ga-form ga-form-input"><label for="yoast-ga-form-select-phpunit-test_select" class="ga-form ga-form-select-label ga-form-label-left" id="yoast-ga-form-label-select-phpunit-' . $name . '">';
     $output .= $title . ':</label><select data-placeholder="" name="' . $name . '" id="yoast-ga-form-select-phpunit-' . $name . '">';
     $output .= '<option value="1" >PHP Unit</option><option value="2" >Tests</option></select></div>';
     $this->assertEquals(Yoast_GA_Admin_Form::select($title, $name, $values), $output);
 }
コード例 #2
0
ファイル: settings.php プロジェクト: StefanBonilla/CoupSoup
echo '<h2>' . __('Universal settings', 'google-analytics-for-wordpress') . '</h2>';
echo Yoast_GA_Admin_Form::input('checkbox', __('Enable Universal tracking', 'google-analytics-for-wordpress'), 'enable_universal', null, sprintf(__('First enable Universal tracking in your Google Analytics account. Please read %1$sthis guide%2$s to learn how to do that.', 'google-analytics-for-wordpress'), '<a href="http://kb.yoast.com/article/125-universal-analytics#utm_medium=kb-link&utm_source=gawp-config&utm_campaign=wpgaplugin" target="_blank">', '</a>'));
echo Yoast_GA_Admin_Form::input('checkbox', __('Enable Demographics and Interests Reports for Remarketing and Advertising', 'google-analytics-for-wordpress'), 'demographics', '<span id="yoast-ga-displayfeatures-warning">' . __('Note that usage of this function is affected by privacy and cookie laws around the world. Be sure to follow the laws that affect your target audience.', 'google-analytics-for-wordpress') . '</span>', sprintf(__('Check this setting to add the Demographics and Remarketing features to your Google Analytics tracking code. We\'ve written an article in our %1$sknowledge base%2$s about Demographics and Interest reports. For more information about Remarketing, we refer you to %3$sGoogle\'s documentation%2$s.', 'google-analytics-for-wordpress'), '<a href="http://kb.yoast.com/article/154-enable-demographics-and-interests-report-in-google-analytics/#utm_medium=kb-link&amp;utm_source=gawp-config&amp;utm_campaign=wpgaplugin" target="_blank">', '</a>', '<a href="https://support.google.com/analytics/answer/2444872?hl=' . get_locale() . '" target="_blank">'));
echo Yoast_GA_Admin_Form::input('checkbox', __('Enhanced Link Attribution', 'google-analytics-for-wordpress'), 'enhanced_link_attribution', null, sprintf(__('Add %1$sEnhanced Link Attribution%2$s to your tracking code.', 'google-analytics-for-wordpress'), '<a href="https://support.google.com/analytics/answer/2558867" target="_blank">', ' </a>'));
/**
 * Action: 'yst_ga_universal_tab' - Allow adding to the universal tab of the settings
 */
do_action('yst_ga_universal_tab');
?>
	</div>
	<div id="advanced" class="gatab">
		<?php 
echo '<h2>' . __('Advanced settings', 'google-analytics-for-wordpress') . '</h2>';
echo Yoast_GA_Admin_Form::select(__('Track downloads as', 'google-analytics-for-wordpress'), 'track_download_as', $yoast_ga_admin->track_download_types(), __('Not recommended, as this would skew your statistics, but it does make it possible to track downloads as goals.', 'google-analytics-for-wordpress'));
echo Yoast_GA_Admin_Form::input('text', __('Extensions of files to track as downloads', 'google-analytics-for-wordpress'), 'extensions_of_files', null, 'Please separate extensions using commas');
echo Yoast_GA_Admin_Form::select(__('Track full URL of outbound clicks or just the domain', 'google-analytics-for-wordpress'), 'track_full_url', $yoast_ga_admin->get_track_full_url());
echo Yoast_GA_Admin_Form::input('text', __('Subdomain tracking', 'google-analytics-for-wordpress'), 'subdomain_tracking', null, sprintf(__('This allows you to set the domain that\'s set by %1$s for tracking subdomains.<br/>If empty, this will not be set.', 'google-analytics-for-wordpress'), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory#_gat.GA_Tracker_._setDomainName" target="_blank"><code>_setDomainName</code></a>'));
echo Yoast_GA_Admin_Form::input('text', __('Set path for internal links to track as outbound links', 'google-analytics-for-wordpress'), 'track_internal_as_outbound', null, sprintf(__('If you want to track all internal links that begin with %1$s, enter %1$s in the box above. If you have multiple prefixes you can separate them with comma\'s: %2$s', 'google-analytics-for-wordpress'), '<code>/out/</code>', '<code>/out/,/recommends/</code>'));
echo Yoast_GA_Admin_Form::input('text', __('Label for those links', 'google-analytics-for-wordpress'), 'track_internal_as_label', null, 'The label to use for these links, this will be added to where the click came from, so if the label is "aff", the label for a click from the content of an article becomes "outbound-article-aff".');
echo Yoast_GA_Admin_Form::input('checkbox', __('Tag links in RSS feed with campaign variables', 'google-analytics-for-wordpress'), 'tag_links_in_rss', null, __('Do not use this feature if you use FeedBurner, as FeedBurner can do this automatically and better than this plugin can. Check <a href="https://support.google.com/feedburner/answer/165769?hl=en&amp;ref_topic=13075" target="_blank">this help page</a> for info on how to enable this feature in FeedBurner.', 'google-analytics-for-wordpress'));
echo Yoast_GA_Admin_Form::input('checkbox', __('Allow anchor', 'google-analytics-for-wordpress'), 'allow_anchor', null, sprintf(__('This adds a %1$s call to your tracking code, and makes RSS link tagging use a %2$s as well.', 'google-analytics-for-wordpress'), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiCampaignTracking?csw=1#_gat.GA_Tracker_._setAllowAnchor" target="_blank"><code>_setAllowAnchor</code></a>', '<code>#</code>'));
echo Yoast_GA_Admin_Form::input('checkbox', __('Add <code>_setAllowLinker</code>', 'google-analytics-for-wordpress'), 'add_allow_linker', null, sprintf(__('This adds a %1$s call to your tracking code, allowing you to use %2$s and related functions.', 'google-analytics-for-wordpress'), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory?csw=1#_gat.GA_Tracker_._setAllowLinker" target="_blank"><code>_setAllowLinker</code></a>', ' <code>_link</code>'));
if (current_user_can('unfiltered_html')) {
    echo Yoast_GA_Admin_Form::textarea(__('Custom code', 'google-analytics-for-wordpress'), 'custom_code', sprintf(__('Not for the average user: this allows you to add a line of code, to be added before the %1$s call.', 'google-analytics-for-wordpress'), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration#_gat.GA_Tracker_._trackPageview" target="_blank"><code>_trackPageview</code></a>'));
}
/**
 * Action: 'yst_ga_advanced-tab' - Allow adding to the advanced tab of the settings
 */
do_action('yst_ga_advanced-tab');
?>
	</div>