本文整理汇总了PHP中Yoast_Form::get_instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Yoast_Form::get_instance方法的具体用法?PHP Yoast_Form::get_instance怎么用?PHP Yoast_Form::get_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yoast_Form
的用法示例。
在下文中一共展示了Yoast_Form::get_instance方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Function that outputs the redirect page
*/
public static function display()
{
// Licensing part.
$license_manager = new Yoast_Plugin_License_Manager(new WPSEO_Product_Premium());
// Setup constant name.
$license_manager->set_license_constant_name('WPSEO_LICENSE');
// Admin header.
Yoast_Form::get_instance()->admin_header(false);
if ($license_manager->license_is_valid()) {
?>
<div class="wpseo_content_cell">
<iframe src="//fast.wistia.net/embed/playlists/5t35e24abt?media_0_0%5BautoPlay%5D=false&media_0_0%5BcontrolsVisibleOnLoad%5D=false&theme=bento&version=v1&videoOptions%5BautoPlay%5D=true&videoOptions%5BvideoHeight%5D=450&videoOptions%5BvideoWidth%5D=800&videoOptions%5BvolumeControl%5D=true" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_playlist" name="wistia_playlist" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="1107" height="450"></iframe>
<br class="clear">
</div>
<br class="clear">
<?php
} else {
echo '<div class="wpseo-warning">';
/* translators: %s: 'Yoast SEO Premium' */
echo '<h2>' . sprintf(__('%s is inactive.', 'wordpress-seo-premium'), 'Yoast SEO Premium') . '</h2>';
if (current_user_can('manage_options')) {
/* translators: %s: 'Yoast SEO Premium' */
echo '<p>' . sprintf(__('Please activate %s to be able to see the videos.', 'wordpress-seo-premium'), 'Yoast SEO Premium') . '</p></div>';
} else {
/* translators: %s: 'Yoast SEO Premium' */
echo '<p>' . sprintf(__('Please ask your site administrator to activate %s to be able to see the videos.', 'wordpress-seo-premium'), 'Yoast SEO Premium') . '</p></div>';
}
}
// Admin footer.
Yoast_Form::get_instance()->admin_footer(false);
}
示例2: header
/**
* @package WPSEO\Admin
*/
if (!defined('WPSEO_VERSION')) {
header('Status: 403 Forbidden');
header('HTTP/1.1 403 Forbidden');
exit;
}
/**
* @todo [JRF => testers] Extensively test the export & import of the (new) settings!
* If that all works fine, getting testers to export before and after upgrade will make testing easier.
*
* @todo [Yoast] The import for the RSS Footer plugin checks for data already entered via Yoast SEO,
* the other import routines should do that too.
*/
$yform = Yoast_Form::get_instance();
$replace = false;
/**
* The import method is used to dermine if there should be something imported.
*
* In case of POST the user is on the Yoast SEO import page and in case of the GET the user sees a notice from
* Yoast SEO that we can import stuff for that plugin.
*/
if (filter_input(INPUT_POST, 'import') || filter_input(INPUT_GET, 'import')) {
check_admin_referer('wpseo-import');
$post_wpseo = filter_input(INPUT_POST, 'wpseo', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
$replace = !empty($post_wpseo['deleteolddata']) && $post_wpseo['deleteolddata'] === 'on';
if (!empty($post_wpseo['importwoo'])) {
$import = new WPSEO_Import_WooThemes_SEO($replace);
}
if (!empty($post_wpseo['importaioseo']) || filter_input(INPUT_GET, 'importaioseo')) {
示例3: admin_page_meta_post_types_checkboxes
/**
* This hook will add an input-field for specifying custom fields for page analysis.
*
* The values will be comma-seperated and will target the belonging field in the post_meta. Page analysis will
* use the content of it by sticking it to the post_content.
*
* @param array $wpseo_admin_pages
* @param string $name
*/
public function admin_page_meta_post_types_checkboxes($wpseo_admin_pages, $name)
{
echo Yoast_Form::get_instance()->textinput('page-analyse-extra-' . $name, __('Add custom fields to page analysis', 'wordpress-seo-premium'));
}
示例4: header
/**
* @package WPSEO\Admin
*/
if (!defined('WPSEO_VERSION')) {
header('Status: 403 Forbidden');
header('HTTP/1.1 403 Forbidden');
exit;
}
$active_tab = filter_input(INPUT_GET, 'tab');
$tabs = array('breadcrumbs' => array('label' => __('Breadcrumbs', 'wordpress-seo'), 'opt_group' => 'wpseo_internallinks'), 'permalinks' => array('label' => __('Permalinks', 'wordpress-seo'), 'opt_group' => 'wpseo_permalinks'), 'rss' => array('label' => __('RSS', 'wordpress-seo'), 'opt_group' => 'wpseo_rss'));
if ('' === $active_tab || !in_array($active_tab, array_keys($tabs))) {
$active_tab = 'breadcrumbs';
}
Yoast_Form::get_instance()->admin_header(true, $tabs[$active_tab]['opt_group']);
?>
<h2 class="nav-tab-wrapper">
<?php
foreach ($tabs as $tab_key => $tab_opt) {
$active = '';
if ($active_tab == $tab_key) {
$active = ' nav-tab-active';
}
echo '<a class="nav-tab' . $active . '" id="' . $tab_key . '-tab" href="' . admin_url('admin.php?page=wpseo_advanced&tab=' . $tab_key) . '">' . $tab_opt['label'] . '</a>';
}
?>
</h2>
<br/>
<?php
require_once WPSEO_PATH . 'admin/views/tab-' . $active_tab . '.php';
Yoast_Form::get_instance()->admin_footer();
示例5: radio
/**
* Create a Radio input field.
*
* @deprecated 2.0
*
* @param string $var The variable within the option to create the file upload field for.
* @param array $values The radio options to choose from.
* @param string $label The label to show for the variable.
* @param string $option The option the variable belongs to.
*/
function radio($var, $values, $label, $option = '')
{
_deprecated_function(__METHOD__, 'WPSEO 2.0', 'This method is deprecated, please use the <code>Yoast_Form</code> class.');
if ($option !== '') {
Yoast_Form::get_instance()->set_option($option);
}
Yoast_Form::get_instance()->radio($var, $values, $label);
}
示例6: manage_app_as_admin
/**
* Show input field to set a facebook apps as an admin
*
* @return $this
*/
private function manage_app_as_admin()
{
echo '<div class="clear"></div><br />';
Yoast_Form::get_instance()->textinput('fbadminapp', __('Facebook App ID', 'ymbeseo'));
return $this;
}
示例7: checkbox
/**
* Wrapper for checkbox method
*
* @param $var
* @param $label
* @param bool $label_left
* @param string $option
*
* @return mixed
*/
public static function checkbox($var, $label, $label_left = false, $option = '')
{
if (method_exists('Yoast_Form', 'checkbox')) {
if ($option !== '') {
Yoast_Form::get_instance()->set_option($option);
}
Yoast_Form::get_instance()->checkbox($var, $label, $label_left);
return;
}
return self::admin_pages()->checkbox($var, $label, $label_left, $option);
}
示例8: display
/**
* Function that outputs the redirect page
*/
public static function display()
{
// Check if there's an old URL set.
$old_url = '';
if (($old_url = filter_input(INPUT_GET, 'old_url')) != '') {
$old_url = urldecode($old_url);
}
// Get the redirect types.
$redirect_types = WPSEO_Redirect_Manager::get_redirect_types();
// Admin header.
Yoast_Form::get_instance()->admin_header(false, 'wpseo_redirects', false, 'yoast_wpseo_redirects_options');
?>
<h2 class="nav-tab-wrapper" id="wpseo-tabs">
<a class="nav-tab" id="tab-url-tab"
href="#top#tab-url"><?php
_e('Redirects', 'wordpress-seo-premium');
?>
</a>
<a class="nav-tab" id="tab-regex-tab"
href="#top#tab-regex"><?php
_e('Regex Redirects', 'wordpress-seo-premium');
?>
</a>
<a class="nav-tab" id="settings-tab"
href="#top#settings"><?php
_e('Settings', 'wordpress-seo-premium');
?>
</a>
</h2>
<div class="tabwrapper>">
<div id="tab-url" class="wpseotab redirect-table-tab">
<?php
// Add new redirect HTML.
echo "<form class='wpseo-new-redirect-form' method='post'>\n";
echo "<div class='wpseo_redirects_new'>\n";
// Echo "<h2>" . __( 'Add New Redirect', 'wordpress-seo' ) . "</h2>\n";.
echo "<label class='textinput' for='wpseo_redirects_new_old'>" . __('Old URL', 'wordpress-seo-premium') . "</label>\n";
echo "<input type='text' class='textinput' name='wpseo_redirects_new_old' id='wpseo_redirects_new_old' value='", esc_url($old_url) . "' />\n";
echo "<br class='clear'/>\n";
echo "<label class='textinput' for='wpseo_redirects_new_new'>" . __('New URL', 'wordpress-seo-premium') . "</label>\n";
echo "<input type='text' class='textinput' name='wpseo_redirects_new_new' id='wpseo_redirects_new_new' value='' />\n";
echo "<br class='clear'/>\n";
echo "<label class='textinput' for='wpseo_redirects_new_type'>" . _x('Type', 'noun', 'wordpress-seo-premium') . "</label>\n";
// Redirect type select element.
echo "<select name='wpseo_redirects_new_type' id='wpseo_redirects_new_type' class='select'>" . PHP_EOL;
// Loop through the redirect types.
if (count($redirect_types) > 0) {
foreach ($redirect_types as $type => $desc) {
echo "<option value='" . $type . "'>" . $desc . '</option>' . PHP_EOL;
}
}
echo '</select>' . PHP_EOL;
echo '<br />';
echo '<br />';
echo '<p class="label desc description">' . sprintf(__('The redirect type is the HTTP response code sent to the browser telling the browser what type of redirect is served.<br/><br/>Read <a href=\'%s\' target=\'_blank\'>this page</a> for more info.', 'wordpress-seo-premium'), 'http://kb.yoast.com/article/121-redirect-types/#utm_source=wordpress-seo-premium-redirects&utm_medium=inline-help&utm_campaign=redirect-types') . '</p>';
echo "<br class='clear'/>\n";
echo "<a href='javascript:;' class='button-primary'>" . __('Add Redirect', 'wordpress-seo-premium') . "</a>\n";
echo "</div>\n";
echo "</form>\n";
echo "<p class='desc'> </p>\n";
// Open <form>.
echo "<form id='url' class='wpseo-redirects-table-form' method='post' action=''>\n";
// AJAX nonce.
echo "<input type='hidden' class='wpseo_redirects_ajax_nonce' value='" . wp_create_nonce('wpseo-redirects-ajax-security') . "' />\n";
// The list table.
$list_table = new WPSEO_Redirect_Table('URL');
$list_table->prepare_items();
$list_table->search_box(__('Search', 'wordpress-seo-premium'), 'wpseo-redirect-search');
$list_table->display();
// Close <form>.
echo "</form>\n";
?>
</div>
<div id="tab-regex" class="wpseotab redirect-table-tab">
<?php
// Add new redirect HTML.
/* translators: %1$s contains a line break tag. %2$s links to our knowledge base, %3$s closes the link. */
echo '<p>' . sprintf(__('Regex Redirects are extremely powerful redirects. You should only use them if you know what you are doing.%1$sIf you don\'t know what Regular Expressions (regex) are, please refer to %2$sour knowledge base%3$s.', 'wordpress-seo-premium'), '<br />', '<a href="http://kb.yoast.com/article/142-what-are-regex-redirects" target="_blank">', '</a>') . "</p>\n";
echo "<form class='wpseo-new-redirect-form' method='post'>\n";
echo "<div class='wpseo_redirects_new'>\n";
// Echo "<h2>" . __( 'Add New Regex Redirect', 'wordpress-seo' ) . "</h2>\n";.
echo "<label class='textinput' for='wpseo_redirects_new_old'>" . __('Regular Expression', 'wordpress-seo-premium') . "</label>\n";
echo "<input type='text' class='textinput' name='wpseo_redirects_new_old' id='wpseo_redirects_new_old' value='{$old_url}' />\n";
echo "<br class='clear'/>\n";
echo "<label class='textinput' for='wpseo_redirects_new_new'>" . __('URL', 'wordpress-seo-premium') . "</label>\n";
echo "<input type='text' class='textinput' name='wpseo_redirects_new_new' id='wpseo_redirects_new_new' value='' />\n";
echo "<br class='clear'/>\n";
echo "<label class='textinput' for='wpseo_redirects_new_type'>" . _x('Type', 'noun', 'wordpress-seo-premium') . "</label>\n";
// Redirect type select element.
echo "<select name='wpseo_redirects_new_type' id='wpseo_redirects_new_type' class='select'>" . PHP_EOL;
// Loop through the redirect types.
if (count($redirect_types) > 0) {
foreach ($redirect_types as $key => $desc) {
echo "<option value='" . $key . "'>" . $desc . '</option>' . PHP_EOL;
}
}
//.........这里部分代码省略.........
示例9: filter_add_premium_import_options
/**
* Add premium import options to import list
*
* @param string $content
*
* @return string
*/
public function filter_add_premium_import_options($content)
{
$content .= Yoast_Form::get_instance()->checkbox('import_redirection', __('Import from Redirection?', 'wordpress-seo-premium'));
return $content;
}
示例10: admin_footer
/**
* Fallback for admin_footer
*
* @param bool $submit
* @param bool $show_sidebar
*
* @return mixed
*/
public static function admin_footer($submit = true, $show_sidebar = true)
{
if (method_exists('Yoast_Form', 'admin_footer')) {
Yoast_Form::get_instance()->admin_footer($submit, $show_sidebar);
return;
}
return self::admin_pages()->admin_footer($submit, $show_sidebar);
}
示例11: display
/**
* Function that outputs the redirect page
*/
public function display()
{
// Admin header
Yoast_Form::get_instance()->admin_header(false, 'wpseo_redirects', false, 'yoast_wpseo_redirects_options');
?>
<h2 class="nav-tab-wrapper" id="wpseo-tabs">
<form action="<?php
echo admin_url('admin.php') . '?page=' . esc_attr(filter_input(INPUT_GET, 'page'));
?>
" method="post">
<input type="submit" name="reload-crawl-issues" id="reload-crawl-issue" class="button-primary"
style="float: right;" value="<?php
_e('Reload crawl issues', 'wordpress-seo-premium');
?>
">
</form>
<a class="nav-tab" id="crawl-issues-tab"
href="#top#redirects"><?php
_e('Crawl Issues', 'wordpress-seo-premium');
?>
</a>
<a class="nav-tab" id="settings-tab"
href="#top#settings"><?php
_e('Settings', 'wordpress-seo-premium');
?>
</a>
</h2>
<div class="tabwrapper>">
<div id="crawl-issues" class="wpseotab">
<?php
// Create a new WPSEO GWT Google Client
$gwt_client = new WPSEO_GWT_Google_Client();
// Check if there is an access token
if (null != $gwt_client->getAccessToken()) {
//echo "<h2>Google Webmaster Tools Errors</h2>\n";
$status = '';
if (!empty($_GET['status'])) {
$status = "&status={$_GET['status']}";
}
// Open <form>
echo "<form id='wpseo-crawl-issues-table-form' action='" . admin_url('admin.php') . '?page=' . esc_attr($_GET['page']) . $status . "' method='post'>\n";
// AJAX nonce
echo "<input type='hidden' class='wpseo_redirects_ajax_nonce' value='" . wp_create_nonce('wpseo-redirects-ajax-security') . "' />\n";
// The list table
$list_table = new WPSEO_Crawl_Issue_Table($gwt_client);
$list_table->prepare_items();
$list_table->search_box(__('Search', 'wordpress-seo-premium'), 'wpseo-crawl-issues-search');
$list_table->display();
// Close <form>
echo "</form>\n";
} else {
// Get the oauth URL
$oath_url = $gwt_client->createAuthUrl();
// Print auth screen
echo "<p>" . __('To allow WordPress SEO Premium to fetch your Google Webmaster Tools information, please enter your Google Authorization Code.', 'wordpress-seo-premium') . "</p>\n";
echo "<a href='javascript:wpseo_gwt_open_authorize_code_window(\"{$oath_url}\");'>" . __('Click here to get a Google Authorization Code', 'wordpress-seo-premium') . "</a>\n";
echo "<p>" . __('Please enter the Authorization Code in the field below and press the Authenticate button.', 'wordpress-seo-premium') . "</p>\n";
echo "<form action='' method='post'>\n";
echo "<input type='text' name='gwt[authorization_code]' value='' />";
echo "<input type='hidden' name='gwt[gwt_nonce]' value='" . wp_create_nonce('wpseo-gwt_nonce') . "' />";
echo "<input type='submit' name='gwt[Submit]' value='" . __('Authenticate', 'wordpress-seo-premium') . "' class='button-primary' />";
echo "</form>\n";
}
?>
</div>
<div id="settings" class="wpseotab">
<h2>Google Webmaster Tools Settings</h2>
<form action="<?php
echo admin_url('options.php');
?>
" method="post">
<?php
settings_fields('yoast_wpseo_gwt_options');
Yoast_Form::get_instance()->set_option('wpseo-premium-gwt');
// Get the sites
$service = new WPSEO_GWT_Service($gwt_client);
$sites = $service->get_sites();
echo Yoast_Form::get_instance()->select('profile', __('Profile', 'wordpress-seo-premium'), $sites);
?>
<p class="submit">
<input type="submit" name="submit" id="submit" class="button button-primary"
value="<?php
_e('Save Changes', 'wordpress-seo-premium');
?>
">
</p>
</form>
</div>
</div>
<br class="clear">
<?php
// Admin footer
//.........这里部分代码省略.........
示例12: file_upload
/**
* Create a upload field.
*
* @param string $var The variable within the option to create the upload field for.
* @param string $option The option the variable belongs to.
*
* @return void|mixed
*/
public static function file_upload($var, $label = '', $option = '')
{
if (method_exists('Yoast_Form', 'file_upload')) {
if ($option !== '') {
Yoast_Form::get_instance()->set_option($option);
}
Yoast_Form::get_instance()->file_upload($var, $label);
return;
}
echo self::admin_pages()->file_upload($var, $label);
}