/**
  * Get the singleton instance of this class
  *
  * @return Yoast_Form
  */
 public static function get_instance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
    /**
     * 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&amp;media_0_0%5BcontrolsVisibleOnLoad%5D=false&amp;theme=bento&amp;version=v1&amp;videoOptions%5BautoPlay%5D=true&amp;videoOptions%5BvideoHeight%5D=450&amp;videoOptions%5BvideoWidth%5D=800&amp;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);
    }
/**
 * @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')) {
 /**
  * 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'));
 }
Exemple #5
0
/**
 * @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();
 /**
  * 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);
 }
 /**
  * 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;
 }
 /**
  * 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);
 }
    /**
     * 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&amp;utm_medium=inline-help&amp;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'>&nbsp;</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;
            }
        }
        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&amp;utm_medium=inline-help&amp;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'>&nbsp;</p>\n";
        // Open <form>.
        echo "<form id='regex' 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('REGEX');
        $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="settings" class="wpseotab">
				<?php 
        // Get redirect options.
        $redirect_options = WPSEO_Redirect_Manager::get_options();
        // Do file checks.
        if ('on' == $redirect_options['disable_php_redirect']) {
            $file_write_error = false;
            if (WPSEO_Utils::is_apache()) {
                if ('on' == $redirect_options['separate_file']) {
                    if (file_exists(WPSEO_Redirect_File_Manager::get_file_path())) {
                        echo '<div style="margin: 5px 0; padding: 3px 10px; background-color: #ffffe0; border: 1px solid #E6DB55; border-radius: 3px">';
                        echo '<p>' . __("As you're on Apache, you should add the following include to the website httpd config file:", 'wordpress-seo-premium') . '</p>';
                        echo '<pre>Include ' . WPSEO_Redirect_File_Manager::get_file_path() . '</pre>';
                        echo '</div>';
                    } else {
                        $file_write_error = true;
                    }
                } else {
                    if (!is_writable(WPSEO_Redirect_File_Manager::get_htaccess_file_path())) {
                        /* translators: %s: '.htaccess' file name */
                        echo "<div class='error'><p><b>" . sprintf(__('We\'re unable to save the redirects to your %s file. Please make the file writable.', 'wordpress-seo-premium'), '<code>.htaccess</code>') . "</b></p></div>\n";
                    }
                }
            } else {
                if (WPSEO_Utils::is_nginx()) {
                    if (file_exists(WPSEO_Redirect_File_Manager::get_file_path())) {
                        echo '<div style="margin: 5px 0; padding: 3px 10px; background-color: #ffffe0; border: 1px solid #E6DB55; border-radius: 3px">';
                        echo '<p>' . __('As you\'re on Nginx, you should add the following include to the NGINX config file:', 'wordpress-seo-premium') . '</p>';
                        echo '<pre>include ' . WPSEO_Redirect_File_Manager::get_file_path() . ';</pre>';
                        echo '</div>';
                    } else {
                        $file_write_error = true;
                    }
                }
            }
            if ($file_write_error) {
                echo "<div class='error'><p><b>" . __(sprintf("We're unable to save the redirect file to %s", WPSEO_Redirect_File_Manager::get_file_path()), 'wordpress-seo-premium') . "</b></p></div>\n";
            }
        }
        ?>
				<h2>Redirect Settings</h2>

				<form action="<?php 
        echo admin_url('options.php');
        ?>
" method="post">
					<?php 
        settings_fields('yoast_wpseo_redirect_options');
        Yoast_Form::get_instance()->set_option('wpseo_redirect');
        if (WPSEO_Utils::is_apache()) {
            echo Yoast_Form::get_instance()->checkbox('disable_php_redirect', __('Disable PHP redirects', 'wordpress-seo-premium'));
            /* translators: 1: '.htaccess' file name */
            echo '<p class="desc">' . sprintf(__('Write redirects to the %1$s file. Make sure the %1$s file is writable.', 'wordpress-seo-premium'), '<code>.htacces</code>') . '</p>';
            echo Yoast_Form::get_instance()->checkbox('separate_file', __('Generate a separate redirect file', 'wordpress-seo-premium'));
            /* translators: %s: '.htaccess' file name */
            echo '<p class="desc">' . sprintf(__('By default we write the redirects to your %s file, check this if you want the redirects written to a separate file. Only check this option if you know what you are doing!', 'wordpress-seo-premium'), '<code>.htaccess</code>') . '</p>';
        } else {
            echo Yoast_Form::get_instance()->checkbox('disable_php_redirect', __('Disable PHP redirects', 'wordpress-seo-premium'));
            /* translators: %s: 'Yoast SEO Premium' */
            echo '<p class="desc">' . sprintf(__('%s will generate redirect files that can be included in your website configuration. You can disable PHP redirect if this is done correctly. Only check this option if you know what you are doing!', 'wordpress-seo-premium'), 'Yoast SEO Premium') . '</p>';
        }
        ?>
					<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.
        Yoast_Form::get_instance()->admin_footer(false);
    }
 /**
  * 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;
 }
 /**
  * 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);
 }
Exemple #12
0
    /**
     * 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
        Yoast_Form::get_instance()->admin_footer(false);
    }
 /**
  * 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);
 }