Whale ahoy
No files matched your search
@@ -1,3 +1,4 @@
|
||||
*.swp
|
||||
*~
|
||||
wp-settings.php
|
||||
wp-config.php
|
||||
.sass-cache
|
||||
@@ -1,82 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* The base configurations of the WordPress.
|
||||
* Grunnkonfigurasjonen til WordPress.
|
||||
*
|
||||
* This file has the following configurations: MySQL settings, Table Prefix,
|
||||
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
|
||||
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
|
||||
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
|
||||
*
|
||||
* This file is used by the wp-config.php creation script during the
|
||||
* installation. You don't have to use the web site, you can just copy this file
|
||||
* to "wp-config.php" and fill in the values.
|
||||
* Denne filen inneholder følgende konfigurasjoner: MySQL-innstillinger, tabellprefiks,
|
||||
* hemmelige nøkler, WordPress-språk og ABSPATH. Du kan finne mer informasjon
|
||||
* ved å besøke {@link http://codex.wordpress.org/Editing_wp-config.php Editing
|
||||
* wp-config.php} Codex-siden. Du kan få MySQL-innstillingene fra din nettjener.
|
||||
*
|
||||
* Denne filen brukes av koden som lager wp-config.php i løpet av
|
||||
* installasjonen. Du trenger ikke å bruke nettstedet til å gjøre det, du trenger bare
|
||||
* å kopiere denne filen til "wp-config.php" og fylle inn verdiene.
|
||||
*
|
||||
* @package WordPress
|
||||
*/
|
||||
|
||||
// ** MySQL settings - You can get this info from your web host ** //
|
||||
/** The name of the database for WordPress */
|
||||
// ** MySQL-innstillinger - Dette får du fra din nettjener ** //
|
||||
/** Navnet på WordPress-databasen */
|
||||
define('DB_NAME', 'database_name_here');
|
||||
|
||||
/** MySQL database username */
|
||||
/** MySQL-databasens brukernavn */
|
||||
define('DB_USER', 'username_here');
|
||||
|
||||
/** MySQL database password */
|
||||
/** MySQL-databasens passord */
|
||||
define('DB_PASSWORD', 'password_here');
|
||||
|
||||
/** MySQL hostname */
|
||||
/** MySQL-tjener */
|
||||
define('DB_HOST', 'localhost');
|
||||
|
||||
/** Database Charset to use in creating database tables. */
|
||||
/** Tegnsettet som skal brukes i databasen for å lage tabeller. */
|
||||
define('DB_CHARSET', 'utf8');
|
||||
|
||||
/** The Database Collate type. Don't change this if in doubt. */
|
||||
/** Databasens "Collate"-type. La denne være hvis du er i tvil. */
|
||||
define('DB_COLLATE', '');
|
||||
|
||||
/**#@+
|
||||
* Authentication Unique Keys and Salts.
|
||||
* Autentiseringsnøkler og salter.
|
||||
*
|
||||
* Change these to different unique phrases!
|
||||
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
|
||||
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
|
||||
* Endre disse til unike nøkler!
|
||||
* Du kan generere nøkler med {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
|
||||
* Du kan når som helst endre disse nøklene for å gjøre aktive cookies ugyldige. Dette vil tvinge alle brukere å logge inn igjen.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
define('AUTH_KEY', 'put your unique phrase here');
|
||||
define('SECURE_AUTH_KEY', 'put your unique phrase here');
|
||||
define('LOGGED_IN_KEY', 'put your unique phrase here');
|
||||
define('NONCE_KEY', 'put your unique phrase here');
|
||||
define('AUTH_SALT', 'put your unique phrase here');
|
||||
define('SECURE_AUTH_SALT', 'put your unique phrase here');
|
||||
define('LOGGED_IN_SALT', 'put your unique phrase here');
|
||||
define('NONCE_SALT', 'put your unique phrase here');
|
||||
define('AUTH_KEY', 'angi din unike nøkkel her');
|
||||
define('SECURE_AUTH_KEY', 'angi din unike nøkkel her');
|
||||
define('LOGGED_IN_KEY', 'angi din unike nøkkel her');
|
||||
define('NONCE_KEY', 'angi din unike nøkkel her');
|
||||
define('AUTH_SALT', 'angi din unike nøkkel her');
|
||||
define('SECURE_AUTH_SALT', 'angi din unike nøkkel her');
|
||||
define('LOGGED_IN_SALT', 'angi din unike nøkkel her');
|
||||
define('NONCE_SALT', 'angi din unike nøkkel her');
|
||||
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* WordPress Database Table prefix.
|
||||
* WordPress-databasens tabellprefiks.
|
||||
*
|
||||
* You can have multiple installations in one database if you give each a unique
|
||||
* prefix. Only numbers, letters, and underscores please!
|
||||
* Du kan ha flere installasjoner i en databasehvis du gir dem hver deres unike
|
||||
* prefiks. Kun tall, bokstaver og understrek (_), takk!
|
||||
*/
|
||||
$table_prefix = 'wp_';
|
||||
|
||||
/**
|
||||
* WordPress Localized Language, defaults to English.
|
||||
* WordPress-språk, forhåndsinnstilt til norsk (bokmål).
|
||||
*
|
||||
* Change this to localize WordPress. A corresponding MO file for the chosen
|
||||
* language must be installed to wp-content/languages. For example, install
|
||||
* de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
|
||||
* language support.
|
||||
* Du kan endre denne linjen for å bruke WordPress på et annet språk. En tilsvarende MO-fil for
|
||||
* det valgte språket må installeres i wp-content/languages. For eksempel, installer
|
||||
* de.mo i wp-content/languages og sett WPLANG til 'de' for å aktivere språkstøtte
|
||||
* på tysk.
|
||||
*/
|
||||
define('WPLANG', '');
|
||||
define('WPLANG', 'nb_NO');
|
||||
|
||||
/**
|
||||
* For developers: WordPress debugging mode.
|
||||
* For utviklere: WordPress-feilsøkingstilstand.
|
||||
*
|
||||
* Change this to true to enable the display of notices during development.
|
||||
* It is strongly recommended that plugin and theme developers use WP_DEBUG
|
||||
* in their development environments.
|
||||
* Sett denne til "true" for å aktivere visning av meldinger under utvikling.
|
||||
* Det er sterkt anbefalt at innstikks- og tema-utviklere bruker WP_DEBUG
|
||||
* i deres utviklermiljøer.
|
||||
*/
|
||||
define('WP_DEBUG', false);
|
||||
|
||||
|
||||
@@ -0,0 +1,576 @@
|
||||
# Translation of Twenty Eleven in Norwegian (Bokmål)
|
||||
# This file is distributed under the same license as the Twenty Eleven package.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"PO-Revision-Date: 2013-01-25 11:15:47+0000\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: GlotPress/0.1\n"
|
||||
"Project-Id-Version: Twenty Eleven\n"
|
||||
|
||||
#: 404.php:17
|
||||
msgid "This is somewhat embarrassing, isn’t it?"
|
||||
msgstr "Dette er litt flaut, ikke sant?"
|
||||
|
||||
#: 404.php:21
|
||||
msgid "It seems we can’t find what you’re looking for. Perhaps searching, or one of the links below, can help."
|
||||
msgstr "Det synes ikke som at vi kan finne det du leter etter. Kanskje det hjelper å søke, eller å sjekke en av lenkene nedenfor."
|
||||
|
||||
#: 404.php:28
|
||||
msgid "Most Used Categories"
|
||||
msgstr "Mest brukte kategorier"
|
||||
|
||||
#: 404.php:36
|
||||
msgid "Try looking in the monthly archives. %1$s"
|
||||
msgstr "Prøv å se i de månedlige arkivene. %1$s"
|
||||
|
||||
#: archive.php:25
|
||||
msgid "Daily Archives: %s"
|
||||
msgstr "Daglige arkiver: %s"
|
||||
|
||||
#: archive.php:27
|
||||
msgid "Monthly Archives: %s"
|
||||
msgstr "Månedlige arkiver: %s"
|
||||
|
||||
#: archive.php:27
|
||||
msgctxt "monthly archives date format"
|
||||
msgid "F Y"
|
||||
msgstr "F Y"
|
||||
|
||||
#: archive.php:29
|
||||
msgid "Yearly Archives: %s"
|
||||
msgstr "Årlige arkiver: %s"
|
||||
|
||||
#: archive.php:29
|
||||
msgctxt "yearly archives date format"
|
||||
msgid "Y"
|
||||
msgstr "Y"
|
||||
|
||||
#: archive.php:31
|
||||
msgid "Blog Archives"
|
||||
msgstr "Bloggarkiv"
|
||||
|
||||
#: archive.php:57 author.php:74 category.php:50 index.php:37 search.php:42
|
||||
#: tag.php:50
|
||||
msgid "Nothing Found"
|
||||
msgstr "Ingenting funnet"
|
||||
|
||||
#: archive.php:61 author.php:78 category.php:54 index.php:41 tag.php:54
|
||||
msgid "Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post."
|
||||
msgstr "Beklager, men det ble ikke funnet noe i dette arkivet. Kanskje et søk vil hjelpe deg å finne et relatert innlegg."
|
||||
|
||||
#: author.php:28
|
||||
msgid "Author Archives: %s"
|
||||
msgstr "Forfatterarkiv: %s"
|
||||
|
||||
#: author.php:49 content-single.php:60
|
||||
msgid "About %s"
|
||||
msgstr "Om %s"
|
||||
|
||||
#: category.php:19
|
||||
msgid "Category Archives: %s"
|
||||
msgstr "Kategoriarkiv: %s"
|
||||
|
||||
#: comments.php:17
|
||||
msgid "This post is password protected. Enter the password to view any comments."
|
||||
msgstr "Dette innlegget er passordbeskyttet. Skriv inn passordet for å vise kommentarene."
|
||||
|
||||
#: comments.php:33
|
||||
msgid "One thought on “%2$s”"
|
||||
msgid_plural "%1$s thoughts on “%2$s”"
|
||||
msgstr[0] "En tanke om “%2$s”"
|
||||
msgstr[1] "%1$s tanker om “%2$s”"
|
||||
|
||||
#: comments.php:40 comments.php:60
|
||||
msgid "Comment navigation"
|
||||
msgstr "Kommentarnavigasjon"
|
||||
|
||||
#: comments.php:41 comments.php:61
|
||||
msgid "← Older Comments"
|
||||
msgstr "← Eldre kommentarer"
|
||||
|
||||
#: comments.php:42 comments.php:62
|
||||
msgid "Newer Comments →"
|
||||
msgstr "Nyere kommentarer →"
|
||||
|
||||
#: comments.php:71
|
||||
msgid "Comments are closed."
|
||||
msgstr "Det er stengt for kommentarer."
|
||||
|
||||
#: content-aside.php:16 content-featured.php:14 content-gallery.php:16
|
||||
#: content-gallery.php:48 content-image.php:15 content-link.php:16
|
||||
#: content-quote.php:14 content-status.php:15 content.php:15 content.php:19
|
||||
#: inc/widgets.php:89 showcase.php:120 showcase.php:199
|
||||
msgid "Permalink to %s"
|
||||
msgstr "Permalenke til %s"
|
||||
|
||||
#: content-aside.php:17
|
||||
msgid "Aside"
|
||||
msgstr "Notis"
|
||||
|
||||
#: content-aside.php:22 content-image.php:21 content-link.php:22
|
||||
#: content-quote.php:24 content-status.php:21 content.php:30
|
||||
msgid "Reply"
|
||||
msgstr "Svar"
|
||||
|
||||
#: content-aside.php:22 content-image.php:21 content-link.php:22
|
||||
#: content-quote.php:24 content-status.php:21 content.php:30
|
||||
msgctxt "comments number"
|
||||
msgid "1"
|
||||
msgstr "1"
|
||||
|
||||
#: content-aside.php:22 content-image.php:21 content-link.php:22
|
||||
#: content-quote.php:24 content-status.php:21 content.php:30
|
||||
msgctxt "comments number"
|
||||
msgid "%"
|
||||
msgstr "%"
|
||||
|
||||
#: content-aside.php:33 content-gallery.php:32 content-image.php:27
|
||||
#: content-link.php:33 content-quote.php:35 content-status.php:34
|
||||
#: content.php:41 functions.php:345
|
||||
msgid "Continue reading <span class=\"meta-nav\">→</span>"
|
||||
msgstr "Les videre <span class=\"meta-nav\">→</span>"
|
||||
|
||||
#: content-aside.php:34 content-featured.php:23 content-gallery.php:54
|
||||
#: content-image.php:28 content-intro.php:18 content-link.php:34
|
||||
#: content-page.php:18 content-quote.php:36 content-single.php:24
|
||||
#: content-status.php:35 content.php:42 image.php:90
|
||||
msgid "Pages:"
|
||||
msgstr "Sider:"
|
||||
|
||||
#: content-aside.php:42 content-gallery.php:87 content-image.php:64
|
||||
#: content-link.php:42 content-quote.php:69 content-status.php:43
|
||||
#: content.php:79 showcase.php:201
|
||||
msgid "Leave a reply"
|
||||
msgstr "Skriv en kommentar"
|
||||
|
||||
#: content-aside.php:42 content-gallery.php:87 content-image.php:64
|
||||
#: content-link.php:42 content-quote.php:69 content-status.php:43
|
||||
#: content.php:79 showcase.php:201
|
||||
msgid "<b>1</b> Reply"
|
||||
msgstr "<b>1</b> svar"
|
||||
|
||||
#: content-aside.php:42 content-gallery.php:87 content-image.php:64
|
||||
#: content-link.php:42 content-quote.php:69 content-status.php:43
|
||||
#: content.php:79 showcase.php:201
|
||||
msgid "<b>%</b> Replies"
|
||||
msgstr "<b>%</b> svar"
|
||||
|
||||
#: content-aside.php:44 content-featured.php:45 content-gallery.php:90
|
||||
#: content-image.php:68 content-intro.php:19 content-link.php:44
|
||||
#: content-page.php:21 content-quote.php:72 content-single.php:52
|
||||
#: content-status.php:45 content.php:82 functions.php:525 functions.php:553
|
||||
#: image.php:41
|
||||
msgid "Edit"
|
||||
msgstr "Rediger"
|
||||
|
||||
#: content-featured.php:29 content-featured.php:38 content-gallery.php:62
|
||||
#: content-gallery.php:72 content-image.php:47 content-image.php:56
|
||||
#: content-quote.php:44 content-quote.php:54 content-single.php:30
|
||||
#: content-single.php:33 content.php:51 content.php:63
|
||||
msgid ", "
|
||||
msgstr ", "
|
||||
|
||||
#: content-featured.php:31
|
||||
msgid "This entry was posted in %1$s and tagged %2$s. Bookmark the <a href=\"%3$s\" title=\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>."
|
||||
msgstr "Dette innlegget ble publisert i %1$s og merket med %2$s. Bokmerk <a href=\"%3$s\" title=\"Permalenke til %4$s\" rel=\"bookmark\">permalenken</a>."
|
||||
|
||||
#: content-featured.php:33
|
||||
msgid "This entry was posted in %1$s. Bookmark the <a href=\"%3$s\" title=\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>."
|
||||
msgstr "Dette innlegget ble skrevet i %1$s. Bokmerk <a href=\"%3$s\" title=\"Permalenken til %4$s\" rel=\"bookmark\">permalenken</a>."
|
||||
|
||||
#: content-gallery.php:17
|
||||
msgid "Gallery"
|
||||
msgstr "Galleri"
|
||||
|
||||
#: content-gallery.php:47
|
||||
msgid "This gallery contains <a %1$s>%2$s photo</a>."
|
||||
msgid_plural "This gallery contains <a %1$s>%2$s photos</a>."
|
||||
msgstr[0] "Dette galleriet inneholder <a %1$s>%2$s bilde</a>."
|
||||
msgstr[1] "Dette galleriet inneholder <a %1$s>%2$s bilder</a>."
|
||||
|
||||
#: content-gallery.php:66 content-image.php:51 content-quote.php:48
|
||||
#: content.php:55
|
||||
msgid "<span class=\"%1$s\">Posted in</span> %2$s"
|
||||
msgstr "<span class=\"%1$s\">Skrevet i</span> %2$s"
|
||||
|
||||
#: content-gallery.php:78 content-image.php:59 content-quote.php:60
|
||||
#: content.php:69
|
||||
msgid "<span class=\"%1$s\">Tagged</span> %2$s"
|
||||
msgstr "<span class=\"%1$s\">Merket</span> %2$s"
|
||||
|
||||
#: content-image.php:16
|
||||
msgid "Image"
|
||||
msgstr "Bilde"
|
||||
|
||||
#: content-image.php:34
|
||||
msgid "<a href=\"%1$s\" rel=\"bookmark\"><time class=\"entry-date\" datetime=\"%2$s\">%3$s</time></a><span class=\"by-author\"> <span class=\"sep\"> by </span> <span class=\"author vcard\"><a class=\"url fn n\" href=\"%4$s\" title=\"%5$s\" rel=\"author\">%6$s</a></span></span>"
|
||||
msgstr "<a href=\"%1$s\" rel=\"bookmark\"><time class=\"entry-date\" datetime=\"%2$s\">%3$s</time></a><span class=\"by-author\"> <span class=\"sep\"> av </span> <span class=\"author vcard\"><a class=\"url fn n\" href=\"%4$s\" title=\"%5$s\" rel=\"author\">%6$s</a></span></span>"
|
||||
|
||||
#: content-image.php:39 functions.php:590
|
||||
msgid "View all posts by %s"
|
||||
msgstr "Vis alle innlegg av %s"
|
||||
|
||||
#: content-link.php:17
|
||||
msgid "Link"
|
||||
msgstr "Lenke"
|
||||
|
||||
#: content-quote.php:15
|
||||
msgid "Quote"
|
||||
msgstr "Sitat"
|
||||
|
||||
#: content-single.php:35
|
||||
msgid "This entry was posted in %1$s and tagged %2$s by <a href=\"%6$s\">%5$s</a>. Bookmark the <a href=\"%3$s\" title=\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>."
|
||||
msgstr "Dette innlegget ble skrevet i %1$s og merket %2$s av <a href=\"%6$s\">%5$s</a>. Bokmerk <a href=\"%3$s\" title=\"Permalenken til %4$s\" rel=\"bookmark\">permalenken</a>."
|
||||
|
||||
#: content-single.php:37
|
||||
msgid "This entry was posted in %1$s by <a href=\"%6$s\">%5$s</a>. Bookmark the <a href=\"%3$s\" title=\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>."
|
||||
msgstr "Dette innlegget ble publisert i %1$s av <a href=\"%6$s\">%5$s</a>. Bokmerk <a href=\"%3$s\" title=\"Permalenken til %4$s\" rel=\"bookmark\">permalenken</a>."
|
||||
|
||||
#: content-single.php:39
|
||||
msgid "This entry was posted by <a href=\"%6$s\">%5$s</a>. Bookmark the <a href=\"%3$s\" title=\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>."
|
||||
msgstr "Dette ble publisert av <a href=\"%6$s\">%5$s</a>. Bokmerk <a href=\"%3$s\" title=\"Permalenken til %4$s\" rel=\"bookmark\">permalenken</a>."
|
||||
|
||||
#: content-single.php:64
|
||||
msgid "View all posts by %s <span class=\"meta-nav\">→</span>"
|
||||
msgstr "Les alle innlegg av %s <span class=\"meta-nav\">→</span>"
|
||||
|
||||
#: content-status.php:16
|
||||
msgid "Status"
|
||||
msgstr "Status"
|
||||
|
||||
#: content.php:16
|
||||
msgid "Featured"
|
||||
msgstr "Fremhevet"
|
||||
|
||||
#: footer.php:27
|
||||
msgid "http://wordpress.org/"
|
||||
msgstr "http://wordpress.org/"
|
||||
|
||||
#: footer.php:27
|
||||
msgid "Semantic Personal Publishing Platform"
|
||||
msgstr "Semantisk, personlig publiseringsplattform"
|
||||
|
||||
#: footer.php:27
|
||||
msgid "Proudly powered by %s"
|
||||
msgstr "Stolt drevet av %s"
|
||||
|
||||
#: functions.php:95
|
||||
msgid "Primary Menu"
|
||||
msgstr "Primærmeny"
|
||||
|
||||
#: functions.php:164
|
||||
msgid "Wheel"
|
||||
msgstr "Hjul"
|
||||
|
||||
#: functions.php:170
|
||||
msgid "Shore"
|
||||
msgstr "Kyst"
|
||||
|
||||
#: functions.php:176
|
||||
msgid "Trolley"
|
||||
msgstr "Trikk"
|
||||
|
||||
#: functions.php:182
|
||||
msgid "Pine Cone"
|
||||
msgstr "Kongle"
|
||||
|
||||
#: functions.php:188
|
||||
msgid "Chessboard"
|
||||
msgstr "Sjakkbrett"
|
||||
|
||||
#: functions.php:194
|
||||
msgid "Lanterns"
|
||||
msgstr "Lanterner"
|
||||
|
||||
#: functions.php:200
|
||||
msgid "Willow"
|
||||
msgstr "Piletre"
|
||||
|
||||
#: functions.php:206
|
||||
msgid "Hanoi Plant"
|
||||
msgstr "Hanoi-plante"
|
||||
|
||||
#: functions.php:394
|
||||
msgid "Main Sidebar"
|
||||
msgstr "Primær sidekolonne"
|
||||
|
||||
#: functions.php:403
|
||||
msgid "Showcase Sidebar"
|
||||
msgstr "Sidekolonne for ustillingsvindu"
|
||||
|
||||
#: functions.php:405
|
||||
msgid "The sidebar for the optional Showcase Template"
|
||||
msgstr "Sidekolonnen for den valgfrie Ustillingsvindu-malen"
|
||||
|
||||
#: functions.php:413
|
||||
msgid "Footer Area One"
|
||||
msgstr "Sidebunnområde én"
|
||||
|
||||
#: functions.php:415 functions.php:425 functions.php:435
|
||||
msgid "An optional widget area for your site footer"
|
||||
msgstr "Et valgfritt widget-område for ditt nettstedets sidebunn"
|
||||
|
||||
#: functions.php:423
|
||||
msgid "Footer Area Two"
|
||||
msgstr "Sidebunnområde to"
|
||||
|
||||
#: functions.php:433
|
||||
msgid "Footer Area Three"
|
||||
msgstr "Sidebunnområde tre"
|
||||
|
||||
#: functions.php:453 single.php:18
|
||||
msgid "Post navigation"
|
||||
msgstr "Innleggsnavigasjon"
|
||||
|
||||
#: functions.php:454
|
||||
msgid "<span class=\"meta-nav\">←</span> Older posts"
|
||||
msgstr "<span class=\"meta-nav\">←</span> Eldre innlegg"
|
||||
|
||||
#: functions.php:455
|
||||
msgid "Newer posts <span class=\"meta-nav\">→</span>"
|
||||
msgstr "Nyere innlegg <span class=\"meta-nav\">→</span>"
|
||||
|
||||
#: functions.php:525
|
||||
msgid "Pingback:"
|
||||
msgstr "Tilbaketråkk:"
|
||||
|
||||
#: functions.php:542
|
||||
msgid "%1$s on %2$s <span class=\"says\">said:</span>"
|
||||
msgstr "%2$s <span class=\"says\">sa</span> %1$s:"
|
||||
|
||||
#: functions.php:548
|
||||
msgid "%1$s at %2$s"
|
||||
msgstr "%1$s, kl. %2$s"
|
||||
|
||||
#: functions.php:557
|
||||
msgid "Your comment is awaiting moderation."
|
||||
msgstr "Din kommentar avventer moderasjon."
|
||||
|
||||
#: functions.php:566
|
||||
msgid "Reply <span>↓</span>"
|
||||
msgstr "Svar <span>↓</span>"
|
||||
|
||||
#: functions.php:584
|
||||
msgid "<span class=\"sep\">Posted on </span><a href=\"%1$s\" title=\"%2$s\" rel=\"bookmark\"><time class=\"entry-date\" datetime=\"%3$s\">%4$s</time></a><span class=\"by-author\"> <span class=\"sep\"> by </span> <span class=\"author vcard\"><a class=\"url fn n\" href=\"%5$s\" title=\"%6$s\" rel=\"author\">%7$s</a></span></span>"
|
||||
msgstr "<span class=\"sep\">Publisert </span><a href=\"%1$s\" title=\"%2$s\" rel=\"bookmark\"><time class=\"entry-date\" datetime=\"%3$s\">%4$s</time></a><span class=\"by-author\"> <span class=\"sep\"> av </span> <span class=\"author vcard\"><a class=\"url fn n\" href=\"%5$s\" title=\"%6$s\" rel=\"author\">%7$s</a></span></span>"
|
||||
|
||||
#: header.php:45
|
||||
msgid "Page %s"
|
||||
msgstr "Side %s"
|
||||
|
||||
#: header.php:129
|
||||
msgid "Main menu"
|
||||
msgstr "Hovedmeny"
|
||||
|
||||
#: header.php:131
|
||||
msgid "Skip to primary content"
|
||||
msgstr "Gå direkte til hovedinnholdet"
|
||||
|
||||
#: header.php:132
|
||||
msgid "Skip to secondary content"
|
||||
msgstr "Gå direkte til sekundærinnholdet"
|
||||
|
||||
#: image.php:18
|
||||
msgid "Image navigation"
|
||||
msgstr "Bildenavigasjon"
|
||||
|
||||
#: image.php:19
|
||||
msgid "← Previous"
|
||||
msgstr "← Forrige"
|
||||
|
||||
#: image.php:20
|
||||
msgid "Next →"
|
||||
msgstr "Neste →"
|
||||
|
||||
#: image.php:30
|
||||
msgid "<span class=\"meta-prep meta-prep-entry-date\">Published </span> <span class=\"entry-date\"><abbr class=\"published\" title=\"%1$s\">%2$s</abbr></span> at <a href=\"%3$s\" title=\"Link to full-size image\">%4$s × %5$s</a> in <a href=\"%6$s\" title=\"Return to %7$s\" rel=\"gallery\">%8$s</a>"
|
||||
msgstr "<span class=\"meta-prep meta-prep-entry-date\">Publisert </span> <span class=\"entry-date\"><abbr class=\"published\" title=\"%1$s\">%2$s</abbr></span> @ <a href=\"%3$s\" title=\"Lenke til originalbildet\">%4$s × %5$s</a> i <a href=\"%6$s\" title=\"Tilbake til %7$s\" rel=\"gallery\">%8$s</a>"
|
||||
|
||||
#: inc/theme-options.php:55 inc/theme-options.php:474
|
||||
msgid "Color Scheme"
|
||||
msgstr "Fargeskjema"
|
||||
|
||||
#: inc/theme-options.php:61 inc/theme-options.php:491
|
||||
msgid "Link Color"
|
||||
msgstr "Lenkefarge"
|
||||
|
||||
#: inc/theme-options.php:62
|
||||
msgid "Default Layout"
|
||||
msgstr "Standardutsende"
|
||||
|
||||
#: inc/theme-options.php:94 inc/theme-options.php:95
|
||||
msgid "Theme Options"
|
||||
msgstr "Temavalg"
|
||||
|
||||
#: inc/theme-options.php:110
|
||||
msgid "Some themes provide customization options that are grouped together on a Theme Options screen. If you change themes, options may change or disappear, as they are theme-specific. Your current theme, Twenty Eleven, provides the following Theme Options:"
|
||||
msgstr "Noen temaer har egne tema-funksjoner gruppert under Utseende i hovedmenyen. Hvis du skifter tema, kan dine valg endres eller forsvinne, siden de er spesifikke for temaene. Ditt nåværende tema, Twenty Eleven, tilbyr disse spesifikke tema-funksjonene:"
|
||||
|
||||
#: inc/theme-options.php:112
|
||||
msgid "<strong>Color Scheme</strong>: You can choose a color palette of \"Light\" (light background with dark text) or \"Dark\" (dark background with light text) for your site."
|
||||
msgstr "<strong>Fargeskjema</strong>: Du kan velge et lyst (lys bakgrunn med mørk tekst) eller mørkt (mørk bakgrunn med lys tekst) fargeskjema for ditt nettsted."
|
||||
|
||||
#: inc/theme-options.php:113
|
||||
msgid "<strong>Link Color</strong>: You can choose the color used for text links on your site. You can enter the HTML color or hex code, or you can choose visually by clicking the \"Select a Color\" button to pick from a color wheel."
|
||||
msgstr "<strong>Lenkefarge</strong>: Du kan velge hvilken farge som skal brukes for tekstlenker på nettstedet ditt. Du kan skrive inn HTML-farge eller hex-kode, eller du kan velge visuelt ved å klikke på \"Velg en farge\"-knappen for å velge fra et fargehjul."
|
||||
|
||||
#: inc/theme-options.php:114
|
||||
msgid "<strong>Default Layout</strong>: You can choose if you want your site’s default layout to have a sidebar on the left, the right, or not at all."
|
||||
msgstr "<strong>Standardutseende</strong>: Du kan velge om du vil at nettstedets standardusteende skal være en sidekolonne på enten venstre eller høyre side, eller ingen sidekolonne i det hele tatt."
|
||||
|
||||
#: inc/theme-options.php:116
|
||||
msgid "Remember to click \"Save Changes\" to save any changes you have made to the theme options."
|
||||
msgstr "Husk å klikke \"Lagre endringer\" for lagre de endringer du har gjort i tema-funksjoner."
|
||||
|
||||
#: inc/theme-options.php:118
|
||||
msgid "For more information:"
|
||||
msgstr "For mer informasjon:"
|
||||
|
||||
#: inc/theme-options.php:119
|
||||
msgid "<a href=\"http://codex.wordpress.org/Appearance_Theme_Options_Screen\" target=\"_blank\">Documentation on Theme Options</a>"
|
||||
msgstr "<a href=\"http://codex.wordpress.org/Appearance_Theme_Options_Screen\" target=\"_blank\">Dokumentasjon for tema-funksjoner</a>"
|
||||
|
||||
#: inc/theme-options.php:120
|
||||
msgid "<a href=\"http://wordpress.org/support/\" target=\"_blank\">Support Forums</a>"
|
||||
msgstr "<a href=\"http://wordpress.org/support/\" target=\"_blank\">Supportforum</a>"
|
||||
|
||||
#: inc/theme-options.php:127
|
||||
msgid "Overview"
|
||||
msgstr "Oversikt"
|
||||
|
||||
#: inc/theme-options.php:149
|
||||
msgid "Light"
|
||||
msgstr "Lys"
|
||||
|
||||
#: inc/theme-options.php:155
|
||||
msgid "Dark"
|
||||
msgstr "Mørk"
|
||||
|
||||
#: inc/theme-options.php:173
|
||||
msgid "Content on left"
|
||||
msgstr "Innhold til venstre"
|
||||
|
||||
#: inc/theme-options.php:178
|
||||
msgid "Content on right"
|
||||
msgstr "Innhold til høyre"
|
||||
|
||||
#: inc/theme-options.php:183
|
||||
msgid "One-column, no sidebar"
|
||||
msgstr "Ett hovedområde, ingen sidekolonne"
|
||||
|
||||
#: inc/theme-options.php:273
|
||||
msgid "Select a Color"
|
||||
msgstr "Velg en farge"
|
||||
|
||||
#: inc/theme-options.php:276
|
||||
msgid "Default color: %s"
|
||||
msgstr "Standardfarge: %s"
|
||||
|
||||
#: inc/theme-options.php:312
|
||||
msgid "%s Theme Options"
|
||||
msgstr "%s temavalg"
|
||||
|
||||
#: inc/theme-options.php:498
|
||||
msgid "Layout"
|
||||
msgstr "Sideoppsett"
|
||||
|
||||
#: inc/widgets.php:19
|
||||
msgid "Use this widget to list your recent Aside, Status, Quote, and Link posts"
|
||||
msgstr "Bruk denne widgeten for å liste dine siste notis-, status-, sitat- og lenkeinnlegg"
|
||||
|
||||
#: inc/widgets.php:20
|
||||
msgid "Twenty Eleven Ephemera"
|
||||
msgstr "Twenty Eleven Døgnflue"
|
||||
|
||||
#: inc/widgets.php:52
|
||||
msgid "Ephemera"
|
||||
msgstr "Døgnflue"
|
||||
|
||||
#: inc/widgets.php:91 inc/widgets.php:107
|
||||
msgid "0 <span class=\"reply\">comments →</span>"
|
||||
msgstr "0 <span class=\"reply\">kommentarer →</span>"
|
||||
|
||||
#: inc/widgets.php:91 inc/widgets.php:107
|
||||
msgid "1 <span class=\"reply\">comment →</span>"
|
||||
msgstr "1 <span class=\"reply\">kommentar →</span>"
|
||||
|
||||
#: inc/widgets.php:91 inc/widgets.php:107
|
||||
msgid "% <span class=\"reply\">comments →</span>"
|
||||
msgstr "% <span class=\"reply\">kommentarer →</span>"
|
||||
|
||||
#: inc/widgets.php:105
|
||||
msgid "Link to %s"
|
||||
msgstr "Lenke til %s"
|
||||
|
||||
#: inc/widgets.php:157
|
||||
msgid "Title:"
|
||||
msgstr "Tittel:"
|
||||
|
||||
#: inc/widgets.php:160
|
||||
msgid "Number of posts to show:"
|
||||
msgstr "Antall innlegg å vise:"
|
||||
|
||||
#: search.php:18
|
||||
msgid "Search Results for: %s"
|
||||
msgstr "Søkeresultater for: %s"
|
||||
|
||||
#: search.php:46
|
||||
msgid "Sorry, but nothing matched your search criteria. Please try again with some different keywords."
|
||||
msgstr "Det var ingen treff på dine søkekriterier. Søk på nytt med noen andre nøkkelord."
|
||||
|
||||
#: searchform.php:11 searchform.php:12 searchform.php:13
|
||||
msgid "Search"
|
||||
msgstr "Søk"
|
||||
|
||||
#: showcase.php:77
|
||||
msgid "Featured Post"
|
||||
msgstr "Fremhevet innlegg"
|
||||
|
||||
#: showcase.php:150
|
||||
msgid "Featuring: %s"
|
||||
msgstr "Fremhevet: %s"
|
||||
|
||||
#: showcase.php:160
|
||||
msgid "Recent Posts"
|
||||
msgstr "Nylige innlegg"
|
||||
|
||||
#: sidebar.php:19
|
||||
msgid "Archives"
|
||||
msgstr "Arkiv"
|
||||
|
||||
#: sidebar.php:26
|
||||
msgid "Meta"
|
||||
msgstr "Meta"
|
||||
|
||||
#: single.php:19
|
||||
msgid "<span class=\"meta-nav\">←</span> Previous"
|
||||
msgstr "<span class=\"meta-nav\">←</span> Forrige"
|
||||
|
||||
#: single.php:20
|
||||
msgid "Next <span class=\"meta-nav\">→</span>"
|
||||
msgstr "Neste <span class=\"meta-nav\">→</span>"
|
||||
|
||||
#: tag.php:19
|
||||
msgid "Tag Archives: %s"
|
||||
msgstr "Stikkordarkiv: %s"
|
||||
|
||||
msgid "Twenty Eleven"
|
||||
msgstr "Twenty Eleven"
|
||||
|
||||
msgid "http://wordpress.org/extend/themes/twentyeleven"
|
||||
msgstr "http://wordpress.org/extend/themes/twentyeleven"
|
||||
|
||||
msgid "The 2011 theme for WordPress is sophisticated, lightweight, and adaptable. Make it yours with a custom menu, header image, and background -- then go further with available theme options for light or dark color scheme, custom link colors, and three layout choices. Twenty Eleven comes equipped with a Showcase page template that transforms your front page into a showcase to show off your best content, widget support galore (sidebar, three footer areas, and a Showcase page widget area), and a custom \"Ephemera\" widget to display your Aside, Link, Quote, or Status posts. Included are styles for print and for the admin editor, support for featured images (as custom header images on posts and pages and as large images on featured \"sticky\" posts), and special styles for six different post formats."
|
||||
msgstr "Temaet 2011 for WordPress er sofistikert, lett, og tilpasningsdyktig. Gjør det til ditt med en tilpasset meny, toppbilde, og bakgrunn – og videre med tilgjengelige temaalternativer for lyse eller mørke farger, tilpassede koblingsfarger, og tre layout-valg. Twenty Eleven er utstyrt med sidemalen \"utstillingsvindu\". Med denne kan forsiden brukes til å vise frem ditt beste innhold. Temaet har widget-støtte i massevis (sidekolonne, tre sidebunn-områder, og en spesiell til \"utstillingsvinduet\"), og en tilpasset \"Døgnflue\"-widget for å vise dine notis-, lenke- sitat- eller status-innlegg. Det er også inkludert stiler for utskrift og for tekstbehandleren, støtte for fremhevede bilder (som tilpassede toppbilder på innlegg og sider, og som store bilder på fremhevede \"klebrige\" innlegg), og spesielle stiler for seks ulike innleggsformater."
|
||||
|
||||
msgid "the WordPress team"
|
||||
msgstr "WordPress-gjengen"
|
||||
|
||||
msgid "Showcase Template"
|
||||
msgstr "Mal for utstillingsvindu"
|
||||
|
||||
msgid "Sidebar Template"
|
||||
msgstr "Mal for sidekolonne"
|
||||
@@ -0,0 +1,377 @@
|
||||
# Translation of Twenty Ten in Norwegian (Bokmål)
|
||||
# This file is distributed under the same license as the Twenty Ten package.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"PO-Revision-Date: 2013-01-25 11:15:46+0000\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: GlotPress/0.1\n"
|
||||
"Project-Id-Version: Twenty Ten\n"
|
||||
|
||||
#: archive.php:33
|
||||
msgid "Daily Archives: <span>%s</span>"
|
||||
msgstr "Daglig arkiv: <span>%s</span>"
|
||||
|
||||
#: 404.php:16 loop.php:33
|
||||
msgid "Not Found"
|
||||
msgstr "Ikke funnet"
|
||||
|
||||
#: 404.php:18
|
||||
msgid "Apologies, but the page you requested could not be found. Perhaps searching will help."
|
||||
msgstr "Siden ble dessverre ikke funnet. Du kan kanskje finne den ved å søke."
|
||||
|
||||
#: archive.php:35
|
||||
msgid "Monthly Archives: <span>%s</span>"
|
||||
msgstr "Månedlig arkiv: <span>%s</span>"
|
||||
|
||||
#: archive.php:35
|
||||
msgctxt "monthly archives date format"
|
||||
msgid "F Y"
|
||||
msgstr "F Y"
|
||||
|
||||
#: archive.php:37
|
||||
msgid "Yearly Archives: <span>%s</span>"
|
||||
msgstr "Årlig arkiv: <span>%s</span>"
|
||||
|
||||
#: archive.php:37
|
||||
msgctxt "yearly archives date format"
|
||||
msgid "Y"
|
||||
msgstr "Y"
|
||||
|
||||
#: archive.php:39
|
||||
msgid "Blog Archives"
|
||||
msgstr "Bloggarkiv"
|
||||
|
||||
#: author.php:27
|
||||
msgid "Author Archives: %s"
|
||||
msgstr "Forfatterarkiv: %s"
|
||||
|
||||
#: author.php:37 loop-single.php:43
|
||||
msgid "About %s"
|
||||
msgstr "Om %s"
|
||||
|
||||
#: category.php:16
|
||||
msgid "Category Archives: %s"
|
||||
msgstr "Kategoriarkiv: %s"
|
||||
|
||||
#: comments.php:18
|
||||
msgid "This post is password protected. Enter the password to view any comments."
|
||||
msgstr "Dette innlegget er passordbeskyttet. Skriv inn passordet for å vise kommentarene."
|
||||
|
||||
#: comments.php:35
|
||||
msgid "One Response to %2$s"
|
||||
msgid_plural "%1$s Responses to %2$s"
|
||||
msgstr[0] "En kommentar til %2$s"
|
||||
msgstr[1] "%1$s kommentarer til %2$s"
|
||||
|
||||
#: comments.php:41 comments.php:60
|
||||
msgid "<span class=\"meta-nav\">←</span> Older Comments"
|
||||
msgstr "<span class=\"meta-nav\">←</span> Eldre kommentarer"
|
||||
|
||||
#: comments.php:42 comments.php:61
|
||||
msgid "Newer Comments <span class=\"meta-nav\">→</span>"
|
||||
msgstr "Nyere kommentarer <span class=\"meta-nav\">→</span>"
|
||||
|
||||
#: comments.php:70
|
||||
msgid "Comments are closed."
|
||||
msgstr "Det er stengt for kommentarer."
|
||||
|
||||
#: footer.php:33
|
||||
msgid "http://wordpress.org/"
|
||||
msgstr "http://wordpress.org/"
|
||||
|
||||
#: footer.php:33
|
||||
msgid "Semantic Personal Publishing Platform"
|
||||
msgstr "Semantisk personlig publiseringsplattform"
|
||||
|
||||
#: footer.php:33
|
||||
msgid "Proudly powered by %s."
|
||||
msgstr "Drives med kraft fra %s."
|
||||
|
||||
#: functions.php:93
|
||||
msgid "Primary Navigation"
|
||||
msgstr "Primærmeny"
|
||||
|
||||
#: functions.php:145
|
||||
msgid "Berries"
|
||||
msgstr "Bær"
|
||||
|
||||
#: functions.php:151
|
||||
msgid "Cherry Blossoms"
|
||||
msgstr "Kirsebærblomster"
|
||||
|
||||
#: functions.php:157
|
||||
msgid "Concave"
|
||||
msgstr "Konkav"
|
||||
|
||||
#: functions.php:163
|
||||
msgid "Fern"
|
||||
msgstr "Bregne"
|
||||
|
||||
#: functions.php:169
|
||||
msgid "Forest Floor"
|
||||
msgstr "Skogsbunn"
|
||||
|
||||
#: functions.php:175
|
||||
msgid "Inkwell"
|
||||
msgstr "Blekkhus"
|
||||
|
||||
#: functions.php:181
|
||||
msgid "Path"
|
||||
msgstr "Sti"
|
||||
|
||||
#: functions.php:187
|
||||
msgid "Sunset"
|
||||
msgstr "Solnedgang"
|
||||
|
||||
#: functions.php:255 loop-attachment.php:104 loop.php:115 loop.php:143
|
||||
msgid "Continue reading <span class=\"meta-nav\">→</span>"
|
||||
msgstr "Les videre <span class=\"meta-nav\">→</span>"
|
||||
|
||||
#: functions.php:338
|
||||
msgid "%s <span class=\"says\">says:</span>"
|
||||
msgstr "%s <span class=\"says\">sier:</span>"
|
||||
|
||||
#: functions.php:341
|
||||
msgid "Your comment is awaiting moderation."
|
||||
msgstr "Din kommentar avventer moderasjon."
|
||||
|
||||
#: functions.php:348
|
||||
msgid "%1$s at %2$s"
|
||||
msgstr "%1$s kl. %2$s"
|
||||
|
||||
#: functions.php:348 functions.php:365
|
||||
msgid "(Edit)"
|
||||
msgstr "(Rediger)"
|
||||
|
||||
#: functions.php:365
|
||||
msgid "Pingback:"
|
||||
msgstr "Tilbaketråkk:"
|
||||
|
||||
#: functions.php:384
|
||||
msgid "Primary Widget Area"
|
||||
msgstr "Hovedområde for widgeter"
|
||||
|
||||
#: functions.php:386
|
||||
msgid "The primary widget area"
|
||||
msgstr "Hovedområdet for widgeter"
|
||||
|
||||
#: functions.php:395
|
||||
msgid "Secondary Widget Area"
|
||||
msgstr "Sekundært widgetområde"
|
||||
|
||||
#: functions.php:397
|
||||
msgid "The secondary widget area"
|
||||
msgstr "Det sekundære widgetområdet"
|
||||
|
||||
#: functions.php:406
|
||||
msgid "First Footer Widget Area"
|
||||
msgstr "Første bunnområde for widgeter"
|
||||
|
||||
#: functions.php:408
|
||||
msgid "The first footer widget area"
|
||||
msgstr "Det første bunnområde for widgeter"
|
||||
|
||||
#: functions.php:417
|
||||
msgid "Second Footer Widget Area"
|
||||
msgstr "Andre bunnområde for widgeter"
|
||||
|
||||
#: functions.php:419
|
||||
msgid "The second footer widget area"
|
||||
msgstr "Det andre bunnområdet for widgeter"
|
||||
|
||||
#: functions.php:428
|
||||
msgid "Third Footer Widget Area"
|
||||
msgstr "Tredje bunnområde for widgeter"
|
||||
|
||||
#: functions.php:430
|
||||
msgid "The third footer widget area"
|
||||
msgstr "Det tredje bunnområdet for widgeter"
|
||||
|
||||
#: functions.php:439
|
||||
msgid "Fourth Footer Widget Area"
|
||||
msgstr "Fjerde bunnområde for widgeter"
|
||||
|
||||
#: functions.php:441
|
||||
msgid "The fourth footer widget area"
|
||||
msgstr "Det fjerde bunnområdet for widgeter"
|
||||
|
||||
#: functions.php:475
|
||||
msgid "<span class=\"%1$s\">Posted on</span> %2$s <span class=\"meta-sep\">by</span> %3$s"
|
||||
msgstr "<span class=\"%1$s\">Skrevet</span> %2$s <span class=\"meta-sep\">av</span> %3$s"
|
||||
|
||||
#: functions.php:484 loop-attachment.php:36
|
||||
msgid "View all posts by %s"
|
||||
msgstr "Vis alle innlegg av %s"
|
||||
|
||||
#: functions.php:501
|
||||
msgid "This entry was posted in %1$s and tagged %2$s. Bookmark the <a href=\"%3$s\" title=\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>."
|
||||
msgstr "Dette innlegget ble publisert i %1$s og merket med %2$s. Bokmerk <a href=\"%3$s\" title=\"Permalenke til %4$s\" rel=\"bookmark\">permalenken</a>."
|
||||
|
||||
#: functions.php:503
|
||||
msgid "This entry was posted in %1$s. Bookmark the <a href=\"%3$s\" title=\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>."
|
||||
msgstr "Dette innlegget ble publisert i %1$s. Bokmerk <a href=\"%3$s\" title=\"Permalenke til %4$s\" rel=\"bookmark\">permalenken</a>."
|
||||
|
||||
#: functions.php:505
|
||||
msgid "Bookmark the <a href=\"%3$s\" title=\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>."
|
||||
msgstr "Bokmerk <a href=\"%3$s\" title=\"Permalenke til %4$s\" rel=\"bookmark\">permalenken</a>."
|
||||
|
||||
#: header.php:33
|
||||
msgid "Page %s"
|
||||
msgstr "Side %s"
|
||||
|
||||
#: header.php:101
|
||||
msgid "Skip to content"
|
||||
msgstr "Hopp til innhold"
|
||||
|
||||
#: loop-attachment.php:21
|
||||
msgid "Return to %s"
|
||||
msgstr "Tilbake til %s"
|
||||
|
||||
#: loop-attachment.php:23
|
||||
msgid "<span class=\"meta-nav\">←</span> %s"
|
||||
msgstr "<span class=\"meta-nav\">←</span> %s"
|
||||
|
||||
#: loop-attachment.php:32
|
||||
msgid "<span class=\"%1$s\">By</span> %2$s"
|
||||
msgstr "<span class=\"%1$s\">Av</span> %2$s"
|
||||
|
||||
#: loop-attachment.php:43
|
||||
msgid "<span class=\"%1$s\">Published</span> %2$s"
|
||||
msgstr "<span class=\"%1$s\">Publisert</span> %2$s"
|
||||
|
||||
#: loop-attachment.php:53
|
||||
msgid "Full size is %s pixels"
|
||||
msgstr "Full størrelse er %s piksler"
|
||||
|
||||
#: loop-attachment.php:56
|
||||
msgid "Link to full-size image"
|
||||
msgstr "Lenke til originalbildet"
|
||||
|
||||
#: loop-attachment.php:63 loop-attachment.php:111 loop-page.php:30
|
||||
#: loop-single.php:56 loop.php:100 loop.php:123 loop.php:165
|
||||
msgid "Edit"
|
||||
msgstr "Rediger"
|
||||
|
||||
#: loop-attachment.php:105 loop-page.php:29 loop-single.php:34 loop.php:144
|
||||
msgid "Pages:"
|
||||
msgstr "Sider:"
|
||||
|
||||
#: loop-single.php:21 loop-single.php:61
|
||||
msgctxt "Previous post link"
|
||||
msgid "←"
|
||||
msgstr "←"
|
||||
|
||||
#: loop-single.php:22 loop-single.php:62
|
||||
msgctxt "Next post link"
|
||||
msgid "→"
|
||||
msgstr "→"
|
||||
|
||||
#: loop-single.php:47
|
||||
msgid "View all posts by %s <span class=\"meta-nav\">→</span>"
|
||||
msgstr "Les alle innlegg av %s <span class=\"meta-nav\">→</span>"
|
||||
|
||||
#: loop.php:25 loop.php:178
|
||||
msgid "<span class=\"meta-nav\">←</span> Older posts"
|
||||
msgstr "<span class=\"meta-nav\">←</span> Eldre innlegg"
|
||||
|
||||
#: loop.php:26 loop.php:179
|
||||
msgid "Newer posts <span class=\"meta-nav\">→</span>"
|
||||
msgstr "Nyere innlegg <span class=\"meta-nav\">→</span>"
|
||||
|
||||
#: loop.php:35
|
||||
msgid "Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post."
|
||||
msgstr "Beklager, ingenting ble funnet i dette arkivet. Du kan prøve å søke etter relaterte innlegg."
|
||||
|
||||
#: loop.php:60 loop.php:95 loop.php:96
|
||||
msgctxt "gallery category slug"
|
||||
msgid "gallery"
|
||||
msgstr "galleri"
|
||||
|
||||
#: loop.php:62 loop.php:83 loop.php:131
|
||||
msgid "Permalink to %s"
|
||||
msgstr "Permalenke til %s"
|
||||
|
||||
#: loop.php:82
|
||||
msgid "This gallery contains <a %1$s>%2$s photo</a>."
|
||||
msgid_plural "This gallery contains <a %1$s>%2$s photos</a>."
|
||||
msgstr[0] "Dette galleriet inneholder <a %1$s>%2$s bilde</a>."
|
||||
msgstr[1] "Dette galleriet inneholder <a %1$s>%2$s bilder</a>."
|
||||
|
||||
#: loop.php:93
|
||||
msgid "View Galleries"
|
||||
msgstr "Se gallerier"
|
||||
|
||||
#: loop.php:93 loop.php:96
|
||||
msgid "More Galleries"
|
||||
msgstr "Flere gallerier"
|
||||
|
||||
#: loop.php:96
|
||||
msgid "View posts in the Gallery category"
|
||||
msgstr "Vis innlegg i gallerikategorien"
|
||||
|
||||
#: loop.php:99 loop.php:122 loop.php:164
|
||||
msgid "Leave a comment"
|
||||
msgstr "Skriv en kommentar"
|
||||
|
||||
#: loop.php:99 loop.php:122 loop.php:164
|
||||
msgid "1 Comment"
|
||||
msgstr "1 kommentar"
|
||||
|
||||
#: loop.php:99 loop.php:122 loop.php:164
|
||||
msgid "% Comments"
|
||||
msgstr "% kommentarer"
|
||||
|
||||
#: loop.php:106
|
||||
msgctxt "asides category slug"
|
||||
msgid "asides"
|
||||
msgstr "sideområder"
|
||||
|
||||
#: loop.php:151
|
||||
msgid "<span class=\"%1$s\">Posted in</span> %2$s"
|
||||
msgstr "<span class=\"%1$s\">Publisert i</span> %2$s"
|
||||
|
||||
#: loop.php:160
|
||||
msgid "<span class=\"%1$s\">Tagged</span> %2$s"
|
||||
msgstr "<span class=\"%1$s\">Merket med</span> %2$s"
|
||||
|
||||
#: search.php:16
|
||||
msgid "Search Results for: %s"
|
||||
msgstr "Søkeresultater for: %s"
|
||||
|
||||
#: search.php:26
|
||||
msgid "Nothing Found"
|
||||
msgstr "Ingenting funnet"
|
||||
|
||||
#: search.php:28
|
||||
msgid "Sorry, but nothing matched your search criteria. Please try again with some different keywords."
|
||||
msgstr "Det var ingen treff på dine søkekriterier. Søk på nytt med noen andre nøkkelord."
|
||||
|
||||
#: sidebar.php:27
|
||||
msgid "Archives"
|
||||
msgstr "Arkiv"
|
||||
|
||||
#: sidebar.php:34
|
||||
msgid "Meta"
|
||||
msgstr "Meta"
|
||||
|
||||
#: tag.php:16
|
||||
msgid "Tag Archives: %s"
|
||||
msgstr "Stikkordarkiv: %s"
|
||||
|
||||
msgid "Twenty Ten"
|
||||
msgstr "Twenty Ten"
|
||||
|
||||
msgid "http://wordpress.org/extend/themes/twentyten"
|
||||
msgstr "http://wordpress.org/extend/themes/twentyten"
|
||||
|
||||
msgid "The 2010 theme for WordPress is stylish, customizable, simple, and readable -- make it yours with a custom menu, header image, and background. Twenty Ten supports six widgetized areas (two in the sidebar, four in the footer) and featured images (thumbnails for gallery posts and custom header images for posts and pages). It includes stylesheets for print and the admin Visual Editor, special styles for posts in the \"Asides\" and \"Gallery\" categories, and has an optional one-column page template that removes the sidebar."
|
||||
msgstr "2010-temaet for WordPress er stilig, mulig å tilpasse, enkelt og lesbart - gjør det til ditt eget med en egendefinert meny, tittelbilde og bakgrunn. Twenty Ten støtter seks widgetområder (to i sidekolonnen, fire i bunnteksten) og fremhevede bilder (miniatyrer for galleriinnlegg og tilpassede tittelbilder for innlegg og sider). Det inkluderer stilark for utskrift og visuell redigering (som gjør at du ser nøyaktig hvordan innlegget blir seende ut mens du skriver det), spesielle stiler for innlegg i asides- og gallerikategoriene, og har en valgfri én-kolonne sidemal som fjerner sidekolonnen."
|
||||
|
||||
msgid "the WordPress team"
|
||||
msgstr "WordPress-gjengen"
|
||||
|
||||
msgid "One column, no sidebar"
|
||||
msgstr "En kolonne, ingen sidekolonne"
|
||||
@@ -0,0 +1,309 @@
|
||||
# Translation of Twenty Twelve in Norwegian (Bokmål)
|
||||
# This file is distributed under the same license as the Twenty Twelve package.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"PO-Revision-Date: 2013-01-25 11:15:47+0000\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: GlotPress/0.1\n"
|
||||
"Project-Id-Version: Twenty Twelve\n"
|
||||
|
||||
#: 404.php:17
|
||||
msgid "This is somewhat embarrassing, isn’t it?"
|
||||
msgstr "Dette er litt flaut, ikke sant?"
|
||||
|
||||
#: 404.php:21
|
||||
msgid "It seems we can’t find what you’re looking for. Perhaps searching can help."
|
||||
msgstr "Vi klarer ikke å finne det du leter etter. Prøv å søke."
|
||||
|
||||
#: archive.php:29
|
||||
msgid "Daily Archives: %s"
|
||||
msgstr "Daglige arkiver: %s"
|
||||
|
||||
#: archive.php:31
|
||||
msgid "Monthly Archives: %s"
|
||||
msgstr "Månedlige arkiver: %s"
|
||||
|
||||
#: archive.php:31
|
||||
msgctxt "monthly archives date format"
|
||||
msgid "F Y"
|
||||
msgstr "F Y"
|
||||
|
||||
#: archive.php:33
|
||||
msgid "Yearly Archives: %s"
|
||||
msgstr "Årlige arkiver: %s"
|
||||
|
||||
#: archive.php:33
|
||||
msgctxt "yearly archives date format"
|
||||
msgid "Y"
|
||||
msgstr "Y"
|
||||
|
||||
#: archive.php:35
|
||||
msgid "Archives"
|
||||
msgstr "Arkiv"
|
||||
|
||||
#: author.php:32
|
||||
msgid "Author Archives: %s"
|
||||
msgstr "Forfatterarkiv: %s"
|
||||
|
||||
#: author.php:53 content.php:53
|
||||
msgid "About %s"
|
||||
msgstr "Om %s"
|
||||
|
||||
#: category.php:21
|
||||
msgid "Category Archives: %s"
|
||||
msgstr "Kategoriarkiv: %s"
|
||||
|
||||
#: comments.php:31
|
||||
msgid "One thought on “%2$s”"
|
||||
msgid_plural "%1$s thoughts on “%2$s”"
|
||||
msgstr[0] "En tanke om “%2$s”"
|
||||
msgstr[1] "%1$s tanker om “%2$s”"
|
||||
|
||||
#: comments.php:42
|
||||
msgid "Comment navigation"
|
||||
msgstr "Kommentarnavigasjon"
|
||||
|
||||
#: comments.php:43
|
||||
msgid "← Older Comments"
|
||||
msgstr "← Eldre kommentarer"
|
||||
|
||||
#: comments.php:44
|
||||
msgid "Newer Comments →"
|
||||
msgstr "Nyere kommentarer →"
|
||||
|
||||
#: comments.php:53
|
||||
msgid "Comments are closed."
|
||||
msgstr "Det er stengt for kommentarer."
|
||||
|
||||
#: content-aside.php:13 content-aside.php:20 content-image.php:17
|
||||
#: content-link.php:18 content-quote.php:17 content-status.php:15
|
||||
#: content.php:23
|
||||
msgid "Permalink to %s"
|
||||
msgstr "Permalenke til %s"
|
||||
|
||||
#: content-aside.php:15 content-image.php:13 content-link.php:14
|
||||
#: content-quote.php:13 content-status.php:21 content.php:39
|
||||
msgid "Continue reading <span class=\"meta-nav\">→</span>"
|
||||
msgstr "Les videre <span class=\"meta-nav\">→</span>"
|
||||
|
||||
#: content-aside.php:23 content-image.php:23 content-link.php:21
|
||||
#: content-quote.php:20 content-status.php:27 content.php:28
|
||||
msgid "Leave a reply"
|
||||
msgstr "Skriv en kommentar"
|
||||
|
||||
#: content-aside.php:23 content-image.php:23 content-link.php:21
|
||||
#: content-quote.php:20 content-status.php:27 content.php:28
|
||||
msgid "1 Reply"
|
||||
msgstr "1 svar"
|
||||
|
||||
#: content-aside.php:23 content-image.php:23 content-link.php:21
|
||||
#: content-quote.php:20 content-status.php:27 content.php:28
|
||||
msgid "% Replies"
|
||||
msgstr "% svar"
|
||||
|
||||
#: content-aside.php:26 content-image.php:26 content-link.php:24
|
||||
#: content-page.php:21 content-quote.php:23 content-status.php:30
|
||||
#: content.php:46 functions.php:309 image.php:37
|
||||
msgid "Edit"
|
||||
msgstr "Rediger"
|
||||
|
||||
#: content-link.php:12
|
||||
msgid "Link"
|
||||
msgstr "Lenke"
|
||||
|
||||
#: content-none.php:13 index.php:49 search.php:34
|
||||
msgid "Nothing Found"
|
||||
msgstr "Ingenting funnet"
|
||||
|
||||
#: content-none.php:17 index.php:53
|
||||
msgid "Apologies, but no results were found. Perhaps searching will help find a related post."
|
||||
msgstr "Beklager, men ingen resultater ble funnet. Kanskje du kan finne et relatert innlegg ved å søke."
|
||||
|
||||
#: content-page.php:18 content.php:40 image.php:92
|
||||
msgid "Pages:"
|
||||
msgstr "Sider:"
|
||||
|
||||
#: content.php:14
|
||||
msgid "Featured post"
|
||||
msgstr "Fremhevet innlegg"
|
||||
|
||||
#: content.php:57
|
||||
msgid "View all posts by %s <span class=\"meta-nav\">→</span>"
|
||||
msgstr "Les alle innlegg av %s <span class=\"meta-nav\">→</span>"
|
||||
|
||||
#: footer.php:17
|
||||
msgid "http://wordpress.org/"
|
||||
msgstr "http://wordpress.org/"
|
||||
|
||||
#: footer.php:17
|
||||
msgid "Semantic Personal Publishing Platform"
|
||||
msgstr "Semantisk, personlig publiseringsplattform"
|
||||
|
||||
#: footer.php:17
|
||||
msgid "Proudly powered by %s"
|
||||
msgstr "Stolt drevet av %s"
|
||||
|
||||
#: functions.php:64
|
||||
msgid "Primary Menu"
|
||||
msgstr "Primærmeny"
|
||||
|
||||
#: functions.php:120
|
||||
msgctxt "Open Sans font: on or off"
|
||||
msgid "on"
|
||||
msgstr "on"
|
||||
|
||||
#: functions.php:125
|
||||
msgctxt "Open Sans font: add new subset (greek, cyrillic, vietnamese)"
|
||||
msgid "no-subset"
|
||||
msgstr "no-subset"
|
||||
|
||||
#: functions.php:181
|
||||
msgid "Page %s"
|
||||
msgstr "Side %s"
|
||||
|
||||
#: functions.php:206
|
||||
msgid "Main Sidebar"
|
||||
msgstr "Primær sidekolonne"
|
||||
|
||||
#: functions.php:208
|
||||
msgid "Appears on posts and pages except the optional Front Page template, which has its own widgets"
|
||||
msgstr "Vises på innlegg og sider bortsett fra den valgfrie forsidemalen, som har sine egne widgeter"
|
||||
|
||||
#: functions.php:216
|
||||
msgid "First Front Page Widget Area"
|
||||
msgstr "Første widget-område på forside"
|
||||
|
||||
#: functions.php:218 functions.php:228
|
||||
msgid "Appears when using the optional Front Page template with a page set as Static Front Page"
|
||||
msgstr "Vises når man bruker den valgfrie forsidemalen med en side satt som statisk forside"
|
||||
|
||||
#: functions.php:226
|
||||
msgid "Second Front Page Widget Area"
|
||||
msgstr "Andre widget-område på forside"
|
||||
|
||||
#: functions.php:250 single.php:20
|
||||
msgid "Post navigation"
|
||||
msgstr "Innleggsnavigasjon"
|
||||
|
||||
#: functions.php:251
|
||||
msgid "<span class=\"meta-nav\">←</span> Older posts"
|
||||
msgstr "<span class=\"meta-nav\">←</span> Eldre innlegg"
|
||||
|
||||
#: functions.php:252
|
||||
msgid "Newer posts <span class=\"meta-nav\">→</span>"
|
||||
msgstr "Nyere innlegg <span class=\"meta-nav\">→</span>"
|
||||
|
||||
#: functions.php:277
|
||||
msgid "Pingback:"
|
||||
msgstr "Tilbaketråkk:"
|
||||
|
||||
#: functions.php:277
|
||||
msgid "(Edit)"
|
||||
msgstr "(Rediger)"
|
||||
|
||||
#: functions.php:292
|
||||
msgid "Post author"
|
||||
msgstr "Innleggsforfatter"
|
||||
|
||||
#: functions.php:298
|
||||
msgid "%1$s at %2$s"
|
||||
msgstr "%1$s, kl. %2$s"
|
||||
|
||||
#: functions.php:304
|
||||
msgid "Your comment is awaiting moderation."
|
||||
msgstr "Din kommentar avventer moderasjon."
|
||||
|
||||
#: functions.php:313
|
||||
msgid "Reply"
|
||||
msgstr "Svar"
|
||||
|
||||
#: functions.php:332 functions.php:335
|
||||
msgid ", "
|
||||
msgstr ", "
|
||||
|
||||
#: functions.php:346
|
||||
msgid "View all posts by %s"
|
||||
msgstr "Vis alle innlegg av %s"
|
||||
|
||||
#: functions.php:352
|
||||
msgid "This entry was posted in %1$s and tagged %2$s on %3$s<span class=\"by-author\"> by %4$s</span>."
|
||||
msgstr "Dette innlegget ble skrevet i %1$s og market %2$s, %3$s<span class=\"by-author\"> av %4$s</span>."
|
||||
|
||||
#: functions.php:354
|
||||
msgid "This entry was posted in %1$s on %3$s<span class=\"by-author\"> by %4$s</span>."
|
||||
msgstr "Dette innlegget ble skrevet i %1$s, %3$s<span class=\"by-author\"> av %4$s</span>."
|
||||
|
||||
#: functions.php:356
|
||||
msgid "This entry was posted on %3$s<span class=\"by-author\"> by %4$s</span>."
|
||||
msgstr "Dette innlegget ble skrevet %3$s<span class=\"by-author\"> av %4$s</span>."
|
||||
|
||||
#: header.php:43
|
||||
msgid "Menu"
|
||||
msgstr "Meny"
|
||||
|
||||
#: header.php:44
|
||||
msgid "Skip to content"
|
||||
msgstr "Gå til innhold"
|
||||
|
||||
#: image.php:26
|
||||
msgid "<span class=\"meta-prep meta-prep-entry-date\">Published </span> <span class=\"entry-date\"><time class=\"entry-date\" datetime=\"%1$s\">%2$s</time></span> at <a href=\"%3$s\" title=\"Link to full-size image\">%4$s × %5$s</a> in <a href=\"%6$s\" title=\"Return to %7$s\" rel=\"gallery\">%8$s</a>."
|
||||
msgstr "<span class=\"meta-prep meta-prep-entry-date\">Publisert </span> <span class=\"entry-date\"><time class=\"entry-date\" datetime=\"%1$s\">%2$s</time></span>, <a href=\"%3$s\" title=\"Link to full-size image\">%4$s × %5$s</a> i <a href=\"%6$s\" title=\"Tilbake til %7$s\" rel=\"gallery\">%8$s</a>."
|
||||
|
||||
#: image.php:41
|
||||
msgid "← Previous"
|
||||
msgstr "← Forrige"
|
||||
|
||||
#: image.php:42
|
||||
msgid "Next →"
|
||||
msgstr "Neste →"
|
||||
|
||||
#: index.php:38
|
||||
msgid "No posts to display"
|
||||
msgstr "Ingen innlegg å vise"
|
||||
|
||||
#: index.php:42
|
||||
msgid "Ready to publish your first post? <a href=\"%s\">Get started here</a>."
|
||||
msgstr "Klar for å publisere ditt første innlegg? <a href=\"%s\">Start her</a>."
|
||||
|
||||
#: search.php:18
|
||||
msgid "Search Results for: %s"
|
||||
msgstr "Søkeresultater for: %s"
|
||||
|
||||
#: search.php:38
|
||||
msgid "Sorry, but nothing matched your search criteria. Please try again with some different keywords."
|
||||
msgstr "Det var ingen treff på dine søkekriterier. Søk på nytt med noen andre nøkkelord."
|
||||
|
||||
#: single.php:21
|
||||
msgctxt "Previous post link"
|
||||
msgid "←"
|
||||
msgstr "←"
|
||||
|
||||
#: single.php:22
|
||||
msgctxt "Next post link"
|
||||
msgid "→"
|
||||
msgstr "→"
|
||||
|
||||
#: tag.php:21
|
||||
msgid "Tag Archives: %s"
|
||||
msgstr "Stikkordarkiv: %s"
|
||||
|
||||
msgid "Twenty Twelve"
|
||||
msgstr "Twenty Twelve"
|
||||
|
||||
msgid "http://wordpress.org/extend/themes/twentytwelve"
|
||||
msgstr "http://wordpress.org/extend/themes/twentytwelve"
|
||||
|
||||
msgid "The 2012 theme for WordPress is a fully responsive theme that looks great on any device. Features include a front page template with its own widgets, an optional display font, styling for post formats on both index and single views, and an optional no-sidebar page template. Make it yours with a custom menu, header image, and background."
|
||||
msgstr "2012-temaet for WordPress er et helresponsivt tema som ser bra ut både på såvel mobil som datamaskin. Funksjoner inkluderer forsidemal med egne widgeter, en valgfri visningsfont, stiler for innleggsformater, både i arkivvisning og enkeltvisning, og en valgfri sidemal uten sidekolonne. Gjør temaet til ditt eget med en egendefinert meny, toppbilde og bakgrunn."
|
||||
|
||||
msgid "the WordPress team"
|
||||
msgstr "WordPress-gjengen"
|
||||
|
||||
msgid "Front Page Template"
|
||||
msgstr "Forsidemal"
|
||||
|
||||
msgid "Full-width Page Template, No Sidebar"
|
||||
msgstr "Sidemal med full bredde, uten sidekolonne"
|
||||
@@ -1,211 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: trololol
|
||||
Plugin URI: http://www.dagen.ifi.uio.no
|
||||
Description: Plugin to manage sponsors for dagen@ifi
|
||||
Version 0.1
|
||||
Author: Sjur Hernes
|
||||
Author URI: grey.sjux.net
|
||||
License: GPL v2 or later
|
||||
*/
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
if (!class_exists("DagenBed")) {
|
||||
|
||||
class DagenBed{
|
||||
|
||||
function DagenBed(){
|
||||
|
||||
/**
|
||||
Create the fields the post type should have
|
||||
*/
|
||||
function dagen_bedrift_post_type() {
|
||||
register_post_type(
|
||||
'bedrift',
|
||||
array(
|
||||
'labels' => array(
|
||||
'name' => __( 'Bedrifter' ),
|
||||
'singular_name' => __( 'Bedrift' ),
|
||||
'add_new' => __( 'Legg til ny bedrift' ),
|
||||
'add_new_item' => __( 'Legg til ny bedrift' ),
|
||||
'edit_item' => __( 'Rediger bedrift' ),
|
||||
'new_item' => __( 'Legg til ny bedrift' ),
|
||||
'view_item' => __( 'Vis bedrift' ),
|
||||
'search_items' => __( 'Søk etter bedrift' ),
|
||||
'not_found' => __( 'ingen bedrifter funnet' ),
|
||||
'not_found_in_trash' => __( 'ingen bedrifter funnet i søppel' )
|
||||
),
|
||||
'public' => true,
|
||||
'publicly_queryable' => true,
|
||||
// gives url the_site()/bedrift
|
||||
'rewrite' => array(
|
||||
'slug' => 'bedrift',
|
||||
'with_front' => false),
|
||||
'query_var' => 'bedrift',
|
||||
'capability_type' => 'bedrift',
|
||||
'map_meta_cap' => true,
|
||||
'supports' => array(
|
||||
'title',
|
||||
'editor',
|
||||
'author',
|
||||
'thumbnail',
|
||||
'administrator'
|
||||
),
|
||||
'register_meta_box_cb' => 'add_bedrift_metaboxes',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
********************************************************************************
|
||||
** Add meta-boxes ***********************************************************
|
||||
********************************************************************************
|
||||
*******************************************************************************/
|
||||
|
||||
function add_bedrift_metaboxes() {
|
||||
|
||||
add_meta_box(
|
||||
'dagen_bedrifts_type',
|
||||
__('Bedriftstype'),
|
||||
'dagen_bedtype_custom_box',
|
||||
'bedrift',
|
||||
'side',
|
||||
'high'
|
||||
);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
********************************************************************************
|
||||
** Eventtype metabox ********************************************************
|
||||
********************************************************************************
|
||||
*******************************************************************************/
|
||||
|
||||
function dagen_bedtype_custom_box(){
|
||||
|
||||
global $post;
|
||||
|
||||
$dagen_bedrift_type = get_post_meta($post->ID, 'dagen_bedrift_type', true);
|
||||
|
||||
echo "Type:";
|
||||
echo '<select name="dagen_bedrift_type">';
|
||||
echo $dagen_bedrift_type;
|
||||
|
||||
$types = array(array( 'id' => 3, 'name' => 'Standplass' ),
|
||||
array( 'id' => 1, 'name' => 'Hovedsponsor'),
|
||||
array( 'id' => 2, 'name' => 'Sammarbeidspartner'));
|
||||
|
||||
foreach($types as $type){
|
||||
echo '<option value="' . $type['id'] . '"';
|
||||
if($type['id'] == $dagen_bedrift_type)
|
||||
echo ' selected="selected"';
|
||||
echo '>' . $type['name'] . '</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
}
|
||||
|
||||
/**
|
||||
* When the post is saved, saves our custom data
|
||||
*/
|
||||
|
||||
|
||||
function dagen_bedrift_save_info( $post_id ) {
|
||||
|
||||
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return $post_id;
|
||||
|
||||
// Check permissions
|
||||
// TODO
|
||||
if ( !current_user_can( 'edit_post', $post_id )
|
||||
/*&& get_current_user()->user_login == get_post_meta($post_id, 'author', true)*/ ) return $post_id;
|
||||
|
||||
// Get posted data
|
||||
$bedrift_type = $_POST['dagen_bedrift_type'];
|
||||
|
||||
if ( !get_post_meta($post_id, 'dagen_bedrift_type') ) {
|
||||
add_post_meta($post_id, 'dagen_bedrift_type', $bedrift_type, true);
|
||||
}elseif($bedrift_type != get_post_meta($post_id, 'dagen_bedrift_type', true)){
|
||||
update_post_meta($post_id, 'dagen_bedrift_type',$bedrift_type);
|
||||
}
|
||||
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
/** View of the custom page */
|
||||
|
||||
function dagen_bedrift_list() {
|
||||
global $post, $wp_locale;
|
||||
|
||||
$bedrifter = new WP_Query( array(
|
||||
'post_type' => 'bedrift',
|
||||
'posts_per_page' => -1,
|
||||
'meta_key' => 'dagen_bedrift_type',
|
||||
'orderby' => 'meta_value',
|
||||
'order' => 'ASC'
|
||||
)
|
||||
);
|
||||
$html = '';
|
||||
|
||||
if ( $bedrifter->have_posts() ) :
|
||||
$date = "";
|
||||
|
||||
$html .= '<table class="bedrift-table">';
|
||||
|
||||
while ( $bedrifter->have_posts() ) :
|
||||
$bedrifter->the_post();
|
||||
$types = array(1 => "hovedsponsor", 2 => "Samarbeidspartnere", 3 => "Bedrift");
|
||||
$type = get_post_meta( $post->ID, 'dagen_bedrift_type', true);
|
||||
|
||||
$html .= ' <tr>';
|
||||
$html .= ' <td class="title" style="padding-right:10px;"><a href="' . get_permalink() . '">' . get_the_title() . '</a></td>';
|
||||
$html .= ' <td class="bedtype" style="font-size:smaller;">' . $types[$type] . '</td>';
|
||||
$html .= ' </tr>';
|
||||
endwhile;
|
||||
|
||||
$html .= '</table><!-- .event-table -->';
|
||||
endif;
|
||||
|
||||
//if( current_user_can('upload_files') { $html .= 'uploading works'; }
|
||||
return $html;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (class_exists("DagenBed")) {
|
||||
$dagen_bedrift_object = new DagenBed();
|
||||
}
|
||||
|
||||
if ( isset($dagen_bedrift_object)){
|
||||
|
||||
/**
|
||||
Register the bedrift post type
|
||||
*/
|
||||
add_action( 'init', 'dagen_bedrift_post_type', 0);
|
||||
add_action( 'save_post', 'dagen_bedrift_save_info');
|
||||
add_shortcode( 'dagen-bedrift-list', 'dagen_bedrift_list' );
|
||||
|
||||
// make a new role, that only can edit and delete own bedrifts
|
||||
add_role('bedrift', 'Bedrift',
|
||||
array( 'read' => 1,
|
||||
'edit_bedrifts' => true,
|
||||
'edit_published_bedrifts' => true,
|
||||
'publish_bedrifts' => true,
|
||||
'delete_bedrifts' => true,
|
||||
'delete_published_bedrifts' => true,
|
||||
'upload_files' => true
|
||||
));
|
||||
|
||||
// give all power to the admins!!
|
||||
$role = get_role('administrator');
|
||||
$role->add_cap('edit_bedrifts');
|
||||
$role->add_cap('edit_published_bedrifts');
|
||||
$role->add_cap('edit_others_bedrifts');
|
||||
$role->add_cap('publish_bedrifts');
|
||||
$role->add_cap('delete_bedrifts');
|
||||
$role->add_cap('delete_others_bedrifts');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,277 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modified (Reduced) TextStatistics Class
|
||||
*
|
||||
* Mostly removed functionality that isn't needed within the WordPress SEO plugin.
|
||||
*
|
||||
* @link http://code.google.com/p/php-text-statistics/
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD license
|
||||
*/
|
||||
|
||||
class Yoast_TextStatistics {
|
||||
|
||||
/**
|
||||
* @var string $strEncoding Used to hold character encoding to be used by object, if set
|
||||
*/
|
||||
protected $strEncoding = '';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $strEncoding Optional character encoding.
|
||||
*/
|
||||
public function __construct( $strEncoding = '' ) {
|
||||
if ( $strEncoding <> '' ) {
|
||||
// Encoding is given. Use it!
|
||||
$this->strEncoding = $strEncoding;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives the Flesch-Kincaid Reading Ease of text entered rounded to one digit
|
||||
*
|
||||
* @param string $strText Text to be checked
|
||||
* @return float
|
||||
*/
|
||||
function flesch_kincaid_reading_ease( $strText ) {
|
||||
$strText = $this->clean_text( $strText );
|
||||
return round( ( 206.835 - ( 1.015 * $this->average_words_per_sentence( $strText ) ) - ( 84.6 * $this->average_syllables_per_word( $strText ) ) ), 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives string length.
|
||||
*
|
||||
* @param string $strText Text to be measured
|
||||
* @return int
|
||||
*/
|
||||
public function text_length( $strText ) {
|
||||
return strlen( utf8_decode( $strText ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives letter count (ignores all non-letters).
|
||||
*
|
||||
* @param string $strText Text to be measured
|
||||
* @return int
|
||||
*/
|
||||
public function letter_count( $strText ) {
|
||||
$strText = $this->clean_text( $strText ); // To clear out newlines etc
|
||||
$strText = preg_replace( '/[^A-Za-z]+/', '', $strText );
|
||||
$intTextLength = strlen( $strText );
|
||||
return $intTextLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trims, removes line breaks, multiple spaces and generally cleans text before processing.
|
||||
*
|
||||
* @param string $strText Text to be transformed
|
||||
* @return string
|
||||
*/
|
||||
protected function clean_text( $strText ) {
|
||||
// all these tags should be preceeded by a full stop.
|
||||
$fullStopTags = array( 'li', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'dd' );
|
||||
foreach ( $fullStopTags as $tag ) {
|
||||
$strText = str_ireplace( '</' . $tag . '>', '.', $strText );
|
||||
}
|
||||
$strText = strip_tags( $strText );
|
||||
$strText = preg_replace( '/[,:;()-]/', ' ', $strText ); // Replace commans, hyphens etc (count them as spaces)
|
||||
$strText = preg_replace( '/[\.!?]/', '.', $strText ); // Unify terminators
|
||||
$strText = trim( $strText ) . '.'; // Add final terminator, just in case it's missing.
|
||||
$strText = preg_replace( '/[ ]*(\n|\r\n|\r)[ ]*/', ' ', $strText ); // Replace new lines with spaces
|
||||
$strText = preg_replace( '/([\.])[\. ]+/', '$1', $strText ); // Check for duplicated terminators
|
||||
$strText = trim( preg_replace( '/[ ]*([\.])/', '$1 ', $strText ) ); // Pad sentence terminators
|
||||
$strText = preg_replace( '/[ ]+/', ' ', $strText ); // Remove multiple spaces
|
||||
$strText = preg_replace_callback( '/\. [^ ]+/', create_function( '$matches', 'return strtolower($matches[0]);' ), $strText ); // Lower case all words following terminators (for gunning fog score)
|
||||
return $strText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts string to lower case. Tries mb_strtolower and if that fails uses regular strtolower.
|
||||
*
|
||||
* @param string $strText Text to be transformed
|
||||
* @return string
|
||||
*/
|
||||
protected function lower_case( $strText ) {
|
||||
return strtolower( $strText );
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts string to upper case. Tries mb_strtoupper and if that fails uses regular strtoupper.
|
||||
*
|
||||
* @param string $strText Text to be transformed
|
||||
* @return string
|
||||
*/
|
||||
protected function upper_case( $strText ) {
|
||||
return strtoupper( $strText );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns sentence count for text.
|
||||
*
|
||||
* @param string $strText Text to be measured
|
||||
* @return int
|
||||
*/
|
||||
public function sentence_count( $strText ) {
|
||||
$strText = $this->clean_text( $strText );
|
||||
// Will be tripped up by "Mr." or "U.K.". Not a major concern at this point.
|
||||
$intSentences = max( 1, $this->text_length( preg_replace( '/[^\.!?]/', '', $strText ) ) );
|
||||
return $intSentences;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns word count for text.
|
||||
*
|
||||
* @param string $strText Text to be measured
|
||||
* @return int
|
||||
*/
|
||||
public function word_count( $strText ) {
|
||||
$strText = $this->clean_text( $strText );
|
||||
// Will be tripped by by em dashes with spaces either side, among other similar characters
|
||||
$intWords = 1 + $this->text_length( preg_replace( '/[^ ]/', '', $strText ) ); // Space count + 1 is word count
|
||||
return $intWords;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns average words per sentence for text.
|
||||
*
|
||||
* @param string $strText Text to be measured
|
||||
* @return int
|
||||
*/
|
||||
public function average_words_per_sentence( $strText ) {
|
||||
$strText = $this->clean_text( $strText );
|
||||
$intSentenceCount = $this->sentence_count( $strText );
|
||||
$intWordCount = $this->word_count( $strText );
|
||||
return ( $intWordCount / $intSentenceCount );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns average syllables per word for text.
|
||||
*
|
||||
* @param string $strText Text to be measured
|
||||
* @return int
|
||||
*/
|
||||
public function average_syllables_per_word( $strText ) {
|
||||
$strText = $this->clean_text( $strText );
|
||||
$intSyllableCount = 0;
|
||||
$intWordCount = $this->word_count( $strText );
|
||||
$arrWords = explode( ' ', $strText );
|
||||
for ( $i = 0; $i < $intWordCount; $i++ ) {
|
||||
$intSyllableCount += $this->syllable_count( $arrWords[$i] );
|
||||
}
|
||||
return ( $intSyllableCount / $intWordCount );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of syllables in the word.
|
||||
* Based in part on Greg Fast's Perl module Lingua::EN::Syllables
|
||||
*
|
||||
* @param string $strWord Word to be measured
|
||||
* @return int
|
||||
*/
|
||||
public function syllable_count( $strWord ) {
|
||||
|
||||
$intSyllableCount = 0;
|
||||
$strWord = $this->lower_case( $strWord );
|
||||
|
||||
// Specific common exceptions that don't follow the rule set below are handled individually
|
||||
// Array of problem words (with word as key, syllable count as value)
|
||||
$arrProblemWords = Array(
|
||||
'simile' => 3
|
||||
, 'forever' => 3
|
||||
, 'shoreline' => 2
|
||||
);
|
||||
if ( isset( $arrProblemWords[$strWord] ) ) {
|
||||
$intSyllableCount = $arrProblemWords[$strWord];
|
||||
}
|
||||
if ( $intSyllableCount > 0 ) {
|
||||
return $intSyllableCount;
|
||||
}
|
||||
|
||||
// These syllables would be counted as two but should be one
|
||||
$arrSubSyllables = Array(
|
||||
'cial'
|
||||
, 'tia'
|
||||
, 'cius'
|
||||
, 'cious'
|
||||
, 'giu'
|
||||
, 'ion'
|
||||
, 'iou'
|
||||
, 'sia$'
|
||||
, '[^aeiuoyt]{2,}ed$'
|
||||
, '.ely$'
|
||||
, '[cg]h?e[rsd]?$'
|
||||
, 'rved?$'
|
||||
, '[aeiouy][dt]es?$'
|
||||
, '[aeiouy][^aeiouydt]e[rsd]?$'
|
||||
, '^[dr]e[aeiou][^aeiou]+$' // Sorts out deal, deign etc
|
||||
, '[aeiouy]rse$' // Purse, hearse
|
||||
);
|
||||
|
||||
// These syllables would be counted as one but should be two
|
||||
$arrAddSyllables = Array(
|
||||
'ia'
|
||||
, 'riet'
|
||||
, 'dien'
|
||||
, 'iu'
|
||||
, 'io'
|
||||
, 'ii'
|
||||
, '[aeiouym]bl$'
|
||||
, '[aeiou]{3}'
|
||||
, '^mc'
|
||||
, 'ism$'
|
||||
, '([^aeiouy])\1l$'
|
||||
, '[^l]lien'
|
||||
, '^coa[dglx].'
|
||||
, '[^gq]ua[^auieo]'
|
||||
, 'dnt$'
|
||||
, 'uity$'
|
||||
, 'ie(r|st)$'
|
||||
);
|
||||
|
||||
// Single syllable prefixes and suffixes
|
||||
$arrPrefixSuffix = Array(
|
||||
'/^un/'
|
||||
, '/^fore/'
|
||||
, '/ly$/'
|
||||
, '/less$/'
|
||||
, '/ful$/'
|
||||
, '/ers?$/'
|
||||
, '/ings?$/'
|
||||
);
|
||||
|
||||
// Remove prefixes and suffixes and count how many were taken
|
||||
$strWord = preg_replace( $arrPrefixSuffix, '', $strWord, -1, $intPrefixSuffixCount );
|
||||
|
||||
// Removed non-word characters from word
|
||||
$strWord = preg_replace( '/[^a-z]/is', '', $strWord );
|
||||
$arrWordParts = preg_split( '/[^aeiouy]+/', $strWord );
|
||||
$intWordPartCount = 0;
|
||||
foreach ( $arrWordParts as $strWordPart ) {
|
||||
if ( $strWordPart <> '' ) {
|
||||
$intWordPartCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// Some syllables do not follow normal rules - check for them
|
||||
// Thanks to Joe Kovar for correcting a bug in the following lines
|
||||
$intSyllableCount = $intWordPartCount + $intPrefixSuffixCount;
|
||||
foreach ( $arrSubSyllables as $strSyllable ) {
|
||||
$intSyllableCount -= preg_match( '~' . $strSyllable . '~', $strWord );
|
||||
}
|
||||
foreach ( $arrAddSyllables as $strSyllable ) {
|
||||
$intSyllableCount += preg_match( '~' . $strSyllable . '~', $strWord );
|
||||
}
|
||||
$intSyllableCount = ( $intSyllableCount == 0 ) ? 1 : $intSyllableCount;
|
||||
return $intSyllableCount;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used from AJAX calls, takes it variables from $_POST, dies on exit.
|
||||
*/
|
||||
function wpseo_set_option() {
|
||||
if ( !current_user_can( 'manage_options' ) )
|
||||
die( '-1' );
|
||||
check_ajax_referer( 'wpseo-setoption' );
|
||||
|
||||
$option = esc_attr( $_POST['option'] );
|
||||
if ( $option != 'page_comments' )
|
||||
die( '-1' );
|
||||
|
||||
update_option( $option, 0 );
|
||||
die( '1' );
|
||||
}
|
||||
|
||||
add_action( 'wp_ajax_wpseo_set_option', 'wpseo_set_option' );
|
||||
|
||||
/**
|
||||
* Function used to remove the admin notices for several purposes, dies on exit.
|
||||
*/
|
||||
function wpseo_set_ignore() {
|
||||
if ( !current_user_can( 'manage_options' ) )
|
||||
die( '-1' );
|
||||
check_ajax_referer( 'wpseo-ignore' );
|
||||
|
||||
$options = get_option( 'wpseo' );
|
||||
$options['ignore_' . $_POST['option']] = 'ignore';
|
||||
update_option( 'wpseo', $options );
|
||||
die( '1' );
|
||||
}
|
||||
|
||||
add_action( 'wp_ajax_wpseo_set_ignore', 'wpseo_set_ignore' );
|
||||
|
||||
/**
|
||||
* Function used to remove the admin notices for several purposes, dies on exit.
|
||||
*/
|
||||
function wpseo_kill_blocking_files() {
|
||||
if ( !current_user_can( 'manage_options' ) )
|
||||
die( '-1' );
|
||||
check_ajax_referer( 'wpseo-blocking-files' );
|
||||
|
||||
$message = 'There were no files to delete.';
|
||||
$options = get_option( 'wpseo' );
|
||||
if ( isset( $options['blocking_files'] ) && is_array( $options['blocking_files'] ) && count( $options['blocking_files'] ) > 0 ) {
|
||||
$message = 'success';
|
||||
foreach ( $options['blocking_files'] as $k => $file ) {
|
||||
if ( !@unlink( $file ) )
|
||||
$message = __( 'Some files could not be removed. Please remove them via FTP.', 'wordpress-seo' );
|
||||
else
|
||||
unset( $options['blocking_files'][$k] );
|
||||
}
|
||||
update_option( 'wpseo', $options );
|
||||
}
|
||||
|
||||
die( $message );
|
||||
}
|
||||
|
||||
add_action( 'wp_ajax_wpseo_kill_blocking_files', 'wpseo_kill_blocking_files' );
|
||||
|
||||
/**
|
||||
* Retrieve the suggestions from the Google Suggest API and return them to be
|
||||
* used in the suggest box within the plugin. Dies on exit.
|
||||
*/
|
||||
function wpseo_get_suggest() {
|
||||
check_ajax_referer( 'wpseo-get-suggest' );
|
||||
|
||||
$term = urlencode( $_GET['term'] );
|
||||
$result = wp_remote_get( 'http://www.google.com/complete/search?output=toolbar&q=' . $term );
|
||||
|
||||
preg_match_all( '/suggestion data="([^"]+)"\/>/u', $result['body'], $matches );
|
||||
|
||||
$return_arr = array();
|
||||
|
||||
foreach ( $matches[1] as $match ) {
|
||||
$return_arr[] = html_entity_decode( $match, ENT_COMPAT, "UTF-8" );
|
||||
}
|
||||
echo json_encode( $return_arr );
|
||||
die();
|
||||
}
|
||||
|
||||
add_action( 'wp_ajax_wpseo_get_suggest', 'wpseo_get_suggest' );
|
||||
@@ -0,0 +1,568 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'HTTP/1.0 403 Forbidden' );
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class that holds most of the admin functionality for WP SEO.
|
||||
*/
|
||||
class WPSEO_Admin {
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*/
|
||||
function __construct() {
|
||||
$this->multisite_defaults();
|
||||
|
||||
$options = get_wpseo_options();
|
||||
|
||||
if ( isset( $options['stripcategorybase'] ) && $options['stripcategorybase'] ) {
|
||||
add_action( 'created_category', 'flush_rewrite_rules' );
|
||||
add_action( 'edited_category', 'flush_rewrite_rules' );
|
||||
add_action( 'delete_category', 'flush_rewrite_rules' );
|
||||
}
|
||||
|
||||
if ( $this->grant_access() ) {
|
||||
add_action( 'admin_init', array( $this, 'options_init' ) );
|
||||
// Needs the lower than default priority so other plugins can hook underneath it without issue.
|
||||
add_action( 'admin_menu', array( $this, 'register_settings_page' ), 5 );
|
||||
add_action( 'network_admin_menu', array( $this, 'register_network_settings_page' ) );
|
||||
|
||||
add_filter( 'plugin_action_links', array( $this, 'add_action_link' ), 10, 2 );
|
||||
add_action( 'admin_print_scripts', array( $this, 'config_page_scripts' ) );
|
||||
|
||||
if ( '0' == get_option( 'blog_public' ) )
|
||||
add_action( 'admin_footer', array( $this, 'blog_public_warning' ) );
|
||||
}
|
||||
|
||||
add_action( 'admin_init', array( $this, 'maybe_upgrade' ) );
|
||||
|
||||
add_filter( 'name_save_pre', array( $this, 'remove_stopwords_from_slug' ), 0 );
|
||||
|
||||
add_action( 'show_user_profile', array( $this, 'user_profile' ) );
|
||||
add_action( 'edit_user_profile', array( $this, 'user_profile' ) );
|
||||
add_action( 'personal_options_update', array( $this, 'process_user_option_update' ) );
|
||||
add_action( 'edit_user_profile_update', array( $this, 'process_user_option_update' ) );
|
||||
add_filter( 'user_contactmethods', array( $this, 'update_contactmethods' ), 10, 1 );
|
||||
|
||||
add_action( 'update_option_wpseo_titles', array( $this, 'clear_cache' ) );
|
||||
add_action( 'update_option_wpseo', array( $this, 'clear_cache' ) );
|
||||
|
||||
add_action( 'update_option_wpseo_permalinks', array( $this, 'clear_rewrites' ) );
|
||||
add_action( 'update_option_wpseo_xml', array( $this, 'clear_rewrites' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the cache
|
||||
*/
|
||||
function clear_cache() {
|
||||
if ( function_exists( 'w3tc_pgcache_flush' ) ) {
|
||||
w3tc_pgcache_flush();
|
||||
} else if ( function_exists( 'wp_cache_clear_cache' ) ) {
|
||||
wp_cache_clear_cache();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear rewrites
|
||||
*/
|
||||
function clear_rewrites() {
|
||||
delete_option( 'rewrite_rules' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all the options needed for the configuration pages.
|
||||
*/
|
||||
function options_init() {
|
||||
register_setting( 'yoast_wpseo_options', 'wpseo' );
|
||||
register_setting( 'yoast_wpseo_permalinks_options', 'wpseo_permalinks' );
|
||||
register_setting( 'yoast_wpseo_titles_options', 'wpseo_titles' );
|
||||
register_setting( 'yoast_wpseo_rss_options', 'wpseo_rss' );
|
||||
register_setting( 'yoast_wpseo_internallinks_options', 'wpseo_internallinks' );
|
||||
register_setting( 'yoast_wpseo_xml_sitemap_options', 'wpseo_xml' );
|
||||
register_setting( 'yoast_wpseo_social_options', 'wpseo_social' );
|
||||
|
||||
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
|
||||
if ( get_option( 'wpseo' ) == '1pseo_social' )
|
||||
delete_option( 'wpseo' );
|
||||
register_setting( 'yoast_wpseo_multisite_options', 'wpseo_multisite' );
|
||||
}
|
||||
}
|
||||
|
||||
function multisite_defaults() {
|
||||
$option = get_option( 'wpseo' );
|
||||
if ( function_exists( 'is_multisite' ) && is_multisite() && !is_array( $option ) ) {
|
||||
$options = get_site_option( 'wpseo_ms' );
|
||||
if ( is_array( $options ) && isset( $options['defaultblog'] ) && !empty( $options['defaultblog'] ) && $options['defaultblog'] != 0 ) {
|
||||
foreach ( get_wpseo_options_arr() as $wpseo_option ) {
|
||||
update_option( $wpseo_option, get_blog_option( $options['defaultblog'], $wpseo_option ) );
|
||||
}
|
||||
}
|
||||
$option['ms_defaults_set'] = true;
|
||||
update_option( 'wpseo', $option );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the current user is allowed to access the configuration.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function grant_access() {
|
||||
if ( !function_exists( 'is_multisite' ) || !is_multisite() )
|
||||
return true;
|
||||
|
||||
$options = get_site_option( 'wpseo_ms' );
|
||||
if ( !is_array( $options ) || !isset( $options['access'] ) )
|
||||
return true;
|
||||
|
||||
if ( $options['access'] == 'superadmin' && !is_super_admin() )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the menu item and its sub menu's.
|
||||
*
|
||||
* @global array $submenu used to change the label on the first item.
|
||||
*/
|
||||
function register_settings_page() {
|
||||
add_menu_page( __( 'WordPress SEO Configuration', 'wordpress-seo' ), __( 'SEO', 'wordpress-seo' ), 'manage_options', 'wpseo_dashboard', array( $this, 'config_page' ), WPSEO_URL . 'images/yoast-icon.png' );
|
||||
add_submenu_page( 'wpseo_dashboard', __( 'Titles & Metas', 'wordpress-seo' ), __( 'Titles & Metas', 'wordpress-seo' ), 'manage_options', 'wpseo_titles', array( $this, 'titles_page' ) );
|
||||
add_submenu_page( 'wpseo_dashboard', __( 'Social', 'wordpress-seo' ), __( 'Social', 'wordpress-seo' ), 'manage_options', 'wpseo_social', array( $this, 'social_page' ) );
|
||||
add_submenu_page( 'wpseo_dashboard', __( 'XML Sitemaps', 'wordpress-seo' ), __( 'XML Sitemaps', 'wordpress-seo' ), 'manage_options', 'wpseo_xml', array( $this, 'xml_sitemaps_page' ) );
|
||||
add_submenu_page( 'wpseo_dashboard', __( 'Permalinks', 'wordpress-seo' ), __( 'Permalinks', 'wordpress-seo' ), 'manage_options', 'wpseo_permalinks', array( $this, 'permalinks_page' ) );
|
||||
add_submenu_page( 'wpseo_dashboard', __( 'Internal Links', 'wordpress-seo' ), __( 'Internal Links', 'wordpress-seo' ), 'manage_options', 'wpseo_internal-links', array( $this, 'internallinks_page' ) );
|
||||
add_submenu_page( 'wpseo_dashboard', __( 'RSS', 'wordpress-seo' ), __( 'RSS', 'wordpress-seo' ), 'manage_options', 'wpseo_rss', array( $this, 'rss_page' ) );
|
||||
add_submenu_page( 'wpseo_dashboard', __( 'Import & Export', 'wordpress-seo' ), __( 'Import & Export', 'wordpress-seo' ), 'manage_options', 'wpseo_import', array( $this, 'import_page' ) );
|
||||
|
||||
if ( !( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) && !( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) ) {
|
||||
// Make sure on a multi site install only super admins can edit .htaccess and robots.txt
|
||||
if ( !function_exists( 'is_multisite' ) || !is_multisite() )
|
||||
add_submenu_page( 'wpseo_dashboard', __( 'Edit files', 'wordpress-seo' ), __( 'Edit files', 'wordpress-seo' ), 'manage_options', 'wpseo_files', array( $this, 'files_page' ) );
|
||||
else
|
||||
add_submenu_page( 'wpseo_dashboard', __( 'Edit files', 'wordpress-seo' ), __( 'Edit files', 'wordpress-seo' ), 'delete_users', 'wpseo_files', array( $this, 'files_page' ) );
|
||||
}
|
||||
|
||||
global $submenu;
|
||||
if ( isset( $submenu['wpseo_dashboard'] ) )
|
||||
$submenu['wpseo_dashboard'][0][0] = __( 'Dashboard', 'wordpress-seo' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the settings page for the Network settings.
|
||||
*/
|
||||
function register_network_settings_page() {
|
||||
add_menu_page( __( 'WordPress SEO Configuration', 'wordpress-seo' ), __( 'SEO', 'wordpress-seo' ), 'delete_users', 'wpseo_dashboard', array( $this, 'network_config_page' ), WPSEO_URL . 'images/yoast-icon.png' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the form for the network configuration page.
|
||||
*/
|
||||
function network_config_page() {
|
||||
require( WPSEO_PATH . '/admin/pages/network.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the form for the import/export page.
|
||||
*/
|
||||
function import_page() {
|
||||
if ( isset( $_GET['page'] ) && 'wpseo_import' == $_GET['page'] )
|
||||
include( WPSEO_PATH . '/admin/pages/import.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the form for the titles & metas page.
|
||||
*/
|
||||
function titles_page() {
|
||||
if ( isset( $_GET['page'] ) && 'wpseo_titles' == $_GET['page'] )
|
||||
include( WPSEO_PATH . '/admin/pages/metas.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the form for the permalinks page.
|
||||
*/
|
||||
function permalinks_page() {
|
||||
if ( isset( $_GET['page'] ) && 'wpseo_permalinks' == $_GET['page'] )
|
||||
include( WPSEO_PATH . '/admin/pages/permalinks.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the form for the internal links / breadcrumbs page.
|
||||
*/
|
||||
function internallinks_page() {
|
||||
if ( isset( $_GET['page'] ) && 'wpseo_internal-links' == $_GET['page'] )
|
||||
include( WPSEO_PATH . '/admin/pages/internal-links.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the form for the file edit page.
|
||||
*/
|
||||
function files_page() {
|
||||
if ( isset( $_GET['page'] ) && 'wpseo_files' == $_GET['page'] )
|
||||
include( WPSEO_PATH . '/admin/pages/files.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the form for the RSS page.
|
||||
*/
|
||||
function rss_page() {
|
||||
if ( isset( $_GET['page'] ) && 'wpseo_rss' == $_GET['page'] )
|
||||
include( WPSEO_PATH . '/admin/pages/rss.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the form for the XML Sitemaps page.
|
||||
*/
|
||||
function xml_sitemaps_page() {
|
||||
if ( isset( $_GET['page'] ) && 'wpseo_xml' == $_GET['page'] )
|
||||
include( WPSEO_PATH . '/admin/pages/xml-sitemaps.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the form for the Dashboard page.
|
||||
*/
|
||||
function config_page() {
|
||||
if ( isset( $_GET['page'] ) && 'wpseo_dashboard' == $_GET['page'] )
|
||||
include( WPSEO_PATH . '/admin/pages/dashboard.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the form for the Social Settings page.
|
||||
*/
|
||||
function social_page() {
|
||||
if ( isset( $_GET['page'] ) && 'wpseo_social' == $_GET['page'] )
|
||||
require( WPSEO_PATH . '/admin/pages/social.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Display an error message when the blog is set to private.
|
||||
*/
|
||||
function blog_public_warning() {
|
||||
if ( function_exists( 'is_network_admin' ) && is_network_admin() )
|
||||
return;
|
||||
|
||||
$options = get_option( 'wpseo' );
|
||||
if ( isset( $options['ignore_blog_public_warning'] ) && $options['ignore_blog_public_warning'] == 'ignore' )
|
||||
return;
|
||||
echo "<div id='message' class='error'>";
|
||||
echo "<p><strong>" . __( "Huge SEO Issue: You're blocking access to robots.", 'wordpress-seo' ) . "</strong> " . sprintf( __( "You must %sgo to your Reading Settings%s and uncheck the box for Search Engine Visibility.", 'wordpress-seo' ), "<a href='".admin_url('options-reading.php')."'>", "</a>" ) . " <a href='javascript:wpseo_setIgnore(\"blog_public_warning\",\"message\",\"" . wp_create_nonce( 'wpseo-ignore' ) . "\");' class='button'>" . __( "I know, don't bug me.", 'wordpress-seo' ) . "</a></p></div>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a link to the settings page to the plugins list
|
||||
*
|
||||
* @staticvar string $this_plugin holds the directory & filename for the plugin
|
||||
* @param array $links array of links for the plugins, adapted when the current plugin is found.
|
||||
* @param string $file the filename for the current plugin, which the filter loops through.
|
||||
* @return array $links
|
||||
*/
|
||||
function add_action_link( $links, $file ) {
|
||||
static $this_plugin;
|
||||
if ( empty( $this_plugin ) ) $this_plugin = 'wordpress-seo/wp-seo.php';
|
||||
if ( $file == $this_plugin ) {
|
||||
$settings_link = '<a href="' . admin_url( 'admin.php?page=wpseo_dashboard' ) . '">' . __( 'Settings', 'wordpress-seo' ) . '</a>';
|
||||
array_unshift( $links, $settings_link );
|
||||
}
|
||||
return $links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues the (tiny) global JS needed for the plugin.
|
||||
*/
|
||||
function config_page_scripts() {
|
||||
wp_enqueue_script( 'wpseo-admin-global-script', WPSEO_URL . 'js/wp-seo-admin-global.js', array( 'jquery' ), WPSEO_VERSION, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the user metas that (might) have been set on the user profile page.
|
||||
*
|
||||
* @param int $user_id of the updated user
|
||||
*/
|
||||
function process_user_option_update( $user_id ) {
|
||||
if ( isset( $_POST['wpseo_author_title'] ) ) {
|
||||
check_admin_referer( 'wpseo_user_profile_update', 'wpseo_nonce' );
|
||||
update_user_meta( $user_id, 'wpseo_title', ( isset( $_POST['wpseo_author_title'] ) ? esc_html( $_POST['wpseo_author_title'] ) : '' ) );
|
||||
update_user_meta( $user_id, 'wpseo_metadesc', ( isset( $_POST['wpseo_author_metadesc'] ) ? esc_html( $_POST['wpseo_author_metadesc'] ) : '' ) );
|
||||
update_user_meta( $user_id, 'wpseo_metakey', ( isset( $_POST['wpseo_author_metakey'] ) ? esc_html( $_POST['wpseo_author_metakey'] ) : '' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the $contactmethods array and add Google+ and Twitter.
|
||||
*
|
||||
* These are used with the rel="author" and Twitter cards implementation.
|
||||
*
|
||||
* @param array $contactmethods currently set contactmethods.
|
||||
* @return array $contactmethods with added contactmethods.
|
||||
*/
|
||||
function update_contactmethods( $contactmethods ) {
|
||||
// Add Google+
|
||||
$contactmethods['googleplus'] = 'Google+';
|
||||
// Add Twitter
|
||||
$contactmethods['twitter'] = __( 'Twitter username (without @)', 'wordpress-seo' );
|
||||
|
||||
return $contactmethods;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the inputs needed for SEO values to the User Profile page
|
||||
*
|
||||
* @param object $user
|
||||
*/
|
||||
function user_profile( $user ) {
|
||||
|
||||
if ( !current_user_can( 'edit_users' ) )
|
||||
return;
|
||||
|
||||
$options = get_wpseo_options();
|
||||
|
||||
wp_nonce_field( 'wpseo_user_profile_update', 'wpseo_nonce' );
|
||||
?>
|
||||
<h3 id="wordpress-seo"><?php _e( "WordPress SEO settings", 'wordpress-seo' ); ?></h3>
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th><?php _e( "Title to use for Author page", 'wordpress-seo' ); ?></th>
|
||||
<td><input class="regular-text" type="text" name="wpseo_author_title"
|
||||
value="<?php echo esc_attr( get_the_author_meta( 'wpseo_title', $user->ID ) ); ?>"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php _e( "Meta description to use for Author page", 'wordpress-seo' ); ?></th>
|
||||
<td><textarea rows="3" cols="30"
|
||||
name="wpseo_author_metadesc"><?php echo esc_html( get_the_author_meta( 'wpseo_metadesc', $user->ID ) ); ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ( isset( $options['usemetakeywords'] ) && $options['usemetakeywords'] ) { ?>
|
||||
<tr>
|
||||
<th><?php _e( "Meta keywords to use for Author page", 'wordpress-seo' ); ?></th>
|
||||
<td><input class="regular-text" type="text" name="wpseo_author_metakey"
|
||||
value="<?php echo esc_attr( get_the_author_meta( 'wpseo_metakey', $user->ID ) ); ?>"/></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<br/><br/>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the wpseo option holds the current version, if it doesn't, run
|
||||
* the upgrade procedures.
|
||||
*/
|
||||
function maybe_upgrade() {
|
||||
$options = get_option( 'wpseo' );
|
||||
$current_version = isset( $options['version'] ) ? $options['version'] : 0;
|
||||
|
||||
if ( version_compare( $current_version, WPSEO_VERSION, '==' ) )
|
||||
return;
|
||||
|
||||
delete_option( 'rewrite_rules' );
|
||||
|
||||
// <= 0.3.5: flush rewrite rules for new XML sitemaps
|
||||
if ( $current_version == 0 ) {
|
||||
flush_rewrite_rules();
|
||||
}
|
||||
|
||||
if ( version_compare( $current_version, '0.4.2', '<' ) ) {
|
||||
$xml_opt = array();
|
||||
// Move XML Sitemap settings from general array to XML specific array, general settings first
|
||||
foreach ( array( 'enablexmlsitemap', 'xml_include_images', 'xml_ping_google', 'xml_ping_bing', 'xml_ping_yahoo', 'xml_ping_ask', 'xmlnews_posttypes' ) as $opt ) {
|
||||
if ( isset( $options[$opt] ) ) {
|
||||
$xml_opt[$opt] = $options[$opt];
|
||||
unset( $options[$opt] );
|
||||
}
|
||||
}
|
||||
// Per post type settings
|
||||
foreach ( get_post_types() as $post_type ) {
|
||||
if ( in_array( $post_type, array( 'revision', 'nav_menu_item', 'attachment' ) ) )
|
||||
continue;
|
||||
|
||||
if ( isset( $options['post_types-' . $post_type . '-not_in_sitemap'] ) ) {
|
||||
$xml_opt['post_types-' . $post_type . '-not_in_sitemap'] = $options['post_types-' . $post_type . '-not_in_sitemap'];
|
||||
unset( $options['post_types-' . $post_type . '-not_in_sitemap'] );
|
||||
}
|
||||
}
|
||||
// Per taxonomy settings
|
||||
foreach ( get_taxonomies() as $taxonomy ) {
|
||||
if ( in_array( $taxonomy, array( 'nav_menu', 'link_category', 'post_format' ) ) )
|
||||
continue;
|
||||
|
||||
if ( isset( $options['taxonomies-' . $taxonomy . '-not_in_sitemap'] ) ) {
|
||||
$xml_opt['taxonomies-' . $taxonomy . '-not_in_sitemap'] = $options['taxonomies-' . $taxonomy . '-not_in_sitemap'];
|
||||
unset( $options['taxonomies-' . $taxonomy . '-not_in_sitemap'] );
|
||||
}
|
||||
}
|
||||
if ( get_option( 'wpseo_xml' ) === false )
|
||||
update_option( 'wpseo_xml', $xml_opt );
|
||||
unset( $xml_opt );
|
||||
|
||||
// Clean up other no longer used settings
|
||||
unset( $options['wpseodir'], $options['wpseourl'] );
|
||||
}
|
||||
|
||||
if ( version_compare( $current_version, '1.0.2.2', '<' ) ) {
|
||||
$opt = (array) get_option( 'wpseo_indexation' );
|
||||
unset( $opt['hideindexrel'], $opt['hidestartrel'], $opt['hideprevnextpostlink'], $opt['hidewpgenerator'] );
|
||||
update_option( 'wpseo_indexation', $opt );
|
||||
}
|
||||
|
||||
if ( version_compare( $current_version, '1.0.4', '<' ) ) {
|
||||
$opt = (array) get_option( 'wpseo_indexation' );
|
||||
$newopt = array(
|
||||
'opengraph' => isset( $opt['opengraph'] ) ? $opt['opengraph'] : '',
|
||||
'fb_adminid' => isset( $opt['fb_adminid'] ) ? $opt['fb_adminid'] : '',
|
||||
'fb_appid' => isset( $opt['fb_appid'] ) ? $opt['fb_appid'] : '',
|
||||
);
|
||||
update_option( 'wpseo_social', $newopt );
|
||||
unset( $opt['opengraph'], $opt['fb_pageid'], $opt['fb_adminid'], $opt['fb_appid'] );
|
||||
update_option( 'wpseo_indexation', $opt );
|
||||
}
|
||||
|
||||
if ( version_compare( $current_version, '1.2', '<' ) ) {
|
||||
$opt = get_option( 'wpseo_indexation' );
|
||||
$metaopt = get_option( 'wpseo_titles' );
|
||||
|
||||
$metaopt['noindex-author'] = isset( $opt['noindexauthor'] ) ? $opt['noindexauthor'] : '';
|
||||
$metaopt['disable-author'] = isset( $opt['disableauthor'] ) ? $opt['disableauthor'] : '';
|
||||
$metaopt['noindex-archive'] = isset( $opt['noindexdate'] ) ? $opt['noindexdate'] : '';
|
||||
$metaopt['noindex-category'] = isset( $opt['noindexcat'] ) ? $opt['noindexcat'] : '';
|
||||
$metaopt['noindex-post_tag'] = isset( $opt['noindextag'] ) ? $opt['noindextag'] : '';
|
||||
$metaopt['noindex-post_format'] = isset( $opt['noindexpostformat'] ) ? $opt['noindexpostformat'] : '';
|
||||
$metaopt['noindex-subpages'] = isset( $opt['noindexsubpages'] ) ? $opt['noindexsubpages'] : '';
|
||||
$metaopt['hide-rsdlink'] = isset( $opt['hidersdlink'] ) ? $opt['hidersdlink'] : '';
|
||||
$metaopt['hide-feedlinks'] = isset( $opt['hidefeedlinks'] ) ? $opt['hidefeedlinks'] : '';
|
||||
$metaopt['hide-wlwmanifest'] = isset( $opt['hidewlwmanifest'] ) ? $opt['hidewlwmanifest'] : '';
|
||||
$metaopt['hide-shortlink'] = isset( $opt['hideshortlink'] ) ? $opt['hideshortlink'] : '';
|
||||
|
||||
update_option( 'wpseo_titles', $metaopt );
|
||||
|
||||
delete_option( 'wpseo_indexation' );
|
||||
|
||||
wpseo_title_test();
|
||||
}
|
||||
|
||||
// Clean up the wrong wpseo options
|
||||
if ( version_compare( $current_version, '1.2.3', '<' ) ) {
|
||||
$opt = get_option( 'wpseo' );
|
||||
|
||||
if ( is_array( $opt ) ) {
|
||||
foreach ( $opt as $key => $val ) {
|
||||
if ( !in_array( $key, array( 'ignore_blog_public_warning', 'ignore_tour', 'ignore_page_comments', 'ignore_permalink', 'ms_defaults_set', 'version', 'disableadvanced_meta', 'googleverify', 'msverify', 'alexaverify' ) ) ) {
|
||||
unset( $opt[$key] );
|
||||
}
|
||||
}
|
||||
|
||||
update_option( 'wpseo', $opt );
|
||||
unset( $opt );
|
||||
}
|
||||
}
|
||||
|
||||
// Fix wrongness created by buggy version 1.2.2
|
||||
if ( version_compare( $current_version, '1.2.4', '<' ) ) {
|
||||
$options = get_option( 'wpseo_titles' );
|
||||
if ( is_array( $options ) && isset( $options['title-home'] ) && $options['title-home'] == '%%sitename%% - %%sitedesc%% - 12345' ) {
|
||||
$options['title-home'] = '%%sitename%% - %%sitedesc%%';
|
||||
update_option( 'wpseo_titles', $options );
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compare( $current_version, '1.2.8', '<' ) ) {
|
||||
$options = get_option( 'wpseo' );
|
||||
if ( is_array( $options ) && isset( $options['presstrends'] ) ) {
|
||||
$options['yoast_tracking'] = 'on';
|
||||
unset( $options['presstrends'] );
|
||||
update_option( 'wpseo', $options );
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compare( $current_version, '1.2.8.2', '<' ) ) {
|
||||
$options = get_option( 'wpseo' );
|
||||
if ( is_array( $options ) && isset( $options['presstrends'] ) ) {
|
||||
$options['yoast_tracking'] = 'on';
|
||||
unset( $options['presstrends'] );
|
||||
}
|
||||
if ( is_array( $options ) && isset( $options['presstrends_popup'] ) ) {
|
||||
$options['tracking_popup'] = 'on';
|
||||
unset( $options['presstrends_popup'] );
|
||||
}
|
||||
update_option( 'wpseo', $options );
|
||||
}
|
||||
|
||||
if ( version_compare( $current_version, '1.3.2', '<' ) ) {
|
||||
$options = get_option( 'wpseo_xml' );
|
||||
|
||||
$options['post_types-attachment-not_in_sitemap'] = true;
|
||||
update_option( 'wpseo_xml', $options );
|
||||
}
|
||||
|
||||
$options = get_option( 'wpseo' );
|
||||
$options['version'] = WPSEO_VERSION;
|
||||
update_option( 'wpseo', $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans stopwords out of the slug, if the slug hasn't been set yet.
|
||||
*
|
||||
* @since 1.1.7
|
||||
*
|
||||
* @param string $slug if this isn't empty, the function will return an unaltered slug.
|
||||
* @return string $clean_slug cleaned slug
|
||||
*/
|
||||
function remove_stopwords_from_slug( $slug ) {
|
||||
// Don't to change an existing slug
|
||||
if ( $slug )
|
||||
return $slug;
|
||||
|
||||
if ( !isset( $_POST['post_title'] ) )
|
||||
return $slug;
|
||||
|
||||
// Lowercase the slug and strip slashes
|
||||
$clean_slug = sanitize_title( stripslashes( $_POST['post_title'] ) );
|
||||
|
||||
// Turn it to an array and strip stopwords by comparing against an array of stopwords
|
||||
$clean_slug_array = array_diff( explode( " ", $clean_slug ), $this->stopwords() );
|
||||
|
||||
// Turn the sanitized array into a string
|
||||
$clean_slug = join( "-", $clean_slug_array );
|
||||
|
||||
return $clean_slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the stopwords for the current language
|
||||
*
|
||||
* @since 1.1.7
|
||||
*
|
||||
* @return array $stopwords array of stop words to check and / or remove from slug
|
||||
*/
|
||||
function stopwords() {
|
||||
/* translators: this should be an array of stopwords for your language, separated by comma's. */
|
||||
return explode( ',', __( "a,about,above,after,again,against,all,am,an,and,any,are,aren't,as,at,be,because,been,before,being,below,between,both,but,by,can't,cannot,could,couldn't,did,didn't,do,does,doesn't,doing,don't,down,during,each,few,for,from,further,had,hadn't,has,hasn't,have,haven't,having,he,he'd,he'll,he's,her,here,here's,hers,herself,him,himself,his,how,how's,i,i'd,i'll,i'm,i've,if,in,into,is,isn't,it,it's,its,itself,let's,me,more,most,mustn't,my,myself,no,nor,not,of,off,on,once,only,or,other,ought,our,ours , ourselves,out,over,own,same,shan't,she,she'd,she'll,she's,should,shouldn't,so,some,such,than,that,that's,the,their,theirs,them,themselves,then,there,there's,these,they,they'd,they'll,they're,they've,this,those,through,to,too,under,until,up,very,was,wasn't,we,we'd,we'll,we're,we've,were,weren't,what,what's,when,when's,where,where's,which,while,who,who's,whom,why,why's,with,won't,would,wouldn't,you,you'd,you'll,you're,you've,your,yours,yourself,yourselves", "wordpress-seo" ) );
|
||||
}
|
||||
|
||||
function stopwords_check( $haystack, $checkingUrl = false ) {
|
||||
$stopWords = $this->stopwords();
|
||||
|
||||
foreach ( $stopWords as $stopWord ) {
|
||||
// If checking a URL remove the single quotes
|
||||
if ( $checkingUrl )
|
||||
$stopWord = str_replace( "'", "", $stopWord );
|
||||
|
||||
// Check whether the stopword appears as a whole word
|
||||
$res = preg_match( "/(^|[ \n\r\t\.,'\(\)\"\+;!?:])" . preg_quote( $stopWord, '/' ) . "($|[ \n\r\t\.,'\(\)\"\+;!?:])/i", $haystack, $match );
|
||||
if ( $res > 0 )
|
||||
return $stopWord;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Globalize the var first as it's needed globally.
|
||||
global $wpseo_admin;
|
||||
$wpseo_admin = new WPSEO_Admin();
|
||||
@@ -0,0 +1,538 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'HTTP/1.0 403 Forbidden' );
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* class WPSEO_Admin_Pages
|
||||
*
|
||||
* Class with functionality for the WP SEO admin pages.
|
||||
*/
|
||||
class WPSEO_Admin_Pages {
|
||||
|
||||
/**
|
||||
* @var string $currentoption The option in use for the current admin page.
|
||||
*/
|
||||
var $currentoption = 'wpseo';
|
||||
|
||||
/**
|
||||
* @var array $adminpages Array of admin pages that the plugin uses.
|
||||
*/
|
||||
var $adminpages = array( 'wpseo_dashboard', 'wpseo_rss', 'wpseo_files', 'wpseo_permalinks', 'wpseo_internal-links', 'wpseo_import', 'wpseo_titles', 'wpseo_xml', 'wpseo_social' );
|
||||
|
||||
/**
|
||||
* Class constructor, which basically only hooks the init function on the init hook
|
||||
*/
|
||||
function __construct() {
|
||||
add_action( 'init', array( $this, 'init' ), 20 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure the needed scripts are loaded for admin pages
|
||||
*/
|
||||
function init() {
|
||||
if ( isset( $_GET['wpseo_reset_defaults'] ) && wp_verify_nonce( $_GET['nonce'], 'wpseo_reset_defaults' ) && current_user_can( 'manage_options' ) ) {
|
||||
$this->reset_defaults();
|
||||
wp_redirect( admin_url( 'admin.php?page=wpseo_dashboard' ) );
|
||||
}
|
||||
|
||||
$this->adminpages = apply_filters( 'wpseo_admin_pages', $this->adminpages );
|
||||
|
||||
global $wpseo_admin;
|
||||
|
||||
if ( $wpseo_admin->grant_access() ) {
|
||||
add_action( 'admin_print_scripts', array( $this, 'config_page_scripts' ) );
|
||||
add_action( 'admin_print_styles', array( $this, 'config_page_styles' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the site to the default WordPress SEO settings and runs a title test to check whether force rewrite needs to be on.
|
||||
*/
|
||||
function reset_defaults() {
|
||||
foreach ( get_wpseo_options_arr() as $opt ) {
|
||||
delete_option( $opt );
|
||||
}
|
||||
wpseo_defaults();
|
||||
|
||||
wpseo_title_test();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the sidebar for admin pages.
|
||||
*/
|
||||
function admin_sidebar() {
|
||||
$banners = array(
|
||||
array(
|
||||
'url' => 'https://yoast.com/hire-us/website-review/#utm_source=wordpress-seo-config&utm_medium=banner&utm_campaign=website-review-banner',
|
||||
'img' => 'banner-website-review.png',
|
||||
'alt' => 'Website Review banner',
|
||||
)
|
||||
);
|
||||
if ( 'nl_NL' == get_locale() ) {
|
||||
$rand = rand( 1, 2 );
|
||||
switch ( $rand ) {
|
||||
case 1:
|
||||
$banners[] = array(
|
||||
'url' => 'http://yoast.nl/seo-trainingen/wordpress-seo-training//#utm_source=wordpress-seo-config&utm_medium=banner&utm_campaign=wpseo-training-banner&utm_content=prijs',
|
||||
'img' => 'banner-wpseo-training.png',
|
||||
'alt' => 'WordPress SEO Training banner',
|
||||
);
|
||||
break;
|
||||
case 2:
|
||||
$banners[] = array(
|
||||
'url' => 'http://yoast.nl/seo-trainingen/wordpress-seo-training//#utm_source=wordpress-seo-config&utm_medium=banner&utm_campaign=wpseo-training-banner&utm_content=klik-hier',
|
||||
'img' => 'banner-wpseo-training-2.png',
|
||||
'alt' => 'WordPress SEO Training banner',
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !class_exists( 'wpseo_Video_Sitemap' ) ) {
|
||||
$banners[] = array(
|
||||
'url' => 'http://yoast.com/wordpress/video-seo/#utm_source=wordpress-seo-config&utm_medium=banner&utm_campaign=video-seo-banner',
|
||||
'img' => 'banner-video-seo.png',
|
||||
'alt' => 'Banner WordPress SEO Video SEO extension',
|
||||
);
|
||||
}
|
||||
if ( !class_exists( 'wpseo_Video_Manual' ) ) {
|
||||
$banners[] = array(
|
||||
'url' => 'http://yoast.com/wordpress/video-manual-wordpress-seo/#utm_source=wordpress-seo-config&utm_medium=banner&utm_campaign=video-manual-banner',
|
||||
'img' => 'banner-video-seo-manual.png',
|
||||
'alt' => 'Banner WordPress SEO Video manual',
|
||||
);
|
||||
}
|
||||
shuffle( $banners );
|
||||
?>
|
||||
<div class="postbox-container" style="width:261px;">
|
||||
<div id="sidebar">
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ( $banners as $banner ) {
|
||||
if ( $i == 3 )
|
||||
break;
|
||||
if ( $i != 0 )
|
||||
echo '<hr style="border:none;border-top:dotted 1px #f48500;margin: 30px 0;">';
|
||||
echo '<a target="_blank" href="' . $banner['url'] . '"><img src="' . WPSEO_URL . '/images/' . $banner['img'] . '" alt="' . $banner['alt'] . '"/></a>';
|
||||
$i++;
|
||||
}
|
||||
?>
|
||||
<br/><br/><br/>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the header for admin pages
|
||||
*
|
||||
* @param string $title The title to show in the main heading.
|
||||
* @param bool $form Whether or not the form should be included.
|
||||
* @param string $option The long name of the option to use for the current page.
|
||||
* @param string $optionshort The short name of the option to use for the current page.
|
||||
* @param bool $contains_files Whether the form should allow for file uploads.
|
||||
*/
|
||||
function admin_header( $title, $form = true, $option = 'yoast_wpseo_options', $optionshort = 'wpseo', $contains_files = false ) {
|
||||
?>
|
||||
<div class="wrap">
|
||||
<?php
|
||||
if ( ( isset( $_GET['updated'] ) && $_GET['updated'] == 'true' ) || ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] == 'true' ) ) {
|
||||
$msg = __( 'Settings updated', 'wordpress-seo' );
|
||||
|
||||
echo '<div id="message" style="width:94%;" class="message updated"><p><strong>' . esc_html( $msg ) . '.</strong></p></div>';
|
||||
}
|
||||
?>
|
||||
<a href="http://yoast.com/">
|
||||
<div id="yoast-icon"
|
||||
style="background: url('<?php echo WPSEO_URL; ?>images/wordpress-SEO-32x32.png') no-repeat;"
|
||||
class="icon32">
|
||||
<br/>
|
||||
</div>
|
||||
</a>
|
||||
<h2 id="wpseo-title"><?php _e( "Yoast WordPress SEO: ", 'wordpress-seo' ); echo $title; ?></h2>
|
||||
<div id="wpseo_content_top" class="postbox-container" style="min-width:400px; max-width:600px; padding: 0 20px 0 0;">
|
||||
<div class="metabox-holder">
|
||||
<div class="meta-box-sortables">
|
||||
<?php
|
||||
if ( $form ) {
|
||||
echo '<form action="' . admin_url( 'options.php' ) . '" method="post" id="wpseo-conf"' . ( $contains_files ? ' enctype="multipart/form-data"' : '' ) . '>';
|
||||
settings_fields( $option );
|
||||
$this->currentoption = $optionshort;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the footer for admin pages
|
||||
*
|
||||
* @param bool $submit Whether or not a submit button should be shown.
|
||||
*/
|
||||
function admin_footer( $submit = true ) {
|
||||
if ( $submit ) {
|
||||
?>
|
||||
<div class="submit"><input type="submit" class="button-primary" name="submit"
|
||||
value="<?php _e( "Save Settings", 'wordpress-seo' ); ?>"/></div>
|
||||
<?php } ?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php $this->admin_sidebar(); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all post meta values with a given meta key from the database
|
||||
*
|
||||
* @param string $metakey Key to delete all meta values for.
|
||||
*/
|
||||
function delete_meta( $metakey ) {
|
||||
global $wpdb;
|
||||
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $metakey ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the current site's WP SEO settings.
|
||||
*
|
||||
* @param bool $include_taxonomy Whether to include the taxonomy metadata the plugin creates.
|
||||
* @return bool|string $return False when failed, the URL to the export file when succeeded.
|
||||
*/
|
||||
function export_settings( $include_taxonomy ) {
|
||||
$content = "; " . __( "This is a settings export file for the WordPress SEO plugin by Yoast.com", 'wordpress-seo' ) . " - http://yoast.com/wordpress/seo/ \r\n";
|
||||
|
||||
$optarr = get_wpseo_options_arr();
|
||||
|
||||
foreach ( $optarr as $optgroup ) {
|
||||
$content .= "\n" . '[' . $optgroup . ']' . "\n";
|
||||
$options = get_option( $optgroup );
|
||||
if ( !is_array( $options ) )
|
||||
continue;
|
||||
foreach ( $options as $key => $elem ) {
|
||||
if ( is_array( $elem ) ) {
|
||||
for ( $i = 0; $i < count( $elem ); $i++ ) {
|
||||
$content .= $key . "[] = \"" . $elem[$i] . "\"\n";
|
||||
}
|
||||
} else if ( $elem == "" )
|
||||
$content .= $key . " = \n";
|
||||
else
|
||||
$content .= $key . " = \"" . $elem . "\"\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ( $include_taxonomy ) {
|
||||
$content .= "\r\n\r\n[wpseo_taxonomy_meta]\r\n";
|
||||
$content .= "wpseo_taxonomy_meta = \"" . urlencode( json_encode( get_option( 'wpseo_taxonomy_meta' ) ) ) . "\"";
|
||||
}
|
||||
|
||||
$dir = wp_upload_dir();
|
||||
|
||||
if ( !$handle = fopen( $dir['path'] . '/settings.ini', 'w' ) )
|
||||
die();
|
||||
|
||||
if ( !fwrite( $handle, $content ) )
|
||||
die();
|
||||
|
||||
fclose( $handle );
|
||||
|
||||
require_once ( ABSPATH . 'wp-admin/includes/class-pclzip.php' );
|
||||
|
||||
chdir( $dir['path'] );
|
||||
$zip = new PclZip( './settings.zip' );
|
||||
if ( $zip->create( './settings.ini' ) == 0 )
|
||||
return false;
|
||||
|
||||
return $dir['url'] . '/settings.zip';
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the required styles for the config page.
|
||||
*/
|
||||
function config_page_styles() {
|
||||
global $pagenow;
|
||||
if ( $pagenow == 'admin.php' && isset( $_GET['page'] ) && in_array( $_GET['page'], $this->adminpages ) ) {
|
||||
wp_enqueue_style( 'dashboard' );
|
||||
wp_enqueue_style( 'thickbox' );
|
||||
wp_enqueue_style( 'global' );
|
||||
wp_enqueue_style( 'wp-admin' );
|
||||
wp_enqueue_style( 'yoast-admin-css', WPSEO_URL . 'css/yst_plugin_tools.css', WPSEO_VERSION );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the required scripts for the config page.
|
||||
*/
|
||||
function config_page_scripts() {
|
||||
global $pagenow;
|
||||
if ( $pagenow == 'admin.php' && isset( $_GET['page'] ) && in_array( $_GET['page'], $this->adminpages ) ) {
|
||||
wp_enqueue_script( 'wpseo-admin-script', WPSEO_URL . 'js/wp-seo-admin.js', array( 'jquery' ), WPSEO_VERSION, true );
|
||||
wp_enqueue_script( 'postbox' );
|
||||
wp_enqueue_script( 'dashboard' );
|
||||
wp_enqueue_script( 'thickbox' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve options based on the option or the class currentoption.
|
||||
*
|
||||
* @since 1.2.4
|
||||
*
|
||||
* @param string $option The option to retrieve.
|
||||
* @return array
|
||||
*/
|
||||
function get_option( $option ) {
|
||||
if ( function_exists( 'is_network_admin' ) && is_network_admin() )
|
||||
return get_site_option( $option );
|
||||
else
|
||||
return get_option( $option );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Checkbox input field.
|
||||
*
|
||||
* @param string $var The variable within the option to create the checkbox for.
|
||||
* @param string $label The label to show for the variable.
|
||||
* @param bool $label_left Whether the label should be left (true) or right (false).
|
||||
* @param string $option The option the variable belongs to.
|
||||
* @return string
|
||||
*/
|
||||
function checkbox( $var, $label, $label_left = false, $option = '' ) {
|
||||
if ( empty( $option ) )
|
||||
$option = $this->currentoption;
|
||||
|
||||
$options = $this->get_option( $option );
|
||||
|
||||
if ( !isset( $options[$var] ) )
|
||||
$options[$var] = false;
|
||||
|
||||
if ( $options[$var] === true )
|
||||
$options[$var] = 'on';
|
||||
|
||||
if ( $label_left !== false ) {
|
||||
if ( !empty( $label_left ) )
|
||||
$label_left .= ':';
|
||||
$output_label = '<label class="checkbox" for="' . esc_attr( $var ) . '">' . $label_left . '</label>';
|
||||
$class = 'checkbox';
|
||||
} else {
|
||||
$output_label = '<label for="' . esc_attr( $var ) . '">' . $label . '</label>';
|
||||
$class = 'checkbox double';
|
||||
}
|
||||
|
||||
$output_input = "<input class='$class' type='checkbox' id='" . esc_attr( $var ) . "' name='" . esc_attr( $option ) . "[" . esc_attr( $var ) . "]' " . checked( $options[$var], 'on', false ) . '/>';
|
||||
|
||||
if ( $label_left !== false ) {
|
||||
$output = $output_label . $output_input . '<label class="checkbox" for="' . esc_attr( $var ) . '">' . $label . '</label>';
|
||||
} else {
|
||||
$output = $output_input . $output_label;
|
||||
}
|
||||
return $output . '<br class="clear" />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Text input field.
|
||||
*
|
||||
* @param string $var The variable within the option to create the text input field for.
|
||||
* @param string $label The label to show for the variable.
|
||||
* @param string $option The option the variable belongs to.
|
||||
* @return string
|
||||
*/
|
||||
function textinput( $var, $label, $option = '' ) {
|
||||
if ( empty( $option ) )
|
||||
$option = $this->currentoption;
|
||||
|
||||
$options = $this->get_option( $option );
|
||||
|
||||
$val = '';
|
||||
if ( isset( $options[$var] ) )
|
||||
$val = esc_attr( $options[$var] );
|
||||
|
||||
return '<label class="textinput" for="' . esc_attr( $var ) . '">' . $label . ':</label><input class="textinput" type="text" id="' . esc_attr( $var ) . '" name="' . $option . '[' . esc_attr( $var ) . ']" value="' . $val . '"/>' . '<br class="clear" />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a textarea.
|
||||
*
|
||||
* @param string $var The variable within the option to create the textarea for.
|
||||
* @param string $label The label to show for the variable.
|
||||
* @param string $option The option the variable belongs to.
|
||||
* @param string $class The CSS class to assign to the textarea.
|
||||
* @return string
|
||||
*/
|
||||
function textarea( $var, $label, $option = '', $class = '' ) {
|
||||
if ( empty( $option ) )
|
||||
$option = $this->currentoption;
|
||||
|
||||
$options = $this->get_option( $option );
|
||||
|
||||
$val = '';
|
||||
if ( isset( $options[$var] ) )
|
||||
$val = esc_attr( $options[$var] );
|
||||
|
||||
|
||||
return '<label class="textinput" for="' . esc_attr( $var ) . '">' . esc_html( $label ) . ':</label><textarea class="textinput ' . $class . '" id="' . esc_attr( $var ) . '" name="' . $option . '[' . esc_attr( $var ) . ']">' . $val . '</textarea>' . '<br class="clear" />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a hidden input field.
|
||||
*
|
||||
* @param string $var The variable within the option to create the hidden input for.
|
||||
* @param string $option The option the variable belongs to.
|
||||
* @return string
|
||||
*/
|
||||
function hidden( $var, $option = '' ) {
|
||||
if ( empty( $option ) )
|
||||
$option = $this->currentoption;
|
||||
|
||||
$options = $this->get_option( $option );
|
||||
|
||||
$val = '';
|
||||
if ( isset( $options[$var] ) )
|
||||
$val = esc_attr( $options[$var] );
|
||||
|
||||
return '<input type="hidden" id="hidden_' . esc_attr( $var ) . '" name="' . $option . '[' . esc_attr( $var ) . ']" value="' . $val . '"/>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Select Box.
|
||||
*
|
||||
* @param string $var The variable within the option to create the select for.
|
||||
* @param string $label The label to show for the variable.
|
||||
* @param array $values The select options to choose from.
|
||||
* @param string $option The option the variable belongs to.
|
||||
* @return string
|
||||
*/
|
||||
function select( $var, $label, $values, $option = '' ) {
|
||||
if ( empty( $option ) )
|
||||
$option = $this->currentoption;
|
||||
|
||||
$options = $this->get_option( $option );
|
||||
|
||||
$var_esc = esc_attr( $var );
|
||||
$output = '<label class="select" for="' . $var_esc . '">' . $label . ':</label>';
|
||||
$output .= '<select class="select" name="' . $option . '[' . $var_esc . ']" id="' . $var_esc . '">';
|
||||
|
||||
foreach ( $values as $value => $label ) {
|
||||
$sel = '';
|
||||
if ( isset( $options[$var] ) && $options[$var] == $value )
|
||||
$sel = 'selected="selected" ';
|
||||
|
||||
if ( !empty( $label ) )
|
||||
$output .= '<option ' . $sel . 'value="' . esc_attr( $value ) . '">' . $label . '</option>';
|
||||
}
|
||||
$output .= '</select>';
|
||||
return $output . '<br class="clear"/>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a File upload field.
|
||||
*
|
||||
* @param string $var The variable within the option to create the file upload field for.
|
||||
* @param string $label The label to show for the variable.
|
||||
* @param string $option The option the variable belongs to.
|
||||
* @return string
|
||||
*/
|
||||
function file_upload( $var, $label, $option = '' ) {
|
||||
if ( empty( $option ) )
|
||||
$option = $this->currentoption;
|
||||
|
||||
$options = $this->get_option( $option );
|
||||
|
||||
$val = '';
|
||||
if ( isset( $options[$var] ) && strtolower( gettype( $options[$var] ) ) == 'array' ) {
|
||||
$val = $options[$var]['url'];
|
||||
}
|
||||
|
||||
$var_esc = esc_attr( $var );
|
||||
$output = '<label class="select" for="' . $var_esc . '">' . esc_html( $label ) . ':</label>';
|
||||
$output .= '<input type="file" value="' . $val . '" class="textinput" name="' . esc_attr( $option ) . '[' . $var_esc . ']" id="' . $var_esc . '"/>';
|
||||
|
||||
// Need to save separate array items in hidden inputs, because empty file inputs type will be deleted by settings API.
|
||||
if ( !empty( $options[$var] ) ) {
|
||||
$output .= '<input class="hidden" type="hidden" id="' . $var_esc . '_file" name="wpseo_local[' . $var_esc . '][file]" value="' . esc_attr( $options[$var]['file'] ) . '"/>';
|
||||
$output .= '<input class="hidden" type="hidden" id="' . $var_esc . '_url" name="wpseo_local[' . $var_esc . '][url]" value="' . esc_attr( $options[$var]['url'] ) . '"/>';
|
||||
$output .= '<input class="hidden" type="hidden" id="' . $var_esc . '_type" name="wpseo_local[' . $var_esc . '][type]" value="' . esc_attr( $options[$var]['type'] ) . '"/>';
|
||||
}
|
||||
$output .= '<br class="clear"/>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Radio input field.
|
||||
*
|
||||
* @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.
|
||||
* @return string
|
||||
*/
|
||||
function radio( $var, $values, $label, $option = '' ) {
|
||||
if ( empty( $option ) )
|
||||
$option = $this->currentoption;
|
||||
|
||||
$options = $this->get_option( $option );
|
||||
|
||||
if ( !isset( $options[$var] ) )
|
||||
$options[$var] = false;
|
||||
|
||||
$var_esc = esc_attr( $var );
|
||||
|
||||
$output = '<br/><label class="select">' . $label . ':</label>';
|
||||
foreach ( $values as $key => $value ) {
|
||||
$key = esc_attr( $key );
|
||||
$output .= '<input type="radio" class="radio" id="' . $var_esc . '-' . $key . '" name="' . esc_attr( $option ) . '[' . $var_esc . ']" value="' . $key . '" ' . ( $options[$var] == $key ? ' checked="checked"' : '' ) . ' /> <label class="radio" for="' . $var_esc . '-' . $key . '">' . esc_attr( $value ) . '</label>';
|
||||
}
|
||||
$output .= '<br/>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a postbox widget.
|
||||
*
|
||||
* @param string $id ID of the postbox.
|
||||
* @param string $title Title of the postbox.
|
||||
* @param string $content Content of the postbox.
|
||||
*/
|
||||
function postbox( $id, $title, $content ) {
|
||||
?>
|
||||
<div id="<?php echo esc_attr( $id ); ?>" class="yoastbox">
|
||||
<h2><?php echo $title; ?></h2>
|
||||
<?php echo $content; ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a form table from an array of rows.
|
||||
*
|
||||
* @param array $rows Rows to include in the table.
|
||||
* @return string
|
||||
*/
|
||||
function form_table( $rows ) {
|
||||
$content = '<table class="form-table">';
|
||||
foreach ( $rows as $row ) {
|
||||
$content .= '<tr><th valign="top" scrope="row">';
|
||||
if ( isset( $row['id'] ) && $row['id'] != '' )
|
||||
$content .= '<label for="' . esc_attr( $row['id'] ) . '">' . esc_html( $row['label'] ) . ':</label>';
|
||||
else
|
||||
$content .= esc_html( $row['label'] );
|
||||
if ( isset( $row['desc'] ) && $row['desc'] != '' )
|
||||
$content .= '<br/><small>' . esc_html( $row['desc'] ) . '</small>';
|
||||
$content .= '</th><td valign="top">';
|
||||
$content .= $row['content'];
|
||||
$content .= '</td></tr>';
|
||||
}
|
||||
$content .= '</table>';
|
||||
return $content;
|
||||
}
|
||||
|
||||
} // end class WPSEO_Admin
|
||||
global $wpseo_admin_pages;
|
||||
$wpseo_admin_pages = new WPSEO_Admin_Pages();
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class adds the Social tab to the WP SEO metabox and makes sure the settings are saved.
|
||||
*/
|
||||
class WPSEO_Social_Admin extends WPSEO_Metabox {
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'wpseo_tab_header', array( $this, 'tab_header' ), 60 );
|
||||
add_action( 'wpseo_tab_content', array( $this, 'tab_content' ) );
|
||||
add_filter( 'wpseo_save_metaboxes', array( $this, 'save_meta_boxes' ), 10, 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the tab header for the Social tab
|
||||
*/
|
||||
public function tab_header() {
|
||||
echo '<li class="social"><a class="wpseo_tablink" href="#wpseo_social">' . __( 'Social', 'wordpress-seo' ) . '</a></li>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the tab content
|
||||
*/
|
||||
public function tab_content() {
|
||||
$content = '';
|
||||
foreach ( $this->get_meta_boxes() as $meta_box ) {
|
||||
$content .= $this->do_meta_box( $meta_box );
|
||||
}
|
||||
$this->do_tab( 'social', __( 'Social', 'wordpress-seo' ), $content );
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the meta boxes for the Social tab
|
||||
*
|
||||
* @return array Array containing the meta boxes
|
||||
*/
|
||||
public function get_meta_boxes() {
|
||||
$mbs = array();
|
||||
$mbs[ 'opengraph-description' ] = array(
|
||||
"name" => "opengraph-description",
|
||||
"type" => "textarea",
|
||||
"std" => "",
|
||||
"richedit" => false,
|
||||
"title" => __( "Facebook Description", 'wordpress-seo' ),
|
||||
"description" => __( 'If you don\'t want to use the meta description for sharing the post on Facebook but want another description there, write it here.', 'wordpress-seo' )
|
||||
);
|
||||
$mbs[ 'google-plus-description' ] = array(
|
||||
"name" => "google-plus-description",
|
||||
"type" => "textarea",
|
||||
"std" => "",
|
||||
"richedit" => false,
|
||||
"title" => __( "Google+ Description", 'wordpress-seo' ),
|
||||
"description" => __( 'If you don\'t want to use the meta description for sharing the post on Google+ but want another description there, write it here.', 'wordpress-seo' )
|
||||
);
|
||||
return $mbs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter over the meta boxes to save, this function adds the Social meta boxes.
|
||||
*
|
||||
* @param array $mbs Array of metaboxes to save.
|
||||
* @return array
|
||||
*/
|
||||
public function save_meta_boxes( $mbs ) {
|
||||
return array_merge( $mbs, $this->get_meta_boxes() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$wpseo_social = new WPSEO_Social_Admin();
|
||||
@@ -0,0 +1,268 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class handles the pointers used in the introduction tour.
|
||||
*
|
||||
* @todo Add an introdutory pointer on the edit post page too.
|
||||
*/
|
||||
class WPSEO_Pointers {
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
global $wp_version;
|
||||
if ( version_compare($wp_version, '3.4', '<') )
|
||||
return false;
|
||||
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue styles and scripts needed for the pointers.
|
||||
*/
|
||||
function enqueue() {
|
||||
if ( ! current_user_can('manage_options') )
|
||||
return;
|
||||
|
||||
$options = get_option( 'wpseo' );
|
||||
if ( !isset( $options['yoast_tracking'] ) || ( !isset( $options['ignore_tour'] ) || !$options['ignore_tour'] ) ) {
|
||||
wp_enqueue_style( 'wp-pointer' );
|
||||
wp_enqueue_script( 'jquery-ui' );
|
||||
wp_enqueue_script( 'wp-pointer' );
|
||||
wp_enqueue_script( 'utils' );
|
||||
}
|
||||
if ( !isset( $options['tracking_popup'] ) && !isset( $_GET['allow_tracking'] ) ) {
|
||||
add_action( 'admin_print_footer_scripts', array( $this, 'tracking_request' ) );
|
||||
} else if ( !isset( $options['ignore_tour'] ) || !$options['ignore_tour'] ) {
|
||||
add_action( 'admin_print_footer_scripts', array( $this, 'intro_tour' ) );
|
||||
add_action( 'admin_head', array( $this, 'admin_head' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a popup that asks for permission to allow tracking.
|
||||
*/
|
||||
function tracking_request() {
|
||||
$id = '#wpadminbar';
|
||||
$nonce = wp_create_nonce( 'wpseo_activate_tracking' );
|
||||
|
||||
$content = '<h3>' . __( 'Help improve WordPress SEO', 'wordpress-seo' ) . '</h3>';
|
||||
$content .= '<p>' . __( 'You\'ve just installed WordPress SEO by Yoast. Please helps us improve it by allowing us to gather anonymous usage stats so we know which configurations, plugins and themes to test with.', 'wordpress-seo' ) . '</p>';
|
||||
$opt_arr = array(
|
||||
'content' => $content,
|
||||
'position' => array( 'edge' => 'top', 'align' => 'center' )
|
||||
);
|
||||
$button2 = __( 'Allow tracking', 'wordpress-seo' );
|
||||
|
||||
$function2 = 'wpseo_store_answer("yes","'.$nonce.'")';
|
||||
$function1 = 'wpseo_store_answer("no","'.$nonce.'")';
|
||||
|
||||
$this->print_scripts( $id, $opt_arr, __( 'Do not allow tracking', 'wordpress-seo' ), $button2, $function2, $function1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the introduction tour
|
||||
*/
|
||||
function intro_tour() {
|
||||
global $pagenow, $current_user;
|
||||
|
||||
$adminpages = array(
|
||||
'wpseo_dashboard' => array(
|
||||
'content' => '<h3>' . __( 'Dashboard', 'wordpress-seo' ) . '</h3><p>' . __( 'This is the WordPress SEO Dashboard, here you can restart this tour or revert the WP SEO settings to default.', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'More WordPress SEO', 'wordpress-seo' ) . '</strong><br/>' . sprintf( __( 'There\'s more to learn about WordPress & SEO than just using this plugin. Read our article %1$sthe definitive guide to WordPress SEO%2$s.', 'wordpress-seo' ), '<a target="_blank" href="http://yoast.com/articles/wordpress-seo/#utm_source=wpadmin&utm_medium=wpseo_tour&utm_term=link&utm_campaign=wpseoplugin">', '</a>' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Webmaster Tools', 'wordpress-seo' ) . '</strong><br/>' . __( 'Underneath the General Settings, you can add the verification codes for the different Webmaster Tools programs, I highly encourage you to check out both Google and Bing\'s Webmaster Tools.', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'About This Tour', 'wordpress-seo' ) . '</strong><br/>' . __( 'Clicking Next below takes you to the next page of the tour. If you want to stop this tour, click "Close".', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Like this plugin?', 'wordpress-seo' ) . '</strong><br/>' . sprintf( __( 'If you like this plugin, please %srate it 5 stars on WordPress.org%s and consider making a donation by clicking the button on the right!', 'wordpress-seo' ), '<a target="_blank" href="http://wordpress.org/extend/plugins/wordpress-seo/">', '</a>' ) . '</p>' .
|
||||
'<p><strong>' . __( 'Newsletter', 'wordpress-seo' ) . '</strong><br/>' .
|
||||
__( 'If you would like to keep up to date regarding the WordPress SEO plugin and other plugins by Yoast, subscribe to the newsletter:', 'wordpress-seo' ) . '</p>' .
|
||||
'<form action="http://yoast.us1.list-manage.com/subscribe/post?u=ffa93edfe21752c921f860358&id=972f1c9122" method="post" id="newsletter-form">' .
|
||||
'<p>' .
|
||||
'<label for="newsletter-name">' . __( 'Name', 'wordpress-seo' ) . ':</label><input style="color:#666" name="MMERGE9" value="' . esc_attr( $current_user->display_name ) . '" id="newsletter-name" placeholder="' . __( 'Name', 'wordpress-seo' ) . '"/><br/>' .
|
||||
'<label for="newsletter-email">' . __( 'Email', 'wordpress-seo' ) . ':</label><input style="color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" id="newsletter-email" placeholder="' . __( 'Email', 'wordpress-seo' ) . '"/><br/>' .
|
||||
'<input type="hidden" name="group" value="2"/>' .
|
||||
'<button type="submit" class="button-primary">' . __( 'Subscribe', 'wordpress-seo' ) . '</button>' .
|
||||
'</p></form>',
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_titles' ) . '";'
|
||||
),
|
||||
'wpseo_titles' => array(
|
||||
'content' => "<h3>" . __( "Title & Description settings", 'wordpress-seo' ) . "</h3>"
|
||||
. "<p>" . __( "This is where you set the templates for your titles and descriptions of all the different types of pages on your blog, be it your homepage, posts & pages (under post types), category or tag archives (under taxonomy archives), or even custom post type archives and custom posts: all of that is done from here.", 'wordpress-seo' ) . "</p>"
|
||||
. "<p><strong>" . __( "Templates", 'wordpress-seo' ) . "</strong><br/>"
|
||||
. __( "The templates are built using variables, the help tab for all the different variables available to you to use in these.", 'wordpress-seo' ) . "</p>"
|
||||
. "<p><strong>" . __( "Sitewide settings", 'wordpress-seo' ) . "</strong><br/>"
|
||||
. __( "You can also set some settings for the entire site here to add specific meta tags or to remove some unneeded cruft.", 'wordpress-seo' ) . "</p>",
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_social' ) . '";'
|
||||
),
|
||||
'wpseo_social' => array(
|
||||
'content' => "<h3>" . __( "Social settings", 'wordpress-seo' ) . "</h3>"
|
||||
. "<p><strong>" . __( 'Facebook OpenGraph', 'wordpress-seo' ) . '</strong><br/>'
|
||||
. __( "On this page you can enable the OpenGraph functionality from this plugin, as well as assign a Facebook user or Application to be the admin of your site, so you can view the Facebook insights.", 'wordpress-seo' ) . "</p>"
|
||||
. '<p>' . sprintf( __( 'Read more about %1$sFacebook OpenGraph%2$s.', 'wordpress-seo' ), '<a target="_blank" href="http://yoast.com/facebook-open-graph-protocol/#utm_source=wpadmin&utm_medium=wpseo_tour&utm_term=link&utm_campaign=wpseoplugin">', '</a>' ) . "</p>"
|
||||
. "<p><strong>" . __( 'Twitter Cards', 'wordpress-seo' ) . '</strong><br/>'
|
||||
. sprintf( __( 'This functionality is currently in beta, but it allows for %1$sTwitter Cards%2$s.', 'wordpress-seo' ), '<a target="_blank" href="http://yoast.com/twitter-cards/#utm_source=wpadmin&utm_medium=wpseo_tour&utm_term=link&utm_campaign=wpseoplugin">', '</a>' ) . "</p>",
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_xml' ) . '";'
|
||||
),
|
||||
'wpseo_xml' => array(
|
||||
'content' => '<h3>' . __( 'XML Sitemaps', 'wordpress-seo' ) . '</h3><p>' . __( 'This plugin adds an XML sitemap to your site. It\'s automatically updated when you publish a new post, page or custom post and Google and Bing will be automatically notified.', 'wordpress-seo' ) . '</p><p>' . __( 'Be sure to check whether post types or taxonomies are showing that search engines shouldn\'t be indexing, if so, check the box before them to hide them from the XML sitemaps.', 'wordpress-seo' ) . '</p>',
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_permalinks' ) . '";'
|
||||
),
|
||||
'wpseo_permalinks' => array(
|
||||
'content' => '<h3>' . __( 'Permalink Settings', 'wordpress-seo' ) . '</h3><p>' . __( 'All of the options here are for advanced users only, if you don\'t know whether you should check any, don\'t touch them.', 'wordpress-seo' ) . '</p>',
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_internal-links' ) . '";'
|
||||
),
|
||||
'wpseo_internal-links' => array(
|
||||
'content' => '<h3>' . __( 'Breadcrumbs Settings', 'wordpress-seo' ) . '</h3><p>' . sprintf( __( 'If your theme supports my breadcrumbs, as all Genesis and WooThemes themes as well as a couple of other ones do, you can change the settings for those here. If you want to modify your theme to support them, %sfollow these instructions%s.', 'wordpress-seo' ), '<a target="_blank" href="http://yoast.com/wordpress/breadcrumbs/#utm_source=wpadmin&utm_medium=wpseo_tour&utm_term=link&utm_campaign=wpseoplugin">', '</a>' ) . '</p>',
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_rss' ) . '";'
|
||||
),
|
||||
'wpseo_rss' => array(
|
||||
'content' => '<h3>' . __( 'RSS Settings', 'wordpress-seo' ) . '</h3><p>' . __( 'This incredibly powerful function allows you to add content to the beginning and end of your posts in your RSS feed. This helps you gain links from people who steal your content!', 'wordpress-seo' ) . '</p>',
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_import' ) . '";'
|
||||
),
|
||||
'wpseo_import' => array(
|
||||
'content' => '<h3>' . __( 'Import & Export', 'wordpress-seo' ) . '</h3><p>' . __( 'Just switched over from another SEO plugin? Use the options here to switch your data over. If you were using some of my older plugins like Robots Meta & RSS Footer, you can import the settings here too.', 'wordpress-seo' ) . '</p><p>' . __( 'If you have multiple blogs and you\'re happy with how you\'ve configured this blog, you can export the settings and import them on another blog so you don\'t have to go through this process twice!', 'wordpress-seo' ) . '</p>',
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_files' ) . '";'
|
||||
),
|
||||
'wpseo_files' => array(
|
||||
'content' => '<h3>' . __( 'File Editor', 'wordpress-seo' ) . '</h3><p>' . __( 'Here you can edit the .htaccess and robots.txt files, two of the most powerful files in your WordPress install. Only touch these files if you know what you\'re doing!', 'wordpress-seo' ) . '</p>'
|
||||
. '<p>' . sprintf( __( 'The tour ends here, thank you for using my plugin and good luck with your SEO!<br/><br/>Best,<br/>Joost de Valk - %1$sYoast.com%2$s', 'wordpress-seo' ), '<a target="_blank" href="http://yoast.com/#utm_source=wpadmin&utm_medium=wpseo_tour&utm_term=link&utm_campaign=wpseoplugin">', '</a>' ) . '</p>',
|
||||
),
|
||||
);
|
||||
|
||||
if ( ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) || ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) ) {
|
||||
unset( $adminpages['wpseo_files'] );
|
||||
$adminpages['wpseo_import']['function'] = '';
|
||||
unset( $adminpages['wpseo_import']['button2'] );
|
||||
$adminpages['wpseo_import']['content'] .= '<p>' . sprintf( __( 'The tour ends here,thank you for using my plugin and good luck with your SEO!<br/><br/>Best,<br/>Joost de Valk - %1$sYoast.com%2$s', 'wordpress-seo' ), '<a href="http://yoast.com/">', '</a>' ) . '</p>';
|
||||
}
|
||||
$page = '';
|
||||
if ( isset( $_GET['page'] ) )
|
||||
$page = $_GET['page'];
|
||||
|
||||
$function = '';
|
||||
$button2 = '';
|
||||
$opt_arr = array();
|
||||
$id = '#wpseo-title';
|
||||
if ( 'admin.php' != $pagenow || !array_key_exists( $page, $adminpages ) ) {
|
||||
$id = 'li.toplevel_page_wpseo_dashboard';
|
||||
$content = '<h3>' . __( 'Congratulations!', 'wordpress-seo' ) . '</h3>';
|
||||
$content .= '<p>' . __( 'You\'ve just installed WordPress SEO by Yoast! Click "Start Tour" to view a quick introduction of this plugins core functionality.', 'wordpress-seo' ) . '</p>';
|
||||
$opt_arr = array(
|
||||
'content' => $content,
|
||||
'position' => array( 'edge' => 'top', 'align' => 'center' )
|
||||
);
|
||||
$button2 = __( "Start Tour", 'wordpress-seo' );
|
||||
$function = 'document.location="' . admin_url( 'admin.php?page=wpseo_dashboard' ) . '";';
|
||||
} else {
|
||||
if ( '' != $page && in_array( $page, array_keys( $adminpages ) ) ) {
|
||||
$opt_arr = array(
|
||||
'content' => $adminpages[$page]['content'],
|
||||
'position' => array( 'edge' => 'top', 'align' => 'left' ),
|
||||
'pointerWidth' => 400
|
||||
);
|
||||
$button2 = $adminpages[$page]['button2'];
|
||||
$function = $adminpages[$page]['function'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->print_scripts( $id, $opt_arr, __( "Close", 'wordpress-seo' ), $button2, $function );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a tiny bit of CSS in the head
|
||||
*/
|
||||
function admin_head() {
|
||||
?>
|
||||
<style type="text/css" media="screen">
|
||||
#pointer-primary {
|
||||
margin: 0 5px 0 0;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the pointer script
|
||||
*
|
||||
* @param string $selector The CSS selector the pointer is attached to.
|
||||
* @param array $options The options for the pointer.
|
||||
* @param string $button1 Text for button 1
|
||||
* @param string|bool $button2 Text for button 2 (or false to not show it, defaults to false)
|
||||
* @param string $button2_function The JavaScript function to attach to button 2
|
||||
* @param string $button1_function The JavaScript function to attach to button 1
|
||||
*/
|
||||
function print_scripts( $selector, $options, $button1, $button2 = false, $button2_function = '', $button1_function = '' ) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
(function ($) {
|
||||
var wpseo_pointer_options = <?php echo json_encode( $options ); ?>, setup;
|
||||
|
||||
function wpseo_store_answer( input, nonce ) {
|
||||
var wpseo_tracking_data = {
|
||||
action : 'wpseo_allow_tracking',
|
||||
allow_tracking : input,
|
||||
nonce: nonce
|
||||
}
|
||||
jQuery.post( ajaxurl, wpseo_tracking_data, function() {
|
||||
jQuery('#wp-pointer-0').remove();
|
||||
} );
|
||||
}
|
||||
|
||||
wpseo_pointer_options = $.extend(wpseo_pointer_options, {
|
||||
buttons:function (event, t) {
|
||||
button = jQuery('<a id="pointer-close" style="margin-left:5px" class="button-secondary">' + '<?php echo $button1; ?>' + '</a>');
|
||||
button.bind('click.pointer', function () {
|
||||
t.element.pointer('close');
|
||||
});
|
||||
return button;
|
||||
},
|
||||
close:function () {
|
||||
}
|
||||
});
|
||||
|
||||
setup = function () {
|
||||
$('<?php echo $selector; ?>').pointer(wpseo_pointer_options).pointer('open');
|
||||
<?php if ( $button2 ) { ?>
|
||||
jQuery('#pointer-close').after('<a id="pointer-primary" class="button-primary">' + '<?php echo $button2; ?>' + '</a>');
|
||||
jQuery('#pointer-primary').click(function () {
|
||||
<?php echo $button2_function; ?>
|
||||
});
|
||||
jQuery('#pointer-close').click(function () {
|
||||
<?php if ( $button1_function == '' ) { ?>
|
||||
wpseo_setIgnore("tour", "wp-pointer-0", "<?php echo wp_create_nonce( 'wpseo-ignore' ); ?>");
|
||||
<?php } else { ?>
|
||||
<?php echo $button1_function; ?>
|
||||
<?php } ?>
|
||||
});
|
||||
<?php } ?>
|
||||
};
|
||||
|
||||
if (wpseo_pointer_options.position && wpseo_pointer_options.position.defer_loading)
|
||||
$(window).bind('load.wp-pointers', setup);
|
||||
else
|
||||
$(document).ready(setup);
|
||||
})(jQuery);
|
||||
//]]>
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
$wpseo_pointers = new WPSEO_Pointers;
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* @package XML_Sitemaps
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class that handles the Admin side of XML sitemaps
|
||||
*/
|
||||
class WPSEO_Sitemaps_Admin {
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*/
|
||||
function __construct() {
|
||||
|
||||
$options = get_option( 'wpseo_xml' );
|
||||
if ( !isset( $options[ 'enablexmlsitemap' ] ) || !$options[ 'enablexmlsitemap' ] )
|
||||
return;
|
||||
|
||||
add_action( 'transition_post_status', array( $this, 'status_transition' ), 10, 3 );
|
||||
add_action( 'admin_init', array( $this, 'delete_sitemaps' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove sitemaps residing on disk as they will block our rewrite.
|
||||
*/
|
||||
function delete_sitemaps() {
|
||||
$options = get_option( 'wpseo' );
|
||||
if ( isset( $options[ 'enablexmlsitemap' ] ) && $options[ 'enablexmlsitemap' ] ) {
|
||||
$file = ABSPATH . 'sitemap_index.xml';
|
||||
if ( ( !isset( $options[ 'blocking_files' ] ) || !is_array( $options[ 'blocking_files' ] ) || !in_array( $file, $options[ 'blocking_files' ] ) ) &&
|
||||
file_exists( $file )
|
||||
) {
|
||||
if ( !is_array( $options[ 'blocking_files' ] ) )
|
||||
$options[ 'blocking_files' ] = array();
|
||||
$options[ 'blocking_files' ][ ] = $file;
|
||||
update_option( 'wpseo', $options );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hooked into transition_post_status. Will initiate search engine pings
|
||||
* if the post is being published, is a post type that a sitemap is built for
|
||||
* and is a post that is included in sitemaps.
|
||||
*/
|
||||
function status_transition( $new_status, $old_status, $post ) {
|
||||
if ( $new_status != 'publish' )
|
||||
return;
|
||||
|
||||
wp_cache_delete( 'lastpostmodified:gmt:' . $post->post_type, 'timeinfo' ); // #17455
|
||||
|
||||
$options = get_wpseo_options();
|
||||
if ( isset( $options[ 'post_types-' . $post->post_type . '-not_in_sitemap' ] ) && $options[ 'post_types-' . $post->post_type . '-not_in_sitemap' ] )
|
||||
return;
|
||||
|
||||
if ( WP_CACHE )
|
||||
wp_schedule_single_event( time() + 300, 'wpseo_hit_sitemap_index' );
|
||||
|
||||
// Allow the pinging to happen slightly after the hit sitemap index so the sitemap is fully regenerated when the ping happens.
|
||||
if ( wpseo_get_value( 'sitemap-include', $post->ID ) != 'never' ) {
|
||||
if ( defined( 'YOAST_SEO_PING_IMMEDIATELY' ) && YOAST_SEO_PING_IMMEDIATELY )
|
||||
wpseo_ping_search_engines();
|
||||
else
|
||||
wp_schedule_single_event( ( time() + 300 ), 'wpseo_ping_search_engines' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Instantiate class
|
||||
$wpseo_sitemaps_admin = new WPSEO_Sitemaps_Admin();
|
||||
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'HTTP/1.0 403 Forbidden' );
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class that handles the edit boxes on taxonomy edit pages.
|
||||
*/
|
||||
class WPSEO_Taxonomy {
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*/
|
||||
function __construct() {
|
||||
$options = get_wpseo_options();
|
||||
|
||||
if ( is_admin() && isset( $_GET['taxonomy'] ) &&
|
||||
( !isset( $options['tax-hideeditbox-' . $_GET['taxonomy']] ) || !$options['tax-hideeditbox-' . $_GET['taxonomy']] )
|
||||
)
|
||||
add_action( $_GET['taxonomy'] . '_edit_form', array( $this, 'term_seo_form' ), 10, 1 );
|
||||
|
||||
add_action( 'edit_term', array( $this, 'update_term' ), 99, 3 );
|
||||
|
||||
add_action( 'init', array( $this, 'custom_category_descriptions_allow_html' ) );
|
||||
add_filter( 'category_description', array( $this, 'custom_category_descriptions_add_shortcode_support' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a row in the form table.
|
||||
*
|
||||
* @param string $var Variable the row controls.
|
||||
* @param string $label Label for the variable.
|
||||
* @param string $desc Description of the use of the variable.
|
||||
* @param array $tax_meta Taxonomy meta value.
|
||||
* @param string $type Type of form row to create.
|
||||
* @param array $options Options to use when form row is a select box.
|
||||
*/
|
||||
function form_row( $var, $label, $desc, $tax_meta, $type = 'text', $options = array() ) {
|
||||
$val = '';
|
||||
if ( isset( $tax_meta[$var] ) && !empty( $tax_meta[$var] ) )
|
||||
$val = stripslashes( $tax_meta[$var] );
|
||||
|
||||
echo '<tr class="form-field">' . "\n";
|
||||
echo "\t" . '<th scope="row" valign="top"><label for="' . $var . '">' . $label . ':</label></th>' . "\n";
|
||||
echo "\t" . '<td>' . "\n";
|
||||
if ( $type == 'text' ) {
|
||||
?>
|
||||
<input name="<?php echo $var; ?>" id="<?php echo $var; ?>" type="text" value="<?php echo $val; ?>" size="40"/>
|
||||
<p class="description"><?php echo $desc; ?></p>
|
||||
<?php
|
||||
} else if ( $type == 'checkbox' ) {
|
||||
?>
|
||||
<input name="<?php echo $var; ?>" id="<?php echo $var; ?>" type="checkbox" <?php checked( $val ); ?>/>
|
||||
<?php
|
||||
} else if ( $type == 'select' ) {
|
||||
?>
|
||||
<select name="<?php echo $var; ?>" id="<?php echo $var; ?>">
|
||||
<?php foreach ( $options as $option => $label ) {
|
||||
$sel = '';
|
||||
if ( $option == $val )
|
||||
$sel = " selected='selected'";
|
||||
echo "<option" . $sel . " value='" . $option . "'>" . $label . "</option>";
|
||||
}?>
|
||||
</select>
|
||||
<?php
|
||||
}
|
||||
echo "\t" . '</td>' . "\n";
|
||||
echo '</tr>' . "\n";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the SEO inputs for term.
|
||||
*
|
||||
* @param object $term Term to show the edit boxes for.
|
||||
*/
|
||||
function term_seo_form( $term ) {
|
||||
$tax_meta = get_option( 'wpseo_taxonomy_meta' );
|
||||
$options = get_wpseo_options();
|
||||
|
||||
if ( isset( $tax_meta[$term->taxonomy][$term->term_id] ) )
|
||||
$tax_meta = $tax_meta[$term->taxonomy][$term->term_id];
|
||||
|
||||
echo '<h2>' . __( 'Yoast WordPress SEO Settings', 'wordpress-seo' ) . '</h2>';
|
||||
echo '<table class="form-table">';
|
||||
|
||||
$this->form_row( 'wpseo_title', __( 'SEO Title', 'wordpress-seo' ), __( 'The SEO title is used on the archive page for this term.', 'wordpress-seo' ), $tax_meta );
|
||||
$this->form_row( 'wpseo_desc', __( 'SEO Description', 'wordpress-seo' ), __( 'The SEO description is used for the meta description on the archive page for this term.', 'wordpress-seo' ), $tax_meta );
|
||||
if ( isset( $options['usemetakeywords'] ) && $options['usemetakeywords'] )
|
||||
$this->form_row( 'wpseo_metakey', __( 'Meta Keywords', 'wordpress-seo' ), __( 'Meta keywords used on the archive page for this term.', 'wordpress-seo' ), $tax_meta );
|
||||
$this->form_row( 'wpseo_canonical', __( 'Canonical', 'wordpress-seo' ), __( 'The canonical link is shown on the archive page for this term.', 'wordpress-seo' ), $tax_meta );
|
||||
$this->form_row( 'wpseo_bctitle', __( 'Breadcrumbs Title', 'wordpress-seo' ), sprintf( __( 'The Breadcrumbs title is used in the breadcrumbs where this %s appears.', 'wordpress-seo' ), $term->taxonomy ), $tax_meta );
|
||||
|
||||
if ( isset( $tax_meta['wpseo_noindex'] ) && $tax_meta['wpseo_noindex'] == 'on' )
|
||||
$tax_meta['wpseo_noindex'] = 'noindex';
|
||||
$current = ( isset( $options['noindex-' . $term->taxonomy] ) && $options['noindex-' . $term->taxonomy] ) ? 'noindex' : 'index';
|
||||
$noindex_options = array(
|
||||
'default' => sprintf( __( 'Use %s default (Currently: %s)', 'wordpress-seo' ), $term->taxonomy, $current ),
|
||||
'index' => __( 'Always index', 'wordpress-seo' ),
|
||||
'noindex' => __( 'Always noindex', 'wordpress-seo' ) );
|
||||
$this->form_row( 'wpseo_noindex', sprintf( __( 'Noindex this %s', 'wordpress-seo' ), $term->taxonomy ), sprintf( __( 'This %s follows the indexation rules set under Metas and Titles, you can override it here.', 'wordpress-seo' ), $term->taxonomy ), $tax_meta, 'select', $noindex_options );
|
||||
|
||||
$this->form_row( 'wpseo_sitemap_include', __( 'Include in sitemap?', 'wordpress-seo' ), '', $tax_meta, 'select', array(
|
||||
"-" => __( "Auto detect", 'wordpress-seo' ),
|
||||
"always" => __( "Always include", 'wordpress-seo' ),
|
||||
"never" => __( "Never include", 'wordpress-seo' ),
|
||||
) );
|
||||
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the taxonomy meta data on save.
|
||||
*
|
||||
* @param int $term_id ID of the term to save data for
|
||||
* @param int $tt_id The taxonomy_term_id for the term.
|
||||
* @param string $taxonomy The taxonmy the term belongs to.
|
||||
*/
|
||||
function update_term( $term_id, $tt_id, $taxonomy ) {
|
||||
$tax_meta = get_option( 'wpseo_taxonomy_meta' );
|
||||
|
||||
if ( !is_array( $tax_meta[$taxonomy][$term_id] ) )
|
||||
$tax_meta[$taxonomy][$term_id] = array();
|
||||
|
||||
foreach ( array( 'title', 'desc', 'metakey', 'bctitle', 'canonical', 'noindex', 'sitemap_include' ) as $key ) {
|
||||
if ( isset( $_POST['wpseo_' . $key] ) && !empty( $_POST['wpseo_' . $key] ) ) {
|
||||
$val = trim( $_POST['wpseo_' . $key] );
|
||||
|
||||
if ( $key == 'canonical' )
|
||||
$val = esc_url( $val );
|
||||
else
|
||||
$val = sanitize_text_field( $val );
|
||||
|
||||
$tax_meta[$taxonomy][$term_id]['wpseo_' . $key] = $val;
|
||||
} else {
|
||||
if ( isset( $tax_meta[$taxonomy][$term_id]['wpseo_' . $key] ) )
|
||||
unset( $tax_meta[$taxonomy][$term_id]['wpseo_' . $key] );
|
||||
}
|
||||
}
|
||||
|
||||
update_option( 'wpseo_taxonomy_meta', $tax_meta, 99 );
|
||||
|
||||
if ( defined( 'W3TC_DIR' ) && class_exists( 'W3_ObjectCache' ) ) {
|
||||
require_once W3TC_DIR . '/lib/W3/ObjectCache.php';
|
||||
$w3_objectcache = & W3_ObjectCache::instance();
|
||||
|
||||
$w3_objectcache->flush();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows HTML in descriptions
|
||||
*/
|
||||
function custom_category_descriptions_allow_html() {
|
||||
$filters = array(
|
||||
'pre_term_description',
|
||||
'pre_link_description',
|
||||
'pre_link_notes',
|
||||
'pre_user_description'
|
||||
);
|
||||
|
||||
foreach ( $filters as $filter ) {
|
||||
remove_filter( $filter, 'wp_filter_kses' );
|
||||
}
|
||||
remove_filter( 'term_description', 'wp_kses_data' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds shortcode support to category descriptions.
|
||||
*
|
||||
* @param string $desc String to add shortcodes in.
|
||||
* @return string
|
||||
*/
|
||||
function custom_category_descriptions_add_shortcode_support( $desc ) {
|
||||
return do_shortcode( $desc );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$wpseo_taxonomy = new WPSEO_Taxonomy();
|
||||
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'HTTP/1.0 403 Forbidden' );
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class that creates the tracking functionality for WP SEO, as the core class might be used in more plugins,
|
||||
* it's checked for existence first.
|
||||
*
|
||||
* NOTE: this functionality is opt-in. Disabling the tracking in the settings or saying no when asked will cause
|
||||
* this file to not even be loaded.
|
||||
*/
|
||||
if ( !class_exists( 'Yoast_Tracking' ) ) {
|
||||
class Yoast_Tracking {
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*/
|
||||
function __construct() {
|
||||
// The tracking checks daily, but only sends new data every 7 days.
|
||||
if ( !wp_next_scheduled( 'yoast_tracking' ) ) {
|
||||
wp_schedule_event( time(), 'daily', 'yoast_tracking' );
|
||||
}
|
||||
|
||||
add_action( 'yoast_tracking', array( $this, 'tracking' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Main tracking function.
|
||||
*/
|
||||
function tracking() {
|
||||
// Start of Metrics
|
||||
global $blog_id, $wpdb;
|
||||
|
||||
$hash = get_option( 'Yoast_Tracking_Hash' );
|
||||
|
||||
if ( !isset( $hash ) || !$hash || empty( $hash ) ) {
|
||||
$hash = md5( site_url() );
|
||||
update_option( 'Yoast_Tracking_Hash', $hash );
|
||||
}
|
||||
|
||||
$data = get_transient( 'yoast_tracking_cache' );
|
||||
if ( !$data ) {
|
||||
|
||||
$pts = array();
|
||||
foreach ( get_post_types( array( 'public' => true ) ) as $pt ) {
|
||||
$count = wp_count_posts( $pt );
|
||||
$pts[$pt] = $count->publish;
|
||||
}
|
||||
|
||||
$comments_count = wp_count_comments();
|
||||
|
||||
// wp_get_theme was introduced in 3.4, for compatibility with older versions, let's do a workaround for now.
|
||||
if ( function_exists( 'wp_get_theme' ) ) {
|
||||
$theme_data = wp_get_theme();
|
||||
$theme = array(
|
||||
'name' => $theme_data->display( 'Name', false, false ),
|
||||
'theme_uri' => $theme_data->display( 'ThemeURI', false, false ),
|
||||
'version' => $theme_data->display( 'Version', false, false ),
|
||||
'author' => $theme_data->display( 'Author', false, false ),
|
||||
'author_uri' => $theme_data->display( 'AuthorURI', false, false ),
|
||||
);
|
||||
if ( isset( $theme_data->template ) && !empty( $theme_data->template ) && $theme_data->parent() ) {
|
||||
$theme['template'] = array(
|
||||
'version' => $theme_data->parent()->display( 'Version', false, false ),
|
||||
'name' => $theme_data->parent()->display( 'Name', false, false ),
|
||||
'theme_uri' => $theme_data->parent()->display( 'ThemeURI', false, false ),
|
||||
'author' => $theme_data->parent()->display( 'Author', false, false ),
|
||||
'author_uri' => $theme_data->parent()->display( 'AuthorURI', false, false ),
|
||||
);
|
||||
} else {
|
||||
$theme['template'] = '';
|
||||
}
|
||||
} else {
|
||||
$theme_data = (object) get_theme_data( get_stylesheet_directory() . '/style.css' );
|
||||
$theme = array(
|
||||
'version' => $theme_data->Version,
|
||||
'name' => $theme_data->Name,
|
||||
'author' => $theme_data->Author,
|
||||
'template' => $theme_data->Template,
|
||||
);
|
||||
}
|
||||
|
||||
$plugins = array();
|
||||
foreach ( get_option( 'active_plugins' ) as $plugin_path ) {
|
||||
if ( !function_exists( 'get_plugin_data' ) )
|
||||
require_once ABSPATH . 'wp-admin/includes/admin.php';
|
||||
|
||||
$plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_path );
|
||||
|
||||
$slug = str_replace( '/' . basename( $plugin_path ), '', $plugin_path );
|
||||
$plugins[$slug] = array(
|
||||
'version' => $plugin_info['Version'],
|
||||
'name' => $plugin_info['Name'],
|
||||
'plugin_uri' => $plugin_info['PluginURI'],
|
||||
'author' => $plugin_info['AuthorName'],
|
||||
'author_uri' => $plugin_info['AuthorURI'],
|
||||
);
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'site' => array(
|
||||
'hash' => $hash,
|
||||
'url' => site_url(),
|
||||
'name' => get_bloginfo( 'name' ),
|
||||
'version' => get_bloginfo( 'version' ),
|
||||
'multisite' => is_multisite(),
|
||||
'users' => $wpdb->get_var( "SELECT COUNT(*) FROM wp_users INNER JOIN wp_usermeta ON (wp_users.ID = wp_usermeta.user_id) WHERE 1 = 1 AND ( wp_usermeta.meta_key = 'wp_{$blog_id}_capabilities' ) " ),
|
||||
'lang' => get_locale(),
|
||||
),
|
||||
'pts' => $pts,
|
||||
'comments' => array(
|
||||
'total' => $comments_count->total_comments,
|
||||
'approved' => $comments_count->approved,
|
||||
'spam' => $comments_count->spam,
|
||||
'pings' => $wpdb->get_var( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_type = 'pingback'" ),
|
||||
),
|
||||
'options' => apply_filters( 'yoast_tracking_filters', array() ),
|
||||
'theme' => $theme,
|
||||
'plugins' => $plugins,
|
||||
);
|
||||
|
||||
$args = array(
|
||||
'body' => $data
|
||||
);
|
||||
wp_remote_post( 'https://tracking.yoast.com/', $args );
|
||||
|
||||
// Store for a week, then push data again.
|
||||
set_transient( 'yoast_tracking_cache', true, 7 * 60 * 60 * 24 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$yoast_tracking = new Yoast_Tracking;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds tracking parameters for WP SEO settings. Outside of the main class as the class could also be in use in other plugins.
|
||||
*
|
||||
* @param array $options
|
||||
* @return array
|
||||
*/
|
||||
function wpseo_tracking_additions( $options ) {
|
||||
$opt = get_wpseo_options();
|
||||
|
||||
$options['wpseo'] = array(
|
||||
'xml_sitemaps' => isset( $opt['enablexmlsitemap'] ) ? 1 : 0,
|
||||
'force_rewrite' => isset( $opt['forcerewritetitle'] ) ? 1 : 0,
|
||||
'opengraph' => isset( $opt['opengraph'] ) ? 1 : 0,
|
||||
'twitter' => isset( $opt['twitter'] ) ? 1 : 0,
|
||||
'strip_category_base' => isset( $opt['stripcategorybase'] ) ? 1 : 0,
|
||||
'on_front' => get_option( 'show_on_front' ),
|
||||
);
|
||||
return $options;
|
||||
}
|
||||
|
||||
add_filter( 'yoast_tracking_filters', 'wpseo_tracking_additions' );
|
||||
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
global $wpseo_admin_pages;
|
||||
|
||||
$options = get_option( 'wpseo' );
|
||||
|
||||
if ( isset( $_GET['allow_tracking'] ) && check_admin_referer( 'wpseo_activate_tracking', 'nonce' ) ) {
|
||||
$options['tracking_popup'] = 'done';
|
||||
if ( $_GET['allow_tracking'] == 'yes' )
|
||||
$options['yoast_tracking'] = 'on';
|
||||
else
|
||||
$options['yoast_tracking'] = 'off';
|
||||
update_option( 'wpseo', $options );
|
||||
|
||||
if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
|
||||
wp_safe_redirect( $_SERVER['HTTP_REFERER'], 307 );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$wpseo_admin_pages->admin_header( __( 'General Settings', 'wordpress-seo' ), true, 'yoast_wpseo_options', 'wpseo' );
|
||||
|
||||
echo $wpseo_admin_pages->hidden( 'ignore_blog_public_warning' );
|
||||
echo $wpseo_admin_pages->hidden( 'ignore_tour' );
|
||||
echo $wpseo_admin_pages->hidden( 'ignore_page_comments' );
|
||||
echo $wpseo_admin_pages->hidden( 'ignore_permalink' );
|
||||
echo $wpseo_admin_pages->hidden( 'ms_defaults_set' );
|
||||
echo $wpseo_admin_pages->hidden( 'version' );
|
||||
echo $wpseo_admin_pages->hidden( 'tracking_popup' );
|
||||
|
||||
if ( isset( $options['blocking_files'] ) && is_array( $options['blocking_files'] ) && count( $options['blocking_files'] ) > 0 ) {
|
||||
$options['blocking_files'] = array_unique( $options['blocking_files'] );
|
||||
echo '<p id="blocking_files" class="wrong">'
|
||||
. '<a href="javascript:wpseo_killBlockingFiles(\'' . wp_create_nonce( 'wpseo-blocking-files' ) . '\')" class="button fixit">' . __( 'Fix it.', 'wordpress-seo' ) . '</a>'
|
||||
. __( 'The following file(s) is/are blocking your XML sitemaps from working properly:', 'wordpress-seo' ) . '<br />';
|
||||
foreach ( $options['blocking_files'] as $file ) {
|
||||
echo esc_html( $file ) . '<br/>';
|
||||
}
|
||||
echo __( 'Either delete them (this can be done with the "Fix it" button) or disable WP SEO XML sitemaps.', 'wordpress-seo' );
|
||||
echo '</p>';
|
||||
}
|
||||
|
||||
if ( isset( $_GET['fixmetadesc'] ) && check_admin_referer( 'wpseo-fix-metadesc', 'nonce' ) && isset( $options['theme_check'] ) && isset( $options['theme_check']['description_found'] ) && $options['theme_check']['description_found'] ) {
|
||||
$fcontent = file_get_contents( TEMPLATEPATH . '/header.php' );
|
||||
$msg = '';
|
||||
if ( !file_exists( TEMPLATEPATH . '/header.php.wpseobak' ) ) {
|
||||
$backupfile = fopen( TEMPLATEPATH . '/header.php.wpseobak', 'w+' );
|
||||
if ( $backupfile ) {
|
||||
fwrite( $backupfile, $fcontent );
|
||||
fclose( $backupfile );
|
||||
$msg = __( 'Backed up the original file header.php to header.php.wpseobak, ', 'wordpress-seo' );
|
||||
|
||||
$count = 0;
|
||||
$fcontent = str_replace( $options['theme_check']['description_found'], '', $fcontent, $count );
|
||||
if ( $count > 0 ) {
|
||||
$header_file = fopen( TEMPLATEPATH . '/header.php', 'w+' );
|
||||
if ( $header_file ) {
|
||||
fwrite( $header_file, $fcontent );
|
||||
fclose( $header_file );
|
||||
$msg .= __( 'removed hardcoded meta description.' );
|
||||
}
|
||||
}
|
||||
unset( $options['theme_check']['description_found'] );
|
||||
update_option( 'wpseo', $options );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !isset( $options['theme_check']['description'] ) ) {
|
||||
if ( file_exists( TEMPLATEPATH . '/header.php' ) ) {
|
||||
$header_file = file_get_contents( TEMPLATEPATH . '/header.php' );
|
||||
$issue = preg_match_all( '#<\s*meta\s*(name|content)\s*=\s*("|\')(.*)("|\')\s*(name|content)\s*=\s*("|\')(.*)("|\')(\s+)?/?>#i', $header_file, $matches, PREG_SET_ORDER );
|
||||
if ( !$issue ) {
|
||||
$options['theme_check']['description'] = true;
|
||||
} else {
|
||||
foreach ( $matches as $meta ) {
|
||||
if ( ( strtolower( $meta[1] ) == 'name' && strtolower( $meta[3] ) == 'description' ) || ( strtolower( $meta[5] ) == 'name' && strtolower( $meta[7] ) == 'description' ) ) {
|
||||
$options['theme_check']['description_found'] = $meta[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
update_option( 'wpseo', $options );
|
||||
}
|
||||
|
||||
if ( isset( $options['theme_check'] ) && isset( $options['theme_check']['description_found'] ) && $options['theme_check']['description_found'] ) {
|
||||
echo '<p id="metadesc_found notice" class="wrong settings_error">'
|
||||
. '<a href="' . admin_url( 'admin.php?page=wpseo_dashboard&fixmetadesc&nonce=' . wp_create_nonce( 'wpseo-fix-metadesc' ) ) . '" class="button fixit">' . __( 'Fix it.', 'wordpress-seo' ) . '</a>'
|
||||
. __( 'Your theme contains a meta description, which blocks WordPress SEO from working properly, please delete the following line, or press fix it:', 'wordpress-seo' ) . '<br />';
|
||||
echo '<code>' . htmlentities( $options['theme_check']['description_found'] ) . '</code>';
|
||||
echo '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( strpos( get_option( 'permalink_structure' ), '%postname%' ) === false && !isset( $options['ignore_permalink'] ) )
|
||||
echo '<p id="wrong_permalink" class="wrong">'
|
||||
. '<a href="' . admin_url( 'options-permalink.php' ) . '" class="button fixit">' . __( 'Fix it.', 'wordpress-seo' ) . '</a>'
|
||||
. '<a href="javascript:wpseo_setIgnore(\'permalink\',\'wrong_permalink\',\'' . wp_create_nonce( 'wpseo-ignore' ) . '\');" class="button fixit">' . __( 'Ignore.', 'wordpress-seo' ) . '</a>'
|
||||
. __( 'You do not have your postname in the URL of your posts and pages, it is highly recommended that you do. Consider setting your permalink structure to <strong>/%postname%/</strong>.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
if ( get_option( 'page_comments' ) && !isset( $options['ignore_page_comments'] ) )
|
||||
echo '<p id="wrong_page_comments" class="wrong">'
|
||||
. '<a href="javascript:setWPOption(\'page_comments\',\'0\',\'wrong_page_comments\',\'' . wp_create_nonce( 'wpseo-setoption' ) . '\');" class="button fixit">' . __( 'Fix it.', 'wordpress-seo' ) . '</a>'
|
||||
. '<a href="javascript:wpseo_setIgnore(\'page_comments\',\'wrong_page_comments\',\'' . wp_create_nonce( 'wpseo-ignore' ) . '\');" class="button fixit">' . __( 'Ignore.', 'wordpress-seo' ) . '</a>'
|
||||
. __( 'Paging comments is enabled, this is not needed in 999 out of 1000 cases, so the suggestion is to disable it, to do that, simply uncheck the box before "Break comments into pages..."', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
echo '<h2>' . __( 'General', 'wordpress-seo' ) . '</h2>';
|
||||
|
||||
if ( isset( $options['ignore_tour'] ) && $options['ignore_tour'] ) {
|
||||
echo '<label class="select">' . __( 'Introduction Tour:', 'wordpress-seo' ) . '</label><a class="button-secondary" href="' . admin_url( 'admin.php?page=wpseo_dashboard&wpseo_restart_tour' ) . '">' . __( 'Start Tour', 'wordpress-seo' ) . '</a>';
|
||||
echo '<p class="desc label">' . __( 'Take this tour to quickly learn about the use of this plugin.', 'wordpress-seo' ) . '</p>';
|
||||
}
|
||||
|
||||
echo '<label class="select">' . __( 'Default Settings:', 'wordpress-seo' ) . '</label><a class="button-secondary" href="' . admin_url( 'admin.php?page=wpseo_dashboard&wpseo_reset_defaults&nonce='. wp_create_nonce('wpseo_reset_defaults') ) . '">' . __( 'Reset Default Settings', 'wordpress-seo' ) . '</a>';
|
||||
echo '<p class="desc label">' . __( 'If you want to restore a site to the default WordPress SEO settings, press this button.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
echo '<h2>' . __( 'Tracking', 'wordpress-seo' ) . '</h2>';
|
||||
echo $wpseo_admin_pages->checkbox( 'yoast_tracking', __( 'Allow tracking of this WordPress installs anonymous data.', 'wordpress-seo' ) );
|
||||
echo '<p class="desc">' . __( "To maintain a plugin as big as WordPress SEO, we need to know what we're dealing: what kinds of other plugins our users are using, what themes, etc. Please allow us to track that data from your install. It will not track <em>any</em> user details, so your security and privacy are safe with us.", 'wordpress-seo' ) . '</p>';
|
||||
|
||||
echo '<h2>' . __( 'Security', 'wordpress-seo' ) . '</h2>';
|
||||
echo $wpseo_admin_pages->checkbox( 'disableadvanced_meta', __( 'Disable the Advanced part of the WordPress SEO meta box', 'wordpress-seo' ) );
|
||||
echo '<p class="desc">' . __( 'Unchecking this box allows authors and editors to redirect posts, noindex them and do other things you might not want if you don\'t trust your authors.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
echo '<h2>' . __( 'Webmaster Tools', 'wordpress-seo' ) . '</h2>';
|
||||
echo '<p>' . __( 'You can use the boxes below to verify with the different Webmaster Tools, if your site is already verified, you can just forget about these. Enter the verify meta values for:', 'wordpress-seo' ) . '</p>';
|
||||
echo $wpseo_admin_pages->textinput( 'googleverify', '<a target="_blank" href="https://www.google.com/webmasters/tools/dashboard?hl=en&siteUrl=' . urlencode( get_bloginfo( 'url' ) ) . '%2F">' . __( 'Google Webmaster Tools', 'wordpress-seo' ) . '</a>' );
|
||||
echo $wpseo_admin_pages->textinput( 'msverify', '<a target="_blank" href="http://www.bing.com/webmaster/?rfp=1#/Dashboard/?url=' . str_replace( 'http://', '', get_bloginfo( 'url' ) ) . '">' . __( 'Bing Webmaster Tools', 'wordpress-seo' ) . '</a>' );
|
||||
echo $wpseo_admin_pages->textinput( 'alexaverify', '<a target="_blank" href="http://www.alexa.com/pro/subscription">' . __( 'Alexa Verification ID', 'wordpress-seo' ) . '</a>' );
|
||||
|
||||
do_action( 'wpseo_dashboard' );
|
||||
|
||||
$wpseo_admin_pages->admin_footer();
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
global $wpseo_admin_pages;
|
||||
|
||||
if ( isset( $_POST[ 'submitrobots' ] ) ) {
|
||||
if ( !current_user_can( 'manage_options' ) ) die( __( 'You cannot edit the robots.txt file.', 'wordpress-seo' ) );
|
||||
|
||||
check_admin_referer( 'wpseo-robotstxt' );
|
||||
|
||||
if ( file_exists( get_home_path() . "robots.txt" ) ) {
|
||||
$robots_file = get_home_path() . "robots.txt";
|
||||
$robotsnew = stripslashes( $_POST[ 'robotsnew' ] );
|
||||
if ( is_writable( $robots_file ) ) {
|
||||
$f = fopen( $robots_file, 'w+' );
|
||||
fwrite( $f, $robotsnew );
|
||||
fclose( $f );
|
||||
$msg = __( 'Updated Robots.txt', 'wordpress-seo' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $_POST[ 'submithtaccess' ] ) ) {
|
||||
if ( !current_user_can( 'manage_options' ) ) die( __( 'You cannot edit the .htaccess file.', 'wordpress-seo' ) );
|
||||
|
||||
check_admin_referer( 'wpseo-htaccess' );
|
||||
|
||||
if ( file_exists( get_home_path() . ".htaccess" ) ) {
|
||||
$htaccess_file = get_home_path() . ".htaccess";
|
||||
$htaccessnew = stripslashes( $_POST[ 'htaccessnew' ] );
|
||||
if ( is_writeable( $htaccess_file ) ) {
|
||||
$f = fopen( $htaccess_file, 'w+' );
|
||||
fwrite( $f, $htaccessnew );
|
||||
fclose( $f );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$wpseo_admin_pages->admin_header( 'Files', false );
|
||||
if ( isset( $msg ) && !empty( $msg ) ) {
|
||||
echo '<div id="message" style="width:94%;" class="updated fade"><p>' . esc_html( $msg ) . '</p></div>';
|
||||
}
|
||||
|
||||
if ( file_exists( get_home_path() . "robots.txt" ) ) {
|
||||
$robots_file = get_home_path() . "robots.txt";
|
||||
$f = fopen( $robots_file, 'r' );
|
||||
if ( filesize( $robots_file ) > 0 )
|
||||
$content = fread( $f, filesize( $robots_file ) );
|
||||
else
|
||||
$content = '';
|
||||
$robotstxtcontent = esc_textarea( $content );
|
||||
|
||||
if ( !is_writable( $robots_file ) ) {
|
||||
$content = "<p><em>" . __( "If your robots.txt were writable, you could edit it from here.", 'wordpress-seo' ) . "</em></p>";
|
||||
$content .= '<textarea disabled="disabled" style="width: 90%;" rows="15" name="robotsnew">' . $robotstxtcontent . '</textarea><br/>';
|
||||
} else {
|
||||
$content = '<form action="" method="post" id="robotstxtform">';
|
||||
$content .= wp_nonce_field( 'wpseo-robotstxt', '_wpnonce', true, false );
|
||||
$content .= "<p>" . __( "Edit the content of your robots.txt:", 'wordpress-seo' ) . "</p>";
|
||||
$content .= '<textarea style="width: 90%;" rows="15" name="robotsnew">' . $robotstxtcontent . '</textarea><br/>';
|
||||
$content .= '<div class="submit"><input class="button" type="submit" name="submitrobots" value="' . __( "Save changes to Robots.txt", 'wordpress-seo' ) . '" /></div>';
|
||||
$content .= '</form>';
|
||||
}
|
||||
|
||||
} else {
|
||||
$content = '<p>'.__('If you had a robots.txt file and it was editable, you could edit it from here.','wordpress-seo');
|
||||
}
|
||||
|
||||
$wpseo_admin_pages->postbox( 'robotstxt', __( 'Robots.txt', 'wordpress-seo' ), $content );
|
||||
|
||||
if ( (isset($_SERVER['SERVER_SOFTWARE']) && stristr($_SERVER['SERVER_SOFTWARE'], 'nginx') === false) && file_exists( get_home_path() . ".htaccess" ) ) {
|
||||
$htaccess_file = get_home_path() . "/.htaccess";
|
||||
$f = fopen( $htaccess_file, 'r' );
|
||||
$contentht = fread( $f, filesize( $htaccess_file ) );
|
||||
$contentht = esc_textarea( $contentht );
|
||||
|
||||
if ( !is_writable( $htaccess_file ) ) {
|
||||
$content = "<p><em>" . __( "If your .htaccess were writable, you could edit it from here.", 'wordpress-seo' ) . "</em></p>";
|
||||
$content .= '<textarea disabled="disabled" style="width: 90%;" rows="15" name="robotsnew">' . $contentht . '</textarea><br/>';
|
||||
} else {
|
||||
$content = '<form action="" method="post" id="htaccessform">';
|
||||
$content .= wp_nonce_field( 'wpseo-htaccess', '_wpnonce', true, false );
|
||||
$content .= "<p>" . __( 'Edit the content of your .htaccess:', 'wordpress-seo' ) . "</p>";
|
||||
$content .= '<textarea style="width: 90%;" rows="15" name="htaccessnew">' . $contentht . '</textarea><br/>';
|
||||
$content .= '<div class="submit"><input class="button" type="submit" name="submithtaccess" value="' . __( 'Save changes to .htaccess', 'wordpress-seo' ) . '" /></div>';
|
||||
$content .= '</form>';
|
||||
}
|
||||
$wpseo_admin_pages->postbox( 'htaccess', __( '.htaccess file', 'wordpress-seo' ), $content );
|
||||
} else if ( (isset($_SERVER['SERVER_SOFTWARE']) && stristr($_SERVER['SERVER_SOFTWARE'], 'nginx') === false) && !file_exists( get_home_path() . ".htaccess" ) ) {
|
||||
$content = '<p>'.__('If you had a .htaccess file and it was editable, you could edit it from here.','wordpress-seo');
|
||||
$wpseo_admin_pages->postbox( 'htaccess', __( '.htaccess file', 'wordpress-seo' ), $content );
|
||||
}
|
||||
|
||||
$wpseo_admin_pages->admin_footer( false );
|
||||
@@ -0,0 +1,348 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
global $wpseo_admin_pages;
|
||||
|
||||
/**
|
||||
* Used for imports, this functions either copies $old_metakey into $new_metakey or just plain replaces $old_metakey with $new_metakey
|
||||
*
|
||||
* @param string $old_metakey The old name of the meta value.
|
||||
* @param string $new_metakey The new name of the meta value, usually the WP SEO name.
|
||||
* @param bool $replace Whether to replace or to copy the values.
|
||||
*/
|
||||
function replace_meta( $old_metakey, $new_metakey, $replace = false ) {
|
||||
global $wpdb;
|
||||
$oldies = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE meta_key = %s", $old_metakey ) );
|
||||
foreach ( $oldies as $old ) {
|
||||
// Prevent inserting new meta values for posts that already have a value for that new meta key
|
||||
$check = get_post_meta( $old->post_id, $new_metakey, true );
|
||||
if ( !$check || empty($check) )
|
||||
update_post_meta( $old->post_id, $new_metakey, $old->meta_value );
|
||||
|
||||
if ( $replace )
|
||||
delete_post_meta( $old->post_id, $old_metakey );
|
||||
}
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
if ( isset( $_POST['import'] ) ) {
|
||||
|
||||
check_admin_referer( 'wpseo-import' );
|
||||
|
||||
global $wpdb;
|
||||
$replace = false;
|
||||
$deletekw = false;
|
||||
|
||||
if ( isset( $_POST['wpseo']['deleteolddata'] ) && $_POST['wpseo']['deleteolddata'] == 'on' ) {
|
||||
$replace = true;
|
||||
}
|
||||
if ( isset( $_POST['wpseo']['importwoo'] ) ) {
|
||||
wpseo_defaults();
|
||||
|
||||
$sep = get_option('seo_woo_seperator');
|
||||
|
||||
$options = get_wpseo_options();
|
||||
|
||||
switch ( get_option( 'seo_woo_home_layout' ) ) {
|
||||
case 'a':
|
||||
$options['title-home'] = '%%sitename%% '.$sep.' %%sitedesc%%';
|
||||
break;
|
||||
case 'b':
|
||||
$options['title-home'] = '%%sitename%% '.get_option('seo_woo_paged_var').' %%pagenum%%';
|
||||
break;
|
||||
case 'c':
|
||||
$options['title-home'] = '%%sitedesc%%';
|
||||
break;
|
||||
}
|
||||
if ( $replace )
|
||||
delete_option('seo_woo_home_layout');
|
||||
|
||||
switch ( get_option( 'seo_woo_single_layout' ) ) {
|
||||
case 'a':
|
||||
$options['title-post'] = '%%title%% '.$sep.' %%sitename%%';
|
||||
break;
|
||||
case 'b':
|
||||
$options['title-post'] = '%%title%%';
|
||||
break;
|
||||
case 'c':
|
||||
$options['title-post'] = '%%sitename%% '.$sep.' %%title%%';
|
||||
break;
|
||||
case 'd':
|
||||
$options['title-post'] = '%%title%% '.$sep.' %%sitedesc%%';
|
||||
break;
|
||||
case 'e':
|
||||
$options['title-post'] = '%%sitename%% '.$sep.' %%title%% '.$sep.' %%sitedesc%%';
|
||||
break;
|
||||
}
|
||||
if ( $replace )
|
||||
delete_option('seo_woo_single_layout');
|
||||
|
||||
switch ( get_option( 'seo_woo_page_layout' ) ) {
|
||||
case 'a':
|
||||
$options['title-page'] = '%%title%% '.$sep.' %%sitename%%';
|
||||
break;
|
||||
case 'b':
|
||||
$options['title-page'] = '%%title%%';
|
||||
break;
|
||||
case 'c':
|
||||
$options['title-page'] = '%%sitename%% '.$sep.' %%title%%';
|
||||
break;
|
||||
case 'd':
|
||||
$options['title-page'] = '%%title%% '.$sep.' %%sitedesc%%';
|
||||
break;
|
||||
case 'e':
|
||||
$options['title-page'] = '%%sitename%% '.$sep.' %%title%% '.$sep.' %%sitedesc%%';
|
||||
break;
|
||||
}
|
||||
if ( $replace )
|
||||
delete_option('seo_woo_page_layout');
|
||||
|
||||
$template = '%%term_title%% '.$sep.' %%page%% '.$sep.' %%sitename%%';
|
||||
switch ( get_option( 'seo_woo_archive_layout' ) ) {
|
||||
case 'a':
|
||||
$template = '%%term_title%% '.$sep.' %%page%% '.$sep.' %%sitename%%';
|
||||
break;
|
||||
case 'b':
|
||||
$template = '%%term_title%%';
|
||||
break;
|
||||
case 'c':
|
||||
$template = '%%sitename%% '.$sep.' %%term_title%% '.$sep.' %%page%%';
|
||||
break;
|
||||
case 'd':
|
||||
$template = '%%term_title%% '.$sep.' %%page%%'.$sep.' %%sitedesc%%';
|
||||
break;
|
||||
case 'e':
|
||||
$template = '%%sitename%% '.$sep.' %%term_title%% '.$sep.' %%page%% '.$sep.' %%sitedesc%%';
|
||||
break;
|
||||
}
|
||||
if ( $replace )
|
||||
delete_option('seo_woo_archive_layout');
|
||||
|
||||
foreach ( get_taxonomies( array( 'public' => true ), 'names' ) as $tax ) {
|
||||
$options['title-'.$tax] = $template;
|
||||
}
|
||||
|
||||
// Import the custom homepage description
|
||||
if ( 'c' == get_option( 'seo_woo_meta_home_desc' ) ) {
|
||||
$options['metadesc-home'] = get_option( 'seo_woo_meta_home_desc_custom' );
|
||||
}
|
||||
if ( $replace )
|
||||
delete_option('seo_woo_meta_home_desc');
|
||||
|
||||
// Import the custom homepage keywords
|
||||
if ( 'c' == get_option( 'seo_woo_meta_home_key' ) ) {
|
||||
$options['metakey-home'] = get_option( 'seo_woo_meta_home_key_custom' );
|
||||
}
|
||||
if ( $replace )
|
||||
delete_option('seo_woo_meta_home_key');
|
||||
|
||||
// If WooSEO is set to use the Woo titles, import those
|
||||
if ( 'true' == get_option( 'seo_woo_wp_title' ) ) {
|
||||
replace_meta( 'seo_title', '_yoast_wpseo_title', $replace );
|
||||
}
|
||||
|
||||
// If WooSEO is set to use the Woo meta descriptions, import those
|
||||
if ( 'b' == get_option( 'seo_woo_meta_single_desc' ) ) {
|
||||
replace_meta( 'seo_description', '_yoast_wpseo_metadesc', $replace );
|
||||
}
|
||||
|
||||
// If WooSEO is set to use the Woo meta keywords, import those
|
||||
if ( 'b' == get_option( 'seo_woo_meta_single_key' ) ) {
|
||||
replace_meta( 'seo_keywords', '_yoast_wpseo_metakeywords', $replace );
|
||||
}
|
||||
|
||||
replace_meta( 'seo_follow', '_yoast_wpseo_meta-robots-nofollow', $replace );
|
||||
replace_meta( 'seo_noindex', '_yoast_wpseo_meta-robots-noindex', $replace );
|
||||
|
||||
$msg .= __( 'WooThemes SEO framework settings & data successfully imported.', 'wordpress-seo' );
|
||||
}
|
||||
if ( isset( $_POST['wpseo']['importheadspace'] ) ) {
|
||||
replace_meta( '_headspace_description', '_yoast_wpseo_metadesc', $replace );
|
||||
replace_meta( '_headspace_keywords', '_yoast_wpseo_metakeywords', $replace );
|
||||
replace_meta( '_headspace_page_title', '_yoast_wpseo_title', $replace );
|
||||
replace_meta( '_headspace_noindex', '_yoast_wpseo_meta-robots-noindex', $replace );
|
||||
replace_meta( '_headspace_nofollow', '_yoast_wpseo_meta-robots-nofollow', $replace );
|
||||
|
||||
$posts = $wpdb->get_results( "SELECT ID FROM $wpdb->posts" );
|
||||
foreach ( $posts as $post ) {
|
||||
$custom = get_post_custom( $post->ID );
|
||||
$robotsmeta_adv = '';
|
||||
if ( isset( $custom['_headspace_noarchive'] ) ) {
|
||||
$robotsmeta_adv .= 'noarchive,';
|
||||
}
|
||||
if ( isset( $custom['_headspace_noodp'] ) ) {
|
||||
$robotsmeta_adv .= 'noodp,';
|
||||
}
|
||||
if ( isset( $custom['_headspace_noydir'] ) ) {
|
||||
$robotsmeta_adv .= 'noydir';
|
||||
}
|
||||
$robotsmeta_adv = preg_replace( '/,$/', '', $robotsmeta_adv );
|
||||
wpseo_set_value( 'meta-robots-adv', $robotsmeta_adv, $post->ID );
|
||||
|
||||
if ( $replace ) {
|
||||
foreach ( array( 'noindex', 'nofollow', 'noarchive', 'noodp', 'noydir' ) as $meta ) {
|
||||
delete_post_meta( $post->ID, '_headspace_' . $meta );
|
||||
}
|
||||
}
|
||||
}
|
||||
$msg .= __('HeadSpace2 data successfully imported','wordpress-seo');
|
||||
}
|
||||
if ( isset( $_POST['wpseo']['importaioseo'] ) ) {
|
||||
replace_meta( '_aioseop_description', '_yoast_wpseo_metadesc', $replace );
|
||||
replace_meta( '_aioseop_keywords', '_yoast_wpseo_metakeywords', $replace );
|
||||
replace_meta( '_aioseop_title', '_yoast_wpseo_title', $replace );
|
||||
$msg .= __( 'All in One SEO data successfully imported.', 'wordpress-seo' );
|
||||
}
|
||||
if ( isset( $_POST['wpseo']['importaioseoold'] ) ) {
|
||||
replace_meta( 'description', '_yoast_wpseo_metadesc', $replace );
|
||||
replace_meta( 'keywords', '_yoast_wpseo_metakeywords', $replace );
|
||||
replace_meta( 'title', '_yoast_wpseo_title', $replace );
|
||||
$msg .= __( 'All in One SEO (Old version) data successfully imported.', 'wordpress-seo' );
|
||||
}
|
||||
if ( isset( $_POST['wpseo']['importrobotsmeta'] ) ) {
|
||||
$posts = $wpdb->get_results( "SELECT ID, robotsmeta FROM $wpdb->posts" );
|
||||
foreach ( $posts as $post ) {
|
||||
if ( strpos( $post->robotsmeta, 'noindex' ) !== false )
|
||||
wpseo_set_value( 'meta-robots-noindex', true, $post->ID );
|
||||
|
||||
if ( strpos( $post->robotsmeta, 'nofollow' ) !== false )
|
||||
wpseo_set_value( 'meta-robots-nofollow', true, $post->ID );
|
||||
}
|
||||
$msg .= __( 'Robots Meta values imported.', 'wordpress-seo' );
|
||||
}
|
||||
if ( isset( $_POST['wpseo']['importrssfooter'] ) ) {
|
||||
$optold = get_option( 'RSSFooterOptions' );
|
||||
$optnew = get_option( 'wpseo_rss' );
|
||||
if ( $optold['position'] == 'after' ) {
|
||||
if ( empty( $optnew['rssafter'] ) )
|
||||
$optnew['rssafter'] = $optold['footerstring'];
|
||||
} else {
|
||||
if ( empty( $optnew['rssbefore'] ) )
|
||||
$optnew['rssbefore'] = $optold['footerstring'];
|
||||
}
|
||||
update_option( 'wpseo_rss', $optnew );
|
||||
$msg .= __( 'RSS Footer options imported successfully.', 'wordpress-seo' );
|
||||
}
|
||||
if ( isset( $_POST['wpseo']['importbreadcrumbs'] ) ) {
|
||||
$optold = get_option( 'yoast_breadcrumbs' );
|
||||
$optnew = get_option( 'wpseo_internallinks' );
|
||||
|
||||
if ( is_array( $optold ) ) {
|
||||
foreach ( $optold as $opt => $val ) {
|
||||
if ( is_bool( $val ) && $val == true )
|
||||
$optnew['breadcrumbs-' . $opt] = 'on';
|
||||
else
|
||||
$optnew['breadcrumbs-' . $opt] = $val;
|
||||
}
|
||||
update_option( 'wpseo_internallinks', $optnew );
|
||||
$msg .= __( 'Yoast Breadcrumbs options imported successfully.', 'wordpress-seo' );
|
||||
} else {
|
||||
$msg .= __( 'Yoast Breadcrumbs options could not be found', 'wordpress-seo' );
|
||||
}
|
||||
}
|
||||
if ( $replace )
|
||||
$msg .= __( ', and old data deleted.', 'wordpress-seo' );
|
||||
if ( $deletekw )
|
||||
$msg .= __( ', and meta keywords data deleted.', 'wordpress-seo' );
|
||||
}
|
||||
|
||||
$wpseo_admin_pages->admin_header( 'Import', false );
|
||||
if ( $msg != '' )
|
||||
echo '<div id="message" class="message updated" style="width:94%;"><p>' . esc_html( $msg ) . '</p></div>';
|
||||
|
||||
$content = "<p>" . __( "No doubt you've used an SEO plugin before if this site isn't new. Let's make it easy on you, you can import the data below. If you want, you can import first, check if it was imported correctly, and then import & delete. No duplicate data will be imported.", 'wordpress-seo' ) . "</p>";
|
||||
$content .= '<p>' . sprintf( __( "If you've used another SEO plugin, try the %sSEO Data Transporter%s plugin to move your data into this plugin, it rocks!", 'wordpress-seo' ), "<a href='http://wordpress.org/extend/plugins/seo-data-transporter/'>", "</a>" ) . '</p>';
|
||||
$content .= '<form action="" method="post">';
|
||||
$content .= wp_nonce_field( 'wpseo-import', '_wpnonce', true, false );
|
||||
$content .= $wpseo_admin_pages->checkbox( 'importheadspace', __( 'Import from HeadSpace2?', 'wordpress-seo' ) );
|
||||
$content .= $wpseo_admin_pages->checkbox( 'importaioseo', __( 'Import from All-in-One SEO?', 'wordpress-seo' ) );
|
||||
$content .= $wpseo_admin_pages->checkbox( 'importaioseoold', __( 'Import from OLD All-in-One SEO?', 'wordpress-seo' ) );
|
||||
$content .= $wpseo_admin_pages->checkbox( 'importwoo', __( 'Import from WooThemes SEO framework?', 'wordpress-seo' ) );
|
||||
$content .= '<br/>';
|
||||
$content .= $wpseo_admin_pages->checkbox( 'deleteolddata', __( 'Delete the old data after import? (recommended)', 'wordpress-seo' ) );
|
||||
$content .= '<input type="submit" class="button-primary" name="import" value="' . __( 'Import', 'wordpress-seo' ) . '" />';
|
||||
$content .= '<br/><br/>';
|
||||
$content .= '<h2>' . __( 'Import settings from other plugins', 'wordpress-seo' ) . '</h2>';
|
||||
$content .= $wpseo_admin_pages->checkbox( 'importrobotsmeta', __( 'Import from Robots Meta (by Yoast)?', 'wordpress-seo' ) );
|
||||
$content .= $wpseo_admin_pages->checkbox( 'importrssfooter', __( 'Import from RSS Footer (by Yoast)?', 'wordpress-seo' ) );
|
||||
$content .= $wpseo_admin_pages->checkbox( 'importbreadcrumbs', __( 'Import from Yoast Breadcrumbs?', 'wordpress-seo' ) );
|
||||
$content .= '<input type="submit" class="button-primary" name="import" value="' . __( 'Import', 'wordpress-seo' ) . '" />';
|
||||
$content .= '</form><br/>';
|
||||
|
||||
$wpseo_admin_pages->postbox( 'import', __( 'Import', 'wordpress-seo' ), $content );
|
||||
|
||||
do_action( 'wpseo_import', $this );
|
||||
|
||||
$content = '<h4>' . __( 'Export', 'wordpress-seo' ) . '</h4>';
|
||||
$content .= '<form method="post">';
|
||||
$content .= wp_nonce_field( 'wpseo-export', '_wpnonce', true, false );
|
||||
$content .= '<p>' . __( 'Export your WordPress SEO settings here, to import them again later or to import them on another site.', 'wordpress-seo' ) . '</p>';
|
||||
if ( phpversion() > 5.2 )
|
||||
$content .= $wpseo_admin_pages->checkbox( 'include_taxonomy_meta', __( 'Include Taxonomy Metadata', 'wordpress-seo' ) );
|
||||
$content .= '<br/><input type="submit" class="button" name="wpseo_export" value="' . __( 'Export settings', 'wordpress-seo' ) . '"/>';
|
||||
$content .= '</form>';
|
||||
if ( isset( $_POST['wpseo_export'] ) ) {
|
||||
check_admin_referer( 'wpseo-export' );
|
||||
$include_taxonomy = false;
|
||||
if ( isset( $_POST['wpseo']['include_taxonomy_meta'] ) )
|
||||
$include_taxonomy = true;
|
||||
$url = $wpseo_admin_pages->export_settings( $include_taxonomy );
|
||||
if ( $url ) {
|
||||
$content .= '<script type="text/javascript">
|
||||
document.location = \'' . $url . '\';
|
||||
</script>';
|
||||
} else {
|
||||
$content .= 'Error: ' . $url;
|
||||
}
|
||||
}
|
||||
|
||||
$content .= '<h4>' . __( 'Import', 'wordpress-seo' ) . '</h4>';
|
||||
if ( !isset( $_FILES['settings_import_file'] ) || empty( $_FILES['settings_import_file'] ) ) {
|
||||
$content .= '<p>' . __( 'Import settings by locating <em>settings.zip</em> and clicking', 'wordpress-seo' ) . ' "' . __( 'Import settings', 'wordpress-seo' ) . '":</p>';
|
||||
$content .= '<form method="post" enctype="multipart/form-data">';
|
||||
$content .= wp_nonce_field( 'wpseo-import-file', '_wpnonce', true, false );
|
||||
$content .= '<input type="file" name="settings_import_file"/>';
|
||||
$content .= '<input type="hidden" name="action" value="wp_handle_upload"/>';
|
||||
$content .= '<input type="submit" class="button" value="' . __( 'Import settings', 'wordpress-seo' ) . '"/>';
|
||||
$content .= '</form><br/>';
|
||||
} else if ( isset( $_FILES['settings_import_file'] ) ) {
|
||||
check_admin_referer( 'wpseo-import-file' );
|
||||
$file = wp_handle_upload( $_FILES['settings_import_file'] );
|
||||
|
||||
if ( isset( $file['file'] ) && !is_wp_error( $file ) ) {
|
||||
require_once ( ABSPATH . 'wp-admin/includes/class-pclzip.php' );
|
||||
$zip = new PclZip( $file['file'] );
|
||||
$unzipped = $zip->extract( $p_path = WP_CONTENT_DIR . '/wpseo-import/' );
|
||||
if ( $unzipped[0]['stored_filename'] == 'settings.ini' ) {
|
||||
$options = parse_ini_file( WP_CONTENT_DIR . '/wpseo-import/settings.ini', true );
|
||||
foreach ( $options as $name => $optgroup ) {
|
||||
if ( $name != 'wpseo_taxonomy_meta' ) {
|
||||
update_option( $name, $optgroup );
|
||||
} else {
|
||||
update_option( $name, json_decode( urldecode( $optgroup['wpseo_taxonomy_meta'] ), true ) );
|
||||
}
|
||||
}
|
||||
@unlink( WP_CONTENT_DIR . '/wpseo-import/' );
|
||||
@unlink( $file['file'] );
|
||||
|
||||
$content .= '<p><strong>' . __( 'Settings successfully imported.', 'wordpress-seo' ) . '</strong></p>';
|
||||
} else {
|
||||
$content .= '<p><strong>' . __( 'Settings could not be imported:', 'wordpress-seo' ) . ' ' . __( 'Unzipping failed.', 'wordpress-seo' ) . '</strong></p>';
|
||||
}
|
||||
} else {
|
||||
if ( is_wp_error( $file ) )
|
||||
$content .= '<p><strong>' . __( 'Settings could not be imported:', 'wordpress-seo' ) . ' ' . $file['error'] . '</strong></p>';
|
||||
else
|
||||
$content .= '<p><strong>' . __( 'Settings could not be imported:', 'wordpress-seo' ) . ' ' . __( 'Upload failed.', 'wordpress-seo' ) . '</strong></p>';
|
||||
}
|
||||
}
|
||||
$wpseo_admin_pages->postbox( 'wpseo_export', __( 'Export & Import SEO Settings', 'wordpress-seo' ), $content );
|
||||
|
||||
$wpseo_admin_pages->admin_footer( false );
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
global $wpseo_admin_pages;
|
||||
|
||||
$wpseo_admin_pages->admin_header( __( 'Internal Links', 'wordpress-seo' ), true, 'yoast_wpseo_internallinks_options', 'wpseo_internallinks' );
|
||||
|
||||
$content = $wpseo_admin_pages->checkbox( 'breadcrumbs-enable', __( 'Enable Breadcrumbs', 'wordpress-seo' ) );
|
||||
$content .= '<br/>';
|
||||
$content .= $wpseo_admin_pages->textinput( 'breadcrumbs-sep', __( 'Separator between breadcrumbs', 'wordpress-seo' ) );
|
||||
$content .= $wpseo_admin_pages->textinput( 'breadcrumbs-home', __( 'Anchor text for the Homepage', 'wordpress-seo' ) );
|
||||
$content .= $wpseo_admin_pages->textinput( 'breadcrumbs-prefix', __( 'Prefix for the breadcrumb path', 'wordpress-seo' ) );
|
||||
$content .= $wpseo_admin_pages->textinput( 'breadcrumbs-archiveprefix', __( 'Prefix for Archive breadcrumbs', 'wordpress-seo' ) );
|
||||
$content .= $wpseo_admin_pages->textinput( 'breadcrumbs-searchprefix', __( 'Prefix for Search Page breadcrumbs', 'wordpress-seo' ) );
|
||||
$content .= $wpseo_admin_pages->textinput( 'breadcrumbs-404crumb', __( 'Breadcrumb for 404 Page', 'wordpress-seo' ) );
|
||||
$content .= $wpseo_admin_pages->checkbox( 'breadcrumbs-blog-remove', __( 'Remove Blog page from Breadcrumbs', 'wordpress-seo' ) );
|
||||
$content .= '<br/><br/>';
|
||||
$content .= '<strong>' . __( 'Taxonomy to show in breadcrumbs for:', 'wordpress-seo' ) . '</strong><br/>';
|
||||
foreach ( get_post_types( array( 'public' => true ), 'objects' ) as $pt ) {
|
||||
$taxonomies = get_object_taxonomies( $pt->name, 'objects' );
|
||||
if ( count( $taxonomies ) > 0 ) {
|
||||
$values = array( 0 => __( 'None', 'wordpress-seo' ) );
|
||||
foreach ( $taxonomies as $tax ) {
|
||||
$values[ $tax->name ] = $tax->labels->singular_name;
|
||||
}
|
||||
$content .= $wpseo_admin_pages->select( 'post_types-' . $pt->name . '-maintax', $pt->labels->name, $values );
|
||||
}
|
||||
}
|
||||
$content .= '<br/>';
|
||||
|
||||
$content .= '<strong>' . __( 'Post type archive to show in breadcrumbs for:', 'wordpress-seo' ) . '</strong><br/>';
|
||||
foreach ( get_taxonomies( array( 'public'=> true, '_builtin' => false ), 'objects' ) as $tax ) {
|
||||
$values = array( '' => __( 'None', 'wordpress-seo' ) );
|
||||
if ( get_option( 'show_on_front' ) == 'page' )
|
||||
$values[ 'post' ] = __( 'Blog', 'wordpress-seo' );
|
||||
|
||||
foreach ( get_post_types( array( 'public' => true ), 'objects' ) as $pt ) {
|
||||
if ( $pt->has_archive )
|
||||
$values[ $pt->name ] = $pt->labels->name;
|
||||
}
|
||||
$content .= $wpseo_admin_pages->select( 'taxonomy-' . $tax->name . '-ptparent', $tax->labels->singular_name, $values );
|
||||
}
|
||||
|
||||
$content .= $wpseo_admin_pages->checkbox( 'breadcrumbs-boldlast', __( 'Bold the last page in the breadcrumb', 'wordpress-seo' ) );
|
||||
|
||||
$content .= '<br class="clear"/>';
|
||||
$content .= '<h4>' . __( 'How to insert breadcrumbs in your theme', 'wordpress-seo' ) . '</h4>';
|
||||
$content .= '<p>' . __( 'Usage of this breadcrumbs feature is explained <a href="http://yoast.com/wordpress/breadcrumbs/">here</a>. For the more code savvy, insert this in your theme:', 'wordpress-seo' ) . '</p>';
|
||||
$content .= '<pre><?php if ( function_exists('yoast_breadcrumb') ) {
|
||||
yoast_breadcrumb('<p id="breadcrumbs">','</p>');
|
||||
} ?></pre>';
|
||||
$wpseo_admin_pages->postbox( 'internallinks', __( 'Breadcrumbs Settings', 'wordpress-seo' ), $content );
|
||||
|
||||
$wpseo_admin_pages->admin_footer();
|
||||
@@ -0,0 +1,327 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
global $wpseo_admin_pages;
|
||||
|
||||
$options = get_wpseo_options();
|
||||
|
||||
?>
|
||||
<div class="wrap">
|
||||
<?php
|
||||
|
||||
if ( ( isset( $_GET[ 'updated' ] ) && $_GET[ 'updated' ] == 'true' ) || ( isset( $_GET[ 'settings-updated' ] ) && $_GET[ 'settings-updated' ] == 'true' ) ) {
|
||||
$msg = __( 'Settings updated', 'wordpress-seo' );
|
||||
|
||||
echo '<div id="message" style="width:94%;" class="message updated"><p><strong>' . $msg . '.</strong></p></div>';
|
||||
}
|
||||
|
||||
?>
|
||||
<a href="http://yoast.com/">
|
||||
<div id="top yoast-icon" style="background: url('<?php echo WPSEO_URL; ?>images/wordpress-SEO-32x32.png') no-repeat;"
|
||||
class="icon32"><br/></div>
|
||||
</a>
|
||||
|
||||
<h2 id="wpseo-title"><?php _e( "Yoast WordPress SEO: Titles & Metas", 'wordpress-seo' ); ?></h2>
|
||||
|
||||
<div id="wpseo_content_top" class="postbox-container">
|
||||
<div class="metabox-holder">
|
||||
<div class="meta-box-sortables">
|
||||
|
||||
<h2 class="nav-tab-wrapper" id="wpseo-tabs">
|
||||
<a class="nav-tab" id="general-tab" href="#top#general"><?php _e( 'General', 'wordpress-seo' );?></a>
|
||||
<a class="nav-tab" id="home-tab" href="#top#home"><?php _e( 'Home', 'wordpress-seo' );?></a>
|
||||
<a class="nav-tab" id="post_types-tab" href="#top#post_types"><?php _e( 'Post Types', 'wordpress-seo' );?></a>
|
||||
<a class="nav-tab" id="taxonomies-tab" href="#top#taxonomies"><?php _e( 'Taxonomies', 'wordpress-seo' );?></a>
|
||||
<a class="nav-tab" id="archives-tab" href="#top#archives"><?php _e( 'Other', 'wordpress-seo' );?></a>
|
||||
<a class="nav-tab" id="template_help-tab" href="#top#template_help"><?php _e( 'Help', 'wordpress-seo' );?></a>
|
||||
</h2>
|
||||
|
||||
<div id="general" class="wpseotab">
|
||||
<?php
|
||||
echo '<form action="' . admin_url( 'options.php' ) . '" method="post" id="wpseo-conf">';
|
||||
settings_fields( 'yoast_wpseo_titles_options' );
|
||||
$wpseo_admin_pages->currentoption = 'wpseo_titles';
|
||||
|
||||
echo '<h2>' . __( 'Title settings', 'wordpress-seo' ) . '</h2>';
|
||||
echo $wpseo_admin_pages->checkbox( 'forcerewritetitle', __( 'Force rewrite titles', 'wordpress-seo' ) );
|
||||
echo '<p class="desc">' . __( 'WordPress SEO has auto-detected whether it needs to force rewrite the titles for your pages, if you think it\'s wrong and you know what you\'re doing, you can change the setting here.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
echo '<h2>' . __( 'Sitewide <code>meta</code> settings', 'wordpress-seo' ) . '</h2>';
|
||||
echo $wpseo_admin_pages->checkbox( 'noindex-subpages', __( 'Noindex subpages of archives', 'wordpress-seo' ) );
|
||||
echo '<p class="desc">' . __( 'If you want to prevent /page/2/ and further of any archive to show up in the search results, enable this.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
echo $wpseo_admin_pages->checkbox( 'usemetakeywords', __( 'Use <code>meta</code> keywords tag?', 'wordpress-seo' ) );
|
||||
echo '<p class="desc">' . __( 'I don\'t know why you\'d want to use meta keywords, but if you want to, check this box.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
echo $wpseo_admin_pages->checkbox( 'noodp', __( 'Add <code>noodp</code> meta robots tag sitewide', 'wordpress-seo' ) );
|
||||
echo '<p class="desc">' . __( 'Prevents search engines from using the DMOZ description for pages from this site in the search results.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
echo $wpseo_admin_pages->checkbox( 'noydir', __( 'Add <code>noydir</code> meta robots tag sitewide', 'wordpress-seo' ) );
|
||||
echo '<p class="desc">' . __( 'Prevents search engines from using the Yahoo! directory description for pages from this site in the search results.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
echo '<h2>' . __( 'Clean up the <code><head></code>', 'wordpress-seo' ) . '</h2>';
|
||||
echo $wpseo_admin_pages->checkbox( 'hide-rsdlink', __( 'Hide RSD Links', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->checkbox( 'hide-wlwmanifest', __( 'Hide WLW Manifest Links', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->checkbox( 'hide-shortlink', __( 'Hide Shortlink for posts', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->checkbox( 'hide-feedlinks', __( 'Hide RSS Links', 'wordpress-seo' ) );
|
||||
?>
|
||||
</div>
|
||||
<div id="home" class="wpseotab">
|
||||
<?php
|
||||
if ( 'page' != get_option( 'show_on_front' ) ) {
|
||||
echo '<h2>' . __( 'Homepage', 'wordpress-seo' ) . '</h2>';
|
||||
echo $wpseo_admin_pages->textinput( 'title-home', __( 'Title template', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->textarea( 'metadesc-home', __( 'Meta description template', 'wordpress-seo' ), '', 'metadesc' );
|
||||
if ( isset( $options[ 'usemetakeywords' ] ) && $options[ 'usemetakeywords' ] )
|
||||
echo $wpseo_admin_pages->textinput( 'metakey-home', __( 'Meta keywords template', 'wordpress-seo' ) );
|
||||
} else {
|
||||
echo '<h2>' . __( 'Homepage & Front page', 'wordpress-seo' ) . '</h2>';
|
||||
echo '<p>' . sprintf( __( 'You can determine the title and description for the front page by %sediting the front page itself »%s', 'wordpress-seo' ), '<a href="' . get_edit_post_link( get_option( 'page_on_front' ) ) . '">', '</a>' ) . '</p>';
|
||||
if ( is_numeric( get_option( 'page_for_posts' ) ) )
|
||||
echo '<p>' . sprintf( __( 'You can determine the title and description for the blog page by %sediting the blog page itself »%s', 'wordpress-seo' ), '<a href="' . get_edit_post_link( get_option( 'page_for_posts' ) ) . '">', '</a>' ) . '</p>';
|
||||
}
|
||||
|
||||
echo '<h2>' . __( 'Author metadata', 'wordpress-seo' ) . '</h2>';
|
||||
echo '<label class="select" for="">' . __( 'Author highlighting', 'wordpress-seo' ) . ':</label>';
|
||||
wp_dropdown_users( array( 'show_option_none' => "Don't show", 'name' => 'wpseo_titles[plus-author]', 'class' => 'select', 'selected' => isset( $options[ 'plus-author' ] ) ? $options[ 'plus-author' ] : '' ) );
|
||||
echo '<p class="desc label">' . __( 'Choose the user that should be used for the <code>rel="author"</code> on the blog homepage. Make sure the user has filled out his/her Google+ profile link on their profile page.', 'wordpress-seo' ) . '</p>';
|
||||
echo $wpseo_admin_pages->textinput( 'plus-publisher', __( 'Google Publisher Page', 'wordpress-seo' ) );
|
||||
echo '<p class="desc label">' . __( 'If you have a Google+ page for your business, add that URL here and link it on your Google+ page\'s about page.', 'wordpress-seo' ) . '</p>';
|
||||
?>
|
||||
</div>
|
||||
<div id="post_types" class="wpseotab">
|
||||
<?php
|
||||
foreach ( get_post_types( array( 'public' => true ), 'objects' ) as $posttype ) {
|
||||
if ( isset( $options[ 'redirectattachment' ] ) && $options[ 'redirectattachment' ] && $posttype == 'attachment' )
|
||||
continue;
|
||||
$name = $posttype->name;
|
||||
echo '<h4 id="' . esc_attr( $name ) . '">' . esc_html( ucfirst( $posttype->labels->name ) ) . '</h4>';
|
||||
echo $wpseo_admin_pages->textinput( 'title-' . $name, __( 'Title template', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->textarea( 'metadesc-' . $name, __( 'Meta description template', 'wordpress-seo' ), '', 'metadesc' );
|
||||
if ( isset( $options[ 'usemetakeywords' ] ) && $options[ 'usemetakeywords' ] )
|
||||
echo $wpseo_admin_pages->textinput( 'metakey-' . $name, __( 'Meta keywords template', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->checkbox( 'noindex-' . $name, '<code>noindex, follow</code>', __( 'Meta Robots', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->checkbox( 'showdate-' . $name, __( 'Show date in snippet preview?', 'wordpress-seo' ), __( 'Date in Snippet Preview', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->checkbox( 'hideeditbox-' . $name, __( 'Hide', 'wordpress-seo' ), __( 'WordPress SEO Meta Box', 'wordpress-seo' ) );
|
||||
echo '<br/>';
|
||||
}
|
||||
|
||||
$post_types = get_post_types( array( 'public' => true, '_builtin' => false ), 'objects' );
|
||||
|
||||
if ( count( $post_types ) > 0 ) {
|
||||
echo '<h2>' . __( 'Custom Post Type Archives', 'wordpress-seo' ) . '</h2>';
|
||||
echo '<p>' . __( 'Note: instead of templates these are the actual titles and meta descriptions for these custom post type archive pages.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
foreach ( $post_types as $pt ) {
|
||||
if ( !$pt->has_archive )
|
||||
continue;
|
||||
|
||||
$name = $pt->name;
|
||||
|
||||
echo '<h4>' . esc_html( ucfirst( $pt->labels->name ) ) . '</h4>';
|
||||
echo $wpseo_admin_pages->textinput( 'title-ptarchive-' . $name, __( 'Title', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->textarea( 'metadesc-ptarchive-' . $name, __( 'Meta description', 'wordpress-seo' ), '', 'metadesc' );
|
||||
if ( isset( $options[ 'breadcrumbs-enable' ] ) && $options[ 'breadcrumbs-enable' ] )
|
||||
echo $wpseo_admin_pages->textinput( 'bctitle-ptarchive-' . $name, __( 'Breadcrumbs Title', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->checkbox( 'noindex-ptarchive-' . $name, '<code>noindex, follow</code>', __( 'Meta Robots', 'wordpress-seo' ) );
|
||||
}
|
||||
unset( $pt, $post_type );
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
<div id="taxonomies" class="wpseotab">
|
||||
<?php
|
||||
foreach ( get_taxonomies( array( 'public' => true ), 'objects' ) as $tax ) {
|
||||
echo '<h4>' . esc_html( ucfirst( $tax->labels->name ) ). '</h4>';
|
||||
echo $wpseo_admin_pages->textinput( 'title-' . $tax->name, __( 'Title template', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->textarea( 'metadesc-' . $tax->name, __( 'Meta description template', 'wordpress-seo' ), '', 'metadesc' );
|
||||
if ( isset( $options[ 'usemetakeywords' ] ) && $options[ 'usemetakeywords' ] )
|
||||
echo $wpseo_admin_pages->textinput( 'metakey-' . $tax->name, __( 'Meta keywords template', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->checkbox( 'noindex-' . $tax->name, '<code>noindex, follow</code>', __( 'Meta Robots', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->checkbox( 'tax-hideeditbox-' . $tax->name, __( 'Hide', 'wordpress-seo' ), __( 'WordPress SEO Meta Box', 'wordpress-seo' ) );
|
||||
echo '<br/>';
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
<div id="archives" class="wpseotab">
|
||||
<?php
|
||||
echo '<h4>' . __( 'Author Archives', 'wordpress-seo' ) . '</h4>';
|
||||
echo $wpseo_admin_pages->textinput( 'title-author', __( 'Title template', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->textarea( 'metadesc-author', __( 'Meta description template', 'wordpress-seo' ), '', 'metadesc' );
|
||||
if ( isset( $options[ 'usemetakeywords' ] ) && $options[ 'usemetakeywords' ] )
|
||||
echo $wpseo_admin_pages->textinput( 'metakey-author', __( 'Meta keywords template', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->checkbox( 'noindex-author', '<code>noindex, follow</code>', __( 'Meta Robots', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->checkbox( 'disable-author', __( 'Disable the author archives', 'wordpress-seo' ), '' );
|
||||
echo '<p class="desc label">' . __( 'If you\'re running a one author blog, the author archive will always look exactly the same as your homepage. And even though you may not link to it, others might, to do you harm. Disabling them here will make sure any link to those archives will be 301 redirected to the homepage.', 'wordpress-seo' ) . '</p>';
|
||||
echo '<br/>';
|
||||
echo '<h4>' . __( 'Date Archives', 'wordpress-seo' ) . '</h4>';
|
||||
echo $wpseo_admin_pages->textinput( 'title-archive', __( 'Title template', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->textarea( 'metadesc-archive', __( 'Meta description template', 'wordpress-seo' ), '', 'metadesc' );
|
||||
echo '<br/>';
|
||||
echo $wpseo_admin_pages->checkbox( 'noindex-archive', '<code>noindex, follow</code>', __( 'Meta Robots', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->checkbox( 'disable-date', __( 'Disable the date-based archives', 'wordpress-seo' ), '' );
|
||||
echo '<p class="desc label">' . __( 'For the date based archives, the same applies: they probably look a lot like your homepage, and could thus be seen as duplicate content.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
echo '<h2>' . __( 'Special Pages', 'wordpress-seo' ) . '</h2>';
|
||||
echo '<p>' . __( 'These pages will be noindex, followed by default, so they will never show up in search results.', 'wordpress-seo' ) . '</p>';
|
||||
echo '<h4>' . __( 'Search pages', 'wordpress-seo' ) . '</h4>';
|
||||
echo $wpseo_admin_pages->textinput( 'title-search', __( 'Title template', 'wordpress-seo' ) );
|
||||
echo '<h4>' . __( '404 pages', 'wordpress-seo' ) . '</h4>';
|
||||
echo $wpseo_admin_pages->textinput( 'title-404', __( 'Title template', 'wordpress-seo' ) );
|
||||
echo '<br class="clear"/>';
|
||||
?>
|
||||
</div>
|
||||
<div id="template_help" class="wpseotab">
|
||||
<?php
|
||||
$content = '
|
||||
<p>' . __( 'These tags can be included in templates and will be replaced by WordPress SEO by Yoast when a page is displayed.', 'wordpress-seo' ) . '</p>
|
||||
<table class="yoast_help">
|
||||
<tr>
|
||||
<th>%%date%%</th>
|
||||
<td>' . __( 'Replaced with the date of the post/page', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%title%%</th>
|
||||
<td>' . __( 'Replaced with the title of the post/page', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%sitename%%</th>
|
||||
<td>' . __( 'The site\'s name', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%sitedesc%%</th>
|
||||
<td>' . __( 'The site\'s tagline / description', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%excerpt%%</th>
|
||||
<td>' . __( 'Replaced with the post/page excerpt (or auto-generated if it does not exist)', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%excerpt_only%%</th>
|
||||
<td>' . __( 'Replaced with the post/page excerpt (without auto-generation)', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%tag%%</th>
|
||||
<td>' . __( 'Replaced with the current tag/tags', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%category%%</th>
|
||||
<td>' . __( 'Replaced with the post categories (comma separated)', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%category_description%%</th>
|
||||
<td>' . __( 'Replaced with the category description', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%tag_description%%</th>
|
||||
<td>' . __( 'Replaced with the tag description', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%term_description%%</th>
|
||||
<td>' . __( 'Replaced with the term description', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%term_title%%</th>
|
||||
<td>' . __( 'Replaced with the term name', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%pt_single%%</th>
|
||||
<td>' . __( 'Replaced with the post type single label', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%pt_plural%%</th>
|
||||
<td>' . __( 'Replaced with the post type plural label', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%modified%%</th>
|
||||
<td>' . __( 'Replaced with the post/page modified time', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%id%%</th>
|
||||
<td>' . __( 'Replaced with the post/page ID', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%name%%</th>
|
||||
<td>' . __( 'Replaced with the post/page author\'s \'nicename\'', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%userid%%</th>
|
||||
<td>' . __( 'Replaced with the post/page author\'s userid', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%searchphrase%%</th>
|
||||
<td>' . __( 'Replaced with the current search phrase', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr class="alt">
|
||||
<th>%%currenttime%%</th>
|
||||
<td>' . __( 'Replaced with the current time', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%currentdate%%</th>
|
||||
<td>' . __( 'Replaced with the current date', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr class="alt">
|
||||
<th>%%currentday%%</th>
|
||||
<td>' . __( 'Replaced with the current day', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%currentmonth%%</th>
|
||||
<td>' . __( 'Replaced with the current month', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr class="alt">
|
||||
<th>%%currentyear%%</th>
|
||||
<td>' . __( 'Replaced with the current year', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%page%%</th>
|
||||
<td>' . __( 'Replaced with the current page number (i.e. page 2 of 4)', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr class="alt">
|
||||
<th>%%pagetotal%%</th>
|
||||
<td>' . __( 'Replaced with the current page total', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%pagenumber%%</th>
|
||||
<td>' . __( 'Replaced with the current page number', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr class="alt">
|
||||
<th>%%caption%%</th>
|
||||
<td>' . __( 'Attachment caption', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%focuskw%%</th>
|
||||
<td>' . __( 'Replaced with the posts focus keyword', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%cf_<custom-field-name>%%</th>
|
||||
<td>' . __( 'Replaced with a posts custom field value', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%ct_<custom-tax-name>%%</th>
|
||||
<td>' . __( 'Replaced with a posts custom taxonomies, comma separated.', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%ct_desc_<custom-tax-name>%%</th>
|
||||
<td>' . __( 'Replaced with a custom taxonomoies description', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>%%sep%%</th>
|
||||
<td>' . __( 'The separator defined in your theme\'s <code>wp_title()</code> tag.', 'wordpress-seo' ) . '</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
echo '<h2>' . __( 'Variables', 'wordpress-seo' ) . '</h2>';
|
||||
echo $content;
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
$wpseo_admin_pages->admin_footer();
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
global $wpseo_admin_pages;
|
||||
|
||||
$options = get_site_option( 'wpseo_ms' );
|
||||
|
||||
if ( isset( $_POST[ 'wpseo_submit' ] ) ) {
|
||||
check_admin_referer( 'wpseo-network-settings' );
|
||||
|
||||
foreach ( array( 'access', 'defaultblog' ) as $opt ) {
|
||||
$options[ $opt ] = $_POST[ 'wpseo_ms' ][ $opt ];
|
||||
}
|
||||
update_site_option( 'wpseo_ms', $options );
|
||||
echo '<div id="message" class="updated"><p>' . __( 'Settings Updated.', 'wordpress-seo' ) . '</p></div>';
|
||||
}
|
||||
|
||||
if ( isset( $_POST[ 'wpseo_restore_blog' ] ) ) {
|
||||
check_admin_referer( 'wpseo-network-restore' );
|
||||
if ( isset( $_POST[ 'wpseo_ms' ][ 'restoreblog' ] ) && is_numeric( $_POST[ 'wpseo_ms' ][ 'restoreblog' ] ) ) {
|
||||
$blog = get_blog_details( $_POST[ 'wpseo_ms' ][ 'restoreblog' ] );
|
||||
if ( $blog ) {
|
||||
foreach ( get_wpseo_options_arr() as $option ) {
|
||||
$new_options = get_blog_option( $options[ 'defaultblog' ], $option );
|
||||
if ( count( $new_options ) > 0 )
|
||||
update_blog_option( $_POST[ 'wpseo_ms' ][ 'restoreblog' ], $option, $new_options );
|
||||
}
|
||||
echo '<div id="message" class="updated"><p>' . $blog->blogname . ' ' . __( 'restored to default SEO settings.', 'wordpress-seo' ) . '</p></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$wpseo_admin_pages->admin_header( 'MultiSite Settings', false );
|
||||
|
||||
$content = '<form method="post">';
|
||||
$content .= wp_nonce_field( 'wpseo-network-settings', '_wpnonce', true, false );
|
||||
$content .= $wpseo_admin_pages->select( 'access', __( 'Who should have access to the WordPress SEO settings', 'wordpress-seo' ),
|
||||
array(
|
||||
'admin' => __( 'Site Admins (default)', 'wordpress-seo' ),
|
||||
'superadmin' => __( 'Super Admins only', 'wordpress-seo' )
|
||||
), 'wpseo_ms'
|
||||
);
|
||||
$content .= $wpseo_admin_pages->textinput( 'defaultblog', __( 'New blogs get the SEO settings from this blog', 'wordpress-seo' ), 'wpseo_ms' );
|
||||
$content .= '<p>' . __( 'Enter the Blog ID for the site whose settings you want to use as default for all sites that are added to your network. Leave empty for none.', 'wordpress-seo' ) . '</p>';
|
||||
$content .= '<input type="submit" name="wpseo_submit" class="button-primary" value="' . __( 'Save MultiSite Settings', 'wordpress-seo' ) . '"/>';
|
||||
$content .= '</form>';
|
||||
|
||||
$wpseo_admin_pages->postbox( 'wpseo_export', __( 'MultiSite Settings', 'wordpress-seo' ), $content );
|
||||
|
||||
$content = '<form method="post">';
|
||||
$content .= wp_nonce_field( 'wpseo-network-restore', '_wpnonce', true, false );
|
||||
$content .= '<p>' . __( 'Using this form you can reset a site to the default SEO settings.', 'wordpress-seo' ) . '</p>';
|
||||
$content .= $wpseo_admin_pages->textinput( 'restoreblog', __( 'Blog ID', 'wordpress-seo' ), 'wpseo_ms' );
|
||||
$content .= '<input type="submit" name="wpseo_restore_blog" value="' . __( 'Restore site to defaults', 'wordpress-seo' ) . '" class="button"/>';
|
||||
$content .= '</form>';
|
||||
|
||||
$wpseo_admin_pages->postbox( 'wpseo_export', __( 'Restore site to default settings', 'wordpress-seo' ), $content );
|
||||
|
||||
$wpseo_admin_pages->admin_footer( false );
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
global $wpseo_admin_pages;
|
||||
|
||||
$wpseo_admin_pages->admin_header( __( 'Permalinks', 'wordpress-seo' ), true, 'yoast_wpseo_permalinks_options', 'wpseo_permalinks' );
|
||||
$content = $wpseo_admin_pages->checkbox( 'stripcategorybase', __( 'Strip the category base (usually <code>/category/</code>) from the category URL.', 'wordpress-seo' ) );
|
||||
$content .= $wpseo_admin_pages->checkbox( 'trailingslash', __( 'Enforce a trailing slash on all category and tag URL\'s', 'wordpress-seo' ) );
|
||||
$content .= '<p class="desc">' . __( 'If you choose a permalink for your posts with <code>.html</code>, or anything else but a / on the end, this will force WordPress to add a trailing slash to non-post pages nonetheless.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
$content .= $wpseo_admin_pages->checkbox( 'redirectattachment', __( 'Redirect attachment URL\'s to parent post URL.', 'wordpress-seo' ) );
|
||||
$content .= '<p class="desc">' . __( 'Attachments to posts are stored in the database as posts, this means they\'re accessible under their own URL\'s if you do not redirect them, enabling this will redirect them to the post they were attached to.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
$content .= $wpseo_admin_pages->checkbox( 'cleanreplytocom', __( 'Remove the <code>?replytocom</code> variables.', 'wordpress-seo' ) );
|
||||
$content .= '<p class="desc">' . __( 'This prevents threaded replies from working when the user has JavaScript disabled, but on a large site can mean a <em>huge</em> improvement in crawl efficiency for search engines when you have a lot of comments.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
$content .= $wpseo_admin_pages->checkbox( 'cleanpermalinks', __( 'Redirect ugly URL\'s to clean permalinks. (Not recommended in many cases!)', 'wordpress-seo' ) );
|
||||
$content .= '<p class="desc">' . __( 'People make mistakes in their links towards you sometimes, or unwanted parameters are added to the end of your URLs, this allows you to redirect them all away. Please note that while this is a feature that is actively maintained, it is known to break several plugins, and should for that reason be the first feature you disable when you encounter issues after installing this plugin.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
$wpseo_admin_pages->postbox( 'permalinks', __( 'Permalink Settings', 'wordpress-seo' ), $content );
|
||||
|
||||
$content = $wpseo_admin_pages->select( 'force_transport', __( 'Force Transport', 'wordpress-seo' ), array( 'default' => __( 'Leave default', 'wordpress-seo' ), 'http' => __( 'Force http', 'wordpress-seo' ), 'https' => __( 'Force https', 'wordpress-seo' ) ) );
|
||||
$content .= '<p class="desc label">' . __( 'Force the canonical to either http or https, when your blog runs under both.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
$wpseo_admin_pages->postbox( 'canonical', __( 'Canonical Settings', 'wordpress-seo' ), $content );
|
||||
|
||||
$content = $wpseo_admin_pages->checkbox( 'cleanpermalink-googlesitesearch', __( 'Prevent cleaning out Google Site Search URL\'s.', 'wordpress-seo' ) );
|
||||
$content .= '<p class="desc">' . __( 'Google Site Search URL\'s look weird, and ugly, but if you\'re using Google Site Search, you probably do not want them cleaned out.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
$content .= $wpseo_admin_pages->checkbox( 'cleanpermalink-googlecampaign', __( 'Prevent cleaning out Google Analytics Campaign Parameters.', 'wordpress-seo' ) );
|
||||
$content .= '<p class="desc">' . __( 'If you use Google Analytics campaign parameters starting with <code>?utm_</code>, check this box. You shouldn\'t use these btw, you should instead use the hash tagged version instead.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
$content .= $wpseo_admin_pages->textinput( 'cleanpermalink-extravars', __( 'Other variables not to clean', 'wordpress-seo' ) );
|
||||
$content .= '<p class="desc">' . __( 'You might have extra variables you want to prevent from cleaning out, add them here, comma separarted.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
$wpseo_admin_pages->postbox( 'cleanpermalinksdiv', __( 'Clean Permalink Settings', 'wordpress-seo' ), $content );
|
||||
|
||||
$wpseo_admin_pages->admin_footer();
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
global $wpseo_admin_pages;
|
||||
|
||||
$options = get_wpseo_options();
|
||||
$wpseo_admin_pages->admin_header( 'RSS', true, 'yoast_wpseo_rss_options', 'wpseo_rss' );
|
||||
|
||||
$content = '<p>' . __( "This feature is used to automatically add content to your RSS, more specifically, it's meant to add links back to your blog and your blog posts, so dumb scrapers will automatically add these links too, helping search engines identify you as the original source of the content.", 'wordpress-seo' ) . '</p>';
|
||||
$rows = array();
|
||||
$rssbefore = '';
|
||||
if ( isset( $options[ 'rssbefore' ] ) )
|
||||
$rssbefore = esc_html( stripslashes( $options[ 'rssbefore' ] ) );
|
||||
|
||||
$rssafter = '';
|
||||
if ( isset( $options[ 'rssafter' ] ) )
|
||||
$rssafter = esc_html( stripslashes( $options[ 'rssafter' ] ) );
|
||||
|
||||
$rows[ ] = array(
|
||||
"id" => "rssbefore",
|
||||
"label" => __( "Content to put before each post in the feed", 'wordpress-seo' ),
|
||||
"desc" => __( "(HTML allowed)", 'wordpress-seo' ),
|
||||
"content" => '<textarea cols="50" rows="5" id="rssbefore" name="wpseo_rss[rssbefore]">' . $rssbefore . '</textarea>',
|
||||
);
|
||||
$rows[ ] = array(
|
||||
"id" => "rssafter",
|
||||
"label" => __( "Content to put after each post", 'wordpress-seo' ),
|
||||
"desc" => __( "(HTML allowed)", 'wordpress-seo' ),
|
||||
"content" => '<textarea cols="50" rows="5" id="rssafter" name="wpseo_rss[rssafter]">' . $rssafter . '</textarea>',
|
||||
);
|
||||
$rows[ ] = array(
|
||||
"label" => __( 'Explanation', 'wordpress-seo' ),
|
||||
"content" => '<p>' . __( 'You can use the following variables within the content, they will be replaced by the value on the right.', 'wordpress-seo' ) . '</p>' .
|
||||
'<table>' .
|
||||
'<tr><th><strong>%%AUTHORLINK%%</strong></th><td>' . __( 'A link to the archive for the post author, with the authors name as anchor text.', 'wordpress-seo' ) . '</td></tr>' .
|
||||
'<tr><th><strong>%%POSTLINK%%</strong></th><td>' . __( 'A link to the post, with the title as anchor text.', 'wordpress-seo' ) . '</td></tr>' .
|
||||
'<tr><th><strong>%%BLOGLINK%%</strong></th><td>' . __( "A link to your site, with your site's name as anchor text.", 'wordpress-seo' ) . '</td></tr>' .
|
||||
'<tr><th><strong>%%BLOGDESCLINK%%</strong></th><td>' . __( "A link to your site, with your site's name and description as anchor text.", 'wordpress-seo' ) . '</td></tr>' .
|
||||
'</table>'
|
||||
);
|
||||
$wpseo_admin_pages->postbox( 'rssfootercontent', __( 'Content of your RSS Feed', 'wordpress-seo' ), $content . $wpseo_admin_pages->form_table( $rows ) );
|
||||
|
||||
$wpseo_admin_pages->admin_footer();
|
||||
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'HTTP/1.0 403 Forbidden' );
|
||||
die;
|
||||
}
|
||||
|
||||
global $wpseo_admin_pages;
|
||||
|
||||
$options = get_option( 'wpseo_social' );
|
||||
|
||||
$fbconnect = '<p><strong>' . __( 'Facebook Insights and Admins', 'wordpress-seo' ) . '</strong><br>';
|
||||
$fbconnect .= sprintf( __( 'To be able to access your <a href="%s">Facebook Insights</a> for your site, you need to specify a Facebook Admin. This can be a user, but if you have an app for your site, you could use that. For most people a user will be "good enough" though.', 'wordpress-seo' ), 'https://www.facebook.com/insights' ) . '</p>';
|
||||
|
||||
$error = false;
|
||||
$clearall = false;
|
||||
|
||||
if ( isset( $_GET['delfbadmin'] ) ) {
|
||||
if ( wp_verify_nonce( $_GET['nonce'], 'delfbadmin' ) != 1 )
|
||||
die( "I don't think that's really nice of you!." );
|
||||
$id = $_GET['delfbadmin'];
|
||||
if ( isset( $options['fb_admins'][$id] ) ) {
|
||||
$fbadmin = $options['fb_admins'][$id]['name'];
|
||||
unset( $options['fb_admins'][$id] );
|
||||
update_option( 'wpseo_social', $options );
|
||||
add_settings_error( 'yoast_wpseo_social_options', 'success', sprintf( __( 'Successfully removed admin %s', 'wordpress-seo' ), $fbadmin ), 'updated' );
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $_GET['fbclearall'] ) ) {
|
||||
if ( wp_verify_nonce( $_GET['nonce'], 'fbclearall' ) != 1 )
|
||||
die( "I don't think that's really nice of you!." );
|
||||
unset( $options['fb_admins'], $options['fbapps'], $options['fbadminapp'], $options['fbadminpage'] );
|
||||
update_option( 'wpseo_social', $options );
|
||||
add_settings_error( 'yoast_wpseo_social_options', 'success', __( 'Successfully cleared all Facebook Data', 'wordpress-seo' ), 'updated' );
|
||||
}
|
||||
|
||||
if ( !isset( $options['fbconnectkey'] ) || empty( $options['fbconnectkey'] ) ) {
|
||||
$options['fbconnectkey'] = md5( get_bloginfo( 'url' ) . rand() );
|
||||
update_option( 'wpseo_social', $options );
|
||||
}
|
||||
|
||||
if ( isset( $_GET['key'] ) && $_GET['key'] == $options['fbconnectkey'] ) {
|
||||
if ( isset( $_GET['userid'] ) ) {
|
||||
if ( !isset( $options['fb_admins'] ) || !is_array( $options['fb_admins'] ) )
|
||||
$options['fb_admins'] = array();
|
||||
$user_id = $_GET['userid'];
|
||||
$options['fb_admins'][$user_id]['name'] = urldecode( $_GET['userrealname'] );
|
||||
$options['fb_admins'][$user_id]['link'] = urldecode( $_GET['link'] );
|
||||
update_option( 'wpseo_social', $options );
|
||||
add_settings_error( 'yoast_wpseo_social_options', 'success', sprintf( __( 'Successfully added %s as a Facebook Admin!', 'wordpress-seo' ), '<a href="' . esc_url( $options['fb_admins'][$user_id]['link'] ) . '">' . esc_html( $options['fb_admins'][$user_id]['name'] ) . '</a>' ), 'updated' );
|
||||
} else if ( isset( $_GET['apps'] ) ) {
|
||||
$apps = json_decode( stripslashes( $_GET['apps'] ) );
|
||||
$options['fbapps'] = array( '0' => __( 'Do not use a Facebook App as Admin', 'wordpress-seo' ) );
|
||||
foreach ( $apps as $app ) {
|
||||
$options['fbapps'][$app->app_id] = $app->display_name;
|
||||
}
|
||||
update_option( 'wpseo_social', $options );
|
||||
add_settings_error( 'yoast_wpseo_social_options', 'success', __( 'Successfully retrieved your apps from Facebook, now select an app to use as admin.', 'wordpress-seo' ), 'updated' );
|
||||
}
|
||||
$error = true;
|
||||
}
|
||||
|
||||
$options = get_option( 'wpseo_social' );
|
||||
|
||||
if ( isset( $options['fb_admins'] ) && is_array( $options['fb_admins'] ) ) {
|
||||
foreach ( $options['fb_admins'] as $id => $admin ) {
|
||||
$fbconnect .= '<input type="hidden" name="wpseo_social[fb_admins][' . esc_attr( $id ) . ']" value="' . esc_attr( $admin['link'] ) . '"/>';
|
||||
}
|
||||
$clearall = true;
|
||||
}
|
||||
|
||||
if ( isset( $options['fbapps'] ) && is_array( $options['fbapps'] ) ) {
|
||||
foreach ( $options['fbapps'] as $id => $page ) {
|
||||
$fbconnect .= '<input type="hidden" name="wpseo_social[fbapps][' . esc_attr( $id ) . ']" value="' . esc_attr( $page ) . '"/>';
|
||||
}
|
||||
$clearall = true;
|
||||
}
|
||||
|
||||
$app_button_text = __( 'Use a Facebook App as Admin', 'wordpress-seo' );
|
||||
if ( isset( $options['fbapps'] ) && is_array( $options['fbapps'] ) ) {
|
||||
$fbconnect .= '<p>' . __( 'Select an app to use as Facebook admin:', 'wordpress-seo' ) . '</p>';
|
||||
$fbconnect .= '<select name="wpseo_social[fbadminapp]" id="fbadminapp">';
|
||||
|
||||
if ( !isset( $options['fbadminapp'] ) )
|
||||
$options['fbadminapp'] = 0;
|
||||
|
||||
foreach ( $options['fbapps'] as $id => $app ) {
|
||||
$sel = '';
|
||||
|
||||
if ( $id == $options['fbadminapp'] )
|
||||
$sel = 'selected="selected"';
|
||||
$fbconnect .= '<option ' . $sel . ' value="' . esc_attr( $id ) . '">' . esc_attr( $app ) . '</option>';
|
||||
}
|
||||
$fbconnect .= '</select><div class="clear"></div><br/>';
|
||||
$app_button_text = __( 'Update Facebook Apps', 'wordpress-seo' );
|
||||
}
|
||||
|
||||
if ( !isset( $options['fbadminapp'] ) || $options['fbadminapp'] == 0 ) {
|
||||
$button_text = __( 'Add Facebook Admin', 'wordpress-seo' );
|
||||
$primary = true;
|
||||
if ( isset( $options['fb_admins'] ) && is_array( $options['fb_admins'] ) && count( $options['fb_admins'] ) > 0 ) {
|
||||
$fbconnect .= '<p>' . __( 'Currently connected Facebook admins:', 'wordpress-seo' ) . '</p>';
|
||||
$fbconnect .= '<ul>';
|
||||
$nonce = wp_create_nonce( 'delfbadmin' );
|
||||
|
||||
foreach ( $options['fb_admins'] as $admin_id => $admin ) {
|
||||
$admin_id = esc_attr( $admin_id );
|
||||
$fbconnect .= '<li><a href="' . esc_url( $admin['link'] ) . '">' . esc_html( $admin['name'] ) . '</a> - <strong><a href="' . admin_url( 'admin.php?page=wpseo_social&delfbadmin=' . $admin_id . '&nonce=' . $nonce ) . '">X</a></strong></li>';
|
||||
$fbconnect .= '<input type="hidden" name="wpseo_social[fb_admins][' . $admin_id . '][link]" value="' . esc_attr( $admin['link'] ) . '"/>';
|
||||
$fbconnect .= '<input type="hidden" name="wpseo_social[fb_admins][' . $admin_id . '][name]" value="' . esc_attr( $admin['name'] ) . '"/>';
|
||||
}
|
||||
$fbconnect .= '</ul>';
|
||||
$button_text = __( 'Add Another Facebook Admin', 'wordpress-seo' );
|
||||
$primary = false;
|
||||
}
|
||||
$but_primary = '';
|
||||
if ( $primary )
|
||||
$but_primary = '-primary';
|
||||
$fbconnect .= '<p><a class="button' . esc_attr( $but_primary ) . '" href="https://yoast.com/fb-connect/?key=' . $options['fbconnectkey'] . '&redirect=' . urlencode( admin_url( 'admin.php?page=wpseo_social' ) ) . '">' . $button_text . '</a></p>';
|
||||
}
|
||||
|
||||
$fbconnect .= '<a class="button" href="https://yoast.com/fb-connect/?key=' . esc_url( $options['fbconnectkey'] ) . '&type=app&redirect=' . urlencode( admin_url( 'admin.php?page=wpseo_social' ) ) . '">' . esc_html( $app_button_text ) . '</a> ';
|
||||
if ( $clearall ) {
|
||||
$fbconnect .= '<a class="button" href="' . admin_url( 'admin.php?page=wpseo_social&nonce=' . wp_create_nonce( 'fbclearall' ) . '&fbclearall=true' ) . '">' . __( 'Clear all Facebook Data', 'wordpress-seo' ) . '</a> ';
|
||||
}
|
||||
$fbconnect .= '</p>';
|
||||
|
||||
$wpseo_admin_pages->admin_header( __( 'Social', 'wordpress-seo' ), true, 'yoast_wpseo_social_options', 'wpseo_social' );
|
||||
|
||||
if ( $error )
|
||||
settings_errors();
|
||||
|
||||
echo '<h2>' . __( 'Facebook OpenGraph', 'wordpress-seo' ) . '</h2>';
|
||||
echo $wpseo_admin_pages->checkbox( 'opengraph', '<label for="opengraph">' . __( 'Add OpenGraph meta data', 'wordpress-seo' ) . '</label>' );
|
||||
echo'<p class="desc">' . __( 'Add OpenGraph meta data to your site\'s <code><head></code> section. You can specify some of the ID\'s that are sometimes needed below:', 'wordpress-seo' ) . '</p>';
|
||||
echo $fbconnect;
|
||||
echo '<h4>' . __( 'Frontpage settings', 'wordpress-seo' ) . '</h4>';
|
||||
echo $wpseo_admin_pages->textinput( 'og_frontpage_image', __( 'Image URL', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->textinput( 'og_frontpage_desc', __( 'Description', 'wordpress-seo' ) );
|
||||
echo '<p class="desc label">' . __( 'These are the image and description used in the OpenGraph meta tags on the frontpage of your site.', 'wordpress-seo' ) . '</p>';
|
||||
echo '<h4>' . __( 'Default settings', 'wordpress-seo' ) . '</h4>';
|
||||
echo $wpseo_admin_pages->textinput( 'og_default_image', __( 'Image URL', 'wordpress-seo' ) );
|
||||
echo '<p class="desc label">' . __( 'This image is used if the post/page being shared does not contain any images.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
do_action('wpseo_admin_opengraph_section');
|
||||
|
||||
echo '<h2>' . __( 'Twitter', 'wordpress-seo' ) . '</h2>';
|
||||
echo $wpseo_admin_pages->checkbox( 'twitter', '<label for="twitter">' . __( 'Add Twitter card meta data', 'wordpress-seo' ) . '</label>' );
|
||||
echo'<p class="desc">' . __( 'Add Twitter card meta data to your site\'s <code><head></code> section.', 'wordpress-seo' ) . '</p>';
|
||||
echo $wpseo_admin_pages->textinput( 'twitter_site', __( 'Site Twitter Username', 'wordpress-seo' ) );
|
||||
|
||||
do_action('wpseo_admin_twitter_section');
|
||||
|
||||
$wpseo_admin_pages->admin_footer();
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
global $wpseo_admin_pages;
|
||||
|
||||
$wpseo_admin_pages->admin_header( 'XML Sitemaps', true, 'yoast_wpseo_xml_sitemap_options', 'wpseo_xml' );
|
||||
|
||||
$options = get_option( 'wpseo_xml' );
|
||||
|
||||
$base = $GLOBALS[ 'wp_rewrite' ]->using_index_permalinks() ? 'index.php/' : '';
|
||||
|
||||
$content = $wpseo_admin_pages->checkbox( 'enablexmlsitemap', __( 'Check this box to enable XML sitemap functionality.', 'wordpress-seo' ), false );
|
||||
$content .= '<div id="sitemapinfo">';
|
||||
if ( isset($_SERVER['SERVER_SOFTWARE']) && stristr($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false ) {
|
||||
$content .= '<div style="margin: 5px 0; padding: 3px 10px; background-color: #ffffe0; border: 1px solid #E6DB55; border-radius: 3px">';
|
||||
$content .= '<p>'.__('As you\'re on NGINX, you\'ll need the following rewrites:','wordpress-seo').'</p>';
|
||||
$content .= '<pre>rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
|
||||
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;</pre>';
|
||||
$content .= '</div>';
|
||||
}
|
||||
|
||||
if ( isset( $options[ 'enablexmlsitemap' ] ) && $options[ 'enablexmlsitemap' ] )
|
||||
$content .= '<p>' . sprintf( __( 'You can find your XML Sitemap here: %sXML Sitemap%s', 'wordpress-seo' ), '<a target="_blank" class="button-secondary" href="' . home_url( $base . 'sitemap_index.xml' ) . '">', '</a>' ) . '<br/><br/>' . __( 'You do <strong>not</strong> need to generate the XML sitemap, nor will it take up time to generate after publishing a post.', 'wordpress-seo' ) . '</p>';
|
||||
else
|
||||
$content .= '<p>' . __( 'Save your settings to activate XML Sitemaps.', 'wordpress-seo' ) . '</p>';
|
||||
$content .= '<strong>' . __( 'General settings', 'wordpress-seo' ) . '</strong><br/>';
|
||||
$content .= '<p>' . __( 'After content publication, the plugin automatically pings Google and Bing, do you need it to ping other search engines too? If so, check the box:', 'wordpress-seo' ) . '</p>';
|
||||
$content .= $wpseo_admin_pages->checkbox( 'xml_ping_yahoo', __( "Ping Yahoo!", 'wordpress-seo' ), false );
|
||||
$content .= $wpseo_admin_pages->checkbox( 'xml_ping_ask', __( "Ping Ask.com", 'wordpress-seo' ), false );
|
||||
$content .= '<br/><strong>' . __( 'Exclude post types', 'wordpress-seo' ) . '</strong><br/>';
|
||||
$content .= '<p>' . __( 'Please check the appropriate box below if there\'s a post type that you do <strong>NOT</strong> want to include in your sitemap:', 'wordpress-seo' ) . '</p>';
|
||||
foreach ( get_post_types( array( 'public' => true ), 'objects' ) as $pt ) {
|
||||
$content .= $wpseo_admin_pages->checkbox( 'post_types-' . $pt->name . '-not_in_sitemap', $pt->labels->name . ' (<code>' . $pt->name . '</code>)' );
|
||||
}
|
||||
|
||||
$content .= '<br/>';
|
||||
$content .= '<strong>' . __( 'Exclude taxonomies', 'wordpress-seo' ) . '</strong><br/>';
|
||||
$content .= '<p>' . __( 'Please check the appropriate box below if there\'s a taxonomy that you do <strong>NOT</strong> want to include in your sitemap:', 'wordpress-seo' ) . '</p>';
|
||||
foreach ( get_taxonomies( array( 'public' => true ), 'objects' ) as $tax ) {
|
||||
if ( isset( $tax->labels->name ) && trim( $tax->labels->name ) != '' )
|
||||
$content .= $wpseo_admin_pages->checkbox( 'taxonomies-' . $tax->name . '-not_in_sitemap', $tax->labels->name . ' (<code>' . $tax->name . '</code>)' );
|
||||
}
|
||||
|
||||
$content .= '<br/>';
|
||||
$content .= '<strong>' . __( 'Entries per page', 'wordpress-seo' ) . '</strong><br/>';
|
||||
$content .= '<p>' . __( 'Please enter the maximum number of entries per sitemap page (defaults to 1000, you might want to lower this to prevent memory issues on some installs):', 'wordpress-seo' ) . '</p>';
|
||||
$content .= $wpseo_admin_pages->textinput( 'entries-per-page', __( 'Max entries per sitemap page', 'wordpress-seo' ) );
|
||||
|
||||
$content .= '<br class="clear"/>';
|
||||
$content .= '</div>';
|
||||
|
||||
$wpseo_admin_pages->postbox( 'xmlsitemaps', __( 'XML Sitemap', 'wordpress-seo' ), $content );
|
||||
|
||||
do_action( 'wpseo_xmlsitemaps_config' );
|
||||
|
||||
$wpseo_admin_pages->admin_footer();
|
||||
@@ -0,0 +1,27 @@
|
||||
.wpseo_score_img {
|
||||
float: right;
|
||||
margin: 6px 0 0 5px !important;
|
||||
width: 16px !important;
|
||||
height: 16px !important;
|
||||
background-image: url(../images/score_buttons.png) !important;
|
||||
background-repeat: no-repeat !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
.wpseo_score_img.good {
|
||||
background-position: -2px -2px !important;
|
||||
}
|
||||
.wpseo_score_img.ok {
|
||||
background-position: -25px -2px !important;
|
||||
}
|
||||
.wpseo_score_img.poor {
|
||||
background-position: -121px -2px !important;
|
||||
}
|
||||
.wpseo_score_img.bad {
|
||||
background-position: -49px -2px !important;
|
||||
}
|
||||
.wpseo_score_img.na {
|
||||
background-position: -74px -2px !important;
|
||||
}
|
||||
.wpseo_score_img.noindex {
|
||||
background-position: -146px -2px !important;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
.wpseo_score_img {
|
||||
display: inline-block;
|
||||
margin: 3px 0 0 0;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-image: url(../images/score_buttons.png);
|
||||
background-repeat: no-repeat;
|
||||
padding: 0 0 0 0;
|
||||
}
|
||||
.wpseo_score_img.good {
|
||||
background-position: -2px -2px;
|
||||
}
|
||||
.wpseo_score_img.ok {
|
||||
background-position: -25px -2px;
|
||||
}
|
||||
.wpseo_score_img.poor {
|
||||
background-position: -121px -2px;
|
||||
}
|
||||
.wpseo_score_img.bad {
|
||||
background-position: -49px -2px;
|
||||
}
|
||||
.wpseo_score_img.na {
|
||||
background-position: -74px -2px;
|
||||
}
|
||||
.wpseo_score_img.noindex {
|
||||
background-position: -146px -2px;
|
||||
}
|
||||
th#wpseo-score {
|
||||
width: 60px;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
(function($){$.extend({tablesorter:new
|
||||
function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,rows,-1,i);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,rows,rowIndex,cellIndex){var l=parsers.length,node=false,nodeValue=false,keepLooking=true;while(nodeValue==''&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node);if(table.config.debug){log('Checking if value was empty on row:'+rowIndex);}}else{keepLooking=false;}}for(var i=1;i<l;i++){if(parsers[i].is(nodeValue,table,node)){return parsers[i];}}return parsers[0];}function getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){return rows[rowIndex].cells[cellIndex];}function trimAndGetNodeText(config,node){return $.trim(getElementText(config,node));}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=$(table.tBodies[0].rows[i]),cols=[];if(c.hasClass(table.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue;}cache.row.push(c);for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j]),table,c[0].cells[j]));}cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){var text="";if(!node)return"";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(config.textExtraction=="simple"){if(config.supportsTextContent){text=node.textContent;}else{if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){text=node.childNodes[0].innerHTML;}else{text=node.innerHTML;}}}else{if(typeof(config.textExtraction)=="function"){text=config.textExtraction(node);}else{text=$(node).text();}}return text;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){var pos=n[i][checkCell];rows.push(r[pos]);if(!table.config.appender){var l=r[pos].length;for(var j=0;j<l;j++){tableBody[0].appendChild(r[pos][j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false;var header_index=computeTableHeaderCellIndexes(table);$tableHeaders=$(table.config.selectorHeaders,table).each(function(index){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(table.config.sortInitialOrder);this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(checkHeaderOptionsSortingLocked(table,index))this.order=this.lockedOrder=checkHeaderOptionsSortingLocked(table,index);if(!this.sortDisabled){var $th=$(this).addClass(table.config.cssHeader);if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function computeTableHLine truncated
|
||||
var firstAvailCol;if(typeof(matrix[rowIndex])=="undefined"){matrix[rowIndex]=[];}for(var k=0;k<matrix[rowIndex].length+1;k++){if(typeof(matrix[rowIndex][k])=="undefined"){firstAvailCol=k;break;}}lookup[cellId]=firstAvailCol;for(var k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(matrix[k])=="undefined"){matrix[k]=[];}var matrixrow=matrix[k];for(var l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x";}}}}return lookup;}function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){return(v.toLowerCase()=="desc")?1:0;}else{return(v==1)?1:0;}}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(table.config.parsers[c].type=="text")?((order==0)?makeSortFunction("text","asc",c):makeSortFunction("text","desc",c)):((order==0)?makeSortFunction("numeric","asc",c):makeSortFunction("numeric","desc",c));var e="e"+i;dynamicExp+="var "+e+" = "+s;dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";if(table.config.debug){benchmark("Evaling expression:"+dynamicExp,new Date());}eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function makeSortFunction(type,direction,index){var a="a["+index+"]",b="b["+index+"]";if(type=='text'&&direction=='asc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+a+" < "+b+") ? -1 : 1 )));";}else if(type=='text'&&direction=='desc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+b+" < "+a+") ? -1 : 1 )));";}else if(type=='numeric'&&direction=='asc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+a+" - "+b+"));";}else if(type=='numeric'&&direction=='desc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+b+" - "+a+"));";}};function makeSortText(i){return"((a["+i+"] < b["+i+"]) ? -1 : ((a["+i+"] > b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$heaLine truncated
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Metabox Tabs
|
||||
*/
|
||||
|
||||
ul.wpseo-metabox-tabs li.active {
|
||||
background-color: #EFF8FF;
|
||||
}
|
||||
|
||||
ul.wpseo-metabox-tabs li.active, div.wpseo-tab-content {
|
||||
border-color: #D1E5EE;
|
||||
}
|
||||
|
||||
.wpseo-metabox-tabs .active a {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.ui-widget-content .ui-state-hover {
|
||||
border: 1px solid #D1E5EE;
|
||||
background: #EFF8FF;
|
||||
color: #333;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Metabox Tabs
|
||||
*/
|
||||
|
||||
ul.wpseo-metabox-tabs li.active {
|
||||
background-color: #F1F1F1;
|
||||
}
|
||||
|
||||
ul.wpseo-metabox-tabs li.active, div.wpseo-tab-content {
|
||||
border-color: #DFDFDF;
|
||||
background-color: #FFF;
|
||||
}
|
||||
|
||||
.wpseo-metabox-tabs .active a {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.ui-widget-content .ui-state-hover {
|
||||
border: 1px solid #DFDFDF;
|
||||
background: #F1F1F1;
|
||||
color: #333;
|
||||
}
|
||||
@@ -0,0 +1,308 @@
|
||||
/**
|
||||
* Metabox Tabs
|
||||
*/
|
||||
|
||||
ul.wpseo-metabox-tabs {
|
||||
display: none;
|
||||
margin-top: 12px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.wpseo-metabox-tabs-div ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.wpseo-metabox-tabs li {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
ul.wpseo-metabox-tabs li.active {
|
||||
border-style: solid solid none;
|
||||
border-width: 1px 1px 0;
|
||||
}
|
||||
|
||||
ul.wpseo-metabox-tabs li {
|
||||
padding: 5px;
|
||||
-moz-border-radius: 3px 3px 0 0;
|
||||
-webkit-border-top-left-radius: 3px;
|
||||
-webkit-border-top-right-radius: 3px;
|
||||
-khtml-border-top-left-radius: 3px;
|
||||
-khtml-border-top-right-radius: 3px;
|
||||
border-top-left-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
}
|
||||
|
||||
.wpseo-metabox-tabs a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.wpseo-metabox-tabs-div div.wpseo-tabs-panel {
|
||||
overflow: auto;
|
||||
padding: 0.5em 0.9em;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
.wpseo-heading {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.wpseotab {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.wpseotab.active {
|
||||
display: block;
|
||||
overflow: auto;
|
||||
padding: 0.5em 0.9em;
|
||||
border: 1px solid #ddd;
|
||||
background-color: #fff;
|
||||
border-radius: 0 3px 3px 3px;
|
||||
}
|
||||
|
||||
#wpseo_meta .postbox .inside .wpseotab {
|
||||
font-size: 13px !important;
|
||||
}
|
||||
|
||||
.inside .wpseotab .form-table th {
|
||||
font-size: 13px;
|
||||
width: 140px !important;
|
||||
}
|
||||
|
||||
.good, .warn, .wrong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.good {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.warn {
|
||||
color: maroon;
|
||||
}
|
||||
|
||||
.wrong {
|
||||
color: red;
|
||||
}
|
||||
|
||||
#current_seo_title span {
|
||||
background-color: lightyellow;
|
||||
padding: 2px 5px;
|
||||
}
|
||||
|
||||
#wpseosnippet {
|
||||
margin: 0 0 10px 0;
|
||||
padding: 0 5px;
|
||||
font-family: arial, sans-serif;
|
||||
line-height: 15px !important;
|
||||
font-size: 13px !important;
|
||||
font-style: normal;
|
||||
width: auto;
|
||||
max-width: 520px;
|
||||
}
|
||||
|
||||
#wpseosnippet td {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#wpseosnippet cite.url {
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
#wpseosnippet a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#wpseosnippet .title {
|
||||
color: #11c;
|
||||
font-size: 16px !important;
|
||||
line-height: 19px;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#wpseosnippet .desc {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#wpseosnippet .url {
|
||||
color: #093;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
#wpseosnippet .meta {
|
||||
color: #767676;
|
||||
}
|
||||
|
||||
#wpseosnippet .util {
|
||||
color: #4272DB;
|
||||
}
|
||||
|
||||
#wpseosnippet p {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
#wpseosnippet a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#wpseosnippet {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.wpseo_yahoo_kw {
|
||||
display: block;
|
||||
float: left;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
background-color: #ddd;
|
||||
margin: 3px 8px 3px 0;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.wpseo_hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Linkdex analysis block */
|
||||
|
||||
table.wpseoanalysis th {
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
padding: 15px 0 5px 0;
|
||||
}
|
||||
|
||||
table.wpseoanalysis th.first {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
table.wpseoanalysis td {
|
||||
font-size: 13px;
|
||||
line-height: 16px;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
table.wpseoanalysis td.score {
|
||||
width: 20px;
|
||||
height: 18px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.wpseo_msg {
|
||||
border: 1px solid #E6DB55;
|
||||
background-color: lightYellow;
|
||||
margin: 5px 0 10px 0;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
/*
|
||||
* jQuery UI CSS Framework 1.8.12
|
||||
*
|
||||
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://docs.jquery.com/UI/Theming/API
|
||||
*/
|
||||
|
||||
/* Component containers
|
||||
----------------------------------*/
|
||||
.ui-widget-content {
|
||||
border: 1px solid #dddddd;
|
||||
background: #f1f1f1;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.ui-widget-content a {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/*
|
||||
* jQuery UI Autocomplete 1.8.12
|
||||
* http://docs.jquery.com/UI/Autocomplete#theming
|
||||
*/
|
||||
.ui-autocomplete {
|
||||
position: absolute;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* workarounds */
|
||||
* html .ui-autocomplete {
|
||||
width: 1px;
|
||||
}
|
||||
|
||||
/* without this, the menu expands to 100% in IE6 */
|
||||
|
||||
/*
|
||||
* jQuery UI Menu 1.8.12
|
||||
*
|
||||
* http://docs.jquery.com/UI/Menu#theming
|
||||
*/
|
||||
.ui-menu {
|
||||
list-style: none;
|
||||
padding: 2px;
|
||||
margin: 0;
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.ui-menu .ui-menu {
|
||||
margin-top: -3px;
|
||||
}
|
||||
|
||||
.ui-menu .ui-menu-item {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
zoom: 1;
|
||||
float: left;
|
||||
clear: left;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ui-menu .ui-menu-item a {
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
padding: .2em .4em;
|
||||
line-height: 1.5;
|
||||
zoom: 1;
|
||||
}
|
||||
|
||||
.ui-menu .ui-menu-item a.ui-state-hover,
|
||||
.ui-menu .ui-menu-item a.ui-state-active {
|
||||
color: #000;
|
||||
margin: -1px;
|
||||
}
|
||||
|
||||
.wpseo_score_img {
|
||||
display: inline-block;
|
||||
margin: 3px 0 0 0;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-image: url(../images/score_buttons.png);
|
||||
background-repeat: no-repeat;
|
||||
padding: 0 0 0 0;
|
||||
}
|
||||
.wpseo_score_img.good {
|
||||
background-position: -2px -2px;
|
||||
}
|
||||
.wpseo_score_img.ok {
|
||||
background-position: -25px -2px;
|
||||
}
|
||||
.wpseo_score_img.poor {
|
||||
background-position: -121px -2px;
|
||||
}
|
||||
.wpseo_score_img.bad {
|
||||
background-position: -49px -2px;
|
||||
}
|
||||
.wpseo_score_img.na {
|
||||
background-position: -74px -2px;
|
||||
}
|
||||
.wpseo_score_img.noindex {
|
||||
background-position: -146px -2px;
|
||||
}
|
||||
|
||||
img.yoast_help {
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
/**
|
||||
* @package XML_Sitemaps
|
||||
*/
|
||||
header("Content-Type: text/xml");
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>';
|
||||
?><xsl:stylesheet version="2.0"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
|
||||
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>XML Sitemap</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #545353;
|
||||
}
|
||||
table {
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
#sitemap tr.odd td {
|
||||
background-color: #eee !important;
|
||||
}
|
||||
#sitemap tbody tr:hover td {
|
||||
background-color: #ccc;
|
||||
}
|
||||
#sitemap tbody tr:hover td, #sitemap tbody tr:hover td a {
|
||||
color: #000;
|
||||
}
|
||||
#content {
|
||||
margin: 0 auto;
|
||||
width: 1000px;
|
||||
}
|
||||
.expl {
|
||||
margin: 18px 3px;
|
||||
line-height: 1.2em;
|
||||
}
|
||||
.expl a {
|
||||
color: #da3114;
|
||||
font-weight: bold;
|
||||
}
|
||||
.expl a:visited {
|
||||
color: #da3114;
|
||||
}
|
||||
a {
|
||||
color: #000;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:visited {
|
||||
color: #777;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
td {
|
||||
font-size:11px;
|
||||
}
|
||||
th {
|
||||
text-align:left;
|
||||
padding-right:30px;
|
||||
font-size:11px;
|
||||
}
|
||||
thead th {
|
||||
border-bottom: 1px solid #000;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<h1>XML Sitemap</h1>
|
||||
<p class="expl">
|
||||
Generated by <a href="http://yoast.com/">Yoast</a>'s <a href="http://yoast.com/wordpress/seo/">WordPress SEO plugin</a>, this is an XML Sitemap, meant for consumption by search engines.<br/>
|
||||
You can find more information about XML sitemaps on <a href="http://sitemaps.org">sitemaps.org</a>.
|
||||
</p>
|
||||
<xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) > 0">
|
||||
<p class="expl">
|
||||
This XML Sitemap Index file contains <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"/> sitemaps.
|
||||
</p>
|
||||
<table id="sitemap" cellpadding="3">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="75%">Sitemap</th>
|
||||
<th width="25%">Last Modified</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
|
||||
<xsl:variable name="sitemapURL">
|
||||
<xsl:value-of select="sitemap:loc"/>
|
||||
</xsl:variable>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{$sitemapURL}"><xsl:value-of select="sitemap:loc"/></a>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</tbody>
|
||||
</table>
|
||||
</xsl:if>
|
||||
<xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) < 1">
|
||||
<p class="expl">
|
||||
This XML Sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> URLs.
|
||||
</p>
|
||||
<table id="sitemap" cellpadding="3">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="75%">URL</th>
|
||||
<th title="Index Priority" width="5%">Prio</th>
|
||||
<th width="5%">Images</th>
|
||||
<th title="Change Frequency" width="5%">Ch. Freq.</th>
|
||||
<th title="Last Modification Time" width="10%">Last Mod.</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
|
||||
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
||||
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
||||
<tr>
|
||||
<td>
|
||||
<xsl:variable name="itemURL">
|
||||
<xsl:value-of select="sitemap:loc"/>
|
||||
</xsl:variable>
|
||||
<a href="{$itemURL}">
|
||||
<xsl:value-of select="sitemap:loc"/>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="concat(sitemap:priority*100,'%')"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="count(image:image)"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</tbody>
|
||||
</table>
|
||||
</xsl:if>
|
||||
</div>
|
||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo '//'.$_SERVER['HTTP_HOST'].str_replace('xml-sitemap-xsl.php','',$_SERVER['REQUEST_URI']); ?>jquery.tablesorter.min.js"></script>
|
||||
<script type="text/javascript"><![CDATA[
|
||||
$(document).ready(function() {
|
||||
$("#sitemap").tablesorter( { widgets: ['zebra'] } );
|
||||
});
|
||||
]]></script>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,161 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
|
||||
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>XML Sitemap</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #545353;
|
||||
}
|
||||
table {
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
#sitemap tr.odd {
|
||||
background-color: #eee;
|
||||
}
|
||||
#sitemap tbody tr:hover {
|
||||
background-color: #ccc;
|
||||
}
|
||||
#sitemap tbody tr:hover td, #sitemap tbody tr:hover td a {
|
||||
color: #000;
|
||||
}
|
||||
#content {
|
||||
margin: 0 auto;
|
||||
width: 1000px;
|
||||
}
|
||||
.expl {
|
||||
margin: 18px 3px;
|
||||
line-height: 140%;
|
||||
}
|
||||
.expl a {
|
||||
color: #da3114;
|
||||
font-weight: bold;
|
||||
}
|
||||
.expl a:visited {
|
||||
color: #da3114;
|
||||
}
|
||||
a {
|
||||
color: #000;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:visited {
|
||||
color: #777;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
td {
|
||||
font-size:11px;
|
||||
}
|
||||
th {
|
||||
text-align:left;
|
||||
padding-right:30px;
|
||||
font-size:11px;
|
||||
}
|
||||
thead th {
|
||||
border-bottom: 1px solid #000;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<h1>XML Sitemap</h1>
|
||||
<p class="expl">
|
||||
Generated by <a href="http://yoast.com/">Yoast</a>'s <a href="http://yoast.com/wordpress/seo/">WordPress SEO plugin</a>, this is an XML Sitemap, meant for consumption by search engines.<br/>
|
||||
You can find more information about XML sitemaps on <a href="http://sitemaps.org">sitemaps.org</a>.
|
||||
</p>
|
||||
<xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) > 0">
|
||||
<p class="expl">
|
||||
This XML Sitemap Index file contains <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"/> sitemaps.
|
||||
</p>
|
||||
<table id="sitemap" cellpadding="3">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="75%">Sitemap</th>
|
||||
<th width="25%">Last Modified</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
|
||||
<xsl:variable name="sitemapURL">
|
||||
<xsl:value-of select="sitemap:loc"/>
|
||||
</xsl:variable>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{$sitemapURL}"><xsl:value-of select="sitemap:loc"/></a>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</tbody>
|
||||
</table>
|
||||
</xsl:if>
|
||||
<xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) < 1">
|
||||
<p class="expl">
|
||||
This XML Sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> URLs.
|
||||
</p>
|
||||
<table id="sitemap" cellpadding="3">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="75%">URL</th>
|
||||
<th title="Index Priority" width="5%">Prio</th>
|
||||
<th width="5%">Images</th>
|
||||
<th title="Change Frequency" width="5%">Ch. Freq.</th>
|
||||
<th title="Last Modification Time" width="10%">Last Mod.</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
|
||||
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
||||
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
||||
<tr>
|
||||
<td>
|
||||
<xsl:variable name="itemURL">
|
||||
<xsl:value-of select="sitemap:loc"/>
|
||||
</xsl:variable>
|
||||
<a href="{$itemURL}">
|
||||
<xsl:value-of select="sitemap:loc"/>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="concat(sitemap:priority*100,'%')"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="count(image:image)"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</tbody>
|
||||
</table>
|
||||
</xsl:if>
|
||||
</div>
|
||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="http://cdn.yoast.com/js/jquery.tablesorter.min.js"></script>
|
||||
<script type="text/javascript"><![CDATA[
|
||||
$(document).ready(function() {
|
||||
$("#sitemap").tablesorter( { widgets: ['zebra'] } );
|
||||
});
|
||||
]]></script>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,162 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>XML Video Sitemap</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #545353;
|
||||
}
|
||||
a img {
|
||||
border: none;
|
||||
}
|
||||
table {
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
#sitemap tr.odd {
|
||||
background-color: #eee;
|
||||
}
|
||||
#sitemap tbody tr:hover {
|
||||
background-color: #ccc;
|
||||
}
|
||||
#sitemap tbody tr:hover td, #sitemap tbody tr:hover td a {
|
||||
color: #000;
|
||||
}
|
||||
#content {
|
||||
margin: 0 auto;
|
||||
width: 1000px;
|
||||
}
|
||||
p.expl {
|
||||
margin: 10px 3px;
|
||||
line-height: 1.3em;
|
||||
}
|
||||
p.expl a {
|
||||
color: #da3114;
|
||||
font-weight: bold;
|
||||
}
|
||||
a {
|
||||
color: #000;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:visited {
|
||||
color: #777;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
td {
|
||||
font-size:11px;
|
||||
padding: 5px 15px 5px 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
td img {
|
||||
padding: 0 5px;
|
||||
}
|
||||
th {
|
||||
text-align:left;
|
||||
padding-right:30px;
|
||||
font-size:11px;
|
||||
}
|
||||
thead th {
|
||||
border-bottom: 1px solid #000;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<h1>XML Video Sitemap</h1>
|
||||
<p class="expl">
|
||||
Generated by <a href="http://yoast.com/">Yoast</a>'s <a href="http://yoast.com/wordpress/seo/">WordPress SEO plugin</a>, this is an XML Video Sitemap, meant for consumption by Search Engines.
|
||||
</p>
|
||||
<p class="expl">
|
||||
You can find more information about XML Video sitemaps <a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=80472">here</a>.
|
||||
</p>
|
||||
<p class="expl">
|
||||
This sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> URLs.
|
||||
</p>
|
||||
<div>
|
||||
<table id="sitemap">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="10%">Video</th>
|
||||
<th width="25%">Post / Page</th>
|
||||
<th width="30%">Description</th>
|
||||
<th width="20%">Tags</th>
|
||||
<th width="15%">Pub Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
||||
<tr>
|
||||
<xsl:if test="position() mod 2 = 1">
|
||||
<xsl:attribute name="class">odd</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<td>
|
||||
<xsl:variable name="thumbURL">
|
||||
<xsl:value-of select="video:video/video:thumbnail_loc"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="flvURL">
|
||||
<xsl:value-of select="video:video/video:player_loc"/>
|
||||
</xsl:variable>
|
||||
|
||||
<a href="{$flvURL}"><img src="{$thumbURL}" width="80" height="60" /></a>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<xsl:variable name="itemURL">
|
||||
<xsl:value-of select="sitemap:loc"/>
|
||||
</xsl:variable>
|
||||
<a href="{$itemURL}">
|
||||
<strong><xsl:value-of select="video:video/video:title"/></strong>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<xsl:variable name="desc">
|
||||
<xsl:value-of select="video:video/video:description"/>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length($desc) < 200">
|
||||
<xsl:value-of select="$desc"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat(substring($desc,1,200),' ...')"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<xsl:for-each select="video:video/video:tag">
|
||||
<xsl:value-of select="."/>,
|
||||
</xsl:for-each>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<xsl:value-of select="concat(substring(video:video/video:publication_date,0,11),concat(' ', substring(video:video/video:publication_date,12,5)))"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,204 @@
|
||||
h4 {
|
||||
clear: both;
|
||||
margin: 2em 0 0 0;
|
||||
}
|
||||
|
||||
p.desc {
|
||||
padding: 0 0 8px 22px;
|
||||
margin: 6px 0 10px 0;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
p.desc.label {
|
||||
padding: 2px 0 10px 180px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
tr.yst_row {
|
||||
padding: 5px 0 0 0;
|
||||
margin: 5px 0 0 0;
|
||||
}
|
||||
tr.yst_row.even {
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
div.yoastbox ul {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.postbox {
|
||||
margin: 10px 10px 0 0;
|
||||
}
|
||||
|
||||
label {
|
||||
float: left;
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
input.textinput, textarea, select {
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
input.textinput, textarea.textinput, select.select, input.checkbox {
|
||||
float: left;
|
||||
margin: 12px 3px 0 0;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
input.checkbox.double {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.textinput.metadesc {
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
textarea.import {
|
||||
width: 500px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
label.textinput, label.select, label.checkbox {
|
||||
width: 180px;
|
||||
background-color: transparent;
|
||||
margin: 10px 0 5px 0;
|
||||
}
|
||||
|
||||
label.radio {
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.postbox form {
|
||||
line-height: 150%;
|
||||
}
|
||||
|
||||
div.yoastbox ul li {
|
||||
list-style: square;
|
||||
line-height:16px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
div.yoastbox a, div.yoastbox a.rsswidget {
|
||||
font-family: sans-serif;
|
||||
font-size: 12px;
|
||||
}
|
||||
div.yoastbox a:hover, div.yoastbox a.rsswidget:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
div.yoastbox ul li.rss {
|
||||
list-style-image: url(../images/rss.png);
|
||||
}
|
||||
|
||||
div.yoastbox ul li.twitter {
|
||||
list-style-image: url(../images/twitter-icon.png);
|
||||
}
|
||||
|
||||
div.yoastbox ul li.facebook {
|
||||
list-style-image: url(../images/facebook-icon.png);
|
||||
}
|
||||
|
||||
div.yoastbox ul li.googleplus {
|
||||
list-style-image: url(../images/google-plus-icon.png);
|
||||
}
|
||||
|
||||
div.yoastbox ul li.email {
|
||||
list-style-image: url(../images/email_sub.png);
|
||||
}
|
||||
|
||||
div.yoastbox ul li.yoast {
|
||||
list-style-image: url(../images/yoast-16x16.png);
|
||||
}
|
||||
|
||||
.text {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
div.yoastbox .button:hover, div.yoastbox .button-primary:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/*.button, .button-primary {*/
|
||||
/*margin-top: 10px;*/
|
||||
/*}*/
|
||||
|
||||
table.yoast_help, table.yoast_help th, table.yoast_help td {
|
||||
border: 1px solid #ddd;
|
||||
border-collapse: collapse;
|
||||
font-size: 12px;
|
||||
}
|
||||
table.yoast_help th, table.yoast_help td {
|
||||
vertical-align: text-top;
|
||||
text-align: left;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
table.yoast_help tr:hover {
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
.correct {
|
||||
background-color: green;
|
||||
color: white;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.wrong {
|
||||
background-color: red;
|
||||
color: white;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.wrong code {
|
||||
padding: 3px 8px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.button.fixit {
|
||||
padding: 5px 8px;
|
||||
margin: 0 5px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.button {
|
||||
color: #000 !important;
|
||||
}
|
||||
|
||||
.postbox#donate {
|
||||
border-color: green;
|
||||
border-width: 2px;
|
||||
}
|
||||
|
||||
.wpseotab {
|
||||
display: none;
|
||||
max-width: 600px !important;
|
||||
}
|
||||
.wpseotab.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#sidebar .yoastbox {
|
||||
border: 1px solid #CCC;
|
||||
border-radius: 5px 25px;
|
||||
margin: 0 0 10px 0;
|
||||
padding: 10px 15px;
|
||||
}
|
||||
|
||||
#sidebar .yoastbox h2 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
#sidebar .promo {
|
||||
color: #000;
|
||||
}
|
||||
#donate.yoastbox, #sitereview.yoastbox {
|
||||
border-color: green;
|
||||
background-color: #cfc;
|
||||
}
|
||||
h2 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
h2 code {
|
||||
font-size: 23px;
|
||||
}
|
||||
|
||||
#wpseo-conf {
|
||||
max-width: 600px;
|
||||
}
|
||||
@@ -0,0 +1,308 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Frontend
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class handles the Breadcrumbs generation and display
|
||||
*/
|
||||
class WPSEO_Breadcrumbs {
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*/
|
||||
function __construct() {
|
||||
// If breadcrumbs are active (which they are otherwise this class wouldn't be instantiated), there's no reason
|
||||
// to have bbPress breadcrumbs as well.
|
||||
add_filter( 'bbp_get_breadcrumb', '__return_false' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper function for the breadcrumb so it can be output for the supported themes.
|
||||
*/
|
||||
function breadcrumb_output() {
|
||||
$this->breadcrumb( '<div id="wpseobreadcrumb">', '</div>' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a term's parents.
|
||||
*
|
||||
* @param object $term Term to get the parents for
|
||||
* @return array
|
||||
*/
|
||||
function get_term_parents( $term ) {
|
||||
$tax = $term->taxonomy;
|
||||
$parents = array();
|
||||
while ( $term->parent != 0 ) {
|
||||
$term = get_term( $term->parent, $tax );
|
||||
$parents[] = $term;
|
||||
}
|
||||
return array_reverse( $parents );
|
||||
}
|
||||
|
||||
/**
|
||||
* Display or return the full breadcrumb path.
|
||||
*
|
||||
* @param string $before The prefix for the breadcrumb, usually something like "You're here".
|
||||
* @param string $after The suffix for the breadcrumb.
|
||||
* @param bool $display When true, echo the breadcrumb, if not, return it as a string.
|
||||
* @return string
|
||||
*/
|
||||
function breadcrumb( $before = '', $after = '', $display = true ) {
|
||||
$options = get_wpseo_options();
|
||||
|
||||
global $wp_query, $post;
|
||||
|
||||
$on_front = get_option( 'show_on_front' );
|
||||
$blog_page = get_option( 'page_for_posts' );
|
||||
|
||||
$links = array(
|
||||
array(
|
||||
'url' => get_home_url(),
|
||||
'text' => ( isset( $options['breadcrumbs-home'] ) && $options['breadcrumbs-home'] != '' ) ? $options['breadcrumbs-home'] : __( 'Home', 'wordpress-seo' )
|
||||
)
|
||||
);
|
||||
|
||||
if ( "page" == $on_front && 'post' == get_post_type() && !is_home() ) {
|
||||
if ( $blog_page && ( !isset( $options['breadcrumbs-blog-remove'] ) || !$options['breadcrumbs-blog-remove'] ) )
|
||||
$links[] = array( 'id' => $blog_page );
|
||||
}
|
||||
|
||||
if ( ( $on_front == "page" && is_front_page() ) || ( $on_front == "posts" && is_home() ) ) {
|
||||
|
||||
} else if ( $on_front == "page" && is_home() ) {
|
||||
$links[] = array( 'id' => $blog_page );
|
||||
} else if ( is_singular() ) {
|
||||
if ( get_post_type_archive_link( $post->post_type ) ) {
|
||||
$links[] = array( 'ptarchive' => $post->post_type );
|
||||
}
|
||||
|
||||
if ( 0 == $post->post_parent ) {
|
||||
if ( isset( $options['post_types-' . $post->post_type . '-maintax'] ) && $options['post_types-' . $post->post_type . '-maintax'] != '0' ) {
|
||||
$main_tax = $options['post_types-' . $post->post_type . '-maintax'];
|
||||
$terms = wp_get_object_terms( $post->ID, $main_tax );
|
||||
|
||||
if ( count( $terms ) > 0 ) {
|
||||
// Let's find the deepest term in this array, by looping through and then unsetting every term that is used as a parent by another one in the array.
|
||||
$terms_by_id = array();
|
||||
foreach ( $terms as $term ) {
|
||||
$terms_by_id[$term->term_id] = $term;
|
||||
}
|
||||
foreach ( $terms as $term ) {
|
||||
unset( $terms_by_id[$term->parent] );
|
||||
}
|
||||
|
||||
// As we could still have two subcategories, from different parent categories, let's pick the first.
|
||||
reset( $terms_by_id );
|
||||
$deepest_term = current( $terms_by_id );
|
||||
|
||||
if ( is_taxonomy_hierarchical( $main_tax ) && $deepest_term->parent != 0 ) {
|
||||
foreach ( $this->get_term_parents( $deepest_term ) as $parent_term ) {
|
||||
$links[] = array( 'term' => $parent_term );
|
||||
}
|
||||
}
|
||||
$links[] = array( 'term' => $deepest_term );
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
if ( isset( $post->ancestors ) ) {
|
||||
if ( is_array( $post->ancestors ) )
|
||||
$ancestors = array_values( $post->ancestors );
|
||||
else
|
||||
$ancestors = array( $post->ancestors );
|
||||
} else {
|
||||
$ancestors = array( $post->post_parent );
|
||||
}
|
||||
|
||||
// Reverse the order so it's oldest to newest
|
||||
$ancestors = array_reverse( apply_filters( 'wp_seo_get_bc_ancestors', $ancestors ) );
|
||||
|
||||
foreach ( $ancestors as $ancestor ) {
|
||||
$links[] = array( 'id' => $ancestor );
|
||||
}
|
||||
}
|
||||
$links[] = array( 'id' => $post->ID );
|
||||
} else {
|
||||
if ( is_post_type_archive() ) {
|
||||
$links[] = array( 'ptarchive' => get_post_type() );
|
||||
} else if ( is_tax() || is_tag() || is_category() ) {
|
||||
$term = $wp_query->get_queried_object();
|
||||
|
||||
if ( isset( $options['taxonomy-' . $term->taxonomy . '-ptparent'] ) && $options['taxonomy-' . $term->taxonomy . '-ptparent'] != '' ) {
|
||||
if ( 'post' == $options['taxonomy-' . $term->taxonomy . '-ptparent'] && get_option( 'show_on_front' ) == 'page' ) {
|
||||
if ( get_option( 'page_for_posts' ) ) {
|
||||
$links[] = array( 'id' => get_option( 'page_for_posts' ) );
|
||||
}
|
||||
} else {
|
||||
$links[] = array( 'ptarchive' => $options['taxonomy-' . $term->taxonomy . '-ptparent'] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_taxonomy_hierarchical( $term->taxonomy ) && $term->parent != 0 ) {
|
||||
foreach ( $this->get_term_parents( $term ) as $parent_term ) {
|
||||
$links[] = array( 'term' => $parent_term );
|
||||
}
|
||||
}
|
||||
|
||||
$links[] = array( 'term' => $term );
|
||||
} else if ( is_date() ) {
|
||||
if ( isset( $options['breadcrumbs-archiveprefix'] ) )
|
||||
$bc = esc_html( $options['breadcrumbs-archiveprefix'] );
|
||||
else
|
||||
$bc = __( 'Archives for', 'wordpress-seo' );
|
||||
if ( is_day() ) {
|
||||
global $wp_locale;
|
||||
$links[] = array(
|
||||
'url' => get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) ),
|
||||
'text' => $wp_locale->get_month( get_query_var( 'monthnum' ) ) . ' ' . get_query_var( 'year' )
|
||||
);
|
||||
$links[] = array( 'text' => $bc . " " . get_the_date() );
|
||||
} else if ( is_month() ) {
|
||||
$links[] = array( 'text' => $bc . " " . single_month_title( ' ', false ) );
|
||||
} else if ( is_year() ) {
|
||||
$links[] = array( 'text' => $bc . " " . get_query_var( 'year' ) );
|
||||
}
|
||||
} elseif ( is_author() ) {
|
||||
if ( isset( $options['breadcrumbs-archiveprefix'] ) )
|
||||
$bc = esc_html( $options['breadcrumbs-archiveprefix'] );
|
||||
else
|
||||
$bc = __( 'Archives for', 'wordpress-seo' );
|
||||
$user = $wp_query->get_queried_object();
|
||||
$links[] = array( 'text' => $bc . " " . esc_html( $user->display_name ) );
|
||||
} elseif ( is_search() ) {
|
||||
if ( isset( $options['breadcrumbs-searchprefix'] ) && $options['breadcrumbs-searchprefix'] != '' )
|
||||
$bc = esc_html( $options['breadcrumbs-searchprefix'] );
|
||||
else
|
||||
$bc = __( 'You searched for', 'wordpress-seo' );
|
||||
$links[] = array( 'text' => $bc . ' "' . esc_html( get_search_query() ) . '"' );
|
||||
} elseif ( is_404() ) {
|
||||
if ( isset( $options['breadcrumbs-404crumb'] ) && $options['breadcrumbs-404crumb'] != '' )
|
||||
$crumb404 = $options['breadcrumbs-404crumb'];
|
||||
else
|
||||
$crumb404 = __( 'Error 404: Page not found', 'wordpress-seo' );
|
||||
$links[] = array( 'text' => $crumb404 );
|
||||
}
|
||||
}
|
||||
|
||||
$links = apply_filters( 'wpseo_breadcrumb_links', $links );
|
||||
|
||||
$output = $this->create_breadcrumbs_string( $links );
|
||||
|
||||
if ( isset( $options['breadcrumbs-prefix'] ) && $options['breadcrumbs-prefix'] != "" )
|
||||
$output = $options['breadcrumbs-prefix'] . " " . $output;
|
||||
|
||||
if ( $display ) {
|
||||
echo $before . $output . $after;
|
||||
return true;
|
||||
} else {
|
||||
return $before . $output . $after;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Take the links array and return a full breadcrumb string.
|
||||
*
|
||||
* Each element of the links array can either have one of these keys:
|
||||
* "id" for post types;
|
||||
* "ptarchive" for a post type archive;
|
||||
* "term" for a taxonomy term.
|
||||
* If either of these 3 are set, the url and text are retrieved. If not, url and text have to be set.
|
||||
*
|
||||
* @link http://support.google.com/webmasters/bin/answer.py?hl=en&answer=185417 Google documentation on RDFA
|
||||
*
|
||||
* @param array $links The links that should be contained in the breadcrumb.
|
||||
* @param string $wrapper The wrapping element for the entire breadcrumb path.
|
||||
* @param string $element The wrapping element for each individual link.
|
||||
* @return string
|
||||
*/
|
||||
function create_breadcrumbs_string( $links, $wrapper = 'span', $element = 'span' ) {
|
||||
global $paged;
|
||||
|
||||
$opt = get_wpseo_options();
|
||||
$sep = ( isset( $opt['breadcrumbs-sep'] ) && $opt['breadcrumbs-sep'] != '' ) ? $opt['breadcrumbs-sep'] : '»';
|
||||
$output = '';
|
||||
|
||||
foreach ( $links as $i => $link ) {
|
||||
if ( !empty( $output ) )
|
||||
$output .= " $sep ";
|
||||
|
||||
if ( isset( $link['id'] ) ) {
|
||||
$link['url'] = get_permalink( $link['id'] );
|
||||
$link['text'] = wpseo_get_value( 'bctitle', $link['id'] );
|
||||
if ( empty( $link['text'] ) )
|
||||
$link['text'] = strip_tags( get_the_title( $link['id'] ) );
|
||||
$link['text'] = apply_filters( 'wp_seo_get_bc_title', $link['text'], $link['id'] );
|
||||
}
|
||||
|
||||
if ( isset( $link['term'] ) ) {
|
||||
$bctitle = wpseo_get_term_meta( $link['term'], $link['term']->taxonomy, 'bctitle' );
|
||||
if ( !$bctitle )
|
||||
$bctitle = $link['term']->name;
|
||||
$link['url'] = get_term_link( $link['term'] );
|
||||
$link['text'] = $bctitle;
|
||||
}
|
||||
|
||||
if ( isset( $link['ptarchive'] ) ) {
|
||||
if ( isset( $opt['bctitle-ptarchive-' . $link['ptarchive']] ) && '' != $opt['bctitle-ptarchive-' . $link['ptarchive']] ) {
|
||||
$archive_title = $opt['bctitle-ptarchive-' . $link['ptarchive']];
|
||||
} else {
|
||||
$post_type_obj = get_post_type_object( $link['ptarchive'] );
|
||||
$archive_title = $post_type_obj->labels->menu_name;
|
||||
}
|
||||
$link['url'] = get_post_type_archive_link( $link['ptarchive'] );
|
||||
$link['text'] = $archive_title;
|
||||
}
|
||||
|
||||
$element = esc_attr( apply_filters( 'wpseo_breadcrumb_single_link_wrapper', $element ) );
|
||||
$link_output = '<' . $element . ' typeof="v:Breadcrumb">';
|
||||
if ( isset( $link['url'] ) && ( $i < ( count( $links ) - 1 ) || $paged ) ) {
|
||||
$link_output .= '<a href="' . esc_url( $link['url'] ) . '" rel="v:url" property="v:title">' . esc_html( $link['text'] ) . '</a>';
|
||||
} else {
|
||||
if ( isset( $opt['breadcrumbs-boldlast'] ) && $opt['breadcrumbs-boldlast'] ) {
|
||||
$link_output .= '<strong class="breadcrumb_last" property="v:title">' . esc_html( $link['text'] ) . '</strong>';
|
||||
} else {
|
||||
$link_output .= '<span class="breadcrumb_last" property="v:title">' . esc_html( $link['text'] ) . '</span>';
|
||||
}
|
||||
}
|
||||
$link_output .= '</' . $element . '>';
|
||||
|
||||
$output .= apply_filters( 'wpseo_breadcrumb_single_link', $link_output, $link );
|
||||
}
|
||||
|
||||
$id = apply_filters( 'wpseo_breadcrumb_output_id', false );
|
||||
if ( !empty( $id ) )
|
||||
$id = ' id="' . esc_attr( $id ) . '"';
|
||||
|
||||
$class = apply_filters( 'wpseo_breadcrumb_output_class', false );
|
||||
if ( !empty( $class ) )
|
||||
$class = ' class="' . esc_attr( $class ) . '"';
|
||||
|
||||
$wrapper = apply_filters( 'wpseo_breadcrumb_output_wrapper', $wrapper );
|
||||
return apply_filters( 'wpseo_breadcrumb_output', '<' . $wrapper . $id . $class . ' xmlns:v="http://rdf.data-vocabulary.org/#">' . $output . '</' . $wrapper . '>' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
global $wpseo_bc;
|
||||
$wpseo_bc = new WPSEO_Breadcrumbs();
|
||||
|
||||
if ( !function_exists( 'yoast_breadcrumb' ) ) {
|
||||
/**
|
||||
* Template tag for breadcrumbs.
|
||||
*
|
||||
* @param string $before What to show before the breadcrumb.
|
||||
* @param string $after What to show after the breadcrumb.
|
||||
* @param bool $display Whether to display the breadcrumb (true) or return it (false).
|
||||
* @return string
|
||||
*/
|
||||
function yoast_breadcrumb( $before = '', $after = '', $display = true ) {
|
||||
global $wpseo_bc;
|
||||
return $wpseo_bc->breadcrumb( $before, $after, $display );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,304 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Frontend
|
||||
*
|
||||
* This code handles the OpenGraph output.
|
||||
*/
|
||||
|
||||
if ( !defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'HTTP/1.0 403 Forbidden' );
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the OpenGraph output
|
||||
*/
|
||||
class WPSEO_OpenGraph extends WPSEO_Frontend {
|
||||
|
||||
/**
|
||||
* @var array $options Options for the OpenGraph Settings
|
||||
*/
|
||||
var $options = array();
|
||||
|
||||
/**
|
||||
* @var array $shown_images Holds the images that have been put out as OG image.
|
||||
*/
|
||||
var $shown_images = array();
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->options = get_option( 'wpseo_social' );
|
||||
|
||||
global $fb_ver;
|
||||
if ( isset( $fb_ver ) || class_exists( 'Facebook_Loader' ) ) {
|
||||
add_filter( 'fb_meta_tags', array( $this, 'facebook_filter' ), 10, 1 );
|
||||
} else {
|
||||
add_filter( 'language_attributes', array( $this, 'add_opengraph_namespace' ) );
|
||||
|
||||
add_action( 'wpseo_opengraph', array( $this, 'locale'), 1 );
|
||||
add_action( 'wpseo_opengraph', array( $this, 'site_owner'), 20 );
|
||||
add_action( 'wpseo_opengraph', array( $this, 'og_title'), 10 );
|
||||
add_action( 'wpseo_opengraph', array( $this, 'description'), 11 );
|
||||
add_action( 'wpseo_opengraph', array( $this, 'url'), 12 );
|
||||
add_action( 'wpseo_opengraph', array( $this, 'site_name'), 13 );
|
||||
add_action( 'wpseo_opengraph', array( $this, 'type'), 5 );
|
||||
add_action( 'wpseo_opengraph', array( $this, 'image'), 30 );
|
||||
}
|
||||
remove_action( 'wp_head', 'jetpack_og_tags' );
|
||||
add_action( 'wpseo_head', array( $this, 'opengraph' ), 30 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Main OpenGraph output.
|
||||
*/
|
||||
public function opengraph() {
|
||||
do_action( 'wpseo_opengraph' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the Facebook plugins metadata
|
||||
*
|
||||
* @param array $meta_tags the array to fix.
|
||||
*
|
||||
* @return array $meta_tags
|
||||
*/
|
||||
public function facebook_filter( $meta_tags ) {
|
||||
$meta_tags['http://ogp.me/ns#type'] = $this->type( false );
|
||||
$meta_tags['http://ogp.me/ns#title'] = $this->og_title( false );
|
||||
|
||||
// Filter the locale too because the Facebook plugin locale code is not as good as ours.
|
||||
$meta_tags['http://ogp.me/ns#locale'] = $this->locale( false );
|
||||
|
||||
$ogdesc = $this->description( false );
|
||||
if ( !empty( $ogdesc ) )
|
||||
$meta_tags['http://ogp.me/ns#description'] = $ogdesc;
|
||||
|
||||
return $meta_tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter for the namespace, adding the OpenGraph namespace.
|
||||
*
|
||||
* @param string $input The input namespace string.
|
||||
* @return string
|
||||
*/
|
||||
public function add_opengraph_namespace( $input ) {
|
||||
return $input . ' prefix="og: http://ogp.me/ns#' . ( ( isset( $this->options['fbadminapp'] ) || isset( $this->options['fb_admins'] ) ) ? ' fb: http://ogp.me/ns/fb#' : '' ) . '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the site owner
|
||||
*/
|
||||
public function site_owner() {
|
||||
if ( isset( $this->options['fbadminapp'] ) && 0 != $this->options['fbadminapp'] ) {
|
||||
echo "<meta property='fb:app_id' content='" . esc_attr( $this->options['fbadminapp'] ) . "'/>\n";
|
||||
} else if ( isset( $this->options['fb_admins'] ) && is_array( $this->options['fb_admins'] ) && ( count( $this->options['fb_admins'] ) > 0 ) ) {
|
||||
$adminstr = '';
|
||||
foreach ( $this->options['fb_admins'] as $admin_id => $admin ) {
|
||||
if ( !empty( $adminstr ) )
|
||||
$adminstr .= ',' . $admin_id;
|
||||
else
|
||||
$adminstr = $admin_id;
|
||||
}
|
||||
echo "<meta property='fb:admins' content='" . esc_attr( $adminstr ) . "'/>\n";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the SEO title as OpenGraph title.
|
||||
*
|
||||
* @param bool $echo Whether or not to echo the output.
|
||||
* @return string $title
|
||||
*/
|
||||
public function og_title( $echo = true ) {
|
||||
$title = $this->title( '' );
|
||||
if ( $echo !== false )
|
||||
echo "<meta property='og:title' content='" . esc_attr( $title ) . "'/>\n";
|
||||
else
|
||||
return $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the canonical URL as OpenGraph URL, which consolidates likes and shares.
|
||||
*/
|
||||
public function url() {
|
||||
echo "<meta property='og:url' content='" . esc_attr( $this->canonical( false ) ) . "'/>\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the locale, doing some conversions to make sure the proper Facebook locale is outputted.
|
||||
*
|
||||
* @param bool $echo Whether to echo or return the locale
|
||||
*
|
||||
* @return string $locale
|
||||
*/
|
||||
public function locale( $echo = true ) {
|
||||
$locale = apply_filters( 'wpseo_locale', get_locale() );
|
||||
|
||||
// catch some weird locales served out by WP that are not easily doubled up.
|
||||
$fix_locales = array(
|
||||
'ca' => 'ca_ES',
|
||||
'en' => 'en_US',
|
||||
'el' => 'el_GR',
|
||||
'et' => 'et_EE',
|
||||
'ja' => 'ja_JP',
|
||||
'sq' => 'sq_AL',
|
||||
'uk' => 'uk_UA',
|
||||
'vi' => 'vi_VN',
|
||||
'zh' => 'zh_CN'
|
||||
);
|
||||
|
||||
if ( isset( $fix_locales[$locale] ) )
|
||||
$locale = $fix_locales[$locale];
|
||||
|
||||
// convert locales like "es" to "es_ES", in case that works for the given locale (sometimes it does)
|
||||
if ( strlen( $locale ) == 2 )
|
||||
$locale = strtolower( $locale ) . '_' . strtoupper( $locale );
|
||||
|
||||
// These are the locales FB supports
|
||||
$fb_valid_fb_locales = array(
|
||||
'ca_ES', 'cs_CZ', 'cy_GB', 'da_DK', 'de_DE', 'eu_ES', 'en_PI', 'en_UD', 'ck_US', 'en_US', 'es_LA', 'es_CL', 'es_CO', 'es_ES', 'es_MX',
|
||||
'es_VE', 'fb_FI', 'fi_FI', 'fr_FR', 'gl_ES', 'hu_HU', 'it_IT', 'ja_JP', 'ko_KR', 'nb_NO', 'nn_NO', 'nl_NL', 'pl_PL', 'pt_BR', 'pt_PT',
|
||||
'ro_RO', 'ru_RU', 'sk_SK', 'sl_SI', 'sv_SE', 'th_TH', 'tr_TR', 'ku_TR', 'zh_CN', 'zh_HK', 'zh_TW', 'fb_LT', 'af_ZA', 'sq_AL', 'hy_AM',
|
||||
'az_AZ', 'be_BY', 'bn_IN', 'bs_BA', 'bg_BG', 'hr_HR', 'nl_BE', 'en_GB', 'eo_EO', 'et_EE', 'fo_FO', 'fr_CA', 'ka_GE', 'el_GR', 'gu_IN',
|
||||
'hi_IN', 'is_IS', 'id_ID', 'ga_IE', 'jv_ID', 'kn_IN', 'kk_KZ', 'la_VA', 'lv_LV', 'li_NL', 'lt_LT', 'mk_MK', 'mg_MG', 'ms_MY', 'mt_MT',
|
||||
'mr_IN', 'mn_MN', 'ne_NP', 'pa_IN', 'rm_CH', 'sa_IN', 'sr_RS', 'so_SO', 'sw_KE', 'tl_PH', 'ta_IN', 'tt_RU', 'te_IN', 'ml_IN', 'uk_UA',
|
||||
'uz_UZ', 'vi_VN', 'xh_ZA', 'zu_ZA', 'km_KH', 'tg_TJ', 'ar_AR', 'he_IL', 'ur_PK', 'fa_IR', 'sy_SY', 'yi_DE', 'gn_PY', 'qu_PE', 'ay_BO',
|
||||
'se_NO', 'ps_AF', 'tl_ST'
|
||||
);
|
||||
|
||||
// check to see if the locale is a valid FB one, if not, use en_US as a fallback
|
||||
if ( !in_array( $locale, $fb_valid_fb_locales ) )
|
||||
$locale = 'en_US';
|
||||
|
||||
if ( $echo !== false )
|
||||
echo "<meta property='og:locale' content='" . esc_attr( $locale ) . "'/>\n";
|
||||
else
|
||||
return $locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the OpenGraph type.
|
||||
*
|
||||
* @param boolean $echo Whether to echo or return the type
|
||||
*
|
||||
* @return string $type
|
||||
*/
|
||||
public function type( $echo = true ) {
|
||||
if ( is_singular() ) {
|
||||
$type = wpseo_get_value( 'og_type' );
|
||||
if ( !$type || $type == '' )
|
||||
$type = 'article';
|
||||
} else {
|
||||
$type = 'website';
|
||||
}
|
||||
$type = apply_filters( 'wpseo_opengraph_type', $type );
|
||||
|
||||
if ( $echo !== false )
|
||||
echo "<meta property='og:type' content='" . esc_attr( $type ) . "'/>\n";
|
||||
else
|
||||
return $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display an OpenGraph image tag
|
||||
*
|
||||
* @param string $img Source URL to the image
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function image_output( $img ) {
|
||||
if ( empty( $img ) )
|
||||
return false;
|
||||
|
||||
$img = trim( apply_filters( 'wpseo_opengraph_image', $img ) );
|
||||
if ( !empty( $img ) ) {
|
||||
if ( strpos( $img, 'http' ) !== 0 ) {
|
||||
if ( $img[0] != '/' )
|
||||
return false;
|
||||
|
||||
// If it's a relative URL, it's relative to the domain, not necessarily to the WordPress install, we
|
||||
// want to preserve domain name and URL scheme (http / https) though.
|
||||
$parsed_url = parse_url( home_url() );
|
||||
$img = $parsed_url['scheme'] . '://' . $parsed_url['host'] . $img;
|
||||
}
|
||||
|
||||
if ( in_array( $img, $this->shown_images ) )
|
||||
return false;
|
||||
|
||||
array_push( $this->shown_images, $img );
|
||||
|
||||
echo "<meta property='og:image' content='" . esc_url( $img ) . "'/>\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the OpenGraph image elements for all the images within the current post/page.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function image() {
|
||||
if ( is_singular() ) {
|
||||
global $post;
|
||||
|
||||
if ( is_front_page() ) {
|
||||
if ( isset( $this->options['og_frontpage_image'] ) )
|
||||
$this->image_output( $this->options['og_frontpage_image'] );
|
||||
}
|
||||
|
||||
if ( function_exists( 'has_post_thumbnail' ) && has_post_thumbnail( $post->ID ) ) {
|
||||
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), apply_filters( 'wpseo_opengraph_image_size', 'large' ) );
|
||||
$this->image_output( $thumb[0] );
|
||||
}
|
||||
|
||||
if ( preg_match_all( '/<img [^>]+>/', $post->post_content, $matches ) ) {
|
||||
foreach ( $matches[0] as $img ) {
|
||||
if ( preg_match( '/src=("|\')(.*?)\1/', $img, $match ) )
|
||||
$this->image_output( $match[2] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $this->shown_images ) == 0 && isset( $this->options['og_default_image'] ) )
|
||||
$this->image_output( $this->options['og_default_image'] );
|
||||
|
||||
// @TODO add G+ image stuff
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the OpenGraph description, specific OG description first, if not, grab the meta description.
|
||||
*
|
||||
* @param bool $echo Whether to echo or return the description
|
||||
* @return string $ogdesc
|
||||
*/
|
||||
public function description( $echo = true ) {
|
||||
$ogdesc = wpseo_get_value( 'opengraph-description' );
|
||||
|
||||
if ( !$ogdesc )
|
||||
$ogdesc = $this->metadesc( false );
|
||||
|
||||
$ogdesc = apply_filters( 'wpseo_opengraph_desc', $ogdesc );
|
||||
|
||||
if ( $ogdesc && $ogdesc != '' ) {
|
||||
if ( $echo !== false )
|
||||
echo "<meta property='og:description' content='" . esc_attr( $ogdesc ) . "'/>\n";
|
||||
else
|
||||
return $ogdesc;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the site name straight from the blog info.
|
||||
*/
|
||||
public function site_name() {
|
||||
echo "<meta property='og:site_name' content='" . esc_attr( get_bloginfo( 'name' ) ) . "'/>\n";
|
||||
}
|
||||
}
|
||||
|
||||
global $wpseo_og;
|
||||
$wpseo_og = new WPSEO_OpenGraph;
|
||||
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Frontend
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class handles the Twitter card functionality.
|
||||
*/
|
||||
class WPSEO_Twitter extends WPSEO_Frontend {
|
||||
|
||||
/**
|
||||
* @var array $options Holds the options for the Twitter Card functionality
|
||||
*/
|
||||
var $options;
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->options = get_option( 'wpseo_social' );
|
||||
|
||||
add_action( 'wpseo_head', array( $this, 'twitter' ), 40 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the Twitter Card code on singular pages.
|
||||
*
|
||||
* @return false Only shows on singular pages, false on non-singular pages.
|
||||
*/
|
||||
public function twitter() {
|
||||
if ( !is_singular() )
|
||||
return false;
|
||||
|
||||
wp_reset_query();
|
||||
|
||||
$this->type();
|
||||
$this->site_twitter();
|
||||
$this->author_twitter();
|
||||
// No need to show these when OpenGraph is also showing, as it'd be the same contents and Twitter
|
||||
// would fallback to OpenGraph anyway.
|
||||
$this->image();
|
||||
$options = get_wpseo_options();
|
||||
|
||||
$this->twitter_description();
|
||||
|
||||
if ( !isset( $options['opengraph'] ) || !$options['opengraph'] ) {
|
||||
$this->twitter_title();
|
||||
$this->twitter_url();
|
||||
}
|
||||
|
||||
do_action( 'wpseo_twitter' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the Twitter card type.
|
||||
*
|
||||
* This defaults to summary but can be filtered using the <code>wpseo_twitter_card_type</code> filter.
|
||||
*/
|
||||
public function type() {
|
||||
echo '<meta name="twitter:card" content="' . apply_filters( 'wpseo_twitter_card_type', 'summary' ) . '"/>' . "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the Twitter account for the site.
|
||||
*/
|
||||
public function site_twitter() {
|
||||
if ( isset( $this->options['twitter_site'] ) )
|
||||
echo '<meta name="twitter:site" content="@' . trim( $this->options['twitter_site'] ) . '"/>' . "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the authors Twitter account.
|
||||
*/
|
||||
public function author_twitter() {
|
||||
$twitter = trim( get_the_author_meta( 'twitter' ) );
|
||||
|
||||
if ( $twitter && !empty( $twitter ) )
|
||||
echo '<meta name="twitter:creator" content="@' . $twitter . '"/>' . "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the title for Twitter.
|
||||
*
|
||||
* Only used when OpenGraph is inactive.
|
||||
*/
|
||||
public function twitter_title() {
|
||||
echo '<meta name="twitter:title" content="' . $this->title( '' ) . '"/>' . "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the description for Twitter.
|
||||
*
|
||||
* Only used when OpenGraph is inactive.
|
||||
*/
|
||||
public function twitter_description() {
|
||||
$metadesc = trim( $this->metadesc( false ) );
|
||||
if ( empty( $metadesc ) )
|
||||
$metadesc = false;
|
||||
if ( $metadesc && isset( $options['opengraph'] ) && $options['opengraph'] ) {
|
||||
// Already output the same description in opengraph, no need to repeat.
|
||||
return;
|
||||
} else if ( !$metadesc ) {
|
||||
$metadesc = strip_tags( get_the_excerpt() );
|
||||
}
|
||||
|
||||
echo '<meta name="twitter:description" content="' . esc_attr( $metadesc ) . '"/>' . "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the URL for Twitter.
|
||||
*
|
||||
* Only used when OpenGraph is inactive.
|
||||
*/
|
||||
public function twitter_url() {
|
||||
echo '<meta name="twitter:url" content="' . $this->canonical( false ) . '"/>' . "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the image for Twitter
|
||||
*
|
||||
* Only used when OpenGraph is inactive.
|
||||
*/
|
||||
public function image() {
|
||||
global $post;
|
||||
|
||||
if ( function_exists( 'has_post_thumbnail' ) && has_post_thumbnail( $post->ID ) ) {
|
||||
$featured_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), apply_filters( 'wpseo_opengraph_image_size', 'medium' ) );
|
||||
|
||||
if ( $featured_img ) {
|
||||
$img = apply_filters( 'wpseo_opengraph_image', $featured_img[0] );
|
||||
echo "<meta name='twitter:image' content='" . esc_attr( $img ) . "'/>\n";
|
||||
}
|
||||
} else {
|
||||
$options = get_wpseo_options();
|
||||
if ( isset( $options['og_frontpage_image'] ) && !empty( $options['og_frontpage_image'] ) )
|
||||
echo "<meta name='twitter:image' content='" . esc_attr( $options['og_frontpage_image'] ) . "'/>\n";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
global $wpseo_twitter;
|
||||
$wpseo_twitter = new WPSEO_Twitter();
|
||||
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 710 B |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 605 B |
|
After Width: | Height: | Size: 453 B |
|
After Width: | Height: | Size: 493 B |
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Frontend
|
||||
*/
|
||||
|
||||
if ( !defined('WPSEO_VERSION') ) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* This code handles the category rewrites.
|
||||
*/
|
||||
class WPSEO_Rewrite {
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*/
|
||||
function __construct() {
|
||||
add_filter( 'query_vars', array( $this, 'query_vars' ) );
|
||||
add_filter( 'category_link', array( $this, 'no_category_base' ) );
|
||||
add_filter( 'request', array( $this, 'request' ) );
|
||||
add_filter( 'category_rewrite_rules', array( $this, 'category_rewrite_rules' ) );
|
||||
|
||||
add_action( 'created_category', array( $this, 'schedule_flush' ) );
|
||||
add_action( 'edited_category', array( $this, 'schedule_flush' ) );
|
||||
add_action( 'delete_category', array( $this, 'schedule_flush' ) );
|
||||
|
||||
add_action( 'init', array( $this, 'flush' ), 10 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save an option that triggers a flush on the next init.
|
||||
*
|
||||
* @since 1.2.8
|
||||
*/
|
||||
function schedule_flush() {
|
||||
update_option( 'wpseo_flush_rewrite', 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* If the flush option is set, flush the rewrite rules.
|
||||
*
|
||||
* @since 1.2.8
|
||||
*/
|
||||
function flush() {
|
||||
if ( get_option( 'wpseo_flush_rewrite' ) ) {
|
||||
flush_rewrite_rules();
|
||||
delete_option( 'wpseo_flush_rewrite' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the category link to remove the category base.
|
||||
*
|
||||
* @param string $link Unused, overridden by the function.
|
||||
* @return string
|
||||
*/
|
||||
function no_category_base( $link ) {
|
||||
$category_base = get_option( 'category_base' );
|
||||
|
||||
if ( '' == $category_base )
|
||||
$category_base = 'category';
|
||||
|
||||
// Remove initial slash, if there is one (we remove the trailing slash in the regex replacement and don't want to end up short a slash)
|
||||
if ( '/' == substr( $category_base, 0, 1 ) )
|
||||
$category_base = substr( $category_base, 1 );
|
||||
|
||||
$category_base .= '/';
|
||||
|
||||
return preg_replace( '|' . $category_base . '|', '', $link, 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the query vars with the redirect var when stripcategorybase is active
|
||||
*
|
||||
* @param $query_vars
|
||||
* @return array
|
||||
*/
|
||||
function query_vars( $query_vars ) {
|
||||
$options = get_wpseo_options();
|
||||
|
||||
if ( isset( $options['stripcategorybase'] ) && $options['stripcategorybase'] )
|
||||
$query_vars[] = 'wpseo_category_redirect';
|
||||
|
||||
return $query_vars;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect the "old" category URL to the new one.
|
||||
*
|
||||
* @param array $query_vars Query vars to check for existence of redirect var
|
||||
* @return array
|
||||
*/
|
||||
function request( $query_vars ) {
|
||||
if ( isset( $query_vars['wpseo_category_redirect'] ) ) {
|
||||
$catlink = trailingslashit( get_option( 'home' ) ) . user_trailingslashit( $query_vars['wpseo_category_redirect'], 'category' );
|
||||
|
||||
wp_redirect( $catlink, 301 );
|
||||
exit;
|
||||
}
|
||||
return $query_vars;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function taken and only slightly adapted from WP No Category Base plugin by Saurabh Gupta
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function category_rewrite_rules() {
|
||||
global $wp_rewrite;
|
||||
|
||||
$category_rewrite = array();
|
||||
|
||||
$blog_prefix = '';
|
||||
if ( function_exists( 'is_multisite' ) && is_multisite() && !is_subdomain_install() && is_main_site() )
|
||||
$blog_prefix = 'blog/';
|
||||
|
||||
foreach ( get_categories( array( 'hide_empty'=> false ) ) as $category ) {
|
||||
$category_nicename = $category->slug;
|
||||
if ( $category->parent == $category->cat_ID ) // recursive recursion
|
||||
$category->parent = 0;
|
||||
elseif ( $category->parent != 0 )
|
||||
$category_nicename = get_category_parents( $category->parent, false, '/', true ) . $category_nicename;
|
||||
|
||||
$category_rewrite[$blog_prefix . '(' . $category_nicename . ')/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?category_name=$matches[1]&feed=$matches[2]';
|
||||
$category_rewrite[$blog_prefix . '(' . $category_nicename . ')/page/?([0-9]{1,})/?$'] = 'index.php?category_name=$matches[1]&paged=$matches[2]';
|
||||
$category_rewrite[$blog_prefix . '(' . $category_nicename . ')/?$'] = 'index.php?category_name=$matches[1]';
|
||||
}
|
||||
|
||||
// Redirect support from Old Category Base
|
||||
$old_base = $wp_rewrite->get_category_permastruct();
|
||||
$old_base = str_replace( '%category%', '(.+)', $old_base );
|
||||
$old_base = trim( $old_base, '/' );
|
||||
$category_rewrite[$old_base . '$'] = 'index.php?wpseo_category_redirect=$matches[1]';
|
||||
|
||||
return $category_rewrite;
|
||||
}
|
||||
}
|
||||
|
||||
global $wpseo_rewrite;
|
||||
$wpseo_rewrite = new WPSEO_Rewrite();
|
||||
@@ -0,0 +1,629 @@
|
||||
<?php
|
||||
/**
|
||||
* @package XML_Sitemaps
|
||||
*/
|
||||
|
||||
if ( !defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'HTTP/1.0 403 Forbidden' );
|
||||
die;
|
||||
}
|
||||
|
||||
class WPSEO_Sitemaps {
|
||||
/**
|
||||
* Content of the sitemap to output.
|
||||
*/
|
||||
private $sitemap = '';
|
||||
|
||||
/**
|
||||
* XSL stylesheet for styling a sitemap for web browsers
|
||||
*/
|
||||
private $stylesheet = '';
|
||||
|
||||
/**
|
||||
* Flag to indicate if this is an invalid or empty sitemap.
|
||||
*/
|
||||
private $bad_sitemap = false;
|
||||
|
||||
/**
|
||||
* The maximum number of entries per sitemap page
|
||||
*/
|
||||
private $max_entries = 1000;
|
||||
|
||||
function __construct() {
|
||||
if ( !defined( 'ENT_XML1' ) )
|
||||
define( "ENT_XML1", 16 );
|
||||
|
||||
add_action( 'init', array( $this, 'init' ), 1 );
|
||||
add_action( 'template_redirect', array( $this, 'redirect' ) );
|
||||
add_filter( 'redirect_canonical', array( $this, 'canonical' ) );
|
||||
add_action( 'wpseo_hit_sitemap_index', array( $this, 'hit_sitemap_index' ) );
|
||||
|
||||
// default stylesheet
|
||||
$this->stylesheet = '<?xml-stylesheet type="text/xsl" href="' . WPSEO_FRONT_URL . 'css/xml-sitemap-xsl.php"?>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Register your own sitemap. Call this during 'init'.
|
||||
*
|
||||
* @param string $name The name of the sitemap
|
||||
* @param callback $function Function to build your sitemap
|
||||
* @param string $rewrite Optional. Regular expression to match your sitemap with
|
||||
*/
|
||||
function register_sitemap( $name, $function, $rewrite = '' ) {
|
||||
add_action( 'wpseo_do_sitemap_' . $name, $function );
|
||||
if ( !empty( $rewrite ) )
|
||||
add_rewrite_rule( $rewrite, 'index.php?sitemap=' . $name, 'top' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the sitemap content to display after you have generated it.
|
||||
*
|
||||
* @param string $sitemap The generated sitemap to output
|
||||
*/
|
||||
function set_sitemap( $sitemap ) {
|
||||
$this->sitemap = $sitemap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a custom stylesheet for this sitemap. Set to empty to just remove
|
||||
* the default stylesheet.
|
||||
*
|
||||
* @param string $stylesheet Full xml-stylesheet declaration
|
||||
*/
|
||||
function set_stylesheet( $stylesheet ) {
|
||||
$this->stylesheet = $stylesheet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set as true to make the request 404. Used stop the display of empty sitemaps or
|
||||
* invalid requests.
|
||||
*
|
||||
* @param bool $bool Is this a bad request. True or false.
|
||||
*/
|
||||
function set_bad_sitemap( $bool ) {
|
||||
$this->bad_sitemap = (bool) $bool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize sitemaps. Add sitemap rewrite rules and query var
|
||||
*/
|
||||
function init() {
|
||||
$GLOBALS['wp']->add_query_var( 'sitemap' );
|
||||
$GLOBALS['wp']->add_query_var( 'sitemap_n' );
|
||||
|
||||
$options = get_wpseo_options();
|
||||
$this->max_entries = ( isset( $options['entries-per-page'] ) && $options['entries-per-page'] != '' ) ? intval( $options['entries-per-page'] ) : 1000;
|
||||
|
||||
add_rewrite_rule( 'sitemap_index\.xml$', 'index.php?sitemap=1', 'top' );
|
||||
add_rewrite_rule( '([^/]+?)-sitemap([0-9]+)?\.xml$', 'index.php?sitemap=$matches[1]&sitemap_n=$matches[2]', 'top' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Hijack requests for potential sitemaps.
|
||||
*/
|
||||
function redirect() {
|
||||
$type = get_query_var( 'sitemap' );
|
||||
if ( empty( $type ) )
|
||||
return;
|
||||
|
||||
$this->build_sitemap( $type );
|
||||
// 404 for invalid or emtpy sitemaps
|
||||
if ( $this->bad_sitemap ) {
|
||||
$GLOBALS['wp_query']->is_404 = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// $wphost = parse_url( get_site_url(), PHP_URL_HOST );
|
||||
// if ( isset( $_SERVER['SERVER_NAME'] ) && $_SERVER['SERVER_NAME'] != $wphost ) {
|
||||
// wp_redirect( rtrim( get_site_url(), '/' ) . $_SERVER['REQUEST_URI'], 301 );
|
||||
// }
|
||||
$this->output();
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to build the requested sitemap. Sets $bad_sitemap if this isn't
|
||||
* for the root sitemap, a post type or taxonomy.
|
||||
*
|
||||
* @param string $type The requested sitemap's identifier.
|
||||
*/
|
||||
function build_sitemap( $type ) {
|
||||
$type = apply_filters( 'wpseo_build_sitemap_post_type', $type );
|
||||
|
||||
if ( $type == 1 )
|
||||
$this->build_root_map();
|
||||
else if ( post_type_exists( $type ) )
|
||||
$this->build_post_type_map( $type );
|
||||
else if ( $tax = get_taxonomy( $type ) )
|
||||
$this->build_tax_map( $tax );
|
||||
else if ( has_action( 'wpseo_do_sitemap_' . $type ) )
|
||||
do_action( 'wpseo_do_sitemap_' . $type );
|
||||
else
|
||||
$this->bad_sitemap = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the root sitemap -- example.com/sitemap_index.xml -- which lists sub-sitemaps
|
||||
* for other content types.
|
||||
*
|
||||
* @todo lastmod for sitemaps?
|
||||
*/
|
||||
|
||||
function build_root_map() {
|
||||
global $wpdb;
|
||||
|
||||
$options = get_wpseo_options();
|
||||
|
||||
$this->sitemap = '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
|
||||
$base = $GLOBALS['wp_rewrite']->using_index_permalinks() ? 'index.php/' : '';
|
||||
|
||||
// reference post type specific sitemaps
|
||||
foreach ( get_post_types( array( 'public' => true ) ) as $post_type ) {
|
||||
if ( isset( $options['post_types-' . $post_type . '-not_in_sitemap'] ) && $options['post_types-' . $post_type . '-not_in_sitemap'] )
|
||||
continue;
|
||||
|
||||
$query = $wpdb->prepare( "SELECT COUNT(ID) FROM $wpdb->posts WHERE post_type = '%s' AND post_status IN ('publish','inherit')", $post_type );
|
||||
|
||||
$count = $wpdb->get_var( $query );
|
||||
// don't include post types with no posts
|
||||
if ( !$count )
|
||||
continue;
|
||||
|
||||
$n = ( $count > $this->max_entries ) ? (int) ceil( $count / $this->max_entries ) : 1;
|
||||
for ( $i = 0; $i < $n; $i++ ) {
|
||||
$count = ( $n > 1 ) ? $i + 1 : '';
|
||||
|
||||
if ( empty( $count ) || $count == $n ) {
|
||||
$date = $this->get_last_modified( $post_type );
|
||||
} else {
|
||||
$date = $wpdb->get_var( $wpdb->prepare( "SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status IN ('publish','inherit') AND post_type = %s ORDER BY post_modified_gmt ASC LIMIT 1 OFFSET %d", $post_type, $this->max_entries * ( $i + 1 ) - 1 ) );
|
||||
$date = date( 'c', strtotime( $date ) );
|
||||
}
|
||||
|
||||
$this->sitemap .= '<sitemap>' . "\n";
|
||||
$this->sitemap .= '<loc>' . home_url( $base . $post_type . '-sitemap' . $count . '.xml' ) . '</loc>' . "\n";
|
||||
$this->sitemap .= '<lastmod>' . htmlspecialchars( $date ) . '</lastmod>' . "\n";
|
||||
$this->sitemap .= '</sitemap>' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// reference taxonomy specific sitemaps
|
||||
foreach ( get_taxonomies( array( 'public' => true ) ) as $tax ) {
|
||||
if ( in_array( $tax, array( 'link_category', 'nav_menu', 'post_format' ) ) )
|
||||
continue;
|
||||
|
||||
if ( isset( $options['taxonomies-' . $tax . '-not_in_sitemap'] ) && $options['taxonomies-' . $tax . '-not_in_sitemap'] )
|
||||
continue;
|
||||
// don't include taxonomies with no terms
|
||||
if ( !$wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = %s AND count != 0 LIMIT 1", $tax ) ) )
|
||||
continue;
|
||||
|
||||
// Retrieve the post_types that are registered to this taxonomy and then retrieve last modified date for all of those combined.
|
||||
$taxobj = get_taxonomy( $tax );
|
||||
$date = $this->get_last_modified( $taxobj->object_type );
|
||||
|
||||
$this->sitemap .= '<sitemap>' . "\n";
|
||||
$this->sitemap .= '<loc>' . home_url( $base . $tax . '-sitemap.xml' ) . '</loc>' . "\n";
|
||||
$this->sitemap .= '<lastmod>' . htmlspecialchars( $date ) . '</lastmod>' . "\n";
|
||||
$this->sitemap .= '</sitemap>' . "\n";
|
||||
}
|
||||
|
||||
// allow other plugins to add their sitemaps to the index
|
||||
$this->sitemap .= apply_filters( 'wpseo_sitemap_index', '' );
|
||||
$this->sitemap .= '</sitemapindex>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a sub-sitemap for a specific post type -- example.com/post_type-sitemap.xml
|
||||
*
|
||||
* @param string $post_type Registered post type's slug
|
||||
*/
|
||||
function build_post_type_map( $post_type ) {
|
||||
global $wpdb;
|
||||
|
||||
$options = get_wpseo_options();
|
||||
|
||||
if (
|
||||
( isset( $options['post_types-' . $post_type . '-not_in_sitemap'] ) && $options['post_types-' . $post_type . '-not_in_sitemap'] )
|
||||
|| in_array( $post_type, array( 'revision', 'nav_menu_item' ) )
|
||||
) {
|
||||
$this->bad_sitemap = true;
|
||||
return;
|
||||
}
|
||||
|
||||
$output = '';
|
||||
|
||||
$steps = 25;
|
||||
$n = (int) get_query_var( 'sitemap_n' );
|
||||
$offset = ( $n > 1 ) ? ( $n - 1 ) * $this->max_entries : 0;
|
||||
$total = $offset + $this->max_entries;
|
||||
|
||||
$join_filter = '';
|
||||
$join_filter = apply_filters( 'wpseo_typecount_join', $join_filter, $post_type );
|
||||
$where_filter = '';
|
||||
$where_filter = apply_filters( 'wpseo_typecount_where', $where_filter, $post_type );
|
||||
|
||||
$query = $wpdb->prepare( "SELECT COUNT(ID) FROM $wpdb->posts {$join_filter} WHERE post_status IN ('publish','inherit') AND post_password = '' AND post_type = %s " . $where_filter, $post_type );
|
||||
$typecount = $wpdb->get_var( $query );
|
||||
|
||||
if ( $total > $typecount )
|
||||
$total = $typecount;
|
||||
|
||||
if ( $n == 1 ) {
|
||||
$front_id = get_option( 'page_on_front' );
|
||||
if ( !$front_id && ( $post_type == 'post' || $post_type == 'page' ) ) {
|
||||
$output .= $this->sitemap_url( array(
|
||||
'loc' => home_url( '/' ),
|
||||
'pri' => 1,
|
||||
'chf' => 'daily',
|
||||
) );
|
||||
} else if ( $front_id && $post_type == 'post' ) {
|
||||
$page_for_posts = get_option( 'page_for_posts' );
|
||||
if ( $page_for_posts ) {
|
||||
$output .= $this->sitemap_url( array(
|
||||
'loc' => get_permalink( $page_for_posts ),
|
||||
'pri' => 1,
|
||||
'chf' => 'daily',
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( function_exists( 'get_post_type_archive_link' ) ) {
|
||||
$archive = get_post_type_archive_link( $post_type );
|
||||
if ( $archive ) {
|
||||
$output .= $this->sitemap_url( array(
|
||||
'loc' => $archive,
|
||||
'pri' => 0.8,
|
||||
'chf' => 'weekly',
|
||||
'mod' => $this->get_last_modified( $post_type ) // get_lastpostmodified( 'gmt', $post_type ) #17455
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $typecount == 0 && empty( $archive ) ) {
|
||||
$this->bad_sitemap = true;
|
||||
return;
|
||||
}
|
||||
|
||||
$stackedurls = array();
|
||||
|
||||
// We grab post_date, post_name, post_author and post_status too so we can throw these objects into get_permalink, which saves a get_post call for each permalink.
|
||||
while ( $total > $offset ) {
|
||||
|
||||
// Make sure you're wpdb->preparing everything you throw into this!!
|
||||
$join_filter = apply_filters( 'wpseo_posts_join', false, $post_type );
|
||||
$where_filter = apply_filters( 'wpseo_posts_where', false, $post_type );
|
||||
|
||||
// Optimized query per this thread: http://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-performance-suggestion
|
||||
// Also see http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/
|
||||
|
||||
$status = ( $post_type == 'attachment' ) ? 'inherit' : 'publish';
|
||||
|
||||
$query = $wpdb->prepare( "SELECT l.ID, post_content, post_name, post_author, post_parent, post_modified_gmt, post_date, post_date_gmt
|
||||
FROM (
|
||||
SELECT ID FROM $wpdb->posts {$join_filter}
|
||||
WHERE post_status = '%s'
|
||||
AND post_password = ''
|
||||
AND post_type = '%s'
|
||||
{$where_filter}
|
||||
ORDER BY post_modified ASC
|
||||
LIMIT %d OFFSET %d ) o
|
||||
JOIN $wpdb->posts l
|
||||
ON l.ID = o.ID
|
||||
ORDER BY l.ID", $status, $post_type, $steps, $offset );
|
||||
|
||||
$posts = $wpdb->get_results( $query );
|
||||
|
||||
$offset = $offset + $steps;
|
||||
|
||||
foreach ( $posts as $p ) {
|
||||
$p->post_type = $post_type;
|
||||
$p->post_status = 'publish';
|
||||
$p->filter = 'sample';
|
||||
|
||||
if ( wpseo_get_value( 'meta-robots-noindex', $p->ID ) && wpseo_get_value( 'sitemap-include', $p->ID ) != 'always' )
|
||||
continue;
|
||||
if ( wpseo_get_value( 'sitemap-include', $p->ID ) == 'never' )
|
||||
continue;
|
||||
if ( wpseo_get_value( 'redirect', $p->ID ) && strlen( wpseo_get_value( 'redirect', $p->ID ) ) > 0 )
|
||||
continue;
|
||||
|
||||
$url = array();
|
||||
|
||||
$url['mod'] = ( isset( $p->post_modified_gmt ) && $p->post_modified_gmt != '0000-00-00 00:00:00' ) ? $p->post_modified_gmt : $p->post_date_gmt;
|
||||
$url['chf'] = 'weekly';
|
||||
$url['loc'] = get_permalink( $p );
|
||||
|
||||
$canonical = wpseo_get_value( 'canonical', $p->ID );
|
||||
if ( $canonical && $canonical != '' && $canonical != $url['loc'] ) {
|
||||
// Let's assume that if a canonical is set for this page and it's different from the URL of this post, that page is either
|
||||
// already in the XML sitemap OR is on an external site, either way, we shouldn't include it here.
|
||||
continue;
|
||||
} else {
|
||||
|
||||
if ( isset( $options['trailingslash'] ) && $options['trailingslash'] && $p->post_type != 'post' )
|
||||
$url['loc'] = trailingslashit( $url['loc'] );
|
||||
}
|
||||
|
||||
$pri = wpseo_get_value( 'sitemap-prio', $p->ID );
|
||||
if ( is_numeric( $pri ) )
|
||||
$url['pri'] = $pri;
|
||||
elseif ( $p->post_parent == 0 && $p->post_type == 'page' )
|
||||
$url['pri'] = 0.8; else
|
||||
$url['pri'] = 0.6;
|
||||
|
||||
if ( isset( $front_id ) && $p->ID == $front_id )
|
||||
$url['pri'] = 1.0;
|
||||
|
||||
$url['images'] = array();
|
||||
|
||||
$content = $p->post_content;
|
||||
if ( function_exists( 'get_the_post_thumbnail' ) ) {
|
||||
$content = '<p>' . get_the_post_thumbnail( $p->ID, 'full' ) . '</p>' . $content;
|
||||
}
|
||||
|
||||
$host = str_replace( 'www.', '', parse_url( get_bloginfo( 'url' ), PHP_URL_HOST ) );
|
||||
|
||||
if ( preg_match_all( '/<img [^>]+>/', $content, $matches ) ) {
|
||||
foreach ( $matches[0] as $img ) {
|
||||
if ( preg_match( '/src=("|\')([^"|\']+)("|\')/', $img, $match ) ) {
|
||||
$src = $match[2];
|
||||
if ( strpos( $src, 'http' ) !== 0 ) {
|
||||
if ( $src[0] != '/' )
|
||||
continue;
|
||||
$src = get_bloginfo( 'url' ) . $src;
|
||||
}
|
||||
|
||||
if ( strpos( $src, $host ) === false )
|
||||
continue;
|
||||
|
||||
if ( $src != esc_url( $src ) )
|
||||
continue;
|
||||
|
||||
if ( isset( $url['images'][$src] ) )
|
||||
continue;
|
||||
|
||||
$image = array(
|
||||
'src' => apply_filters( 'wpseo_xml_sitemap_img_src', $src, $p )
|
||||
);
|
||||
|
||||
if ( preg_match( '/title=("|\')([^"\']+)("|\')/', $img, $match ) )
|
||||
$image['title'] = str_replace( array( '-', '_' ), ' ', $match[2] );
|
||||
|
||||
if ( preg_match( '/alt=("|\')([^"\']+)("|\')/', $img, $match ) )
|
||||
$image['alt'] = str_replace( array( '-', '_' ), ' ', $match[2] );
|
||||
|
||||
$image = apply_filters( 'wpseo_xml_sitemap_img', $image, $p );
|
||||
|
||||
$url['images'][] = $image;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( preg_match_all( '/\[gallery/', $p->post_content, $matches ) ) {
|
||||
$attachments = get_children( array( 'post_parent' => $p->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image' ) );
|
||||
foreach ( $attachments as $att_id => $attachment ) {
|
||||
$src = wp_get_attachment_image_src( $att_id, 'large', false );
|
||||
$image = array(
|
||||
'src' => apply_filters( 'wpseo_xml_sitemap_img_src', $src[0], $p )
|
||||
);
|
||||
|
||||
if ( $alt = get_post_meta( $att_id, '_wp_attachment_image_alt', true ) )
|
||||
$image['alt'] = $alt;
|
||||
|
||||
$image['title'] = $attachment->post_title;
|
||||
|
||||
$image = apply_filters( 'wpseo_xml_sitemap_img', $image, $p );
|
||||
|
||||
$url['images'][] = $image;
|
||||
}
|
||||
}
|
||||
|
||||
$url['images'] = apply_filters( 'wpseo_sitemap_urlimages', $url['images'], $p->ID );
|
||||
|
||||
if ( !in_array( $url['loc'], $stackedurls ) ) {
|
||||
$output .= $this->sitemap_url( $url );
|
||||
$stackedurls[] = $url['loc'];
|
||||
}
|
||||
|
||||
// Clear the post_meta and the term cache for the post, as we no longer need it now.
|
||||
// wp_cache_delete( $p->ID, 'post_meta' );
|
||||
// clean_object_term_cache( $p->ID, $post_type );
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $output ) ) {
|
||||
$this->bad_sitemap = true;
|
||||
return;
|
||||
}
|
||||
|
||||
$this->sitemap = '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" ';
|
||||
$this->sitemap .= 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" ';
|
||||
$this->sitemap .= 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
|
||||
$this->sitemap .= $output;
|
||||
|
||||
// Filter to allow adding extra URLs, only do this on the first XML sitemap, not on all.
|
||||
if ( $n == 0 )
|
||||
$this->sitemap .= apply_filters( 'wpseo_sitemap_' . $post_type . '_content', '' );
|
||||
|
||||
$this->sitemap .= '</urlset>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a sub-sitemap for a specific taxonomy -- example.com/tax-sitemap.xml
|
||||
*
|
||||
* @param string $taxonomy Registered taxonomy's slug
|
||||
*/
|
||||
function build_tax_map( $taxonomy ) {
|
||||
$options = get_wpseo_options();
|
||||
if (
|
||||
( isset( $options['taxonomies-' . $taxonomy->name . '-not_in_sitemap'] ) && $options['taxonomies-' . $taxonomy->name . '-not_in_sitemap'] )
|
||||
|| in_array( $taxonomy, array( 'link_category', 'nav_menu', 'post_format' ) )
|
||||
) {
|
||||
$this->bad_sitemap = true;
|
||||
return;
|
||||
}
|
||||
|
||||
$terms = get_terms( $taxonomy->name, array( 'hide_empty' => true ) );
|
||||
|
||||
global $wpdb;
|
||||
$output = '';
|
||||
foreach ( $terms as $c ) {
|
||||
$url = array();
|
||||
|
||||
if ( wpseo_get_term_meta( $c, $c->taxonomy, 'noindex' )
|
||||
&& !in_array( wpseo_get_term_meta( $c, $c->taxonomy, 'sitemap_include' ), array( 'always', '-' ) )
|
||||
)
|
||||
continue;
|
||||
|
||||
if ( wpseo_get_term_meta( $c, $c->taxonomy, 'sitemap_include' ) == 'never' )
|
||||
continue;
|
||||
|
||||
$url['loc'] = wpseo_get_term_meta( $c, $c->taxonomy, 'canonical' );
|
||||
if ( !$url['loc'] ) {
|
||||
$url['loc'] = get_term_link( $c, $c->taxonomy );
|
||||
if ( isset( $options['trailingslash'] ) && $options['trailingslash'] )
|
||||
$url['loc'] = trailingslashit( $url['loc'] );
|
||||
}
|
||||
if ( $c->count > 10 ) {
|
||||
$url['pri'] = 0.6;
|
||||
} else if ( $c->count > 3 ) {
|
||||
$url['pri'] = 0.4;
|
||||
} else {
|
||||
$url['pri'] = 0.2;
|
||||
}
|
||||
|
||||
// Grab last modified date
|
||||
$sql = $wpdb->prepare( "SELECT MAX(p.post_date) AS lastmod
|
||||
FROM $wpdb->posts AS p
|
||||
INNER JOIN $wpdb->term_relationships AS term_rel
|
||||
ON term_rel.object_id = p.ID
|
||||
INNER JOIN $wpdb->term_taxonomy AS term_tax
|
||||
ON term_tax.term_taxonomy_id = term_rel.term_taxonomy_id
|
||||
AND term_tax.taxonomy = %s
|
||||
AND term_tax.term_id = %d
|
||||
WHERE p.post_status IN ('publish','inherit')
|
||||
AND p.post_password = ''", $c->taxonomy, $c->term_id );
|
||||
$url['mod'] = $wpdb->get_var( $sql );
|
||||
$url['chf'] = 'weekly';
|
||||
$output .= $this->sitemap_url( $url );
|
||||
}
|
||||
|
||||
if ( empty( $output ) ) {
|
||||
$this->bad_sitemap = true;
|
||||
return;
|
||||
}
|
||||
|
||||
$this->sitemap = '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
|
||||
$this->sitemap .= 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" ';
|
||||
$this->sitemap .= 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
|
||||
$this->sitemap .= $output . '</urlset>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Spit out the generated sitemap and relevant headers and encoding information.
|
||||
*/
|
||||
function output() {
|
||||
header( 'HTTP/1.1 200 OK', true, 200 );
|
||||
// Prevent the search engines from indexing the XML Sitemap.
|
||||
header( 'X-Robots-Tag: noindex, follow', true );
|
||||
header( 'Content-Type: text/xml' );
|
||||
echo '<?xml version="1.0" encoding="' . get_bloginfo( 'charset' ) . '"?>';
|
||||
if ( $this->stylesheet )
|
||||
echo apply_filters( 'wpseo_stylesheet_url', $this->stylesheet ) . "\n";
|
||||
echo $this->sitemap;
|
||||
echo "\n" . '<!-- XML Sitemap generated by Yoast WordPress SEO -->';
|
||||
|
||||
if ( WP_DEBUG )
|
||||
echo "\n" . '<!-- Built in ' . timer_stop() . ' seconds | ' . memory_get_peak_usage() . ' | ' . count( $GLOBALS['wpdb']->queries ) . ' -->';
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the <url> tag for a given URL.
|
||||
*
|
||||
* @param array $url Array of parts that make up this entry
|
||||
* @return string
|
||||
*/
|
||||
function sitemap_url( $url ) {
|
||||
if ( isset( $url['mod'] ) )
|
||||
$date = mysql2date( "Y-m-d\TH:i:s+00:00", $url['mod'] );
|
||||
else
|
||||
$date = date( 'c' );
|
||||
$output = "\t<url>\n";
|
||||
$output .= "\t\t<loc>" . $url['loc'] . "</loc>\n";
|
||||
$output .= "\t\t<lastmod>" . $date . "</lastmod>\n";
|
||||
$output .= "\t\t<changefreq>" . $url['chf'] . "</changefreq>\n";
|
||||
$output .= "\t\t<priority>" . str_replace( ',', '.', $url['pri'] ) . "</priority>\n";
|
||||
if ( isset( $url['images'] ) && count( $url['images'] ) > 0 ) {
|
||||
foreach ( $url['images'] as $img ) {
|
||||
if ( !isset( $img['src'] ) || empty( $img['src'] ) )
|
||||
continue;
|
||||
$output .= "\t\t<image:image>\n";
|
||||
$output .= "\t\t\t<image:loc>" . esc_html( $img['src'] ) . "</image:loc>\n";
|
||||
if ( isset( $img['title'] ) && !empty( $img['title'] ) )
|
||||
$output .= "\t\t\t<image:title>" . _wp_specialchars( html_entity_decode( $img['title'], ENT_QUOTES, get_bloginfo( 'charset' ) ) ) . "</image:title>\n";
|
||||
if ( isset( $img['alt'] ) && !empty( $img['alt'] ) )
|
||||
$output .= "\t\t\t<image:caption>" . _wp_specialchars( html_entity_decode( $img['alt'], ENT_QUOTES, get_bloginfo( 'charset' ) ) ) . "</image:caption>\n";
|
||||
$output .= "\t\t</image:image>\n";
|
||||
}
|
||||
}
|
||||
$output .= "\t</url>\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a request for the sitemap index so as to cache it before the arrival of the search engines.
|
||||
*/
|
||||
function hit_sitemap_index() {
|
||||
$base = $GLOBALS['wp_rewrite']->using_index_permalinks() ? 'index.php/' : '';
|
||||
$url = home_url( $base . 'sitemap_index.xml' );
|
||||
wp_remote_get( $url );
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook into redirect_canonical to stop trailing slashes on sitemap.xml URLs
|
||||
*
|
||||
* @param string $redirect The redirect URL currently determined.
|
||||
* @return bool|string $redirect
|
||||
*/
|
||||
function canonical( $redirect ) {
|
||||
$sitemap = get_query_var( 'sitemap' );
|
||||
if ( !empty( $sitemap ) )
|
||||
return false;
|
||||
|
||||
return $redirect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the modification date for the last modified post in the post type:
|
||||
*
|
||||
* @param array $post_types Post types to get the last modification date for
|
||||
* @return string
|
||||
*/
|
||||
function get_last_modified( $post_types ) {
|
||||
global $wpdb;
|
||||
if ( !is_array( $post_types ) )
|
||||
$post_types = array( $post_types );
|
||||
|
||||
$result = 0;
|
||||
foreach ( $post_types as $post_type ) {
|
||||
$key = 'lastpostmodified:gmt:' . $post_type;
|
||||
$date = wp_cache_get( $key, 'timeinfo' );
|
||||
if ( !$date ) {
|
||||
$date = $wpdb->get_var( $wpdb->prepare( "SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status IN ('publish','inherit') AND post_type = %s ORDER BY post_modified_gmt DESC LIMIT 1", $post_type ) );
|
||||
if ( $date )
|
||||
wp_cache_set( $key, $date, 'timeinfo' );
|
||||
}
|
||||
if ( strtotime( $date ) > $result )
|
||||
$result = strtotime( $date );
|
||||
}
|
||||
|
||||
// Transform to W3C Date format.
|
||||
$result = date( 'c', $result );
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
global $wpseo_sitemaps;
|
||||
$wpseo_sitemaps = new WPSEO_Sitemaps();
|
||||
@@ -0,0 +1,367 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Internals
|
||||
*/
|
||||
|
||||
if ( !defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'HTTP/1.0 403 Forbidden' );
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value from the post custom values
|
||||
*
|
||||
* @param string $val name of the value to get
|
||||
* @param int $postid post ID of the post to get the value for
|
||||
* @return bool|mixed
|
||||
*/
|
||||
function wpseo_get_value( $val, $postid = 0 ) {
|
||||
$postid = absint( $postid );
|
||||
if ( $postid === 0 ) {
|
||||
global $post;
|
||||
if ( isset( $post ) && isset( $post->post_status ) && $post->post_status != 'auto-draft')
|
||||
$postid = $post->ID;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
$custom = get_post_custom( $postid );
|
||||
if ( !empty( $custom['_yoast_wpseo_' . $val][0] ) )
|
||||
return maybe_unserialize( $custom['_yoast_wpseo_' . $val][0] );
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $meta the meta to change
|
||||
* @param mixed $val the value to set the meta to
|
||||
* @param int $postid the ID of the post to change the meta for.
|
||||
*/
|
||||
function wpseo_set_value( $meta, $val, $postid ) {
|
||||
update_post_meta( $postid, '_yoast_wpseo_' . $meta, $val );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve an array of all the options the plugin uses. It can't use only one due to limitations of the options API.
|
||||
*
|
||||
* @return array of options.
|
||||
*/
|
||||
function get_wpseo_options_arr() {
|
||||
$optarr = array( 'wpseo', 'wpseo_permalinks', 'wpseo_titles', 'wpseo_rss', 'wpseo_internallinks', 'wpseo_xml', 'wpseo_social' );
|
||||
return apply_filters( 'wpseo_options', $optarr );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all the options for the SEO plugin in one go.
|
||||
*
|
||||
* @return array of options
|
||||
*/
|
||||
function get_wpseo_options() {
|
||||
static $options;
|
||||
|
||||
if ( !isset( $options ) ) {
|
||||
$options = array();
|
||||
foreach ( get_wpseo_options_arr() as $opt ) {
|
||||
$options = array_merge( $options, (array) get_option( $opt ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string the string to replace the variables in.
|
||||
* @param array $args the object some of the replacement values might come from, could be a post, taxonomy or term.
|
||||
* @param array $omit variables that should not be replaced by this function.
|
||||
* @return string
|
||||
*/
|
||||
function wpseo_replace_vars( $string, $args, $omit = array() ) {
|
||||
|
||||
$args = (array) $args;
|
||||
|
||||
$string = strip_tags( $string );
|
||||
|
||||
// Let's see if we can bail super early.
|
||||
if ( strpos( $string, '%%' ) === false )
|
||||
return trim( preg_replace( '/\s+/u', ' ', $string ) );
|
||||
|
||||
global $sep;
|
||||
if ( !isset( $sep ) || empty( $sep ) )
|
||||
$sep = '-';
|
||||
|
||||
$simple_replacements = array(
|
||||
'%%sep%%' => $sep,
|
||||
'%%sitename%%' => get_bloginfo( 'name' ),
|
||||
'%%sitedesc%%' => get_bloginfo( 'description' ),
|
||||
'%%currenttime%%' => date( get_option( 'time_format' ) ),
|
||||
'%%currentdate%%' => date( get_option( 'date_format' ) ),
|
||||
'%%currentday%%' => date( 'j' ),
|
||||
'%%currentmonth%%' => date( 'F' ),
|
||||
'%%currentyear%%' => date( 'Y' ),
|
||||
);
|
||||
|
||||
foreach ( $simple_replacements as $var => $repl ) {
|
||||
$string = str_replace( $var, $repl, $string );
|
||||
}
|
||||
|
||||
// Let's see if we can bail early.
|
||||
if ( strpos( $string, '%%' ) === false )
|
||||
return trim( preg_replace( '/\s+/u', ' ', $string ) );
|
||||
|
||||
global $wp_query;
|
||||
|
||||
$defaults = array(
|
||||
'ID' => '',
|
||||
'name' => '',
|
||||
'post_author' => '',
|
||||
'post_content' => '',
|
||||
'post_date' => '',
|
||||
'post_excerpt' => '',
|
||||
'post_modified' => '',
|
||||
'post_title' => '',
|
||||
'taxonomy' => '',
|
||||
'term_id' => '',
|
||||
);
|
||||
|
||||
if ( isset( $args['post_content'] ) )
|
||||
$args['post_content'] = wpseo_strip_shortcode( $args['post_content'] );
|
||||
if ( isset( $args['post_excerpt'] ) )
|
||||
$args['post_excerpt'] = wpseo_strip_shortcode( $args['post_excerpt'] );
|
||||
|
||||
$r = (object) wp_parse_args( $args, $defaults );
|
||||
|
||||
$max_num_pages = 1;
|
||||
if ( !is_single() ) {
|
||||
$pagenum = get_query_var( 'paged' );
|
||||
if ( $pagenum === 0 )
|
||||
$pagenum = 1;
|
||||
|
||||
if ( isset( $wp_query->max_num_pages ) && $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0 )
|
||||
$max_num_pages = $wp_query->max_num_pages;
|
||||
} else {
|
||||
global $post;
|
||||
$pagenum = get_query_var( 'page' );
|
||||
$max_num_pages = ( isset( $post->post_content ) ) ? substr_count( $post->post_content, '<!--nextpage-->' ) : 1;
|
||||
if ( $max_num_pages >= 1 )
|
||||
$max_num_pages++;
|
||||
}
|
||||
|
||||
// Let's do date first as it's a bit more work to get right.
|
||||
if ( $r->post_date != '' ) {
|
||||
$date = mysql2date( get_option( 'date_format' ), $r->post_date );
|
||||
} else {
|
||||
if ( get_query_var( 'day' ) && get_query_var( 'day' ) != '' ) {
|
||||
$date = get_the_date();
|
||||
} else {
|
||||
if ( single_month_title( ' ', false ) && single_month_title( ' ', false ) != '' ) {
|
||||
$date = single_month_title( ' ', false );
|
||||
} else if ( get_query_var( 'year' ) != '' ) {
|
||||
$date = get_query_var( 'year' );
|
||||
} else {
|
||||
$date = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$replacements = array(
|
||||
'%%date%%' => $date,
|
||||
'%%searchphrase%%' => esc_html( get_query_var( 's' ) ),
|
||||
'%%page%%' => ( $max_num_pages > 1 && $pagenum > 1 ) ? sprintf( $sep . ' ' . __( 'Page %d of %d', 'wordpress-seo' ), $pagenum, $max_num_pages ) : '',
|
||||
'%%pagetotal%%' => $max_num_pages,
|
||||
'%%pagenumber%%' => $pagenum,
|
||||
);
|
||||
|
||||
if ( isset( $r->ID ) ) {
|
||||
$replacements = array_merge( $replacements, array(
|
||||
'%%caption%%' => $r->post_excerpt,
|
||||
'%%category%%' => wpseo_get_terms( $r->ID, 'category' ),
|
||||
'%%excerpt%%' => ( !empty( $r->post_excerpt ) ) ? strip_tags( $r->post_excerpt ) : ( ( extension_loaded( 'mbstring' ) === true ) ? mb_substr( strip_shortcodes( strip_tags( $r->post_content ) ), 0, 155, 'UTF-8' ) : substr( strip_shortcodes( strip_tags( utf8_decode( $r->post_content ) ) ), 0, 155 ) ),
|
||||
'%%excerpt_only%%' => strip_tags( $r->post_excerpt ),
|
||||
'%%focuskw%%' => wpseo_get_value( 'focuskw', $r->ID ),
|
||||
'%%id%%' => $r->ID,
|
||||
'%%modified%%' => mysql2date( get_option( 'date_format' ), $r->post_modified ),
|
||||
'%%name%%' => get_the_author_meta( 'display_name', !empty( $r->post_author ) ? $r->post_author : get_query_var( 'author' ) ),
|
||||
'%%tag%%' => wpseo_get_terms( $r->ID, 'post_tag' ),
|
||||
'%%title%%' => stripslashes( $r->post_title ),
|
||||
'%%userid%%' => !empty( $r->post_author ) ? $r->post_author : get_query_var( 'author' ),
|
||||
) );
|
||||
}
|
||||
|
||||
if ( !empty( $r->taxonomy ) ) {
|
||||
$replacements = array_merge( $replacements, array(
|
||||
'%%category_description%%' => trim( strip_tags( get_term_field( 'description', $r->term_id, $r->taxonomy ) ) ),
|
||||
'%%tag_description%%' => trim( strip_tags( get_term_field( 'description', $r->term_id, $r->taxonomy ) ) ),
|
||||
'%%term_description%%' => trim( strip_tags( get_term_field( 'description', $r->term_id, $r->taxonomy ) ) ),
|
||||
'%%term_title%%' => $r->name,
|
||||
) );
|
||||
}
|
||||
|
||||
foreach ( $replacements as $var => $repl ) {
|
||||
if ( !in_array( $var, $omit ) )
|
||||
$string = str_replace( $var, $repl, $string );
|
||||
}
|
||||
|
||||
if ( strpos( $string, '%%' ) === false ) {
|
||||
$string = preg_replace( '/\s+/u', ' ', $string );
|
||||
return trim( $string );
|
||||
}
|
||||
|
||||
if ( isset( $wp_query->query_vars['post_type'] ) && preg_match_all( '/%%pt_([^%]+)%%/u', $string, $matches, PREG_SET_ORDER ) ) {
|
||||
$pt = get_post_type_object( $wp_query->query_vars['post_type'] );
|
||||
$pt_plural = $pt_singular = $pt->name;
|
||||
if ( isset( $pt->labels->singular_name ) )
|
||||
$pt_singular = $pt->labels->singular_name;
|
||||
if ( isset( $pt->labels->name ) )
|
||||
$pt_plural = $pt->labels->name;
|
||||
$string = str_replace( '%%pt_single%%', $pt_singular, $string );
|
||||
$string = str_replace( '%%pt_plural%%', $pt_plural, $string );
|
||||
}
|
||||
|
||||
if ( preg_match_all( '/%%cf_([^%]+)%%/u', $string, $matches, PREG_SET_ORDER ) ) {
|
||||
global $post;
|
||||
foreach ( $matches as $match ) {
|
||||
$string = str_replace( $match[0], get_post_meta( $post->ID, $match[1], true ), $string );
|
||||
}
|
||||
}
|
||||
|
||||
if ( preg_match_all( '/%%ct_desc_([^%]+)?%%/u', $string, $matches, PREG_SET_ORDER ) ) {
|
||||
global $post;
|
||||
foreach ( $matches as $match ) {
|
||||
$terms = get_the_terms( $post->ID, $match[1] );
|
||||
$string = str_replace( $match[0], get_term_field( 'description', $terms[0]->term_id, $match[1] ), $string );
|
||||
}
|
||||
}
|
||||
|
||||
if ( preg_match_all( '/%%ct_([^%]+)%%(single%%)?/u', $string, $matches, PREG_SET_ORDER ) ) {
|
||||
foreach ( $matches as $match ) {
|
||||
$single = false;
|
||||
if ( isset( $match[2] ) && $match[2] == 'single%%' )
|
||||
$single = true;
|
||||
$ct_terms = wpseo_get_terms( $r->ID, $match[1], $single );
|
||||
|
||||
$string = str_replace( $match[0], $ct_terms, $string );
|
||||
}
|
||||
}
|
||||
|
||||
$string = preg_replace( '/\s+/u', ' ', $string );
|
||||
return trim( $string );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a post's terms, comma delimited.
|
||||
*
|
||||
* @param int $id ID of the post to get the terms for.
|
||||
* @param string $taxonomy The taxonomy to get the terms for this post from.
|
||||
* @param bool $return_single If true, return the first term.
|
||||
* @return string either a single term or a comma delimited string of terms.
|
||||
*/
|
||||
function wpseo_get_terms( $id, $taxonomy, $return_single = false ) {
|
||||
// If we're on a specific tag, category or taxonomy page, return that and bail.
|
||||
if ( is_category() || is_tag() || is_tax() ) {
|
||||
global $wp_query;
|
||||
$term = $wp_query->get_queried_object();
|
||||
return $term->name;
|
||||
}
|
||||
|
||||
if ( empty( $id ) || empty( $taxonomy ) )
|
||||
return '';
|
||||
|
||||
$output = '';
|
||||
$terms = get_the_terms( $id, $taxonomy );
|
||||
if ( $terms ) {
|
||||
foreach ( $terms as $term ) {
|
||||
if ( $return_single )
|
||||
return $term->name;
|
||||
$output .= $term->name . ', ';
|
||||
}
|
||||
return rtrim( trim( $output ), ',' );
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a taxonomy term's meta value.
|
||||
*
|
||||
* @param string|object $term term to get the meta value for
|
||||
* @param string $taxonomy name of the taxonomy to which the term is attached
|
||||
* @param string $meta meta value to get
|
||||
* @return bool|mixed value when the meta exists, false when it does not
|
||||
*/
|
||||
function wpseo_get_term_meta( $term, $taxonomy, $meta ) {
|
||||
if ( is_string( $term ) )
|
||||
$term = get_term_by( 'slug', $term, $taxonomy );
|
||||
|
||||
if ( is_object( $term ) )
|
||||
$term = $term->term_id;
|
||||
else
|
||||
return false;
|
||||
|
||||
$tax_meta = get_option( 'wpseo_taxonomy_meta' );
|
||||
if ( isset( $tax_meta[$taxonomy][$term] ) )
|
||||
$tax_meta = $tax_meta[$taxonomy][$term];
|
||||
else
|
||||
return false;
|
||||
|
||||
return ( isset( $tax_meta['wpseo_' . $meta] ) ) ? $tax_meta['wpseo_' . $meta] : false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Strip out the shortcodes with a filthy regex, because people don't properly register their shortcodes.
|
||||
*
|
||||
* @param string $text input string that might contain shortcodes
|
||||
* @return string $text string without shortcodes
|
||||
*/
|
||||
function wpseo_strip_shortcode( $text ) {
|
||||
return preg_replace( '|\[[^\]]+\]|s', '', $text );
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize sitemaps. Add sitemap rewrite rules and query var
|
||||
*/
|
||||
function wpseo_xml_sitemaps_init() {
|
||||
$options = get_option( 'wpseo_xml' );
|
||||
if ( !isset( $options['enablexmlsitemap'] ) || !$options['enablexmlsitemap'] )
|
||||
return;
|
||||
|
||||
$GLOBALS['wp']->add_query_var( 'sitemap' );
|
||||
$GLOBALS['wp']->add_query_var( 'sitemap_n' );
|
||||
add_rewrite_rule( 'sitemap_index\.xml$', 'index.php?sitemap=1', 'top' );
|
||||
add_rewrite_rule( '([^/]+?)-sitemap([0-9]+)?\.xml$', 'index.php?sitemap=$matches[1]&sitemap_n=$matches[2]', 'top' );
|
||||
}
|
||||
|
||||
add_action( 'init', 'wpseo_xml_sitemaps_init', 1 );
|
||||
|
||||
/**
|
||||
* Notify search engines of the updated sitemap.
|
||||
*/
|
||||
function wpseo_ping_search_engines( $sitemapurl = null ) {
|
||||
$options = get_option( 'wpseo_xml' );
|
||||
$base = $GLOBALS['wp_rewrite']->using_index_permalinks() ? 'index.php/' : '';
|
||||
if ( $sitemapurl == null )
|
||||
$sitemapurl = urlencode( home_url( $base . 'sitemap_index.xml' ) );
|
||||
|
||||
// Always ping Google and Bing, optionally ping Ask and Yahoo!
|
||||
wp_remote_get( 'http://www.google.com/webmasters/tools/ping?sitemap=' . $sitemapurl );
|
||||
wp_remote_get( 'http://www.bing.com/webmaster/ping.aspx?sitemap=' . $sitemapurl );
|
||||
|
||||
if ( isset( $options['xml_ping_yahoo'] ) && $options['xml_ping_yahoo'] )
|
||||
wp_remote_get( 'http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=3usdTDLV34HbjQpIBuzMM1UkECFl5KDN7fogidABihmHBfqaebDuZk1vpLDR64I-&url=' . $sitemapurl );
|
||||
|
||||
if ( isset( $options['xml_ping_ask'] ) && $options['xml_ping_ask'] )
|
||||
wp_remote_get( 'http://submissions.ask.com/ping?sitemap=' . $sitemapurl );
|
||||
}
|
||||
add_action( 'wpseo_ping_search_engines', 'wpseo_ping_search_engines' );
|
||||
|
||||
function wpseo_store_tracking_response() {
|
||||
if ( ! wp_verify_nonce( $_POST['nonce'], 'wpseo_activate_tracking' ) )
|
||||
die();
|
||||
|
||||
$options = get_option( 'wpseo' );
|
||||
$options['tracking_popup'] = 'done';
|
||||
|
||||
if ( $_POST['allow_tracking'] == 'yes' )
|
||||
$options['yoast_tracking'] = true;
|
||||
|
||||
update_option( 'wpseo', $options );
|
||||
}
|
||||
add_action('wp_ajax_wpseo_allow_tracking', 'wpseo_store_tracking_response');
|
||||
@@ -0,0 +1,314 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Internals
|
||||
*/
|
||||
|
||||
if ( !defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'HTTP/1.0 403 Forbidden' );
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush the rewrite rules.
|
||||
*/
|
||||
function wpseo_flush_rules() {
|
||||
global $wp_rewrite;
|
||||
$wp_rewrite->flush_rules();
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs on activation of the plugin.
|
||||
*/
|
||||
function wpseo_activate() {
|
||||
wpseo_defaults();
|
||||
|
||||
wpseo_flush_rules();
|
||||
|
||||
wpseo_title_test();
|
||||
|
||||
// Clear cache so the changes are obvious.
|
||||
if ( function_exists( 'w3tc_pgcache_flush' ) ) {
|
||||
w3tc_pgcache_flush();
|
||||
} else if ( function_exists( 'wp_cache_clear_cache' ) ) {
|
||||
wp_cache_clear_cache();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default settings.
|
||||
*
|
||||
* This uses the currently available custom post types and taxonomies.
|
||||
*/
|
||||
function wpseo_defaults() {
|
||||
$options = get_option( 'wpseo' );
|
||||
if ( !is_array( $options ) ) {
|
||||
$opt = array(
|
||||
'disableadvanced_meta' => 'on',
|
||||
'version' => WPSEO_VERSION,
|
||||
);
|
||||
update_option( 'wpseo', $opt );
|
||||
}
|
||||
|
||||
if ( !is_array( get_option( 'wpseo_titles' ) ) ) {
|
||||
$opt = array(
|
||||
'title-home' => '%%sitename%% %%page%% %%sep%% %%sitedesc%%',
|
||||
'title-author' => sprintf( __( '%s, Author at %s', 'wordpress-seo' ), '%%name%%', '%%sitename%%' ) . ' %%page%% ',
|
||||
'title-archive' => '%%date%% %%page%% %%sep%% %%sitename%%',
|
||||
'title-search' => sprintf( __( 'You searched for %s', 'wordpress-seo' ), '%%searchphrase%%' ) . ' %%page%% %%sep%% %%sitename%%',
|
||||
'title-404' => __( 'Page Not Found', 'wordpress-seo' ) . ' %%sep%% %%sitename%%',
|
||||
'noindex-archive' => 'on',
|
||||
'noindex-post_format' => 'on',
|
||||
);
|
||||
foreach ( get_post_types( array( 'public' => true ), 'objects' ) as $pt ) {
|
||||
$opt['title-' . $pt->name] = '%%title%% %%page%% %%sep%% %%sitename%%';
|
||||
if ( $pt->has_archive )
|
||||
$opt['title-ptarchive-' . $pt->name] = sprintf( __( '%s Archive', 'wordpress-seo' ), '%%pt_plural%%' ) . ' %%page%% %%sep%% %%sitename%%';
|
||||
}
|
||||
foreach ( get_taxonomies( array( 'public' => true ) ) as $tax ) {
|
||||
$opt['title-' . $tax] = sprintf( __( '%s Archives', 'wordpress-seo' ), '%%term_title%%' ) . ' %%page%% %%sep%% %%sitename%%';
|
||||
}
|
||||
update_option( 'wpseo_titles', $opt );
|
||||
}
|
||||
|
||||
if ( !is_array( get_option( 'wpseo_xml' ) ) ) {
|
||||
$opt = array(
|
||||
'enablexmlsitemap' => 'on',
|
||||
'post_types-attachment-not_in_sitemap' => true
|
||||
);
|
||||
update_option( 'wpseo_xml', $opt );
|
||||
}
|
||||
|
||||
if ( !is_array( get_option( 'wpseo_social' ) ) ) {
|
||||
$opt = array(
|
||||
'opengraph' => 'on',
|
||||
);
|
||||
update_option( 'wpseo_social', $opt );
|
||||
}
|
||||
|
||||
if ( !is_array( get_option( 'wpseo_rss' ) ) ) {
|
||||
$opt = array(
|
||||
'rssafter' => sprintf( __( 'The post %s appeared first on %s.', 'wordpress-seo' ), '%%POSTLINK%%', '%%BLOGLINK%%' ),
|
||||
);
|
||||
update_option( 'wpseo_rss', $opt );
|
||||
}
|
||||
|
||||
// Force WooThemes to use WordPress SEO data.
|
||||
if ( function_exists( 'woo_version_init' ) ) {
|
||||
update_option( 'seo_woo_use_third_party_data', 'true' );
|
||||
}
|
||||
|
||||
wpseo_title_test();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test whether force rewrite should be enabled or not.
|
||||
*/
|
||||
function wpseo_title_test() {
|
||||
$options = get_option( 'wpseo_titles' );
|
||||
|
||||
if ( isset( $options['forcerewritetitle'] ) )
|
||||
unset( $options['forcerewritetitle'] );
|
||||
|
||||
$options['title_test'] = true;
|
||||
update_option( 'wpseo_titles', $options );
|
||||
|
||||
// Setting title_test to true forces the plugin to output the title below through a filter in class-frontend.php
|
||||
$expected_title = 'This is a Yoast Test Title';
|
||||
|
||||
if ( function_exists( 'w3tc_pgcache_flush' ) ) {
|
||||
w3tc_pgcache_flush();
|
||||
} else if ( function_exists( 'wp_cache_clear_cache' ) ) {
|
||||
wp_cache_clear_cache();
|
||||
}
|
||||
|
||||
global $wp_version;
|
||||
$args = array(
|
||||
'user-agent' => "WordPress/${wp_version}; " . get_site_url() . " - Yoast",
|
||||
);
|
||||
$resp = wp_remote_get( get_bloginfo( 'url' ), $args );
|
||||
|
||||
// echo '<pre>'.$resp['body'].'</pre>';
|
||||
|
||||
if ( $resp && !is_wp_error( $resp ) && 200 == $resp['response']['code'] ) {
|
||||
$res = preg_match( '/<title>([^<]+)<\/title>/im', $resp['body'], $matches );
|
||||
|
||||
if ( $res && strcmp( $matches[1], $expected_title ) !== 0 ) {
|
||||
$options['forcerewritetitle'] = 'on';
|
||||
update_option( 'wpseo_titles', $options );
|
||||
|
||||
$resp = wp_remote_get( get_bloginfo( 'url' ), $args );
|
||||
|
||||
$res = preg_match( '/<title>([^>]+)<\/title>/im', $resp['body'], $matches );
|
||||
}
|
||||
|
||||
if ( !$res || $matches[1] != $expected_title )
|
||||
unset( $options['forcerewritetitle'] );
|
||||
} else {
|
||||
// If that dies, let's make sure the titles are correct and force the output.
|
||||
$options['forcerewritetitle'] = 'on';
|
||||
}
|
||||
|
||||
unset( $options['title_test'] );
|
||||
update_option( 'wpseo_titles', $options );
|
||||
}
|
||||
|
||||
add_filter( 'switch_theme', 'wpseo_title_test', 0 );
|
||||
|
||||
/**
|
||||
* On deactivation, flush the rewrite rules so XML sitemaps stop working.
|
||||
*/
|
||||
function wpseo_deactivate() {
|
||||
wpseo_flush_rules();
|
||||
|
||||
// Clear cache so the changes are obvious.
|
||||
if ( function_exists( 'w3tc_pgcache_flush' ) ) {
|
||||
w3tc_pgcache_flush();
|
||||
} else if ( function_exists( 'wp_cache_clear_cache' ) ) {
|
||||
wp_cache_clear_cache();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a decimal analysis score into a textual one.
|
||||
*
|
||||
* @param int $val The decimal score to translate.
|
||||
* @return string
|
||||
*/
|
||||
function wpseo_translate_score( $val ) {
|
||||
switch ( $val ) {
|
||||
case 0:
|
||||
$score = 'na';
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
$score = 'poor';
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
$score = 'ok';
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
$score = 'good';
|
||||
break;
|
||||
default:
|
||||
$score = 'bad';
|
||||
break;
|
||||
}
|
||||
return $score;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an SEO admin bar menu with several options. If the current user is an admin he can also go straight to several settings menu's from here.
|
||||
*/
|
||||
function wpseo_admin_bar_menu() {
|
||||
// If the current user can't write posts, this is all of no use, so let's not output an admin menu
|
||||
if ( !current_user_can( 'edit_posts' ) )
|
||||
return;
|
||||
|
||||
global $wp_admin_bar, $wpseo_front, $post;
|
||||
|
||||
if ( is_object( $wpseo_front ) ) {
|
||||
$url = $wpseo_front->canonical( false );
|
||||
} else {
|
||||
$url = '';
|
||||
}
|
||||
|
||||
$focuskw = '';
|
||||
$score = '';
|
||||
$seo_url = get_admin_url( null, 'admin.php?page=wpseo_dashboard' );
|
||||
|
||||
if ( is_singular() && isset( $post ) && is_object( $post ) && apply_filters( 'wpseo_use_page_analysis', true ) === true ) {
|
||||
$focuskw = wpseo_get_value( 'focuskw', $post->ID );
|
||||
$perc_score = wpseo_get_value( 'linkdex', $post->ID );
|
||||
$txtscore = wpseo_translate_score( round( $perc_score / 10 ) );
|
||||
$score = '<div title="' . ucfirst( $txtscore ) . '" class="wpseo_score_img ' . $txtscore . ' ' . $perc_score . '"></div>';
|
||||
$seo_url = get_edit_post_link( $post->ID );
|
||||
if ( $txtscore != 'na' )
|
||||
$seo_url .= '#wpseo_linkdex';
|
||||
}
|
||||
|
||||
$wp_admin_bar->add_menu( array( 'id' => 'wpseo-menu', 'title' => __( 'SEO', 'wordpress-seo' ) . $score, 'href' => $seo_url, ) );
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'wpseo-menu', 'id' => 'wpseo-kwresearch', 'title' => __( 'Keyword Research', 'wordpress-seo' ), '#', ) );
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'wpseo-kwresearch', 'id' => 'wpseo-adwordsexternal', 'title' => __( 'AdWords External', 'wordpress-seo' ), 'href' => 'https://adwords.google.com/select/KeywordToolExternal', 'meta' => array( 'target' => '_blank' ) ) );
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'wpseo-kwresearch', 'id' => 'wpseo-googleinsights', 'title' => __( 'Google Insights', 'wordpress-seo' ), 'href' => 'http://www.google.com/insights/search/#q=' . urlencode( $focuskw ) . '&cmpt=q', 'meta' => array( 'target' => '_blank' ) ) );
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'wpseo-kwresearch', 'id' => 'wpseo-wordtracker', 'title' => __( 'SEO Book', 'wordpress-seo' ), 'href' => 'http://tools.seobook.com/keyword-tools/seobook/?keyword=' . urlencode( $focuskw ), 'meta' => array( 'target' => '_blank' ) ) );
|
||||
|
||||
if ( !is_admin() ) {
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'wpseo-menu', 'id' => 'wpseo-analysis', 'title' => __( 'Analyze this page', 'wordpress-seo' ), '#', ) );
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'wpseo-analysis', 'id' => 'wpseo-inlinks-ose', 'title' => __( 'Check Inlinks (OSE)', 'wordpress-seo' ), 'href' => 'http://www.opensiteexplorer.org/' . str_replace( '/', '%252F', preg_replace( '/^https?:\/\//', '', $url ) ) . '/a!links', 'meta' => array( 'target' => '_blank' ) ) );
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'wpseo-analysis', 'id' => 'wpseo-kwdensity', 'title' => __( 'Check Keyword Density', 'wordpress-seo' ), 'href' => 'http://tools.davidnaylor.co.uk/keyworddensity/index.php?url=' . $url . '&keyword=' . urlencode( $focuskw ), 'meta' => array( 'target' => '_blank' ) ) );
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'wpseo-analysis', 'id' => 'wpseo-cache', 'title' => __( 'Check Google Cache', 'wordpress-seo' ), 'href' => 'http://webcache.googleusercontent.com/search?strip=1&q=cache:' . $url, 'meta' => array( 'target' => '_blank' ) ) );
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'wpseo-analysis', 'id' => 'wpseo-header', 'title' => __( 'Check Headers', 'wordpress-seo' ), 'href' => 'http://quixapp.com/headers/?r=' . urlencode( $url ), 'meta' => array( 'target' => '_blank' ) ) );
|
||||
}
|
||||
|
||||
$admin_menu = false;
|
||||
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
|
||||
$options = get_site_option( 'wpseo_ms' );
|
||||
if ( is_array( $options ) && isset( $options['access'] ) && $options['access'] == 'superadmin' ) {
|
||||
if ( is_super_admin() )
|
||||
$admin_menu = true;
|
||||
else
|
||||
$admin_menu = false;
|
||||
} else {
|
||||
if ( current_user_can( 'manage_options' ) )
|
||||
$admin_menu = true;
|
||||
else
|
||||
$admin_menu = false;
|
||||
}
|
||||
} else {
|
||||
if ( current_user_can( 'manage_options' ) )
|
||||
$admin_menu = true;
|
||||
}
|
||||
|
||||
if ( $admin_menu ) {
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'wpseo-menu', 'id' => 'wpseo-settings', 'title' => __( 'SEO Settings', 'wordpress-seo' ), 'href' => admin_url( 'admin.php?page=wpseo_titles' ), ) );
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'wpseo-settings', 'id' => 'wpseo-titles', 'title' => __( "Titles & Metas", 'wordpress-seo' ), 'href' => admin_url( 'admin.php?page=wpseo_titles' ), ) );
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'wpseo-settings', 'id' => 'wpseo-social', 'title' => __( 'Social', 'wordpress-seo' ), 'href' => admin_url( 'admin.php?page=wpseo_social' ), ) );
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'wpseo-settings', 'id' => 'wpseo-xml', 'title' => __( 'XML Sitemaps', 'wordpress-seo' ), 'href' => admin_url( 'admin.php?page=wpseo_xml' ), ) );
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'wpseo-settings', 'id' => 'wpseo-permalinks', 'title' => __( 'Permalinks', 'wordpress-seo' ), 'href' => admin_url( 'admin.php?page=wpseo_permalinks' ), ) );
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'wpseo-settings', 'id' => 'wpseo-internal-links', 'title' => __( 'Internal Links', 'wordpress-seo' ), 'href' => admin_url( 'admin.php?page=wpseo_internal-links' ), ) );
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'wpseo-settings', 'id' => 'wpseo-rss', 'title' => __( 'RSS', 'wordpress-seo' ), 'href' => admin_url( 'admin.php?page=wpseo_rss' ), ) );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'admin_bar_menu', 'wpseo_admin_bar_menu', 95 );
|
||||
|
||||
/**
|
||||
* Enqueue a tiny bit of CSS to show so the adminbar shows right.
|
||||
*/
|
||||
function wpseo_admin_bar_css() {
|
||||
if ( is_admin_bar_showing() && is_singular() )
|
||||
wp_enqueue_style( 'boxes', WPSEO_URL . 'css/adminbar.css', WPSEO_VERSION );
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'wpseo_admin_bar_css' );
|
||||
|
||||
/**
|
||||
* Allows editing of the meta fields through weblog editors like Marsedit.
|
||||
*
|
||||
* @param array $allcaps Capabilities that must all be true to allow action.
|
||||
* @param array $cap Array of capabilities to be checked, unused here.
|
||||
* @param array $args List of arguments for the specific cap to be checked.
|
||||
*
|
||||
* @return array $allcaps
|
||||
*/
|
||||
function allow_custom_field_edits( $allcaps, $cap, $args ) {
|
||||
// $args[0] holds the capability
|
||||
// $args[2] holds the post ID
|
||||
// $args[3] holds the custom field
|
||||
|
||||
// Make sure the request is to edit or add a post meta (this is usually also the second value in $cap,
|
||||
// but this is safer to check).
|
||||
if ( in_array( $args[0], array( "edit_post_meta", "add_post_meta" ) ) ) {
|
||||
// Only allow editing rights for users who have the rights to edit this post and make sure
|
||||
// the meta value starts with _yoast_wpseo.
|
||||
if ( current_user_can( 'edit_post', $args[2] ) && strpos( $args[3], "_yoast_wpseo_" ) === 0 )
|
||||
$allcaps[$args[0]] = true;
|
||||
}
|
||||
|
||||
return $allcaps;
|
||||
}
|
||||
add_filter( 'user_has_cap', 'allow_custom_field_edits', 0, 3 );
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* jQuery UI Autocomplete 1.8.12
|
||||
*
|
||||
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://docs.jquery.com/UI/Autocomplete
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.position.js
|
||||
*/
|
||||
(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.attr("readonly"))){g=
|
||||
false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!=
|
||||
a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)};
|
||||
this.menu=d("<ul></ul>").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&&
|
||||
a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");
|
||||
d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&&
|
||||
b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source=
|
||||
this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)!==false)return this._search(a)},_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){if(!this.options.disabled&&a&&a.length){a=this._normalize(a);this._suggest(a);this._trigger("open")}else this.close();
|
||||
this.pending--;this.pending||this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.deactivate();this._trigger("close",a)}},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return d.map(a,function(b){if(typeof b==="string")return{label:b,value:b};return d.extend({label:b.label||
|
||||
b.value,value:b.value||b.label},b)})},_suggest:function(a){var b=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(b,a);this.menu.deactivate();this.menu.refresh();b.show();this._resizeMenu();b.position(d.extend({of:this.element},this.options.position));this.options.autoFocus&&this.menu.next(new d.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(a,b){var g=this;
|
||||
d.each(b,function(c,f){g._renderItem(a,f)})},_renderItem:function(a,b){return d("<li></li>").data("item.autocomplete",b).append(d("<a></a>").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,
|
||||
"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery);
|
||||
(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
|
||||
-1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.attr("scrollTop"),c=this.element.height();if(b<0)this.element.attr("scrollTop",g+b);else b>=c&&this.element.attr("scrollTop",g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})},
|
||||
deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0);
|
||||
e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b,this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e,
|
||||
g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first"));
|
||||
this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element.attr("scrollHeight")},select:function(e){this._trigger("selected",e,{item:this.active})}})})(jQuery);
|
||||
;
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* jquery.qtip. The jQuery tooltip plugin
|
||||
*
|
||||
* Copyright (c) 2009 Craig Thompson
|
||||
* http://craigsworks.com
|
||||
*
|
||||
* Licensed under MIT
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* Launch : February 2009
|
||||
* Version : 1.0.0-rc3
|
||||
* Released: Tuesday 12th May, 2009 - 00:00
|
||||
* Debug: jquery.qtip.debug.js
|
||||
*/
|
||||
(function(f){f.fn.qtip=function(B,u){var y,t,A,s,x,w,v,z;if(typeof B=="string"){if(typeof f(this).data("qtip")!=="object"){f.fn.qtip.log.error.call(self,1,f.fn.qtip.constants.NO_TOOLTIP_PRESENT,false)}if(B=="api"){return f(this).data("qtip").interfaces[f(this).data("qtip").current]}else{if(B=="interfaces"){return f(this).data("qtip").interfaces}}}else{if(!B){B={}}if(typeof B.content!=="object"||(B.content.jquery&&B.content.length>0)){B.content={text:B.content}}if(typeof B.content.title!=="object"){B.content.title={text:B.content.title}}if(typeof B.position!=="object"){B.position={corner:B.position}}if(typeof B.position.corner!=="object"){B.position.corner={target:B.position.corner,tooltip:B.position.corner}}if(typeof B.show!=="object"){B.show={when:B.show}}if(typeof B.show.when!=="object"){B.show.when={event:B.show.when}}if(typeof B.show.effect!=="object"){B.show.effect={type:B.show.effect}}if(typeof B.hide!=="object"){B.hide={when:B.hide}}if(typeof B.hide.when!=="object"){B.hide.when={event:B.hide.when}}if(typeof B.hide.effect!=="object"){B.hide.effect={type:B.hide.effect}}if(typeof B.style!=="object"){B.style={name:B.style}}B.style=c(B.style);s=f.extend(true,{},f.fn.qtip.defaults,B);s.style=a.call({options:s},s.style);s.user=f.extend(true,{},B)}return f(this).each(function(){if(typeof B=="string"){w=B.toLowerCase();A=f(this).qtip("interfaces");if(typeof A=="object"){if(u===true&&w=="destroy"){while(A.length>0){A[A.length-1].destroy()}}else{if(u!==true){A=[f(this).qtip("api")]}for(y=0;y<A.length;y++){if(w=="destroy"){A[y].destroy()}else{if(A[y].status.rendered===true){if(w=="show"){A[y].show()}else{if(w=="hide"){A[y].hide()}else{if(w=="focus"){A[y].focus()}else{if(w=="disable"){A[y].disable(true)}else{if(w=="enable"){A[y].disable(false)}}}}}}}}}}}else{v=f.extend(true,{},s);v.hide.effect.length=s.hide.effect.length;v.show.effect.length=s.show.effect.length;if(v.position.container===false){v.position.container=f(document.body)}if(v.position.target===false){v.position.target=f(this)}if(v.show.when.target===false){v.show.when.target=f(this)}if(v.hide.when.target===false){v.hide.when.target=f(this)}t=f.fn.qtip.interfaces.length;for(y=0;y<t;y++){if(typeof f.fn.qtip.interfaces[y]=="undefined"){t=y;break}}x=new d(f(this),v,t);f.fn.qtip.interfaces[t]=x;if(typeof f(this).data("qtip")=="object"){if(typeof f(this).attr("qtip")==="undefined"){f(this).data("qtip").current=f(this).data("qtip").interfaces.length}f(this).data("qtip").interfaces.push(x)}else{f(this).data("qtip",{current:0,interfaces:[x]})}if(v.content.prerender===false&&v.show.when.event!==false&&v.show.ready!==true){v.show.when.target.bind(v.show.when.event+".qtip-"+t+"-create",{qtip:t},function(C){z=f.fn.qtip.interfaces[C.data.qtip];z.options.show.when.target.unbind(z.options.show.when.event+".qtip-"+C.data.qtip+"-create");z.cache.mouse={x:C.pageX,y:C.pageY};p.call(z);z.options.show.when.target.trigger(z.options.show.when.event)})}else{x.cache.mouse={x:v.show.when.target.offset().left,y:v.show.when.target.offset().top};p.call(x)}}})};function d(u,t,v){var s=this;s.id=v;s.options=t;s.status={animated:false,rendered:false,disabled:false,focused:false};s.elements={target:u.addClass(s.options.style.classes.target),tooltip:null,wrapper:null,content:null,contentWrapper:null,title:null,button:null,tip:null,bgiframe:null};s.cache={mouse:{},position:{},toggle:0};s.timers={};f.extend(s,s.options.api,{show:function(y){var x,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"show")}if(s.elements.tooltip.css("display")!=="none"){return s}s.elements.tooltip.stop(true,false);x=s.beforeShow.call(s,y);if(x===false){return s}function w(){if(s.options.position.type!=="static"){s.focus()}s.onShow.call(s,y);if(f.browser.msie){s.elements.tooltip.get(0).style.removeAttribute("filter")}}s.cache.toggle=1;if(s.options.position.type!=="static"){s.updatePosition(y,(s.options.show.effect.length>0))}if(typeof s.options.show.solo=="object"){z=f(s.options.show.solo)}else{if(s.options.show.solo===true){z=f("div.qtip").not(s.elements.tooltip)}}if(z){z.each(function(){if(f(this).qtip("api").status.rendered===true){f(this).qtip("api").hide()}})}if(typeof s.options.show.effect.type=="function"){s.options.show.effect.type.call(s.elements.tooltip,s.options.show.effect.length);s.elements.tooltip.queue(function(){w();f(this).dequeue()})}else{switch(s.options.show.effect.type.toLowerCase()){case"fade":s.elements.tooltip.fadeIn(s.options.show.effect.length,w);break;case"slide":s.elements.tooltip.slideDown(s.options.show.effect.length,function(){w();if(s.options.position.type!=="static"){s.updatePosition(y,true)}});break;case"grow":s.elements.tooltip.show(s.options.show.effect.length,w);break;default:s.elements.tooltip.show(null,w);break}s.elements.tooltip.addClass(s.options.style.classes.active)}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_SHOWN,"show")},hide:function(y){var x;if(!s.status.rendered){return f.fn.qtip.log.error.caLine truncated
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
function wpseo_setIgnore( option, hide, nonce ) {
|
||||
jQuery.post(ajaxurl, {
|
||||
action: 'wpseo_set_ignore',
|
||||
option: option,
|
||||
_wpnonce: nonce
|
||||
}, function(data) {
|
||||
if (data) {
|
||||
jQuery('#'+hide).hide();
|
||||
jQuery('#hidden_ignore_'+option).val('ignore');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
jQuery(document).ready(function () {
|
||||
jQuery("#enablexmlsitemap").change(function() {
|
||||
if (jQuery("#enablexmlsitemap").is(':checked')) {
|
||||
jQuery("#sitemapinfo").css("display","block");
|
||||
} else {
|
||||
jQuery("#sitemapinfo").css("display","none");
|
||||
}
|
||||
}).change();
|
||||
jQuery("#cleanpermalinks").change(function() {
|
||||
if (jQuery("#cleanpermalinks").is(':checked')) {
|
||||
jQuery("#cleanpermalinksdiv").css("display","block");
|
||||
} else {
|
||||
jQuery("#cleanpermalinksdiv").css("display","none");
|
||||
}
|
||||
}).change();
|
||||
});
|
||||
|
||||
function setWPOption( option, newval, hide, nonce ) {
|
||||
jQuery.post(ajaxurl, {
|
||||
action: 'wpseo_set_option',
|
||||
option: option,
|
||||
newval: newval,
|
||||
_wpnonce: nonce
|
||||
}, function(data) {
|
||||
if (data)
|
||||
jQuery('#'+hide).hide();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function wpseo_killBlockingFiles( nonce ) {
|
||||
jQuery.post( ajaxurl, {
|
||||
action: 'wpseo_kill_blocking_files',
|
||||
_ajax_nonce: nonce
|
||||
}, function(data) {
|
||||
if (data == 'success')
|
||||
jQuery('#blocking_files').hide();
|
||||
else
|
||||
jQuery('#block_files').html(data);
|
||||
});
|
||||
}
|
||||
|
||||
jQuery(document).ready(function(){
|
||||
var active_tab = window.location.hash.replace('#top#','');
|
||||
if ( active_tab == '' )
|
||||
active_tab = 'general';
|
||||
jQuery('#'+active_tab).addClass('active');
|
||||
jQuery('#'+active_tab+'-tab').addClass('nav-tab-active');
|
||||
|
||||
jQuery('#wpseo-tabs a').click(function() {
|
||||
jQuery('#wpseo-tabs a').removeClass('nav-tab-active');
|
||||
jQuery('.wpseotab').removeClass('active');
|
||||
|
||||
var id = jQuery(this).attr('id').replace('-tab','');
|
||||
jQuery('#'+id).addClass('active');
|
||||
jQuery(this).addClass('nav-tab-active');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,370 @@
|
||||
function yst_clean( str ) {
|
||||
if ( str == '' || str == undefined )
|
||||
return '';
|
||||
|
||||
try {
|
||||
str = str.replace(/<\/?[^>]+>/gi, '');
|
||||
str = str.replace(/\[(.+?)\](.+?\[\/\\1\])?/, '');
|
||||
} catch(e) {}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function ptest(str, p) {
|
||||
str = yst_clean( str );
|
||||
str = str.toLowerCase();
|
||||
var r = str.match(p);
|
||||
if (r != null)
|
||||
return '<span class="good">Yes ('+r.length+')</span>';
|
||||
else
|
||||
return '<span class="wrong">No</span>';
|
||||
}
|
||||
|
||||
function removeLowerCaseDiacritics ( str ) {
|
||||
var defaultDiacriticsRemovalMap = [
|
||||
{'base':'a', 'letters':/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},
|
||||
{'base':'aa','letters':/[\uA733]/g},
|
||||
{'base':'ae','letters':/[\u00E6\u01FD\u01E3]/g},
|
||||
{'base':'ao','letters':/[\uA735]/g},
|
||||
{'base':'au','letters':/[\uA737]/g},
|
||||
{'base':'av','letters':/[\uA739\uA73B]/g},
|
||||
{'base':'ay','letters':/[\uA73D]/g},
|
||||
{'base':'b', 'letters':/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},
|
||||
{'base':'c', 'letters':/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},
|
||||
{'base':'d', 'letters':/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},
|
||||
{'base':'dz','letters':/[\u01F3\u01C6]/g},
|
||||
{'base':'e', 'letters':/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},
|
||||
{'base':'f', 'letters':/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},
|
||||
{'base':'g', 'letters':/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},
|
||||
{'base':'h', 'letters':/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},
|
||||
{'base':'hv','letters':/[\u0195]/g},
|
||||
{'base':'i', 'letters':/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},
|
||||
{'base':'j', 'letters':/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},
|
||||
{'base':'k', 'letters':/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},
|
||||
{'base':'l', 'letters':/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},
|
||||
{'base':'lj','letters':/[\u01C9]/g},
|
||||
{'base':'m', 'letters':/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},
|
||||
{'base':'n', 'letters':/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},
|
||||
{'base':'nj','letters':/[\u01CC]/g},
|
||||
{'base':'o', 'letters':/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},
|
||||
{'base':'oi','letters':/[\u01A3]/g},
|
||||
{'base':'ou','letters':/[\u0223]/g},
|
||||
{'base':'oo','letters':/[\uA74F]/g},
|
||||
{'base':'p','letters':/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},
|
||||
{'base':'q','letters':/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},
|
||||
{'base':'r','letters':/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},
|
||||
{'base':'s','letters':/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},
|
||||
{'base':'t','letters':/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},
|
||||
{'base':'tz','letters':/[\uA729]/g},
|
||||
{'base':'u','letters':/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},
|
||||
{'base':'v','letters':/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},
|
||||
{'base':'vy','letters':/[\uA761]/g},
|
||||
{'base':'w','letters':/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},
|
||||
{'base':'x','letters':/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},
|
||||
{'base':'y','letters':/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},
|
||||
{'base':'z','letters':/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}
|
||||
];
|
||||
var changes;
|
||||
if(!changes) {
|
||||
changes = defaultDiacriticsRemovalMap;
|
||||
}
|
||||
for(var i=0; i<changes.length; i++) {
|
||||
str = str.replace(changes[i].letters, changes[i].base);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
function testFocusKw() {
|
||||
// Retrieve focus keyword and trim
|
||||
var focuskw = jQuery.trim( jQuery('#yoast_wpseo_focuskw').val() );
|
||||
focuskw = focuskw.toLowerCase();
|
||||
|
||||
var postname = jQuery('#editable-post-name-full').text();
|
||||
var url = wpseo_permalink_template.replace('%postname%', postname).replace('http://','');
|
||||
|
||||
p = new RegExp("(^|[ \s\n\r\t\.,'\(\"\+;!?:\-])"+focuskw+"($|[ \s\n\r\t.,'\)\"\+!?:;\-])",'gim');
|
||||
//remove diacritics of a lower cased focuskw for url matching in foreign lang
|
||||
var focuskwNoDiacritics = removeLowerCaseDiacritics( focuskw );
|
||||
p2 = new RegExp(focuskwNoDiacritics.replace(/\s+/g,"[-_\\\//]"),'gim');
|
||||
|
||||
if (focuskw != '') {
|
||||
var html = '<p>Your focus keyword was found in:<br/>';
|
||||
html += 'Article Heading: ' + ptest( jQuery('#title').val(), p ) + '<br/>';
|
||||
html += 'Page title: ' + ptest( jQuery('#wpseosnippet .title').text(), p ) + '<br/>';
|
||||
html += 'Page URL: ' + ptest( url, p2 ) + '<br/>';
|
||||
html += 'Content: ' + ptest( jQuery('#content').val(), p ) + '<br/>';
|
||||
html += 'Meta description: ' + ptest( jQuery('#yoast_wpseo_metadesc').val(), p );
|
||||
html += '</p>';
|
||||
jQuery('#focuskwresults').html(html);
|
||||
} else {
|
||||
jQuery('#focuskwresults').html('');
|
||||
}
|
||||
}
|
||||
|
||||
function updateTitle( force ) {
|
||||
if ( jQuery("#yoast_wpseo_title").val() ) {
|
||||
var title = jQuery("#yoast_wpseo_title").val();
|
||||
} else {
|
||||
var title = wpseo_title_template.replace('%%title%%', jQuery('#title').val() );
|
||||
}
|
||||
if ( title == '' ) {
|
||||
jQuery('#wpseosnippet .title').html( '' );
|
||||
jQuery('#yoast_wpseo_title-length').html( '' );
|
||||
return;
|
||||
}
|
||||
|
||||
title = jQuery('<div />').html(title).text();
|
||||
|
||||
if ( force )
|
||||
jQuery('#yoast_wpseo_title').val( title );
|
||||
else
|
||||
jQuery('#yoast_wpseo_title').attr( 'placeholder', title );
|
||||
|
||||
title = yst_clean( title );
|
||||
title = jQuery.trim( title );
|
||||
|
||||
if ( title.length > 70 ) {
|
||||
var space = title.lastIndexOf( " ", 67 );
|
||||
title = title.substring( 0, space ).concat( ' <strong>...</strong>' );
|
||||
}
|
||||
var len = 70 - title.length;
|
||||
if (len < 0)
|
||||
len = '<span class="wrong">'+len+'</span>';
|
||||
else
|
||||
len = '<span class="good">'+len+'</span>';
|
||||
|
||||
title = boldKeywords( title, false );
|
||||
|
||||
jQuery('#wpseosnippet .title').html( title );
|
||||
jQuery('#yoast_wpseo_title-length').html( len );
|
||||
testFocusKw();
|
||||
}
|
||||
|
||||
function updateDesc( desc ) {
|
||||
var autogen = false;
|
||||
var desc = jQuery.trim( yst_clean( jQuery("#yoast_wpseo_metadesc").val() ) );
|
||||
var color = '#000';
|
||||
|
||||
if ( desc == '' ) {
|
||||
if ( wpseo_metadesc_template != '' ) {
|
||||
var excerpt = yst_clean( jQuery("#excerpt").val() );
|
||||
desc = wpseo_metadesc_template.replace('%%excerpt_only%%', excerpt);
|
||||
desc = desc.replace('%%excerpt%%', excerpt);
|
||||
}
|
||||
|
||||
desc = jQuery.trim ( desc );
|
||||
|
||||
if ( desc == '' ) {
|
||||
desc = jQuery("#content").val();
|
||||
desc = yst_clean( desc );
|
||||
|
||||
var focuskw = jQuery.trim( jQuery('#yoast_wpseo_focuskw').val() );
|
||||
if ( focuskw != '' ) {
|
||||
var descsearch = new RegExp( focuskw, 'gim');
|
||||
if ( desc.search(descsearch) != -1 && desc.length > wpseo_meta_desc_length ) {
|
||||
desc = desc.substr( desc.search(descsearch), wpseo_meta_desc_length );
|
||||
} else {
|
||||
desc = desc.substr( 0, wpseo_meta_desc_length );
|
||||
}
|
||||
} else {
|
||||
desc = desc.substr( 0, wpseo_meta_desc_length );
|
||||
}
|
||||
var color = "#888";
|
||||
autogen = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !autogen )
|
||||
var len = wpseo_meta_desc_length - desc.length;
|
||||
else
|
||||
var len = wpseo_meta_desc_length;
|
||||
|
||||
if (len < 0)
|
||||
len = '<span class="wrong">'+len+'</span>';
|
||||
else
|
||||
len = '<span class="good">'+len+'</span>';
|
||||
|
||||
if ( autogen || desc.length > wpseo_meta_desc_length ) {
|
||||
if ( desc.length > wpseo_meta_desc_length )
|
||||
var space = desc.lastIndexOf( " ", ( wpseo_meta_desc_length - 3 ) );
|
||||
else
|
||||
var space = wpseo_meta_desc_length;
|
||||
desc = desc.substring( 0, space ).concat( ' <strong>...</strong>' );
|
||||
}
|
||||
|
||||
desc = boldKeywords( desc, false );
|
||||
|
||||
jQuery('#yoast_wpseo_metadesc-length').html(len);
|
||||
jQuery("#wpseosnippet .desc span.content").css( 'color', color );
|
||||
jQuery("#wpseosnippet .desc span.content").html( desc );
|
||||
testFocusKw();
|
||||
}
|
||||
|
||||
function updateURL() {
|
||||
var name = jQuery('#editable-post-name-full').text();
|
||||
var url = wpseo_permalink_template.replace('%postname%', name).replace('http://','');
|
||||
url = boldKeywords( url, true );
|
||||
jQuery("#wpseosnippet .url").html( url );
|
||||
testFocusKw();
|
||||
}
|
||||
|
||||
function boldKeywords( str, url ) {
|
||||
focuskw = jQuery.trim( jQuery('#yoast_wpseo_focuskw').val() );
|
||||
|
||||
if ( focuskw == '' )
|
||||
return str;
|
||||
|
||||
if ( focuskw.search(' ') != -1 ) {
|
||||
var keywords = focuskw.split(' ');
|
||||
} else {
|
||||
var keywords = new Array( focuskw );
|
||||
}
|
||||
for (var i=0;i<keywords.length;i++) {
|
||||
var kw = yst_clean( keywords[i] );
|
||||
if ( url ) {
|
||||
var kw = kw.replace(' ','-').toLowerCase();
|
||||
kwregex = new RegExp( "([-/])("+kw+")([-/])?" );
|
||||
} else {
|
||||
kwregex = new RegExp( "(^|[ \s\n\r\t\.,'\(\"\+;!?:\-]+)("+kw+")($|[ \s\n\r\t\.,'\)\"\+;!?:\-]+)", 'gim' );
|
||||
}
|
||||
str = str.replace( kwregex, "$1<strong>$2</strong>$3" );
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
function updateSnippet() {
|
||||
updateURL();
|
||||
updateTitle();
|
||||
updateDesc();
|
||||
}
|
||||
|
||||
jQuery(document).ready(function(){
|
||||
var active_tab = window.location.hash;
|
||||
if ( active_tab == '' || active_tab.search('wpseo') == -1 )
|
||||
active_tab = 'general';
|
||||
else
|
||||
active_tab = active_tab.replace('#wpseo_','');
|
||||
|
||||
jQuery('.'+active_tab).addClass('active');
|
||||
|
||||
|
||||
jQuery('a.wpseo_tablink').click( function($) {
|
||||
jQuery('.wpseo-metabox-tabs li').removeClass('active');
|
||||
jQuery('.wpseotab').removeClass('active');
|
||||
|
||||
var id = jQuery(this).attr('href').replace('#wpseo_','');
|
||||
jQuery('.'+id).addClass('active');
|
||||
jQuery(this).parent().addClass('active');
|
||||
|
||||
if ( jQuery(this).hasClass('scroll') ) {
|
||||
var scrollto = jQuery(this).attr('href').replace('wpseo_','');
|
||||
jQuery( "html, body" ).animate({
|
||||
scrollTop: jQuery( scrollto ).offset().top
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
|
||||
jQuery('.wpseo-heading').hide();
|
||||
jQuery('.wpseo-metabox-tabs').show();
|
||||
// End Tabs code
|
||||
|
||||
jQuery('#related_keywords_heading').hide();
|
||||
|
||||
var cache = {}, lastXhr;
|
||||
|
||||
jQuery('#yoast_wpseo_focuskw').autocomplete({
|
||||
minLength: 3,
|
||||
formatResult: function(row) {
|
||||
return jQuery('<div/>').html(row).html();
|
||||
},
|
||||
source: function( request, response ) {
|
||||
var term = request.term;
|
||||
if ( term in cache ) {
|
||||
response( cache[ term ] );
|
||||
return;
|
||||
}
|
||||
request._ajax_nonce = wpseo_keyword_suggest_nonce;
|
||||
request.action = 'wpseo_get_suggest';
|
||||
|
||||
lastXhr = jQuery.getJSON( ajaxurl, request, function( data, status, xhr ) {
|
||||
cache[ term ] = data;
|
||||
if ( xhr === lastXhr ) {
|
||||
response( data );
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
jQuery('#yoast_wpseo_title').keyup( function() {
|
||||
updateTitle();
|
||||
});
|
||||
jQuery('#yoast_wpseo_metadesc').keyup( function() {
|
||||
updateDesc();
|
||||
});
|
||||
jQuery('#excerpt').keyup( function() {
|
||||
updateDesc();
|
||||
});
|
||||
|
||||
jQuery('#yoast_wpseo_title').live('change', function() {
|
||||
updateTitle();
|
||||
});
|
||||
jQuery('#yoast_wpseo_metadesc').live('change', function() {
|
||||
updateDesc();
|
||||
});
|
||||
jQuery('#excerpt').live('change', function() {
|
||||
updateDesc();
|
||||
});
|
||||
jQuery('#content').live('change', function() {
|
||||
updateDesc();
|
||||
});
|
||||
jQuery('#tinymce').live('change', function() {
|
||||
updateDesc();
|
||||
});
|
||||
jQuery('#titlewrap #title').live('change', function() {
|
||||
updateTitle();
|
||||
});
|
||||
jQuery('#wpseo_regen_title').click(function() {
|
||||
updateTitle(1);
|
||||
return false;
|
||||
});
|
||||
|
||||
var focuskwhelptriggered = false;
|
||||
jQuery('#yoast_wpseo_focuskw').live('change', function() {
|
||||
if ( jQuery('#yoast_wpseo_focuskw').val().search(',') != -1 ) {
|
||||
jQuery("#focuskwhelp").click();
|
||||
focuskwhelptriggered = true;
|
||||
} else if ( focuskwhelptriggered ) {
|
||||
jQuery('#focuskwhelp').qtip("hide");
|
||||
focuskwhelptriggered = false;
|
||||
}
|
||||
|
||||
updateSnippet();
|
||||
});
|
||||
|
||||
|
||||
jQuery(".yoast_help").qtip({
|
||||
position:{
|
||||
corner:{
|
||||
target:'topMiddle',
|
||||
tooltip:'bottomLeft'
|
||||
}
|
||||
},
|
||||
show:{
|
||||
when:{
|
||||
event:'click'
|
||||
}
|
||||
},
|
||||
hide:{
|
||||
when:{
|
||||
event:'click'
|
||||
}
|
||||
},
|
||||
style:{
|
||||
tip:'bottomLeft',
|
||||
name:'blue'
|
||||
}
|
||||
});
|
||||
|
||||
updateSnippet();
|
||||
|
||||
});
|
||||