Move into wp-content path
Signed-off-by: Adrian Nöthlich <git@promasu.tech>
2
wp-content/index.php
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<?php
|
||||||
|
// Silence is golden.
|
||||||
BIN
wp-content/languages/admin-de_DE.mo
Normal file
13391
wp-content/languages/admin-de_DE.po
Normal file
BIN
wp-content/languages/admin-network-de_DE.mo
Normal file
1348
wp-content/languages/admin-network-de_DE.po
Normal file
BIN
wp-content/languages/continents-cities-de_DE.mo
Normal file
2117
wp-content/languages/continents-cities-de_DE.po
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2019-06-13 17:08:54+0000","generator":"GlotPress\/2.4.0-alpha","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=2; plural=n != 1;","lang":"de"},"Editor tips":["Editor-Tipps"],"Disable tips":["Tipps deaktivieren"],"Got it":["Verstanden"],"See next tip":["N\u00e4chsten Tipp ansehen"]}},"comment":{"reference":"wp-includes\/js\/dist\/nux.js"}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2019-06-13 17:08:54+0000","generator":"GlotPress\/2.4.0-alpha","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=2; plural=n != 1;","lang":"de"},"Reusable Blocks":["Wiederverwendbare Bl\u00f6cke"],"Embeds":["Einbettungen"],"Layout Elements":["Layout-Elemente"],"Formatting":["Formatierung"],"Common Blocks":["Allgemeine Bl\u00f6cke"],"Widgets":["Widgets"]}},"comment":{"reference":"wp-includes\/js\/dist\/blocks.js"}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2019-06-13 17:08:54+0000","generator":"GlotPress\/2.4.0-alpha","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=2; plural=n != 1;","lang":"de"},"The response is not a valid JSON response.":["Die Antwort ist keine g\u00fcltige JSON-Antwort."],"An unknown error occurred.":["Ein unbekannter Fehler ist aufgetreten."]}},"comment":{"reference":"wp-includes\/js\/dist\/api-fetch.js"}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2019-06-13 17:08:54+0000","generator":"GlotPress\/2.4.0-alpha","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=2; plural=n != 1;","lang":"de"},"Reusable block imported successfully!":["Wiederverwendbarer Block erfolgreich importiert!"],"button label\u0004Import":["Importieren"],"Unknown error":["Unbekannter Fehler"],"Invalid Reusable Block JSON file":["Ung\u00fcltige JSON-Datei f\u00fcr wiederverwendbaren Block"],"Invalid JSON file":["Ung\u00fcltige JSON-Datei"],"Import from JSON":["Import von JSON"],"File":["Datei"]}},"comment":{"reference":"wp-includes\/js\/dist\/list-reusable-blocks.js"}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2019-06-13 17:08:54+0000","generator":"GlotPress\/2.4.0-alpha","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=2; plural=n != 1;","lang":"de"},"Annotation":["Anmerkung"]}},"comment":{"reference":"wp-includes\/js\/dist\/annotations.js"}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2019-06-13 17:30:07+0000","generator":"GlotPress\/2.4.0-alpha","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=2; plural=n != 1;","lang":"de"},"%s Critical issue":["%s kritisches Problem","%s kritische Probleme"],"%s Item with no issues detected":["%s Element, bei dem keine Probleme erkannt wurden","%s Elemente, bei denen keine Probleme erkannt wurde"],"%s Recommended improvement":["%s empfohlene Verbesserung","%s empfohlene Verbesserungen"],"Site information has been added to your clipboard.":["Der Bericht wurde in deine Zwischenablage kopiert."],"All site health tests have finished running. Your site scored %s, and the results are now available on the page.":["Alle Website-Health-Tests wurden erfolgreich abgeschlossen. Deine Website hat %s erzielt und die Ergebnisse sind nun auf der Seite verf\u00fcgbar."],"All site health tests have finished running.":["Alle Website-Health-Tests wurden erfolgreich abgeschlossen."],"Please wait...":["Bitte warten..."]}},"comment":{"reference":"wp-admin\/js\/site-health.js"}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2019-06-13 17:08:54+0000","generator":"GlotPress\/2.4.0-alpha","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=2; plural=n != 1;","lang":"de"},"Link edited.":["Link bearbeitet."],"%s (opens in a new tab)":["%s (\u00f6ffnet in neuem Tab)"],"Link removed.":["Link entfernt."],"Inline Image":["Inline-Bild"],"media":["Medien"],"photo":["Foto"],"Warning: the link has been inserted but may have errors. Please test it.":["Warnung: Der Link wurde eingef\u00fcgt, k\u00f6nnte aber fehlerhaft sein. Bitte teste ihn."],"Link inserted.":["Link eingef\u00fcgt."],"Link":["Link"],"Open in New Tab":["In neuem Tab \u00f6ffnen"],"Image":["Bild"],"Unlink":["Link entfernen"],"Strikethrough":["Durchgestrichen"],"Underline":["Unterstreichen"],"Italic":["Kursiv"],"Bold":["Fett"],"Code":["Code"],"Width":["Breite"],"Apply":["\u00dcbernehmen"],"Edit":["Bearbeiten"]}},"comment":{"reference":"wp-includes\/js\/dist\/format-library.js"}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2019-06-13 17:08:54+0000","generator":"GlotPress\/2.4.0-alpha","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=2; plural=n != 1;","lang":"de"},"Vertical Pos.":["Vertikale Pos."],"Horizontal Pos.":["Horizontale Pos."],"Custom Color":["Individuelle Farbe"],"Font size: %s":["Schriftgr\u00f6\u00dfe: %s"],"Error loading block: %s":["Fehler beim Laden des Blocks: %s"],"Number of items":["Anzahl Elemente"],"Category":["Kategorie"],"Z \u2192 A":["Z → A"],"A \u2192 Z":["A → Z"],"Oldest to Newest":["Alt nach Neu"],"Newest to Oldest":["Neu nach Alt"],"Order by":["Reihenfolge von"],"Dismiss this notice":["Diesen Hinweis verwerfen"],"%1$s (%2$s of %3$s)":["%1$s (%2$s of %3$s)"],"Remove item":["Element entfernen"],"Item removed.":["Element entfernt."],"Item added.":["Element hinzugef\u00fcgt."],"Separate with commas":["Mit Kommas trennen"],"Add item":["Element hinzuf\u00fcgen"],"Reset":["Zur\u00fccksetzen"],"font size name\u0004Custom":["Individuell"],"font size name\u0004Normal":["Normal"],"Custom font size":["Individuelle Schriftgr\u00f6\u00dfe"],"(opens in a new tab)":["(\u00f6ffnet in neuem Tab)"],"Minutes":["Minuten"],"Calendar Help":["Kalender-Hilfe"],"Go to the first (home) or last (end) day of a week.":["Gehe zum ersten (Start) oder letzten (Ende) Tag der Woche."],"Home\/End":["Start\/Ende"],"Home and End":["Start und Ende"],"Move backward (PgUp) or forward (PgDn) by one month.":["Zur\u00fcck (Bild-auf) oder vorw\u00e4rts (Bild-ab) bewegen um einen Monat."],"PgUp\/PgDn":["Bild-auf\/Bild-ab"],"Page Up and Page Down":["Bild-auf und Bild-ab"],"Move backward (up) or forward (down) by one week.":["Zur\u00fcck (hoch) oder vorw\u00e4rts (runter) bewegen um eine Woche."],"Up and Down Arrows":["Pfeile hoch und runter"],"Move backward (left) or forward (right) by one day.":["Zur\u00fcck (links) oder vorw\u00e4rts (rechts) bewegen um einen Tag."],"Left and Right Arrows":["Pfeile links und rechts"],"Select the date in focus.":["Datum im Fokus ausw\u00e4hlen."],"keyboard button\u0004Enter":["Eingabetaste"],"Navigating with a keyboard":["Navigation mit einer Tastatur"],"Click the desired day to select it.":["Klicke den gew\u00fcnschten Tag an, um ihn auszuw\u00e4hlen."],"Click the right or left arrows to select other months in the past or the future.":["Klicke die Pfeile nach rechts oder links an, um Monate in der Vergangenheit oder der Zukunft auszuw\u00e4hlen."],"Click to Select":["Klicken zum Ausw\u00e4hlen"],"Use your arrow keys to change the base color. Move up to lighten the color, down to darken, left to decrease saturation, and right to increase saturation.":["Benutze deine Pfeiltasten, um die Basisfarbe zu \u00e4ndern. Hoch, um die Farbe aufzuhellen, runter zum Verdunkeln, links um die S\u00e4ttigung zu erh\u00f6hen, rechts um sie zu verringern."],"Choose a shade":["Farbton ausw\u00e4hlen"],"Change color format":["Farbformat wechseln"],"Color value in HSL":["HSL-Farbwert"],"Color value in RGB":["RGB-Farbwert"],"Color value in hexadecimal":["Hexadezimaler Farbwert"],"Hex color mode active":["Hex-Farbmodus aktiv"],"Hue\/saturation\/lightness mode active":["Farbton\/S\u00e4ttigung\/Helligkeit-Modus aktiv"],"RGB mode active":["RGB-Modus aktiv"],"Move the arrow left or right to change hue.":["Bewege den Pfeil nach rechts oder links zum \u00c4ndern des Farbtons."],"Hue value in degrees, from 0 to 359.":["Farbtonwert in Grad, von 0 bis 359."],"Alpha value, from 0 (transparent) to 1 (fully opaque).":["Alphawert von 0 (transparent) bis 1 (volle Deckkraft)."],"Color: %s":["Farbe: %s"],"Color code: %s":["Farbcode: %s"],"Custom color picker":["Individueller Farbw\u00e4hler"],"No results.":["Keine Ergebnisse."],"%d result found, use up and down arrow keys to navigate.":["%d Ergebnis gefunden, benutze die Pfeile nach oben oder unten zum Navigieren.","%d Ergebnisse gefunden, benutze die Pfeile nach oben oder unten zum Navigieren."],"Time":["Zeit"],"Day":["Tag"],"Month":["Monat"],"Date":["Datum"],"Hours":["\u00d6ffnungszeiten"],"Close dialog":["Dialog schlie\u00dfen"],"Year":["Jahr"],"Custom Size":["Individuelle Gr\u00f6\u00dfe"],"Drop files to upload":["Dateien f\u00fcr den Upload bereitstellen"],"Clear":["Leeren"],"PM":["PM"],"AM":["AM"],"Font Size":["Schriftgr\u00f6\u00dfe"],"December":["Dezember"],"November":["November"],"October":["Oktober"],"September":["September"],"August":["August"],"July":["Juli"],"June":["Juni"],"May":["Mai"],"April":["April"],"March":["M\u00e4rz"],"February":["Februar"],"January":["Januar"],"No results found.":["Es wurden keine Ergebnisse gefunden, die deinen Suchkriterien entsprechen."],"All":["Alle"],"Close":["Schlie\u00dfen"]}},"comment":{"reference":"wp-includes\/js\/dist\/components.js"}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2019-06-13 17:08:54+0000","generator":"GlotPress\/2.4.0-alpha","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=2; plural=n != 1;","lang":"de"},"Backtick":["Backtick"],"Period":["Punkt"],"Comma":["Komma"]}},"comment":{"reference":"wp-includes\/js\/dist\/keycodes.js"}}
|
||||||
BIN
wp-content/languages/de_DE.mo
Normal file
16510
wp-content/languages/de_DE.po
Normal file
BIN
wp-content/languages/plugins/github-updater-de_DE.mo
Normal file
661
wp-content/languages/plugins/github-updater-de_DE.po
Normal file
@@ -0,0 +1,661 @@
|
|||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: GitHub Updater\n"
|
||||||
|
"POT-Creation-Date: 2018-11-26 10:14-0800\n"
|
||||||
|
"PO-Revision-Date: 2018-12-01 09:17-0800\n"
|
||||||
|
"Last-Translator: Connor Bär <hello@connorbaer.io>\n"
|
||||||
|
"Language-Team: Andy Fragen <andy@thefragens.com>\n"
|
||||||
|
"Language: de_DE\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Generator: Poedit 2.2\n"
|
||||||
|
"X-Poedit-Basepath: ..\n"
|
||||||
|
"X-Poedit-SourceCharset: UTF-8\n"
|
||||||
|
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
|
||||||
|
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
|
||||||
|
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"X-Poedit-SearchPath-0: .\n"
|
||||||
|
|
||||||
|
#. translators: 1: minimum PHP version required, 2: Upgrade PHP URL
|
||||||
|
#: github-updater.php:40
|
||||||
|
#, fuzzy, php-format
|
||||||
|
#| msgid ""
|
||||||
|
#| "GitHub Updater cannot run on PHP versions older than 5.3.0. Please "
|
||||||
|
#| "contact your hosting provider to update your site."
|
||||||
|
msgid ""
|
||||||
|
"GitHub Updater cannot run on PHP versions older than %1$s. <a href=\"%2$s"
|
||||||
|
"\">Learn about upgrading your PHP.</a>"
|
||||||
|
msgstr ""
|
||||||
|
"GitHub-Updater kann nicht auf PHP-Versionen älter als 5.3.0 ausgeführt "
|
||||||
|
"werden. Bitte kontaktieren Sie Ihren Hosting-Anbieter, um Ihre Webseite zu "
|
||||||
|
"aktualisieren."
|
||||||
|
|
||||||
|
#: github-updater.php:42
|
||||||
|
msgid "https://wordpress.org/support/upgrade-php/"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: mu/ghu-loader.php:66
|
||||||
|
msgid "Activated as mu-plugin"
|
||||||
|
msgstr "Aktiviert als mu-Plugin"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:351
|
||||||
|
msgid "Bitbucket Private Settings"
|
||||||
|
msgstr "Bitbucket Privat Einstellungen"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:358
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:446
|
||||||
|
msgid "Bitbucket Username"
|
||||||
|
msgstr "Bitbucket Benutzername"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:367
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:454
|
||||||
|
msgid "Bitbucket Password"
|
||||||
|
msgstr "Bitbucket Passwort"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:383
|
||||||
|
msgid "Bitbucket Private Repositories"
|
||||||
|
msgstr "Bitbucket Private Repositories"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:413
|
||||||
|
msgid "Bitbucket"
|
||||||
|
msgstr "Bitbucket"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:422
|
||||||
|
msgid ""
|
||||||
|
"Check box if private repository. Leave unchecked for public repositories."
|
||||||
|
msgstr ""
|
||||||
|
"Aktivieren Sie das Kästchen, falls es sich um ein privates Repository "
|
||||||
|
"handelt. Lassen Sie es deaktiviert für öffentliche Repositories."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:429
|
||||||
|
msgid "Enter your personal Bitbucket username and password."
|
||||||
|
msgstr "Geben Sie Ihren persönlichen Bitbucket Benutzernamen und Passwort ein."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:463
|
||||||
|
msgid "Private Bitbucket Repository"
|
||||||
|
msgstr "Privates Bitbucket Repository"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:479
|
||||||
|
msgid "Check for private Bitbucket repositories."
|
||||||
|
msgstr "Auswählen für private Bitbucket Repositories"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:494
|
||||||
|
msgid "Enter Bitbucket username."
|
||||||
|
msgstr "Bitbucket Benutzername angeben"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:509
|
||||||
|
msgid "Enter Bitbucket password."
|
||||||
|
msgstr "Bitbucket Passwort angeben"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:345
|
||||||
|
msgid "Bitbucket Server Private Settings"
|
||||||
|
msgstr "Bitbucket Private Server Einstellungen"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:352
|
||||||
|
msgid "Bitbucket Server Username"
|
||||||
|
msgstr "Bitbucket Server-Benutzernamen"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:361
|
||||||
|
msgid "Bitbucket Server Password"
|
||||||
|
msgstr "Bitbucket Serverkennwort"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:377
|
||||||
|
msgid "Bitbucket Server Private Repositories"
|
||||||
|
msgstr "Bitbucket Private Verzeichnisse"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:407
|
||||||
|
msgid "Bitbucket Server"
|
||||||
|
msgstr "Bitbucket Server"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:365
|
||||||
|
msgid "GitHub Personal Access Token"
|
||||||
|
msgstr "Privater GitHub Access-Token"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:372
|
||||||
|
msgid "GitHub.com Access Token"
|
||||||
|
msgstr "GitHub.com Access-Token"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:385
|
||||||
|
msgid "GitHub Enterprise Access Token"
|
||||||
|
msgstr "GitHub Enterprise Access-Token"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:402
|
||||||
|
msgid "GitHub Private Settings"
|
||||||
|
msgstr "Private GitHub Einstellungen"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:429
|
||||||
|
msgid "Enter your GitHub Access Token. Leave empty for public repositories."
|
||||||
|
msgstr ""
|
||||||
|
"Geben Sie Ihr GitHub Access-Token ein. Leer lassen für öffentliche "
|
||||||
|
"Repositories."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:436
|
||||||
|
msgid ""
|
||||||
|
"Enter your personal GitHub.com or GitHub Enterprise Access Token to avoid "
|
||||||
|
"API access limits."
|
||||||
|
msgstr ""
|
||||||
|
"Geben Sie Ihr persönliches GitHub.com oder GitHub Enterprise Access-Token "
|
||||||
|
"ein, um API-Limits zu vermeiden."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:447
|
||||||
|
msgid "GitHub Access Token"
|
||||||
|
msgstr "GitHub Accesstoken"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:461
|
||||||
|
msgid "GitHub"
|
||||||
|
msgstr "GitHub"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:475
|
||||||
|
msgid "Enter GitHub Access Token for private GitHub repositories."
|
||||||
|
msgstr "Geben Sie Ihr GitHub Access-Token für private GitHub Repositories ein."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:431
|
||||||
|
msgid "GitLab Personal Access Token"
|
||||||
|
msgstr "Privater GitLab Access-Token"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:440
|
||||||
|
msgid "GitLab Private Settings"
|
||||||
|
msgstr "Private GitLab Einstellungen"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:449
|
||||||
|
msgid "GitLab.com Access Token"
|
||||||
|
msgstr "GitLab Access-Token"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:463
|
||||||
|
msgid "GitLab CE or GitLab Enterprise Personal Access Token"
|
||||||
|
msgstr "Privater GitLab CE oder GitLab Enterprise Access-Token"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:498
|
||||||
|
msgid "GitLab"
|
||||||
|
msgstr "GitLab"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:507
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "Enter your GitLab Access Token."
|
||||||
|
msgid "Enter your repository specific GitLab Access Token."
|
||||||
|
msgstr "Geben Sie Ihr GitLab Access-Token ein."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:514
|
||||||
|
msgid "Enter your GitLab.com, GitLab CE, or GitLab Enterprise Access Token."
|
||||||
|
msgstr ""
|
||||||
|
"Geben Sie Ihr GitLab.com, GitLab CE oder GitLab Enterprise Access-Token ein."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:525
|
||||||
|
msgid "GitLab Access Token"
|
||||||
|
msgstr "GitLab Access-Token"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:541
|
||||||
|
msgid "Enter GitLab Access Token for private GitLab repositories."
|
||||||
|
msgstr "Geben Sie Ihr GitLab Access-Token für private GitHub Repositories ein."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:574
|
||||||
|
msgid ""
|
||||||
|
"You must set a GitLab.com, GitLab CE, or GitLab Enterprise Access Token."
|
||||||
|
msgstr ""
|
||||||
|
"Sie müssen ein privates GitLab.com, GitLab CE oder GitLab Enterprise Token "
|
||||||
|
"angeben."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:311
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:329
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:391
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "GitLab Access Token"
|
||||||
|
msgid "Gitea Access Token"
|
||||||
|
msgstr "GitLab Access-Token"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:320
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "GitLab Private Settings"
|
||||||
|
msgid "Gitea Private Settings"
|
||||||
|
msgstr "Private GitLab Einstellungen"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:364
|
||||||
|
msgid "Gitea"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:373
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "Enter your GitLab Access Token."
|
||||||
|
msgid "Enter your repository specific Gitea Access Token."
|
||||||
|
msgstr "Geben Sie Ihr GitLab Access-Token ein."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:380
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "Enter your GitLab Access Token."
|
||||||
|
msgid "Enter your Gitea Access Token."
|
||||||
|
msgstr "Geben Sie Ihr GitLab Access-Token ein."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:407
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "Enter GitLab Access Token for private GitLab repositories."
|
||||||
|
msgid "Enter Gitea Access Token for private Gitea repositories."
|
||||||
|
msgstr "Geben Sie Ihr GitLab Access-Token für private GitHub Repositories ein."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:438
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "Enter your GitLab Access Token."
|
||||||
|
msgid "You must set a Gitea Access Token."
|
||||||
|
msgstr "Geben Sie Ihr GitLab Access-Token ein."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Zipfile_API.php:37
|
||||||
|
msgid "Zipfile Slug"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Zipfile_API.php:53
|
||||||
|
msgid "Enter plugin or theme slug."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Base.php:449
|
||||||
|
msgid ""
|
||||||
|
"There may be a problem with WP-Cron. A GitHub Updater WP-Cron event is "
|
||||||
|
"overdue."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. translators: current branch name and link
|
||||||
|
#. translators: 1: branch name, 2: jQuery dropdown, 3: closing tag
|
||||||
|
#: src/GitHub_Updater/Base.php:882 src/GitHub_Updater/Theme.php:585
|
||||||
|
#, php-format
|
||||||
|
msgid "Current branch is `%1$s`, try %2$sanother version%3$s"
|
||||||
|
msgstr ""
|
||||||
|
"Aktueller Branch ist `%1$s`, versuchen Sie %2$seinen anderen Branch%3$s."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Base.php:893
|
||||||
|
msgid "Switch to branch "
|
||||||
|
msgstr "Zum Branch wechseln "
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Base.php:909
|
||||||
|
msgid "Switch to release "
|
||||||
|
msgstr "Zur Version wechseln"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Base.php:917 src/GitHub_Updater/Theme.php:611
|
||||||
|
msgid "No previous tags to rollback to."
|
||||||
|
msgstr "Keine früheren Tags für ein Rollback."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:104 src/GitHub_Updater/Install.php:366
|
||||||
|
msgid "Install Plugin"
|
||||||
|
msgstr "Plugin installieren"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:107 src/GitHub_Updater/Install.php:369
|
||||||
|
msgid "Install Theme"
|
||||||
|
msgstr "Theme installieren"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:160
|
||||||
|
msgid "A repository URI is required."
|
||||||
|
msgstr "Eine Repository-URI ist erforderlich."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:386
|
||||||
|
msgid "Plugin"
|
||||||
|
msgstr "Plugin"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:389
|
||||||
|
msgid "Theme"
|
||||||
|
msgstr "Theme"
|
||||||
|
|
||||||
|
#. translators: variable is 'Plugin' or 'Theme'
|
||||||
|
#: src/GitHub_Updater/Install.php:401
|
||||||
|
#, php-format
|
||||||
|
msgid "GitHub Updater Install %s"
|
||||||
|
msgstr "GitHub Updater Installiert %s"
|
||||||
|
|
||||||
|
#. translators: variable is 'Plugin' or 'Theme'
|
||||||
|
#: src/GitHub_Updater/Install.php:409
|
||||||
|
#, php-format
|
||||||
|
msgid "%s URI"
|
||||||
|
msgstr "%s URI"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:417
|
||||||
|
msgid "Repository Branch"
|
||||||
|
msgstr "Repository-Branch"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:425
|
||||||
|
msgid "Remote Repository Host"
|
||||||
|
msgstr "Remoter Repository Host"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:461
|
||||||
|
msgid "URI is case sensitive."
|
||||||
|
msgstr "URI unterscheidet zwischen Groß- und Kleinschreibung."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:476
|
||||||
|
msgid "Enter branch name or leave empty for `master`"
|
||||||
|
msgstr "Branchnamen angeben oder leer lassen für `master`"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:541
|
||||||
|
msgid "Activate"
|
||||||
|
msgstr "Aktivieren"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:553
|
||||||
|
msgctxt "This refers to a network activation in a multisite installation"
|
||||||
|
msgid "Network Enable"
|
||||||
|
msgstr "Netzwerk/Multisite Aktivieren"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Messages.php:112 src/GitHub_Updater/Messages.php:153
|
||||||
|
#: src/GitHub_Updater/Messages.php:173
|
||||||
|
msgid "GitHub Updater Error Code:"
|
||||||
|
msgstr "GitHub Updater Fehlercode:"
|
||||||
|
|
||||||
|
#. translators: %s: wait time
|
||||||
|
#: src/GitHub_Updater/Messages.php:119
|
||||||
|
#, fuzzy, php-format
|
||||||
|
#| msgid "GitHub API's rate limit will reset in %s minutes."
|
||||||
|
msgid "GitHub API’s rate limit will reset in %s minutes."
|
||||||
|
msgstr "GitHub APIs Limite wird in %s Minutes zurückgesetzt."
|
||||||
|
|
||||||
|
#. translators: %s: GitHub personal access token URL
|
||||||
|
#: src/GitHub_Updater/Messages.php:125
|
||||||
|
#, fuzzy, php-format
|
||||||
|
#| msgid ""
|
||||||
|
#| "It looks like you are running into GitHub API rate limits. Be sure and "
|
||||||
|
#| "configure a %sPersonal Access Token%s to avoid this issue."
|
||||||
|
msgid ""
|
||||||
|
"It looks like you are running into GitHub API rate limits. Be sure and "
|
||||||
|
"configure a <a href=\"%s\">Personal Access Token</a> to avoid this issue."
|
||||||
|
msgstr ""
|
||||||
|
"Es sieht so aus, als hätten Sie das GitHub API Limit erreicht. Um dieses "
|
||||||
|
"Problem zu verhindern, können Sie ein %spersönliches Zugriffs-Token%s "
|
||||||
|
"angeben."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Messages.php:157
|
||||||
|
msgid ""
|
||||||
|
"There is probably an access token or password error on the GitHub Updater "
|
||||||
|
"Settings page."
|
||||||
|
msgstr ""
|
||||||
|
"Wahrscheinlich ist Ihr Access-Token oder Passwort fehlerhaft auf der GitHub "
|
||||||
|
"Updater Einstellungsseite."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Messages.php:188
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "GitHub Updater Settings"
|
||||||
|
msgid "GitHub Updater Information"
|
||||||
|
msgstr "GitHub Updater Einstellungen"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Messages.php:190
|
||||||
|
msgid "Please be patient while WP-Cron finishes making API calls."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Plugin.php:326
|
||||||
|
msgid "View details"
|
||||||
|
msgstr "Details ansehen"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Remote_Management.php:138
|
||||||
|
#: src/GitHub_Updater/Remote_Management.php:195
|
||||||
|
msgid "Remote Management"
|
||||||
|
msgstr "Fernwartung/-management"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Remote_Management.php:177
|
||||||
|
msgid "Reset RESTful key"
|
||||||
|
msgstr "RESTful Key zurücksetzen."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Remote_Management.php:231
|
||||||
|
msgid ""
|
||||||
|
"Please refer to README for complete list of attributes. RESTful endpoints "
|
||||||
|
"begin at:"
|
||||||
|
msgstr ""
|
||||||
|
"Eine vollständige Liste der Attribute finden Sie im README. RESTful-"
|
||||||
|
"Endpunkte beginnen bei:"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Remote_Management.php:235
|
||||||
|
msgid ""
|
||||||
|
"Use of Remote Management services may result increase some page load speeds "
|
||||||
|
"only for `admin` level users in the dashboard."
|
||||||
|
msgstr ""
|
||||||
|
"Verwenden von Fernwartung/-managementdiensten kann eine höhere "
|
||||||
|
"Seiteladezeiten zur Folge haben für `Admin`-Level Benutzer auf dem Dashboard"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:114 src/GitHub_Updater/Settings.php:719
|
||||||
|
msgid "Settings"
|
||||||
|
msgstr "Einstellungen"
|
||||||
|
|
||||||
|
#. Plugin Name of the plugin/theme
|
||||||
|
#: src/GitHub_Updater/Settings.php:133 src/GitHub_Updater/Settings.php:172
|
||||||
|
#: src/GitHub_Updater/Settings.php:223
|
||||||
|
msgid "GitHub Updater"
|
||||||
|
msgstr "GitHub Updater"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:171 src/GitHub_Updater/Settings.php:310
|
||||||
|
msgid "GitHub Updater Settings"
|
||||||
|
msgstr "GitHub Updater Einstellungen"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:245
|
||||||
|
msgid "Refresh Cache"
|
||||||
|
msgstr "Cache aktualisieren."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:277
|
||||||
|
msgid "Settings saved."
|
||||||
|
msgstr "Einstellungen gespeichert."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:279
|
||||||
|
msgid "RESTful key reset."
|
||||||
|
msgstr "RESTful Key zurückgesetzt."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:281
|
||||||
|
msgid "Cache refreshed."
|
||||||
|
msgstr "Cache aktualisiert."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:323
|
||||||
|
msgid "Enable Branch Switching"
|
||||||
|
msgstr "Wechsel des Plugin-Branches aktivieren"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:526
|
||||||
|
msgid "Check to enable branch switching from the Plugins or Themes page."
|
||||||
|
msgstr ""
|
||||||
|
"Auswählen, um das Wechseln des Pluginbranches auf der Plugins oder Themes "
|
||||||
|
"Seite zu aktivieren."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:550
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "Installed Plugins and Themes"
|
||||||
|
msgid "Overridden Plugins and Themes"
|
||||||
|
msgstr "Installierte Plugins und Themes"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:551
|
||||||
|
msgid ""
|
||||||
|
"The following plugins or themes might exist on wp.org, but any updates will "
|
||||||
|
"be downloaded from their respective git repositories."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:753
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "Check for private Bitbucket repositories."
|
||||||
|
msgid "This is a private repository."
|
||||||
|
msgstr "Auswählen für private Bitbucket Repositories"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:754
|
||||||
|
msgid "This repository has not connected to the API or was unable to connect."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:755
|
||||||
|
msgid "This repository is hosted on WordPress.org."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:792
|
||||||
|
msgid "Installed Plugins and Themes"
|
||||||
|
msgstr "Installierte Plugins und Themes"
|
||||||
|
|
||||||
|
#. translators: %s: theme name
|
||||||
|
#: src/GitHub_Updater/Theme.php:337 src/GitHub_Updater/Theme.php:533
|
||||||
|
#, php-format
|
||||||
|
msgid "There is a new version of %s available."
|
||||||
|
msgstr "Es ist eine neue Version von %s verfügbar."
|
||||||
|
|
||||||
|
#. translators: %s: theme version
|
||||||
|
#: src/GitHub_Updater/Theme.php:349
|
||||||
|
#, php-format
|
||||||
|
msgid "View version %s details."
|
||||||
|
msgstr "Zeige Details der Version %s"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Theme.php:353
|
||||||
|
msgid "Automatic update is unavailable for this theme."
|
||||||
|
msgstr "Automatisches Update ist nicht verfügbar für dieses Theme."
|
||||||
|
|
||||||
|
#. translators: 1: version number, 2: closing anchor tag, 3: update URL
|
||||||
|
#: src/GitHub_Updater/Theme.php:358 src/GitHub_Updater/Theme.php:543
|
||||||
|
#, fuzzy, php-format
|
||||||
|
#| msgid "View version %1$s details%2$s or %3$supdate now%4$s."
|
||||||
|
msgid "View version %1$s details%2$s or %3$supdate now%2$s."
|
||||||
|
msgstr "Zeige Details der Version%1$s %2$s oder %3$saktualisiere jetzt%4$s."
|
||||||
|
|
||||||
|
#. translators: %s: theme name
|
||||||
|
#: src/GitHub_Updater/Theme.php:363 src/GitHub_Updater/Theme.php:548
|
||||||
|
#, php-format
|
||||||
|
msgid "Update %s now"
|
||||||
|
msgstr "Aktualisieren Sie %s jetzt."
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Theme.php:593
|
||||||
|
msgid "Choose a Version"
|
||||||
|
msgstr "Wählen Sie eine Version"
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Theme.php:615
|
||||||
|
msgid "Install"
|
||||||
|
msgstr "Installieren"
|
||||||
|
|
||||||
|
#. Plugin URI of the plugin/theme
|
||||||
|
msgid "https://github.com/afragen/github-updater"
|
||||||
|
msgstr "https://github.com/afragen/github-updater"
|
||||||
|
|
||||||
|
#. Description of the plugin/theme
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid ""
|
||||||
|
#| "A plugin to automatically update GitHub, Bitbucket, or GitLab hosted "
|
||||||
|
#| "plugins, themes, and language packs. It also allows for remote "
|
||||||
|
#| "installation of plugins or themes into WordPress."
|
||||||
|
msgid ""
|
||||||
|
"A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted "
|
||||||
|
"plugins, themes, and language packs. It also allows for remote installation "
|
||||||
|
"of plugins or themes into WordPress."
|
||||||
|
msgstr ""
|
||||||
|
"Ein Plugin um Themes, Plugins und Language Packs automatisch zu "
|
||||||
|
"aktualisieren, welche auf GitHub, Bitbucket oder GitLab gehostet sind. "
|
||||||
|
"Fernwartung/-management ist unterstützt und ermöglicht die Ferninstallation "
|
||||||
|
"von Plugins oder Themes in WordPress."
|
||||||
|
|
||||||
|
#. Author of the plugin/theme
|
||||||
|
msgid "Andy Fragen"
|
||||||
|
msgstr "Andy Fragen"
|
||||||
|
|
||||||
|
#~ msgid "Rename successful using extended name to %1$s"
|
||||||
|
#~ msgstr "Umbenennen erfolgreich, der erweiterte Name %1$s wird nun verwendet"
|
||||||
|
|
||||||
|
#~ msgid "GitHub Updater cache has been cleared."
|
||||||
|
#~ msgstr "GitHub Updater Cache wurde geleert."
|
||||||
|
|
||||||
|
#~ msgid "Incorrect command syntax, see %s for proper syntax."
|
||||||
|
#~ msgstr "Falsche Befehlssyntax, siehe %s für korrekte Syntax."
|
||||||
|
|
||||||
|
#~ msgid "GitHub Updater REST API key has been reset."
|
||||||
|
#~ msgstr "GitHub Updater REST API-Schlüssel wurde zurückgesetzt."
|
||||||
|
|
||||||
|
#~ msgid "The current RESTful endpoint is `%s`"
|
||||||
|
#~ msgstr "Die aktuelle Rest-Endpunkt ist `%s`"
|
||||||
|
|
||||||
|
#~ msgid "Plugin %s installed."
|
||||||
|
#~ msgstr "Plugin %s installiert."
|
||||||
|
|
||||||
|
#~ msgid "Theme %s installed."
|
||||||
|
#~ msgstr "Thema %s installiert."
|
||||||
|
|
||||||
|
#~ msgid "Extended Naming is %sactive%s."
|
||||||
|
#~ msgstr "Erweitertes Benennen ist %saktiv%s."
|
||||||
|
|
||||||
|
#~ msgid "Extended Naming is %snot active%s."
|
||||||
|
#~ msgstr "Erweitertes Benennen ist %snicht aktiv%s."
|
||||||
|
|
||||||
|
#~ msgid ""
|
||||||
|
#~ "Extended Naming renames plugin directories %s to prevent possible "
|
||||||
|
#~ "conflicts with WP.org plugins."
|
||||||
|
#~ msgstr ""
|
||||||
|
#~ "Erweitertes Benennen benennt Pluginverzeichnisse %s um, um mögliche "
|
||||||
|
#~ "Konflikte mit WP.org Plugins zu vermeiden."
|
||||||
|
|
||||||
|
#~ msgid "Activate Extended Naming by setting %s"
|
||||||
|
#~ msgstr "Erweitertes Benennen Aktivieren durch setzen von %s"
|
||||||
|
|
||||||
|
#~ msgid "GitLab Private Token"
|
||||||
|
#~ msgstr "Privates GitLab Token"
|
||||||
|
|
||||||
|
#~ msgid "Enter GitLab Private Token for private GitLab repositories."
|
||||||
|
#~ msgstr ""
|
||||||
|
#~ "Geben Sie Ihr GitLab Accesstoken für private GitLab Repositories ein."
|
||||||
|
|
||||||
|
#~ msgid "GitLab.com Private Token"
|
||||||
|
#~ msgstr "Privates GitLab.com Token"
|
||||||
|
|
||||||
|
#~ msgid "No private repositories are installed."
|
||||||
|
#~ msgstr "Keine private Repositories installiert."
|
||||||
|
|
||||||
|
#~ msgid "Theme is up-to-date!"
|
||||||
|
#~ msgstr "Theme ist auf dem neusten Stand!"
|
||||||
|
|
||||||
|
#~ msgid "Rollback to:"
|
||||||
|
#~ msgstr "Rollback zu:"
|
||||||
|
|
||||||
|
#, fuzzy
|
||||||
|
#~ msgid "Rollback"
|
||||||
|
#~ msgstr "Rollback zu:"
|
||||||
|
|
||||||
|
#, fuzzy
|
||||||
|
#~ msgid "now"
|
||||||
|
#~ msgstr "Zeige Details der Version%1$s %2$s oder %3$saktualisiere jetzt%4$s."
|
||||||
|
|
||||||
|
#, fuzzy
|
||||||
|
#~ msgid "Current branch is `%s`. Try %sanother version%s"
|
||||||
|
#~ msgstr ""
|
||||||
|
#~ "Aktueller Branch ist `%1$s`, versuchen Sie %2$seinen anderen Branch%3$s."
|
||||||
|
|
||||||
|
#~ msgid "Saved."
|
||||||
|
#~ msgstr "Gespeichert."
|
||||||
|
|
||||||
|
#~ msgid "Theme:"
|
||||||
|
#~ msgstr "Theme:"
|
||||||
|
|
||||||
|
#~ msgid "Current version is up to date. Try %sanother version%s"
|
||||||
|
#~ msgstr ""
|
||||||
|
#~ "Die aktuelle Version ist auf dem neuesten Stand. Versuchen Sie %seine "
|
||||||
|
#~ "andere Version%s"
|
||||||
|
|
||||||
|
#~ msgid "Renaming %1$s to %2$s"
|
||||||
|
#~ msgstr "Umbenennen von%1$s zu %2$s"
|
||||||
|
|
||||||
|
#~ msgid "Rename successful"
|
||||||
|
#~ msgstr "Umbenennen erfolgreich"
|
||||||
|
|
||||||
|
#~ msgid "Unable to rename downloaded repository."
|
||||||
|
#~ msgstr "Kann das heruntergeladene Repository nicht umbenennen."
|
||||||
|
|
||||||
|
#~ msgid "this plugin"
|
||||||
|
#~ msgstr "dieses Plugin"
|
||||||
|
|
||||||
|
#~ msgid "Unfortunately, %1$s can not run on PHP versions older than %2$s."
|
||||||
|
#~ msgstr ""
|
||||||
|
#~ "Leider kann %1$s nicht auf PHP-Versionen älter als %2$s ausgeführt werden."
|
||||||
|
|
||||||
|
#~ msgid "Read more information about %show you can update%s."
|
||||||
|
#~ msgstr "Lesen Sie mehr Informationen über %swie Sie aktualisieren können%s."
|
||||||
|
|
||||||
|
#~ msgid "%1$s recommends a PHP version greater than %2$s."
|
||||||
|
#~ msgstr "%1$s empfiehlt eine PHP-Version neuer als %2$s."
|
||||||
|
|
||||||
|
#~ msgid ""
|
||||||
|
#~ "A plugin to automatically update GitHub, Bitbucket or GitLab hosted "
|
||||||
|
#~ "plugins and themes. It also allows for remote installation of plugins or "
|
||||||
|
#~ "themes into WordPress. Plugin class based upon <a href=\"https://github."
|
||||||
|
#~ "com/codepress/github-plugin-updater\">codepress/github-plugin-updater</"
|
||||||
|
#~ "a>. Theme class based upon <a href=\"https://github.com/WordPress-Phoenix/"
|
||||||
|
#~ "whitelabel-framework\">Whitelabel Framework</a> modifications."
|
||||||
|
#~ msgstr ""
|
||||||
|
#~ "Ein Plugin, das Themes und Plugins, welche auf GitHub, Bitbucket oder "
|
||||||
|
#~ "GitLab gehostet sind, automatisch aktualisiert. Es ermöglicht ebenfalls, "
|
||||||
|
#~ "Plugins oder Themes remote in WordPress zu installieren. Die Plugin-"
|
||||||
|
#~ "Klasse ist auf <a href=\"https://github.com/codepress/github-plugin-"
|
||||||
|
#~ "updater\">codepress/github-plugin-updater</a> basiert. Die Theme-Klasse "
|
||||||
|
#~ "ist auf Modifizierungen von <a href=\"https://github.com/WordPress-"
|
||||||
|
#~ "Phoenix/whitelabel-framework\">Whitelabel Framework</a> basiert."
|
||||||
|
|
||||||
|
#~ msgid ""
|
||||||
|
#~ "No changelog is available via GitHub Updater. Create a file <code>CHANGES."
|
||||||
|
#~ "md</code> or <code>CHANGELOG.md</code> in your repository."
|
||||||
|
#~ msgstr ""
|
||||||
|
#~ "Keine Änderungsprotokoll verfügbar via GitHub Updater. Erstellen Sie eine "
|
||||||
|
#~ "Datei <code>CHANGES.md</code> oder <code>CHANGELOG.md</code> in Ihrem "
|
||||||
|
#~ "Repository."
|
||||||
674
wp-content/plugins/Pirate-Crew/LICENSE
Normal file
@@ -0,0 +1,674 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
{one line to give the program's name and a brief idea of what it does.}
|
||||||
|
Copyright (C) {year} {name of author}
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
{project} Copyright (C) {year} {fullname}
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
2
wp-content/plugins/Pirate-Crew/README.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Pirate-Crew
|
||||||
|
WordPress Plugin for Pirate Party to display crew members
|
||||||
339
wp-content/plugins/Pirate-Crew/css/admin.css
Normal file
@@ -0,0 +1,339 @@
|
|||||||
|
*, *:after, *:before {
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.picrew-clearfix::after {
|
||||||
|
display: table;
|
||||||
|
clear:both;
|
||||||
|
content: " ";
|
||||||
|
}
|
||||||
|
.picrew-row {
|
||||||
|
margin-right: -15px;
|
||||||
|
margin-left: -15px;
|
||||||
|
}
|
||||||
|
.picrew-row:before {
|
||||||
|
display: table;
|
||||||
|
content: " ";
|
||||||
|
}
|
||||||
|
.picrew-row:after {
|
||||||
|
display: table;
|
||||||
|
content: " ";
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
.picrew-col {
|
||||||
|
padding-right: 15px;
|
||||||
|
padding-left: 15px;
|
||||||
|
}
|
||||||
|
.picrew-col-2 {
|
||||||
|
width: 50%;
|
||||||
|
float: left;
|
||||||
|
position: relative;
|
||||||
|
min-height: 1px;
|
||||||
|
padding-right: 15px;
|
||||||
|
padding-left: 15px;
|
||||||
|
}
|
||||||
|
.pirate-crew-customize-inner {
|
||||||
|
padding: 15px 0;
|
||||||
|
}
|
||||||
|
.picrew-preset-list, .pirate-crew-customize-member, .picrew-section {
|
||||||
|
margin-top: 0;
|
||||||
|
padding-bottom: 30px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
border-bottom: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
.pirate-crew-customize-member ul li {
|
||||||
|
vertical-align: middle;
|
||||||
|
position: relative;
|
||||||
|
padding: 15px 20px;
|
||||||
|
}
|
||||||
|
.pirate-crew-customize-member ul li img {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
.pirate-crew-customize-member ul li p {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.pirate-crew-customize-member ul li span {
|
||||||
|
position: absolute;
|
||||||
|
right: 20px;
|
||||||
|
top: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #2ea2cc;
|
||||||
|
}
|
||||||
|
.pirate-crew-customize-member ul li span.add-disabled {
|
||||||
|
color: #b9bec0;
|
||||||
|
}
|
||||||
|
.picrew-heading-group {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
#poststuff h2.sub-h {
|
||||||
|
font-size: 14px;
|
||||||
|
margin: 0 0 5px 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.picrew-heading-group span {
|
||||||
|
font-size: 12px;
|
||||||
|
color: rgba(10, 10, 10, 0.6);
|
||||||
|
}
|
||||||
|
.picrew-select-members {
|
||||||
|
max-width: 400px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
.wrap-picrew-members-list-selected, .picrew-members-list-selected {
|
||||||
|
max-width: 400px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
.picrew-members-list-selected {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
/*.picrew-select-members {
|
||||||
|
vertical-align: middle;
|
||||||
|
position: relative;
|
||||||
|
padding: 15px 20px;
|
||||||
|
border: 1px solid #cccccc;
|
||||||
|
position: relative;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: #fff;
|
||||||
|
}*/
|
||||||
|
.picrew-select-members > ul {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
.select-arrow {
|
||||||
|
float: right;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
background: url('../images/down-arrow.png') no-repeat;
|
||||||
|
background-size: contain;
|
||||||
|
}
|
||||||
|
.select-arrow.collapse {
|
||||||
|
background: url('../images/close.png') no-repeat;
|
||||||
|
background-size: contain;
|
||||||
|
}
|
||||||
|
.picrew-select-members.show ul {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.picrew-select-members.show {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
/*.picrew-members-list {
|
||||||
|
display: none;
|
||||||
|
max-height: 200px;
|
||||||
|
overflow: auto;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
left: -1px;
|
||||||
|
top: 100%;
|
||||||
|
background-color: #fff;
|
||||||
|
z-index: 1;
|
||||||
|
border: 1px solid #cccccc;
|
||||||
|
margin-top: 0;
|
||||||
|
box-sizing: content-box;
|
||||||
|
}*/
|
||||||
|
/*.picrew-members-list li {
|
||||||
|
margin-bottom: 0;
|
||||||
|
border: none;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
}*/
|
||||||
|
.picrew-members-list-selected li {
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
.picrew-members-list-selected li.ui-sortable-helper, .picrew-social-profile-wrap.ui-sortable-helper{
|
||||||
|
cursor: move;
|
||||||
|
}
|
||||||
|
.picrew-members-list-selected li.ui-sortable-helper {
|
||||||
|
-webkit-box-shadow: 0 1px 3px 1px rgba(0,0,0,0.2);
|
||||||
|
box-shadow: 0 1px 3px 1px rgba(0,0,0,0.2);
|
||||||
|
}
|
||||||
|
.picrew-members-info {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #bbb;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 40px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.picrew-preset-list label {
|
||||||
|
width: 85px;
|
||||||
|
height: 81px;
|
||||||
|
display: block;
|
||||||
|
float: left;
|
||||||
|
margin-right: 4px;
|
||||||
|
padding: 10px 10px 10px 10px;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #c2c2c2;
|
||||||
|
border-radius: 2px;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
.picrew-preset-list label.drawer {
|
||||||
|
background: url('../images/drawer.jpg') no-repeat;
|
||||||
|
background-position: center 10px;
|
||||||
|
}
|
||||||
|
input.picrew-radio-hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.picrew-radio-hidden:checked + label {
|
||||||
|
border: 3px solid #00afe9;
|
||||||
|
}
|
||||||
|
.picrew-preset-list label.picrew_pro_feature {
|
||||||
|
cursor: not-allowed;
|
||||||
|
position: relative;
|
||||||
|
border: 1px solid rgba(194, 194, 194, 0.2);
|
||||||
|
|
||||||
|
}
|
||||||
|
.picrew-preset-list label.picrew_pro_feature img,
|
||||||
|
.picrew-preset-list label.picrew_pro_feature span {
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
.picrew-preset-list label.picrew_pro_feature:before {
|
||||||
|
opacity: 0;
|
||||||
|
content: 'Pro Feature';
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
margin: auto;
|
||||||
|
height: 20px;
|
||||||
|
line-height: 20px;
|
||||||
|
transition: all ease 0.3s;
|
||||||
|
}
|
||||||
|
.picrew-preset-list label.picrew_pro_feature:hover:before {
|
||||||
|
opacity: 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
select.picrew-select-default {
|
||||||
|
width: 100%;
|
||||||
|
display: block;
|
||||||
|
border: 1px solid #acacac;
|
||||||
|
height: 40px;
|
||||||
|
box-shadow: none;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.picrew-custom-css-wrap textarea {
|
||||||
|
width: 100%;
|
||||||
|
height: 75px;
|
||||||
|
border: 1px solid #acacac;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
.pirate-crew-customize-footer {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.picrew-sorable-table {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
#member_details .picrew-sorable-table tbody tr:first-child td:last-child .remove-row {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#member_details .picrew-sorable-table .ui-sortable-helper {
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
#member_details .picrew-sorable-table .select2-container--default .select2-selection--single {
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
|
||||||
|
box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
#member_details .inside{
|
||||||
|
padding: 0 0 12px;
|
||||||
|
}
|
||||||
|
#member_details .member-details-section{
|
||||||
|
padding: 0 12px;
|
||||||
|
}
|
||||||
|
#member_details .inside h3{
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 12px 12px 0;
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
/********* select2 Style ************/
|
||||||
|
|
||||||
|
|
||||||
|
.picrew-select-members .select2-container--default .select2-selection--single {
|
||||||
|
height: 50px;
|
||||||
|
border-radius: 0;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picrew-select-members .select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||||
|
line-height: 50px;
|
||||||
|
padding-left: 15px;
|
||||||
|
padding-right: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picrew-select-members .select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||||
|
height: 50px;
|
||||||
|
width: 40px
|
||||||
|
}
|
||||||
|
.select2-result-repository {
|
||||||
|
position: relative;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
.select2-result-repository__title {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.select2-result-repository__avatar {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
.select2-result-repository__disabled {
|
||||||
|
position: absolute;
|
||||||
|
right: 20px;
|
||||||
|
top: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #b9bec0;
|
||||||
|
}
|
||||||
|
.pirate-crew-upgrade-msg h3{
|
||||||
|
text-align: center;
|
||||||
|
line-height: 1.7;
|
||||||
|
}
|
||||||
|
.pirate-crew-upgrade-list li:before {
|
||||||
|
content: "\f147";
|
||||||
|
font-size: 28px;
|
||||||
|
font-family: 'dashicons';
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 3px;
|
||||||
|
}
|
||||||
|
.pirate-crew-upgrade-list li {
|
||||||
|
padding-left: 35px;
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.pirate-crew-btn-upgrade {
|
||||||
|
background-color: #0085ba;
|
||||||
|
font-size: 14px;
|
||||||
|
height: 60px;
|
||||||
|
line-height: 60px;
|
||||||
|
display: block;
|
||||||
|
margin:20px 0 10px 0;
|
||||||
|
border-radius: 4px;
|
||||||
|
text-align: center;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.pirate-crew-upgrade-msg p {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #414141;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.pirate-crew-btn-upgrade:hover, .pirate-crew-btn-upgrade:active, .pirate-crew-btn-upgrade:focus {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #008fc8;
|
||||||
|
}
|
||||||
BIN
wp-content/plugins/Pirate-Crew/css/fonts/icomoon.eot
Normal file
78
wp-content/plugins/Pirate-Crew/css/fonts/icomoon.svg
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<metadata>Generated by IcoMoon</metadata>
|
||||||
|
<defs>
|
||||||
|
<font id="icomoon" horiz-adv-x="1024">
|
||||||
|
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
||||||
|
<missing-glyph horiz-adv-x="1024" />
|
||||||
|
<glyph unicode=" " horiz-adv-x="512" d="" />
|
||||||
|
<glyph unicode="" glyph-name="arrow-down" d="M1024 676.838v-0.178c-169.318-163.584-338.624-327.168-507.954-490.726-1.612 1.422-3.214 2.866-4.852 4.25-1.562-1.422-3.15-2.828-4.722-4.262-168.818 163.11-337.69 326.182-506.47 489.332v2.944c10.342 9.254 20.736 18.444 31.040 27.738 160.102-154.61 320.142-309.274 480.218-463.898 160.14 154.572 320.128 309.312 480.27 463.884 10.778-9.754 21.682-19.342 32.474-29.082z" />
|
||||||
|
<glyph unicode="" glyph-name="arrow-left" d="M253.682 451.866c163.212 168.998 326.452 337.972 489.69 506.932 9.754-10.804 19.404-21.684 29.082-32.564-154.226-159.744-308.582-319.36-462.798-479.116 154.266-159.706 308.544-319.412 462.81-479.116-9.486-10.688-19.058-21.298-28.518-32h-1.076c-163.072 168.78-326.156 337.548-489.178 506.38 1.408 1.6 2.816 3.188 4.224 4.774-1.408 1.574-2.83 3.15-4.236 4.71z" />
|
||||||
|
<glyph unicode="" glyph-name="arrow-right" d="M283.162 960h0.178c163.584-169.318 327.168-338.624 490.726-507.954-1.422-1.612-2.866-3.214-4.25-4.852 1.422-1.562 2.828-3.15 4.262-4.722-163.11-168.818-326.182-337.69-489.332-506.47h-2.944c-9.254 10.342-18.444 20.736-27.738 31.040 154.61 160.102 309.274 320.142 463.898 480.218-154.572 160.14-309.312 320.128-463.884 480.27 9.754 10.778 19.342 21.682 29.082 32.474z" />
|
||||||
|
<glyph unicode="" glyph-name="uniE612" d="M35.086 960h0.87c158.4-162.112 316.736-324.288 475.11-486.426 158.388 162.126 316.698 324.326 475.11 486.426h0.87c8.422-8.218 16.742-16.538 25.14-24.794-158.63-162.47-317.326-324.89-475.968-487.346 158.618-162.51 317.338-324.916 475.98-487.386-8.294-8.154-16.538-16.358-24.87-24.474h-1.446c-158.284 162.010-316.544 324.070-474.802 486.118-158.298-162.022-316.532-324.108-474.842-486.118h-1.46c-8.294 8.128-16.538 16.308-24.806 24.462 158.63 162.482 317.312 324.914 475.968 487.374-158.63 162.482-317.35 324.864-475.954 487.374 8.372 8.268 16.704 16.562 25.1 24.794z" />
|
||||||
|
<glyph unicode="" glyph-name="yelp" d="M608.876 306.532c-17.282-17.426-2.668-49.128-2.668-49.128l130.090-217.218c0 0 21.36-28.64 39.864-28.64 18.59 0 36.954 15.27 36.954 15.27l102.844 147.008c0 0 10.36 18.546 10.598 34.792 0.372 23.106-34.454 29.434-34.454 29.434l-243.488 78.192c-0.002-0.004-23.858 6.328-39.74-9.71zM596.532 416.016c12.46-21.128 46.828-14.972 46.828-14.972l242.938 71.006c0 0 33.106 13.466 37.832 31.418 4.64 17.954-5.46 39.622-5.46 39.622l-116.098 136.752c0 0-10.062 17.292-30.938 19.032-23.016 1.958-37.18-25.898-37.18-25.898l-137.27-216.010c0-0.004-12.134-21.516-0.652-40.95zM481.754 500.232c28.608 7.044 33.148 48.604 33.148 48.604l-1.944 345.87c0 0-4.314 42.666-23.486 54.232-30.070 18.242-38.982 8.718-47.596 7.444l-201.696-74.944c0 0-19.754-6.536-30.042-23.018-14.69-23.352 14.928-57.544 14.928-57.544l209.644-285.756c0 0 20.69-21.396 47.044-14.888zM431.944 360.262c0.722 26.676-32.030 42.7-32.030 42.7l-216.796 109.524c0 0-32.126 13.246-47.722 4.016-11.95-7.060-22.536-19.84-23.572-31.134l-14.12-173.812c0 0-2.116-30.114 5.69-43.82 11.054-19.442 47.428-5.902 47.428-5.902l253.096 55.942c9.832 6.61 27.074 7.204 28.026 42.486zM494.88 266.458c-21.726 11.156-47.724-11.95-47.724-11.95l-169.468-186.566c0 0-21.144-28.528-15.768-46.050 5.066-16.418 13.454-24.578 25.318-30.328l170.192-53.726c0 0 20.634-4.286 36.258 0.242 22.18 6.43 18.094 41.152 18.094 41.152l3.848 252.602c-0.002-0.002-0.868 24.334-20.75 34.624z" />
|
||||||
|
<glyph unicode="" glyph-name="github" horiz-adv-x="878" d="M438.857 877.714q119.429 0 220.286-58.857t159.714-159.714 58.857-220.286q0-143.429-83.714-258t-216.286-158.571q-15.429-2.857-22.857 4t-7.429 17.143q0 1.714 0.286 43.714t0.286 76.857q0 55.429-29.714 81.143 32.571 3.429 58.571 10.286t53.714 22.286 46.286 38 30.286 60 11.714 86q0 68-45.143 117.714 21.143 52-4.571 116.571-16 5.143-46.286-6.286t-52.571-25.143l-21.714-13.714q-53.143 14.857-109.714 14.857t-109.714-14.857q-9.143 6.286-24.286 15.429t-47.714 22-48.571 7.714q-25.714-64.571-4.571-116.571-45.143-49.714-45.143-117.714 0-48.571 11.714-85.714t30-60 46-38.286 53.714-22.286 58.571-10.286q-22.286-20.571-28-58.857-12-5.714-25.714-8.571t-32.571-2.857-37.429 12.286-31.714 35.714q-10.857 18.286-27.714 29.714t-28.286 13.714l-11.429 1.714q-12 0-16.571-2.571t-2.857-6.571 5.143-8 7.429-6.857l4-2.857q12.571-5.714 24.857-21.714t18-29.143l5.714-13.143q7.429-21.714 25.143-35.143t38.286-17.143 39.714-4 31.714 2l13.143 2.286q0-21.714 0.286-50.571t0.286-31.143q0-10.286-7.429-17.143t-22.857-4q-132.571 44-216.286 158.571t-83.714 258q0 119.429 58.857 220.286t159.714 159.714 220.286 58.857zM166.286 247.428q1.714 4-4 6.857-5.714 1.714-7.429-1.143-1.714-4 4-6.857 5.143-3.429 7.429 1.143zM184 228q4 2.857-1.143 9.143-5.714 5.143-9.143 1.714-4-2.857 1.143-9.143 5.714-5.714 9.143-1.714zM201.143 202.286q5.143 4 0 10.857-4.571 7.429-9.714 3.429-5.143-2.857 0-10.286t9.714-4zM225.143 178.286q4.571 4.571-2.286 10.857-6.857 6.857-11.429 1.714-5.143-4.571 2.286-10.857 6.857-6.857 11.429-1.714zM257.714 164q1.714 6.286-7.429 9.143-8.571 2.286-10.857-4t7.429-8.571q8.571-3.429 10.857 3.429zM293.714 161.143q0 7.429-9.714 6.286-9.143 0-9.143-6.286 0-7.429 9.714-6.286 9.143 0 9.143 6.286zM326.857 166.857q-1.143 6.286-10.286 5.143-9.143-1.714-8-8.571t10.286-4.571 8 8z" />
|
||||||
|
<glyph unicode="" glyph-name="flattr" d="M367.562 960c-243.358 0-367.562-140.162-367.562-401.856v0-549.034l238.39 238.628v278.896c0 108.416 28.73 177.406 125.118 192.894v0c33.672 6.584 103.75 4.278 148.306 4.278v0-165.596c0-1.51 0.208-4.206 0.594-5.586v0c1.87-6.704 7.93-11.616 15.116-11.63v0c4.062-0.008 7.868 2.104 11.79 5.97v0l413.122 412.974-584.874 0.062zM785.61 648.254v-278.89c0-108.414-28.736-177.414-125.116-192.894v0c-33.672-6.582-103.756-4.278-148.312-4.278v0 165.594c0 1.5-0.206 4.204-0.594 5.582v0c-1.864 6.712-7.922 11.622-15.112 11.63v0c-4.064 0.008-7.866-2.112-11.79-5.966v0l-413.124-412.966 584.874-0.066c243.354 0 367.564 140.168 367.564 401.852v0 549.028l-238.39-238.626z" />
|
||||||
|
<glyph unicode="" glyph-name="xing" d="M155.6 757.8c-8.8 0-16.4-3.2-20.2-9.2-3.8-6.4-3.2-14.4 0.8-22.6l99.8-172.8c0.2-0.4 0.2-0.6 0-0.8l-156.8-277.2c-4-8.2-3.8-16.4 0-22.6 3.8-6 10.4-10 19.2-10h147.6c22 0 32.8 15 40.2 28.6 0 0 153.4 271.4 159.4 282-0.6 1-101.6 177-101.6 177-7.4 13-18.4 27.6-41.2 27.6h-147.2zM776 960c-22 0-31.6-13.8-39.6-28.2 0 0-318.2-564.2-328.6-582.8 0.6-1 209.8-385 209.8-385 7.4-13 18.6-28.2 41.2-28.2h147.6c8.8 0 15.8 3.4 19.6 9.4 4 6.4 3.8 14.6-0.4 22.8l-208 380.6c-0.2 0.4-0.2 0.6 0 1l327 578.2c4 8.2 4.2 16.4 0.4 22.8-3.8 6-10.8 9.4-19.6 9.4h-149.4z" />
|
||||||
|
<glyph unicode="" glyph-name="xing2" d="M928 960h-832c-52.8 0-96-43.2-96-96v-832c0-52.8 43.2-96 96-96h832c52.8 0 96 43.2 96 96v832c0 52.8-43.2 96-96 96zM312.6 294h-110.6c-6.6 0-11.6 3-14.4 7.6-3 4.8-3 10.8 0 17l117.6 207.6c0.2 0.2 0.2 0.4 0 0.6l-74.8 129.6c-3 6.2-3.6 12.2-0.6 17 2.8 4.6 8.4 7 15.2 7h110.8c17 0 25.4-11 30.8-20.8 0 0 75.6-132 76.2-132.8-4.4-8-119.6-211.4-119.6-211.4-6-10.4-14-21.4-30.6-21.4zM836.4 807.8l-245.2-433.6c-0.2-0.2-0.2-0.6 0-0.8l156.2-285.2c3-6.2 3.2-12.4 0.2-17.2-2.8-4.6-8-7-14.8-7h-110.6c-17 0-25.4 11.2-31 21 0 0-157 288-157.4 288.8 7.8 13.8 246.4 437 246.4 437 6 10.6 13.2 21 29.6 21h112.2c6.6 0 12-2.6 14.8-7 2.8-4.6 2.8-10.8-0.4-17z" />
|
||||||
|
<glyph unicode="" glyph-name="stumbleupon" d="M852 960h-680c-94.6 0-172-77.4-172-172v-680c0-94.6 77.4-172 172-172h680c94.6 0 172 77.4 172 172v680c0 94.6-77.4 172-172 172zM512 640c-35.29 0-64-28.71-64-64v-256c0-105.872-86.13-192-192-192s-192 86.128-192 192v128h128v-128c0-35.29 28.71-64 64-64s64 28.71 64 64v256c0 105.87 86.13 192 192 192s192-86.13 192-178v-62l-82-24-46 24v62c0 21.29-28.71 50-64 50zM960 320c0-105.872-86.13-192-192-192s-192 86.128-192 206v124l46-24 82 24v-124c0-49.29 28.71-78 64-78s64 28.71 64 64v128h128v-128z" />
|
||||||
|
<glyph unicode="" glyph-name="stumbleupon2" d="M512 640c-35.2 0-64-28.8-64-64v-256c0-105.8-86.2-192-192-192s-192 86.2-192 192v128h128v-128c0-35.2 28.8-64 64-64s64 28.8 64 64v256c0 105.8 86.2 192 192 192s192-86.2 192-178v-62l-82-24-46 24v62c0 21.2-28.8 50-64 50zM960 320c0-105.8-86.2-192-192-192s-192 86.2-192 206v124l46-24 82 24v-124c0-49.2 28.8-78 64-78s64 28.8 64 64v128h128v-128z" />
|
||||||
|
<glyph unicode="" glyph-name="delicious" d="M0 960v-1024h1024v1024h-1024zM512 0v448h-448v448h448v-448h448v-448h-448z" />
|
||||||
|
<glyph unicode="" glyph-name="lastfm" d="M928 960h-832c-52.8 0-96-43.2-96-96v-832c0-52.8 43.2-96 96-96h832c52.8 0 96 43.2 96 96v832c0 52.8-43.2 96-96 96zM746.6 199.2c-177.6 0-239.2 80-272 179.6l-32.8 102.6c-24.6 75-53.4 133.4-143.6 133.4-62.6 0-126.2-45.2-126.2-171.4 0-98.6 50.2-160.2 121.2-160.2 80 0 133.4 59.6 133.4 59.6l32.8-89.2c0 0-55.4-54.4-171.4-54.4-144 0-224 84-224 240 0 162.2 80 257.6 231 257.6 136.6 0 205.2-49.2 248.4-182.6l33.8-102.6c24.6-75 67.8-129.4 171.4-129.4 69.8 0 106.8 15.4 106.8 53.4 0 29.8-17.4 51.4-69.8 63.6l-69.8 16.4c-85.2 20.6-119 64.6-119 134.4 0 111.8 90.4 146.8 182.6 146.8 104.6 0 168.4-38 176.6-130.4l-102.6-12.4c-4.2 44.2-30.8 62.6-80 62.6-45.2 0-72.8-20.6-72.8-55.4 0-30.8 13.4-49.2 58.4-59.6l65.6-14.4c88.2-20.6 135.4-63.6 135.4-146.8 0-102.2-86.2-141.2-213.4-141.2z" />
|
||||||
|
<glyph unicode="" glyph-name="lastfm2" d="M451.6 193.8l-37.6 102c0 0-61-68-152.4-68-81 0-138.4 70.4-138.4 183 0 144.2 72.8 195.8 144.2 195.8 103.2 0 136-66.8 164.2-152.4l37.6-117.2c37.6-113.8 108-205.2 310.8-205.2 145.4 0 244 44.6 244 161.8 0 95-54 144.2-154.8 167.8l-75 16.4c-51.6 11.8-66.8 32.8-66.8 68 0 39.8 31.6 63.4 83.2 63.4 56.4 0 86.8-21.2 91.4-71.6l117.2 14c-9.4 105.6-82.2 149-201.8 149-105.6 0-208.8-39.8-208.8-167.8 0-79.8 38.8-130.2 136-153.6l79.8-18.8c59.8-14 79.8-38.8 79.8-72.8 0-43.4-42.2-61-122-61-118.4 0-167.8 62.2-195.8 147.8l-38.8 117.2c-49 152.6-127.6 208.8-283.6 208.8-172.4 0-264-109-264-294.4 0-178.2 91.4-274.4 255.8-274.4 132.4 0 195.8 62.2 195.8 62.2v0z" />
|
||||||
|
<glyph unicode="" glyph-name="hackernews" d="M0 960v-1024h1024v1024h-1024zM544 376v-216h-64v216l-175 328h72.6l134.4-252 134.4 252h72.6l-175-328z" />
|
||||||
|
<glyph unicode="" glyph-name="reddit" d="M256 320c0 35.346 28.654 64 64 64s64-28.654 64-64c0-35.346-28.654-64-64-64s-64 28.654-64 64zM640 320c0 35.346 28.654 64 64 64s64-28.654 64-64c0-35.346-28.654-64-64-64s-64 28.654-64 64zM643.112 183.222c16.482 12.986 40.376 10.154 53.364-6.332s10.152-40.378-6.334-53.366c-45.896-36.158-115.822-59.524-178.142-59.524-62.322 0-132.248 23.366-178.144 59.522-16.486 12.99-19.32 36.882-6.332 53.368 12.99 16.482 36.882 19.318 53.366 6.332 26.422-20.818 78.722-43.222 131.11-43.222s104.688 22.404 131.112 43.222zM1024 448c0 70.692-57.308 128-128 128-48.116 0-89.992-26.57-111.852-65.82-65.792 35.994-145.952 59.246-233.28 64.608l76.382 171.526 146.194-42.2c13.152-37.342 48.718-64.114 90.556-64.114 53.020 0 96 42.98 96 96s-42.98 96-96 96c-36.56 0-68.342-20.442-84.554-50.514l-162.906 47.024c-18.224 5.258-37.538-3.722-45.252-21.052l-103.77-233.026c-85.138-5.996-163.262-29.022-227.636-64.236-21.864 39.25-63.766 65.804-111.882 65.804-70.692 0-128-57.308-128-128 0-52.312 31.402-97.254 76.372-117.102-8.070-24.028-12.372-49.104-12.372-74.898 0-176.73 200.576-320 448-320 247.422 0 448 143.27 448 320 0 25.792-4.3 50.862-12.368 74.886 44.97 19.85 76.368 64.802 76.368 117.114zM864 772c19.882 0 36-16.118 36-36s-16.118-36-36-36-36 16.118-36 36 16.118 36 36 36zM64 448c0 35.29 28.71 64 64 64 25.508 0 47.572-15.004 57.846-36.646-33.448-25.366-61.166-54.626-81.666-86.738-23.524 9.47-40.18 32.512-40.18 59.384zM512 12c-205.45 0-372 109.242-372 244s166.55 244 372 244c205.45 0 372-109.242 372-244s-166.55-244-372-244zM919.82 388.616c-20.5 32.112-48.218 61.372-81.666 86.738 10.276 21.642 32.338 36.646 57.846 36.646 35.29 0 64-28.71 64-64 0-26.872-16.656-49.914-40.18-59.384z" />
|
||||||
|
<glyph unicode="" glyph-name="soundcloud" d="M928 960h-832c-52.8 0-96-43.2-96-96v-832c0-52.8 43.2-96 96-96h832c52.8 0 96 43.2 96 96v832c0 52.8-43.2 96-96 96zM176 256h-32l-16 96 16 96h32l16-96-16-96zM304 256h-32l-16 128 16 128h32l16-128-16-128zM432 256h-32l-16 192 16 192h32l16-192-16-192zM825.2 256c-2 0-301.2 0.2-301.4 0.2-6.4 0.6-11.6 6.2-11.8 12.8v345.2c0 6.4 2.2 9.6 10.4 12.8 21.2 8.2 45 13 69.6 13 100.2 0 182.4-76.8 191.2-175 13 5.4 27.2 8.4 42 8.4 60 0 108.8-48.8 108.8-108.8s-48.8-108.6-108.8-108.6z" />
|
||||||
|
<glyph unicode="" glyph-name="soundcloud2" d="M891.96 445.796c-18.086 0-35.348-3.52-51.064-9.856-10.506 114.358-110.29 204.060-232 204.060-29.786 0-58.682-5.63-84.318-15.164-9.96-3.702-12.578-7.52-12.578-14.916v-402.714c0-7.766 6.24-14.234 14.124-14.996 0.336-0.034 363.536-0.21 365.89-0.21 72.904 0 131.986 56.816 131.986 126.894s-59.134 126.902-132.040 126.902zM400 192h32l16 224.22-16 223.78h-32l-16-223.78zM304 192h-32l-16 162.75 16 157.25h32l16-160zM144 192h32l16 128-16 128h-32l-16-128zM16 256h32l16 64-16 64h-32l-16-64z" />
|
||||||
|
<glyph unicode="" glyph-name="yahoo" d="M568.2 371v0c112.6 197.6 298.6 520 349.6 589-22.4-15-56.8-22.6-88.4-29.8l-47.8 29.8c-38.4-71.6-180-303-270.2-451.2-91.4 151.4-199.6 326.2-270.2 451.2-56-12-79.2-12.6-135 0v0 0c0 0 0 0 0 0v0c110.8-166.8 288.2-484.6 348.6-589v0l-8.2-435 64.8 29.8v0.8l64.8-30.6-8 435z" />
|
||||||
|
<glyph unicode="" glyph-name="blogger2" d="M957.796 576h-57.406c-35.166 0-65.988 29.742-68.39 64v0c0.004 182.668-147.258 320-331.19 320h-167.824c-183.812 0-332.856-148-332.986-330.666v-362.798c0-182.654 149.174-330.536 332.984-330.536h358.42c183.948 0 332.596 147.882 332.596 330.536v234.382c0 36.502-29.44 75.082-66.204 75.082zM320 704h192c35.2 0 64-28.8 64-64s-28.8-64-64-64h-192c-35.2 0-64 28.8-64 64s28.8 64 64 64zM704 192h-384c-35.2 0-64 28.8-64 64s28.8 64 64 64h384c35.2 0 64-28.8 64-64s-28.8-64-64-64z" />
|
||||||
|
<glyph unicode="" glyph-name="ello" d="M512 960c-282.77 0-512-229.23-512-512s229.23-512 512-512 512 229.23 512 512-229.23 512-512 512zM824.636 370.402c-36.798-142.716-165.358-242.402-312.63-242.402-147.282 0-275.85 99.686-312.654 242.42-6.232 24.158 8.352 48.886 32.512 55.124 3.71 0.958 7.528 1.446 11.338 1.446 20.624 0 38.628-13.972 43.788-33.976 26.512-102.748 119.042-174.51 225.014-174.51 105.978 0 198.502 71.76 225 174.51 5.152 20.006 23.15 33.982 43.766 33.982 3.822 0 7.65-0.49 11.376-1.456 11.692-3.016 21.526-10.418 27.668-20.842 6.142-10.416 7.854-22.596 4.822-34.296z" />
|
||||||
|
<glyph unicode="" glyph-name="wordpress2" d="M128 448.008c0-148.026 88.322-275.968 216.43-336.578l-183.178 488.784c-21.308-46.508-33.252-97.982-33.252-152.206zM771.228 466.872c0 46.234-17.054 78.236-31.654 103.142-19.458 30.82-37.72 56.894-37.72 87.716 0 34.374 26.766 66.376 64.486 66.376 1.704 0 3.32-0.204 4.976-0.302-68.316 60.97-159.34 98.196-259.308 98.196-134.16 0-252.186-67.046-320.844-168.568 9.010-0.282 17.506-0.454 24.712-0.454 40.154 0 102.34 4.752 102.34 4.752 20.69 1.182 23.132-28.434 2.458-30.822 0 0-20.81-2.368-43.952-3.55l139.834-405.106 84.044 245.456-59.822 159.65c-20.688 1.184-40.278 3.55-40.278 3.55-20.702 1.192-18.272 32.002 2.438 30.822 0 0 63.4-4.752 101.134-4.752 40.146 0 102.35 4.752 102.35 4.752 20.702 1.182 23.14-28.434 2.446-30.822 0 0-20.834-2.372-43.948-3.55l138.78-402.018 38.312 124.632c16.58 51.75 29.216 88.9 29.216 120.9zM518.742 415.296l-115.226-326.058c34.416-9.858 70.794-15.238 108.488-15.238 44.716 0 87.604 7.518 127.518 21.2-1.018 1.602-1.974 3.304-2.75 5.154l-118.030 314.942zM848.962 627.428c1.652-11.91 2.588-24.686 2.588-38.458 0-37.93-7.292-80.596-29.202-133.95l-117.286-330.272c114.162 64.828 190.938 185.288 190.938 323.258 0 65.030-17.060 126.16-47.038 179.422zM512 960c-282.77 0-512-229.23-512-512s229.23-512 512-512 512 229.23 512 512-229.23 512-512 512zM512 0c-247.424 0-448 200.576-448 448s200.576 448 448 448 448-200.576 448-448-200.576-448-448-448z" />
|
||||||
|
<glyph unicode="" glyph-name="steam" d="M303.922 123.99c27.144 0 53.786 13.136 69.972 37.416 25.734 38.602 15.302 90.754-23.298 116.488l-66.074 44.048c11.308 3.080 23.194 4.756 35.478 4.756 74.392 0 134.696-60.304 134.696-134.698s-60.306-134.698-134.698-134.698c-72.404 0-131.444 57.132-134.548 128.774l71.954-47.968c14.322-9.548 30.506-14.118 46.518-14.118zM853.34 960c93.876 0 170.66-76.812 170.66-170.688v-682.628c0-93.936-76.784-170.684-170.66-170.684h-682.652c-93.876 0-170.688 76.75-170.688 170.682v203.028l121.334-80.888c-11.652-63.174 6.938-130.83 55.798-179.69 78.904-78.904 206.83-78.904 285.736 0 48.468 48.466 67.15 115.43 56.076 178.166l249.056 222.988c46.248 6.638 90.816 27.744 126.394 63.322 87.476 87.476 87.476 229.306 0 316.784-87.48 87.478-229.308 87.478-316.786 0-35.578-35.578-56.684-80.146-63.322-126.392v0l-204.694-310.23c-31.848-1.632-63.378-10.764-91.726-27.392l-217.866 145.244v277.69c0 93.876 76.81 170.688 170.686 170.688h682.654zM896 672c0 88.366-71.634 160-160 160s-160-71.634-160-160 71.634-160 160-160 160 71.634 160 160zM640 672c0 53.020 42.98 96 96 96s96-42.98 96-96-42.98-96-96-96-96 42.98-96 96z" />
|
||||||
|
<glyph unicode="" glyph-name="steam2" d="M704 672c0 53.019 42.981 96 96 96s96-42.981 96-96c0-53.019-42.981-96-96-96s-96 42.981-96 96zM958.392 830.392c-87.478 87.476-229.306 87.476-316.786 0-35.578-35.578-56.684-80.146-63.322-126.392v0l-204.694-310.228c-27.506-1.41-54.776-8.416-79.966-21.016l-157.892 123.424c-36.55 28.574-89.342 22.102-117.912-14.448-28.572-36.55-22.102-89.342 14.448-117.912l155.934-121.892c-16.96-66.782 0.672-140.538 52.93-192.794 78.906-78.904 206.832-78.904 285.736 0 48.466 48.466 67.15 115.428 56.076 178.166l249.054 222.986c46.248 6.638 90.816 27.744 126.394 63.322 87.478 87.476 87.478 229.306 0 316.784zM384 57.302c-74.39 0-134.698 60.304-134.698 134.698 0 0.712 0.042 1.414 0.054 2.124l66.912-52.304c15.36-12.006 33.582-17.824 51.674-17.824 24.962 0 49.672 11.080 66.238 32.272 28.572 36.55 22.102 89.342-14.448 117.912l-63.5 49.636c8.962 1.878 18.248 2.88 27.768 2.88 74.392 0 134.698-60.304 134.698-134.698s-60.306-134.696-134.698-134.696zM800 512c-88.366 0-160 71.634-160 160s71.634 160 160 160 160-71.634 160-160-71.634-160-160-160z" />
|
||||||
|
<glyph unicode="" glyph-name="500px" d="M253 287.2c0.2-0.6 5.6-15.2 8.6-22.6 16.8-39.8 41-75.8 71.8-106.6s66.6-55 106.6-71.8c41.4-17.4 85.2-26.4 130.4-26.4s89.2 8.8 130.4 26.4c40 16.8 75.8 41 106.6 71.8s55 66.6 71.8 106.6c17.4 41.4 26.4 85.2 26.4 130.4s-8.8 89.2-26.4 130.4c-16.8 40-41 75.8-71.8 106.6s-66.6 55-106.6 71.8c-41.4 17.4-85.2 26.4-130.4 26.4-45.8 0-91.6-9.2-132.2-26.4-32.6-13.8-87.8-49.2-120-82.6l-0.2-0.2v276h463.4c16.8 0.2 16.8 23.8 16.8 31.4 0 7.8 0 31.2-17 31.4h-501c-13.6 0-22-11.4-22-21.8v-388.2c0-12.6 15.6-21.6 30.2-24.6 28.4-6 34.8 3 41.8 12.6l1 1.2c10.6 15.8 43.6 49 44 49.4 51.6 51.6 120.6 80 194.4 80 73.4 0 142.2-28.4 193.8-80 51.8-51.8 80.4-120.4 80.4-193.2 0-73-28.4-141.8-80-193.2-50.8-50.8-122-80-195-80-49.4 0-97.2 13.2-138.2 38.2l0.2 236c0 31.4 13.6 65.8 36.6 91.6 26.2 29.6 62.2 45.8 101.6 45.8 38 0 73.6-14.4 100.2-40.6 26.2-26 40.8-60.8 40.8-97.8 0-78.8-62-140.6-141.2-140.6-15.2 0-43 6.8-44.2 7-16 4.8-22.8-17.4-25-24.8-8.6-28.2 4.4-33.8 7-34.6 25.4-8 42.2-9.4 64.2-9.4 111.8 0 202.8 91 202.8 202.8 0 111-91 201.2-202.6 201.2-54.8 0-106.2-21-144.8-58.8-36.8-36.2-57.8-84.4-57.8-132.4v-1.2c-0.2-6-0.2-147.6-0.4-194l-0.2 0.2c-21 23.2-41.8 58.8-55.6 95.2-5.4 14.2-17.6 11.8-34.2 6.6-8-2.2-30-9-25-25.2v0zM491.2 342.6c0-6.8 6.2-12.8 10-16.2l1.2-1.2c6.4-6.2 12.4-9.4 18-9.4 4.6 0 7.4 2.2 8.4 3.2 2.8 2.6 34.4 34.8 37.6 37.8l35.4-35.2c3.2-3.6 6.8-5.6 11-5.6 5.6 0 11.8 3.4 18.2 10 15.2 15.6 7.6 24 4 28l-35.8 35.8 37.4 37.6c8.2 8.8 1 18.2-6.2 25.4-10.4 10.4-20.6 13.2-27 7.2l-37.2-37.2-37.6 37.6c-2 2-4.6 3-7.2 3-5 0-11-3.4-17.6-10-11.6-11.6-14-19.6-8-26l37.6-37.4-37.4-37.4c-3.4-3.2-5-6.6-4.8-10zM573 850.2c-60 0-124-12.2-170.8-32.4-5-2-8-6-8.6-11.6-0.6-5.4 0.8-12.4 4.4-21.6 3-7.4 10.6-27.2 25.6-21.4 48 18.4 101.2 28.4 149.4 28.4 54.8 0 108-10.8 158-31.8 39.8-16.8 77.2-41.2 118-76.4 3-2.6 6.2-3.8 9.4-3.8 8 0 15.6 7.8 22.2 15.2 10.8 12.2 18.4 22.4 7.6 32.6-39 36.8-81.6 64.4-134.4 86.8-57.2 23.8-118.2 36-180.8 36zM896.4 108.8v0c-7.2 7.2-13.4 11.4-18.8 13s-10.4 0.4-14.2-3.4l-3.6-3.6c-37.2-37.2-80.6-66.4-128.8-86.8-50-21.2-103-31.8-157.6-31.8-54.8 0-107.8 10.8-157.6 31.8-48.2 20.4-91.6 49.6-128.8 86.8-38.8 38.8-68 82.2-86.8 128.8-18.4 45.6-24.4 79.8-26.4 91-0.2 1-0.4 1.8-0.4 2.4-2.6 13.2-14.8 14.2-32.2 11.4-7.2-1.2-29.4-4.6-27.4-20.4v-0.4c5.8-37 16.2-73.2 30.8-107.6 23.4-55.4 57-105.2 99.8-148s92.6-76.2 148-99.8c57.4-24.2 118.4-36.6 181.2-36.6s123.8 12.4 181.2 36.6c55.4 23.4 105.2 57 148 99.8 0 0 2.4 2.4 3.8 3.8 4.4 5.4 8.6 14.4-10.2 33z" />
|
||||||
|
<glyph unicode="" glyph-name="deviantart" d="M829 773.8v186.2h-186.2l-18.6-18.8-88-167.4-27.6-18.6h-313.6v-255.6h172.4l15.4-18.6-187.8-358.8v-186.2h186.2l18.6 18.8 88 167.4 27.6 18.6h313.6v255.6h-172.4l-15.4 18.8z" />
|
||||||
|
<glyph unicode="" glyph-name="twitch" d="M96 960l-96-160v-736h256v-128h128l128 128h160l288 288v608h-864zM832 416l-160-160h-160l-128-128v128h-192v576h640v-416zM608 704h96v-256h-96v256zM416 704h96v-256h-96v256z" />
|
||||||
|
<glyph unicode="" glyph-name="feed" d="M928 960h-832c-52.8 0-96-43.2-96-96v-832c0-52.8 43.2-96 96-96h832c52.8 0 96 43.2 96 96v832c0 52.8-43.2 96-96 96zM279 128.8c-48 0-87 38.6-87 86.6 0 47.6 39 86.8 87 86.8 48.2 0 87-39.2 87-86.8 0-48-39-86.6-87-86.6zM497.4 128c0 81.8-31.8 158.8-89.4 216.4-57.8 57.8-134.4 89.6-216 89.6v125.2c237.6 0 431.2-193.4 431.2-431.2h-125.8zM719.6 128c0 291-236.6 528-527.4 528v125.2c360 0 653-293.2 653-653.2h-125.6z" />
|
||||||
|
<glyph unicode="" glyph-name="feed2" d="M136.294 209.070c-75.196 0-136.292-61.334-136.292-136.076 0-75.154 61.1-135.802 136.292-135.802 75.466 0 136.494 60.648 136.494 135.802-0.002 74.742-61.024 136.076-136.494 136.076zM0.156 612.070v-196.258c127.784 0 247.958-49.972 338.458-140.512 90.384-90.318 140.282-211.036 140.282-339.3h197.122c-0.002 372.82-303.282 676.070-675.862 676.070zM0.388 960v-196.356c455.782 0 826.756-371.334 826.756-827.644h196.856c0 564.47-459.254 1024-1023.612 1024z" />
|
||||||
|
<glyph unicode="" glyph-name="sina-weibo" d="M430.2 62c-169.6-16.8-316 60-327 171.2-11 111.4 117.6 215 287 231.8 169.6 16.8 316-60 326.8-171.2 11.2-111.4-117.4-215.2-286.8-231.8zM769.2 431.4c-14.4 4.4-24.4 7.2-16.8 26.2 16.4 41.2 18 76.6 0.2 102-33.2 47.4-124.2 45-228.4 1.2 0 0-32.8-14.2-24.4 11.6 16 51.6 13.6 94.6-11.4 119.6-56.6 56.6-207-2.2-336-131.2-96.4-96.2-152.4-198.8-152.4-287.4 0-169.2 217.2-272.2 429.6-272.2 278.4 0 463.8 161.8 463.8 290.2 0 77.8-65.4 121.8-124.2 140zM954.2 741.4c-67.2 74.6-166.4 103-258 83.6v0c-21.2-4.6-34.6-25.4-30-46.4 4.6-21.2 25.2-34.6 46.4-30 65.2 13.8 135.6-6.4 183.4-59.4s60.8-125.2 40.2-188.4v0c-6.6-20.6 4.6-42.6 25.2-49.4 20.6-6.6 42.6 4.6 49.4 25.2v0.2c28.8 88.4 10.6 190-56.6 264.6zM850.8 648c-32.8 36.4-81.2 50.2-125.6 40.6-18.2-3.8-29.8-22-26-40.2 4-18.2 22-29.8 40-25.8v0c21.8 4.6 45.4-2.2 61.4-19.8 16-17.8 20.4-42 13.4-63.2v0c-5.6-17.6 4-36.8 21.8-42.6 17.8-5.6 36.8 4 42.6 21.8 14 43.4 5.2 93-27.6 129.2zM439.6 263.4c-6-10.2-19-15-29.2-10.8-10.2 4-13.2 15.6-7.4 25.4 6 9.8 18.6 14.6 28.6 10.8 10-3.6 13.6-15 8-25.4zM385.4 194.2c-16.4-26.2-51.6-37.6-78-25.6-26 11.8-33.8 42.2-17.4 67.8 16.2 25.4 50.2 36.8 76.4 25.8 26.6-11.4 35.2-41.6 19-68zM447 379.4c-80.6 21-171.8-19.2-206.8-90.2-35.8-72.4-1.2-153 80.2-179.4 84.4-27.2 184 14.6 218.6 92.6 34.2 76.6-8.4 155.2-92 177z" />
|
||||||
|
<glyph unicode="" glyph-name="renren" d="M425.2 949.4c-241.2-40.6-425.2-250.4-425.2-503.2 0-125.6 45.6-240.6 120.8-329.6 178.6 86.4 303.6 282 304.4 509.8v323zM598.8 949.4c241.2-40.6 425.2-250.4 425.2-503.2 0-125.6-45.6-240.6-120.8-329.6-178.6 86.4-303.6 282-304.4 509.8v323zM510.2 317.4c-31.8-131.6-126.8-244-245-318.8 72.8-39.8 156.2-62.6 245-62.6s172.2 22.8 245 62.6c-118.2 74.8-213.2 187.2-245 318.8z" />
|
||||||
|
<glyph unicode="" glyph-name="vk" d="M928 960h-832c-52.8 0-96-43.2-96-96v-832c0-52.8 43.2-96 96-96h832c52.8 0 96 43.2 96 96v832c0 52.8-43.2 96-96 96zM829.4 243.2l-93.6-1.4c0 0-20.2-4-46.6 14.2-35 24-68 86.6-93.8 78.4-26-8.2-25.2-64.4-25.2-64.4s0.2-12-5.8-18.4c-6.4-7-19.2-8.4-19.2-8.4h-41.8c0 0-92.4-5.6-173.8 79.2-88.8 92.4-167.2 275.8-167.2 275.8s-4.6 12 0.4 17.8c5.6 6.6 20.6 7 20.6 7l100.2 0.6c0 0 9.4-1.6 16.2-6.6 5.6-4 8.6-11.8 8.6-11.8s16.2-41 37.6-78c41.8-72.2 61.4-88 75.6-80.4 20.6 11.2 14.4 102.2 14.4 102.2s0.4 33-10.4 47.6c-8.4 11.4-24.2 14.8-31 15.6-5.6 0.8 3.6 13.8 15.6 19.8 18 8.8 49.8 9.4 87.4 9 29.2-0.2 37.8-2.2 49.2-4.8 34.6-8.4 22.8-40.6 22.8-117.8 0-24.8-4.4-59.6 13.4-71 7.6-5 26.4-0.8 73.4 79 22.2 37.8 39 82.2 39 82.2s3.6 8 9.2 11.4c5.8 3.4 13.6 2.4 13.6 2.4l105.4 0.6c0 0 31.6 3.8 36.8-10.6 5.4-15-11.8-50-54.8-107.4-70.6-94.2-78.6-85.4-19.8-139.8 56-52 67.6-77.4 69.6-80.6 22.8-38.4-26-41.4-26-41.4z" />
|
||||||
|
<glyph unicode="" glyph-name="vine" d="M960.8 451c-26.4-6-51.8-8.8-74.8-8.8-129.2 0-228.6 90.2-228.6 247.2 0 77 29.8 116.8 71.8 116.8 40 0 66.6-35.8 66.6-108.6 0-41.4-11-86.8-19.2-113.6 0 0 39.8-69.4 148.6-48.2 23.2 51.4 35.6 117.8 35.6 176 0 156.8-80 248.2-226.6 248.2-150.8 0-239-115.8-239-268.6 0-151.4 70.8-281.2 187.4-340.4-49-98.2-111.4-184.6-176.6-249.8-118 142.8-224.8 333.2-268.6 705h-174.2c80.6-619.2 320.4-816.4 384-854.2 35.8-21.6 66.8-20.6 99.6-2 51.6 29.2 206.2 184 292 365 36 0 79.2 4.2 122.2 14v122z" />
|
||||||
|
<glyph unicode="" glyph-name="telegram" d="M512 960c-282.8 0-512-229.2-512-512s229.2-512 512-512 512 229.2 512 512-229.2 512-512 512zM763.6 609l-84-395.8c-5.8-28.2-22.8-34.8-46.4-21.8l-128 94.6-61.4-59.8c-7.2-7-12.8-12.8-25.6-12.8-16.6 0-13.8 6.2-19.4 22l-43.6 143.2-126.6 39.4c-27.4 8.4-27.6 27.2 6.2 40.6l493.2 190.4c22.4 10.2 44.2-5.4 35.6-40z" />
|
||||||
|
<glyph unicode="" glyph-name="spotify" d="M512 960c-281.6 0-512-230.4-512-512s230.4-512 512-512 512 230.4 512 512-227.8 512-512 512zM747.6 220.2c-10.2-15.4-28.2-20.4-43.6-10.2-120.4 74.2-271.4 89.6-450.6 48.6-18-5.2-33.2 7.6-38.4 23-5.2 18 7.6 33.2 23 38.4 194.6 43.6 363.6 25.6 496.6-56.4 18-7.6 20.6-28 13-43.4zM809 361c-12.8-18-35.8-25.6-53.8-12.8-138.2 84.4-348.2 110-509.4 58.8-20.4-5.2-43.6 5.2-48.6 25.6-5.2 20.4 5.2 43.6 25.6 48.6 186.8 56.4 417.2 28.2 576-69.2 15.2-7.6 23-33.2 10.2-51zM814 504.4c-163.8 97.2-437.8 107.6-594 58.8-25.6-7.6-51.2 7.6-58.8 30.8-7.6 25.6 7.6 51.2 30.8 58.8 181.8 53.8 481.2 43.6 670.8-69.2 23-12.8 30.8-43.6 18-66.6-13-17.8-43.6-25.4-66.8-12.6z" />
|
||||||
|
<glyph unicode="" glyph-name="mail2" d="M512 960c-282.77 0-512-229.23-512-512s229.23-512 512-512 512 229.23 512 512-229.23 512-512 512zM256 704h512c9.138 0 18.004-1.962 26.144-5.662l-282.144-329.168-282.144 329.17c8.14 3.696 17.006 5.66 26.144 5.66zM192 256v384c0 1.34 0.056 2.672 0.14 4l187.664-218.942-185.598-185.598c-1.444 5.336-2.206 10.886-2.206 16.54zM768 192h-512c-5.654 0-11.202 0.762-16.54 2.208l182.118 182.118 90.422-105.498 90.424 105.494 182.116-182.12c-5.34-1.44-10.886-2.202-16.54-2.202zM832 256c0-5.654-0.762-11.2-2.206-16.54l-185.6 185.598 187.666 218.942c0.084-1.328 0.14-2.66 0.14-4v-384z" />
|
||||||
|
<glyph unicode="" glyph-name="mail3" d="M853.31 960h-682.62c-93.88 0-170.69-76.784-170.69-170.658v-682.656c0-93.876 76.81-170.686 170.69-170.686h682.622c93.938 0 170.688 76.81 170.688 170.686v682.656c0 93.874-76.75 170.658-170.69 170.658zM256 704h512c9.138 0 18.004-1.962 26.144-5.662l-282.144-329.168-282.144 329.17c8.14 3.696 17.006 5.66 26.144 5.66zM192 256v384c0 1.34 0.056 2.672 0.14 4l187.664-218.94-185.598-185.6c-1.444 5.338-2.206 10.886-2.206 16.54zM768 192h-512c-5.654 0-11.202 0.762-16.54 2.206l182.118 182.118 90.422-105.496 90.424 105.494 182.116-182.118c-5.34-1.442-10.886-2.204-16.54-2.204zM832 256c0-5.654-0.762-11.2-2.206-16.54l-185.598 185.598 187.664 218.942c0.084-1.328 0.14-2.66 0.14-4v-384z" />
|
||||||
|
<glyph unicode="" glyph-name="mail" d="M928 832h-832c-52.8 0-96-43.2-96-96v-640c0-52.8 43.2-96 96-96h832c52.8 0 96 43.2 96 96v640c0 52.8-43.2 96-96 96zM398.74 409.628l-270.74-210.892v501.642l270.74-290.75zM176.38 704h671.24l-335.62-252-335.62 252zM409.288 398.302l102.712-110.302 102.71 110.302 210.554-270.302h-626.528l210.552 270.302zM625.26 409.628l270.74 290.75v-501.642l-270.74 210.892z" />
|
||||||
|
<glyph unicode="" glyph-name="link" d="M440.236 324.234c-13.31 0-26.616 5.076-36.77 15.23-95.134 95.136-95.134 249.934 0 345.070l192 192c46.088 46.086 107.36 71.466 172.534 71.466s126.448-25.38 172.536-71.464c95.132-95.136 95.132-249.934 0-345.070l-87.766-87.766c-20.308-20.308-53.23-20.308-73.54 0-20.306 20.306-20.306 53.232 0 73.54l87.766 87.766c54.584 54.586 54.584 143.404 0 197.99-26.442 26.442-61.6 41.004-98.996 41.004s-72.552-14.562-98.996-41.006l-192-191.998c-54.586-54.586-54.586-143.406 0-197.992 20.308-20.306 20.306-53.232 0-73.54-10.15-10.152-23.462-15.23-36.768-15.23zM256-52c-65.176 0-126.45 25.38-172.534 71.464-95.134 95.136-95.134 249.934 0 345.070l87.764 87.764c20.308 20.306 53.234 20.306 73.54 0 20.308-20.306 20.308-53.232 0-73.54l-87.764-87.764c-54.586-54.586-54.586-143.406 0-197.992 26.44-26.44 61.598-41.002 98.994-41.002s72.552 14.562 98.998 41.006l192 191.998c54.584 54.586 54.584 143.406 0 197.992-20.308 20.308-20.306 53.232 0 73.54 20.306 20.306 53.232 20.306 73.54-0.002 95.132-95.134 95.132-249.932 0.002-345.068l-192.002-192c-46.090-46.088-107.364-71.466-172.538-71.466z" />
|
||||||
|
<glyph unicode="" glyph-name="google-plus" d="M325.8 502.6v-111.8h184.8c-7.4-48-55.8-140.6-184.8-140.6-111.2 0-202 92.2-202 205.8s90.8 205.8 202 205.8c63.4 0 105.6-27 129.8-50.2l88.4 85.2c-56.8 53-130.4 85.2-218.2 85.2-180.2-0.2-325.8-145.8-325.8-326s145.6-325.8 325.8-325.8c188 0 312.8 132.2 312.8 318.4 0 21.4-2.4 37.8-5.2 54h-307.6zM1024 512h-96v96h-96v-96h-96v-96h96v-96h96v96h96z" />
|
||||||
|
<glyph unicode="" glyph-name="google-plus2" d="M928 960h-832c-52.8 0-96-43.2-96-96v-832c0-52.8 43.2-96 96-96h832c52.8 0 96 43.2 96 96v832c0 52.8-43.2 96-96 96zM384 192c-141.6 0-256 114.4-256 256s114.4 256 256 256c69.2 0 127-25.2 171.6-67l-69.6-66.8c-19 18.2-52.2 39.4-102 39.4-87.4 0-158.8-72.4-158.8-161.6s71.4-161.6 158.8-161.6c101.4 0 139.4 72.8 145.2 110.4h-145.2v87.8h241.8c2.2-12.8 4-25.6 4-42.4 0-146.4-98-250.2-245.8-250.2zM896 448h-64v-64h-64v64h-64v64h64v64h64v-64h64v-64z" />
|
||||||
|
<glyph unicode="" glyph-name="hangouts" d="M511.8 960c-244.2 0-442.2-198-442.2-442.2 0-231.4 210.8-419 442.2-419v-162.8c268.6 136.2 442.6 355.6 442.6 581.8 0 244.2-198.4 442.2-442.6 442.2zM448 448c0-53-28.6-96-64-96v96h-128v192h192v-192zM768 448c0-53-28.6-96-64-96v96h-128v192h192v-192z" />
|
||||||
|
<glyph unicode="" glyph-name="google-drive" d="M438 320l-184.6-320h580.6l184.6 320zM992.4 384l-295.6 512h-369.6l295.6-512zM290.2 832l-290.2-502.8 184.8-320 290.2 502.8z" />
|
||||||
|
<glyph unicode="" glyph-name="facebook" d="M608 768h160v192h-160c-123.514 0-224-100.486-224-224v-96h-128v-192h128v-512h192v512h160l32 192h-192v96c0 17.346 14.654 32 32 32z" />
|
||||||
|
<glyph unicode="" glyph-name="facebook2" d="M928 960h-832c-52.8 0-96-43.2-96-96v-832c0-52.8 43.2-96 96-96h416v448h-128v128h128v64c0 105.8 86.2 192 192 192h128v-128h-128c-35.2 0-64-28.8-64-64v-64h192l-32-128h-160v-448h288c52.8 0 96 43.2 96 96v832c0 52.8-43.2 96-96 96z" />
|
||||||
|
<glyph unicode="" glyph-name="instagram" d="M512 867.8c136.8 0 153-0.6 206.8-3 50-2.2 77-10.6 95-17.6 23.8-9.2 41-20.4 58.8-38.2 18-18 29-35 38.4-58.8 7-18 15.4-45.2 17.6-95 2.4-54 3-70.2 3-206.8s-0.6-153-3-206.8c-2.2-50-10.6-77-17.6-95-9.2-23.8-20.4-41-38.2-58.8-18-18-35-29-58.8-38.4-18-7-45.2-15.4-95-17.6-54-2.4-70.2-3-206.8-3s-153 0.6-206.8 3c-50 2.2-77 10.6-95 17.6-23.8 9.2-41 20.4-58.8 38.2-18 18-29 35-38.4 58.8-7 18-15.4 45.2-17.6 95-2.4 54-3 70.2-3 206.8s0.6 153 3 206.8c2.2 50 10.6 77 17.6 95 9.2 23.8 20.4 41 38.2 58.8 18 18 35 29 58.8 38.4 18 7 45.2 15.4 95 17.6 53.8 2.4 70 3 206.8 3zM512 960c-139 0-156.4-0.6-211-3-54.4-2.4-91.8-11.2-124.2-23.8-33.8-13.2-62.4-30.6-90.8-59.2-28.6-28.4-46-57-59.2-90.6-12.6-32.6-21.4-69.8-23.8-124.2-2.4-54.8-3-72.2-3-211.2s0.6-156.4 3-211c2.4-54.4 11.2-91.8 23.8-124.2 13.2-33.8 30.6-62.4 59.2-90.8 28.4-28.4 57-46 90.6-59 32.6-12.6 69.8-21.4 124.2-23.8 54.6-2.4 72-3 211-3s156.4 0.6 211 3c54.4 2.4 91.8 11.2 124.2 23.8 33.6 13 62.2 30.6 90.6 59s46 57 59 90.6c12.6 32.6 21.4 69.8 23.8 124.2 2.4 54.6 3 72 3 211s-0.6 156.4-3 211c-2.4 54.4-11.2 91.8-23.8 124.2-12.6 34-30 62.6-58.6 91-28.4 28.4-57 46-90.6 59-32.6 12.6-69.8 21.4-124.2 23.8-54.8 2.6-72.2 3.2-211.2 3.2v0zM512 711c-145.2 0-263-117.8-263-263s117.8-263 263-263 263 117.8 263 263c0 145.2-117.8 263-263 263zM512 277.4c-94.2 0-170.6 76.4-170.6 170.6s76.4 170.6 170.6 170.6c94.2 0 170.6-76.4 170.6-170.6s-76.4-170.6-170.6-170.6zM846.8 721.4c0-33.91-27.49-61.4-61.4-61.4s-61.4 27.49-61.4 61.4c0 33.91 27.49 61.4 61.4 61.4s61.4-27.49 61.4-61.4z" />
|
||||||
|
<glyph unicode="" glyph-name="whatsapp" d="M873 811.2c-95.8 96-223.2 148.8-359 148.8-279.6 0-507.2-227.6-507.2-507.4 0-89.4 23.4-176.8 67.8-253.6l-72-263 269 70.6c74.2-40.4 157.6-61.8 242.4-61.8h0.2c0 0 0 0 0 0 279.6 0 507.4 227.6 507.4 507.4 0 135.6-52.8 263-148.6 359zM514.2 30.4v0c-75.8 0-150 20.4-214.8 58.8l-15.4 9.2-159.6-41.8 42.6 155.6-10 16c-42.4 67-64.6 144.6-64.6 224.4 0 232.6 189.2 421.8 422 421.8 112.6 0 218.6-44 298.2-123.6 79.6-79.8 123.4-185.6 123.4-298.4-0.2-232.8-189.4-422-421.8-422zM745.4 346.4c-12.6 6.4-75 37-86.6 41.2s-20 6.4-28.6-6.4c-8.4-12.6-32.8-41.2-40.2-49.8-7.4-8.4-14.8-9.6-27.4-3.2s-53.6 19.8-102 63c-37.6 33.6-63.2 75.2-70.6 87.8s-0.8 19.6 5.6 25.8c5.8 5.6 12.6 14.8 19 22.2s8.4 12.6 12.6 21.2c4.2 8.4 2.2 15.8-1 22.2s-28.6 68.8-39 94.2c-10.2 24.8-20.8 21.4-28.6 21.8-7.4 0.4-15.8 0.4-24.2 0.4s-22.2-3.2-33.8-15.8c-11.6-12.6-44.4-43.4-44.4-105.8s45.4-122.6 51.8-131.2c6.4-8.4 89.4-136.6 216.6-191.4 30.2-13 53.8-20.8 72.2-26.8 30.4-9.6 58-8.2 79.8-5 24.4 3.6 75 30.6 85.6 60.2s10.6 55 7.4 60.2c-3 5.6-11.4 8.8-24.2 15.2z" />
|
||||||
|
<glyph unicode="" glyph-name="twitter" d="M1024 733.6c-37.6-16.8-78.2-28-120.6-33 43.4 26 76.6 67.2 92.4 116.2-40.6-24-85.6-41.6-133.4-51-38.4 40.8-93 66.2-153.4 66.2-116 0-210-94-210-210 0-16.4 1.8-32.4 5.4-47.8-174.6 8.8-329.4 92.4-433 219.6-18-31-28.4-67.2-28.4-105.6 0-72.8 37-137.2 93.4-174.8-34.4 1-66.8 10.6-95.2 26.2 0-0.8 0-1.8 0-2.6 0-101.8 72.4-186.8 168.6-206-17.6-4.8-36.2-7.4-55.4-7.4-13.6 0-26.6 1.4-39.6 3.8 26.8-83.4 104.4-144.2 196.2-146-72-56.4-162.4-90-261-90-17 0-33.6 1-50.2 3 93.2-59.8 203.6-94.4 322.2-94.4 386.4 0 597.8 320.2 597.8 597.8 0 9.2-0.2 18.2-0.6 27.2 41 29.4 76.6 66.4 104.8 108.6z" />
|
||||||
|
<glyph unicode="" glyph-name="youtube" d="M1013.8 652.8c0 0-10 70.6-40.8 101.6-39 40.8-82.6 41-102.6 43.4-143.2 10.4-358.2 10.4-358.2 10.4h-0.4c0 0-215 0-358.2-10.4-20-2.4-63.6-2.6-102.6-43.4-30.8-31-40.6-101.6-40.6-101.6s-10.2-82.8-10.2-165.8v-77.6c0-82.8 10.2-165.8 10.2-165.8s10-70.6 40.6-101.6c39-40.8 90.2-39.4 113-43.8 82-7.8 348.2-10.2 348.2-10.2s215.2 0.4 358.4 10.6c20 2.4 63.6 2.6 102.6 43.4 30.8 31 40.8 101.6 40.8 101.6s10.2 82.8 10.2 165.8v77.6c-0.2 82.8-10.4 165.8-10.4 165.8zM406.2 315.2v287.8l276.6-144.4-276.6-143.4z" />
|
||||||
|
<glyph unicode="" glyph-name="vimeo" d="M1023.6 686c-4.6-99.6-74.2-236.2-208.8-409.4-139.2-180.8-257-271.4-353.4-271.4-59.6 0-110.2 55-151.4 165.2-27.6 101-55 202-82.6 303-30.6 110.2-63.4 165.2-98.6 165.2-7.6 0-34.4-16.2-80.4-48.2l-48.2 62c50.6 44.4 100.4 88.8 149.4 133.2 67.4 58.2 118 88.8 151.8 92 79.6 7.6 128.8-46.8 147.2-163.4 19.8-125.8 33.6-204 41.4-234.6 23-104.4 48.2-156.6 75.8-156.6 21.4 0 53.6 33.8 96.6 101.6 42.8 67.6 65.8 119.2 69 154.6 6.2 58.4-16.8 87.8-69 87.8-24.6 0-49.8-5.6-75.8-16.8 50.4 164.8 146.4 244.8 288.4 240.2 105-2.8 154.6-71 148.6-204.4z" />
|
||||||
|
<glyph unicode="" glyph-name="vimeo2" d="M928 960h-832c-52.8 0-96-43.2-96-96v-832c0-52.8 43.2-96 96-96h832c52.8 0 96 43.2 96 96v832c0 52.8-43.2 96-96 96zM861.6 620c-3.2-72-53.6-170.6-151-295.8-100.6-130.8-185.8-196.2-255.4-196.2-43.2 0-79.6 39.8-109.4 119.4-20 73-39.8 146-59.8 219-22 79.6-45.8 119.4-71.2 119.4-5.6 0-25-11.6-58-34.8l-34.8 44.8c36.6 32 72.6 64.2 108 96.2 48.8 42 85.2 64.2 109.6 66.4 57.6 5.6 93-33.8 106.4-118 14.4-91 24.4-147.4 30-169.6 16.6-75.4 34.8-113 54.8-113 15.4 0 38.8 24.4 69.8 73.4s47.6 86.2 49.8 111.8c4.4 42.2-12.2 63.4-49.8 63.4-17.8 0-36-4-54.8-12.2 36.4 119 105.8 177 208.4 173.6 76-2.2 111.8-51.4 107.4-147.8z" />
|
||||||
|
<glyph unicode="" glyph-name="flickr" d="M0 416c0 123.712 100.288 224 224 224s224-100.288 224-224c0-123.712-100.288-224-224-224s-224 100.288-224 224zM576 416c0 123.712 100.288 224 224 224s224-100.288 224-224c0-123.712-100.288-224-224-224s-224 100.288-224 224z" />
|
||||||
|
<glyph unicode="" glyph-name="flickr2" d="M800 544c-70.58 0-128-57.42-128-128s57.42-128 128-128c70.58 0 128 57.42 128 128s-57.42 128-128 128zM800 640v0c123.71 0 224-100.288 224-224 0-123.71-100.29-224-224-224s-224 100.29-224 224c0 123.712 100.29 224 224 224zM0 416c0 123.712 100.288 224 224 224s224-100.288 224-224c0-123.712-100.288-224-224-224s-224 100.288-224 224z" />
|
||||||
|
<glyph unicode="" glyph-name="dribbble" d="M512-64c-282.4 0-512 229.6-512 512s229.6 512 512 512c282.4 0 512-229.6 512-512s-229.6-512-512-512v0zM943.8 378c-15 4.8-135.4 40.6-272.4 18.6 57.2-157.2 80.4-285.2 85-311.8 98 66.4 168 171.4 187.4 293.2v0zM682.8 44.8c-6.6 38.4-31.8 172-93.2 331.6-1-0.4-2-0.6-2.8-1-246.8-86-335.4-257-343.2-273 74.2-57.8 167.4-92.4 268.4-92.4 60.6 0 118.4 12.4 170.8 34.8v0zM187 155c10 17 130 215.6 355.4 288.6 5.6 1.8 11.4 3.6 17.2 5.2-11 24.8-23 49.8-35.4 74.2-218.2-65.4-430.2-62.6-449.4-62.4-0.2-4.4-0.2-8.8-0.2-13.4 0-112.2 42.6-214.8 112.4-292.2v0zM84 537c19.6-0.2 199.8-1 404.4 53.2-72.4 128.8-150.6 237.2-162.2 253-122.4-57.8-214-170.6-242.2-306.2v0zM409.6 872.6c12-16.2 91.6-124.4 163.2-256 155.6 58.2 221.4 146.8 229.2 158-77.2 68.6-178.8 110.2-290 110.2-35.2-0.2-69.6-4.4-102.4-12.2v0zM850.6 723.8c-9.2-12.4-82.6-106.4-244.2-172.4 10.2-20.8 20-42 29-63.4 3.2-7.6 6.4-15 9.4-22.6 145.6 18.2 290.2-11 304.6-14-1 103.2-38 198-98.8 272.4v0z" />
|
||||||
|
<glyph unicode="" glyph-name="behance" d="M297 754.8c30.2 0 57.4-2.6 82.2-8 24.8-5.2 45.8-14 63.6-26 17.6-12 31.2-28 41.2-48 9.6-19.8 14.4-44.6 14.4-74 0-31.8-7.2-58.2-21.6-79.4-14.6-21.2-35.8-38.4-64.2-52 38.8-11.2 67.4-30.8 86.6-58.6 19.2-28 28.4-61.6 28.4-101.2 0-32-6.2-59.4-18.4-82.6-12.4-23.4-29.2-42.4-49.8-57-20.8-14.8-44.8-25.6-71.6-32.6-26.6-7-54-10.6-82.4-10.6h-305.4v630h297zM279 500.4c24.6 0 45 5.8 61 17.6 16 11.6 23.6 30.8 23.6 57.2 0 14.6-2.6 26.8-7.8 36.2-5.4 9.4-12.4 16.8-21.4 22-8.8 5.4-18.8 9-30.6 11-11.4 2.2-23.4 3.2-35.6 3.2h-129.6v-147.2h140.4zM286.6 232.2c13.6 0 26.6 1.2 38.8 4 12.4 2.8 23.4 7 32.6 13.4 9.2 6.2 17 14.4 22.6 25.2 5.6 10.6 8.2 24.2 8.2 40.8 0 32.4-9.2 55.6-27.4 69.6-18.2 13.8-42.4 20.6-72.4 20.6h-150.4v-173.4h148zM725.2 234.4c18.8-18.4 45.8-27.6 81-27.6 25.2 0 47.2 6.4 65.4 19.2s29.2 26.4 33.4 40.4h110.4c-17.8-55-44.6-94-81.4-117.6-36.2-23.6-80.6-35.6-132-35.6-36 0-68.2 5.8-97.2 17.2-29 11.6-53.2 27.8-73.6 49-19.8 21.2-35.4 46.4-46.4 76-10.8 29.4-16.4 62-16.4 97.2 0 34.2 5.6 66 16.8 95.4 11.4 29.6 27 55 47.8 76.4s45.2 38.4 74 50.8c28.6 12.4 60.2 18.6 95.2 18.6 38.6 0 72.4-7.4 101.4-22.6 28.8-15 52.6-35.2 71.2-60.4s31.8-54.2 40-86.6c8.2-32.4 11-66.2 8.8-101.6h-329.4c0-35.8 12-70 31-88.2zM869 474c-14.8 16.4-40.2 25.4-70.8 25.4-20 0-36.6-3.4-49.8-10.2-13-6.8-23.6-15.2-31.8-25.2-8-10-13.6-20.8-16.8-32.2-3.2-11-5.2-21.2-5.8-30h204c-3 32-14 55.6-29 72.2zM668.4 704h255.4v-62.2h-255.4v62.2z" />
|
||||||
|
<glyph unicode="" glyph-name="behance2" d="M404.2 511.4c13 9.4 19.2 25 19.2 46.6 0 12-2 21.8-6.2 29.4-4.4 7.6-10 13.6-17.4 17.8-7.2 4.4-15.4 7.4-24.8 9-9.2 1.8-19 2.6-29 2.6h-105.4v-119.6h114c20-0.2 36.6 4.6 49.6 14.2zM422 403.4c-14.8 11.2-34.4 16.8-58.8 16.8h-122.6v-141h120.2c11.2 0 21.6 1 31.6 3.2s19 5.6 26.6 10.8c7.6 5 13.8 11.8 18.4 20.4s6.8 19.8 6.8 33.2c0 26.4-7.4 45.2-22.2 56.6zM928 960h-832c-52.8 0-96-43.2-96-96v-832c0-52.8 43.2-96 96-96h832c52.8 0 96 43.2 96 96v832c0 52.8-43.2 96-96 96zM671.2 690.6h207.4v-50.6h-207.4v50.6zM541.6 273.6c-10-19-23.6-34.4-40.4-46.4-17-12-36.4-20.8-58.2-26.6-21.6-5.8-44-8.6-66.8-8.6h-248.2v511.8h241.2c24.4 0 46.6-2.2 66.8-6.4 20-4.2 37.2-11.4 51.6-21.2 14.2-9.8 25.4-22.8 33.4-39 7.8-16 11.8-36.2 11.8-60 0-25.8-5.8-47.2-17.6-64.4s-29-31.2-52.2-42.2c31.6-9 54.8-25 70.2-47.6 15.6-22.8 23.2-50.2 23.2-82.2 0.2-26.2-4.8-48.6-14.8-67.2zM959.4 352.8h-267.4c0-29.2 10-57 25.2-72 15.2-14.8 37.2-22.4 65.8-22.4 20.6 0 38.2 5.2 53.2 15.6 14.8 10.4 23.8 21.4 27.2 32.8h89.6c-14.4-44.6-36.2-76.4-66-95.6-29.4-19.2-65.4-28.8-107.2-28.8-29.2 0-55.4 4.8-79 14-23.6 9.4-43.2 22.6-59.8 39.8-16.2 17.2-28.6 37.8-37.6 61.8-8.8 23.8-13.4 50.4-13.4 79 0 27.8 4.6 53.6 13.6 77.6 9.2 24 22 44.8 38.8 62 16.8 17.4 36.8 31.2 60 41.4 23.2 10 48.8 15 77.2 15 31.4 0 58.8-6 82.4-18.4 23.4-12.2 42.6-28.6 57.8-49.2s25.8-44 32.6-70.4c6.6-26 8.8-53.4 7-82.2zM776.6 496.2c-16.2 0-29.8-2.8-40.4-8.4s-19.2-12.4-25.8-20.4c-6.6-8.2-11-16.8-13.6-26.2-2.6-9-4.2-17.2-4.6-24.4h165.6c-2.4 26-11.4 45.2-23.4 58.6-12.4 13.6-32.8 20.8-57.8 20.8z" />
|
||||||
|
<glyph unicode="" glyph-name="dropbox" d="M736 928l-224-192 288-192 224 192zM512 736l-224 192-288-192 224-192zM800 544l224-192-288-160-224 192zM512 384l-288 160-224-192 288-160zM728.156 114.43l-216.156 185.278-216.158-185.278-135.842 75.468v-93.898l352-160 352 160v93.898z" />
|
||||||
|
<glyph unicode="" glyph-name="wordpress" d="M128 448.008c0-148.026 88.322-275.968 216.43-336.578l-183.178 488.784c-21.308-46.508-33.252-97.982-33.252-152.206zM771.228 466.872c0 46.234-17.054 78.236-31.654 103.142-19.458 30.82-37.72 56.894-37.72 87.716 0 34.374 26.766 66.376 64.486 66.376 1.704 0 3.32-0.204 4.976-0.302-68.316 60.97-159.34 98.196-259.308 98.196-134.16 0-252.186-67.046-320.844-168.568 9.010-0.282 17.506-0.454 24.712-0.454 40.154 0 102.34 4.752 102.34 4.752 20.69 1.182 23.132-28.434 2.458-30.822 0 0-20.81-2.368-43.952-3.55l139.834-405.106 84.044 245.456-59.822 159.65c-20.688 1.184-40.278 3.55-40.278 3.55-20.702 1.192-18.272 32.002 2.438 30.822 0 0 63.4-4.752 101.134-4.752 40.146 0 102.35 4.752 102.35 4.752 20.702 1.182 23.14-28.434 2.446-30.822 0 0-20.834-2.372-43.948-3.55l138.78-402.018 38.312 124.632c16.58 51.75 29.216 88.9 29.216 120.9zM518.742 415.296l-115.226-326.058c34.416-9.858 70.794-15.238 108.488-15.238 44.716 0 87.604 7.518 127.518 21.2-1.018 1.602-1.974 3.304-2.75 5.154l-118.030 314.942zM848.962 627.428c1.652-11.91 2.588-24.686 2.588-38.458 0-37.93-7.292-80.596-29.202-133.95l-117.286-330.272c114.162 64.828 190.938 185.288 190.938 323.258 0 65.030-17.060 126.16-47.038 179.422zM512 960c-282.77 0-512-229.23-512-512s229.23-512 512-512 512 229.23 512 512-229.23 512-512 512zM512 0c-247.424 0-448 200.576-448 448s200.576 448 448 448 448-200.576 448-448-200.576-448-448-448z" />
|
||||||
|
<glyph unicode="" glyph-name="blogger" d="M928 960h-832c-52.8 0-96-43.2-96-96v-832c0-52.8 43.2-96 96-96h832c52.8 0 96 43.2 96 96v832c0 52.8-43.2 96-96 96zM896 312c0-137-111.4-248-249.4-248h-268.8c-138 0-249.8 111-249.8 248v272c0 137 111.8 248 249.8 248h125.8c138 0 248.4-103 248.4-240 1.8-25.6 25-48 51.2-48h43c27.6 0 49.6-29 49.6-56.4v-175.6zM704 320c0-35.2-28.8-64-64-64h-256c-35.2 0-64 28.8-64 64v0c0 35.2 28.8 64 64 64h256c35.2 0 64-28.8 64-64v0zM576 576c0-35.2-28.8-64-64-64h-128c-35.2 0-64 28.8-64 64v0c0 35.2 28.8 64 64 64h128c35.2 0 64-28.8 64-64v0z" />
|
||||||
|
<glyph unicode="" glyph-name="tumblr" d="M576.032 512l-0.002-234.184c0-59.418-0.77-93.656 5.53-110.5 6.25-16.754 21.918-34.146 38.99-44.202 22.684-13.588 48.542-20.376 77.708-20.376 51.854 0 82.478 6.848 133.742 40.54v-153.944c-43.7-20.552-81.866-32.594-117.324-40.922-35.5-8.242-73.86-12.406-115.064-12.406-46.828 0-74.456 5.886-110.41 17.656-35.958 11.868-66.66 28.806-92.020 50.54-25.45 21.922-43.022 45.208-52.848 69.832-9.826 24.636-14.716 60.414-14.716 107.244v359.1h-137.426v145.006c40.208 13.042 85.164 31.788 113.78 56.152 28.754 24.45 51.766 53.706 69.106 87.944 17.392 34.146 29.348 77.712 35.872 130.516h165.084l-0.002-255.996h255.968v-192h-255.968z" />
|
||||||
|
<glyph unicode="" glyph-name="tumblr2" d="M928 960h-832c-52.8 0-96-43.2-96-96v-832c0-52.8 43.2-96 96-96h832c52.8 0 96 43.2 96 96v832c0 52.8-43.2 96-96 96zM731.8 135.4c-30.2-14.2-57.6-24.2-82-30-24.4-5.6-51-8.6-79.4-8.6-32.4 0-51.4 4-76.2 12.2s-46 19.8-63.6 34.8c-17.6 15.2-29.6 31.2-36.4 48.2s-10.2 41.6-10.2 74v247.8h-96v100c27.8 9 60 22 79.6 38.8 19.8 16.8 35.8 37 47.6 60.6 12 23.6 20.2 53.6 24.8 90h100.4v-163.2h163.6v-126.2h-163.4v-181.2c0-41-0.6-64.6 3.8-76.2s15.2-23.6 27-30.4c15.6-9.4 33.6-14 53.6-14 35.8 0 71.4 11.6 106.8 34.8v-111.4z" />
|
||||||
|
<glyph unicode="" glyph-name="skype" d="M425.6 922.6c-1.6 1-3.4 1.8-5 2.6-1.8-0.4-3.4-0.6-5.2-1l10.2-1.6zM36.8 539c-0.4-1.8-0.6-3.6-0.8-5.2 1-1.6 1.6-3.2 2.6-4.8l-1.8 10zM986.8 357.4c0.4 1.8 0.6 3.6 1 5.4-1 1.6-1.6 3.2-2.6 4.8l1.6-10.2zM592-23c1.6-1 3.4-1.8 5-2.6 1.8 0.4 3.6 0.6 5.4 0.8l-10.4 1.8zM987.8 362.8c-0.4-1.8-0.6-3.6-1-5.4l-1.8 10.4c1-1.8 1.8-3.4 2.8-5 5.2 28.8 8 58.2 8 87.6 0 65.2-12.8 128.6-38 188.2-24.4 57.6-59.2 109.4-103.6 153.8s-96.2 79.2-153.6 103.6c-59.6 25.2-123 38-188.2 38-30.8 0-61.6-2.8-91.6-8.6 0 0-0.2 0-0.2 0 1.6-0.8 3.4-1.6 5-2.6l-10.2 1.6c1.8 0.4 3.4 0.6 5.2 1-41.2 21.8-87.4 33.6-134.2 33.6-76.4 0-148.4-29.8-202.4-83.8s-83.8-126-83.8-202.4c0-48.6 12.6-96.6 36-138.8 0.4 1.8 0.6 3.6 0.8 5.2l1.8-10.2c-1 1.6-1.8 3.2-2.6 4.8-4.8-27.4-7.2-55.4-7.2-83.4 0-65.2 12.8-128.6 38-188.2 24.4-57.6 59.2-109.2 103.6-153.6s96.2-79.2 153.8-103.6c59.6-25.2 123-38 188.2-38 28.4 0 56.8 2.6 84.6 7.6-1.6 1-3.2 1.8-5 2.6l10.4-1.8c-1.8-0.4-3.6-0.6-5.4-0.8 42.8-24.2 91.4-37.2 140.8-37.2 76.4 0 148.4 29.8 202.4 83.8s83.8 126 83.8 202.4c-0.2 48.6-12.8 96.6-36.4 139.2zM514.2 154.2c-171.8 0-248.6 84.4-248.6 147.8 0 32.4 24 55.2 57 55.2 73.6 0 54.4-105.6 191.6-105.6 70.2 0 109 38.2 109 77.2 0 23.4-11.6 49.4-57.8 60.8l-152.8 38.2c-123 30.8-145.4 97.4-145.4 160 0 129.8 122.2 178.6 237 178.6 105.8 0 230.4-58.4 230.4-136.4 0-33.4-29-52.8-62-52.8-62.8 0-51.2 86.8-177.6 86.8-62.8 0-97.4-28.4-97.4-69s49.6-53.6 92.6-63.4l113.2-25.2c123.8-27.6 155.2-100 155.2-168 0-105.4-81-184.2-244.4-184.2z" />
|
||||||
|
<glyph unicode="" glyph-name="linkedin2" d="M928 960h-832c-52.8 0-96-43.2-96-96v-832c0-52.8 43.2-96 96-96h832c52.8 0 96 43.2 96 96v832c0 52.8-43.2 96-96 96zM384 128h-128v448h128v-448zM320 640c-35.4 0-64 28.6-64 64s28.6 64 64 64c35.4 0 64-28.6 64-64s-28.6-64-64-64zM832 128h-128v256c0 35.4-28.6 64-64 64s-64-28.6-64-64v-256h-128v448h128v-79.4c26.4 36.2 66.8 79.4 112 79.4 79.6 0 144-71.6 144-160v-288z" />
|
||||||
|
<glyph unicode="" glyph-name="linkedin" d="M384 576h177.106v-90.782h2.532c24.64 44.194 84.958 90.782 174.842 90.782 186.946 0 221.52-116.376 221.52-267.734v-308.266h-184.61v273.278c0 65.184-1.334 149.026-96.028 149.026-96.148 0-110.82-70.986-110.82-144.292v-278.012h-184.542v576zM64 576h192v-576h-192v576zM256 736c0-53.019-42.981-96-96-96s-96 42.981-96 96c0 53.019 42.981 96 96 96s96-42.981 96-96z" />
|
||||||
|
<glyph unicode="" glyph-name="stackoverflow" d="M1024 320v-384h-1024v384h128v-256h768v256zM192 256h640v-128h-640zM207.152 394.534l27.698 124.964 624.832-138.496-27.698-124.964zM279.658 651.442l54.092 116.006 580.032-270.464-54.092-116.006zM991.722 598.524l-77.922-101.55-507.746 389.608 56.336 73.418h58.244z" />
|
||||||
|
<glyph unicode="" glyph-name="pinterest2" d="M512 891.6c-245 0-443.6-198.6-443.6-443.6 0-188 117-348.4 282-413-3.8 35-7.4 89 1.6 127.2 8 34.6 52 220.4 52 220.4s-13.2 26.6-13.2 65.8c0 61.6 35.8 107.8 80.2 107.8 37.8 0 56.2-28.4 56.2-62.4 0-38-24.2-95-36.8-147.6-10.6-44.2 22-80.2 65.6-80.2 78.8 0 139.4 83.2 139.4 203.2 0 106.2-76.4 180.4-185.2 180.4-126.2 0-200.2-94.6-200.2-192.6 0-38.2 14.6-79 33-101.2 3.6-4.4 4.2-8.2 3-12.8-3.4-14-10.8-44.2-12.4-50.4-2-8.2-6.4-9.8-14.8-6-55.4 25.8-90 106.8-90 171.8 0 140 101.6 268.4 293 268.4 153.8 0 273.4-109.6 273.4-256.2 0-152.8-96.4-276-230.2-276-45 0-87.2 23.4-101.6 51 0 0-22.2-84.6-27.6-105.4-10-38.6-37-86.8-55.2-116.2 41.6-12.8 85.6-19.8 131.4-19.8 245 0 443.6 198.6 443.6 443.6 0 245.2-198.6 443.8-443.6 443.8z" />
|
||||||
|
<glyph unicode="" glyph-name="pinterest" d="M512 960c-282.4 0-512-229.6-512-512s229.6-512 512-512 512 229.6 512 512-229.6 512-512 512zM512 4.4c-45.8 0-89.8 7-131.4 19.8 18 29.4 45.2 77.8 55.2 116.2 5.4 20.8 27.6 105.4 27.6 105.4 14.4-27.6 56.8-51 101.6-51 133.8 0 230.2 123 230.2 276 0 146.6-119.6 256.2-273.4 256.2-191.4 0-293-128.6-293-268.4 0-65 34.6-146 90-171.8 8.4-4 12.8-2.2 14.8 6 1.4 6.2 9 36.2 12.4 50.4 1 4.4 0.6 8.4-3 12.8-18.4 22.2-33 63.2-33 101.2 0 97.8 74 192.6 200.2 192.6 109 0 185.2-74.2 185.2-180.4 0-120-60.6-203.2-139.4-203.2-43.6 0-76.2 36-65.6 80.2 12.6 52.8 36.8 109.6 36.8 147.6 0 34-18.2 62.4-56.2 62.4-44.6 0-80.2-46-80.2-107.8 0-39.2 13.2-65.8 13.2-65.8s-44-185.8-52-220.4c-9-38.4-5.4-92.2-1.6-127.2-165 64.4-282 224.8-282 412.8 0 245 198.6 443.6 443.6 443.6s443.6-198.6 443.6-443.6c0-245-198.6-443.6-443.6-443.6z" />
|
||||||
|
<glyph unicode="" glyph-name="foursquare" d="M851.564 869.91c-12.060 16.404-31.204 26.090-51.564 26.090h-608c-35.346 0-64-28.654-64-64v-768c0-25.884 15.592-49.222 39.508-59.128 7.918-3.28 16.234-4.874 24.478-4.874 16.656 0 33.026 6.504 45.268 18.748l237.256 237.254h165.49c27.992 0 52.736 18.192 61.086 44.91l160 512c6.074 19.432 2.538 40.596-9.522 57zM672.948 640h-224.948c-35.346 0-64-28.654-64-64s28.654-64 64-64h184.948l-40-128h-144.948c-16.974 0-33.252-6.742-45.254-18.746l-146.746-146.744v549.49h456.948l-40-128z" />
|
||||||
|
</font></defs></svg>
|
||||||
|
After Width: | Height: | Size: 48 KiB |
BIN
wp-content/plugins/Pirate-Crew/css/fonts/icomoon.ttf
Normal file
BIN
wp-content/plugins/Pirate-Crew/css/fonts/icomoon.woff
Normal file
228
wp-content/plugins/Pirate-Crew/css/icomoon.css
Normal file
@@ -0,0 +1,228 @@
|
|||||||
|
@font-face {
|
||||||
|
font-family: 'icomoon';
|
||||||
|
src: url('fonts/icomoon.eot');
|
||||||
|
src: url('fonts/icomoon.eot') format('embedded-opentype'), url('fonts/icomoon.ttf') format('truetype'), url('fonts/icomoon.woff') format('woff'), url('fonts/icomoon.svg') format('svg');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
[class^="picrew-icon-"],
|
||||||
|
[class*=" picrew-icon-"] {
|
||||||
|
|
||||||
|
/* use !important to prevent issues with browser extensions that change fonts */
|
||||||
|
font-family: 'icomoon' !important;
|
||||||
|
speak: none;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
font-variant: normal;
|
||||||
|
text-transform: none;
|
||||||
|
line-height: 1; /* Better Font Rendering =========== */
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picrew-icon-yelp:before {
|
||||||
|
content: "\e900";
|
||||||
|
}
|
||||||
|
.picrew-icon-flattr:before {
|
||||||
|
content: "\e902";
|
||||||
|
}
|
||||||
|
.picrew-icon-xing:before {
|
||||||
|
content: "\e903";
|
||||||
|
}
|
||||||
|
.picrew-icon-xing2:before {
|
||||||
|
content: "\e904";
|
||||||
|
}
|
||||||
|
.picrew-icon-stumbleupon:before {
|
||||||
|
content: "\e905";
|
||||||
|
}
|
||||||
|
.picrew-icon-stumbleupon2:before {
|
||||||
|
content: "\e906";
|
||||||
|
}
|
||||||
|
.picrew-icon-delicious:before {
|
||||||
|
content: "\e907";
|
||||||
|
}
|
||||||
|
.picrew-icon-lastfm:before {
|
||||||
|
content: "\e908";
|
||||||
|
}
|
||||||
|
.picrew-icon-lastfm2:before {
|
||||||
|
content: "\e909";
|
||||||
|
}
|
||||||
|
.picrew-icon-hackernews:before {
|
||||||
|
content: "\e90a";
|
||||||
|
}
|
||||||
|
.picrew-icon-reddit:before {
|
||||||
|
content: "\e90b";
|
||||||
|
}
|
||||||
|
.picrew-icon-soundcloud:before {
|
||||||
|
content: "\e90c";
|
||||||
|
}
|
||||||
|
.picrew-icon-soundcloud2:before {
|
||||||
|
content: "\e90d";
|
||||||
|
}
|
||||||
|
.picrew-icon-yahoo:before {
|
||||||
|
content: "\e90e";
|
||||||
|
}
|
||||||
|
.picrew-icon-blogger2:before {
|
||||||
|
content: "\e90f";
|
||||||
|
}
|
||||||
|
.picrew-icon-ello:before {
|
||||||
|
content: "\e910";
|
||||||
|
}
|
||||||
|
.picrew-icon-wordpress2:before {
|
||||||
|
content: "\e911";
|
||||||
|
}
|
||||||
|
.picrew-icon-steam:before {
|
||||||
|
content: "\e912";
|
||||||
|
}
|
||||||
|
.picrew-icon-steam2:before {
|
||||||
|
content: "\e913";
|
||||||
|
}
|
||||||
|
.picrew-icon-500px:before {
|
||||||
|
content: "\e914";
|
||||||
|
}
|
||||||
|
.picrew-icon-deviantart:before {
|
||||||
|
content: "\e915";
|
||||||
|
}
|
||||||
|
.picrew-icon-twitch:before {
|
||||||
|
content: "\e916";
|
||||||
|
}
|
||||||
|
.picrew-icon-feed:before {
|
||||||
|
content: "\e917";
|
||||||
|
}
|
||||||
|
.picrew-icon-feed2:before {
|
||||||
|
content: "\e918";
|
||||||
|
}
|
||||||
|
.picrew-icon-sina-weibo:before {
|
||||||
|
content: "\e919";
|
||||||
|
}
|
||||||
|
.picrew-icon-renren:before {
|
||||||
|
content: "\e91a";
|
||||||
|
}
|
||||||
|
.picrew-icon-vk:before {
|
||||||
|
content: "\e91b";
|
||||||
|
}
|
||||||
|
.picrew-icon-vine:before {
|
||||||
|
content: "\e91c";
|
||||||
|
}
|
||||||
|
.picrew-icon-telegram:before {
|
||||||
|
content: "\e91d";
|
||||||
|
}
|
||||||
|
.picrew-icon-spotify:before {
|
||||||
|
content: "\e91e";
|
||||||
|
}
|
||||||
|
.picrew-icon-mail2:before {
|
||||||
|
content: "\e91f";
|
||||||
|
}
|
||||||
|
.picrew-icon-mail3:before {
|
||||||
|
content: "\e920";
|
||||||
|
}
|
||||||
|
.picrew-icon-arrow-down:before {
|
||||||
|
content: "\e60f";
|
||||||
|
}
|
||||||
|
.picrew-icon-arrow-left:before {
|
||||||
|
content: "\e610";
|
||||||
|
}
|
||||||
|
.picrew-icon-arrow-right:before {
|
||||||
|
content: "\e611";
|
||||||
|
}
|
||||||
|
.picrew-icon-close:before {
|
||||||
|
content: "\e612";
|
||||||
|
}
|
||||||
|
.picrew-icon-github:before {
|
||||||
|
content: "\e901";
|
||||||
|
}
|
||||||
|
.picrew-icon-mail:before {
|
||||||
|
content: "\e945";
|
||||||
|
}
|
||||||
|
.picrew-icon-link:before {
|
||||||
|
content: "\e9cb";
|
||||||
|
}
|
||||||
|
.picrew-icon-google-plus:before {
|
||||||
|
content: "\ea8b";
|
||||||
|
}
|
||||||
|
.picrew-icon-google-plus2:before {
|
||||||
|
content: "\ea8c";
|
||||||
|
}
|
||||||
|
.picrew-icon-hangouts:before {
|
||||||
|
content: "\ea8e";
|
||||||
|
}
|
||||||
|
.picrew-icon-google-drive:before {
|
||||||
|
content: "\ea8f";
|
||||||
|
}
|
||||||
|
.picrew-icon-facebook:before {
|
||||||
|
content: "\ea90";
|
||||||
|
}
|
||||||
|
.picrew-icon-facebook2:before {
|
||||||
|
content: "\ea91";
|
||||||
|
}
|
||||||
|
.picrew-icon-instagram:before {
|
||||||
|
content: "\ea92";
|
||||||
|
}
|
||||||
|
.picrew-icon-whatsapp:before {
|
||||||
|
content: "\ea93";
|
||||||
|
}
|
||||||
|
.picrew-icon-twitter:before {
|
||||||
|
content: "\ea96";
|
||||||
|
}
|
||||||
|
.picrew-icon-youtube:before {
|
||||||
|
content: "\ea9d";
|
||||||
|
}
|
||||||
|
.picrew-icon-vimeo:before {
|
||||||
|
content: "\eaa0";
|
||||||
|
}
|
||||||
|
.picrew-icon-vimeo2:before {
|
||||||
|
content: "\eaa1";
|
||||||
|
}
|
||||||
|
.picrew-icon-flickr:before {
|
||||||
|
content: "\eaa3";
|
||||||
|
}
|
||||||
|
.picrew-icon-flickr2:before {
|
||||||
|
content: "\eaa4";
|
||||||
|
}
|
||||||
|
.picrew-icon-dribbble:before {
|
||||||
|
content: "\eaa7";
|
||||||
|
}
|
||||||
|
.picrew-icon-behance:before {
|
||||||
|
content: "\eaa8";
|
||||||
|
}
|
||||||
|
.picrew-icon-behance2:before {
|
||||||
|
content: "\eaa9";
|
||||||
|
}
|
||||||
|
.picrew-icon-dropbox:before {
|
||||||
|
content: "\eaae";
|
||||||
|
}
|
||||||
|
.picrew-icon-wordpress:before {
|
||||||
|
content: "\eab4";
|
||||||
|
}
|
||||||
|
.picrew-icon-blogger:before {
|
||||||
|
content: "\eab8";
|
||||||
|
}
|
||||||
|
.picrew-icon-tumblr:before {
|
||||||
|
content: "\eab9";
|
||||||
|
}
|
||||||
|
.picrew-icon-tumblr2:before {
|
||||||
|
content: "\eaba";
|
||||||
|
}
|
||||||
|
.picrew-icon-skype:before {
|
||||||
|
content: "\eac5";
|
||||||
|
}
|
||||||
|
.picrew-icon-linkedin2:before {
|
||||||
|
content: "\eac9";
|
||||||
|
}
|
||||||
|
.picrew-icon-linkedin:before {
|
||||||
|
content: "\eaca";
|
||||||
|
}
|
||||||
|
.picrew-icon-stackoverflow:before {
|
||||||
|
content: "\ead0";
|
||||||
|
}
|
||||||
|
.picrew-icon-pinterest2:before {
|
||||||
|
content: "\ead1";
|
||||||
|
}
|
||||||
|
.picrew-icon-pinterest:before {
|
||||||
|
content: "\ead2";
|
||||||
|
}
|
||||||
|
.picrew-icon-foursquare:before {
|
||||||
|
content: "\ead6";
|
||||||
|
}
|
||||||
|
|
||||||
409
wp-content/plugins/Pirate-Crew/css/sass/_social-media.scss
Normal file
@@ -0,0 +1,409 @@
|
|||||||
|
/*
|
||||||
|
* Social media Settings
|
||||||
|
*/
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'icomoon';
|
||||||
|
src: url('fonts/icomoon.eot');
|
||||||
|
src: url('fonts/icomoon.eot') format('embedded-opentype'), url('fonts/icomoon.ttf') format('truetype'), url('fonts/icomoon.woff') format('woff'), url('fonts/icomoon.svg') format('svg');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
[class^="picrew-icon-"] {
|
||||||
|
font-family: $font_family_1 !important;
|
||||||
|
speak: none;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
font-variant: normal;
|
||||||
|
text-transform: none;
|
||||||
|
line-height: 1;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
[class*=" picrew-icon-"] {
|
||||||
|
font-family: $font_family_1 !important;
|
||||||
|
speak: none;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
font-variant: normal;
|
||||||
|
text-transform: none;
|
||||||
|
line-height: 1;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.picrew-social-icons {
|
||||||
|
li {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background: none;
|
||||||
|
&:before {
|
||||||
|
vertical-align: top;
|
||||||
|
position: relative;
|
||||||
|
content: '';
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-social-icons {
|
||||||
|
span {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0 5px;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
display: block;
|
||||||
|
-webkit-transition: -webkit-transform 0.3s;
|
||||||
|
-moz-transition: -moz-transform 0.3s;
|
||||||
|
transition: transform 0.3s;
|
||||||
|
line-height: 1;
|
||||||
|
&:hover {
|
||||||
|
-moz-transform: translateY(-4px);
|
||||||
|
-webkit-transform: translateY(-4px);
|
||||||
|
transform: translateY(-4px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.picrew-icon-yelp {
|
||||||
|
&:before {
|
||||||
|
content: "\e900";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-flattr {
|
||||||
|
&:before {
|
||||||
|
content: "\e902";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-xing {
|
||||||
|
&:before {
|
||||||
|
content: "\e903";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-xing2 {
|
||||||
|
&:before {
|
||||||
|
content: "\e904";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-stumbleupon {
|
||||||
|
&:before {
|
||||||
|
content: "\e905";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-stumbleupon2 {
|
||||||
|
&:before {
|
||||||
|
content: "\e906";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-delicious {
|
||||||
|
&:before {
|
||||||
|
content: "\e907";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-lastfm {
|
||||||
|
&:before {
|
||||||
|
content: "\e908";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-lastfm2 {
|
||||||
|
&:before {
|
||||||
|
content: "\e909";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-hackernews {
|
||||||
|
&:before {
|
||||||
|
content: "\e90a";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-reddit {
|
||||||
|
&:before {
|
||||||
|
content: "\e90b";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-soundcloud {
|
||||||
|
&:before {
|
||||||
|
content: "\e90c";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-soundcloud2 {
|
||||||
|
&:before {
|
||||||
|
content: "\e90d";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-yahoo {
|
||||||
|
&:before {
|
||||||
|
content: "\e90e";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-blogger2 {
|
||||||
|
&:before {
|
||||||
|
content: "\e90f";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-ello {
|
||||||
|
&:before {
|
||||||
|
content: "\e910";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-wordpress2 {
|
||||||
|
&:before {
|
||||||
|
content: "\e911";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-steam {
|
||||||
|
&:before {
|
||||||
|
content: "\e912";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-steam2 {
|
||||||
|
&:before {
|
||||||
|
content: "\e913";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-500px {
|
||||||
|
&:before {
|
||||||
|
content: "\e914";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-deviantart {
|
||||||
|
&:before {
|
||||||
|
content: "\e915";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-twitch {
|
||||||
|
&:before {
|
||||||
|
content: "\e916";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-feed {
|
||||||
|
&:before {
|
||||||
|
content: "\e917";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-feed2 {
|
||||||
|
&:before {
|
||||||
|
content: "\e918";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-sina-weibo {
|
||||||
|
&:before {
|
||||||
|
content: "\e919";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-renren {
|
||||||
|
&:before {
|
||||||
|
content: "\e91a";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-vk {
|
||||||
|
&:before {
|
||||||
|
content: "\e91b";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-vine {
|
||||||
|
&:before {
|
||||||
|
content: "\e91c";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-telegram {
|
||||||
|
&:before {
|
||||||
|
content: "\e91d";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-spotify {
|
||||||
|
&:before {
|
||||||
|
content: "\e91e";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-mail2 {
|
||||||
|
&:before {
|
||||||
|
content: "\e91f";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-mail3 {
|
||||||
|
&:before {
|
||||||
|
content: "\e920";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-arrow-down {
|
||||||
|
&:before {
|
||||||
|
content: "\e60f";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-arrow-left {
|
||||||
|
&:before {
|
||||||
|
content: "\e610";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-arrow-right {
|
||||||
|
&:before {
|
||||||
|
content: "\e611";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-close {
|
||||||
|
&:before {
|
||||||
|
content: "\e612";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-github {
|
||||||
|
&:before {
|
||||||
|
content: "\e901";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-mail {
|
||||||
|
&:before {
|
||||||
|
content: "\e945";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-link {
|
||||||
|
&:before {
|
||||||
|
content: "\e9cb";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-google-plus {
|
||||||
|
&:before {
|
||||||
|
content: "\ea8b";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-google-plus2 {
|
||||||
|
&:before {
|
||||||
|
content: "\ea8c";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-hangouts {
|
||||||
|
&:before {
|
||||||
|
content: "\ea8e";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-google-drive {
|
||||||
|
&:before {
|
||||||
|
content: "\ea8f";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-facebook {
|
||||||
|
&:before {
|
||||||
|
content: "\ea90";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-facebook2 {
|
||||||
|
&:before {
|
||||||
|
content: "\ea91";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-instagram {
|
||||||
|
&:before {
|
||||||
|
content: "\ea92";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-whatsapp {
|
||||||
|
&:before {
|
||||||
|
content: "\ea93";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-twitter {
|
||||||
|
&:before {
|
||||||
|
content: "\ea96";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-youtube {
|
||||||
|
&:before {
|
||||||
|
content: "\ea9d";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-vimeo {
|
||||||
|
&:before {
|
||||||
|
content: "\eaa0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-vimeo2 {
|
||||||
|
&:before {
|
||||||
|
content: "\eaa1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-flickr {
|
||||||
|
&:before {
|
||||||
|
content: "\eaa3";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-flickr2 {
|
||||||
|
&:before {
|
||||||
|
content: "\eaa4";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-dribbble {
|
||||||
|
&:before {
|
||||||
|
content: "\eaa7";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-behance {
|
||||||
|
&:before {
|
||||||
|
content: "\eaa8";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-behance2 {
|
||||||
|
&:before {
|
||||||
|
content: "\eaa9";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-dropbox {
|
||||||
|
&:before {
|
||||||
|
content: "\eaae";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-wordpress {
|
||||||
|
&:before {
|
||||||
|
content: "\eab4";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-blogger {
|
||||||
|
&:before {
|
||||||
|
content: "\eab8";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-tumblr {
|
||||||
|
&:before {
|
||||||
|
content: "\eab9";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-tumblr2 {
|
||||||
|
&:before {
|
||||||
|
content: "\eaba";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-skype {
|
||||||
|
&:before {
|
||||||
|
content: "\eac5";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-linkedin2 {
|
||||||
|
&:before {
|
||||||
|
content: "\eac9";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-linkedin {
|
||||||
|
&:before {
|
||||||
|
content: "\eaca";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-stackoverflow {
|
||||||
|
&:before {
|
||||||
|
content: "\ead0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-pinterest2 {
|
||||||
|
&:before {
|
||||||
|
content: "\ead1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-pinterest {
|
||||||
|
&:before {
|
||||||
|
content: "\ead2";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.picrew-icon-foursquare {
|
||||||
|
&:before {
|
||||||
|
content: "\ead6";
|
||||||
|
}
|
||||||
|
}
|
||||||
1220
wp-content/plugins/Pirate-Crew/css/sass/_styles.scss
Normal file
68
wp-content/plugins/Pirate-Crew/css/sass/_variables.scss
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Variables
|
||||||
|
*/
|
||||||
|
|
||||||
|
$color_1: #aaa;
|
||||||
|
$color_2: #333;
|
||||||
|
$color_3: #1f1f1f;
|
||||||
|
$color_4: #000;
|
||||||
|
$color_5: #fff;
|
||||||
|
$color_6: #111;
|
||||||
|
$font_family_1: 'icomoon';
|
||||||
|
$background_color_1: rgba(113, 113, 113, 0.04);
|
||||||
|
$background_color_2: #eee;
|
||||||
|
|
||||||
|
|
||||||
|
/****************** Presets ***********************/
|
||||||
|
|
||||||
|
@keyframes "DownMove" {
|
||||||
|
0% {
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
5% {
|
||||||
|
top: 60%;
|
||||||
|
}
|
||||||
|
10% {
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
15% {
|
||||||
|
top: 60%;
|
||||||
|
}
|
||||||
|
20% {
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@-webkit-keyframes "DownMove" {
|
||||||
|
0% {
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
5% {
|
||||||
|
top: 60%;
|
||||||
|
}
|
||||||
|
10% {
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
15% {
|
||||||
|
top: 60%;
|
||||||
|
}
|
||||||
|
20% {
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@-moz-keyframes "DownMove" {
|
||||||
|
0% {
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
5% {
|
||||||
|
top: 60%;
|
||||||
|
}
|
||||||
|
10% {
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
15% {
|
||||||
|
top: 60%;
|
||||||
|
}
|
||||||
|
20% {
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
6
wp-content/plugins/Pirate-Crew/css/sass/team.scss
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
@import "variables";
|
||||||
|
|
||||||
|
@import "social-media";
|
||||||
|
|
||||||
|
@import "styles";
|
||||||
1
wp-content/plugins/Pirate-Crew/css/select2.min.css
vendored
Normal file
1
wp-content/plugins/Pirate-Crew/css/team.css
Normal file
BIN
wp-content/plugins/Pirate-Crew/images/Browse.plb
Normal file
BIN
wp-content/plugins/Pirate-Crew/images/cards.jpg
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
wp-content/plugins/Pirate-Crew/images/close.png
Normal file
|
After Width: | Height: | Size: 406 B |
BIN
wp-content/plugins/Pirate-Crew/images/default-member.jpg
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
wp-content/plugins/Pirate-Crew/images/list.jpg
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
wp-content/plugins/Pirate-Crew/images/table.jpg
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
wp-content/plugins/Pirate-Crew/images/team-vc-icon.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
92
wp-content/plugins/Pirate-Crew/includes/member-details.php
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<div class="member-details-section">
|
||||||
|
<p>
|
||||||
|
<label for="pirate-crew-designation"><?php _e( "Position", 'pirate-crew' ); ?></label>
|
||||||
|
<input class="widefat" type="text" name="pirate-crew-designation" id="pirate-crew-designation" value="<?php echo esc_attr(get_post_meta($post->ID, 'pirate-crew-designation', true));?>"/>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for="pirate-crew-short-desc"><?php _e( 'Short Description (in 140 characters or less)', 'pirate-crew' ); ?></label><br/>
|
||||||
|
<textarea id="pirate-crew-short-desc" name="pirate-crew-short-desc" class="widefat" type="text" maxlength="140"><?php echo esc_attr(get_post_meta($post->ID, 'pirate-crew-short-desc', true));?></textarea>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<h3><?php _e('Additional Information (for Email, Telephone, Fax, etc)','pirate-crew');?></h3>
|
||||||
|
<div class="member-details-section">
|
||||||
|
<table id="repeatable-fieldset-one" class="picrew-sorable-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td width="3%"></td>
|
||||||
|
<td width="45%"><?php _e('Label','pirate-crew');?></td>
|
||||||
|
<td width="42%"><?php _e('Content','pirate-crew');?></td>
|
||||||
|
<td width="10%"></td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php if ( $pirate_crew_contact ) :
|
||||||
|
foreach ( $pirate_crew_contact as $field ) { ?>
|
||||||
|
<tr>
|
||||||
|
<td><span class="dashicons dashicons-move"></span></td>
|
||||||
|
<td><input type="text" placeholder="<?php _e('ex: Email','pirate-crew');?>" class="widefat" name="pirate-crew-label[]" value="<?php if(isset($field['label'])) echo esc_attr( $field['label'] ); ?>"/></td>
|
||||||
|
<td><input type="text" placeholder="<?php _e('mail@example.com','pirate-crew');?>" class="widefat" name="pirate-crew-content[]" value="<?php if(isset($field['content'])) echo esc_attr( $field['content'] ); ?>"/></td>
|
||||||
|
<td><a class="button remove-row" href="#"><?php _e('Remove','pirate-crew');?></a></td>
|
||||||
|
</tr>
|
||||||
|
<?php } else:?>
|
||||||
|
<tr>
|
||||||
|
<td><span class="dashicons dashicons-move"></span></td>
|
||||||
|
<td><input type="text" placeholder="<?php _e('ex: Email','pirate-crew');?>" class="widefat" name="pirate-crew-label[]" value=""/></td>
|
||||||
|
<td><input type="text" placeholder="<?php _e('mail@example.com','pirate-crew');?>" class="widefat" name="pirate-crew-content[]" value=""/></td>
|
||||||
|
<td><a class="button remove-row" href="#"><?php _e('Remove','pirate-crew');?></a></td>
|
||||||
|
</tr>
|
||||||
|
<?php endif; ?>
|
||||||
|
<tr class="empty-row screen-reader-text">
|
||||||
|
<td><span class="dashicons dashicons-move"></span></td>
|
||||||
|
<td><input type="text" class="widefat" placeholder="<?php _e('ex: Email','pirate-crew');?>" name="pirate-crew-label[]" /></td>
|
||||||
|
<td><input type="text" class="widefat" placeholder="<?php _e('mail@example.com','pirate-crew');?>" name="pirate-crew-content[]" value=""/></td>
|
||||||
|
<td><a class="button remove-row" href="#"><?php _e('Remove','pirate-crew');?></a></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p><a class="button picrew-add-row" href="#" data-table="repeatable-fieldset-one"><?php _e('Add row','pirate-crew');?></a></p>
|
||||||
|
</div>
|
||||||
|
<h3><?php _e('Links (Twitter, LinkedIn, etc)','pirate-crew');?></h3>
|
||||||
|
<div class="member-details-section">
|
||||||
|
<table id="repeatable-fieldset-two" class="picrew-sorable-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th> </th>
|
||||||
|
<th><?php _e('Icon','pirate-crew');?></th>
|
||||||
|
<th><?php _e('Link','pirate-crew');?></th>
|
||||||
|
<th> </th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php if ( $pirate_crew_social ) :
|
||||||
|
foreach ( $pirate_crew_social as $field ) { ?>
|
||||||
|
<tr>
|
||||||
|
<td><span class="dashicons dashicons-move"></span></td>
|
||||||
|
<td>
|
||||||
|
<?php $this->selectbuilder('pirate-crew-icon[]',$socialicons,$field['icon'],__('Select icon','pirate-crew'),'widefat picrew-icon-select');?>
|
||||||
|
</td>
|
||||||
|
<td><input type="text" placeholder="<?php _e('ex: http://www.twitter.com/piratenpartei','pirate-crew');?>" class="widefat" name="pirate-crew-link[]" value="<?php if(isset($field['link'])) echo esc_attr( $field['link'] ); ?>"/></td>
|
||||||
|
<td><a class="button remove-row" href="#"><?php _e('Remove','pirate-crew');?></a></td>
|
||||||
|
</tr>
|
||||||
|
<?php } else: ?>
|
||||||
|
<tr>
|
||||||
|
<td><span class="dashicons dashicons-move"></span></td>
|
||||||
|
<td>
|
||||||
|
<?php $this->selectbuilder('pirate-crew-icon[]',$socialicons,'',__('Select icon','pirate-crew'),'widefat picrew-icon-select');?>
|
||||||
|
</td>
|
||||||
|
<td><input type="text" placeholder="<?php _e('ex: http://www.twitter.com/piratenpartei','pirate-crew');?>" class="widefat" name="pirate-crew-link[]" value=""/></td>
|
||||||
|
<td><a class="button remove-row" href="#"><?php _e('Remove','pirate-crew');?></a></td>
|
||||||
|
</tr>
|
||||||
|
<?php endif; ?>
|
||||||
|
<tr class="empty-row screen-reader-text">
|
||||||
|
<td><span class="dashicons dashicons-move"></span></td>
|
||||||
|
<td>
|
||||||
|
<?php $this->selectbuilder('pirate-crew-icon[]',$socialicons,'',__('Select icon','pirate-crew'),'widefat');?>
|
||||||
|
</td>
|
||||||
|
<td><input type="text" placeholder="<?php _e('ex: http://www.twitter.com/piratenpartei','pirate-crew');?>" class="widefat" name="pirate-crew-link[]" value=""/></td>
|
||||||
|
<td><a class="button remove-row" href="#"><?php _e('Remove','pirate-crew');?></a></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p><a class="button picrew-add-row" href="#" data-table="repeatable-fieldset-two"><?php _e('Add row','pirate-crew');?></a></p>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<div class="wrap">
|
||||||
|
<div class="pirate-crew-customize">
|
||||||
|
<div class="pirate-crew-customize-inner">
|
||||||
|
<div class="pirate-crew-customize-member">
|
||||||
|
<div class="picrew-heading-group">
|
||||||
|
<p><?php _e('Select a member from the list to add as author to the post', 'pirate-crew');?></p>
|
||||||
|
</div>
|
||||||
|
<div class="picrew-select-members">
|
||||||
|
<?php
|
||||||
|
if($members->have_posts()): ?>
|
||||||
|
<select name="pirate_crew_member_id" id="picrew-members">
|
||||||
|
<?php
|
||||||
|
echo '<option value="" data-img="'.$defaultimage.'">'.__('Select a member','pirate-crew').'</option>';
|
||||||
|
while($members->have_posts()): $members->the_post();
|
||||||
|
$disabled ="";
|
||||||
|
if($members->post->ID ==$preauthor ) $disabled ='selected = "selected"';
|
||||||
|
|
||||||
|
$thumb = $this->pirate_team_get_thumbnail($members->post->ID,'thumbnail');
|
||||||
|
echo '<option value="'.$members->post->ID.'" data-img="'.$thumb.'" '.$disabled.'>'.get_the_title().'</option>';
|
||||||
|
endwhile;
|
||||||
|
wp_reset_postdata();
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<?php else:
|
||||||
|
$addmember = admin_url('post-new.php?post_type=pirate_crew_member');
|
||||||
|
echo '<p>';
|
||||||
|
_e('You haven\'t added any crew members yet.','pirate-crew');
|
||||||
|
echo '<a href="'.$addmember.'">'.__("Add a crew member",'pirate-crew').'</a>';
|
||||||
|
echo '</p>';
|
||||||
|
endif;?>
|
||||||
|
</div><!-- .picrew-select-members -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
125
wp-content/plugins/Pirate-Crew/includes/team-details.php
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
<div class="wrap">
|
||||||
|
<div class="pirate-crew-customize">
|
||||||
|
<div class="pirate-crew-customize-inner">
|
||||||
|
<div class="pirate-crew-customize-member">
|
||||||
|
<div class="picrew-heading-group">
|
||||||
|
<h2 class="sub-h"><?php _e('Members', 'pirate-crew');?></h2>
|
||||||
|
<span><?php _e('Select members from the dropdown, drag and drop them to reorder.', 'pirate-crew');?></span>
|
||||||
|
</div>
|
||||||
|
<div class="picrew-select-members">
|
||||||
|
<?php
|
||||||
|
if($members->have_posts()): ?>
|
||||||
|
<select name="members" id="picrew-members">
|
||||||
|
<?php
|
||||||
|
echo '<option value="" data-img="'.$defaultimage.'">'.__('Select a member','pirate-crew').'</option>';
|
||||||
|
while($members->have_posts()): $members->the_post();
|
||||||
|
$disabled ="";
|
||||||
|
if(in_array($members->post->ID, $options['memberlist']) ) $disabled ="disabled";
|
||||||
|
echo '<option value="'.$members->post->ID.'" data-img="'.$this->pirate_team_get_thumbnail($members->post->ID,'thumbnail').'" '.$disabled.'>'.get_the_title().'</option>';
|
||||||
|
endwhile;
|
||||||
|
wp_reset_postdata();
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<?php else:
|
||||||
|
$addmember = admin_url('post-new.php?post_type=pirate_crew_member');
|
||||||
|
echo '<p>';
|
||||||
|
_e('You haven\'t added any crew members yet.','pirate-crew');
|
||||||
|
echo '<a href="'.$addmember.'">'.__("Add a crew member",'pirate-crew').'</a>';
|
||||||
|
echo '</p>';
|
||||||
|
endif;?>
|
||||||
|
</div><!-- .picrew-select-members -->
|
||||||
|
<ul class="picrew-members-list-selected">
|
||||||
|
<div class="picrew-members-info"><?php echo __('No Members Selected' ,'pirate-crew'); ?></div>
|
||||||
|
<script type="text/html" id="tmpl-picrew-member-list">
|
||||||
|
<li data-member-id="{{{data.id}}}" class="">
|
||||||
|
<img width="31" height="31" src="{{{data.src}}}"/>
|
||||||
|
<p>{{{data.title}}}</p><span class="remove-member-to-list" data-member="{{{data.id}}}"><i class="picrew-icon-close"></i></span>
|
||||||
|
<input type="hidden" name="memberlist[]" value='{{{data.id}}}'>
|
||||||
|
</li>
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
if($options['memberlist']):
|
||||||
|
$teamargs = array(
|
||||||
|
'orderby' => 'post__in',
|
||||||
|
'post_type' => 'pirate_crew_member',
|
||||||
|
'post__in' => $options['memberlist'],
|
||||||
|
);
|
||||||
|
$team = new WP_Query($teamargs);
|
||||||
|
if($team->have_posts()):
|
||||||
|
while($team->have_posts()): $team->the_post();?>
|
||||||
|
<li data-member-id="<?php echo $team->post->ID;?>" class="">
|
||||||
|
<img width="31" height="31" src="<?php echo $this->pirate_team_get_thumbnail($team->post->ID,'thumbnail');?>"/>
|
||||||
|
<p><?php the_title();?></p><span class="remove-member-to-list" data-member="<?php echo $team->post->ID; ?>"><i class="picrew-icon-close"></i></span>
|
||||||
|
<input type="hidden" name="memberlist[]" value="<?php echo $team->post->ID;?>">
|
||||||
|
</li>
|
||||||
|
<?php endwhile;
|
||||||
|
wp_reset_postdata();
|
||||||
|
endif;
|
||||||
|
endif;
|
||||||
|
?>
|
||||||
|
</ul><!-- .picrew-members-list-selected -->
|
||||||
|
</div><!-- .pirate-crew-customize-member -->
|
||||||
|
<div class="pirate-crew-customize-style">
|
||||||
|
<div class="picrew-heading-group">
|
||||||
|
<h2 class="sub-h"><?php echo __('Presets', 'pirate-crew');?></h2>
|
||||||
|
<span><?php echo __('Choose a preset from below.', 'pirate-crew');?></span>
|
||||||
|
</div>
|
||||||
|
<div class="picrew-preset-list picrew-clearfix">
|
||||||
|
<?php
|
||||||
|
$styles = array(
|
||||||
|
'Cards' => array(4, 1),
|
||||||
|
'List' => array(2, 0),
|
||||||
|
'Table' => array(3, 0),
|
||||||
|
);
|
||||||
|
foreach ($styles as $key => $set):
|
||||||
|
$val = strtolower($key);?>
|
||||||
|
<input class="picrew-radio-hidden" id="rad-<?php echo $val;?>" type="radio" data-style="<?php echo $set[0];?>" data-column="<?php echo $set[1];?>" name="team-style" value="<?php echo $val;?>" <?php checked($val,$options['team-style']);?>>
|
||||||
|
<label for="rad-<?php echo $val;?>"><img src="<?php echo $this->settings['plugin_url'] . '/images/' . $val . '.jpg';?>">
|
||||||
|
<span data-type="<?php echo $val;?>"><?php echo $key;?></span>
|
||||||
|
</label>
|
||||||
|
<?php endforeach;?>
|
||||||
|
</div><!-- .picrew-preset-list -->
|
||||||
|
<div class="picrew-section picrew-clearfix">
|
||||||
|
<div class="picrew-heading-group">
|
||||||
|
<h2 class="sub-h"><?php echo __('Style', 'pirate-crew');?></h2>
|
||||||
|
</div><!-- .picrew-heading-group -->
|
||||||
|
<div class="picrew-row">
|
||||||
|
<div class="picrew-col-2">
|
||||||
|
<?php
|
||||||
|
$preset = array(
|
||||||
|
'style-1' => sprintf(__('Style %d', 'pirate-crew'), 1),
|
||||||
|
'style-2' => sprintf(__('Style %d', 'pirate-crew'), 2),
|
||||||
|
'style-3' => sprintf(__('Style %d', 'pirate-crew'), 3),
|
||||||
|
'style-4' => sprintf(__('Style %d', 'pirate-crew'), 4));
|
||||||
|
$this->selectbuilder('preset', $preset, $options['preset'], '', "picrew-select-default dyn-sel picrew-styles",'key');
|
||||||
|
?>
|
||||||
|
</div><!-- .picrew-col-2 -->
|
||||||
|
<div class="picrew-col-2 picrew-columns-wrap">
|
||||||
|
<?php
|
||||||
|
$columns = array(
|
||||||
|
'2' => sprintf(__('%d Columns', 'pirate-crew'), 2),
|
||||||
|
'3' => sprintf(__('%d Columns', 'pirate-crew'), 3),
|
||||||
|
'4' => sprintf(__('%d Columns', 'pirate-crew'), 4),
|
||||||
|
'5' => sprintf(__('%d Columns', 'pirate-crew'), 5));
|
||||||
|
$this->selectbuilder('columns', $columns, $options['columns'], '', "picrew-select-default dyn-sel picrew-columns",'key');
|
||||||
|
?>
|
||||||
|
</div><!-- .picrew-col-2 -->
|
||||||
|
</div><!-- .picrew-row -->
|
||||||
|
</div><!-- .picrew-row -->
|
||||||
|
|
||||||
|
</div><!-- .pirate-crew-customize-style -->
|
||||||
|
<div class="picrew-clearfix"></div>
|
||||||
|
</div><!-- .pirate-crew-customize-inner -->
|
||||||
|
</div><!-- .pirate-crew-customize -->
|
||||||
|
</div><!-- wrap -->
|
||||||
|
<script type="text/html" id="tmpl-picrew-member-select">
|
||||||
|
<div class="select2-result-repository clearfix">
|
||||||
|
<# if ( data.src ) { #>
|
||||||
|
<img class="select2-result-repository__avatar" width="31" height="31" src="{{{data.src}}}" />
|
||||||
|
<# } #>
|
||||||
|
<p class="select2-result-repository__title">{{{data.title}}}</p>
|
||||||
|
<# if ( data.disabled ) { #>
|
||||||
|
<span class="select2-result-repository__disabled"><?php _e('Added','pirate-crew');?></span>
|
||||||
|
<# } #>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
3
wp-content/plugins/Pirate-Crew/js/select2.min.js
vendored
Normal file
117
wp-content/plugins/Pirate-Crew/js/team-admin.js
Normal file
13
wp-content/plugins/Pirate-Crew/js/team.js
Normal file
1
wp-content/plugins/Pirate-Crew/js/team.min.js
vendored
Normal file
BIN
wp-content/plugins/Pirate-Crew/language/pirate-crew-de_DE.mo
Normal file
270
wp-content/plugins/Pirate-Crew/language/pirate-crew-de_DE.po
Normal file
@@ -0,0 +1,270 @@
|
|||||||
|
# Copyright (C) 2017 Pirate Crew
|
||||||
|
# This file is distributed under the same license as the Pirate Crew package.
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Pirate Crew 1.0.8\n"
|
||||||
|
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/Pirate-Crew\n"
|
||||||
|
"POT-Creation-Date: 2018-12-18 12:12+0100\n"
|
||||||
|
"PO-Revision-Date: 2018-12-21 19:13+0100\n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"Language: de_DE\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Generator: Poedit 2.2\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"X-Poedit-KeywordsList: __;_e;esc_html_e;esc_html_x:1,2c;esc_html__;"
|
||||||
|
"esc_attr_e;esc_attr_x:1,2c;esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;"
|
||||||
|
"_x:1,2c;_n:1,2;_n_noop:1,2;__ngettext:1,2;__ngettext_noop:1,2;_c,_nc:4c,1,2\n"
|
||||||
|
"X-Poedit-Basepath: ..\n"
|
||||||
|
"X-Poedit-SearchPath-0: .\n"
|
||||||
|
|
||||||
|
#: includes/member-details.php:3 pirate-crew.php:284 templates/table.php:12
|
||||||
|
msgid "Position"
|
||||||
|
msgstr "Position"
|
||||||
|
|
||||||
|
#: includes/member-details.php:7
|
||||||
|
msgid "Short Description (in 140 characters or less)"
|
||||||
|
msgstr "Kurzbeschreibung (in 140 Zeichen oder weniger)"
|
||||||
|
|
||||||
|
#: includes/member-details.php:11
|
||||||
|
msgid "Additional Information (for Email, Telephone, Fax, etc)"
|
||||||
|
msgstr "Zusätzliche Informationen (E-Mail, Telefon, Fax etc.)"
|
||||||
|
|
||||||
|
#: includes/member-details.php:17
|
||||||
|
msgid "Label"
|
||||||
|
msgstr "Bezeichnung"
|
||||||
|
|
||||||
|
#: includes/member-details.php:18
|
||||||
|
msgid "Content"
|
||||||
|
msgstr "Inhalt"
|
||||||
|
|
||||||
|
#: includes/member-details.php:27 includes/member-details.php:34
|
||||||
|
#: includes/member-details.php:41
|
||||||
|
msgid "ex: Email"
|
||||||
|
msgstr "Beispiel: E-Mail"
|
||||||
|
|
||||||
|
#: includes/member-details.php:28 includes/member-details.php:35
|
||||||
|
#: includes/member-details.php:42
|
||||||
|
msgid "mail@example.com"
|
||||||
|
msgstr "mail@example.com"
|
||||||
|
|
||||||
|
#: includes/member-details.php:29 includes/member-details.php:36
|
||||||
|
#: includes/member-details.php:43 includes/member-details.php:69
|
||||||
|
#: includes/member-details.php:78 includes/member-details.php:87
|
||||||
|
msgid "Remove"
|
||||||
|
msgstr "Entfernen"
|
||||||
|
|
||||||
|
#: includes/member-details.php:47 includes/member-details.php:91
|
||||||
|
msgid "Add row"
|
||||||
|
msgstr "Zeile hinzufügen"
|
||||||
|
|
||||||
|
#: includes/member-details.php:49
|
||||||
|
msgid "Links (Twitter, LinkedIn, etc)"
|
||||||
|
msgstr "Links (Twitter, LinkedIn etc.)"
|
||||||
|
|
||||||
|
#: includes/member-details.php:55
|
||||||
|
msgid "Icon"
|
||||||
|
msgstr "Symbol"
|
||||||
|
|
||||||
|
#: includes/member-details.php:56
|
||||||
|
msgid "Link"
|
||||||
|
msgstr "Link"
|
||||||
|
|
||||||
|
#: includes/member-details.php:66 includes/member-details.php:75
|
||||||
|
#: includes/member-details.php:84
|
||||||
|
msgid "Select icon"
|
||||||
|
msgstr "Symbol auswählen"
|
||||||
|
|
||||||
|
#: includes/member-details.php:68 includes/member-details.php:77
|
||||||
|
#: includes/member-details.php:86
|
||||||
|
msgid "ex: http://www.twitter.com/piratenpartei"
|
||||||
|
msgstr "Beispiel: http://www.twitter.com/piratenpartei"
|
||||||
|
|
||||||
|
#: includes/member-post-insert.php:6
|
||||||
|
msgid "Select a member from the list to add as author to the post"
|
||||||
|
msgstr ""
|
||||||
|
"Wähle ein Mitglied aus der Liste aus, um es als Autor zum Beitrag "
|
||||||
|
"hinzuzufügen"
|
||||||
|
|
||||||
|
#: includes/member-post-insert.php:13 includes/team-details.php:14
|
||||||
|
msgid "Select a member"
|
||||||
|
msgstr "Ein Mitglied auswählen"
|
||||||
|
|
||||||
|
#: includes/member-post-insert.php:27 includes/team-details.php:26
|
||||||
|
msgid "You haven't added any crew members yet."
|
||||||
|
msgstr "Du hast noch keine Crew-Mitglieder hinzugefügt."
|
||||||
|
|
||||||
|
#: includes/member-post-insert.php:28 includes/team-details.php:27
|
||||||
|
msgid "Add a crew member"
|
||||||
|
msgstr "Crew-Mitglied hinzufügen"
|
||||||
|
|
||||||
|
#: includes/team-details.php:6 pirate-crew.php:202 pirate-crew.php:311
|
||||||
|
msgid "Members"
|
||||||
|
msgstr "Mitglieder"
|
||||||
|
|
||||||
|
#: includes/team-details.php:7
|
||||||
|
msgid "Select members from the dropdown, drag and drop them to reorder."
|
||||||
|
msgstr ""
|
||||||
|
"Wähle Mitglieder im Auswahlmenü aus und sortiere sie mit Drag-and-drop."
|
||||||
|
|
||||||
|
#: includes/team-details.php:32
|
||||||
|
msgid "No Members Selected"
|
||||||
|
msgstr "Keine Mitglieder ausgewählt"
|
||||||
|
|
||||||
|
#: includes/team-details.php:64
|
||||||
|
msgid "Presets"
|
||||||
|
msgstr "Vorlagen"
|
||||||
|
|
||||||
|
#: includes/team-details.php:65
|
||||||
|
msgid "Choose a preset from below."
|
||||||
|
msgstr "Wählen unten eine Vorlage aus."
|
||||||
|
|
||||||
|
#: includes/team-details.php:84 pirate-crew.php:313
|
||||||
|
msgid "Style"
|
||||||
|
msgstr "Stil"
|
||||||
|
|
||||||
|
#: includes/team-details.php:90 includes/team-details.php:91
|
||||||
|
#: includes/team-details.php:92 includes/team-details.php:93
|
||||||
|
#, php-format
|
||||||
|
msgid "Style %d"
|
||||||
|
msgstr "Stil %d"
|
||||||
|
|
||||||
|
#: includes/team-details.php:100 includes/team-details.php:101
|
||||||
|
#: includes/team-details.php:102 includes/team-details.php:103
|
||||||
|
#, php-format
|
||||||
|
msgid "%d Columns"
|
||||||
|
msgstr "%d Spalten"
|
||||||
|
|
||||||
|
#: includes/team-details.php:122
|
||||||
|
msgid "Added"
|
||||||
|
msgstr "Hinzugefügt"
|
||||||
|
|
||||||
|
#: pirate-crew.php:194 pirate-crew.php:195 pirate-crew.php:383
|
||||||
|
msgid "Pirate Crew Member"
|
||||||
|
msgstr "Piraten-Crew-Mitglied"
|
||||||
|
|
||||||
|
#: pirate-crew.php:196 pirate-crew.php:226
|
||||||
|
msgid "Pirate Crews"
|
||||||
|
msgstr "Piraten-Crews"
|
||||||
|
|
||||||
|
#: pirate-crew.php:197 pirate-crew.php:198
|
||||||
|
msgid "Add New Member"
|
||||||
|
msgstr "Neues Mitglied erstellen"
|
||||||
|
|
||||||
|
#: pirate-crew.php:199
|
||||||
|
msgid "New Crew Member"
|
||||||
|
msgstr "Neues Crew-Mitglied"
|
||||||
|
|
||||||
|
#: pirate-crew.php:200
|
||||||
|
msgid "Edit Crew Member"
|
||||||
|
msgstr "Crew-Mitglied bearbeiten"
|
||||||
|
|
||||||
|
#: pirate-crew.php:201
|
||||||
|
msgid "View Crew Member"
|
||||||
|
msgstr "Crew-Mitglied anzeigen"
|
||||||
|
|
||||||
|
#: pirate-crew.php:203
|
||||||
|
msgid "Search Crew Members"
|
||||||
|
msgstr "Crew-Mitglieder bearbeiten"
|
||||||
|
|
||||||
|
#: pirate-crew.php:204
|
||||||
|
msgid "No crew members found."
|
||||||
|
msgstr "Keine Crew-Mitglieder gefunden."
|
||||||
|
|
||||||
|
#: pirate-crew.php:205
|
||||||
|
msgid "No crew members found in trash."
|
||||||
|
msgstr "Keine Crew-Mitglieder im Papierkorb gefunden."
|
||||||
|
|
||||||
|
#: pirate-crew.php:209
|
||||||
|
msgid "This is where you can create and manage crew members."
|
||||||
|
msgstr "Hier kannst du Crew-Mitglieder erstellen und verwalten."
|
||||||
|
|
||||||
|
#: pirate-crew.php:224 pirate-crew.php:225
|
||||||
|
msgid "Pirate Crew"
|
||||||
|
msgstr "Piraten-Crew"
|
||||||
|
|
||||||
|
#: pirate-crew.php:227 pirate-crew.php:228 pirate-crew.php:375
|
||||||
|
msgid "Add New Crew"
|
||||||
|
msgstr "Neue Crew erstellen"
|
||||||
|
|
||||||
|
#: pirate-crew.php:229
|
||||||
|
msgid "New Crew"
|
||||||
|
msgstr "Neue Crew"
|
||||||
|
|
||||||
|
#: pirate-crew.php:230
|
||||||
|
msgid "Edit Crew"
|
||||||
|
msgstr "Crew bearbeiten"
|
||||||
|
|
||||||
|
#: pirate-crew.php:231
|
||||||
|
msgid "View Crew"
|
||||||
|
msgstr "Crew anzeigen"
|
||||||
|
|
||||||
|
#: pirate-crew.php:232
|
||||||
|
msgid "Crews"
|
||||||
|
msgstr "Crews"
|
||||||
|
|
||||||
|
#: pirate-crew.php:233
|
||||||
|
msgid "Search Crews"
|
||||||
|
msgstr "Crews durchsuchen"
|
||||||
|
|
||||||
|
#: pirate-crew.php:234
|
||||||
|
msgid "No crews found."
|
||||||
|
msgstr "Keine Crews gefunden."
|
||||||
|
|
||||||
|
#: pirate-crew.php:235
|
||||||
|
msgid "No crews found in trash."
|
||||||
|
msgstr "Keine Crews im Papierkorb gefunden."
|
||||||
|
|
||||||
|
#: pirate-crew.php:239
|
||||||
|
msgid "This is where you can create and manage crews."
|
||||||
|
msgstr "Hier kannst du Crews erstellen und verwalten."
|
||||||
|
|
||||||
|
#: pirate-crew.php:282 pirate-crew.php:310 templates/table.php:9
|
||||||
|
msgid "Name"
|
||||||
|
msgstr "Name"
|
||||||
|
|
||||||
|
#: pirate-crew.php:283 templates/table.php:6
|
||||||
|
msgid "Photo"
|
||||||
|
msgstr "Foto"
|
||||||
|
|
||||||
|
#: pirate-crew.php:312
|
||||||
|
msgid "Preset"
|
||||||
|
msgstr "Vorlage"
|
||||||
|
|
||||||
|
#: pirate-crew.php:314 pirate-crew.php:345 pirate-crew.php:347
|
||||||
|
msgid "Shortcode"
|
||||||
|
msgstr "Shortcode"
|
||||||
|
|
||||||
|
#: pirate-crew.php:345 pirate-crew.php:347
|
||||||
|
msgid "Copy"
|
||||||
|
msgstr "Kopieren"
|
||||||
|
|
||||||
|
#: pirate-crew.php:381
|
||||||
|
msgid "Member Details"
|
||||||
|
msgstr "Mitglied-Details"
|
||||||
|
|
||||||
|
#: pirate-crew.php:382
|
||||||
|
msgid "Crew Details"
|
||||||
|
msgstr "Crew-Details"
|
||||||
|
|
||||||
|
#: shortcodes/crew.php:13
|
||||||
|
msgid "Crew not found"
|
||||||
|
msgstr "Crew nicht gefunden"
|
||||||
|
|
||||||
|
#: shortcodes/crew.php:17
|
||||||
|
msgid "No members found"
|
||||||
|
msgstr "Keine Mitglieder gefunden"
|
||||||
|
|
||||||
|
#: shortcodes/member.php:96
|
||||||
|
msgid "Pirate not found"
|
||||||
|
msgstr "Pirat nicht gefunden"
|
||||||
|
|
||||||
|
#: templates/table.php:15
|
||||||
|
msgid "Short Description"
|
||||||
|
msgstr "Kurzbschreibung"
|
||||||
|
|
||||||
|
#: templates/table.php:18
|
||||||
|
msgid "Social Links"
|
||||||
|
msgstr "Soziale Links"
|
||||||
684
wp-content/plugins/Pirate-Crew/pirate-crew.php
Normal file
@@ -0,0 +1,684 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
Plugin Name: Pirate Crew
|
||||||
|
Plugin URI: http://github.com/Piratenpartei/Pirate-Crew
|
||||||
|
Description: Defines crew (people) list and cards for websites in pirate style
|
||||||
|
Version: 1.0.7
|
||||||
|
Author: xwolf
|
||||||
|
Author URI: http://www.xwolf.de
|
||||||
|
License: GPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('ABSPATH')) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
add_action('plugins_loaded', array('Pirate_Crew', 'instance'));
|
||||||
|
register_activation_hook(__FILE__, array('Pirate_Crew', 'activation'));
|
||||||
|
register_deactivation_hook(__FILE__, array('Pirate_Crew', 'deactivation'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (!class_exists('Pirate_Crew')):
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
/* Sets up main class
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
class Pirate_Crew {
|
||||||
|
|
||||||
|
const version = '1.0.8';
|
||||||
|
const php_version = '5.6'; // Minimal erforderliche PHP-Version
|
||||||
|
const wp_version = '4.5'; // Minimal erforderliche WordPress-Version
|
||||||
|
|
||||||
|
public static $themeswithowncss = array('Pirate Rogue');
|
||||||
|
private static $instance = null;
|
||||||
|
|
||||||
|
private $settings;
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Define Instance
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public static function instance() {
|
||||||
|
if (null == self::$instance) {
|
||||||
|
self::$instance = new self;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Contstructor
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public function __construct() {
|
||||||
|
$this->settings = array(
|
||||||
|
'plugin_path' => plugin_dir_path(__FILE__),
|
||||||
|
'plugin_url' => plugin_dir_url(__FILE__),
|
||||||
|
'plugin_base' => dirname(plugin_basename(__FILE__)),
|
||||||
|
'plugin_file' => __FILE__,
|
||||||
|
'plugin_version' => self::version,
|
||||||
|
'image_size_width' => 300,
|
||||||
|
'image_size_height' => 300,
|
||||||
|
'image_size_crop' => true,
|
||||||
|
);
|
||||||
|
$this->pirate_crew_load_textdomain();
|
||||||
|
$this->pirate_crew_start();
|
||||||
|
|
||||||
|
|
||||||
|
$this->pirate_crew_backend();
|
||||||
|
$this->pirate_crew_add_shortcodes();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Load Textdomain
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public function pirate_crew_load_textdomain() {
|
||||||
|
load_plugin_textdomain('pirate-crew', false, $this->settings['plugin_base'] . '/language');
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Activation
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public static function activation() {
|
||||||
|
self::version_compare();
|
||||||
|
flush_rewrite_rules(); // Flush Rewrite-Regeln, so dass CPT und CT auf dem Front-End sofort vorhanden sind
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* deactivate plugin
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public static function deactivation() {
|
||||||
|
flush_rewrite_rules(); // Flush Rewrite-Regeln, so dass CPT und CT auf dem Front-End sofort vorhanden sind
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Checking Versions
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
private static function version_compare() {
|
||||||
|
$error = '';
|
||||||
|
|
||||||
|
if (version_compare(PHP_VERSION, self::php_version, '<')) {
|
||||||
|
$error = sprintf('Your version of PHP (%s) is too old. Please update at least to version %s.', PHP_VERSION, self::php_version);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version_compare($GLOBALS['wp_version'], self::wp_version, '<')) {
|
||||||
|
$error = sprintf('Your version of WordPress (%s) is too old. Please upgrade at least to version %s.', $GLOBALS['wp_version'], self::wp_version);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($error)) {
|
||||||
|
deactivate_plugins(plugin_basename(__FILE__), false, true);
|
||||||
|
wp_die($error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Main
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public function pirate_crew_start() {
|
||||||
|
add_action('init', array( $this, 'create_member_support' ));
|
||||||
|
add_action('init', array( $this, 'pirate_crew_image_size' ));
|
||||||
|
add_action('wp_enqueue_scripts', array( $this, 'embed_front_script_styles' ));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Define Image Size for crew member thumbnail
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public function pirate_crew_image_size(){
|
||||||
|
if ( function_exists( 'add_image_size' ) ) {
|
||||||
|
add_image_size('pirate_crew', $this->settings['image_size_width'], $this->settings['image_size_height'], $this->settings['image_size_crop']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Defines Shortcodes
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
public function pirate_crew_add_shortcodes() {
|
||||||
|
add_shortcode('pirate', array( $this, 'pirate_team_member_shortcode' ));
|
||||||
|
add_shortcode('crew', array( $this, 'pirate_crew_shortcodes' ));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function pirate_crew_shortcodes($atts) {
|
||||||
|
include('shortcodes/crew.php');
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pirate_team_member_shortcode($atts) {
|
||||||
|
require('shortcodes/member.php');
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Register Scripts and CSS
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public function embed_front_script_styles() {
|
||||||
|
|
||||||
|
$my_theme = wp_get_theme();
|
||||||
|
$my_theme_name = $my_theme->get( 'Name' );
|
||||||
|
|
||||||
|
|
||||||
|
if (!in_array($my_theme_name, Pirate_Crew::$themeswithowncss)) {
|
||||||
|
wp_enqueue_script('pirate-crew', plugins_url('js/team.min.js', $this->settings['plugin_file']), array('jquery'), $this->settings['plugin_version'], true);
|
||||||
|
wp_enqueue_style('pirate-crew', plugins_url('css/team.css', $this->settings['plugin_file']), false, $this->settings['plugin_version'], 'all');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Create Custom Post Type
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public function create_member_support() {
|
||||||
|
// Create pirate_crew_member post type
|
||||||
|
if (post_type_exists("pirate_crew_member")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$labels = array(
|
||||||
|
'name' => __('Pirate Crew Member', 'pirate-crew'),
|
||||||
|
'singular_name' => __('Pirate Crew Member', 'pirate-crew'),
|
||||||
|
'menu_name' => __('Pirate Crews', 'pirate-crew'),
|
||||||
|
'add_new' => __('Add New Member', 'pirate-crew'),
|
||||||
|
'add_new_item' => __('Add New Member', 'pirate-crew'),
|
||||||
|
'new_item' => __('New Crew Member', 'pirate-crew'),
|
||||||
|
'edit_item' => __('Edit Crew Member', 'pirate-crew'),
|
||||||
|
'view_item' => __('View Crew Member', 'pirate-crew'),
|
||||||
|
'all_items' => __('Members', 'pirate-crew'),
|
||||||
|
'search_items' => __('Search Crew Members', 'pirate-crew'),
|
||||||
|
'not_found' => __('No crew members found.', 'pirate-crew'),
|
||||||
|
'not_found_in_trash' => __('No crew members found in trash.', 'pirate-crew')
|
||||||
|
);
|
||||||
|
$cp_args = array(
|
||||||
|
'labels' => $labels,
|
||||||
|
'description' => __('This is where you can create and manage crew members.', 'pirate-crew'),
|
||||||
|
'publicly_queryable' => false,
|
||||||
|
'show_ui' => true,
|
||||||
|
'show_in_menu' => true,
|
||||||
|
'capability_type' => 'post',
|
||||||
|
'supports' => array('title','editor', 'thumbnail' ),
|
||||||
|
'menu_icon' => 'dashicons-admin-users'
|
||||||
|
);
|
||||||
|
register_post_type('pirate_crew_member', $cp_args);
|
||||||
|
|
||||||
|
|
||||||
|
if (post_type_exists("pirate_crew")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$labels = array(
|
||||||
|
'name' => __('Pirate Crew', 'pirate-crew'),
|
||||||
|
'singular_name' => __('Pirate Crew', 'pirate-crew'),
|
||||||
|
'menu_name' => __('Pirate Crews', 'pirate-crew'),
|
||||||
|
'add_new' => __('Add New Crew', 'pirate-crew'),
|
||||||
|
'add_new_item' => __('Add New Crew', 'pirate-crew'),
|
||||||
|
'new_item' => __('New Crew', 'pirate-crew'),
|
||||||
|
'edit_item' => __('Edit Crew', 'pirate-crew'),
|
||||||
|
'view_item' => __('View Crew', 'pirate-crew'),
|
||||||
|
'all_items' => __('Crews', 'pirate-crew'),
|
||||||
|
'search_items' => __('Search Crews', 'pirate-crew'),
|
||||||
|
'not_found' => __('No crews found.', 'pirate-crew'),
|
||||||
|
'not_found_in_trash' => __('No crews found in trash.', 'pirate-crew')
|
||||||
|
);
|
||||||
|
$cp_args = array(
|
||||||
|
'labels' => $labels,
|
||||||
|
'description' => __('This is where you can create and manage crews.', 'pirate-crew'),
|
||||||
|
'show_ui' => true,
|
||||||
|
"show_in_menu" => 'edit.php?post_type=pirate_crew_member',
|
||||||
|
'capability_type' => 'post',
|
||||||
|
'supports' => array('title')
|
||||||
|
);
|
||||||
|
register_post_type('pirate_crew', $cp_args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Admin Styles
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public function pirate_crew_backend() {
|
||||||
|
if (is_admin()) {
|
||||||
|
add_action('add_meta_boxes', array( $this, 'register_metaboxes' ));
|
||||||
|
add_action('save_post', array( $this, 'save_metabox_data' ), 10, 3);
|
||||||
|
add_action('admin_init', array( $this, 'meta_box_scripts' ));
|
||||||
|
add_action('admin_menu', array( $this, 'add_submenu_items' ), 12);
|
||||||
|
add_action('edit_form_after_title', array( $this, 'shortcode_preview' ));
|
||||||
|
add_filter('manage_pirate_crew_member_posts_columns' , array( $this, 'custom_columns_member' ));
|
||||||
|
add_action('manage_pirate_crew_member_posts_custom_column' , array( $this, 'custom_columns_member_data' ) , 10, 2 );
|
||||||
|
add_filter('manage_pirate_crew_posts_columns' , array( $this, 'custom_columns_team' ));
|
||||||
|
add_action('manage_pirate_crew_posts_custom_column' , array( $this, 'custom_columns_team_data' ) , 10, 2 );
|
||||||
|
add_filter('admin_post_thumbnail_size', array($this,'custom_admin_thumb_size'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Admin Thumb SIze
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
function custom_admin_thumb_size($thumb_size){
|
||||||
|
global $post_type,$post;
|
||||||
|
if($post_type == 'pirate_crew_member'){
|
||||||
|
$thumb_size = "pirate_crew";
|
||||||
|
}
|
||||||
|
return $thumb_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Crew Data
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
function custom_columns_member($columns){
|
||||||
|
$columns = array(
|
||||||
|
'cb' => '<input type="checkbox" />',
|
||||||
|
'title' => __('Name','pirate-crew'),
|
||||||
|
'featured_image' => __('Photo','pirate-crew'),
|
||||||
|
'designation' => __('Position','pirate-crew'),
|
||||||
|
'date' => 'Date'
|
||||||
|
);
|
||||||
|
return $columns;
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Get Crew Member Data
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
function custom_columns_member_data($column,$post_ID){
|
||||||
|
$options = $this->get_options('pirate_crew_member',$post_ID );
|
||||||
|
switch ( $column ) {
|
||||||
|
case 'featured_image':
|
||||||
|
echo the_post_thumbnail( 'thumbnail' );
|
||||||
|
break;
|
||||||
|
case 'designation':
|
||||||
|
echo $options['pirate-crew-designation'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Custom member column for team.
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
function custom_columns_team($columns){
|
||||||
|
$columns = array(
|
||||||
|
'cb' => '<input type="checkbox" />',
|
||||||
|
'title' => __('Name','pirate-crew'),
|
||||||
|
'members' => __('Members','pirate-crew'),
|
||||||
|
'preset' => __('Preset','pirate-crew'),
|
||||||
|
'style' => __('Style','pirate-crew'),
|
||||||
|
'shortcode' =>__('Shortcode','pirate-crew')
|
||||||
|
);
|
||||||
|
return $columns;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Custom member column data for team.
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
function custom_columns_team_data($column,$post_ID){
|
||||||
|
$options = $this->get_options('pirate_crew',$post_ID );
|
||||||
|
$post = get_post( $post_ID );
|
||||||
|
switch ( $column ) {
|
||||||
|
case 'members':
|
||||||
|
echo count($options['memberlist']);
|
||||||
|
break;
|
||||||
|
case 'preset':
|
||||||
|
echo $options['team-style'];
|
||||||
|
break;
|
||||||
|
case 'style':
|
||||||
|
echo $options['preset'];
|
||||||
|
break;
|
||||||
|
case 'shortcode':
|
||||||
|
printf('<code>[crew id="%s"]</code>',$post_ID);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Helper for Shortcodes
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public function shortcode_preview($post) {
|
||||||
|
if ('pirate_crew' == $post->post_type && 'publish' == $post->post_status) {
|
||||||
|
printf('<p>%1$s: <code>[crew id="%2$s"]</code><button id="copy-picrew" type="button" data-clipboard-text="[crew id="%2$s"]" class="button">%3$s</button></p>', __("Shortcode", 'pirate-crew'), $post->ID, __("Copy", 'pirate-crew'));
|
||||||
|
} elseif ('pirate_crew_member' == $post->post_type && 'publish' == $post->post_status) {
|
||||||
|
printf('<p>%1$s: <code>[pirate id="%2$s"]</code><button id="copy-picrew" type="button" data-clipboard-text="[pirate id="%2$s"]" class="button">%3$s</button></p>', __("Shortcode", 'pirate-crew'), $post->ID, __("Copy", 'pirate-crew'));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Meta Boxes
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public function meta_box_scripts() {
|
||||||
|
global $pagenow, $typenow, $post;
|
||||||
|
if (empty($typenow) && !empty($_GET['post'])) {
|
||||||
|
$post = get_post($_GET['post']);
|
||||||
|
$typenow = $post->post_type;
|
||||||
|
}
|
||||||
|
if (($pagenow == 'post-new.php' or $pagenow == 'post.php') and ($typenow == 'pirate_crew_member' or $typenow == 'pirate_crew')) {
|
||||||
|
wp_enqueue_style('pirate-crew-admin', plugins_url('css/admin.css', $this->settings['plugin_file']), false, $this->settings['plugin_version'], 'all');
|
||||||
|
wp_enqueue_script('team-meta-box', plugins_url('js/team-admin.js', $this->settings['plugin_file']), array( 'jquery', 'jquery-ui-sortable', 'wp-util' ), $this->settings['plugin_version']);
|
||||||
|
wp_enqueue_script('select2', plugins_url('js/select2.min.js', $this->settings['plugin_file']), array( 'jquery' ), $this->settings['plugin_version']);
|
||||||
|
wp_enqueue_style('select2', plugins_url('css/select2.min.css', $this->settings['plugin_file']), false, $this->settings['plugin_version'], 'all');
|
||||||
|
wp_enqueue_style('pirate-crew-icomoon-css', plugins_url('css/icomoon.css', $this->settings['plugin_file']), false, $this->settings['plugin_version'], 'all');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Add Submenu Items
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public function add_submenu_items() {
|
||||||
|
add_submenu_page('edit.php?post_type=pirate_crew_member', __('Add New Crew', 'pirate-crew'), __('Add New Crew', 'pirate-crew'), 'manage_options', 'post-new.php?post_type=pirate_crew');
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Register metaboxes
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public function register_metaboxes() {
|
||||||
|
add_meta_box('member_details', __('Member Details', 'pirate-crew'), array( $this, 'member_details_meta' ), 'pirate_crew_member');
|
||||||
|
add_meta_box('team_details', __('Crew Details', 'pirate-crew'), array( $this, 'team_details_meta' ), 'pirate_crew', 'normal', 'high');
|
||||||
|
add_meta_box('team_details', __('Pirate Crew Member', 'pirate-crew'), array( $this, 'member_post_insert' ), 'post', 'normal', 'high');
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Metabox for extra data of crew member
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public function member_details_meta($post) {
|
||||||
|
wp_nonce_field(basename(__FILE__), 'pirate_crew_meta_details');
|
||||||
|
$pirate_crew_contact = get_post_meta($post->ID, 'pirate_crew_contact', true);
|
||||||
|
$pirate_crew_social = get_post_meta($post->ID, 'pirate_crew_social', true);
|
||||||
|
$socialicons = array('mail', 'link', 'twitter','facebook',
|
||||||
|
'google-plus', 'google-plus2',
|
||||||
|
'hangouts', 'google-drive',
|
||||||
|
'facebook2', 'instagram', 'whatsapp',
|
||||||
|
'youtube', 'vimeo', 'vimeo2',
|
||||||
|
'flickr', 'dribbble', 'behance',
|
||||||
|
'behance2', 'dropbox', 'wordpress', 'blogger',
|
||||||
|
'tumblr', 'skype', 'linkedin2',
|
||||||
|
'linkedin', 'stackoverflow', 'pinterest2', 'pinterest', 'foursquare',
|
||||||
|
'github', 'flattr', 'xing', 'stumbleupon', 'stumbleupon2',
|
||||||
|
'delicious', 'lastfm', 'hackernews', 'reddit', 'soundcloud',
|
||||||
|
'soundcloud2', 'yahoo', 'ello', 'wordpress2', 'steam', 'steam2',
|
||||||
|
'500px', 'deviantart', 'twitch', 'feed', 'sina-weibo', 'renren',
|
||||||
|
'vk', 'vine', 'telegram', 'spotify');
|
||||||
|
include $this->settings['plugin_path'] . 'includes/member-details.php';
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Meta box display callback - Team details.
|
||||||
|
* @since 1.0.0
|
||||||
|
* @param WP_Post $post Current post object.
|
||||||
|
*/
|
||||||
|
public function team_details_meta($post) {
|
||||||
|
wp_nonce_field(basename(__FILE__), 'pirate_crew_meta_details');
|
||||||
|
$args = array(
|
||||||
|
'post_type' => 'pirate_crew_member',
|
||||||
|
'posts_per_page' => -1
|
||||||
|
);
|
||||||
|
$members = new WP_Query($args);
|
||||||
|
$options = $this->get_options('pirate_crew', $post->ID);
|
||||||
|
$defaultimage = $this->settings['plugin_url'] . 'images/default-member.jpg';
|
||||||
|
include $this->settings['plugin_path'] . 'includes/team-details.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Meta box display callback - Team details.
|
||||||
|
* @since 1.0.0
|
||||||
|
* @param WP_Post $post Current post object.
|
||||||
|
*/
|
||||||
|
public function member_post_insert($post) {
|
||||||
|
wp_nonce_field(basename(__FILE__), 'pirate_crew_meta_details');
|
||||||
|
$args = array(
|
||||||
|
'post_type' => 'pirate_crew_member',
|
||||||
|
'posts_per_page' => -1,
|
||||||
|
'orderby' => 'title',
|
||||||
|
'order' => 'ASC',
|
||||||
|
);
|
||||||
|
$members = new WP_Query($args);
|
||||||
|
|
||||||
|
$preauthor = get_post_meta( $post->ID, 'pirate_crew_member_id', true );
|
||||||
|
|
||||||
|
$defaultimage = $this->settings['plugin_url'] . 'images/default-member.jpg';
|
||||||
|
include $this->settings['plugin_path'] . 'includes/member-post-insert.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/*Save Metabox Data
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public function save_metabox_data($post_id, $post) {
|
||||||
|
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isset($_POST['pirate_crew_meta_details']) || !wp_verify_nonce($_POST['pirate_crew_meta_details'], basename(__FILE__))) {
|
||||||
|
return $post_id;
|
||||||
|
}
|
||||||
|
$post_type = get_post_type_object($post->post_type);
|
||||||
|
if (!current_user_can($post_type->cap->edit_post, $post_id)) {
|
||||||
|
return $post_id;
|
||||||
|
}
|
||||||
|
$team_meta = array();
|
||||||
|
|
||||||
|
if ($post->post_type == 'pirate_crew_member') {
|
||||||
|
$team_repeater = array(
|
||||||
|
'pirate_crew_contact' => array(
|
||||||
|
'label' => 'pirate-crew-label',
|
||||||
|
'content' => 'pirate-crew-content'
|
||||||
|
),
|
||||||
|
'pirate_crew_social' => array(
|
||||||
|
'icon' => 'pirate-crew-icon',
|
||||||
|
'link' => 'pirate-crew-link'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$team_meta = array(
|
||||||
|
'pirate-crew-designation',
|
||||||
|
'pirate-crew-short-desc'
|
||||||
|
);
|
||||||
|
foreach ($team_repeater as $key => $value) {
|
||||||
|
$olddata = get_post_meta($post_id, $key, true);
|
||||||
|
$newdata = $item = array();
|
||||||
|
foreach ($value as $k => $v) {
|
||||||
|
$item[$k] = $_POST[$v];
|
||||||
|
}
|
||||||
|
$count = count(reset($item));
|
||||||
|
for ($i = 0; $i < $count; $i++) {
|
||||||
|
foreach ($value as $k => $v) {
|
||||||
|
if ($item[$k][$i] != '') {
|
||||||
|
$newdata[$i][$k] = stripslashes(strip_tags($item[$k][$i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!empty($newdata) && $newdata != $olddata) {
|
||||||
|
update_post_meta($post_id, $key, $newdata);
|
||||||
|
} elseif (empty($newdata) && $olddata) {
|
||||||
|
delete_post_meta($post_id, $key, $olddata);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} elseif ($post->post_type == 'pirate_crew') {
|
||||||
|
$team_meta = array('memberlist', 'team-style', 'preset', 'columns');
|
||||||
|
} elseif ($post->post_type == 'post') {
|
||||||
|
$team_meta = array('pirate_crew_member_id');
|
||||||
|
}
|
||||||
|
foreach ($team_meta as $meta_key) {
|
||||||
|
$olddata = get_post_meta($post_id, $meta_key, true);
|
||||||
|
$newdata = array();
|
||||||
|
if (isset($_POST[$meta_key])) {
|
||||||
|
if (is_array($_POST[$meta_key])) {
|
||||||
|
$newdata = $_POST[$meta_key];
|
||||||
|
} else {
|
||||||
|
$newdata = stripslashes(strip_tags($_POST[$meta_key]));
|
||||||
|
}
|
||||||
|
if (!empty($newdata) && $newdata != $olddata) {
|
||||||
|
update_post_meta($post_id, $meta_key, $newdata);
|
||||||
|
} elseif (empty($newdata) && $olddata) {
|
||||||
|
delete_post_meta($post_id, $meta_key, $olddata);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
delete_post_meta($post_id, $meta_key, $olddata);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Dropdown Builder
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public function selectbuilder($name, $options, $selected = "", $selecttext = "", $class = "", $optionvalue = 'value')
|
||||||
|
{
|
||||||
|
if (is_array($options)):
|
||||||
|
$select_html = "<select name=\"$name\" id=\"$name\" class=\"$class\">";
|
||||||
|
if ($selecttext) {
|
||||||
|
$select_html .= '<option value="">' . $selecttext . '</option>';
|
||||||
|
}
|
||||||
|
foreach ($options as $key => $option) {
|
||||||
|
if ($optionvalue == 'value') {
|
||||||
|
$value = $option;
|
||||||
|
} else {
|
||||||
|
$value = $key;
|
||||||
|
}
|
||||||
|
$select_html .= "<option value=\"$value\"";
|
||||||
|
if ($value == $selected) {
|
||||||
|
$select_html .= ' selected="selected"';
|
||||||
|
}
|
||||||
|
$select_html .= ">$option</option>\n";
|
||||||
|
}
|
||||||
|
$select_html .= '</select>';
|
||||||
|
echo $select_html;
|
||||||
|
else:
|
||||||
|
endif;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Get options
|
||||||
|
* @param String $postype Post type slug
|
||||||
|
* @param Int $post_id ID of post
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public function get_options($postype, $post_id){
|
||||||
|
$post = get_post($post_id);
|
||||||
|
|
||||||
|
if (!$post) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$metakeys['pirate_crew_member'] = array(
|
||||||
|
'pirate_crew_contact',
|
||||||
|
'pirate_crew_social',
|
||||||
|
'pirate-crew-designation',
|
||||||
|
'pirate-crew-short-desc'
|
||||||
|
);
|
||||||
|
$metakeys['pirate_crew'] = array(
|
||||||
|
'memberlist',
|
||||||
|
'team-style',
|
||||||
|
'preset',
|
||||||
|
'columns',
|
||||||
|
);
|
||||||
|
$options['pirate_crew_member'] = array(
|
||||||
|
'pirate_crew_contact' => array(),
|
||||||
|
'pirate_crew_social' => array(),
|
||||||
|
'pirate-crew-designation' => '',
|
||||||
|
'pirate-crew-short-desc' => ''
|
||||||
|
);
|
||||||
|
$options['pirate_crew'] = array(
|
||||||
|
'memberlist' => array(),
|
||||||
|
'team-style' => 'cards',
|
||||||
|
'preset' => '',
|
||||||
|
'columns' => '',
|
||||||
|
);
|
||||||
|
foreach ($metakeys[$postype] as $key => $value) {
|
||||||
|
$metavalue = get_post_meta($post_id, $value, true);
|
||||||
|
if ($metavalue) {
|
||||||
|
$options[$postype][$value] = $metavalue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $options[$postype];
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Get Thumbnail or default
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
public function pirate_team_get_thumbnail($team_id, $thumbnail = "pirate_crew") {
|
||||||
|
$defaultimage = $this->settings['plugin_url'] . 'images/default-member.jpg';
|
||||||
|
$member_image = get_post_thumbnail_id($team_id);
|
||||||
|
if ($member_image) {
|
||||||
|
$member_image_url = wp_get_attachment_image_src($member_image, $thumbnail, true);
|
||||||
|
$member_image_url = $member_image_url[0];
|
||||||
|
} else {
|
||||||
|
$member_image_url = $defaultimage;
|
||||||
|
}
|
||||||
|
return $member_image_url;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Item stle generator
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public function item_style($options, $custom = "") {
|
||||||
|
$style = array(
|
||||||
|
$options['team-style'] . '-style',
|
||||||
|
$options['preset'],
|
||||||
|
'grid-' . $options['columns'] . '-col',
|
||||||
|
$custom
|
||||||
|
);
|
||||||
|
return implode(' ', $style);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Class generator
|
||||||
|
* @param Array $class classnames
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public function addclass($class) {
|
||||||
|
return implode(' ', $class);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ID generator
|
||||||
|
* @param Array $id
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public function add_id($id) {
|
||||||
|
return implode('-', $id);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Print the meta data after checking it's existence
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public function checkprint($template, $value, $return = false) {
|
||||||
|
if ($value) {
|
||||||
|
if ($return) {
|
||||||
|
return sprintf($template, $value);
|
||||||
|
} else {
|
||||||
|
echo sprintf($template, $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endif;
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Sanitize class for shortcodes
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
function pirate_crew_sanitize_shortcodeclass( $pirate_crew_class ) {
|
||||||
|
if ( ! in_array( $pirate_crew_class, array( 'alignleft', 'alignright', 'aligncenter' ) ) ) {
|
||||||
|
$pirate_crew_class = 'alignleft';
|
||||||
|
}
|
||||||
|
return $pirate_crew_class;
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Sanitize format for shortcodes
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
function pirate_crew_sanitize_shortcodeformat( $pirate_crew_format ) {
|
||||||
|
if ( ! in_array( $pirate_crew_format, array( 'card', 'list') ) ) {
|
||||||
|
$pirate_crew_format = 'card';
|
||||||
|
}
|
||||||
|
return $pirate_crew_format;
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* Sanitize format for member shortcode, list style
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
function pirate_crew_sanitize_shortcodestyle( $pirate_crew_style ) {
|
||||||
|
if ( ! in_array( $pirate_crew_style, array( 'style1', 'style2', 'style3', 'style4') ) ) {
|
||||||
|
$pirate_crew_style = 'style1';
|
||||||
|
}
|
||||||
|
return $pirate_crew_style;
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
/* The end of this file as you know it
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
|
||||||
14
wp-content/plugins/Pirate-Crew/readme.txt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
=== Pirate Crew ===
|
||||||
|
Contributors: xwolf
|
||||||
|
Tags: team, crew, pirates
|
||||||
|
Requires at least: 4.5
|
||||||
|
Tested up to: 4.7
|
||||||
|
Stable tag: trunk
|
||||||
|
License: GPLv2 or later
|
||||||
|
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
|
||||||
|
== Summary ==
|
||||||
|
|
||||||
|
Simple member card plugin with pirate default images. Best in use with theme Pirate Rogue.
|
||||||
|
|
||||||
|
|
||||||
37
wp-content/plugins/Pirate-Crew/shortcodes/crew.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* crew Shortcode
|
||||||
|
*/
|
||||||
|
|
||||||
|
$out = '';
|
||||||
|
extract(shortcode_atts(array(
|
||||||
|
'id' => false
|
||||||
|
), $atts));
|
||||||
|
$options = $this->get_options('pirate_crew', $id);
|
||||||
|
if (!$options) {
|
||||||
|
$out = '<div class="pirate-crew-error">' . __('Crew not found', 'pirate-crew') . '</div>';
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
if (empty($options['memberlist'])) {
|
||||||
|
$out = '<div class="pirate-crew-error">' . __('No members found', 'pirate-crew') . '</div>';
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
$template = $this->settings['plugin_path'] . 'templates/' . $options['team-style'] . '.php';
|
||||||
|
|
||||||
|
if (file_exists($template)) {
|
||||||
|
|
||||||
|
$teamargs = array(
|
||||||
|
'orderby' => 'post__in',
|
||||||
|
'post_type' => 'pirate_crew_member',
|
||||||
|
'post__in' => $options['memberlist'],
|
||||||
|
'posts_per_page' => -1 ,
|
||||||
|
);
|
||||||
|
$team = new WP_Query($teamargs);
|
||||||
|
ob_start();
|
||||||
|
include $template;
|
||||||
|
$var = ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
// wp_reset_postdata();
|
||||||
|
$out = $var;
|
||||||
|
}
|
||||||
97
wp-content/plugins/Pirate-Crew/shortcodes/member.php
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Handling of [pirate] shortcode
|
||||||
|
*/
|
||||||
|
|
||||||
|
$out = '';
|
||||||
|
extract(shortcode_atts(array(
|
||||||
|
'id' => false,
|
||||||
|
'alignclass' => '',
|
||||||
|
'format' => 'card',
|
||||||
|
'style' => 'style1',
|
||||||
|
'showcontent' => 'true'
|
||||||
|
), $atts));
|
||||||
|
|
||||||
|
$id = intval($id);
|
||||||
|
$class = pirate_crew_sanitize_shortcodeclass($alignclass);
|
||||||
|
$format = pirate_crew_sanitize_shortcodeformat($format);
|
||||||
|
$style = pirate_crew_sanitize_shortcodestyle($style);
|
||||||
|
|
||||||
|
|
||||||
|
$post = get_post($id);
|
||||||
|
if ($post && $post->post_type == 'pirate_crew_member') {
|
||||||
|
|
||||||
|
$flip = false;
|
||||||
|
$flipclass = array("picrew-figcaption");
|
||||||
|
|
||||||
|
if ($format == 'list') {
|
||||||
|
$class = 'list';
|
||||||
|
}
|
||||||
|
$out .= '<div id="'.Pirate_Crew::add_id(array('pirate-crew',$id)).'" class="pirate-crew-single '.$class.'">';
|
||||||
|
$styleclass = '';
|
||||||
|
if ($format == 'list') {
|
||||||
|
if ($style == 'style2') {
|
||||||
|
$styleclass= 'style-2';
|
||||||
|
} else {
|
||||||
|
$styleclass= 'style-1';
|
||||||
|
}
|
||||||
|
$out .= '<div class="list-style '.$styleclass.' grid-2-col picrew-grid grid-full-col">';
|
||||||
|
} else {
|
||||||
|
if ($style == 'style4') {
|
||||||
|
$styleclass= 'style-4';
|
||||||
|
} elseif ($style == 'style3') {
|
||||||
|
$styleclass= 'style-3';
|
||||||
|
} elseif ($style == 'style2') {
|
||||||
|
$styleclass= 'style-2';
|
||||||
|
} else {
|
||||||
|
$styleclass= 'style-1';
|
||||||
|
}
|
||||||
|
$out .= '<div class="cards-style '.$styleclass.' picrew-grid grid-full-col">';
|
||||||
|
}
|
||||||
|
$teamdata = $this->get_options('pirate_crew_member', $post->ID);
|
||||||
|
$out .= '<div id="'.$this->add_id(array('pirate_crew_member',$id,$post->ID)).'" class="picrew-grid-card">';
|
||||||
|
$out .= '<figure>';
|
||||||
|
$out .= '<img src="'.$this->pirate_team_get_thumbnail($post->ID).'" alt="">';
|
||||||
|
$out .= '<figcaption class="'.$this->addclass($flipclass).'">';
|
||||||
|
$out .= '<div class="picrew-personal-info">';
|
||||||
|
$out .= '<h3>'.get_the_title($post->ID).'</h3>';
|
||||||
|
$out .= '<p>'.$teamdata['pirate-crew-designation'].'</p>';
|
||||||
|
$out .= '</div> <!-- .picrew-personal-info -->';
|
||||||
|
$out .= '<div class="picrew-contact-info">';
|
||||||
|
|
||||||
|
$out .= '<nav class="picrew-social-icons">';
|
||||||
|
foreach ($teamdata['pirate_crew_social'] as $social) {
|
||||||
|
if (isset($social['link'])) {
|
||||||
|
$out .= '<span><a href="' . esc_url($social['link']) . '"><i class="picrew-icon-' . $social['icon'] . '" aria-hidden="true"></i><span class="screen-reader-text">'. $social['icon'].'</span></a></span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$out .= '</nav>';
|
||||||
|
|
||||||
|
|
||||||
|
$out .= '</div> <!-- .picrew-contact-info -->';
|
||||||
|
$out .= '</figcaption>';
|
||||||
|
if (($format == 'list')&& ($showcontent == true)) {
|
||||||
|
if ($post->post_content) {
|
||||||
|
$content = apply_filters( 'the_content', $post->post_content );
|
||||||
|
$content = str_replace( ']]>', ']]>', $content );
|
||||||
|
$out .=$content;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$out .= '</figure></div>';
|
||||||
|
|
||||||
|
$out .= '</div>';
|
||||||
|
$out .= '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
wp_reset_postdata();
|
||||||
|
return $out;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$out = '<div class="pirate-crew-error">' . __('Pirate not found', 'pirate-crew') . '</div>';
|
||||||
|
}
|
||||||
39
wp-content/plugins/Pirate-Crew/templates/cards.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
$flip = false;
|
||||||
|
$flipclass = array("picrew-figcaption");
|
||||||
|
if(in_array($options['preset'], array('style-2'))){
|
||||||
|
$flip = true;
|
||||||
|
$flipclass = array("picrew-flip-back");
|
||||||
|
}?>
|
||||||
|
<div id="<?php echo $this->add_id(array('pirate-crew',$id));?>" class="picrew-grid-wrapper"><?php if ($team->have_posts()): ?>
|
||||||
|
<div class="picrew-grid <?php echo $this->item_style($options);?>">
|
||||||
|
<?php
|
||||||
|
while ($team->have_posts()): $team->the_post();
|
||||||
|
$teamdata = $this->get_options('pirate_crew_member', $team->post->ID);?>
|
||||||
|
<div id="<?php echo $this->add_id(array('pirate_crew_member',$id,$team->post->ID));?>" class="picrew-grid-card">
|
||||||
|
<figure>
|
||||||
|
<!-- <span class="picrew-grid-holder"> -->
|
||||||
|
<?php $this->checkprint('<div class="picrew-flip-front">',$flip);?>
|
||||||
|
<img src="<?php echo $this->pirate_team_get_thumbnail($team->post->ID);?>" alt="<?php the_title();?>">
|
||||||
|
<?php $this->checkprint('</div>',$flip);?>
|
||||||
|
<figcaption class="<?php echo $this->addclass($flipclass);?>">
|
||||||
|
<?php $this->checkprint('<div class="picrew-flip-back-inner">',$flip);?>
|
||||||
|
<div class="picrew-personal-info">
|
||||||
|
<h3><?php the_title();?></h3>
|
||||||
|
<span><?php echo $teamdata['pirate-crew-designation'];?></span>
|
||||||
|
</div> <!-- .picrew-personal-info -->
|
||||||
|
<div class="picrew-contact-info">
|
||||||
|
<?php
|
||||||
|
$this->checkprint('<p>%s</p>', $teamdata['pirate-crew-short-desc']);
|
||||||
|
include( $this->settings['plugin_path'].'templates/partials/social.php' );
|
||||||
|
?>
|
||||||
|
</div> <!-- .picrew-contact-info -->
|
||||||
|
<?php $this->checkprint('</div><!-- .picrew-flip-back-inner -->',$flip);?>
|
||||||
|
</figcaption>
|
||||||
|
<!-- </span> -->
|
||||||
|
<!-- .picrew-grid-holder -->
|
||||||
|
</figure>
|
||||||
|
</div>
|
||||||
|
<?php endwhile; wp_reset_postdata();?>
|
||||||
|
</div><!-- .grid -->
|
||||||
|
<?php endif;?></div>
|
||||||
29
wp-content/plugins/Pirate-Crew/templates/list.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<div id="<?php echo $this->add_id(array('pirate-crew',$id));?>" class="picrew-grid-wrapper">
|
||||||
|
<?php if ($team->have_posts()): ?>
|
||||||
|
<div class="picrew-grid <?php echo $this->item_style($options);?>">
|
||||||
|
<?php
|
||||||
|
while ($team->have_posts()): $team->the_post();
|
||||||
|
$teamdata = $this->get_options('pirate_crew_member', $team->post->ID);?>
|
||||||
|
<div id="<?php echo $this->add_id(array('pirate_crew_member',$id,$team->post->ID));?>" class="picrew-grid-card">
|
||||||
|
<figure>
|
||||||
|
<img src="<?php echo $this->pirate_team_get_thumbnail($team->post->ID);?>" alt="<?php the_title();?>">
|
||||||
|
<figcaption>
|
||||||
|
<div class="picrew-personal-info">
|
||||||
|
<h3><?php the_title();?></h3>
|
||||||
|
<?php $this->checkprint('<span>%s</span>', $teamdata['pirate-crew-designation']);?>
|
||||||
|
</div> <!-- .picrew-personal-info -->
|
||||||
|
<div class="picrew-contact-info">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include( $this->settings['plugin_path'].'templates/partials/social.php' );
|
||||||
|
|
||||||
|
the_content();
|
||||||
|
?>
|
||||||
|
</div> <!-- .picrew-contact-info -->
|
||||||
|
</figcaption>
|
||||||
|
</figure>
|
||||||
|
</div>
|
||||||
|
<?php endwhile; wp_reset_postdata();?>
|
||||||
|
</div><!-- .grid -->
|
||||||
|
<?php endif;?>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
if (!empty($teamdata['pirate_crew_contact'])) {
|
||||||
|
echo '<div class="picrew-contact-details">';
|
||||||
|
foreach ($teamdata['pirate_crew_contact'] as $contact) {
|
||||||
|
if(filter_var($contact['content'], FILTER_VALIDATE_EMAIL)){
|
||||||
|
$contact['content'] = sprintf('<a href="mailto:%1$s">%1$s</a>',$contact['content']);
|
||||||
|
}
|
||||||
|
echo '<p><span>'.$contact['label'].':</span>'.$contact['content'].'</p>';
|
||||||
|
}
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<div id="<?php echo $this->add_id(array('slide-ins',$id,$team->post->ID));?>" class="picrew-modal-item">
|
||||||
|
<div id="<?php echo $this->add_id(array('picrew-member-info',$id,$team->post->ID));?>" class="picrew-modal-content">
|
||||||
|
<div class="picrew-modal-content-main">
|
||||||
|
<div class="picrew-modal-image-main">
|
||||||
|
<img src="<?php echo $this->pirate_team_get_thumbnail($team->post->ID);?>" alt="<?php the_title();?>">
|
||||||
|
</div>
|
||||||
|
<!-- .image-main -->
|
||||||
|
<div class="picrew-modal-details">
|
||||||
|
<?php
|
||||||
|
$this->checkprint('<h3>%s</h3>', $teamdata['pirate-crew-designation']);
|
||||||
|
the_title( '<h2>', '</h2>');
|
||||||
|
the_content();
|
||||||
|
include( $this->settings['plugin_path'].'templates/partials/contact.php' );
|
||||||
|
include( $this->settings['plugin_path'].'templates/partials/social.php' );
|
||||||
|
?>
|
||||||
|
</div> <!-- .picrew-modal-details -->
|
||||||
|
</div> <!-- .picrew-modal-content-main -->
|
||||||
|
</div> <!-- .picrew-modal-content -->
|
||||||
|
</div> <!-- .picrew-modal-item -->
|
||||||
20
wp-content/plugins/Pirate-Crew/templates/partials/popup.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<div id="<?php echo $this->add_id(array('modal-style',$id,$team->post->ID));?>" class="picrew-modal-item">
|
||||||
|
<div id="<?php echo $this->add_id(array('picrew-member-info',$id,$team->post->ID));?>" class="picrew-modal-content">
|
||||||
|
<div class="picrew-modal-content-main">
|
||||||
|
<div class="picrew-image-main">
|
||||||
|
<img src="<?php echo $this->pirate_team_get_thumbnail($team->post->ID);?>" alt="<?php the_title();?>">
|
||||||
|
</div>
|
||||||
|
<div class="picrew-modal-details">
|
||||||
|
<div class="picrew-modal-content-inner">
|
||||||
|
<?php
|
||||||
|
$this->checkprint('<h3>%s</h3>', $teamdata['pirate-crew-designation']);
|
||||||
|
the_title( '<h2>', '</h2>');
|
||||||
|
the_content();
|
||||||
|
include( $this->settings['plugin_path'].'templates/partials/contact.php' );
|
||||||
|
include( $this->settings['plugin_path'].'templates/partials/social.php' );
|
||||||
|
?>
|
||||||
|
</div><!-- .picrew-modal-content-inner -->
|
||||||
|
</div> <!-- .picrew-modal-details -->
|
||||||
|
</div> <!-- .picrew-modal-content-main -->
|
||||||
|
</div> <!-- .picrew-modal-content -->
|
||||||
|
</div> <!-- .picrew-modal-item -->
|
||||||
11
wp-content/plugins/Pirate-Crew/templates/partials/social.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
if (!empty($teamdata['pirate_crew_social'])) {
|
||||||
|
echo '<nav class="picrew-social-icons">';
|
||||||
|
foreach ($teamdata['pirate_crew_social'] as $social) {
|
||||||
|
if (isset($social['link'])) {
|
||||||
|
echo '<span><a href="' . esc_url($social['link']) . '"><i class="picrew-icon-' . $social['icon'] . '" aria-hidden="true"></i><span class="screen-reader-text">'. $social['icon'].'</span></a></span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo '</nav>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
47
wp-content/plugins/Pirate-Crew/templates/table.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<div id="<?php echo $this->add_id(array('pirate-crew',$id));?>" class="picrew-grid-wrapper">
|
||||||
|
<?php if ($team->have_posts()): ?>
|
||||||
|
<div class="picrew-table <?php echo $this->item_style($options);?>">
|
||||||
|
<div class="picrew-table-row picrew-table-head">
|
||||||
|
<div class="picrew-table-cell">
|
||||||
|
<?php _e('Photo', 'pirate-crew'); ?>
|
||||||
|
</div><!-- .picrew-table-cell -->
|
||||||
|
<div class="picrew-table-cell">
|
||||||
|
<?php _e('Name', 'pirate-crew'); ?>
|
||||||
|
</div><!-- .picrew-table-cell -->
|
||||||
|
<div class="picrew-table-cell">
|
||||||
|
<?php _e('Position', 'pirate-crew'); ?>
|
||||||
|
</div><!-- .picrew-table-cell -->
|
||||||
|
<div class="picrew-table-cell">
|
||||||
|
<?php _e('Short Description', 'pirate-crew'); ?>
|
||||||
|
</div><!-- .picrew-table-cell -->
|
||||||
|
<div class="picrew-table-cell">
|
||||||
|
<?php _e('Social Links', 'pirate-crew'); ?>
|
||||||
|
</div><!-- .picrew-table-cell -->
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
while ($team->have_posts()): $team->the_post();
|
||||||
|
$teamdata = $this->get_options('pirate_crew_member', $team->post->ID);
|
||||||
|
?>
|
||||||
|
<div id="<?php echo $this->add_id(array('pirate_crew_member',$id,$team->post->ID));?>" class="picrew-table-row">
|
||||||
|
<div class="picrew-table-cell picrew-table-image">
|
||||||
|
<div class="picrew-table-img-holder">
|
||||||
|
<img src="<?php echo $this->pirate_team_get_thumbnail($team->post->ID);?>" alt="<?php the_title();?>">
|
||||||
|
</div><!-- .picrew-img-holder -->
|
||||||
|
</div><!-- .picrew-table-cell -->
|
||||||
|
<div class="picrew-table-cell picrew-table-name">
|
||||||
|
<div class="picrew-table-cell-inner"><?php the_title(); ?></div>
|
||||||
|
</div><!-- .picrew-table-cell -->
|
||||||
|
<div class="picrew-table-cell picrew-table-designation">
|
||||||
|
<div class="picrew-table-cell-inner"><?php $this->checkprint('%s', $teamdata['pirate-crew-designation']);?></div>
|
||||||
|
</div><!-- .picrew-table-cell -->
|
||||||
|
<div class="picrew-table-cell picrew-table-description">
|
||||||
|
<div class="picrew-table-cell-inner"><?php $this->checkprint('<p>%s</p>', $teamdata['pirate-crew-short-desc']);?></div>
|
||||||
|
</div><!-- .picrew-table-cell -->
|
||||||
|
<div class="picrew-table-cell">
|
||||||
|
<?php include( $this->settings['plugin_path'].'templates/partials/social.php' ); ?>
|
||||||
|
</div><!-- .picrew-table-cell -->
|
||||||
|
</div><!-- .picrew-table-row -->
|
||||||
|
<?php endwhile; wp_reset_postdata();?>
|
||||||
|
</div>
|
||||||
|
<?php endif;?>
|
||||||
|
</div>
|
||||||
955
wp-content/plugins/github-updater/CHANGES.md
Normal file
@@ -0,0 +1,955 @@
|
|||||||
|
#### [unreleased]
|
||||||
|
|
||||||
|
#### 8.8.1 / 2019-06-11
|
||||||
|
* set `homepage` to `PluginURI` or `ThemeURI`, fixes [#791](https://github.com/afragen/github-updater/issues/791)
|
||||||
|
* fixed Bitbucket release asset updates for proper containing folder structure, thanks @benoitchantre for the bug report
|
||||||
|
|
||||||
|
#### 8.8.0 / 2019-05-15
|
||||||
|
* switched from `pre_set_site_transient_update_{plugins|themes}` to `site_transient_update_{plugins|themes}`
|
||||||
|
* update `Remote_Management` to work with filter change
|
||||||
|
* update `CLI_Integration` to work with filter change
|
||||||
|
* use `GITHUB_UPDATER_DIR` constant for all enqueuing
|
||||||
|
|
||||||
|
#### 8.7.3 / 2019-04-08
|
||||||
|
* fixed PHP notices on Install [#775](https://github.com/afragen/github-updater/issues/775)
|
||||||
|
* updated location of `tmp-readme.txt` file to use `get_temp_dir()`, thanks @DavidAnderson684
|
||||||
|
* a11y updates for `label for=...`
|
||||||
|
* fixed to only set cron event for main site only when `DISABLE_WP_CRON` is set, fixes [#782](https://github.com/afragen/github-updater/issues/782)
|
||||||
|
* a11y updates for settings tabs
|
||||||
|
* remove filter for `http_request_args` after use, fixes [#783](https://github.com/afragen/github-updater/issues/783)
|
||||||
|
|
||||||
|
#### 8.7.2 / 2019-03-09
|
||||||
|
* hotfix to add parity for themes and prevent PHP warning
|
||||||
|
|
||||||
|
#### 8.7.1 / 2019-03-09
|
||||||
|
* add new filter hook `github_updater_post_construct_download_link` to allow for returning your own download link
|
||||||
|
* deprecate filter hook `github_updater_set_rollback_package` as the above replaces it
|
||||||
|
* add _looser_ check of `Base::get_repo_slugs()`, thanks @sc0ttkclark
|
||||||
|
* update `class Bitbucket_Server_API`, thanks @allrite for the access
|
||||||
|
* added filter hook `github_updater_repo_cache_timeout` to change default timeout per repository, thanks @sc0ttkclark
|
||||||
|
|
||||||
|
#### 8.7.0 / 2019-02-24
|
||||||
|
* update `Readme_Parser` for changelog and description parsing
|
||||||
|
* add filter `github_updater_temp_readme_filepath` to change default location if server has permissions issues, fixes [#766](https://github.com/afragen/github-updater/issues/766)
|
||||||
|
* fix `Readme_Parser` to use `version_compare()` when checking compatibility with `create_contributors()`
|
||||||
|
* add commit hash and timestamp to branch data, timestamp not returned by this particular GitHub API call 😞
|
||||||
|
* add filter `github_updater_remote_is_newer` to use your own version comparison function
|
||||||
|
|
||||||
|
#### 8.6.3 / 2019-02-04
|
||||||
|
* use Update PHP messaging as in WP 5.1 in version check
|
||||||
|
|
||||||
|
#### 8.6.2 / 2019-01-14
|
||||||
|
* fix for bug with Bitbucket endpoints, fixes [#757](https://github.com/afragen/github-updater/issues/757)
|
||||||
|
|
||||||
|
#### 8.6.1 / 2019-01-11
|
||||||
|
* remove `tmp-readme.txt` after parsing, fixes [#754](https://github.com/afragen/github-updater/issues/754)
|
||||||
|
* directly call `wp_cron()` after refreshing cache
|
||||||
|
* update POT via `composer.json` and wp-cli
|
||||||
|
* moved `get_file_headers()` to `trait GHU_Trait`
|
||||||
|
* cleanup extra header key/value pairs
|
||||||
|
* add endpoint to Bitbucket to get more than default number of tags, branches, or release assets. Fixes [#752](https://github.com/afragen/github-updater/issues/752) thanks @idpaterson
|
||||||
|
|
||||||
|
#### 8.6.0 / 2018-12-28 🎂
|
||||||
|
* add action hook `github_updater_post_rest_process_request` for @Raruto
|
||||||
|
* add filter hook `github_updater_set_rollback_package` for @sc0ttclark and @moderntribe
|
||||||
|
* return null for `API_Common::parse_release_asset()` when invalid `$response`, fixes [#750](https://github.com/afragen/github-updater/issues/750)
|
||||||
|
* make GitHub private repos with release assets use redirect for download link, fixes [#751](https://github.com/afragen/github-updater/issues/751)
|
||||||
|
|
||||||
|
#### 8.5.2 / 2018-12-10
|
||||||
|
* fixed parsing of wp.org readme changelog items
|
||||||
|
|
||||||
|
#### 8.5.1 / 2018-11-30
|
||||||
|
* refactor release asset API calls to `trait API_Common`
|
||||||
|
* updated GitLab API v4 endpoints, thanks for all the notice GitLab 😩
|
||||||
|
|
||||||
|
#### 8.5.0 / 2018-11-26
|
||||||
|
* silence rename PHP warning during plugin update
|
||||||
|
* specify branch for changelog
|
||||||
|
* refactored dot org override, constant deprecated in favor of new filter `github_updater_override_dot_org`
|
||||||
|
* now using vanilla JS for Install settings
|
||||||
|
* refactored GitHub release asset code to get direct download link
|
||||||
|
* refactored Bitbucket release asset code to get redirected download link for AWS
|
||||||
|
* refactored GitLab release asset code to get redirected download link
|
||||||
|
* exit early if checking _View details_ but not done with background update, avoids PHP notices
|
||||||
|
* updated to add/use composer dependencies and autoloader
|
||||||
|
|
||||||
|
#### 8.4.2 / 2018-11-01
|
||||||
|
* updated password fields to not autoload saved passwords, thanks @figureone
|
||||||
|
* fixed error when saving Remote Management options
|
||||||
|
|
||||||
|
#### 8.4.1 / 2018-10-24
|
||||||
|
* updated PAnD library with `forever` fix, this was my fault 💩
|
||||||
|
|
||||||
|
#### 8.4.0 / 2018-10-23
|
||||||
|
* use new constant for assets
|
||||||
|
* update error checking for `WP_Error` response from `wp_remote_get()`
|
||||||
|
* updated to use Bitbucket API 2.0 where appropriate
|
||||||
|
* refactor API calls with new `trait API_Common`
|
||||||
|
* attempted to update `class Bitbucket_Server_API`, please let me know if I made 💩
|
||||||
|
* refactor release asset and AWS download link code
|
||||||
|
* use action hook `requests-requests.before_redirect` to get AWS redirect URL
|
||||||
|
* fix for [creating proper GitHub Enterprise base URL](https://github.com/afragen/github-updater/pull/721), oops. Thanks @rlindner
|
||||||
|
* fixed [#714](https://github.com/afragen/github-updater/issues/714), get correct Bitbucket release asset download link from AWS
|
||||||
|
* update to `class-parser.php` r7679
|
||||||
|
* don't run on heartbeat API 💗
|
||||||
|
* only run on `admin-ajax.php` when possibly attempting sequential shiny updates, fixes [#723](https://github.com/afragen/github-updater/issues/723)
|
||||||
|
* update Persist Admin notices Dismissal library
|
||||||
|
|
||||||
|
#### 8.3.1 / 2018-09-13
|
||||||
|
* created `class Bootstrap` to setup plugin loading
|
||||||
|
* fixed issue with `load_plugin_textdomain()` not loading completely (now loading in `init` hook), thanks @pnoeric and @garrett-eclipse
|
||||||
|
|
||||||
|
#### 8.3.0 / 2018-09-12
|
||||||
|
* test to ensure `file_put_contents()` works
|
||||||
|
* overwrite `tmp-readme.txt` instead of delete
|
||||||
|
* delete `tmp-readme.txt` on uninstall
|
||||||
|
* switched check for user privileges to `update_{plugins|themes}` and `install_{plugins|themes}`
|
||||||
|
* refactored addition of Install tabs for specific privileges
|
||||||
|
* switch `repo -> slug` and `slug -> file` in plugin/theme objects for more consistency with WP core
|
||||||
|
* add `override` query arg for RESTful updates to specific tags
|
||||||
|
* refactor to remove redundancy between rollback and branch switch
|
||||||
|
* fixed incorrect update notification after update, fixes [#698](https://github.com/afragen/github-updater/issues/698)
|
||||||
|
* fixed to only load `Settings` on appropriate pages, fixes [#711](https://github.com/afragen/github-updater/issues/711)
|
||||||
|
* fixed issue where saving options during background updating could cause some checkbox options to be cleared, [5d68ea5](https://github.com/afragen/github-updater/commit/5d68ea54385a2fe62093e25ef42672bbfd504f89)
|
||||||
|
* updated error handling of Singleton factory
|
||||||
|
* added remote install from a zipfile, remote URL or local file
|
||||||
|
* added 'git' and directly declare 'type' in `class Plugin|Theme`
|
||||||
|
* started to add language pack support for Gitea
|
||||||
|
* use WPCS 1.1.0
|
||||||
|
|
||||||
|
#### 8.2.1 / 2018-07-22
|
||||||
|
* fixed setting of `Requires PHP` header in `API::set_readme_info()`
|
||||||
|
|
||||||
|
#### 8.2.0 / 2018-07-15
|
||||||
|
* fixed `register_activation_hook` to add the `develop` branch if that is the source
|
||||||
|
* refactored `class Readme_Parser` to use unmodified `vendor/class-parser.php`
|
||||||
|
* add `Requires PHP` info to _More Detail_ window
|
||||||
|
|
||||||
|
#### 8.1.2 / 2018-06-28
|
||||||
|
* fixed malformed link tag, thanks @alexclassroom
|
||||||
|
* updated POT
|
||||||
|
|
||||||
|
#### 8.1.1 / 2018-06-27
|
||||||
|
* updated GitLab CE/Enterprise to use GitLab API v4
|
||||||
|
* urlencode part of request to dot org API to avoid redirect
|
||||||
|
|
||||||
|
#### 8.1.0 / 2018-06-26
|
||||||
|
* added `register_activation_hook` to correctly rename directory to `github-updater` on activation; activation will fail if rename successful.
|
||||||
|
|
||||||
|
#### 8.0.0 / 2018-06-20
|
||||||
|
##### This update requires PHP 5.6 or greater
|
||||||
|
* added multiple action/filter hooks for adding data to Settings
|
||||||
|
* refactored `Settings` to add data via hooks
|
||||||
|
* refactored `class Basic_Auth_Loader` to `trait Basic_Auth_Loader`
|
||||||
|
* added `trait GHU_Trait` wih common code
|
||||||
|
* moved traits to own sub-directory
|
||||||
|
* removed old extended naming code
|
||||||
|
* refactored Remote Management to new `class Remote_Management`
|
||||||
|
* converted short array syntax
|
||||||
|
* removed callback passing of object by reference, it seems of dubious value
|
||||||
|
* use `ReflectionObject` in `GHU_Trait::get_class_vars()` to pass arbitrary class properties
|
||||||
|
* refactored WP-CLI integrations
|
||||||
|
* removed `class Additions`, now self-contained in [GitHub Updater Additions](https://github.com/afragen/github-updater-additions)
|
||||||
|
* refactored `Install::install()` a bit more
|
||||||
|
* use new `github_updater_admin_pages` filter hook for adding `index.php` from Remote Management
|
||||||
|
* ensure that all API install fields are available for all installed APIs
|
||||||
|
* updated `class-parser.php` the dot org readme parser
|
||||||
|
* updated POT with more translator messages
|
||||||
|
* fixed to only load install JS in admin pages
|
||||||
|
* updated `GitLab_API` for API v4
|
||||||
|
|
||||||
|
#### 7.6.2 / 2018-04-27
|
||||||
|
* move `auth_required` stuff from `Base` to `Settings`
|
||||||
|
* prevent admin notice from showing when no GitLab.com repo exists
|
||||||
|
* remove caching of `get_plugins()` and `wp_get_themes()` as it seems to result in issues for some users
|
||||||
|
|
||||||
|
#### 7.6.1 / 2018-04-11
|
||||||
|
* check `file_exists()` in `Base::set_installed_apis()` to avoid issue if class not yet loaded prior to checking Settings, fixes [#662](https://github.com/afragen/github-updater/issues/662) and [#667](https://github.com/afragen/github-updater/issues/667)
|
||||||
|
|
||||||
|
#### 7.6.0 / 2018-04-08
|
||||||
|
* added "safety orange" warning dashicon when waiting for WP-Cron to finish
|
||||||
|
* changed all password fields to use `type="password"`
|
||||||
|
* refactored setting of contributor data for [r42631](https://core.trac.wordpress.org/changeset/42631)
|
||||||
|
* moved GitLab specific admin notices to `GitLab_API`
|
||||||
|
* pass `$this` in `Singleton::get_instance()` instead of using `debug_backtrace()`
|
||||||
|
* refactor `Singleton` to automatically find namespaced class
|
||||||
|
* added some error handling to `Singleton`
|
||||||
|
* fixed error messaging
|
||||||
|
* added support for [Gitea](http://gitea.io/) thanks to [Marco Betschart](https://github.com/marbetschar)
|
||||||
|
* refactored code out of `class API` into specific API classes
|
||||||
|
* simplify RESTful update code, no longer parses webhook payload just webhook itself
|
||||||
|
* updated RESTful update code to use `site_transient_{$transient}` filter to add to update transient
|
||||||
|
* added error logging to RESTful update code as sometimes GitLab.com seems to timeout the response, thanks @Raruto
|
||||||
|
|
||||||
|
#### 7.5.0 / 2018-01-28
|
||||||
|
* fixed _View detail_ ratings for large projects with lots of issues
|
||||||
|
* fixed `API::set_readme_info()` to see passed parameter as readme data
|
||||||
|
* added title attribute to icons on Settings subtabs, thanks @petemolinero
|
||||||
|
* created new `class Init` to help unclutter `class Base`
|
||||||
|
* fixed PHP Warning if saving empty Remote Management Settings
|
||||||
|
* changed some variable and function names to be more descriptive
|
||||||
|
* moved Singleton Factory out of namespace
|
||||||
|
* moved capabilities check into `class Init`
|
||||||
|
* moved API classes to subdirectory
|
||||||
|
* moved WP-CLI classes to subdirectory
|
||||||
|
* refactored autoloader to grab all subdirectories
|
||||||
|
* fixed for new WP.org Plugin API response
|
||||||
|
* updated `vendor/class-parser.php` and `vendor/persist-admin-notices-dismissal`
|
||||||
|
* fixed `composer.json` for new license format
|
||||||
|
|
||||||
|
#### 7.4.4 / 2017-11-29
|
||||||
|
* fixed bug in remote install where Bitbucket credentials weren't transferred to Basic_Auth_Loader, [#630](https://github.com/afragen/github-updater/issues/630)
|
||||||
|
|
||||||
|
#### 7.4.3 / 2017-11-07
|
||||||
|
* set all extra header values in `Base::parse_extra_headers()`
|
||||||
|
* added more error messaging for `class WP_Error`
|
||||||
|
* fixed some issues with GitHub Release Assets
|
||||||
|
|
||||||
|
#### 7.4.2 / 2017-10-25
|
||||||
|
* added check to see if wp-cron is updating and if not send and error message
|
||||||
|
* fix for WP-CLI updating for private Bitbucket repos, thanks @v8-ict
|
||||||
|
|
||||||
|
#### 7.4.1 / 2017-10-22
|
||||||
|
* oops, during refactor of `Install` I copied the incorrect query for GitHub's remote install
|
||||||
|
|
||||||
|
#### 7.4.0 / 2017-10-21
|
||||||
|
* use wp-cron for background processing of `wp_remote_get()` calls for getting repo data 🚀
|
||||||
|
* fixed [#603](https://github.com/afragen/github-updater/issues/603) by not creating generic global variables accidentally
|
||||||
|
* fixed issue with remote install of private Bitbucket repos
|
||||||
|
* added plugin icons to `update-core.php` page for WP 4.9
|
||||||
|
* fixed stale AWS download link for GitHub release asset
|
||||||
|
* cache `get_plugins()` and `wp_get_themes()` for short period giving better performance to some admin pages, fixes [#612](https://github.com/afragen/github-updater/issues/612)
|
||||||
|
* refactor of methods from `class Base` to `class API`
|
||||||
|
* created `class API_PseudoTrait` to share methods of `class API`, workaround for OOP traits
|
||||||
|
* fixed removal of stale options
|
||||||
|
|
||||||
|
#### 7.3.1 / 2017-09-20
|
||||||
|
* removed parent constructor from `Branch`, thanks @fwolfst
|
||||||
|
|
||||||
|
#### 7.3.0 / 2017-09-15
|
||||||
|
* removed non-constructor stuff from all constructors
|
||||||
|
* added `parent::__construct()` to extended classes where needed
|
||||||
|
* fixed [#568](https://github.com/afragen/github-updater/issues/586), thanks @bradmkjr
|
||||||
|
* fixed multisite bug for theme update rows that I introduced in v7.0.0 :-(
|
||||||
|
* fixed PHP notice [#591](https://github.com/afragen/github-updater/issues/591)
|
||||||
|
* fixed bug with current branch data being deleted when saving settings with refactor of `Settings::filter_options()`
|
||||||
|
* fixed issues with _up to date_ notice during branch switch [#598](https://github.com/afragen/github-updater/issues/598)
|
||||||
|
|
||||||
|
#### 7.2.0 / 2017-08-30
|
||||||
|
* added a static proxy class to use for creating Singletons
|
||||||
|
* fixed Override Dot Org for themes
|
||||||
|
* fixed PHP Notice [#584](https://github.com/afragen/github-updater/issues/584)
|
||||||
|
* fixed bug introduced in readme.txt parsing [#589](https://github.com/afragen/github-updater/issues/589)
|
||||||
|
* fixed bug introduced in v7.0.0 with linter updates to properly display multisite theme updates in themes.php
|
||||||
|
* fixed branch setting bug [#592](https://github.com/afragen/github-updater/issues/592) by moving trigger from filter hook to direct call, thanks @rob and @idpaterson
|
||||||
|
|
||||||
|
#### 7.1.0 / 2017-08-10
|
||||||
|
* always show _Install_ button for single site theme when branch switch is active [#567](https://github.com/afragen/github-updater/issues/567)
|
||||||
|
* fixed override of dot org to correctly ignore dot org updates [#581](https://github.com/afragen/github-updater/issues/581)
|
||||||
|
* no more extended naming
|
||||||
|
* added constant for overriding dot org updates when plugins have identical slugs, `GITHUB_UPDATER_OVERRIDE_DOT_ORG` replacing the `GITHUB_UPDATER_EXTENDED_NAMING` constant
|
||||||
|
* added Overriding Dot Org functions for both plugins and themes
|
||||||
|
|
||||||
|
#### 7.0.0 / 2017-08-01
|
||||||
|
* added support for GitLab Groups [#556](https://github.com/afragen/github-updater/issues/556), thanks @rolandsaven
|
||||||
|
* refactored Settings and Install to place API Settings data in individual API classes
|
||||||
|
* refactored Settings to make smaller methods
|
||||||
|
* simplified `composer.json`, removed autoload section and no need to require `composer/installer`
|
||||||
|
* many PHP Inspections fixes
|
||||||
|
* fixed `class Rest_Update` for PHP 5.3 compatibility, thanks @epicfaace
|
||||||
|
* created `class Branch` to automatically set correct branch during branch switch or install. No more need for Branch header. This is a breaking change as `master` will become the default branch for all repositories. You will need to use _Branch Switch_ to reinstall the current branch for it to be correctly set.
|
||||||
|
|
||||||
|
#### 6.3.5 / 2017-06-29
|
||||||
|
* hotfix to `composer.json` to remove classmap and files, I think I messed something up.
|
||||||
|
|
||||||
|
#### 6.3.4 / 2017-05-28
|
||||||
|
* fixed [#547](https://github.com/afragen/github-updater/issues/547) for RESTful updating after breaking it again
|
||||||
|
* fixed PHP errors [#550](https://github.com/afragen/github-updater/issues/550)
|
||||||
|
|
||||||
|
#### 6.3.3 / 2017-05-16
|
||||||
|
* definitive fix for [#549](https://github.com/afragen/github-updater/issues/549)
|
||||||
|
* update to `class-parser.php@5483`
|
||||||
|
|
||||||
|
#### 6.3.2 / 2017-05-09
|
||||||
|
* added _broken_ setting to repo not returning HTTP 200 for the main file
|
||||||
|
* ~~fixed PHP error [#549](https://github.com/afragen/github-updater/issues/549)~~
|
||||||
|
* added div class to Settings page to create more specific CSS selectors
|
||||||
|
|
||||||
|
#### 6.3.1 / 2017-05-01
|
||||||
|
* simplify uninstall.php
|
||||||
|
* ensure Basic Auth headers are loaded for RESTful updating [#547](https://github.com/afragen/github-updater/issues/547)
|
||||||
|
|
||||||
|
#### 6.3.0 / 2017-04-26
|
||||||
|
* fixed to not run `load_pre_filters()` during WP-CLI, fixes [#528](https://github.com/afragen/github-updater/issues/528) thanks @egifford
|
||||||
|
* hopefully fixed annoying, intermittent PHP notices empty `parse_header_uri()` output
|
||||||
|
* added a singleton to `class Settings` to avoid duplicate loads [#531](https://github.com/afragen/github-updater/issues/531)
|
||||||
|
* refactored subtabs for Settings page
|
||||||
|
* refactored parsing of extra headers, `Enterprise` and `CE` headers no longer needed
|
||||||
|
* added support for Bitbucket Server!! Thanks @lkistenkas for access and especially to @BjornW for kicking it off
|
||||||
|
* refactored `add_endpoints()` to use everywhere
|
||||||
|
* now requires WordPress 4.4 and above
|
||||||
|
* update to latest wp.org `class-parser.php`
|
||||||
|
* move enqueuing of plugin CSS to `Base::init()`
|
||||||
|
* refactored Language Pack updating to their own classes
|
||||||
|
* split out abstract methods from `abstract class API` to `interface API_Interface`
|
||||||
|
* make Autoloader better functioning as a drop-in
|
||||||
|
* switched logic for plugin branch switching and setting the update transient
|
||||||
|
* refactor `add_access_token_endpoint()` to `class API`
|
||||||
|
* refactor Basic Authentication headers to `class Basic_Auth_Loader`
|
||||||
|
* moved checkboxes before titles in Settings
|
||||||
|
* updated wiki screenshots
|
||||||
|
* fixed to call `load_options()` in `Base::init()` to properly utilize options
|
||||||
|
* add red (#f00) warning dashicon in Settings for repo with malformed header URI
|
||||||
|
|
||||||
|
#### 6.2.2 / 2017-02-09
|
||||||
|
* fixed for updating via webhook from GitHub tagged release, declare branch as `master`
|
||||||
|
* refactored Install download link generation
|
||||||
|
* fixed PHP notices [#525](https://github.com/afragen/github-updater/issues/525)
|
||||||
|
* replaced method with `mb_strrpos()` in `class-parser.php` as some users don't have this function
|
||||||
|
* fixed JSON syntax error in GitHub webhook payload
|
||||||
|
* fixed GitLab Install tab to always show access token
|
||||||
|
* fixed GitLab Settings to show individual access tokens
|
||||||
|
|
||||||
|
#### 6.2.1 / 2017-02-02
|
||||||
|
* removed `wp_cache_flush()` for Install page, not needed with `Base::admin_pages_update_transients()`
|
||||||
|
* hotfix for upgrade routine to properly flush caches :P
|
||||||
|
|
||||||
|
#### 6.2.0 / 2017-02-02
|
||||||
|
* added WP-CLI compatibility
|
||||||
|
* refactored `Base::admin_pages_update_transient()` and `API::wp_update_response()` to use `Base::make_update_transient_current()`, this fixed some PHP notices [#508](https://github.com/afragen/github-updater/issues/508)
|
||||||
|
* added banner display to plugin `View details` iframe
|
||||||
|
* change `API::get_dot_org_data` to use JSON response to avoid PHP notices
|
||||||
|
* refactored `GitHub_API::get_repo_meta()` for simplification
|
||||||
|
* moved some repo renaming to their own methods from `Base::upgrader_source_selection()` to `Base::fix_misnamed_directory()`, `Base::extended_naming()`, and `Base::fix_gitlab_release_asset_directory()`
|
||||||
|
* moved a couple `class-parser.php` mods to separate functions in `class Readme_Parser`
|
||||||
|
* refactored `GitHub_API::get_repo_meta()` to use more efficient API call, gets forks also, thanks @egifford
|
||||||
|
* introduce some variability to transient expiration per plugin
|
||||||
|
* switch to storing repo data in options table instead of using transients, this should help with object caching which doesn't like transients
|
||||||
|
* fixed branch switching with extended naming [#520](https://github.com/afragen/github-updater/issues/520), thanks @joelworsham
|
||||||
|
* updated continuous integration via RESTful endpoints to also update based upon a new tag/release of the repo
|
||||||
|
|
||||||
|
#### 6.1.1 / 2016-11-29
|
||||||
|
* hotfix to flush cache during upgrade routine
|
||||||
|
|
||||||
|
#### 6.1.0 / 2016-11-28
|
||||||
|
* improved transient saving to save optimized version of transient rather that whole API response
|
||||||
|
* changed _Refresh Cache_ to POST to only run once.
|
||||||
|
* fixed `API::wp_update_response` to properly reset the update transient after a shiny update or cache flush
|
||||||
|
* added `Base::admin_pages_update_transient` to properly reset the update transient on plugins.php and themes.php pages
|
||||||
|
* fixed Bitbucket authentication during AJAX update
|
||||||
|
* changed to use dashicon to identify private repos in Settings
|
||||||
|
* fixed transient update when doing shiny updates
|
||||||
|
* added ability to update from GitHub release asset
|
||||||
|
* added our own PHP version check
|
||||||
|
* refactored setting of update transient during rollback, should eliminate the _up to date_ message and rollback failures
|
||||||
|
* added `class GHU_Upgrade` to run upgrade functions if needed
|
||||||
|
* fixed initial display of update for dot org plugins with higher version numbers on git repos when they should be updating from dot org [496](https://github.com/afragen/github-updater/issues/496)
|
||||||
|
* refactored query to wp.org for plugin data
|
||||||
|
* revert javascript href call because Firefox can't have nice things
|
||||||
|
* fixed to allow themes to rollback at any time
|
||||||
|
* renamed filter hook `github_updater_token_distribution` to `github_updater_set_options` as more descriptive
|
||||||
|
* added deprecated hook notice for `github_updater_token_distribution`
|
||||||
|
* fixed setting of GitLab meta
|
||||||
|
* changed to not skip setting meta when no update available
|
||||||
|
* fixed `uninstall.php` for option not transient
|
||||||
|
|
||||||
|
#### 6.0.0 / 2016-10-26
|
||||||
|
* added `class Language_Pack` and new repo, [Language Pack Maker](https://github.com/afragen/github-updater-language-pack-maker), to create and update from a separate Language Pack repository.
|
||||||
|
* added new header for Language Pack updates. Language Pack updates can and will now be decoupled from the plugin release.
|
||||||
|
* obfuscated token/password values in Settings page, for @scarstens
|
||||||
|
* added support for [GitLab Build Artifacts as Release Assets](https://gitlab.com/help/user/project/builds/artifacts.md), [#459](https://github.com/afragen/github-updater/issues/459)
|
||||||
|
* improved check for private repo, removes public repos from Settings page when no updates are available
|
||||||
|
* improved to provide Settings page with dynamically displayed sub-tabs
|
||||||
|
* added display of installed plugins/themes using GitHub Updater in Settings sub-tabs
|
||||||
|
* added ability to enter Bitbucket credentials to Install tabs if not already present
|
||||||
|
* moved action/filter hook calls out of constructors, make @carlalexander happy
|
||||||
|
* improved to incorporate GitLab personal access tokens, users will need to reset tokens.
|
||||||
|
* added a filter hook `'github_updater_run_at_scale'` to skip several API calls making GitHub Updater at scale more performant, see README for usage details
|
||||||
|
* added several hooks for [WP REST Cache](https://github.com/afragen/wordpress-rest-cache) and @scarstens
|
||||||
|
* skip API calls for branches and tags if branch switching not enabled
|
||||||
|
* refactored `delete_all_transients()` to delete from database, only called in `class Base`
|
||||||
|
* refactored and improved _branch switching_ to be consistent among plugins and themes. This means plugins now can rollback to one of the previous 3 tagged releases.
|
||||||
|
* fixed `get_repo_slugs()` for initially misnamed repository, ie `github-updater-develop`
|
||||||
|
* renamed `Refresh Transients` to `Refresh Cache`, hopefully to provide more clarity
|
||||||
|
* refactored to only load GHU site options and other database queries for privileged users on backend only
|
||||||
|
* added query arg of `?per_page=100` to GitLab query for project IDs, this is max number able to be retrieved, yes an edge case [#465](https://github.com/afragen/github-updater/issues/465)
|
||||||
|
|
||||||
|
#### 5.6.2 / 2016-09-24
|
||||||
|
* added reset of _update\_plugins_ and _update\_themes_ transient with _Refresh Transients_
|
||||||
|
* throw Exception for webhook update if PUSH is to branch different from webhook
|
||||||
|
* removed translations from RESTful endpoint responses, only visible from webhook or direct call
|
||||||
|
* fixed PHP fatal during heartbeat for `class PAnD` not found, early exit in class too early, [#453](https://github.com/afragen/github-updater/issues/453)
|
||||||
|
* fixed PHP notice in `Bitbucket_API`, [#451](https://github.com/afragen/github-updater/issues/451)
|
||||||
|
|
||||||
|
#### 5.6.1 / 2016-09-15
|
||||||
|
* fixed PHP notices when parsing `readme.txt` with missing data
|
||||||
|
* fixed PHP fatal by namespacing `class WordPressdotorg\Plugin_Directory\Readme\Parser`
|
||||||
|
* fixed PHP fatal in `WordPressdotorg\Plugin_Directory\Readme\Parser` by avoiding dereferenced array call
|
||||||
|
|
||||||
|
#### 5.6.0 / 2016-09-14
|
||||||
|
* added `Refresh Transients` button to Settings page because the `Check Again` button is going away
|
||||||
|
* added `redirect_on_save()` for Settings page
|
||||||
|
* switched to slightly modified version of [wp.org plugin readme parser](https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-parser.php), now accepts _Markdownified_ readme.txt files
|
||||||
|
* fixed re-activation of RESTful plugin update, multisite vs single site
|
||||||
|
* when creating Settings page, check current Plugin/Theme class instance, not transient. Fixes issue where remote install of private repo not having private settings saved.
|
||||||
|
* fixed PHP errors in Settings page
|
||||||
|
* fixed saving issues with checkboxes during remote install of private Bitbucket repo
|
||||||
|
* added one day dismissal of admin notices using [persist-admin-notices-dismissal library](https://github.com/collizo4sky/persist-admin-notices-dismissal)
|
||||||
|
* Settings page now uses same function to update settings for both single/multisite
|
||||||
|
* temporary fix for AJAX updates of private Bitbucket repos [#432](https://github.com/afragen/github-updater/issues/432), can only do one per page load, not very AJAXy :P
|
||||||
|
* fixed `class Rest_Update` to avoid potential race conditions when RESTful endpoint is used as a webhook
|
||||||
|
* added `branch` and `branches` to update transient, might be able to use this in RESTful update sometime
|
||||||
|
* fixed extended naming when installing forks of plugins and plugins
|
||||||
|
|
||||||
|
#### 5.5.0 / 2016-07-02
|
||||||
|
* better internationalization for changing plugin _View details_ link
|
||||||
|
* refactored and improved `class Additions` for `GitHub Updater Additions` plugin
|
||||||
|
* fixed using GitLab CE private token with using `class Install`
|
||||||
|
* reworked GitHub repo meta as search was occasionally flaky, now also using owner's repos check
|
||||||
|
* refactored adding extra headers
|
||||||
|
* added RESTful endpoints for updating from CLI or browser, courtesy of @limikael
|
||||||
|
* added reset of RESTful API key
|
||||||
|
* added CSS file to help display theme view details
|
||||||
|
* refactored `get_remote_{plugin|theme}_meta()` to `get_remote_repo_meta()` as it was in 4 different places :P
|
||||||
|
* updated for Shiny Updates
|
||||||
|
* fixed PHP fatal, thanks @charli-polo
|
||||||
|
* fixed displaying WP_Errors
|
||||||
|
* made error messages non-static
|
||||||
|
* fixed pesky PHP notice when updating from 5.4.1.3 [#403](https://github.com/afragen/github-updater/issues/403)
|
||||||
|
* added _aria-labels_ for screen readers
|
||||||
|
* always display theme rollback/branch switcher in single site installation [#411](https://github.com/afragen/github-updater/issues/411)
|
||||||
|
* fixed extended naming issue when branch switching, [#429](https://github.com/afragen/github-updater/issues/429)
|
||||||
|
|
||||||
|
#### 5.4.1 / 2016-04-21
|
||||||
|
* get tags for themes to rollback even if no updates are available. I was overzealous in cutting remote API calls.
|
||||||
|
* ManageWP now works for Remote Management.
|
||||||
|
* fixed bug in `GitLab_API` to use `path` and not `name`. Thanks @marbetschar
|
||||||
|
* added filter for background updates if set globally. Thanks @jancbeck
|
||||||
|
* fixed PHP notice when adding new Remote Management option
|
||||||
|
* deleted all transients on uninstall
|
||||||
|
* fixed logic for display of GitLab token fields and error notice
|
||||||
|
* displayed WP_Error message for `wp_remote_get()` error
|
||||||
|
* correctly get use GitLab namespace/project instead of project id when needed
|
||||||
|
* added `data-slug` to theme update rows so CSS may be applied
|
||||||
|
* now supports MainWP for remote management, thanks @ruben-
|
||||||
|
* typecast `readme.txt` response to array, fix for occasional malformed `readme.txt` file
|
||||||
|
|
||||||
|
#### 5.4.0 / 2016-3-18
|
||||||
|
* fixed deprecated PHP4 constructor in vendor class.
|
||||||
|
* added `class Additions` to process JSON config from hook to add repos to GitHub Updater, see [GitHub Updater Additions](https://github.com/afragen/github-updater-additions)
|
||||||
|
* added necessary code in `class Plugin` and `class Theme` for above
|
||||||
|
* skipped many remote API calls if no update available and use local files, huge performance boost :-)
|
||||||
|
* removed check for GitHub asset, this eliminates an API call for a rarely used feature
|
||||||
|
* added additional header `Release Asset: true` to add back ability to set download link to release asset.
|
||||||
|
* added function to remove _Basic Authentication_ header when downloading private Bitbucket release assets as they are stored on AmazonS3 and use [Query String Request Authentication Alternative](http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)
|
||||||
|
* consolidated error messages to show only once per error
|
||||||
|
* added _Other Notes_ section to View details
|
||||||
|
* updated readme.txt with _Other Notes_ information
|
||||||
|
|
||||||
|
#### 5.3.4 / 2016-01-24
|
||||||
|
* reset 'new_version' in update transient to avoid _up to date_ failure with branch switching.
|
||||||
|
* fixed display of branch switching themes on single install.
|
||||||
|
* fixed bug in getting Bitbucket branch names.
|
||||||
|
* fixed to hide checkbox when active as mu-plugin.
|
||||||
|
* work better with shiny updates.
|
||||||
|
|
||||||
|
#### 5.3.3 / 2016-01-04
|
||||||
|
* removed added filters, below as they didn't add functionality to this plugin.
|
||||||
|
* try to use references to `&$this`
|
||||||
|
* added PHPUnit testing setup, I could use help writing tests. A great way to contribute. :-)
|
||||||
|
|
||||||
|
#### 5.3.2 / 2015-12-21
|
||||||
|
* code simplification for `upgrader_source_selection`
|
||||||
|
* fixed plugin branch switching to override _up-to-date_ message (most of the time)
|
||||||
|
* added filters for developers, well I wanted them anyway ;-)
|
||||||
|
* `github_updater_plugin_transient_update`
|
||||||
|
* `github_updater_theme_transient_update`
|
||||||
|
* `github_updater_plugin_row_meta`
|
||||||
|
* `github_updater_theme_row_meta`
|
||||||
|
* `github_updater_append_theme_action`
|
||||||
|
* fixed renaming of updating plugins that were never initially renamed when first installed. Strange bug.
|
||||||
|
|
||||||
|
#### 5.3.1 / 2015-12-03
|
||||||
|
* fixed PHP notice during remote installation
|
||||||
|
* fixed remote install [#325](https://github.com/afragen/github-updater/issues/325)
|
||||||
|
|
||||||
|
#### 5.3.0 / 2015-11-25
|
||||||
|
* fixed parsing of `readme.txt` for donate link
|
||||||
|
* refactored transient storage resulting in significantly few database calls, more performant.
|
||||||
|
* moved `{get|set}_transient` functions to `abstract class API`
|
||||||
|
* fixed settings page saving errors.
|
||||||
|
* fixed shiny updates [#321](https://github.com/afragen/github-updater/issues/321)
|
||||||
|
* overhauled of renaming code back to using `upgrader_source_selection` and for WordPress 4.4 adding `$args['hook_extra']` to `upgrader_source_selection` filter. Thanks @dd32!
|
||||||
|
|
||||||
|
#### 5.2.0 / 2015-10-14
|
||||||
|
* fixed [#309](https://github.com/afragen/github-updater/issues/309) for proper GitHub Enterprise endpoints
|
||||||
|
* added setting for GitHub Enterprise personal access token
|
||||||
|
* new `function _add_access_token()` for `class GitHub_API`
|
||||||
|
* updatede `erusev/parsedown` to current release
|
||||||
|
|
||||||
|
#### 5.1.2 / 2015-09-25
|
||||||
|
* added `upgrader_source_selection` filter back for correct updating of current, active theme.
|
||||||
|
* fixed [#293](https://github.com/afragen/github-updater/issues/293) and [#297](https://github.com/afragen/github-updater/issues/297)
|
||||||
|
* removed `pre_http_request` filter blocking
|
||||||
|
* fixed javascript for theme rollback - @scarstens
|
||||||
|
* play nice with current master branch of wp-update-php
|
||||||
|
|
||||||
|
#### 5.1.1 / 2015-09-09
|
||||||
|
* hotfix to comment out `pre_http_request` filter. Updating of plugin doesn't work. I need to re-think this one.
|
||||||
|
|
||||||
|
#### 5.1.0 / 2015-09-09
|
||||||
|
* refactored Plugin and Theme constructors moving code calling APIs getting remote data to separate functions
|
||||||
|
* fixed [#281](https://github.com/afragen/github-updater/issues/281), removed 'Activate Plugin/Theme' buttons post-install
|
||||||
|
* fixed [#284](https://github.com/afragen/github-updater/issues/284) for GitLab CE/Enterprise install and update
|
||||||
|
* fixed to re-activate plugins after update, doesn't work with branch switching :person_frowning:
|
||||||
|
* fixed to correctly rename plugin/theme on update if installed from upload.
|
||||||
|
* added filter to `pre_http_response` to bypass certain plugins check using `wp_remote_get` with each page load in GitHub Updater. Bypass is only for 12 hours.
|
||||||
|
* cosmetic fix to display GitHub Updater as active when activated as mu-plugin
|
||||||
|
* fixed to `theme_api` 'View version details' CSS; better scrolling for changelog info
|
||||||
|
* fixed annoying PHP notice in `vendor/parse-readme.php` when _Upgrade Notice_ malformed
|
||||||
|
* fixed `API::return_repo_type` to add 'type' to array; allows easier instance creation of API classes
|
||||||
|
* updated POT file
|
||||||
|
|
||||||
|
#### 5.0.1 / 2015-08-18
|
||||||
|
* updated to current `erusev/parsedown` release, fixes PHP7 issue
|
||||||
|
* updated to current `WPupdatePHP/wp-update-php/release-1-1-0` branch
|
||||||
|
|
||||||
|
#### 5.0.0 / 2015-08-15
|
||||||
|
* fix rollback for GitLab themes
|
||||||
|
* add branch switcher for themes
|
||||||
|
* escape all printed strings
|
||||||
|
* changed from using `upgrader_source_selection` hook to `upgrader_post_install`, this greatly simplifies renaming
|
||||||
|
* removed `class Remote_Update` as it's no longer needed when using `upgrader_post_install` hook
|
||||||
|
* added **Remote Management** settings tab more cleanly support those services that currently integrate with GitHub Updater
|
||||||
|
* modified the process loading so faster for admin level users. Much thanks @khromov
|
||||||
|
* added hooks for devs to set GitHub Access Tokens and hide the Settings page. Please be sure your client will never need access to the Settings page. Thanks @oncecoupled
|
||||||
|
* fixed [#267](https://github.com/afragen/github-updater/issues/267) thanks @stevehenty and @rocketgenius
|
||||||
|
|
||||||
|
#### 4.6.2
|
||||||
|
* refactor remote update services to new `class Remote_Update`
|
||||||
|
* general security fixes, don't call files directly...
|
||||||
|
* fix/test for remote updating via InfiniteWP. Child themes are not identified by IWP as needing updates, otherwise it seems to work as expected.
|
||||||
|
|
||||||
|
#### 4.6.1
|
||||||
|
* fix for remote updating via iThemes Sync
|
||||||
|
* fix for renaming when AJAX updating of plugins
|
||||||
|
|
||||||
|
#### 4.6.0
|
||||||
|
* newer, much more precise method for renaming based upon selected repos from the dashboard. Yes, I tested on staging server. :-)
|
||||||
|
* added feature to use extended naming of plugin directories to avoid potential conflict with WP.org slugs. Props @reinink for the idea.
|
||||||
|
* strip `.git` from the end of the plugin or theme URI for those who haven't gotten to the README yet.
|
||||||
|
* added javascript show/hide options on the Install page.
|
||||||
|
* fixed boolean logic to _not_ display GitLab Private Token input on Install if it's already set.
|
||||||
|
* updated screenshots in README
|
||||||
|
* switched a number of methods to be non-static, anticipation of testing.
|
||||||
|
* [broken: renaming during updates from upgrade services](https://github.com/afragen/github-updater/issues/262)
|
||||||
|
|
||||||
|
#### 4.5.7
|
||||||
|
* hotfix GitLab private updating/installing
|
||||||
|
* fix some PHP notices
|
||||||
|
|
||||||
|
#### 4.5.6
|
||||||
|
* bugfix for renaming code to properly strip `<owner>-`
|
||||||
|
* most of Russian translation by [Anatoly Yumashev](https://github.com/yumashev)
|
||||||
|
|
||||||
|
#### 4.5.5
|
||||||
|
* back to simplifying the renaming code, always remember to test renaming on live server.
|
||||||
|
* strip `<owner>-` and `-<hash>` from beginning and end of update for more precise renaming
|
||||||
|
* I think this is the end of renaming for a while. :P
|
||||||
|
|
||||||
|
#### 4.5.4
|
||||||
|
* hotfix for renaming, I reverted back a bunch with more extensive testing on server. It's amazing how different renaming is locally vs on server.
|
||||||
|
|
||||||
|
#### 4.5.3
|
||||||
|
* updated language files -- oops
|
||||||
|
|
||||||
|
#### 4.5.2
|
||||||
|
* cleanup and refactor of renaming code.
|
||||||
|
* added Romanian translation by [Corneliu Cirlan](https://github.com/corneliucirlan)
|
||||||
|
* added Japanese translation by [ishihara](https://github.com/1shiharat)
|
||||||
|
|
||||||
|
#### 4.5.1
|
||||||
|
* fix bug so updates display without having to randomly refresh.
|
||||||
|
|
||||||
|
#### 4.5.0
|
||||||
|
* fix some PHP notices
|
||||||
|
* add update by GitHub release asset in lieu of update by tag when asset is present
|
||||||
|
* install asset via remote install if asset URI used
|
||||||
|
* refactor to simplify class structure, created `abstract class API` and `class Messages`
|
||||||
|
* add GitLab support!!
|
||||||
|
* refactor to set all git servers and extra headers to static arrays in `Base`
|
||||||
|
* remove checkbox when loaded as mu-plugin, props @pbearne
|
||||||
|
|
||||||
|
#### 4.4.0
|
||||||
|
* only add custom user agent once :P
|
||||||
|
* add support of GitHub Enterprise via new `GitHub Enterprise` header
|
||||||
|
* sanitize filter input
|
||||||
|
* add support for parsing `readme.txt` for _View details_ information using `WordPress_Plugin_Readme_Parser` by @markjaquith
|
||||||
|
* fixed _View details_ link to show for all cases when plugin using GitHub Updater
|
||||||
|
* refactor creation of header parts and URIs
|
||||||
|
|
||||||
|
#### 4.3.1
|
||||||
|
* Spanish translation by [Jose Miguel Bejarano](https://github.com/xDae)
|
||||||
|
* German translation by [Linus Metzler](https://github.com/limenet)
|
||||||
|
* squish PHP notices
|
||||||
|
* add custom user agent to `wp_remote_get` and tweak error message at request of GitHub ;-)
|
||||||
|
* fixed edge case renaming bug
|
||||||
|
|
||||||
|
#### 4.3.0
|
||||||
|
* use @WPUpdatePhp `class WPUpdatePhp` for PHP version checking
|
||||||
|
* use <https://api.wordpress.org> not http
|
||||||
|
* Arabic translation by [Hyyan Abo FAkher](https://github.com/hyyan)
|
||||||
|
* make strings better for translation - thanks @pedro-mendonca and @fxbenard
|
||||||
|
* additional Portuguese translation by [Pedro Mendonça](https://github.com/pedro-mendonca)
|
||||||
|
* refactor for getting local plugin and theme meta, now simpler for additional APIs (I'm thinking about you GitLab)
|
||||||
|
* fix link in README to GitHub Link
|
||||||
|
* correctly pass array as last argument in `add_settings_field`
|
||||||
|
* add focus to URI input field
|
||||||
|
* add Setting for personal GitHub Access Token to avoid API rate limit - thanks @mlteal
|
||||||
|
* add Setting for branch switching from the Plugins page
|
||||||
|
* add 'View details' link in Plugins page
|
||||||
|
|
||||||
|
#### 4.2.2
|
||||||
|
* fix POT and some updated languages, thanks @fxbenard
|
||||||
|
* fix PHP notice for `$options` settings on initial install - thanks @benosman
|
||||||
|
|
||||||
|
#### 4.2.1
|
||||||
|
* add PHP version check for graceful exit
|
||||||
|
* add to error message for 401 error.
|
||||||
|
* save settings when remote installing a private repo
|
||||||
|
|
||||||
|
#### 4.2.0
|
||||||
|
* added minutes until reset of GitHub API's rate limit to error message
|
||||||
|
* added `placeholder = "master"` to remote install branch text input
|
||||||
|
* I should have made the last version 4.2.0 as I added a new feature. I'll try to be better with semantic versioning in the future. ;-)
|
||||||
|
|
||||||
|
#### 4.1.4
|
||||||
|
* add message to certain admin pages when API returns HTTP error code
|
||||||
|
* update POT to remove HTML entity codes from strings and generally try to make i18n better
|
||||||
|
* Swedish translation by [Andréas Lundgren](https://github.com/Adevade)
|
||||||
|
* added logo to README and Settings page
|
||||||
|
|
||||||
|
#### 4.1.3
|
||||||
|
* use `strtolower` comparison of plugin directory and repo name. This might is an issue related to the manual installation of a plugin before any update might occur. This allows the **View details** screen to display in these instances where the case of the directory and repo aren't identical. This doesn't work for themes.
|
||||||
|
|
||||||
|
#### 4.1.2
|
||||||
|
* hide star ratings from **View details** screen for private repos
|
||||||
|
|
||||||
|
#### 4.1.1
|
||||||
|
* add `plugin` to `$response` in `Plugin::pre_set_site_transient_update_plugins` to fix PHP Notice
|
||||||
|
* rename `classes` to `src` to follow more conventional naming
|
||||||
|
* refactor renaming code to function under all circumstances, I hope ;-)
|
||||||
|
|
||||||
|
#### 4.1.0
|
||||||
|
* added remote installation of plugins or themes, both public and private
|
||||||
|
* remote installation using either full URI or short `<owner><repo>` format
|
||||||
|
* created new tabbed interface for settings
|
||||||
|
* added another screenshot to readme
|
||||||
|
* I'd like to apologize to all my translators for adding new strings often, you guys are great, thanks!
|
||||||
|
|
||||||
|
#### 4.0.1
|
||||||
|
* hotfix to force an array type when sanitizing settings, it gave me a fatal I wasn't expecting.
|
||||||
|
|
||||||
|
#### 4.0.0
|
||||||
|
* changed `is_a()` to `instanceof` per <https://core.trac.wordpress.org/changeset/31188>
|
||||||
|
* requires PHP 5.3 or greater as autoloader class requires namespacing
|
||||||
|
* updated all classes for namespacing
|
||||||
|
* renamed directory and class names to allow for PSR 4 style loading
|
||||||
|
* clean up a number of foreach loops where I was only using either key or value, not both
|
||||||
|
* Special thanks for all my translators, especially @grappler for adding translation key for description
|
||||||
|
* bugfix to correctly pick CHANGES.MD or CHANGELOG.MD regardless of case
|
||||||
|
* removed reading/saving `GitHub Access Token` header into settings. Must use Settings Page.
|
||||||
|
|
||||||
|
#### 3.2.3 - 3.2.6
|
||||||
|
* added French translation by @daniel-menard
|
||||||
|
* added Italian translation by @overclokk
|
||||||
|
* added Portuguese translation by @valeriosouza
|
||||||
|
* added Ukrainian translation by @andriiryzhkov (our first translation!!)
|
||||||
|
|
||||||
|
#### 3.2.2
|
||||||
|
* remove scraping of user/pass from Bitbucket URI as it's no longer needed
|
||||||
|
* use `Requires WP` header to fill view options detail
|
||||||
|
* rename private methods to begin with underscore
|
||||||
|
* add screenshot to README for Settings Page (only 70 kB)
|
||||||
|
* stop re-creating transient of transients if it already exists
|
||||||
|
|
||||||
|
#### 3.2.1
|
||||||
|
* refactored adding extra headers to `class GitHub_Updater` to ensure they're added before they're needed, resolves issue with WooThemes Updater plugin
|
||||||
|
* update .pot file
|
||||||
|
|
||||||
|
#### 3.2.0
|
||||||
|
* changed settings page and how Bitbucket Private repos authenticate with your username/password
|
||||||
|
* update .pot
|
||||||
|
|
||||||
|
#### 3.1.1
|
||||||
|
* minor transient cleanup
|
||||||
|
* update .pot file
|
||||||
|
* fix to get all themes under both single and multisite installs
|
||||||
|
|
||||||
|
#### 3.1.0
|
||||||
|
* woot!! - updating from Bitbucket private repos now works!!
|
||||||
|
* fix to only add HTTP Authentication header under correct circumstances. This obviates need to fix for other APIs that might also use HTTP Authentication.
|
||||||
|
* fix to correctly add GitHub Access Token from `$options` to `$download_link` - oops
|
||||||
|
* changes `$options` to `private static $options` to save a few database calls
|
||||||
|
* Settings page **only** shows private repos, except for initial setup
|
||||||
|
* simpler test for checking branch as download endpoint
|
||||||
|
* correctly use `parent::` instead of `self::`
|
||||||
|
* many updates for translation
|
||||||
|
* fix to ensure theme rollback and updating works in both single install and multisite
|
||||||
|
* fix to save settings from single site installations
|
||||||
|
|
||||||
|
#### 3.0.7
|
||||||
|
* more efficient solution to HTTP Authentication issues
|
||||||
|
* more efficient options cleanup
|
||||||
|
* remove some unnecessary code resulting in few database calls
|
||||||
|
* change default option setting to use `add_site_option` so not autoloading options
|
||||||
|
|
||||||
|
#### 3.0.6
|
||||||
|
* fix for other APIs that use HTTP Authentication, like JetPack - thanks @tsquez
|
||||||
|
|
||||||
|
#### 3.0.5
|
||||||
|
* fix more PHP Notices
|
||||||
|
* correctly set defaults for Settings page :P
|
||||||
|
* remove options for plugins/themes that are no longer present
|
||||||
|
|
||||||
|
#### 3.0.4
|
||||||
|
* Who would've thought `file_exists` was case-sensitive
|
||||||
|
* when checking meta, use `empty()` instead of `! isset()` for `null array`
|
||||||
|
* set defaults for Settings page
|
||||||
|
* fix a number of PHP Notices
|
||||||
|
|
||||||
|
#### 3.0.3
|
||||||
|
* Bugfix to properly authenticate on JetPack Stats page
|
||||||
|
|
||||||
|
#### 3.0.2
|
||||||
|
* simplify check and exit on Settings if no Bitbucket plugins/themes
|
||||||
|
|
||||||
|
#### 3.0.1
|
||||||
|
* Remove Bitbucket settings from page if no appropriate plugins or themes exist.
|
||||||
|
|
||||||
|
#### 3.0.0
|
||||||
|
* Settings Page for your GitHub Access Tokens
|
||||||
|
* added POT file and some more i18n fixes - thanks @grappler
|
||||||
|
* added `Requires WP` and `Requires PHP` headers to set minimum version requirements - for @GaryJ
|
||||||
|
* move update check to function to also check WP and PHP version requirements.
|
||||||
|
* unset any HTTP Authorization headers for GitHub API calls as this gives a 401 error. Rare potential bug if you have private Bitbucket repos.
|
||||||
|
|
||||||
|
#### 2.9.0
|
||||||
|
* move instantiation of `class GitHub_Plugin_Updater` and `class GitHub_Theme_Updater` into `GitHub_Updater::init()` and restrict to `current_user_can( 'update_plugins' )` and `current_user_can( 'update_themes' )` so that non-privileged users don't incur load time.
|
||||||
|
* now loading classes via `spl_autoload_register`
|
||||||
|
* switched to `erusev/parsedown` for rendering changelogs, faster and more light-weight.
|
||||||
|
* now parses remote file info to save only file headers to transient. Hopefully speeds up database retrieval of transient.
|
||||||
|
* added README link to GitHub Link plugin by @szepeviktor
|
||||||
|
* added mu-plugin option and instructions.
|
||||||
|
* above revisions mostly due to @szepeviktor prodding me. ;-)
|
||||||
|
* accept `CHANGES.md` or `CHANGELOG.md` for processing, for @GaryJ
|
||||||
|
* composer support added, thanks @hyyan
|
||||||
|
|
||||||
|
#### 2.8.1
|
||||||
|
* fix for WP Coding Guidelines
|
||||||
|
* added check for upgrade process instead of `$_GET['action']` (props @SLv99)
|
||||||
|
* launch classes from `GitHub_Updater::init()` so can load in `add_action( 'init', ...` from `__construct()`. Hopefully this will solve issues with remote upgraders like iThemes Sync, ManageWP, InfiniteWP, and MainWP. Thanks @jazzsequence for testing. Thanks @SLv99 for bringing this to my attention.
|
||||||
|
|
||||||
|
#### 2.8.0
|
||||||
|
* refactor API classes and `class GitHub_Updater` to add extra headers from API class. This should allow for better abstraction. Just need to call `GitHub_Updater_{repo}_API::add_headers()` in `class GitHub_Plugin_Updater` and `class GitHub_ Theme_Updater`.
|
||||||
|
* remove @since tags
|
||||||
|
* move `maybe_authenticate_http` to `class GitHub_Updater_Bitbucket_API` as it's not used elsewhere
|
||||||
|
* use non-strict check for http response code (thanks @echav)
|
||||||
|
|
||||||
|
#### 2.7.1
|
||||||
|
* added early exit if no local `CHANGES.md` file exists. This should save an API call.
|
||||||
|
* pull update from WP.org if plugin hosted in WP.org and branch is `master`.
|
||||||
|
|
||||||
|
#### 2.7.0
|
||||||
|
* created functions for getting and setting transients
|
||||||
|
* added deletion of all transients if _force-check_ is used
|
||||||
|
* removed `GitHub Timeout` and `Bitbucket Timeout` headers
|
||||||
|
* fix for `wp_remote_retrieve_response_code` check
|
||||||
|
* give Seth Carstens proper credit in README.md
|
||||||
|
* move `function make_rating` to `class GitHub_Updater`
|
||||||
|
* fix for plugin name in update detail view
|
||||||
|
* fix for Bitbucket repo with no branch tag
|
||||||
|
* set default timeout to 12 hours, same as WP.org
|
||||||
|
* fix for 3.9 setting theme update details to `display:none;`
|
||||||
|
* fix for error when installing themes from WP.org repo
|
||||||
|
* fix for incorrect plugin upgrade link in detail popup
|
||||||
|
|
||||||
|
#### 2.6.3
|
||||||
|
* quick error checking fix for `wp_remote_get` error to wordpress.org API - thanks @deckerweb
|
||||||
|
|
||||||
|
#### 2.6.1
|
||||||
|
* fixed CHANGES.md for GFM strike-through
|
||||||
|
|
||||||
|
#### 2.6.0
|
||||||
|
* added transient to `plugins_api` call
|
||||||
|
* better zeroing of variables in getting local theme data
|
||||||
|
* add error checking to loading of classes
|
||||||
|
* set default transient timeout to 4 hours
|
||||||
|
* added new header `GitHub Timeout` or `Bitbucket Timeout` to set individual plugin/theme transient timeout
|
||||||
|
* ~~fixed for Bitbucket private repos~~
|
||||||
|
* abide by WP Coding Guidelines, esp. for braces
|
||||||
|
* more error checking for correct variable fetch
|
||||||
|
* added graceful exit if repo does not exist
|
||||||
|
|
||||||
|
#### 2.5.0
|
||||||
|
* added `class GitHub_Updater_Bitbucket_API` for Bitbucket hosted plugins and themes.
|
||||||
|
* improvements to efficiency by not loading when `DOING_AJAX`
|
||||||
|
* improvements to efficiency in use of transients
|
||||||
|
|
||||||
|
#### 2.4.5
|
||||||
|
* set PHP MarkdownExtra posts and comments markup to false props @MikeHansonMe
|
||||||
|
* remove WP plugin header from `markdown.php`
|
||||||
|
|
||||||
|
#### 2.4.4
|
||||||
|
* forgot to include markdown.php - damn
|
||||||
|
|
||||||
|
#### 2.4.2
|
||||||
|
* removed PHP Markdown Lib as it required PHP >= 5.3 and that's higher than required by WordPress core.
|
||||||
|
|
||||||
|
#### 2.4.1
|
||||||
|
* switched from PHP Markdown Classic to the new PHP Markdown Lib to prevent collisions with other plugins, like Markdown On Save/Improved that also load PHP Markdown or PHP MarkdownExtra.
|
||||||
|
|
||||||
|
#### 2.4.0
|
||||||
|
* fixed transient assignment for tags returning empty array.
|
||||||
|
* added transient for `CHANGES.md` to themes, should further cut down on API 403 errors.
|
||||||
|
* new feature: theme rollback to previous version thanks @scarstens
|
||||||
|
* changed update methodology to use most recent tag first. If not tagged update from default branch.
|
||||||
|
|
||||||
|
#### 2.3.3
|
||||||
|
* fixed download link to have correct base URI for Repository Contents API. Oops.
|
||||||
|
|
||||||
|
#### 2.3.2
|
||||||
|
* rewrite of `GitHub_Update_GitHub_API::construct_download_link` to download zipball and provide appropriate endpoint.
|
||||||
|
|
||||||
|
#### 2.3.1
|
||||||
|
* now saving transient and adding early return if API returns 404, this should speed up plugin when repo doesn't have `CHANGES.md` file and provide for early return in no tags have been created. If no tags have been created the API is still hit.
|
||||||
|
|
||||||
|
#### 2.3.0
|
||||||
|
* moved action hook to remove `after_theme_row_$stylesheet` to `class GitHub_Theme_Updater`
|
||||||
|
* added feature: if branch other than `master` is specified then tagged version will be ignored. This should make it much easier for beta testing to groups. See [README.md](https://github.com/afragen/github-updater/blob/develop/README.md)
|
||||||
|
* converted `class GitHub_Update_GitHub_API` to extension of `class GitHub_Updater`
|
||||||
|
* combined `description` and `changelog` to show in theme detail view. Rough formatting. Multisite only.
|
||||||
|
* greatly simplified bug fix from 2.2.2, now using Themes API.
|
||||||
|
|
||||||
|
#### 2.2.2
|
||||||
|
* bug fix for removing update notice for WP.org repo themes. Oops.
|
||||||
|
|
||||||
|
#### 2.2.1
|
||||||
|
* minor code simplifications
|
||||||
|
* many thanks to @grappler for solving how to remove default `after_theme_row_$stylesheet`
|
||||||
|
|
||||||
|
#### 2.2.0
|
||||||
|
* moved check and load for `markdown.php` into only function that uses it.
|
||||||
|
* minor README updates
|
||||||
|
* added abort if this plugin called directly
|
||||||
|
* added additional data to update available screen in both plugins and themes - issue #8
|
||||||
|
* removed requirement for tags in theme updating
|
||||||
|
* removed extra line endings from `remote_version`
|
||||||
|
* added ratings function for creating star ratings based upon GitHub repo data.
|
||||||
|
* bring parts of `class GitHub_Theme_Updater` code on par with `class GitHub_Plugin_Updater`
|
||||||
|
* added 'ghu-' prefix to transients
|
||||||
|
* ripped out theme rollback code. Moved to it's own branch on GitHub.
|
||||||
|
* add custom `after_theme_update_{$stylesheet}` detail.
|
||||||
|
|
||||||
|
#### 2.1.1
|
||||||
|
* bug fix to return early from call to `plugins_api` if not getting plugin information. Fixes issue with Plugin Search.
|
||||||
|
|
||||||
|
#### 2.1.0
|
||||||
|
* simplify check for `class Markdown_Parser`
|
||||||
|
* refactor to pass `class GitHub_Update_GitHub_API` as class object. This should enable the creation of other class objects for Bitbucket, etc.
|
||||||
|
* fix for setting branch when API not responding
|
||||||
|
* fix for setting download link when API not responding
|
||||||
|
* redesigned filter for setting transient timeout, but still not working (pull requests welcome)
|
||||||
|
|
||||||
|
#### 2.0.1
|
||||||
|
* bug fix to not load `markdown.php` twice. Just in case it's loaded by some other plugin.
|
||||||
|
|
||||||
|
#### 2.0.0
|
||||||
|
* rearranged where I put `GitHub Plugin URI` header, etc. in README and in this plugin.
|
||||||
|
* minor spelling fixes
|
||||||
|
* renamed some functions for their hooks
|
||||||
|
* refactored `class GitHub_Plugin_Updater` and `class GitHub_Theme_Updater` to use stdClass objects
|
||||||
|
* further refactored base class `GitHub_Updater` to contain renaming code and create stdClass objects for data.
|
||||||
|
* added some ability to see changelog for GitHub hosted plugins.
|
||||||
|
* trying to follow [WordPress Plugin Boilerplate](https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate), so renamed `classes` to `includes`
|
||||||
|
* refactored putting all remote api calls in new `class GitHub_Plugin_Updater_API`.
|
||||||
|
* Theme updating should now be able to have a specified branch.
|
||||||
|
* works on WordPress 3.8
|
||||||
|
* included Michel Fortin's [PHP-Markdown](http://michelf.ca/projects/php-markdown/) for rendering `CHANGES.md`
|
||||||
|
|
||||||
|
#### 1.8.1
|
||||||
|
* added some variable declarations
|
||||||
|
* added early return in no GitHub sourced plugins or themes are identified
|
||||||
|
|
||||||
|
#### 1.8.0
|
||||||
|
* refactored to use base class `GitHub_Updater` and extending classes `GitHub_Plugin_Updater` and `GitHub_Theme_Updater`.
|
||||||
|
|
||||||
|
#### 1.7.4
|
||||||
|
* changed method of not overwriting extra headers to pass array.
|
||||||
|
|
||||||
|
#### 1.7.3
|
||||||
|
* change `'...'` to `…` in renaming notification
|
||||||
|
* fix to not overwrite extra headers of other plugins.
|
||||||
|
|
||||||
|
#### 1.7.2
|
||||||
|
* removed sorting option from `scandir`. Doesn't work with older versions of PHP < 5.4.0
|
||||||
|
* removed extraneous data from array in `multisite_get_themes`
|
||||||
|
|
||||||
|
#### 1.7.1
|
||||||
|
* updated the transient for themes
|
||||||
|
* replaced `readdir` with `scandir` for creating WP\_Theme object in multisite
|
||||||
|
|
||||||
|
#### 1.7.0
|
||||||
|
* updated class-theme-updater.php to utilize WP\_Theme class
|
||||||
|
* added method `get_remote_tag` to update plugins using tags or branch, depending upon which has greater version number.
|
||||||
|
* `get_remote_tag` uses transient to limit calls to API
|
||||||
|
* fix for `wp_get_themes` not working under plugin network activation on multisite installation. I recreated `wp_get_themes` by reading in the theme directory and adding the WP\_Theme object of `wp_get_theme( 'dir_in_themes_dir' )` to an array.
|
||||||
|
|
||||||
|
#### 1.6.1
|
||||||
|
* bug fix for undeclared variable $github_plugins
|
||||||
|
|
||||||
|
#### 1.6.0
|
||||||
|
* Added separate method to parse plugin repo info from header
|
||||||
|
* Shortened GitHub Plugin URI to only use owner/repo
|
||||||
|
* Shortened GitHub Theme URI to only use owner/repo
|
||||||
|
|
||||||
|
#### 1.5.0
|
||||||
|
* Lots of documentation and some bug fixes. Thanks @GaryJones
|
||||||
|
* Made version checking regex more compatible. Thanks @GaryJones
|
||||||
|
* Added ability to define branch to update.
|
||||||
|
* Refactored plugin/theme renaming code.
|
||||||
|
* Added `GitHub Branch` feature - Thanks @GaryJones
|
||||||
|
* Trying to comply with WP Coding Standards.
|
||||||
|
* Major thanks to @GaryJones for all the pull requests and generally improving this project.
|
||||||
|
|
||||||
|
#### 1.4.3
|
||||||
|
* Fixed a couple of non-fatal PHP errors. Thanks @jazzsequence
|
||||||
|
|
||||||
|
#### 1.4.2
|
||||||
|
* Cleaned up readme's markdown.
|
||||||
|
|
||||||
|
#### 1.4.1
|
||||||
|
* Fixed the README to more accurately reflect support for both plugins and themes.
|
||||||
|
|
||||||
|
#### 1.4
|
||||||
|
* Fix for rename functions to be more precise, otherwise might rename wp.org repo themes.
|
||||||
|
|
||||||
|
#### 1.3
|
||||||
|
* Simplify a couple of if statements.
|
||||||
|
|
||||||
|
#### 1.2
|
||||||
|
* Fix to ignore renaming for wp.org plugins
|
||||||
|
|
||||||
|
#### 1.1
|
||||||
|
* Sanity check for theme api uri
|
||||||
|
|
||||||
|
#### 1.0
|
||||||
|
* Serialized WP\_Theme object to search for added GitHub header, lots of help from Seth. No more `file_get_contents`.
|
||||||
|
* Converted plugin class and added it to make joint plugin/theme updater.
|
||||||
|
|
||||||
|
#### 0.2
|
||||||
|
* Code cleanup.
|
||||||
|
* Limit `file_get_contents` to 2000 bytes.
|
||||||
|
|
||||||
|
#### 0.1
|
||||||
|
* Initial commit
|
||||||
339
wp-content/plugins/github-updater/LICENSE
Normal file
@@ -0,0 +1,339 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Lesser General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
{description}
|
||||||
|
Copyright (C) {year} {fullname}
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
{signature of Ty Coon}, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License.
|
||||||
37
wp-content/plugins/github-updater/README.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|

|
||||||
|
|
||||||
|
# GitHub Updater
|
||||||
|
|
||||||
|
[](https://travis-ci.org/afragen/github-updater)
|
||||||
|
|
||||||
|
* Contributors: [Andy Fragen](https://github.com/afragen), [Gary Jones](https://github.com/GaryJones), [Seth Carstens](https://github.com/sethcarstens), [Mikael Lindqvist](https://github.com/limikael), [contributors](https://github.com/afragen/github-updater/graphs/contributors)
|
||||||
|
* Tags: plugin, theme, update, updater, github, bitbucket, gitlab, remote install
|
||||||
|
* Requires at least: 4.6
|
||||||
|
* Requires PHP: 5.6
|
||||||
|
* Tested up to: 5.2
|
||||||
|
* Stable tag: [master](https://github.com/afragen/github-updater/releases/latest)
|
||||||
|
* Donate link: <https://thefragens.com/github-updater-donate>
|
||||||
|
* License: GPLv2 or later
|
||||||
|
* License URI: <https://www.gnu.org/licenses/gpl-2.0.html>
|
||||||
|
|
||||||
|
A simple plugin to enable automatic updates to your GitHub, Bitbucket, GitLab, or Gitea hosted WordPress plugins, themes, and language packs. It also allows for the remote installation of plugins or themes.
|
||||||
|
|
||||||
|
[Comprehensive information regarding GitHub Updater is available on the wiki.](https://github.com/afragen/github-updater/wiki)
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
This plugin was designed to simply update any GitHub hosted WordPress plugin or theme. Your plugin or theme **must** contain a header in the style.css header or in the plugin's header denoting the location on GitHub. The format is as follows.
|
||||||
|
|
||||||
|
GitHub Plugin URI: afragen/github-updater
|
||||||
|
GitHub Plugin URI: https://github.com/afragen/github-updater
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
GitHub Theme URI: afragen/test-child
|
||||||
|
GitHub Theme URI: https://github.com/afragen/test-child
|
||||||
|
|
||||||
|
...where the above URI leads to the __owner/repository__ of your theme or plugin. The URI may be in the format `https://github.com/<owner>/<repo>` or the short format `<owner>/<repo>`. You do not need both. Only one Plugin or Theme URI is required. You **should not** include any extensions like `.git`.
|
||||||
|
|
||||||
|
## Slack
|
||||||
|
|
||||||
|
We now have a [Slack team for GitHub Updater](https://github-updater.slack.com). Please [click here for an invite](https://github-updater.herokuapp.com). You will be automatically added to the _#general_ and _#random_ channels. Please take a look at other channels too.
|
||||||
|
After Width: | Height: | Size: 5.1 KiB |
104
wp-content/plugins/github-updater/assets/icon.svg
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
width="400px" height="216.183px" viewBox="0 0 400 216.183" enable-background="new 0 0 400 216.183" xml:space="preserve">
|
||||||
|
<g>
|
||||||
|
<path fill="#404041" d="M253.896,110.86c-1.805,0-3.192,0.646-4.159,1.934c-0.968,1.354-1.452,3.192-1.452,5.513
|
||||||
|
c0,2.709,0.45,4.677,1.355,5.901c0.967,1.353,2.321,2.031,4.062,2.031c1.804,0,3.191-0.678,4.159-2.031
|
||||||
|
c0.967-1.354,1.451-3.321,1.451-5.901c0-2.321-0.484-4.125-1.451-5.416C256.894,111.537,255.571,110.86,253.896,110.86z"/>
|
||||||
|
<path fill="#404041" d="M267.262,105.819h-0.174c-3.745-17.112-18.978-29.925-37.212-29.925c-6.703,0-12.998,1.738-18.471,4.778
|
||||||
|
c-7.376-16.449-23.882-27.914-43.078-27.914c-26.067,0-47.199,21.132-47.199,47.2c0,2.158,0.158,4.277,0.439,6.359
|
||||||
|
c-14.792,2.573-26.048,15.442-26.048,30.969c0,17.378,14.089,31.467,31.468,31.467h140.274c17.379,0,31.468-14.089,31.468-31.467
|
||||||
|
C298.73,119.907,284.641,105.819,267.262,105.819z M212.889,131.366h-6.964v-14.799H192.19v14.799h-6.868v-29.792
|
||||||
|
c0-0.967,0.339-1.789,1.016-2.466c0.678-0.677,1.5-1.016,2.467-1.016h3.385v12.381h13.735V98.092h6.964V131.366z M238.664,120.726
|
||||||
|
c0,4.58-1.193,7.579-3.579,8.996c-2.385,1.419-4.998,2.127-7.834,2.127c-2.773-0.13-5.305-0.902-7.593-2.321
|
||||||
|
c-2.289-1.418-3.433-4.353-3.433-8.802v-15.089h6.771v16.443c0,1.547,0.451,2.676,1.354,3.385c0.903,0.71,1.935,1.064,3.096,1.064
|
||||||
|
c1.16,0,2.208-0.354,3.143-1.064c0.935-0.709,1.403-1.838,1.403-3.385v-13.154c0-0.902,0.306-1.675,0.919-2.322
|
||||||
|
c0.612-0.644,1.402-0.967,2.37-0.967h3.385V120.726z M263.085,128.367c-0.969,1.225-2.273,2.112-3.918,2.66
|
||||||
|
c-1.644,0.547-3.273,0.822-4.884,0.822c-3.095,0-5.965-0.806-8.608-2.418c-2.646-1.61-3.965-4.706-3.965-9.285V97.996h3.288
|
||||||
|
c0.902,0,1.676,0.323,2.321,0.966c0.644,0.646,0.967,1.42,0.967,2.322v7.738c0.71-1.225,1.741-2.225,3.095-2.999
|
||||||
|
c1.161-0.644,2.579-0.967,4.256-0.967c3.03,0,5.514,1.258,7.449,3.772c1.934,2.515,2.901,5.772,2.901,9.769
|
||||||
|
C265.986,122.597,265.019,125.853,263.085,128.367z"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="168.4292" y1="11.2617" x2="168.4292" y2="76.2716">
|
||||||
|
<stop offset="0" style="stop-color:#FFFFFF"/>
|
||||||
|
<stop offset="1" style="stop-color:#404041"/>
|
||||||
|
</linearGradient>
|
||||||
|
<path fill="url(#SVGID_1_)" d="M185.322,131.366v-29.792c0-0.967,0.339-1.789,1.016-2.466c0.678-0.677,1.5-1.016,2.467-1.016h3.385
|
||||||
|
v12.381h13.735V98.092h2.061c-0.667-21.27-18.109-38.311-39.541-38.311c-21.856,0-39.573,17.717-39.573,39.572
|
||||||
|
c0,21.856,17.717,39.573,39.573,39.573c8.692,0,16.724-2.81,23.253-7.561H185.322z"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<g>
|
||||||
|
<path fill="#00ADEE" d="M132.122,138.934v13.648c0,1.692,0.317,2.941,0.952,3.744c0.676,0.762,1.755,1.143,3.237,1.143
|
||||||
|
c1.438,0,2.517-0.381,3.237-1.143c0.676-0.761,1.016-2.009,1.016-3.744v-13.648h4.507v14.156c0,2.708-0.761,4.761-2.286,6.157
|
||||||
|
c-1.396,1.396-3.554,2.095-6.475,2.095c-2.92,0-5.078-0.698-6.475-2.095c-1.522-1.396-2.285-3.449-2.285-6.157v-11.743
|
||||||
|
c0-0.634,0.223-1.195,0.667-1.682c0.444-0.486,0.983-0.73,1.618-0.73H132.122z"/>
|
||||||
|
<path fill="#00ADEE" d="M153.004,153.027v7.807h-4.508v-19.55c0-0.636,0.223-1.175,0.667-1.619s0.983-0.667,1.618-0.667h7.427
|
||||||
|
c2.326,0,4.063,0.593,5.205,1.777c1.185,1.186,1.777,2.941,1.777,5.268c0,2.201-0.572,3.936-1.715,5.205
|
||||||
|
c-1.142,1.186-2.792,1.778-4.951,1.778H153.004z M153.004,149.091h4.379c1.185,0,2.031-0.254,2.539-0.762
|
||||||
|
c0.55-0.465,0.825-1.27,0.825-2.413c0-0.972-0.253-1.755-0.761-2.348c-0.593-0.508-1.375-0.762-2.35-0.762h-4.632V149.091z"/>
|
||||||
|
<path fill="#00ADEE" d="M168.616,160.833v-19.55c0-0.636,0.223-1.175,0.666-1.619c0.445-0.444,0.985-0.667,1.62-0.667h6.284
|
||||||
|
c3.342,0,5.84,0.888,7.491,2.666c1.65,1.863,2.475,4.613,2.475,8.252c0,1.947-0.297,3.704-0.889,5.269
|
||||||
|
c-0.678,1.608-1.566,2.835-2.666,3.682c-0.932,0.72-1.926,1.227-2.983,1.522c-1.015,0.297-2.562,0.444-4.634,0.444H168.616z
|
||||||
|
M172.996,156.898h3.618c2.073,0,3.596-0.55,4.57-1.65c0.93-1.016,1.397-2.793,1.397-5.332c0-2.454-0.445-4.253-1.333-5.396
|
||||||
|
c-0.847-1.143-2.201-1.714-4.063-1.714h-4.189V156.898z"/>
|
||||||
|
<path fill="#00ADEE" d="M198.735,138.998h3.554l7.934,21.835h-4.761l-1.46-4.507h-8.505l-1.396,4.507h-4.761l7.236-20.376
|
||||||
|
C196.957,139.485,197.676,138.998,198.735,138.998z M199.75,143.378l-3.047,9.268h6.094L199.75,143.378z"/>
|
||||||
|
<path fill="#00ADEE" d="M215.114,160.833V142.87h-6.475v-1.586c0-0.636,0.223-1.175,0.667-1.619
|
||||||
|
c0.443-0.444,0.983-0.667,1.618-0.667h15.108v3.872h-6.412v17.963H215.114z"/>
|
||||||
|
<path fill="#00ADEE" d="M229.457,160.833v-19.55c0-0.636,0.223-1.175,0.667-1.619c0.444-0.444,0.983-0.667,1.618-0.667h13.584
|
||||||
|
v3.745H233.9v4.698h8.506v1.459c0,0.635-0.222,1.174-0.667,1.618s-0.984,0.667-1.619,0.667H233.9v5.586h11.426v4.062H229.457z"/>
|
||||||
|
<path fill="#00ADEE" d="M248.688,160.833v-19.55c0-0.636,0.221-1.175,0.666-1.619c0.444-0.444,0.984-0.667,1.618-0.667h8.316
|
||||||
|
c2.369,0,4.125,0.508,5.269,1.523c1.185,1.059,1.777,2.603,1.777,4.634c0,1.354-0.297,2.476-0.889,3.364
|
||||||
|
c-0.507,0.847-1.313,1.46-2.412,1.841c0.973,0.339,1.651,0.847,2.031,1.523c0.381,0.635,0.613,1.715,0.699,3.238l0.126,2.602
|
||||||
|
c0,0.255,0,0.53,0,0.826c0,0.296,0.021,0.571,0.063,0.825c0.127,0.762,0.381,1.248,0.761,1.459h-4.951
|
||||||
|
c-0.212-0.422-0.339-0.866-0.38-1.333c-0.085-0.676-0.127-1.143-0.127-1.397l-0.063-2.348c-0.085-1.27-0.339-2.179-0.762-2.729
|
||||||
|
c-0.466-0.465-1.292-0.699-2.475-0.699h-4.762v8.505H248.688z M253.194,148.52h5.27c1.142,0,1.988-0.232,2.539-0.698
|
||||||
|
c0.549-0.465,0.825-1.184,0.825-2.158c0-0.973-0.276-1.692-0.825-2.158c-0.508-0.508-1.27-0.762-2.285-0.762h-5.523V148.52z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<polygon fill="#404041" points="134.398,40.817 87.007,33.233 111.77,82.911 "/>
|
||||||
|
<polygon fill="#00ADEE" points="301.31,176.497 348.698,168.913 309.67,129.443 "/>
|
||||||
|
<g>
|
||||||
|
<path fill="#00ADEE" d="M332.068,92.996l0.006-0.008l-0.063-0.047C332.03,92.961,332.05,92.974,332.068,92.996z"/>
|
||||||
|
<path fill="#00ADEE" d="M332.312,99.009c-2.77,1.517-11.495,6.36-13.612,7.38c-0.051,0.024-0.115,0.056-0.174,0.084
|
||||||
|
c0.236,0.655,0.462,1.314,0.678,1.977c3.588-2.059,10.438-5.729,13.964-7.608C332.893,100.225,332.603,99.617,332.312,99.009z"/>
|
||||||
|
<path fill="#00ADEE" d="M314.425,100.514c2.067-1.095,5.574-1.957,3.729-4.525c-1.844-2.568-10.977-13.342-4.684-16.092
|
||||||
|
c1.87-0.818,3.987-1.053,6.79,4.533c2.803,5.585,2.618,11.382,6.53,9.46c0,0,2.485-2.402,4.414-1.561l-4.753-3.592
|
||||||
|
c-14.429-21.39-38.886-35.457-66.628-35.457c-16.68,0-32.166,5.091-45.004,13.795c7.24-4.283,17.161-6.695,35.835-6.828
|
||||||
|
c27.066-0.194,50.629,14.233,62.891,35.5l0.188,5.62C313.832,101.012,314.046,100.715,314.425,100.514z"/>
|
||||||
|
<path fill="#00ADEE" d="M337.378,112.709l0.607-8.118c-0.196,1.356-1.632,5.063-4.022,6.401c-2.99,1.673-7.785,5.321-9.217,11.509
|
||||||
|
c0,0-1.926-3.424-3.959-6.898c-0.958-1.637-1.937-3.339-2.625-4.511c0.916,2.553,2.459,5.992,3.677,8.597
|
||||||
|
c0.447,3.111,0.696,6.282,0.696,9.507c0,8.016-1.432,15.71-4.054,22.868c6.993,2.817,12.126,9.077,13.791,16.239
|
||||||
|
c5.042-10.505,7.866-22.275,7.866-34.706C340.138,126.369,339.168,119.371,337.378,112.709z"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<path fill="#404041" d="M96.988,167.266c-13.307-11.602-21.249-26.871-23.447-42.349c1.677-1.957,3.508-5.005,3.439-8.974
|
||||||
|
l-0.077,0.1c-0.408,1.489-1.028,3.142-1.964,4.411c-1.925,2.609-6.098,6.582-7.158,7.578l-0.099,3.961
|
||||||
|
c-0.045,1.839-1.573,3.293-3.412,3.248c-1.839-0.046-3.293-1.574-3.247-3.413l0.095-3.797c-1.417-1.159-8.518-7.12-9.32-10.885
|
||||||
|
c-0.005-0.025-0.008-0.045-0.013-0.07c0.268,3.582,2.039,6.338,3.609,8.096c2.388,13.672,8.844,26.773,19.406,37.331
|
||||||
|
c14.356,14.352,33.406,21.145,52.208,20.391C116.388,180.341,106.019,175.139,96.988,167.266z"/>
|
||||||
|
<path fill="#404041" d="M56.564,112.344c-0.026-2.129-0.056-6.601-0.056-6.601c0.042-1.68,1.284-3.012,2.775-2.975
|
||||||
|
c1.491,0.036,2.667,1.429,2.625,3.11c0,0-0.208,4.312-0.325,6.451l4.409-0.013c-0.026-2.153-0.055-6.531-0.055-6.531
|
||||||
|
c0.042-1.68,1.284-3.013,2.775-2.976s2.666,1.429,2.625,3.11c0,0-0.204,4.219-0.321,6.382l2.013-0.006
|
||||||
|
c0.762-12.1,5.17-23.745,13.446-33.238c8.729-10.012,20.415-16.098,33.05-18.226c-3.097-4.467-4.336-10.209-2.891-15.747
|
||||||
|
c0.132-0.506,0.29-1,0.461-1.485c-15.453,1.568-30.481,8.268-42.317,20.109c-13.445,13.451-20.255,31.018-20.441,48.642
|
||||||
|
L56.564,112.344z"/>
|
||||||
|
</g>
|
||||||
|
<path fill="#00ADEE" d="M152.781,127.4c-1.161,1.677-2.548,2.902-4.16,3.676c-1.677,0.708-3.515,1.063-5.514,1.063
|
||||||
|
c-4.771,0-8.544-1.579-11.317-4.739c-2.837-3.095-4.255-7.351-4.255-12.768c0-5.352,1.386-9.576,4.16-12.671
|
||||||
|
c2.902-3.223,6.737-4.836,11.51-4.836c4.125,0,7.544,1,10.253,2.999c2.643,2.127,4.223,4.901,4.739,8.318h-4.643
|
||||||
|
c-1.354,0-2.354-0.612-2.998-1.838c-0.453-0.773-1.098-1.482-1.935-2.128c-1.291-0.901-2.999-1.354-5.126-1.354
|
||||||
|
c-2.773,0-4.966,1-6.577,2.999c-1.612,2.128-2.418,4.966-2.418,8.512c0,3.612,0.837,6.448,2.515,8.512
|
||||||
|
c1.611,1.999,3.9,2.998,6.868,2.998c2.191,0,3.997-0.612,5.417-1.838c1.417-1.29,2.321-3.062,2.707-5.32h-4.061
|
||||||
|
c-0.968,0-1.789-0.338-2.467-1.016c-0.677-0.677-1.015-1.499-1.015-2.466v-2.225h13.832v18.088h-1.838
|
||||||
|
c-1.806,0-2.935-0.903-3.386-2.708L152.781,127.4z"/>
|
||||||
|
<path fill="#00ADEE" d="M162.307,98.092h3.481c0.903,0,1.676,0.324,2.323,0.968c0.643,0.645,0.967,1.419,0.967,2.321v2.031h-6.771
|
||||||
|
V98.092z M162.307,105.637h3.481c0.903,0,1.676,0.324,2.323,0.967c0.643,0.646,0.967,1.419,0.967,2.322v22.44h-6.771V105.637z"/>
|
||||||
|
<path fill="#00ADEE" d="M182.761,131.366c-2.128,0.128-4.434,0.097-6.916-0.097c-2.483-0.193-3.723-1.773-3.723-4.74V98.092h3.481
|
||||||
|
c0.837,0,1.579,0.324,2.225,0.968c0.644,0.645,0.968,1.419,0.968,2.321v4.353h3.965v1.354c0,0.967-0.323,1.758-0.967,2.37
|
||||||
|
c-0.645,0.613-1.418,0.919-2.321,0.919h-0.677v14.314c0,1.098,0.644,1.645,1.935,1.645h2.03V131.366z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 9.5 KiB |
48
wp-content/plugins/github-updater/composer.json
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"name": "afragen/github-updater",
|
||||||
|
"description": "A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs. It also allows for remote installation of plugins or themes into WordPress.",
|
||||||
|
"type": "wordpress-plugin",
|
||||||
|
"keywords": [
|
||||||
|
"wordpress",
|
||||||
|
"plugin",
|
||||||
|
"theme",
|
||||||
|
"updater",
|
||||||
|
"install"
|
||||||
|
],
|
||||||
|
"license": "GPL-2.0-or-later",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Andy Fragen",
|
||||||
|
"email": "andy@thefragens.com",
|
||||||
|
"homepage": "https://thefragens.com",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repositories": [
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://github.com/afragen/github-updater"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/afragen/github-updater/issues",
|
||||||
|
"source": "https://github.com/afragen/github-updater"
|
||||||
|
},
|
||||||
|
"prefer-stable": true,
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.6",
|
||||||
|
"afragen/wordpress-plugin-readme-parser": "dev-master",
|
||||||
|
"afragen/singleton": "dev-master",
|
||||||
|
"collizo4sky/persist-admin-notices-dismissal": "^1"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Fragen\\GitHub_Updater\\": "src/GitHub_Updater/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"post-update-cmd": [
|
||||||
|
"wp i18n make-pot . languages/github-updater.pot"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
36
wp-content/plugins/github-updater/css/github-updater.css
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
div.install-theme-info {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remove star rating for themes. */
|
||||||
|
#theme-installer div.install-theme-info div.star-rating {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Position Settings input */
|
||||||
|
input.ghu-callback-text {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.bitbucket_setting {
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Position Save and Refresh buttons */
|
||||||
|
.github-updater-settings form.settings p.submit {
|
||||||
|
float: left;
|
||||||
|
clear: right;
|
||||||
|
width: 40%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.github-updater-settings form.settings.no-sub-tabs p.submit {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.hide-github-updater-settings {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.github-updater-settings .form-table th[scope='row']:empty {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
53
wp-content/plugins/github-updater/github-updater.php
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin Name: GitHub Updater
|
||||||
|
* Plugin URI: https://github.com/afragen/github-updater
|
||||||
|
* Description: A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs. It also allows for remote installation of plugins or themes into WordPress.
|
||||||
|
* Version: 8.8.1
|
||||||
|
* Author: Andy Fragen
|
||||||
|
* License: GNU General Public License v2
|
||||||
|
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
* Domain Path: /languages
|
||||||
|
* Text Domain: github-updater
|
||||||
|
* Network: true
|
||||||
|
* GitHub Plugin URI: https://github.com/afragen/github-updater
|
||||||
|
* GitHub Languages: https://github.com/afragen/github-updater-translations
|
||||||
|
* Requires WP: 4.6
|
||||||
|
* Requires PHP: 5.6
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
* PHP version check and exit.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( version_compare( phpversion(), '5.6', '<=' ) ) {
|
||||||
|
echo '<div class="error notice is-dismissible"><p>';
|
||||||
|
printf(
|
||||||
|
/* translators: 1: minimum PHP version required, 2: Upgrade PHP URL */
|
||||||
|
wp_kses_post( __( 'GitHub Updater cannot run on PHP versions older than %1$s. <a href="%2$s">Learn about updating your PHP.</a>', 'github-updater' ) ),
|
||||||
|
'5.6',
|
||||||
|
esc_url( __( 'https://wordpress.org/support/update-php/' ) )
|
||||||
|
);
|
||||||
|
echo '</p></div>';
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup plugin loading.
|
||||||
|
require_once __DIR__ . '/src/GitHub_Updater/Bootstrap.php';
|
||||||
|
( new Bootstrap( __FILE__ ) )->run();
|
||||||
89
wp-content/plugins/github-updater/js/ghu-install-vanilla.js
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
/**
|
||||||
|
* Vanilla Javascript to show and hide the API specific settings
|
||||||
|
* for the remote install feature.
|
||||||
|
*
|
||||||
|
* @class Fragen\GitHub_Updater\Install
|
||||||
|
* @since 8.5.0
|
||||||
|
* @access public
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
|
||||||
|
// Hide non-default (Bitbucket & GitLab) settings on page load.
|
||||||
|
let nonDefault = ['bitbucket', 'gitlab', 'gitea', 'zipfile'];
|
||||||
|
|
||||||
|
nonDefault.forEach(function (item) {
|
||||||
|
let parents = getParents(item, 'tr');
|
||||||
|
displayNone(parents);
|
||||||
|
});
|
||||||
|
|
||||||
|
// When the api selector changes.
|
||||||
|
let selects = document.querySelector('select[ name="github_updater_api" ]');
|
||||||
|
|
||||||
|
// Only run when on proper tab.
|
||||||
|
if (selects !== null) {
|
||||||
|
selects.addEventListener('change', function () {
|
||||||
|
let defaults = ['github', 'bitbucket', 'gitlab', 'gitea', 'zipfile'];
|
||||||
|
|
||||||
|
// Create difference array.
|
||||||
|
let hideMe = remove(defaults, this.value);
|
||||||
|
|
||||||
|
// Hide items with unselected api's classes.
|
||||||
|
hideMe.forEach(function (item) {
|
||||||
|
let parents = getParents(item, 'tr');
|
||||||
|
displayNone(parents);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Show selected setting.
|
||||||
|
[this.value].forEach(function (item) {
|
||||||
|
let parents = getParents(item, 'tr');
|
||||||
|
display(parents);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove selected element from array and return array.
|
||||||
|
function remove(array, element) {
|
||||||
|
const index = array.indexOf(element);
|
||||||
|
if (index !== -1) {
|
||||||
|
array.splice(index, 1);
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide element.
|
||||||
|
function displayNone(array) {
|
||||||
|
array.forEach((item) => {
|
||||||
|
item.style.display = 'none';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display element.
|
||||||
|
function display(array) {
|
||||||
|
array.forEach((item) => {
|
||||||
|
item.style.display = '';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return query and selector for `$(query).parents.(selector)`.
|
||||||
|
function getParents(item, selector) {
|
||||||
|
return vanillaParents(document.querySelectorAll('input.'.concat(item, '_setting')), selector);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Vanilla JS version of jQuery `$(query).parents(selector)`.
|
||||||
|
function vanillaParents(element, selector) {
|
||||||
|
let parents = [];
|
||||||
|
if (NodeList.prototype.isPrototypeOf(element)) {
|
||||||
|
element.forEach((item) => {
|
||||||
|
element = item.parentElement.closest(selector);
|
||||||
|
parents.push(element);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
element = item.parentElement.closest(selector);
|
||||||
|
parents.push(element);
|
||||||
|
}
|
||||||
|
return parents;
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
||||||
40
wp-content/plugins/github-updater/js/ghu-install.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* Javascript to show and hide the API specific settings
|
||||||
|
* for the remote install feature.
|
||||||
|
*
|
||||||
|
* @class Fragen\GitHub_Updater\Install
|
||||||
|
* @since 4.6.0
|
||||||
|
* @access public
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
jQuery(document).ready(
|
||||||
|
function ($) {
|
||||||
|
// Hide non-default (Bitbucket & GitLab) settings on page load.
|
||||||
|
$.each(['bitbucket', 'gitlab', 'gitea', 'zipfile'],
|
||||||
|
function () {
|
||||||
|
$('input.'.concat(this, '_setting')).parents('tr').hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
// When the api selector changes.
|
||||||
|
$('select[ name="github_updater_api" ]').on('change',
|
||||||
|
function () {
|
||||||
|
|
||||||
|
// create difference array.
|
||||||
|
var hideMe = $(['github', 'bitbucket', 'gitlab', 'gitea', 'zipfile']).not([this.value]).get();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Show/hide all settings that have the selected api's class.
|
||||||
|
* this.value equals either 'github', 'bitbucket', or 'gitlab'.
|
||||||
|
*/
|
||||||
|
$.each(
|
||||||
|
hideMe,
|
||||||
|
function () {
|
||||||
|
$('input.'.concat(this, '_setting')).parents('tr').hide();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$('input.'.concat(this.value, '_setting')).parents('tr').show();
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
446
wp-content/plugins/github-updater/languages/github-updater.pot
Normal file
@@ -0,0 +1,446 @@
|
|||||||
|
# Copyright (C) 2019 Andy Fragen
|
||||||
|
# This file is distributed under the same license as the GitHub Updater plugin.
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: GitHub Updater 8.8.1\n"
|
||||||
|
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/github-updater\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"POT-Creation-Date: 2019-06-12T00:38:56+00:00\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"X-Generator: WP-CLI 2.2.0\n"
|
||||||
|
"X-Domain: github-updater\n"
|
||||||
|
|
||||||
|
#. Plugin Name of the plugin
|
||||||
|
#: src/GitHub_Updater/Settings.php:133
|
||||||
|
#: src/GitHub_Updater/Settings.php:172
|
||||||
|
#: src/GitHub_Updater/Settings.php:223
|
||||||
|
msgid "GitHub Updater"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. Plugin URI of the plugin
|
||||||
|
msgid "https://github.com/afragen/github-updater"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. Description of the plugin
|
||||||
|
msgid "A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs. It also allows for remote installation of plugins or themes into WordPress."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. Author of the plugin
|
||||||
|
msgid "Andy Fragen"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: mu/ghu-loader.php:65
|
||||||
|
msgid "Activated as mu-plugin"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. translators: 1: minimum PHP version required, 2: Upgrade PHP URL
|
||||||
|
#: github-updater.php:42
|
||||||
|
msgid "GitHub Updater cannot run on PHP versions older than %1$s. <a href=\"%2$s\">Learn about updating your PHP.</a>"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:104
|
||||||
|
#: src/GitHub_Updater/Install.php:366
|
||||||
|
msgid "Install Plugin"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:107
|
||||||
|
#: src/GitHub_Updater/Install.php:369
|
||||||
|
msgid "Install Theme"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:160
|
||||||
|
msgid "A repository URI is required."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:386
|
||||||
|
msgid "Plugin"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:389
|
||||||
|
msgid "Theme"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. translators: variable is 'Plugin' or 'Theme'
|
||||||
|
#: src/GitHub_Updater/Install.php:401
|
||||||
|
msgid "GitHub Updater Install %s"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. translators: variable is 'Plugin' or 'Theme'
|
||||||
|
#: src/GitHub_Updater/Install.php:409
|
||||||
|
msgid "%s URI"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:417
|
||||||
|
msgid "Repository Branch"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:425
|
||||||
|
msgid "Remote Repository Host"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:461
|
||||||
|
msgid "URI is case sensitive."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:476
|
||||||
|
msgid "Enter branch name or leave empty for `master`"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:541
|
||||||
|
msgid "Activate"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Install.php:553
|
||||||
|
msgctxt "This refers to a network activation in a multisite installation"
|
||||||
|
msgid "Network Enable"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:114
|
||||||
|
#: src/GitHub_Updater/Settings.php:719
|
||||||
|
msgid "Settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:171
|
||||||
|
#: src/GitHub_Updater/Settings.php:310
|
||||||
|
msgid "GitHub Updater Settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:245
|
||||||
|
msgid "Refresh Cache"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:277
|
||||||
|
msgid "Settings saved."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:279
|
||||||
|
msgid "RESTful key reset."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:281
|
||||||
|
msgid "Cache refreshed."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:323
|
||||||
|
msgid "Enable Branch Switching"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:526
|
||||||
|
msgid "Check to enable branch switching from the Plugins or Themes page."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:550
|
||||||
|
msgid "Overridden Plugins and Themes"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:551
|
||||||
|
msgid "The following plugins or themes might exist on wp.org, but any updates will be downloaded from their respective git repositories."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:753
|
||||||
|
msgid "This is a private repository."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:754
|
||||||
|
msgid "This repository has not connected to the API or was unable to connect."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:755
|
||||||
|
msgid "This repository is hosted on WordPress.org."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Settings.php:792
|
||||||
|
msgid "Installed Plugins and Themes"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Plugin.php:324
|
||||||
|
msgid "View details"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. translators: %s: theme name
|
||||||
|
#: src/GitHub_Updater/Theme.php:333
|
||||||
|
#: src/GitHub_Updater/Theme.php:529
|
||||||
|
msgid "There is a new version of %s available."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. translators: %s: theme version
|
||||||
|
#: src/GitHub_Updater/Theme.php:345
|
||||||
|
msgid "View version %s details."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Theme.php:349
|
||||||
|
msgid "Automatic update is unavailable for this theme."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. translators: 1: version number, 2: closing anchor tag, 3: update URL
|
||||||
|
#: src/GitHub_Updater/Theme.php:354
|
||||||
|
#: src/GitHub_Updater/Theme.php:539
|
||||||
|
msgid "View version %1$s details%2$s or %3$supdate now%2$s."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. translators: %s: theme name
|
||||||
|
#: src/GitHub_Updater/Theme.php:359
|
||||||
|
#: src/GitHub_Updater/Theme.php:544
|
||||||
|
msgid "Update %s now"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. translators: 1: branch name, 2: jQuery dropdown, 3: closing tag
|
||||||
|
#: src/GitHub_Updater/Theme.php:581
|
||||||
|
#: src/GitHub_Updater/Base.php:828
|
||||||
|
msgid "Current branch is `%1$s`, try %2$sanother version%3$s"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Theme.php:589
|
||||||
|
msgid "Choose a Version"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Theme.php:607
|
||||||
|
#: src/GitHub_Updater/Base.php:863
|
||||||
|
msgid "No previous tags to rollback to."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Theme.php:611
|
||||||
|
msgid "Install"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Base.php:446
|
||||||
|
msgid "There may be a problem with WP-Cron. A GitHub Updater WP-Cron event is overdue."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Base.php:839
|
||||||
|
msgid "Switch to branch "
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Base.php:855
|
||||||
|
msgid "Switch to release "
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Remote_Management.php:138
|
||||||
|
#: src/GitHub_Updater/Remote_Management.php:195
|
||||||
|
msgid "Remote Management"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Remote_Management.php:177
|
||||||
|
msgid "Reset RESTful key"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. translators: %s: Link to wiki
|
||||||
|
#: src/GitHub_Updater/Remote_Management.php:235
|
||||||
|
msgid "Please refer to the <a href=\"%s\">wiki</a> for complete list of attributes. RESTful endpoints begin at:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Remote_Management.php:243
|
||||||
|
msgid "Use of Remote Management services may result increase some page load speeds only for `admin` level users in the dashboard."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:386
|
||||||
|
msgid "Bitbucket Private Settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:393
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:481
|
||||||
|
msgid "Bitbucket Username"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:402
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:489
|
||||||
|
msgid "Bitbucket Password"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:418
|
||||||
|
msgid "Bitbucket Private Repositories"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:448
|
||||||
|
msgid "Bitbucket"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:457
|
||||||
|
msgid "Check box if private repository. Leave unchecked for public repositories."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:464
|
||||||
|
msgid "Enter your personal Bitbucket username and password."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:498
|
||||||
|
msgid "Private Bitbucket Repository"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:514
|
||||||
|
msgid "Check for private Bitbucket repositories."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:529
|
||||||
|
msgid "Enter Bitbucket username."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_API.php:544
|
||||||
|
msgid "Enter Bitbucket password."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Zipfile_API.php:37
|
||||||
|
msgid "Zipfile Slug"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Zipfile_API.php:53
|
||||||
|
msgid "Enter plugin or theme slug."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:343
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:361
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:423
|
||||||
|
msgid "Gitea Access Token"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:352
|
||||||
|
msgid "Gitea Private Settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:396
|
||||||
|
msgid "Gitea"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:405
|
||||||
|
msgid "Enter your repository specific Gitea Access Token."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:412
|
||||||
|
msgid "Enter your Gitea Access Token."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:439
|
||||||
|
msgid "Enter Gitea Access Token for private Gitea repositories."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Gitea_API.php:470
|
||||||
|
msgid "You must set a Gitea Access Token."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:436
|
||||||
|
msgid "GitLab Personal Access Token"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:445
|
||||||
|
msgid "GitLab Private Settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:454
|
||||||
|
msgid "GitLab.com Access Token"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:468
|
||||||
|
msgid "GitLab CE or GitLab Enterprise Personal Access Token"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:503
|
||||||
|
msgid "GitLab"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:512
|
||||||
|
msgid "Enter your repository specific GitLab Access Token."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:519
|
||||||
|
msgid "Enter your GitLab.com, GitLab CE, or GitLab Enterprise Access Token."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:530
|
||||||
|
msgid "GitLab Access Token"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:546
|
||||||
|
msgid "Enter GitLab Access Token for private GitLab repositories."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitLab_API.php:579
|
||||||
|
msgid "You must set a GitLab.com, GitLab CE, or GitLab Enterprise Access Token."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:371
|
||||||
|
msgid "GitHub Personal Access Token"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:378
|
||||||
|
msgid "GitHub.com Access Token"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:391
|
||||||
|
msgid "GitHub Enterprise Access Token"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:408
|
||||||
|
msgid "GitHub Private Settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:435
|
||||||
|
msgid "Enter your GitHub Access Token. Leave empty for public repositories."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:442
|
||||||
|
msgid "Enter your personal GitHub.com or GitHub Enterprise Access Token to avoid API access limits."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:453
|
||||||
|
msgid "GitHub Access Token"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:467
|
||||||
|
msgid "GitHub"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/GitHub_API.php:481
|
||||||
|
msgid "Enter GitHub Access Token for private GitHub repositories."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:340
|
||||||
|
msgid "Bitbucket Server Private Settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:347
|
||||||
|
msgid "Bitbucket Server Username"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:356
|
||||||
|
msgid "Bitbucket Server Password"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:372
|
||||||
|
msgid "Bitbucket Server Private Repositories"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:402
|
||||||
|
msgid "Bitbucket Server"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Messages.php:112
|
||||||
|
#: src/GitHub_Updater/Messages.php:153
|
||||||
|
#: src/GitHub_Updater/Messages.php:173
|
||||||
|
msgid "GitHub Updater Error Code:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. translators: %s: wait time
|
||||||
|
#: src/GitHub_Updater/Messages.php:119
|
||||||
|
msgid "GitHub API’s rate limit will reset in %s minutes."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. translators: %s: GitHub personal access token URL
|
||||||
|
#: src/GitHub_Updater/Messages.php:125
|
||||||
|
msgid "It looks like you are running into GitHub API rate limits. Be sure and configure a <a href=\"%s\">Personal Access Token</a> to avoid this issue."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Messages.php:157
|
||||||
|
msgid "There is probably an access token or password error on the GitHub Updater Settings page."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Messages.php:188
|
||||||
|
msgid "GitHub Updater Information"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/GitHub_Updater/Messages.php:190
|
||||||
|
msgid "Please be patient while WP-Cron finishes making API calls."
|
||||||
|
msgstr ""
|
||||||
84
wp-content/plugins/github-updater/mu/ghu-loader.php
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin Name: GitHub Updater MU loader
|
||||||
|
* Plugin URI: https://github.com/afragen/github-updater
|
||||||
|
* Description: A plugin to load GitHub Updater as a must-use plugin. Disables normal plugin activation and deletion.
|
||||||
|
* Version: 1.5.3
|
||||||
|
* Author: Andy Fragen
|
||||||
|
* License: GPL-2.0+
|
||||||
|
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
* GitHub Plugin URI: https://github.com/afragen/github-updater/tree/develop/mu
|
||||||
|
*/
|
||||||
|
|
||||||
|
// If this file is called directly, abort.
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Load normal plugin.
|
||||||
|
*/
|
||||||
|
if ( ! class_exists( 'Fragen\\GitHub_Updater\\Bootstrap' ) ) {
|
||||||
|
$ghu_plugin_file = 'github-updater/github-updater.php';
|
||||||
|
require trailingslashit( WP_PLUGIN_DIR ) . $ghu_plugin_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deactivate if plugin in loaded not as mu-plugin.
|
||||||
|
*
|
||||||
|
* @param string $plugin Plugin slug.
|
||||||
|
*/
|
||||||
|
function ghu_deactivate( $plugin ) {
|
||||||
|
$ghu_plugin_file = 'github-updater/github-updater.php';
|
||||||
|
if ( $ghu_plugin_file === $plugin ) {
|
||||||
|
deactivate_plugins( $ghu_plugin_file );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Label as mu-plugin in plugin view.
|
||||||
|
*
|
||||||
|
* @param array $actions Link actions.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function ghu_mu_plugin_active( $actions ) {
|
||||||
|
if ( isset( $actions['activate'] ) ) {
|
||||||
|
unset( $actions['activate'] );
|
||||||
|
}
|
||||||
|
if ( isset( $actions['delete'] ) ) {
|
||||||
|
unset( $actions['delete'] );
|
||||||
|
}
|
||||||
|
if ( isset( $actions['deactivate'] ) ) {
|
||||||
|
unset( $actions['deactivate'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_merge( array( 'mu-plugin' => esc_html__( 'Activated as mu-plugin', 'github-updater' ) ), $actions );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Deactivate normal plugin as it's loaded as mu-plugin.
|
||||||
|
*/
|
||||||
|
add_action( 'activated_plugin', 'ghu_deactivate', 10, 1 );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove links and checkbox from Plugins page so user can't delete main plugin.
|
||||||
|
*/
|
||||||
|
add_filter( 'network_admin_plugin_action_links_' . $ghu_plugin_file, 'ghu_mu_plugin_active' );
|
||||||
|
add_filter( 'plugin_action_links_' . $ghu_plugin_file, 'ghu_mu_plugin_active' );
|
||||||
|
add_action(
|
||||||
|
'after_plugin_row_' . $ghu_plugin_file,
|
||||||
|
function () {
|
||||||
|
print '<script>jQuery(".inactive[data-plugin=\'github-updater/github-updater.php\']").attr("class", "active");</script>';
|
||||||
|
print '<script>jQuery(".active[data-plugin=\'github-updater/github-updater.php\'] .check-column input").remove();</script>';
|
||||||
|
}
|
||||||
|
);
|
||||||
59
wp-content/plugins/github-updater/readme.txt
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# GitHub Updater
|
||||||
|
Contributors: afragen, garyj, sethcarstens, limikael
|
||||||
|
Donate link: https://thefragens.com/github-updater-donate
|
||||||
|
Tags: plugin, theme, language pack, updater, remote install
|
||||||
|
Requires at least: 4.6
|
||||||
|
Requires PHP: 5.6
|
||||||
|
Tested up to: 5.2
|
||||||
|
Stable tag: master
|
||||||
|
License: GPLv2 or later
|
||||||
|
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
This plugin was designed to simply update any GitHub hosted WordPress plugin or theme. Currently, plugins or themes hosted on GitHub, Bitbucket, GitLab, or Gitea are also supported. Additionally, self-hosted installations of GitHub or GitLab are supported. It also allows for remote installation of plugins or themes into WordPress.
|
||||||
|
|
||||||
|
Your plugin or theme **must** contain a header in the style.css header or in the plugin's header denoting the location on GitHub. The format is as follows.
|
||||||
|
|
||||||
|
GitHub Plugin URI: afragen/github-updater
|
||||||
|
GitHub Plugin URI: https://github.com/afragen/github-updater
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
GitHub Theme URI: afragen/test-child
|
||||||
|
GitHub Theme URI: https://github.com/afragen/test-child
|
||||||
|
|
||||||
|
...where the above URI leads to the __owner/repository__ of your theme or plugin. The URI may be in the format `https://github.com/<owner>/<repo>` or the short format `<owner>/<repo>`. You do not need both. Only one Plugin or Theme URI is required. You **must not** include any extensions like `.git`.
|
||||||
|
|
||||||
|
The following headers are available for use depending upon your hosting source.
|
||||||
|
|
||||||
|
### GitHub
|
||||||
|
* GitHub Plugin URI
|
||||||
|
* GitHub Theme URI
|
||||||
|
* GitHub Languages
|
||||||
|
|
||||||
|
### Bitbucket
|
||||||
|
* Bitbucket Plugin URI
|
||||||
|
* Bitbucket Theme URI
|
||||||
|
* Bitbucket Languages
|
||||||
|
|
||||||
|
### GitLab
|
||||||
|
* GitLab Plugin URI
|
||||||
|
* GitLab Theme URI
|
||||||
|
* GitLab Languages
|
||||||
|
* GitLab CI Job
|
||||||
|
|
||||||
|
### Gitea
|
||||||
|
* Gitea Plugin URI
|
||||||
|
* Gitea Theme URI
|
||||||
|
* Gitea Languages
|
||||||
|
|
||||||
|
## Frequently Asked Questions
|
||||||
|
|
||||||
|
#### Wiki
|
||||||
|
|
||||||
|
[Comprehensive information regarding GitHub Updater is available on the wiki.](https://github.com/afragen/github-updater/wiki)
|
||||||
|
|
||||||
|
#### Slack
|
||||||
|
|
||||||
|
We now have a [Slack team for GitHub Updater](https://github-updater.slack.com). Please [click here for an invite](https://github-updater.herokuapp.com). You will be automatically added to the _#general_ and _#random_ channels. Please take a look at other channels too.
|
||||||
735
wp-content/plugins/github-updater/src/GitHub_Updater/API.php
Normal file
@@ -0,0 +1,735 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater;
|
||||||
|
|
||||||
|
use Fragen\Singleton;
|
||||||
|
use Fragen\GitHub_Updater\Traits\API_Common;
|
||||||
|
use Fragen\GitHub_Updater\Traits\GHU_Trait;
|
||||||
|
use Fragen\GitHub_Updater\Traits\Basic_Auth_Loader;
|
||||||
|
use Fragen\GitHub_Updater\API\GitHub_API;
|
||||||
|
use Fragen\GitHub_Updater\API\Bitbucket_API;
|
||||||
|
use Fragen\GitHub_Updater\API\Bitbucket_Server_API;
|
||||||
|
use Fragen\GitHub_Updater\API\GitLab_API;
|
||||||
|
use Fragen\GitHub_Updater\API\Gitea_API;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class API
|
||||||
|
*/
|
||||||
|
class API {
|
||||||
|
use API_Common, GHU_Trait, Basic_Auth_Loader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds HTTP error code from API call.
|
||||||
|
*
|
||||||
|
* @var array ( $this->type->slug => $code )
|
||||||
|
*/
|
||||||
|
protected static $error_code = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds site options.
|
||||||
|
*
|
||||||
|
* @var array $options
|
||||||
|
*/
|
||||||
|
protected static $options;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds extra headers.
|
||||||
|
*
|
||||||
|
* @var array $extra_headers
|
||||||
|
*/
|
||||||
|
protected static $extra_headers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Variable for setting update transient hours.
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
protected $hours = 12;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Variable to hold all repository remote info.
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $response = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Variable to hold AWS redirect URL.
|
||||||
|
*
|
||||||
|
* @var string|\WP_Error $redirect
|
||||||
|
*/
|
||||||
|
protected $redirect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
static::$options = $this->get_class_vars( 'Base', 'options' );
|
||||||
|
static::$extra_headers = Singleton::get_instance( 'Base', $this )->add_headers( [] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds custom user agent for GitHub Updater.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param array $args Existing HTTP Request arguments.
|
||||||
|
* @param string $url URL being passed.
|
||||||
|
*
|
||||||
|
* @return array Amended HTTP Request arguments.
|
||||||
|
*/
|
||||||
|
public static function http_request_args( $args, $url ) {
|
||||||
|
$args['sslverify'] = true;
|
||||||
|
if ( false === stripos( $args['user-agent'], 'GitHub Updater' ) ) {
|
||||||
|
$args['user-agent'] .= '; GitHub Updater - https://github.com/afragen/github-updater';
|
||||||
|
$args['wp-rest-cache'] = [ 'tag' => 'github-updater' ];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add data in Settings page.
|
||||||
|
*
|
||||||
|
* @param object $git Git API object.
|
||||||
|
*/
|
||||||
|
public function settings_hook( $git ) {
|
||||||
|
add_action(
|
||||||
|
'github_updater_add_settings',
|
||||||
|
function ( $auth_required ) use ( $git ) {
|
||||||
|
$git->add_settings( $auth_required );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
add_filter( 'github_updater_add_repo_setting_field', [ $this, 'add_setting_field' ], 10, 2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add data to the setting_field in Settings.
|
||||||
|
*
|
||||||
|
* @param array $fields
|
||||||
|
* @param array $repo
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function add_setting_field( $fields, $repo ) {
|
||||||
|
if ( ! empty( $fields ) ) {
|
||||||
|
return $fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->get_repo_api( $repo->git, $repo )->add_repo_setting_field();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get repo's API.
|
||||||
|
*
|
||||||
|
* @param string $git (github|bitbucket|gitlab|gitea)
|
||||||
|
* @param bool|\stdClass $repo
|
||||||
|
*
|
||||||
|
* @return \Fragen\GitHub_Updater\API\Bitbucket_API|
|
||||||
|
* \Fragen\GitHub_Updater\API\Bitbucket_Server_API|
|
||||||
|
* \Fragen\GitHub_Updater\API\Gitea_API|
|
||||||
|
* \Fragen\GitHub_Updater\API\GitHub_API|
|
||||||
|
* \Fragen\GitHub_Updater\API\GitLab_API $repo_api
|
||||||
|
*/
|
||||||
|
public function get_repo_api( $git, $repo = false ) {
|
||||||
|
$repo_api = null;
|
||||||
|
$repo = $repo ?: new \stdClass();
|
||||||
|
switch ( $git ) {
|
||||||
|
case 'github':
|
||||||
|
$repo_api = new GitHub_API( $repo );
|
||||||
|
break;
|
||||||
|
case 'bitbucket':
|
||||||
|
if ( ! empty( $repo->enterprise ) ) {
|
||||||
|
$repo_api = new Bitbucket_Server_API( $repo );
|
||||||
|
} else {
|
||||||
|
$repo_api = new Bitbucket_API( $repo );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'gitlab':
|
||||||
|
$repo_api = new GitLab_API( $repo );
|
||||||
|
break;
|
||||||
|
case 'gitea':
|
||||||
|
$repo_api = new Gitea_API( $repo );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $repo_api;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Install settings fields.
|
||||||
|
*
|
||||||
|
* @param object $git Git API from caller.
|
||||||
|
*/
|
||||||
|
public function add_install_fields( $git ) {
|
||||||
|
add_action(
|
||||||
|
'github_updater_add_install_settings_fields',
|
||||||
|
function ( $type ) use ( $git ) {
|
||||||
|
$git->add_install_settings_fields( $type );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call the API and return a json decoded body.
|
||||||
|
* Create error messages.
|
||||||
|
*
|
||||||
|
* @link http://developer.github.com/v3/
|
||||||
|
*
|
||||||
|
* @param string $url The URL to send the request to.
|
||||||
|
*
|
||||||
|
* @return boolean|\stdClass
|
||||||
|
*/
|
||||||
|
protected function api( $url ) {
|
||||||
|
add_filter( 'http_request_args', [ $this, 'http_request_args' ], 10, 2 );
|
||||||
|
|
||||||
|
$type = $this->return_repo_type();
|
||||||
|
$response = wp_remote_get( $this->get_api_url( $url ) );
|
||||||
|
$code = (int) wp_remote_retrieve_response_code( $response );
|
||||||
|
$allowed_codes = [ 200, 404 ];
|
||||||
|
remove_filter( 'http_request_args', [ $this, 'http_request_args' ] );
|
||||||
|
|
||||||
|
if ( is_wp_error( $response ) ) {
|
||||||
|
Singleton::get_instance( 'Messages', $this )->create_error_message( $response );
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
if ( ! in_array( $code, $allowed_codes, true ) ) {
|
||||||
|
static::$error_code = array_merge(
|
||||||
|
static::$error_code,
|
||||||
|
[
|
||||||
|
$this->type->slug => [
|
||||||
|
'repo' => $this->type->slug,
|
||||||
|
'code' => $code,
|
||||||
|
'name' => $this->type->name,
|
||||||
|
'git' => $this->type->git,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
if ( 'github' === $type['git'] ) {
|
||||||
|
GitHub_API::ratelimit_reset( $response, $this->type->slug );
|
||||||
|
}
|
||||||
|
Singleton::get_instance( 'Messages', $this )->create_error_message( $type['git'] );
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gitea doesn't return json encoded raw file.
|
||||||
|
$response = $this->convert_body_string_to_json( $response );
|
||||||
|
|
||||||
|
return json_decode( wp_remote_retrieve_body( $response ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert response body to JSON.
|
||||||
|
*
|
||||||
|
* @param mixed $response (JSON|string)
|
||||||
|
* @return mixed $response JSON encoded.
|
||||||
|
*/
|
||||||
|
private function convert_body_string_to_json( $response ) {
|
||||||
|
if ( $this instanceof Gitea_API || $this instanceof Bitbucket_API || $this instanceof Bitbucket_Server_API ) {
|
||||||
|
$body = wp_remote_retrieve_body( $response );
|
||||||
|
if ( null === json_decode( $body ) ) {
|
||||||
|
$response['body'] = json_encode( $body );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return repo data for API calls.
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function return_repo_type() {
|
||||||
|
$arr = [];
|
||||||
|
$arr['type'] = $this->type->type;
|
||||||
|
|
||||||
|
switch ( $this->type->git ) {
|
||||||
|
case 'github':
|
||||||
|
$arr['git'] = 'github';
|
||||||
|
$arr['base_uri'] = 'https://api.github.com';
|
||||||
|
$arr['base_download'] = 'https://github.com';
|
||||||
|
break;
|
||||||
|
case 'bitbucket':
|
||||||
|
$arr['git'] = 'bitbucket';
|
||||||
|
if ( empty( $this->type->enterprise ) ) {
|
||||||
|
$arr['base_uri'] = 'https://api.bitbucket.org';
|
||||||
|
$arr['base_download'] = 'https://bitbucket.org';
|
||||||
|
} else {
|
||||||
|
$arr['base_uri'] = $this->type->enterprise_api;
|
||||||
|
$arr['base_download'] = $this->type->enterprise;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'gitlab':
|
||||||
|
$arr['git'] = 'gitlab';
|
||||||
|
$arr['base_uri'] = 'https://gitlab.com/api/v4';
|
||||||
|
$arr['base_download'] = 'https://gitlab.com';
|
||||||
|
break;
|
||||||
|
case 'gitea':
|
||||||
|
$arr['git'] = 'gitea';
|
||||||
|
$arr['base_uri'] = $this->type->enterprise . '/api/v1';
|
||||||
|
$arr['base_download'] = $this->type->enterprise;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return API url.
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
*
|
||||||
|
* @param string $endpoint The endpoint to access.
|
||||||
|
* @param bool|string $download_link The plugin or theme download link. Defaults to false.
|
||||||
|
*
|
||||||
|
* @return string $endpoint
|
||||||
|
*/
|
||||||
|
protected function get_api_url( $endpoint, $download_link = false ) {
|
||||||
|
$type = $this->return_repo_type();
|
||||||
|
$segments = [
|
||||||
|
'owner' => $this->type->owner,
|
||||||
|
'repo' => $this->type->slug,
|
||||||
|
'branch' => empty( $this->type->branch ) ? 'master' : $this->type->branch,
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ( $segments as $segment => $value ) {
|
||||||
|
$endpoint = str_replace( ':' . $segment, sanitize_text_field( $value ), $endpoint );
|
||||||
|
}
|
||||||
|
|
||||||
|
$repo_api = $this->get_repo_api( $type['git'], $this->type );
|
||||||
|
switch ( $type['git'] ) {
|
||||||
|
case 'github':
|
||||||
|
if ( ! $this->type->enterprise && $download_link ) {
|
||||||
|
$type['base_download'] = $type['base_uri'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ( $this->type->enterprise_api ) {
|
||||||
|
$type['base_download'] = $this->type->enterprise_api;
|
||||||
|
$type['base_uri'] = null;
|
||||||
|
if ( $download_link ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$endpoint = $repo_api->add_endpoints( $this, $endpoint );
|
||||||
|
break;
|
||||||
|
case 'gitlab':
|
||||||
|
if ( ! $this->type->enterprise && $download_link ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ( $this->type->enterprise ) {
|
||||||
|
$type['base_download'] = $this->type->enterprise;
|
||||||
|
$type['base_uri'] = null;
|
||||||
|
if ( $download_link ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$endpoint = $repo_api->add_endpoints( $this, $endpoint );
|
||||||
|
break;
|
||||||
|
case 'bitbucket':
|
||||||
|
$this->load_authentication_hooks();
|
||||||
|
if ( $this->type->enterprise_api ) {
|
||||||
|
if ( $download_link ) {
|
||||||
|
$type['base_download'] = $type['base_uri'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$endpoint = $repo_api->add_endpoints( $this, $endpoint );
|
||||||
|
|
||||||
|
return $this->type->enterprise_api . $endpoint;
|
||||||
|
}
|
||||||
|
if ( $download_link && 'release_asset' === self::$method ) {
|
||||||
|
$type['base_download'] = $type['base_uri'];
|
||||||
|
}
|
||||||
|
$endpoint = $repo_api->add_endpoints( $this, $endpoint );
|
||||||
|
break;
|
||||||
|
case 'gitea':
|
||||||
|
if ( $download_link ) {
|
||||||
|
$type['base_download'] = $type['base_uri'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$endpoint = $repo_api->add_endpoints( $this, $endpoint );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$base = $download_link ? $type['base_download'] : $type['base_uri'];
|
||||||
|
|
||||||
|
return $base . $endpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query wp.org for plugin/theme information.
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
*
|
||||||
|
* @return bool|int|mixed|string|\WP_Error
|
||||||
|
*/
|
||||||
|
protected function get_dot_org_data() {
|
||||||
|
$response = isset( $this->response['dot_org'] ) ? $this->response['dot_org'] : false;
|
||||||
|
|
||||||
|
if ( ! $response ) {
|
||||||
|
$url = "https://api.wordpress.org/{$this->type->type}s/info/1.1/";
|
||||||
|
$url = add_query_arg(
|
||||||
|
[
|
||||||
|
'action' => "{$this->type->type}_information",
|
||||||
|
rawurlencode( 'request[slug]' ) => $this->type->slug,
|
||||||
|
],
|
||||||
|
$url
|
||||||
|
);
|
||||||
|
$response = wp_remote_get( $url );
|
||||||
|
|
||||||
|
if ( is_wp_error( $response ) ) {
|
||||||
|
Singleton::get_instance( 'Messages', $this )->create_error_message( $response );
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = json_decode( $response['body'] );
|
||||||
|
$response = ! empty( $response ) && ! isset( $response->error ) ? 'in dot org' : 'not in dot org';
|
||||||
|
|
||||||
|
$this->set_repo_cache( 'dot_org', $response );
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'in dot org' === $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add appropriate access token to endpoint.
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
*
|
||||||
|
* @param GitHub_API|GitLab_API $git Class containing the GitAPI used.
|
||||||
|
* @param string $endpoint The endpoint being accessed.
|
||||||
|
*
|
||||||
|
* @return string $endpoint
|
||||||
|
*/
|
||||||
|
protected function add_access_token_endpoint( $git, $endpoint ) {
|
||||||
|
// This will return if checking during shiny updates.
|
||||||
|
if ( null === static::$options ) {
|
||||||
|
return $endpoint;
|
||||||
|
}
|
||||||
|
$key = null;
|
||||||
|
$token = null;
|
||||||
|
$token_enterprise = null;
|
||||||
|
|
||||||
|
switch ( $git->type->git ) {
|
||||||
|
case 'github':
|
||||||
|
$key = 'access_token';
|
||||||
|
$token = 'github_access_token';
|
||||||
|
$token_enterprise = 'github_enterprise_token';
|
||||||
|
break;
|
||||||
|
case 'gitlab':
|
||||||
|
$key = 'private_token';
|
||||||
|
$token = 'gitlab_access_token';
|
||||||
|
$token_enterprise = 'gitlab_enterprise_token';
|
||||||
|
break;
|
||||||
|
case 'gitea':
|
||||||
|
$key = 'access_token';
|
||||||
|
$token = 'gitea_access_token';
|
||||||
|
$token_enterprise = 'gitea_access_token';
|
||||||
|
break;
|
||||||
|
case 'bitbucket':
|
||||||
|
return $endpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add hosted access token.
|
||||||
|
if ( ! empty( static::$options[ $token ] ) ) {
|
||||||
|
$endpoint = add_query_arg( $key, static::$options[ $token ], $endpoint );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add Enterprise access token.
|
||||||
|
if ( ! empty( $git->type->enterprise ) &&
|
||||||
|
! empty( static::$options[ $token_enterprise ] )
|
||||||
|
) {
|
||||||
|
$endpoint = remove_query_arg( $key, $endpoint );
|
||||||
|
$endpoint = add_query_arg( $key, static::$options[ $token_enterprise ], $endpoint );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add repo access token.
|
||||||
|
if ( ! empty( static::$options[ $git->type->slug ] ) ) {
|
||||||
|
$endpoint = remove_query_arg( $key, $endpoint );
|
||||||
|
$endpoint = add_query_arg( $key, static::$options[ $git->type->slug ], $endpoint );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $endpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test to exit early if no update available, saves API calls.
|
||||||
|
*
|
||||||
|
* @param array|bool $response
|
||||||
|
* @param bool $branch
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function exit_no_update( $response, $branch = false ) {
|
||||||
|
/**
|
||||||
|
* Filters the return value of exit_no_update.
|
||||||
|
*
|
||||||
|
* @since 6.0.0
|
||||||
|
* @return bool `true` will exit this function early, default will not.
|
||||||
|
*/
|
||||||
|
if ( apply_filters( 'ghu_always_fetch_update', false ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $branch ) {
|
||||||
|
return empty( static::$options['branch_switch'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
return ! isset( $_POST['ghu_refresh_cache'] ) && ! $response && ! $this->can_update_repo( $this->type );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate wp_remote_get response.
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
*
|
||||||
|
* @param \stdClass $response The response.
|
||||||
|
*
|
||||||
|
* @return bool true if invalid
|
||||||
|
*/
|
||||||
|
protected function validate_response( $response ) {
|
||||||
|
return empty( $response ) || isset( $response->message ) || is_wp_error( $response );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a local file for the repository exists.
|
||||||
|
* Only checks the root directory of the repository.
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
*
|
||||||
|
* @param string $filename The filename to check for.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function local_file_exists( $filename ) {
|
||||||
|
return file_exists( $this->type->local_path . $filename );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort tags and set object data.
|
||||||
|
*
|
||||||
|
* @param array $parsed_tags
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function sort_tags( $parsed_tags ) {
|
||||||
|
if ( empty( $parsed_tags ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
list($tags, $rollback) = $parsed_tags;
|
||||||
|
usort( $tags, 'version_compare' );
|
||||||
|
krsort( $rollback );
|
||||||
|
|
||||||
|
$newest_tag = array_slice( $tags, -1, 1, true );
|
||||||
|
$newest_tag_key = key( $newest_tag );
|
||||||
|
$newest_tag = $tags[ $newest_tag_key ];
|
||||||
|
|
||||||
|
$this->type->newest_tag = $newest_tag;
|
||||||
|
$this->type->tags = $tags;
|
||||||
|
$this->type->rollback = $rollback;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get local file info if no update available. Save API calls.
|
||||||
|
*
|
||||||
|
* @param \stdClass $repo Repo data.
|
||||||
|
* @param string $file
|
||||||
|
*
|
||||||
|
* @return null|string
|
||||||
|
*/
|
||||||
|
protected function get_local_info( $repo, $file ) {
|
||||||
|
$response = false;
|
||||||
|
|
||||||
|
if ( isset( $_POST['ghu_refresh_cache'] ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( is_dir( $repo->local_path ) &&
|
||||||
|
file_exists( $repo->local_path . $file )
|
||||||
|
) {
|
||||||
|
$response = file_get_contents( $repo->local_path . $file );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set repo object file info.
|
||||||
|
*
|
||||||
|
* @param array $response Repo data.
|
||||||
|
*/
|
||||||
|
protected function set_file_info( $response ) {
|
||||||
|
$this->type->transient = $response;
|
||||||
|
$this->type->remote_version = strtolower( $response['Version'] );
|
||||||
|
$this->type->requires_php = ! empty( $response['Requires PHP'] ) ? $response['Requires PHP'] : false;
|
||||||
|
$this->type->requires = ! empty( $response['Requires WP'] ) ? $response['Requires WP'] : null;
|
||||||
|
$this->type->dot_org = $response['dot_org'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add remote data to type object.
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
*/
|
||||||
|
protected function add_meta_repo_object() {
|
||||||
|
$this->type->rating = $this->make_rating( $this->type->repo_meta );
|
||||||
|
$this->type->last_updated = $this->type->repo_meta['last_updated'];
|
||||||
|
$this->type->num_ratings = $this->type->repo_meta['watchers'];
|
||||||
|
$this->type->is_private = $this->type->repo_meta['private'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create some sort of rating from 0 to 100 for use in star ratings.
|
||||||
|
* I'm really just making this up, more based upon popularity.
|
||||||
|
*
|
||||||
|
* @param array $repo_meta
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
protected function make_rating( $repo_meta ) {
|
||||||
|
$watchers = ! empty( $repo_meta['watchers'] ) ? $repo_meta['watchers'] : 0;
|
||||||
|
$forks = ! empty( $repo_meta['forks'] ) ? $repo_meta['forks'] : 0;
|
||||||
|
$open_issues = ! empty( $repo_meta['open_issues'] ) ? $repo_meta['open_issues'] : 0;
|
||||||
|
|
||||||
|
$rating = abs( (int) round( $watchers + ( $forks * 1.5 ) - ( $open_issues * 0.1 ) ) );
|
||||||
|
|
||||||
|
if ( 100 < $rating ) {
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rating;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set data from readme.txt.
|
||||||
|
* Prefer changelog from CHANGES.md.
|
||||||
|
*
|
||||||
|
* @param array $readme Array of parsed readme.txt data.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function set_readme_info( $readme ) {
|
||||||
|
foreach ( (array) $this->type->sections as $section => $value ) {
|
||||||
|
if ( 'description' === $section ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$readme['sections'][ $section ] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$readme['remaining_content'] = ! empty( $readme['remaining_content'] ) ? $readme['remaining_content'] : null;
|
||||||
|
if ( empty( $readme['sections']['other_notes'] ) ) {
|
||||||
|
unset( $readme['sections']['other_notes'] );
|
||||||
|
} else {
|
||||||
|
$readme['sections']['other_notes'] .= $readme['remaining_content'];
|
||||||
|
}
|
||||||
|
unset( $readme['sections']['screenshots'], $readme['sections']['installation'] );
|
||||||
|
$readme['sections'] = ! empty( $readme['sections'] ) ? $readme['sections'] : [];
|
||||||
|
$this->type->sections = array_merge( (array) $this->type->sections, (array) $readme['sections'] );
|
||||||
|
$this->type->tested = isset( $readme['tested'] ) ? $readme['tested'] : null;
|
||||||
|
$this->type->requires = isset( $readme['requires'] ) ? $readme['requires'] : null;
|
||||||
|
$this->type->requires_php = isset( $readme['requires_php'] ) ? $readme['requires_php'] : null;
|
||||||
|
$this->type->donate_link = isset( $readme['donate_link'] ) ? $readme['donate_link'] : null;
|
||||||
|
$this->type->contributors = isset( $readme['contributors'] ) ? $readme['contributors'] : null;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the redirect download link for a release asset.
|
||||||
|
* AWS download link sets a link expiration of ONLY 5 minutes.
|
||||||
|
*
|
||||||
|
* @since 6.1.0
|
||||||
|
* @uses Requests, requires WP 4.6
|
||||||
|
*
|
||||||
|
* @param string $asset Release asset URI from git host.
|
||||||
|
*
|
||||||
|
* @return string|bool|\stdClass Release asset URI from AWS.
|
||||||
|
*/
|
||||||
|
protected function get_release_asset_redirect( $asset, $aws = false ) {
|
||||||
|
if ( ! $asset ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unset release asset url if older than 5 min to account for AWS expiration.
|
||||||
|
if ( $aws && ( time() - strtotime( '-12 hours', $this->response['timeout'] ) ) >= 300 ) {
|
||||||
|
unset( $this->response['release_asset_redirect'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = isset( $this->response['release_asset_redirect'] ) ? $this->response['release_asset_redirect'] : false;
|
||||||
|
|
||||||
|
if ( $this->exit_no_update( $response ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $response ) {
|
||||||
|
add_action( 'requests-requests.before_redirect', [ $this, 'set_redirect' ], 10, 1 );
|
||||||
|
add_filter( 'http_request_args', [ $this, 'set_aws_release_asset_header' ] );
|
||||||
|
$url = $this->add_access_token_endpoint( $this, $asset );
|
||||||
|
wp_remote_get( $url );
|
||||||
|
remove_filter( 'http_request_args', [ $this, 'set_aws_release_asset_header' ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( $this->redirect ) ) {
|
||||||
|
$this->set_repo_cache( 'release_asset_redirect', $this->redirect );
|
||||||
|
|
||||||
|
return $this->redirect;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set HTTP header for following AWS release assets.
|
||||||
|
*
|
||||||
|
* @since 6.1.0
|
||||||
|
*
|
||||||
|
* @param array $args
|
||||||
|
* @param string $url
|
||||||
|
*
|
||||||
|
* @return mixed $args
|
||||||
|
*/
|
||||||
|
public function set_aws_release_asset_header( $args, $url = '' ) {
|
||||||
|
$args['headers']['accept'] = 'application/octet-stream';
|
||||||
|
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set AWS redirect URL from action hook.
|
||||||
|
*
|
||||||
|
* @uses `requests-requests.before_redirect` Action hook.
|
||||||
|
*
|
||||||
|
* @param string $location
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function set_redirect( $location ) {
|
||||||
|
$this->redirect = $location;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater\API;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface API_Interface
|
||||||
|
*/
|
||||||
|
interface API_Interface {
|
||||||
|
/**
|
||||||
|
* Read the remote file and parse headers.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param string $file Filename.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_remote_info( $file);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get remote info for tags.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_remote_tag();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the remote CHANGES.md file.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param string $changes Changelog filename.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_remote_changes( $changes);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read and parse remote readme.txt.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_remote_readme();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the repository meta from API.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_repo_meta();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create array of branches and download links as array.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_branches();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get release asset URL.
|
||||||
|
*
|
||||||
|
* @return string|bool
|
||||||
|
*/
|
||||||
|
public function get_release_asset();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct $this->type->download_link using Repository Contents API.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param bool $branch_switch For direct branch switching. Defaults to false.
|
||||||
|
*
|
||||||
|
* @return string URL for download link.
|
||||||
|
*/
|
||||||
|
public function construct_download_link( $branch_switch = false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create endpoints.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param GitHub_API|Bitbucket_API|Bitbucket_Server_API|GitLab_API $git
|
||||||
|
* @param string $endpoint
|
||||||
|
*
|
||||||
|
* @return string $endpoint
|
||||||
|
*/
|
||||||
|
public function add_endpoints( $git, $endpoint);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response call and return only array of tag numbers.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response API response.
|
||||||
|
*
|
||||||
|
* @return array|\stdClass Array of tag numbers, object is error.
|
||||||
|
*/
|
||||||
|
public function parse_tag_response( $response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array of meta variables.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response API response.
|
||||||
|
*
|
||||||
|
* @return array|\stdClass Array of meta variables.
|
||||||
|
*/
|
||||||
|
public function parse_meta_response( $response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array with changelog.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response API response.
|
||||||
|
*
|
||||||
|
* @return array|\stdClass $arr Array of changes in base64, object if error.
|
||||||
|
*/
|
||||||
|
public function parse_changelog_response( $response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array of branch data.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param \stdClass $response API response.
|
||||||
|
*
|
||||||
|
* @return array Array of branch data.
|
||||||
|
*/
|
||||||
|
public function parse_branch_response( $response );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add values for individual repo add_setting_field().
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function add_repo_setting_field();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add settings for each API.
|
||||||
|
*
|
||||||
|
* @param array $auth_required
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function add_settings( $auth_required);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add remote install settings fields.
|
||||||
|
*
|
||||||
|
* @param string $type plugin|theme.
|
||||||
|
*/
|
||||||
|
public function add_install_settings_fields( $type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add remote install feature, create endpoint.
|
||||||
|
*
|
||||||
|
* @param array $headers
|
||||||
|
* @param array $install
|
||||||
|
*
|
||||||
|
* @return mixed $install
|
||||||
|
*/
|
||||||
|
public function remote_install( $headers, $install);
|
||||||
|
}
|
||||||
@@ -0,0 +1,584 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater\API;
|
||||||
|
|
||||||
|
use Fragen\Singleton;
|
||||||
|
use Fragen\GitHub_Updater\API;
|
||||||
|
use Fragen\GitHub_Updater\Branch;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Bitbucket_API
|
||||||
|
*
|
||||||
|
* Get remote data from a Bitbucket repo.
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
*/
|
||||||
|
class Bitbucket_API extends API implements API_Interface {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param \stdClass $type The repo type.
|
||||||
|
*/
|
||||||
|
public function __construct( $type ) {
|
||||||
|
parent::__construct();
|
||||||
|
$this->type = $type;
|
||||||
|
$this->response = $this->get_repo_cache();
|
||||||
|
$branch = new Branch( $this->response );
|
||||||
|
if ( ! empty( $type->branch ) ) {
|
||||||
|
$this->type->branch = ! empty( $branch->cache['current_branch'] )
|
||||||
|
? $branch->cache['current_branch']
|
||||||
|
: $type->branch;
|
||||||
|
}
|
||||||
|
$this->set_default_credentials();
|
||||||
|
$this->settings_hook( $this );
|
||||||
|
$this->add_settings_subtab();
|
||||||
|
$this->add_install_fields( $this );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set default credentials if option not set.
|
||||||
|
*/
|
||||||
|
protected function set_default_credentials() {
|
||||||
|
$running_servers = Singleton::get_instance( 'Base', $this )->get_running_git_servers();
|
||||||
|
$set_credentials = false;
|
||||||
|
if ( $this instanceof Bitbucket_API ) {
|
||||||
|
$username = 'bitbucket_username';
|
||||||
|
$password = 'bitbucket_password';
|
||||||
|
}
|
||||||
|
if ( $this instanceof Bitbucket_Server_API ) {
|
||||||
|
$username = 'bitbucket_server_username';
|
||||||
|
$password = 'bitbucket_server_password';
|
||||||
|
}
|
||||||
|
if ( ! isset( static::$options[ $username ] ) ) {
|
||||||
|
static::$options[ $username ] = null;
|
||||||
|
$set_credentials = true;
|
||||||
|
}
|
||||||
|
if ( ! isset( static::$options[ $password ] ) ) {
|
||||||
|
static::$options[ $password ] = null;
|
||||||
|
$set_credentials = true;
|
||||||
|
}
|
||||||
|
if ( ( empty( static::$options[ $username ] ) || empty( static::$options[ $password ] ) ) &&
|
||||||
|
( ( 'bitbucket_username' === $username &&
|
||||||
|
in_array( 'bitbucket', $running_servers, true ) ) ||
|
||||||
|
( 'bitbucket_server_username' === $username &&
|
||||||
|
in_array( 'bbserver', $running_servers, true ) ) )
|
||||||
|
) {
|
||||||
|
Singleton::get_instance( 'Messages', $this )->create_error_message( 'bitbucket' );
|
||||||
|
static::$error_code['bitbucket'] = [ 'code' => 401 ];
|
||||||
|
}
|
||||||
|
if ( $set_credentials ) {
|
||||||
|
add_site_option( 'github_updater', static::$options );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the remote file and parse headers.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param string $file The file.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_info( $file ) {
|
||||||
|
return $this->get_remote_api_info( 'bitbucket', $file, "/2.0/repositories/:owner/:repo/src/:branch/{$file}" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the remote info for tags.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_tag() {
|
||||||
|
return $this->get_remote_api_tag( 'bitbucket', '/2.0/repositories/:owner/:repo/refs/tags' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the remote CHANGES.md file.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param string $changes The changelog filename.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_changes( $changes ) {
|
||||||
|
return $this->get_remote_api_changes( 'bitbucket', $changes, "/2.0/repositories/:owner/:repo/src/:branch/{$changes}" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read and parse remote readme.txt.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_readme() {
|
||||||
|
return $this->get_remote_api_readme( 'bitbucket', '/2.0/repositories/:owner/:repo/src/:branch/readme.txt' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the repository meta from API
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_repo_meta() {
|
||||||
|
return $this->get_remote_api_repo_meta( 'bitbucket', '/2.0/repositories/:owner/:repo' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create array of branches and download links as array.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_branches() {
|
||||||
|
return $this->get_remote_api_branches( 'bitbucket', '/2.0/repositories/:owner/:repo/refs/branches' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the Bitbucket release asset URL.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_release_asset() {
|
||||||
|
return $this->get_api_release_asset( 'bitbucket', '/2.0/repositories/:owner/:repo/downloads' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct $this->type->download_link using Bitbucket API
|
||||||
|
*
|
||||||
|
* @param boolean $branch_switch For direct branch changing. Defaults to false.
|
||||||
|
*
|
||||||
|
* @return string $endpoint
|
||||||
|
*/
|
||||||
|
public function construct_download_link( $branch_switch = false ) {
|
||||||
|
self::$method = 'download_link';
|
||||||
|
$download_link_base = $this->get_api_url( '/:owner/:repo/get/', true );
|
||||||
|
$endpoint = '';
|
||||||
|
|
||||||
|
// Release asset.
|
||||||
|
if ( $this->type->release_asset && '0.0.0' !== $this->type->newest_tag ) {
|
||||||
|
$release_asset = $this->get_release_asset();
|
||||||
|
return $this->get_release_asset_redirect( $release_asset, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If a branch has been given, use branch.
|
||||||
|
* If branch is master (default) and tags are used, use newest tag.
|
||||||
|
*/
|
||||||
|
if ( 'master' !== $this->type->branch || empty( $this->type->tags ) ) {
|
||||||
|
if ( ! empty( $this->type->enterprise_api ) ) {
|
||||||
|
$endpoint = add_query_arg( 'at', $this->type->branch, $endpoint );
|
||||||
|
} else {
|
||||||
|
$endpoint .= $this->type->branch . '.zip';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ( ! empty( $this->type->enterprise_api ) ) {
|
||||||
|
$endpoint = add_query_arg( 'at', $this->type->newest_tag, $endpoint );
|
||||||
|
} else {
|
||||||
|
$endpoint .= $this->type->newest_tag . '.zip';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create endpoint for branch switching.
|
||||||
|
*/
|
||||||
|
if ( $branch_switch ) {
|
||||||
|
if ( ! empty( $this->type->enterprise_api ) ) {
|
||||||
|
$endpoint = add_query_arg( 'at', $branch_switch, $endpoint );
|
||||||
|
} else {
|
||||||
|
$endpoint = $branch_switch . '.zip';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$download_link = $download_link_base . $endpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter download link so developers can point to specific ZipFile
|
||||||
|
* to use as a download link during a branch switch.
|
||||||
|
*
|
||||||
|
* @since 8.8.0
|
||||||
|
*
|
||||||
|
* @param string $download_link Download URL.
|
||||||
|
* @param /stdClass $this->type Repository object.
|
||||||
|
* @param string $branch_switch Branch or tag for rollback or branch switching.
|
||||||
|
*/
|
||||||
|
return apply_filters( 'github_updater_post_construct_download_link', $download_link, $this->type, $branch_switch );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Bitbucket API endpoints.
|
||||||
|
*
|
||||||
|
* @param Bitbucket_API|API $git
|
||||||
|
* @param string $endpoint
|
||||||
|
*
|
||||||
|
* @return string|void $endpoint
|
||||||
|
*/
|
||||||
|
public function add_endpoints( $git, $endpoint ) {
|
||||||
|
switch ( $git::$method ) {
|
||||||
|
case 'file':
|
||||||
|
case 'readme':
|
||||||
|
case 'meta':
|
||||||
|
case 'changes':
|
||||||
|
case 'translation':
|
||||||
|
case 'release_asset':
|
||||||
|
case 'download_link':
|
||||||
|
break;
|
||||||
|
case 'tags':
|
||||||
|
case 'branches':
|
||||||
|
$endpoint = add_query_arg(
|
||||||
|
[
|
||||||
|
'pagelen' => '100',
|
||||||
|
'sort' => '-name',
|
||||||
|
],
|
||||||
|
$endpoint
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$endpoint = $this->add_access_token_endpoint( $git, $endpoint );
|
||||||
|
|
||||||
|
return $endpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response call and return only array of tag numbers.
|
||||||
|
*
|
||||||
|
* @param \stdClass $response Response from API call.
|
||||||
|
*
|
||||||
|
* @return array|\stdClass Array of tag numbers, object is error.
|
||||||
|
*/
|
||||||
|
public function parse_tag_response( $response ) {
|
||||||
|
if ( ! isset( $response->values ) || $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$arr = [];
|
||||||
|
array_map(
|
||||||
|
function ( $e ) use ( &$arr ) {
|
||||||
|
$arr[] = $e->name;
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
},
|
||||||
|
(array) $response->values
|
||||||
|
);
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array of meta variables.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call.
|
||||||
|
*
|
||||||
|
* @return array $arr Array of meta variables.
|
||||||
|
*/
|
||||||
|
public function parse_meta_response( $response ) {
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
$arr = [];
|
||||||
|
$response = [ $response ];
|
||||||
|
|
||||||
|
array_filter(
|
||||||
|
$response,
|
||||||
|
function ( $e ) use ( &$arr ) {
|
||||||
|
$arr['private'] = $e->is_private;
|
||||||
|
$arr['last_updated'] = $e->updated_on;
|
||||||
|
$arr['watchers'] = 0;
|
||||||
|
$arr['forks'] = 0;
|
||||||
|
$arr['open_issues'] = 0;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array with changelog in base64.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call.
|
||||||
|
*
|
||||||
|
* @return array|\stdClass $arr Array of changes in base64, object if error.
|
||||||
|
*/
|
||||||
|
public function parse_changelog_response( $response ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array of branch data.
|
||||||
|
*
|
||||||
|
* @param \stdClass $response API response.
|
||||||
|
*
|
||||||
|
* @return array Array of branch data.
|
||||||
|
*/
|
||||||
|
public function parse_branch_response( $response ) {
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
$branches = [];
|
||||||
|
foreach ( $response as $branch ) {
|
||||||
|
$branches[ $branch->name ]['download'] = $this->construct_download_link( $branch->name );
|
||||||
|
$branches[ $branch->name ]['commit_hash'] = $branch->target->hash;
|
||||||
|
$branches[ $branch->name ]['commit_timestamp'] = $branch->target->date;
|
||||||
|
}
|
||||||
|
return $branches;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse tags and create download links.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call.
|
||||||
|
* @param string $repo_type
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function parse_tags( $response, $repo_type ) {
|
||||||
|
$tags = [];
|
||||||
|
$rollback = [];
|
||||||
|
|
||||||
|
foreach ( (array) $response as $tag ) {
|
||||||
|
// $download_base = implode(
|
||||||
|
// '/',
|
||||||
|
// [
|
||||||
|
// $repo_type['base_download'],
|
||||||
|
// $this->type->owner,
|
||||||
|
// $this->type->owner,
|
||||||
|
// 'get/',
|
||||||
|
// ]
|
||||||
|
// );
|
||||||
|
$download_base = "{$repo_type['base_download']}/{$this->type->owner}/{$this->type->owner}/get/";
|
||||||
|
$tags[] = $tag;
|
||||||
|
$rollback[ $tag ] = $download_base . $tag . '.zip';
|
||||||
|
}
|
||||||
|
|
||||||
|
return [ $tags, $rollback ];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add settings for Bitbucket Username and Password.
|
||||||
|
*
|
||||||
|
* @param array $auth_required
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function add_settings( $auth_required ) {
|
||||||
|
add_settings_section(
|
||||||
|
'bitbucket_user',
|
||||||
|
esc_html__( 'Bitbucket Private Settings', 'github-updater' ),
|
||||||
|
[ $this, 'print_section_bitbucket_username' ],
|
||||||
|
'github_updater_bitbucket_install_settings'
|
||||||
|
);
|
||||||
|
|
||||||
|
add_settings_field(
|
||||||
|
'bitbucket_username',
|
||||||
|
esc_html__( 'Bitbucket Username', 'github-updater' ),
|
||||||
|
[ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ],
|
||||||
|
'github_updater_bitbucket_install_settings',
|
||||||
|
'bitbucket_user',
|
||||||
|
[ 'id' => 'bitbucket_username' ]
|
||||||
|
);
|
||||||
|
|
||||||
|
add_settings_field(
|
||||||
|
'bitbucket_password',
|
||||||
|
esc_html__( 'Bitbucket Password', 'github-updater' ),
|
||||||
|
[ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ],
|
||||||
|
'github_updater_bitbucket_install_settings',
|
||||||
|
'bitbucket_user',
|
||||||
|
[
|
||||||
|
'id' => 'bitbucket_password',
|
||||||
|
'token' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Show section for private Bitbucket repositories.
|
||||||
|
*/
|
||||||
|
if ( $auth_required['bitbucket_private'] ) {
|
||||||
|
add_settings_section(
|
||||||
|
'bitbucket_id',
|
||||||
|
esc_html__( 'Bitbucket Private Repositories', 'github-updater' ),
|
||||||
|
[ $this, 'print_section_bitbucket_info' ],
|
||||||
|
'github_updater_bitbucket_install_settings'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add values for individual repo add_setting_field().
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function add_repo_setting_field() {
|
||||||
|
$setting_field['page'] = 'github_updater_bitbucket_install_settings';
|
||||||
|
$setting_field['section'] = 'bitbucket_id';
|
||||||
|
$setting_field['callback_method'] = [
|
||||||
|
Singleton::get_instance( 'Settings', $this ),
|
||||||
|
'token_callback_checkbox',
|
||||||
|
];
|
||||||
|
|
||||||
|
return $setting_field;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add subtab to Settings page.
|
||||||
|
*/
|
||||||
|
private function add_settings_subtab() {
|
||||||
|
add_filter(
|
||||||
|
'github_updater_add_settings_subtabs',
|
||||||
|
function ( $subtabs ) {
|
||||||
|
return array_merge( $subtabs, [ 'bitbucket' => esc_html__( 'Bitbucket', 'github-updater' ) ] );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print the Bitbucket repo Settings text.
|
||||||
|
*/
|
||||||
|
public function print_section_bitbucket_info() {
|
||||||
|
esc_html_e( 'Check box if private repository. Leave unchecked for public repositories.', 'github-updater' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print the Bitbucket user/pass Settings text.
|
||||||
|
*/
|
||||||
|
public function print_section_bitbucket_username() {
|
||||||
|
esc_html_e( 'Enter your personal Bitbucket username and password.', 'github-updater' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add remote install settings fields.
|
||||||
|
*
|
||||||
|
* @param string $type
|
||||||
|
*/
|
||||||
|
public function add_install_settings_fields( $type ) {
|
||||||
|
if ( ( empty( static::$options['bitbucket_username'] ) ||
|
||||||
|
empty( static::$options['bitbucket_password'] ) ) ||
|
||||||
|
|
||||||
|
( empty( static::$options['bitbucket_server_username'] ) ||
|
||||||
|
empty( static::$options['bitbucket_server_password'] ) )
|
||||||
|
) {
|
||||||
|
add_settings_field(
|
||||||
|
'bitbucket_username',
|
||||||
|
esc_html__( 'Bitbucket Username', 'github-updater' ),
|
||||||
|
[ $this, 'bitbucket_username' ],
|
||||||
|
'github_updater_install_' . $type,
|
||||||
|
$type
|
||||||
|
);
|
||||||
|
|
||||||
|
add_settings_field(
|
||||||
|
'bitbucket_password',
|
||||||
|
esc_html__( 'Bitbucket Password', 'github-updater' ),
|
||||||
|
[ $this, 'bitbucket_password' ],
|
||||||
|
'github_updater_install_' . $type,
|
||||||
|
$type
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
add_settings_field(
|
||||||
|
'is_private',
|
||||||
|
esc_html__( 'Private Bitbucket Repository', 'github-updater' ),
|
||||||
|
[ $this, 'is_private_repo' ],
|
||||||
|
'github_updater_install_' . $type,
|
||||||
|
$type
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setting for private repo for remote install.
|
||||||
|
*/
|
||||||
|
public function is_private_repo() {
|
||||||
|
?>
|
||||||
|
<label for="is_private">
|
||||||
|
<input class="bitbucket_setting" type="checkbox" id="is_private" name="is_private" <?php checked( '1', false ); ?> >
|
||||||
|
<br>
|
||||||
|
<span class="description">
|
||||||
|
<?php esc_html_e( 'Check for private Bitbucket repositories.', 'github-updater' ); ?>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bitbucket username for remote install.
|
||||||
|
*/
|
||||||
|
public function bitbucket_username() {
|
||||||
|
?>
|
||||||
|
<label for="bitbucket_username">
|
||||||
|
<input class="bitbucket_setting" type="text" style="width:50%;" id="bitbucket_username" name="bitbucket_username" value="">
|
||||||
|
<br>
|
||||||
|
<span class="description">
|
||||||
|
<?php esc_html_e( 'Enter Bitbucket username.', 'github-updater' ); ?>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bitbucket password for remote install.
|
||||||
|
*/
|
||||||
|
public function bitbucket_password() {
|
||||||
|
?>
|
||||||
|
<label for="bitbucket_password">
|
||||||
|
<input class="bitbucket_setting" type="password" style="width:50%;" id="bitbucket_password" name="bitbucket_password" value="" autocomplete="new-password">
|
||||||
|
<br>
|
||||||
|
<span class="description">
|
||||||
|
<?php esc_html_e( 'Enter Bitbucket password.', 'github-updater' ); ?>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add remote install feature, create endpoint.
|
||||||
|
*
|
||||||
|
* @param array $headers
|
||||||
|
* @param array $install
|
||||||
|
*
|
||||||
|
* @return mixed $install
|
||||||
|
*/
|
||||||
|
public function remote_install( $headers, $install ) {
|
||||||
|
$bitbucket_org = true;
|
||||||
|
|
||||||
|
if ( 'bitbucket.org' === $headers['host'] || empty( $headers['host'] ) ) {
|
||||||
|
$base = 'https://bitbucket.org';
|
||||||
|
$headers['host'] = 'bitbucket.org';
|
||||||
|
} else {
|
||||||
|
$base = $headers['base_uri'];
|
||||||
|
$bitbucket_org = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $bitbucket_org ) {
|
||||||
|
$install['download_link'] = "{$base}/{$install['github_updater_repo']}/get/{$install['github_updater_branch']}.zip";
|
||||||
|
if ( isset( $install['is_private'] ) ) {
|
||||||
|
$install['options'][ $install['repo'] ] = 1;
|
||||||
|
}
|
||||||
|
if ( ! empty( $install['bitbucket_username'] ) ) {
|
||||||
|
$install['options']['bitbucket_username'] = $install['bitbucket_username'];
|
||||||
|
}
|
||||||
|
if ( ! empty( $install['bitbucket_password'] ) ) {
|
||||||
|
$install['options']['bitbucket_password'] = $install['bitbucket_password'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $install;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,451 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater\API;
|
||||||
|
|
||||||
|
use Fragen\Singleton;
|
||||||
|
use Fragen\GitHub_Updater\API;
|
||||||
|
use Fragen\GitHub_Updater\Readme_Parser;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Bitbucket_Server_API
|
||||||
|
*
|
||||||
|
* Get remote data from a self-hosted Bitbucket Server repo.
|
||||||
|
* Assumes an owner == project_key
|
||||||
|
* Group URI: https://bitbucket.example.com/projects/<owner>/<repo>
|
||||||
|
* User URI: https://bitbucket.example.com/users/<owner>/<repo>
|
||||||
|
*
|
||||||
|
* @link https://docs.atlassian.com/bitbucket-server/rest/5.3.1/bitbucket-rest.html
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @author Bjorn Wijers
|
||||||
|
*/
|
||||||
|
class Bitbucket_Server_API extends Bitbucket_API {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param \stdClass $type
|
||||||
|
*/
|
||||||
|
public function __construct( $type ) {
|
||||||
|
parent::__construct( $type );
|
||||||
|
$this->add_settings_subtab();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the remote file and parse headers.
|
||||||
|
*
|
||||||
|
* @param string $file Filename.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_info( $file ) {
|
||||||
|
return $this->get_remote_api_info( 'bbserver', $file, "/1.0/:owner/repos/:repo/browse/{$file}" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the repository meta from API
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_repo_meta() {
|
||||||
|
return $this->get_remote_api_repo_meta( 'bbserver', '/1.0/:owner/repos/:repo' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the remote info for tags.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_tag() {
|
||||||
|
return $this->get_remote_api_tag( 'bbserver', '/1.0/:owner/repos/:repo/tags' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read and parse remote readme.txt.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_readme() {
|
||||||
|
return $this->get_remote_api_readme( 'bbserver', '/1.0/:owner/repos/:repo/raw/readme.txt' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the remote CHANGES.md file
|
||||||
|
*
|
||||||
|
* @param string $changes Changelog filename.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_changes( $changes ) {
|
||||||
|
return $this->get_remote_api_changes( 'bbserver', $changes, "/1.0/:owner/repos/:repo/raw/{$changes}" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create array of branches and download links as array.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_branches() {
|
||||||
|
return $this->get_remote_api_branches( 'bbserver', '/1.0/:owner/repos/:repo/branches' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the Bitbucket Sever release asset URL.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_release_asset() {
|
||||||
|
// TODO: make this work.
|
||||||
|
// return $this->get_api_release_asset( 'bbserver', '/1.0/:owner/:repo/downloads' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct $this->type->download_link using Bitbucket Server API.
|
||||||
|
*
|
||||||
|
* Downloads requires the official stash-archive plugin which enables
|
||||||
|
* subdirectory support using the prefix query argument.
|
||||||
|
*
|
||||||
|
* @link https://bitbucket.org/atlassian/stash-archive
|
||||||
|
*
|
||||||
|
* @param boolean $branch_switch for direct branch changing.
|
||||||
|
*
|
||||||
|
* @return string $endpoint
|
||||||
|
*/
|
||||||
|
public function construct_download_link( $branch_switch = false ) {
|
||||||
|
self::$method = 'download_link';
|
||||||
|
$download_link_base = $this->get_api_url( '/latest/:owner/repos/:repo/archive', true );
|
||||||
|
$endpoint = $this->add_endpoints( $this, '' );
|
||||||
|
|
||||||
|
if ( $branch_switch ) {
|
||||||
|
$endpoint = urldecode( add_query_arg( 'at', $branch_switch, $endpoint ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $download_link_base . $endpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Bitbucket Server API endpoints.
|
||||||
|
*
|
||||||
|
* @param Bitbucket_Server_API|API $git
|
||||||
|
* @param string $endpoint
|
||||||
|
*
|
||||||
|
* @return string $endpoint
|
||||||
|
*/
|
||||||
|
public function add_endpoints( $git, $endpoint ) {
|
||||||
|
switch ( self::$method ) {
|
||||||
|
case 'meta':
|
||||||
|
case 'translation':
|
||||||
|
case 'branches':
|
||||||
|
break;
|
||||||
|
case 'file':
|
||||||
|
case 'readme':
|
||||||
|
$endpoint = add_query_arg( 'at', $git->type->branch, $endpoint );
|
||||||
|
break;
|
||||||
|
case 'changes':
|
||||||
|
$endpoint = add_query_arg(
|
||||||
|
[
|
||||||
|
'at' => $git->type->branch,
|
||||||
|
'raw' => '',
|
||||||
|
],
|
||||||
|
$endpoint
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'tags':
|
||||||
|
case 'download_link':
|
||||||
|
/*
|
||||||
|
* Add a prefix query argument to create a subdirectory with the same name
|
||||||
|
* as the repo, e.g. 'my-repo' becomes 'my-repo/'
|
||||||
|
* Required for using stash-archive.
|
||||||
|
*/
|
||||||
|
$defaults = [
|
||||||
|
'prefix' => $git->type->slug . '/',
|
||||||
|
'at' => $git->type->branch,
|
||||||
|
'format' => 'zip',
|
||||||
|
];
|
||||||
|
$endpoint = add_query_arg( $defaults, $endpoint );
|
||||||
|
if ( ! empty( $git->type->tags ) ) {
|
||||||
|
$endpoint = urldecode( add_query_arg( 'at', $git->type->newest_tag, $endpoint ) );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $endpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Combines separate text lines from API response into one string with \n line endings.
|
||||||
|
* Code relying on raw text can now parse it.
|
||||||
|
*
|
||||||
|
* @param string|\stdClass|mixed $response
|
||||||
|
*
|
||||||
|
* @return string Combined lines of text returned by API
|
||||||
|
*/
|
||||||
|
protected function bbserver_recombine_response( $response ) {
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
$remote_info_file = '';
|
||||||
|
if ( isset( $response->lines ) ) {
|
||||||
|
foreach ( (array) $response->lines as $line ) {
|
||||||
|
$remote_info_file .= $line->text . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $remote_info_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array of meta variables.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call.
|
||||||
|
*
|
||||||
|
* @return array $arr Array of meta variables.
|
||||||
|
*/
|
||||||
|
public function parse_meta_response( $response ) {
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
$arr = [];
|
||||||
|
$response = [ $response ];
|
||||||
|
|
||||||
|
array_filter(
|
||||||
|
$response,
|
||||||
|
function ( $e ) use ( &$arr ) {
|
||||||
|
$arr['private'] = ! $e->public;
|
||||||
|
$arr['last_updated'] = null;
|
||||||
|
$arr['watchers'] = 0;
|
||||||
|
$arr['forks'] = 0;
|
||||||
|
$arr['open_issues'] = 0;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array with changelog.
|
||||||
|
*
|
||||||
|
* @param string $response Response from API call.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function parse_changelog_response( $response ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return object with readme body.
|
||||||
|
*
|
||||||
|
* @param string|\stdClass $response
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function parse_readme_response( $response ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array of branch data.
|
||||||
|
*
|
||||||
|
* @param \stdClass $response API response.
|
||||||
|
*
|
||||||
|
* @return array Array of branch data.
|
||||||
|
*/
|
||||||
|
public function parse_branch_response( $response ) {
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
$branches = [];
|
||||||
|
foreach ( $response as $branch ) {
|
||||||
|
$branches[ $branch->displayId ]['download'] = $this->construct_download_link( $branch->displayId );
|
||||||
|
$branches[ $branch->displayId ]['commit_hash'] = $branch->latestCommit;
|
||||||
|
}
|
||||||
|
return $branches;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response call and return only array of tag numbers.
|
||||||
|
*
|
||||||
|
* @param \stdClass $response Response from API call.
|
||||||
|
*
|
||||||
|
* @return array|\stdClass Array of tag numbers, object is error.
|
||||||
|
*/
|
||||||
|
public function parse_tag_response( $response ) {
|
||||||
|
if ( ! isset( $response->values ) || $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$arr = [];
|
||||||
|
array_map(
|
||||||
|
function ( $e ) use ( &$arr ) {
|
||||||
|
$arr[] = $e->displayId;
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
},
|
||||||
|
(array) $response->values
|
||||||
|
);
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse tags and create download links.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call.
|
||||||
|
* @param string $repo_type
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function parse_tags( $response, $repo_type ) {
|
||||||
|
$tags = [];
|
||||||
|
$rollback = [];
|
||||||
|
|
||||||
|
foreach ( (array) $response as $tag ) {
|
||||||
|
$download_base = "{$repo_type['base_uri']}/latest/{$this->type->owner}/repos/{$this->type->slug}/archive";
|
||||||
|
$download_base = $this->add_endpoints( $this, $download_base );
|
||||||
|
$tags[] = $tag;
|
||||||
|
$rollback[ $tag ] = add_query_arg( 'at', $tag, $download_base );
|
||||||
|
}
|
||||||
|
|
||||||
|
return [ $tags, $rollback ];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add settings for Bitbucket Server Username and Password.
|
||||||
|
*
|
||||||
|
* @param array $auth_required
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function add_settings( $auth_required ) {
|
||||||
|
add_settings_section(
|
||||||
|
'bitbucket_server_user',
|
||||||
|
esc_html__( 'Bitbucket Server Private Settings', 'github-updater' ),
|
||||||
|
[ $this, 'print_section_bitbucket_username' ],
|
||||||
|
'github_updater_bbserver_install_settings'
|
||||||
|
);
|
||||||
|
|
||||||
|
add_settings_field(
|
||||||
|
'bitbucket_server_username',
|
||||||
|
esc_html__( 'Bitbucket Server Username', 'github-updater' ),
|
||||||
|
[ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ],
|
||||||
|
'github_updater_bbserver_install_settings',
|
||||||
|
'bitbucket_server_user',
|
||||||
|
[ 'id' => 'bitbucket_server_username' ]
|
||||||
|
);
|
||||||
|
|
||||||
|
add_settings_field(
|
||||||
|
'bitbucket_server_password',
|
||||||
|
esc_html__( 'Bitbucket Server Password', 'github-updater' ),
|
||||||
|
[ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ],
|
||||||
|
'github_updater_bbserver_install_settings',
|
||||||
|
'bitbucket_server_user',
|
||||||
|
[
|
||||||
|
'id' => 'bitbucket_server_password',
|
||||||
|
'token' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Show section for private Bitbucket Server repositories.
|
||||||
|
*/
|
||||||
|
if ( $auth_required['bitbucket_server'] ) {
|
||||||
|
add_settings_section(
|
||||||
|
'bitbucket_server_id',
|
||||||
|
esc_html__( 'Bitbucket Server Private Repositories', 'github-updater' ),
|
||||||
|
[ $this, 'print_section_bitbucket_info' ],
|
||||||
|
'github_updater_bbserver_install_settings'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add values for individual repo add_setting_field().
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function add_repo_setting_field() {
|
||||||
|
$setting_field['page'] = 'github_updater_bbserver_install_settings';
|
||||||
|
$setting_field['section'] = 'bitbucket_server_id';
|
||||||
|
$setting_field['callback_method'] = [
|
||||||
|
Singleton::get_instance( 'Settings', $this ),
|
||||||
|
'token_callback_checkbox',
|
||||||
|
];
|
||||||
|
|
||||||
|
return $setting_field;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add subtab to Settings page.
|
||||||
|
*/
|
||||||
|
private function add_settings_subtab() {
|
||||||
|
add_filter(
|
||||||
|
'github_updater_add_settings_subtabs',
|
||||||
|
function ( $subtabs ) {
|
||||||
|
return array_merge( $subtabs, [ 'bbserver' => esc_html__( 'Bitbucket Server', 'github-updater' ) ] );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add remote install feature, create endpoint.
|
||||||
|
*
|
||||||
|
* @param array $headers
|
||||||
|
* @param array $install
|
||||||
|
*
|
||||||
|
* @return array $install
|
||||||
|
*/
|
||||||
|
public function remote_install( $headers, $install ) {
|
||||||
|
$bitbucket_org = true;
|
||||||
|
|
||||||
|
if ( 'bitbucket.org' === $headers['host'] || empty( $headers['host'] ) ) {
|
||||||
|
$base = 'https://bitbucket.org';
|
||||||
|
$headers['host'] = 'bitbucket.org';
|
||||||
|
} else {
|
||||||
|
$base = $headers['base_uri'];
|
||||||
|
$bitbucket_org = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $bitbucket_org ) {
|
||||||
|
$install['download_link'] = "{$base}/rest/api/latest/{$headers['owner']}/repos/{$headers['repo']}/archive";
|
||||||
|
|
||||||
|
$install['download_link'] = add_query_arg(
|
||||||
|
[
|
||||||
|
'prefix' => $headers['repo'] . '/',
|
||||||
|
'at' => $install['github_updater_branch'],
|
||||||
|
'format' => 'zip',
|
||||||
|
],
|
||||||
|
$install['download_link']
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( isset( $install['is_private'] ) ) {
|
||||||
|
$install['options'][ $install['repo'] ] = 1;
|
||||||
|
}
|
||||||
|
if ( ! empty( $install['bitbucket_username'] ) ) {
|
||||||
|
$install['options']['bitbucket_server_username'] = $install['bitbucket_username'];
|
||||||
|
}
|
||||||
|
if ( ! empty( $install['bitbucket_password'] ) ) {
|
||||||
|
$install['options']['bitbucket_server_password'] = $install['bitbucket_password'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $install;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,549 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater\API;
|
||||||
|
|
||||||
|
use Fragen\Singleton;
|
||||||
|
use Fragen\GitHub_Updater\API;
|
||||||
|
use Fragen\GitHub_Updater\Branch;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GitHub_API
|
||||||
|
*
|
||||||
|
* Get remote data from a GitHub repo.
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
*/
|
||||||
|
class GitHub_API extends API implements API_Interface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param \stdClass $type
|
||||||
|
*/
|
||||||
|
public function __construct( $type ) {
|
||||||
|
parent::__construct();
|
||||||
|
$this->type = $type;
|
||||||
|
$this->response = $this->get_repo_cache();
|
||||||
|
$branch = new Branch( $this->response );
|
||||||
|
if ( ! empty( $type->branch ) ) {
|
||||||
|
$this->type->branch = ! empty( $branch->cache['current_branch'] )
|
||||||
|
? $branch->cache['current_branch']
|
||||||
|
: $type->branch;
|
||||||
|
}
|
||||||
|
$this->settings_hook( $this );
|
||||||
|
$this->add_settings_subtab();
|
||||||
|
$this->add_install_fields( $this );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the remote file and parse headers.
|
||||||
|
*
|
||||||
|
* @param string $file Filename.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_info( $file ) {
|
||||||
|
return $this->get_remote_api_info( 'github', $file, "/repos/:owner/:repo/contents/{$file}" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get remote info for tags.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_tag() {
|
||||||
|
return $this->get_remote_api_tag( 'github', '/repos/:owner/:repo/tags' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the remote CHANGES.md file.
|
||||||
|
*
|
||||||
|
* @param string $changes Changelog filename.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_changes( $changes ) {
|
||||||
|
return $this->get_remote_api_changes( 'github', $changes, "/repos/:owner/:repo/contents/{$changes}" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read and parse remote readme.txt.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_readme() {
|
||||||
|
$this->get_remote_api_readme( 'github', '/repos/:owner/:repo/contents/readme.txt' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the repository meta from API.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_repo_meta() {
|
||||||
|
return $this->get_remote_api_repo_meta( 'github', '/repos/:owner/:repo' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create array of branches and download links as array.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_branches() {
|
||||||
|
return $this->get_remote_api_branches( 'github', '/repos/:owner/:repo/branches' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the GitHub release asset URL.
|
||||||
|
*
|
||||||
|
* @return string|bool
|
||||||
|
*/
|
||||||
|
public function get_release_asset() {
|
||||||
|
return $this->get_api_release_asset( 'github', '/repos/:owner/:repo/releases/latest' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct $this->type->download_link using Repository Contents API.
|
||||||
|
*
|
||||||
|
* @url http://developer.github.com/v3/repos/contents/#get-archive-link
|
||||||
|
*
|
||||||
|
* @param boolean $branch_switch for direct branch changing.
|
||||||
|
*
|
||||||
|
* @return string $endpoint
|
||||||
|
*/
|
||||||
|
public function construct_download_link( $branch_switch = false ) {
|
||||||
|
self::$method = 'download_link';
|
||||||
|
$download_link_base = $this->get_api_url( '/repos/:owner/:repo/zipball/', true );
|
||||||
|
$endpoint = '';
|
||||||
|
|
||||||
|
// Release asset.
|
||||||
|
if ( $this->type->release_asset && '0.0.0' !== $this->type->newest_tag ) {
|
||||||
|
$release_asset = $this->get_release_asset();
|
||||||
|
if ( property_exists( $this->type, 'is_private' ) && $this->type->is_private ) {
|
||||||
|
return $this->get_release_asset_redirect( $release_asset, true );
|
||||||
|
}
|
||||||
|
return $release_asset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If a branch has been given, use branch.
|
||||||
|
* If branch is master (default) and tags are used, use newest tag.
|
||||||
|
*/
|
||||||
|
if ( 'master' !== $this->type->branch || empty( $this->type->tags ) ) {
|
||||||
|
$endpoint .= $this->type->branch;
|
||||||
|
} else {
|
||||||
|
$endpoint .= $this->type->newest_tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create endpoint for branch switching.
|
||||||
|
if ( $branch_switch ) {
|
||||||
|
$endpoint = $branch_switch;
|
||||||
|
}
|
||||||
|
|
||||||
|
$endpoint = $this->add_access_token_endpoint( $this, $endpoint );
|
||||||
|
$download_link = $download_link_base . $endpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter download link so developers can point to specific ZipFile
|
||||||
|
* to use as a download link during a branch switch.
|
||||||
|
*
|
||||||
|
* @since 8.8.0
|
||||||
|
*
|
||||||
|
* @param string $download_link Download URL.
|
||||||
|
* @param /stdClass $this->type Repository object.
|
||||||
|
* @param string $branch_switch Branch or tag for rollback or branch switching.
|
||||||
|
*/
|
||||||
|
return apply_filters( 'github_updater_post_construct_download_link', $download_link, $this->type, $branch_switch );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create GitHub API endpoints.
|
||||||
|
*
|
||||||
|
* @param GitHub_API|API $git
|
||||||
|
* @param string $endpoint
|
||||||
|
*
|
||||||
|
* @return string $endpoint
|
||||||
|
*/
|
||||||
|
public function add_endpoints( $git, $endpoint ) {
|
||||||
|
switch ( $git::$method ) {
|
||||||
|
case 'file':
|
||||||
|
case 'readme':
|
||||||
|
case 'changes':
|
||||||
|
$endpoint = add_query_arg( 'ref', $git->type->branch, $endpoint );
|
||||||
|
break;
|
||||||
|
case 'meta':
|
||||||
|
case 'tags':
|
||||||
|
case 'download_link':
|
||||||
|
case 'release_asset':
|
||||||
|
case 'translation':
|
||||||
|
break;
|
||||||
|
case 'branches':
|
||||||
|
$endpoint = add_query_arg( 'per_page', '100', $endpoint );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$endpoint = $this->add_access_token_endpoint( $git, $endpoint );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If GitHub Enterprise return this endpoint.
|
||||||
|
*/
|
||||||
|
if ( ! empty( $git->type->enterprise_api ) ) {
|
||||||
|
return $git->type->enterprise_api . $endpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $endpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate and store time until rate limit reset.
|
||||||
|
*
|
||||||
|
* @param array $response HTTP headers.
|
||||||
|
* @param string $repo Repo name.
|
||||||
|
*/
|
||||||
|
public static function ratelimit_reset( $response, $repo ) {
|
||||||
|
if ( isset( $response['headers']['x-ratelimit-reset'] ) ) {
|
||||||
|
$reset = (int) $response['headers']['x-ratelimit-reset'];
|
||||||
|
$wait = date( 'i', $reset - time() );
|
||||||
|
static::$error_code[ $repo ] = array_merge(
|
||||||
|
static::$error_code[ $repo ],
|
||||||
|
[
|
||||||
|
'git' => 'github',
|
||||||
|
'wait' => $wait,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response call and return only array of tag numbers.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call.
|
||||||
|
*
|
||||||
|
* @return \stdClass|array $arr Array of tag numbers, object is error.
|
||||||
|
*/
|
||||||
|
public function parse_tag_response( $response ) {
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$arr = [];
|
||||||
|
array_map(
|
||||||
|
function ( $e ) use ( &$arr ) {
|
||||||
|
$arr[] = $e->name;
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
},
|
||||||
|
(array) $response
|
||||||
|
);
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array of meta variables.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call.
|
||||||
|
*
|
||||||
|
* @return array $arr Array of meta variables.
|
||||||
|
*/
|
||||||
|
public function parse_meta_response( $response ) {
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
$arr = [];
|
||||||
|
$response = [ $response ];
|
||||||
|
|
||||||
|
array_filter(
|
||||||
|
$response,
|
||||||
|
function ( $e ) use ( &$arr ) {
|
||||||
|
$arr['private'] = $e->private;
|
||||||
|
$arr['last_updated'] = $e->pushed_at;
|
||||||
|
$arr['watchers'] = $e->watchers;
|
||||||
|
$arr['forks'] = $e->forks;
|
||||||
|
$arr['open_issues'] = $e->open_issues;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array with changelog in base64.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call.
|
||||||
|
*
|
||||||
|
* @return array $arr Array of changes in base64.
|
||||||
|
*/
|
||||||
|
public function parse_changelog_response( $response ) {
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
$arr = [];
|
||||||
|
$response = [ $response ];
|
||||||
|
|
||||||
|
array_filter(
|
||||||
|
$response,
|
||||||
|
function ( $e ) use ( &$arr ) {
|
||||||
|
$arr['changes'] = $e->content;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array of branch data.
|
||||||
|
*
|
||||||
|
* @param \stdClass $response API response.
|
||||||
|
*
|
||||||
|
* @return array Array of branch data.
|
||||||
|
*/
|
||||||
|
public function parse_branch_response( $response ) {
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
$branches = [];
|
||||||
|
foreach ( $response as $branch ) {
|
||||||
|
$branches[ $branch->name ]['download'] = $this->construct_download_link( $branch->name );
|
||||||
|
$branches[ $branch->name ]['commit_hash'] = $branch->commit->sha;
|
||||||
|
$branches[ $branch->name ]['commit_api'] = $branch->commit->url;
|
||||||
|
}
|
||||||
|
return $branches;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse tags and create download links.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call.
|
||||||
|
* @param array $repo_type
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function parse_tags( $response, $repo_type ) {
|
||||||
|
$tags = [];
|
||||||
|
$rollback = [];
|
||||||
|
|
||||||
|
foreach ( (array) $response as $tag ) {
|
||||||
|
$download_base = implode(
|
||||||
|
'/',
|
||||||
|
[
|
||||||
|
$repo_type['base_uri'],
|
||||||
|
'repos',
|
||||||
|
$this->type->owner,
|
||||||
|
$this->type->slug,
|
||||||
|
'zipball/',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$tags[] = $tag;
|
||||||
|
$rollback[ $tag ] = $download_base . $tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [ $tags, $rollback ];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add settings for GitHub Personal Access Token.
|
||||||
|
*
|
||||||
|
* @param array $auth_required
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function add_settings( $auth_required ) {
|
||||||
|
add_settings_section(
|
||||||
|
'github_access_token',
|
||||||
|
esc_html__( 'GitHub Personal Access Token', 'github-updater' ),
|
||||||
|
[ $this, 'print_section_github_access_token' ],
|
||||||
|
'github_updater_github_install_settings'
|
||||||
|
);
|
||||||
|
|
||||||
|
add_settings_field(
|
||||||
|
'github_access_token',
|
||||||
|
esc_html__( 'GitHub.com Access Token', 'github-updater' ),
|
||||||
|
[ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ],
|
||||||
|
'github_updater_github_install_settings',
|
||||||
|
'github_access_token',
|
||||||
|
[
|
||||||
|
'id' => 'github_access_token',
|
||||||
|
'token' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( $auth_required['github_enterprise'] ) {
|
||||||
|
add_settings_field(
|
||||||
|
'github_enterprise_token',
|
||||||
|
esc_html__( 'GitHub Enterprise Access Token', 'github-updater' ),
|
||||||
|
[ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ],
|
||||||
|
'github_updater_github_install_settings',
|
||||||
|
'github_access_token',
|
||||||
|
[
|
||||||
|
'id' => 'github_enterprise_token',
|
||||||
|
'token' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Show section for private GitHub repositories.
|
||||||
|
*/
|
||||||
|
if ( $auth_required['github_private'] || $auth_required['github_enterprise'] ) {
|
||||||
|
add_settings_section(
|
||||||
|
'github_id',
|
||||||
|
esc_html__( 'GitHub Private Settings', 'github-updater' ),
|
||||||
|
[ $this, 'print_section_github_info' ],
|
||||||
|
'github_updater_github_install_settings'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add values for individual repo add_setting_field().
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function add_repo_setting_field() {
|
||||||
|
$setting_field['page'] = 'github_updater_github_install_settings';
|
||||||
|
$setting_field['section'] = 'github_id';
|
||||||
|
$setting_field['callback_method'] = [
|
||||||
|
Singleton::get_instance( 'Settings', $this ),
|
||||||
|
'token_callback_text',
|
||||||
|
];
|
||||||
|
|
||||||
|
return $setting_field;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print the GitHub text.
|
||||||
|
*/
|
||||||
|
public function print_section_github_info() {
|
||||||
|
esc_html_e( 'Enter your GitHub Access Token. Leave empty for public repositories.', 'github-updater' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print the GitHub Personal Access Token text.
|
||||||
|
*/
|
||||||
|
public function print_section_github_access_token() {
|
||||||
|
esc_html_e( 'Enter your personal GitHub.com or GitHub Enterprise Access Token to avoid API access limits.', 'github-updater' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add remote install settings fields.
|
||||||
|
*
|
||||||
|
* @param string $type plugin|theme.
|
||||||
|
*/
|
||||||
|
public function add_install_settings_fields( $type ) {
|
||||||
|
add_settings_field(
|
||||||
|
'github_access_token',
|
||||||
|
esc_html__( 'GitHub Access Token', 'github-updater' ),
|
||||||
|
[ $this, 'github_access_token' ],
|
||||||
|
'github_updater_install_' . $type,
|
||||||
|
$type
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add subtab to Settings page.
|
||||||
|
*/
|
||||||
|
private function add_settings_subtab() {
|
||||||
|
add_filter(
|
||||||
|
'github_updater_add_settings_subtabs',
|
||||||
|
function ( $subtabs ) {
|
||||||
|
return array_merge( $subtabs, [ 'github' => esc_html__( 'GitHub', 'github-updater' ) ] );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GitHub Access Token for remote install.
|
||||||
|
*/
|
||||||
|
public function github_access_token() {
|
||||||
|
?>
|
||||||
|
<label for="github_access_token">
|
||||||
|
<input class="github_setting" type="password" style="width:50%;" id="github_access_token" name="github_access_token" value="" autocomplete="new-password">
|
||||||
|
<br>
|
||||||
|
<span class="description">
|
||||||
|
<?php esc_html_e( 'Enter GitHub Access Token for private GitHub repositories.', 'github-updater' ); ?>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add remote install feature, create endpoint.
|
||||||
|
*
|
||||||
|
* @param array $headers
|
||||||
|
* @param array $install
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function remote_install( $headers, $install ) {
|
||||||
|
$github_com = true;
|
||||||
|
$options['github_access_token'] = isset( static::$options['github_access_token'] ) ? static::$options['github_access_token'] : null;
|
||||||
|
$options['github_enterprise_token'] = isset( static::$options['github_enterprise_token'] ) ? static::$options['github_enterprise_token'] : null;
|
||||||
|
|
||||||
|
if ( 'github.com' === $headers['host'] || empty( $headers['host'] ) ) {
|
||||||
|
$base = 'https://api.github.com';
|
||||||
|
$headers['host'] = 'github.com';
|
||||||
|
} else {
|
||||||
|
$base = $headers['base_uri'] . '/api/v3';
|
||||||
|
$github_com = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$install['download_link'] = "{$base}/repos/{$install['github_updater_repo']}/zipball/{$install['github_updater_branch']}";
|
||||||
|
|
||||||
|
// If asset is entered install it.
|
||||||
|
if ( false !== stripos( $headers['uri'], 'releases/download' ) ) {
|
||||||
|
$install['download_link'] = $headers['uri'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add/Save access token if present.
|
||||||
|
*/
|
||||||
|
if ( ! empty( $install['github_access_token'] ) ) {
|
||||||
|
$install['options'][ $install['repo'] ] = $install['github_access_token'];
|
||||||
|
if ( $github_com ) {
|
||||||
|
$install['options']['github_access_token'] = $install['github_access_token'];
|
||||||
|
} else {
|
||||||
|
$install['options']['github_enterprise_token'] = $install['github_access_token'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( $github_com ) {
|
||||||
|
$token = ! empty( $install['options']['github_access_token'] )
|
||||||
|
? $install['options']['github_access_token']
|
||||||
|
: $options['github_access_token'];
|
||||||
|
} else {
|
||||||
|
$token = ! empty( $install['options']['github_enterprise_token'] )
|
||||||
|
? $install['options']['github_enterprise_token']
|
||||||
|
: $options['github_enterprise_token'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( $token ) ) {
|
||||||
|
$install['download_link'] = add_query_arg( 'access_token', $token, $install['download_link'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( static::$options['github_access_token'] ) ) {
|
||||||
|
unset( $install['options']['github_access_token'] );
|
||||||
|
}
|
||||||
|
if ( ! empty( static::$options['github_enterprise_token'] ) ) {
|
||||||
|
unset( $install['options']['github_enterprise_token'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $install;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,645 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater\API;
|
||||||
|
|
||||||
|
use Fragen\Singleton;
|
||||||
|
use Fragen\GitHub_Updater\API;
|
||||||
|
use Fragen\GitHub_Updater\Branch;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GitLab_API
|
||||||
|
*
|
||||||
|
* Get remote data from a GitLab repo.
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
*/
|
||||||
|
class GitLab_API extends API implements API_Interface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param \stdClass $type
|
||||||
|
*/
|
||||||
|
public function __construct( $type ) {
|
||||||
|
parent::__construct();
|
||||||
|
$this->type = $type;
|
||||||
|
$this->response = $this->get_repo_cache();
|
||||||
|
$branch = new Branch( $this->response );
|
||||||
|
if ( ! empty( $type->branch ) ) {
|
||||||
|
$this->type->branch = ! empty( $branch->cache['current_branch'] )
|
||||||
|
? $branch->cache['current_branch']
|
||||||
|
: $type->branch;
|
||||||
|
}
|
||||||
|
$this->set_default_credentials();
|
||||||
|
$this->settings_hook( $this );
|
||||||
|
$this->add_settings_subtab();
|
||||||
|
$this->add_install_fields( $this );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set default credentials if option not set.
|
||||||
|
*/
|
||||||
|
protected function set_default_credentials() {
|
||||||
|
$running_servers = Singleton::get_instance( 'Base', $this )->get_running_git_servers();
|
||||||
|
$set_credentials = false;
|
||||||
|
if ( ! isset( static::$options['gitlab_access_token'] ) ) {
|
||||||
|
static::$options['gitlab_access_token'] = null;
|
||||||
|
$set_credentials = true;
|
||||||
|
}
|
||||||
|
if ( ! isset( static::$options['gitlab_enterprise_token'] ) ) {
|
||||||
|
static::$options['gitlab_enterprise_token'] = null;
|
||||||
|
$set_credentials = true;
|
||||||
|
}
|
||||||
|
if ( ( empty( static::$options['gitlab_enterprise_token'] ) &&
|
||||||
|
in_array( 'gitlabce', $running_servers, true ) ) ||
|
||||||
|
( empty( static::$options['gitlab_access_token'] ) &&
|
||||||
|
in_array( 'gitlab', $running_servers, true ) )
|
||||||
|
) {
|
||||||
|
$this->gitlab_error_notices();
|
||||||
|
}
|
||||||
|
if ( $set_credentials ) {
|
||||||
|
add_site_option( 'github_updater', static::$options );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the remote file and parse headers.
|
||||||
|
*
|
||||||
|
* @param string $file Filename.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_info( $file ) {
|
||||||
|
$id = $this->get_gitlab_id();
|
||||||
|
return $this->get_remote_api_info( 'gitlab', $file, "/projects/{$id}/repository/files/{$file}" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get remote info for tags.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_tag() {
|
||||||
|
$id = $this->get_gitlab_id();
|
||||||
|
return $this->get_remote_api_tag( 'gitlab', "/projects/{$id}/repository/tags" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the remote CHANGES.md file.
|
||||||
|
*
|
||||||
|
* @param string $changes Changelog filename.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_changes( $changes ) {
|
||||||
|
$id = $this->get_gitlab_id();
|
||||||
|
return $this->get_remote_api_changes( 'gitlab', $changes, "/projects/{$id}/repository/files/{$changes}" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read and parse remote readme.txt.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_readme() {
|
||||||
|
$id = $this->get_gitlab_id();
|
||||||
|
return $this->get_remote_api_readme( 'gitlab', "/projects/{$id}/repository/files/readme.txt" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the repository meta from API.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_repo_meta() {
|
||||||
|
$response = isset( $this->response['meta'] ) ? $this->response['meta'] : false;
|
||||||
|
|
||||||
|
if ( ! $response ) {
|
||||||
|
self::$method = 'meta';
|
||||||
|
$project = isset( $this->response['project'] ) ? $this->response['project'] : false;
|
||||||
|
|
||||||
|
// exit if transient is empty.
|
||||||
|
if ( ! $project ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = ( $this->type->slug === $project->path ) ? $project : false;
|
||||||
|
|
||||||
|
if ( $response ) {
|
||||||
|
$response = $this->parse_meta_response( $response );
|
||||||
|
$this->set_repo_cache( 'meta', $response );
|
||||||
|
$this->set_repo_cache( 'project', null );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->type->repo_meta = $response;
|
||||||
|
$this->add_meta_repo_object();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create array of branches and download links as array.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_branches() {
|
||||||
|
$id = $this->get_gitlab_id();
|
||||||
|
return $this->get_remote_api_branches( 'gitlab', "/projects/{$id}/repository/branches" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get GitLab release asset download link.
|
||||||
|
*
|
||||||
|
* @return string|bool
|
||||||
|
*/
|
||||||
|
public function get_release_asset() {
|
||||||
|
return $this->get_api_release_asset( 'gitlab', "/projects/{$this->response['project_id']}/jobs/artifacts/{$this->type->newest_tag}/download" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct $this->type->download_link using GitLab API v4.
|
||||||
|
*
|
||||||
|
* @param boolean $branch_switch for direct branch changing.
|
||||||
|
*
|
||||||
|
* @return string $endpoint
|
||||||
|
*/
|
||||||
|
public function construct_download_link( $branch_switch = false ) {
|
||||||
|
self::$method = 'download_link';
|
||||||
|
$download_link_base = $this->get_api_url( "/projects/{$this->get_gitlab_id()}/repository/archive.zip" );
|
||||||
|
$download_link_base = remove_query_arg( 'private_token', $download_link_base );
|
||||||
|
|
||||||
|
$endpoint = '';
|
||||||
|
$endpoint = add_query_arg( 'sha', $this->type->branch, $endpoint );
|
||||||
|
|
||||||
|
// Release asset.
|
||||||
|
if ( $this->type->ci_job && '0.0.0' !== $this->type->newest_tag ) {
|
||||||
|
$release_asset = $this->get_release_asset();
|
||||||
|
return $release_asset;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If branch is master (default) and tags are used, use newest tag.
|
||||||
|
if ( 'master' === $this->type->branch && ! empty( $this->type->tags ) ) {
|
||||||
|
$endpoint = add_query_arg( 'sha', $this->type->newest_tag, $endpoint );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create endpoint for branch switching.
|
||||||
|
if ( $branch_switch ) {
|
||||||
|
$endpoint = add_query_arg( 'sha', $branch_switch, $endpoint );
|
||||||
|
}
|
||||||
|
|
||||||
|
$endpoint = $this->add_access_token_endpoint( $this, $endpoint );
|
||||||
|
$download_link = $download_link_base . $endpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter download link so developers can point to specific ZipFile
|
||||||
|
* to use as a download link during a branch switch.
|
||||||
|
*
|
||||||
|
* @since 8.8.0
|
||||||
|
*
|
||||||
|
* @param string $download_link Download URL.
|
||||||
|
* @param /stdClass $this->type Repository object.
|
||||||
|
* @param string $branch_switch Branch or tag for rollback or branch switching.
|
||||||
|
*/
|
||||||
|
return apply_filters( 'github_updater_post_construct_download_link', $download_link, $this->type, $branch_switch );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create GitLab API endpoints.
|
||||||
|
*
|
||||||
|
* @param GitLab_API|API $git
|
||||||
|
* @param string $endpoint
|
||||||
|
*
|
||||||
|
* @return string $endpoint
|
||||||
|
*/
|
||||||
|
public function add_endpoints( $git, $endpoint ) {
|
||||||
|
switch ( $git::$method ) {
|
||||||
|
case 'projects':
|
||||||
|
$endpoint = add_query_arg( 'per_page', '100', $endpoint );
|
||||||
|
break;
|
||||||
|
case 'meta':
|
||||||
|
case 'tags':
|
||||||
|
case 'branches':
|
||||||
|
case 'download_link':
|
||||||
|
break;
|
||||||
|
case 'file':
|
||||||
|
case 'changes':
|
||||||
|
case 'readme':
|
||||||
|
$endpoint = add_query_arg( 'ref', $git->type->branch, $endpoint );
|
||||||
|
break;
|
||||||
|
case 'translation':
|
||||||
|
$endpoint = add_query_arg( 'ref', 'master', $endpoint );
|
||||||
|
break;
|
||||||
|
case 'release_asset':
|
||||||
|
$endpoint = add_query_arg( 'job', $git->type->ci_job, $endpoint );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$endpoint = $this->add_access_token_endpoint( $git, $endpoint );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If GitLab CE/Enterprise return this endpoint.
|
||||||
|
*/
|
||||||
|
if ( ! empty( $git->type->enterprise_api ) ) {
|
||||||
|
return $git->type->enterprise_api . $endpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $endpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get GitLab project ID and project meta.
|
||||||
|
*
|
||||||
|
* @return string|int
|
||||||
|
*/
|
||||||
|
public function get_gitlab_id() {
|
||||||
|
$id = null;
|
||||||
|
$response = isset( $this->response['project_id'] ) ? $this->response['project_id'] : false;
|
||||||
|
|
||||||
|
if ( ! $response ) {
|
||||||
|
self::$method = 'projects';
|
||||||
|
$id = implode( '/', [ $this->type->owner, $this->type->slug ] );
|
||||||
|
$id = rawurlencode( $id );
|
||||||
|
$response = $this->api( '/projects/' . $id );
|
||||||
|
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $response && $this->type->slug === $response->path ) {
|
||||||
|
$id = $response->id;
|
||||||
|
$this->set_repo_cache( 'project_id', $id );
|
||||||
|
$this->set_repo_cache( 'project', $response );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response call and return only array of tag numbers.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call for tags.
|
||||||
|
*
|
||||||
|
* @return \stdClass|array Array of tag numbers, object is error.
|
||||||
|
*/
|
||||||
|
public function parse_tag_response( $response ) {
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$arr = [];
|
||||||
|
array_map(
|
||||||
|
function ( $e ) use ( &$arr ) {
|
||||||
|
$arr[] = $e->name;
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
},
|
||||||
|
(array) $response
|
||||||
|
);
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array of meta variables.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call.
|
||||||
|
*
|
||||||
|
* @return array $arr Array of meta variables.
|
||||||
|
*/
|
||||||
|
public function parse_meta_response( $response ) {
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
$arr = [];
|
||||||
|
$response = [ $response ];
|
||||||
|
|
||||||
|
array_filter(
|
||||||
|
$response,
|
||||||
|
function ( $e ) use ( &$arr ) {
|
||||||
|
$arr['private'] = isset( $e->visibility ) && 'private' === $e->visibility ? true : false;
|
||||||
|
$arr['private'] = isset( $e->public ) ? ! $e->public : $arr['private'];
|
||||||
|
$arr['last_updated'] = $e->last_activity_at;
|
||||||
|
$arr['watchers'] = 0;
|
||||||
|
$arr['forks'] = $e->forks_count;
|
||||||
|
$arr['open_issues'] = isset( $e->open_issues_count ) ? $e->open_issues_count : 0;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array with changelog in base64.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call.
|
||||||
|
*
|
||||||
|
* @return array|\stdClass $arr Array of changes in base64, object if error.
|
||||||
|
*/
|
||||||
|
public function parse_changelog_response( $response ) {
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$arr = [];
|
||||||
|
$response = [ $response ];
|
||||||
|
|
||||||
|
array_filter(
|
||||||
|
$response,
|
||||||
|
function ( $e ) use ( &$arr ) {
|
||||||
|
$arr['changes'] = $e->content;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array of branch data.
|
||||||
|
*
|
||||||
|
* @param \stdClass $response API response.
|
||||||
|
*
|
||||||
|
* @return array Array of branch data.
|
||||||
|
*/
|
||||||
|
public function parse_branch_response( $response ) {
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
$branches = [];
|
||||||
|
foreach ( $response as $branch ) {
|
||||||
|
$branches[ $branch->name ]['download'] = $this->construct_download_link( $branch->name );
|
||||||
|
$branches[ $branch->name ]['commit_hash'] = $branch->commit->id;
|
||||||
|
$branches[ $branch->name ]['commit_timestamp'] = $branch->commit->committed_date;
|
||||||
|
}
|
||||||
|
return $branches;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse tags and create download links.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call.
|
||||||
|
* @param array $repo_type
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function parse_tags( $response, $repo_type ) {
|
||||||
|
$tags = [];
|
||||||
|
$rollback = [];
|
||||||
|
|
||||||
|
foreach ( (array) $response as $tag ) {
|
||||||
|
$download_link = "/projects/{$this->get_gitlab_id()}/repository/archive.zip";
|
||||||
|
$download_link = $this->get_api_url( $download_link );
|
||||||
|
$download_link = add_query_arg( 'sha', $tag, $download_link );
|
||||||
|
$tags[] = $tag;
|
||||||
|
$rollback[ $tag ] = $download_link;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [ $tags, $rollback ];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add settings for GitLab.com, GitLab Community Edition.
|
||||||
|
* or GitLab Enterprise Access Token.
|
||||||
|
*
|
||||||
|
* @param array $auth_required
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function add_settings( $auth_required ) {
|
||||||
|
if ( $auth_required['gitlab'] || $auth_required['gitlab_enterprise'] ) {
|
||||||
|
add_settings_section(
|
||||||
|
'gitlab_settings',
|
||||||
|
esc_html__( 'GitLab Personal Access Token', 'github-updater' ),
|
||||||
|
[ $this, 'print_section_gitlab_token' ],
|
||||||
|
'github_updater_gitlab_install_settings'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $auth_required['gitlab_private'] ) {
|
||||||
|
add_settings_section(
|
||||||
|
'gitlab_id',
|
||||||
|
esc_html__( 'GitLab Private Settings', 'github-updater' ),
|
||||||
|
[ $this, 'print_section_gitlab_info' ],
|
||||||
|
'github_updater_gitlab_install_settings'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $auth_required['gitlab'] ) {
|
||||||
|
add_settings_field(
|
||||||
|
'gitlab_access_token',
|
||||||
|
esc_html__( 'GitLab.com Access Token', 'github-updater' ),
|
||||||
|
[ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ],
|
||||||
|
'github_updater_gitlab_install_settings',
|
||||||
|
'gitlab_settings',
|
||||||
|
[
|
||||||
|
'id' => 'gitlab_access_token',
|
||||||
|
'token' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $auth_required['gitlab_enterprise'] ) {
|
||||||
|
add_settings_field(
|
||||||
|
'gitlab_enterprise_token',
|
||||||
|
esc_html__( 'GitLab CE or GitLab Enterprise Personal Access Token', 'github-updater' ),
|
||||||
|
[ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ],
|
||||||
|
'github_updater_gitlab_install_settings',
|
||||||
|
'gitlab_settings',
|
||||||
|
[
|
||||||
|
'id' => 'gitlab_enterprise_token',
|
||||||
|
'token' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add values for individual repo add_setting_field().
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function add_repo_setting_field() {
|
||||||
|
$setting_field['page'] = 'github_updater_gitlab_install_settings';
|
||||||
|
$setting_field['section'] = 'gitlab_id';
|
||||||
|
$setting_field['callback_method'] = [
|
||||||
|
Singleton::get_instance( 'Settings', $this ),
|
||||||
|
'token_callback_text',
|
||||||
|
];
|
||||||
|
|
||||||
|
return $setting_field;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add subtab to Settings page.
|
||||||
|
*/
|
||||||
|
private function add_settings_subtab() {
|
||||||
|
add_filter(
|
||||||
|
'github_updater_add_settings_subtabs',
|
||||||
|
function ( $subtabs ) {
|
||||||
|
return array_merge( $subtabs, [ 'gitlab' => esc_html__( 'GitLab', 'github-updater' ) ] );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print the GitLab Settings text.
|
||||||
|
*/
|
||||||
|
public function print_section_gitlab_info() {
|
||||||
|
esc_html_e( 'Enter your repository specific GitLab Access Token.', 'github-updater' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print the GitLab Access Token Settings text.
|
||||||
|
*/
|
||||||
|
public function print_section_gitlab_token() {
|
||||||
|
esc_html_e( 'Enter your GitLab.com, GitLab CE, or GitLab Enterprise Access Token.', 'github-updater' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add remote install settings fields.
|
||||||
|
*
|
||||||
|
* @param string $type
|
||||||
|
*/
|
||||||
|
public function add_install_settings_fields( $type ) {
|
||||||
|
add_settings_field(
|
||||||
|
'gitlab_access_token',
|
||||||
|
esc_html__( 'GitLab Access Token', 'github-updater' ),
|
||||||
|
[ $this, 'gitlab_access_token' ],
|
||||||
|
'github_updater_install_' . $type,
|
||||||
|
$type
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GitLab Access Token for remote install.
|
||||||
|
*/
|
||||||
|
public function gitlab_access_token() {
|
||||||
|
?>
|
||||||
|
<label for="gitlab_access_token">
|
||||||
|
<input class="gitlab_setting" type="password" style="width:50%;" id="gitlab_access_token" name="gitlab_access_token" value="" autocomplete="new-password">
|
||||||
|
<br>
|
||||||
|
<span class="description">
|
||||||
|
<?php esc_html_e( 'Enter GitLab Access Token for private GitLab repositories.', 'github-updater' ); ?>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display GitLab error admin notices.
|
||||||
|
*/
|
||||||
|
public function gitlab_error_notices() {
|
||||||
|
add_action( is_multisite() ? 'network_admin_notices' : 'admin_notices', [ $this, 'gitlab_error' ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate error message for missing GitLab Private Token.
|
||||||
|
*/
|
||||||
|
public function gitlab_error() {
|
||||||
|
$auth_required = $this->get_class_vars( 'Settings', 'auth_required' );
|
||||||
|
$error_code = $this->get_error_codes();
|
||||||
|
|
||||||
|
if ( ! isset( $error_code['gitlab'] ) &&
|
||||||
|
( ( empty( static::$options['gitlab_enterprise_token'] ) &&
|
||||||
|
$auth_required['gitlab_enterprise'] ) ||
|
||||||
|
( empty( static::$options['gitlab_access_token'] ) &&
|
||||||
|
$auth_required['gitlab'] ) )
|
||||||
|
) {
|
||||||
|
self::$error_code['gitlab'] = [ 'error' => true ];
|
||||||
|
if ( ! \PAnD::is_admin_notice_active( 'gitlab-error-1' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div data-dismissible="gitlab-error-1" class="error notice is-dismissible">
|
||||||
|
<p>
|
||||||
|
<?php esc_html_e( 'You must set a GitLab.com, GitLab CE, or GitLab Enterprise Access Token.', 'github-updater' ); ?>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add remote install feature, create endpoint.
|
||||||
|
*
|
||||||
|
* @param array $headers
|
||||||
|
* @param array $install
|
||||||
|
*
|
||||||
|
* @return mixed $install
|
||||||
|
*/
|
||||||
|
public function remote_install( $headers, $install ) {
|
||||||
|
$gitlab_com = true;
|
||||||
|
$options['gitlab_access_token'] = isset( static::$options['gitlab_access_token'] ) ? static::$options['gitlab_access_token'] : null;
|
||||||
|
$options['gitlab_enterprise_token'] = isset( static::$options['gitlab_enterprise_token'] ) ? static::$options['gitlab_enterprise_token'] : null;
|
||||||
|
|
||||||
|
if ( 'gitlab.com' === $headers['host'] || empty( $headers['host'] ) ) {
|
||||||
|
$base = 'https://gitlab.com';
|
||||||
|
$headers['host'] = 'gitlab.com';
|
||||||
|
} else {
|
||||||
|
$base = $headers['base_uri'];
|
||||||
|
$gitlab_com = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = rawurlencode( $install['github_updater_repo'] );
|
||||||
|
$install['download_link'] = "{$base}/api/v4/projects/{$id}/repository/archive.zip";
|
||||||
|
$install['download_link'] = add_query_arg( 'sha', $install['github_updater_branch'], $install['download_link'] );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add/Save access token if present.
|
||||||
|
*/
|
||||||
|
if ( ! empty( $install['gitlab_access_token'] ) ) {
|
||||||
|
$install['options'][ $install['repo'] ] = $install['gitlab_access_token'];
|
||||||
|
if ( $gitlab_com ) {
|
||||||
|
$install['options']['gitlab_access_token'] = $install['gitlab_access_token'];
|
||||||
|
} else {
|
||||||
|
$install['options']['gitlab_enterprise_token'] = $install['gitlab_access_token'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( $gitlab_com ) {
|
||||||
|
$token = ! empty( $install['options']['gitlab_access_token'] )
|
||||||
|
? $install['options']['gitlab_access_token']
|
||||||
|
: $options['gitlab_access_token'];
|
||||||
|
} else {
|
||||||
|
$token = ! empty( $install['options']['gitlab_enterprise_token'] )
|
||||||
|
? $install['options']['gitlab_enterprise_token']
|
||||||
|
: $options['gitlab_enterprise_token'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( $token ) ) {
|
||||||
|
$install['download_link'] = add_query_arg( 'private_token', $token, $install['download_link'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( static::$options['gitlab_access_token'] ) ) {
|
||||||
|
unset( $install['options']['gitlab_access_token'] );
|
||||||
|
}
|
||||||
|
if ( ! empty( static::$options['gitlab_enterprise_token'] ) ) {
|
||||||
|
unset( $install['options']['gitlab_enterprise_token'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $install;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,514 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater\API;
|
||||||
|
|
||||||
|
use Fragen\Singleton;
|
||||||
|
use Fragen\GitHub_Updater\API;
|
||||||
|
use Fragen\GitHub_Updater\Branch;
|
||||||
|
use Fragen\GitHub_Updater\Traits\GHU_Trait;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Gitea_API
|
||||||
|
*
|
||||||
|
* Get remote data from a Gitea repo.
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @author Marco Betschart
|
||||||
|
*/
|
||||||
|
class Gitea_API extends API implements API_Interface {
|
||||||
|
use GHU_Trait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param \stdClass $type
|
||||||
|
*/
|
||||||
|
public function __construct( $type ) {
|
||||||
|
parent::__construct();
|
||||||
|
$this->type = $type;
|
||||||
|
$this->response = $this->get_repo_cache();
|
||||||
|
$branch = new Branch( $this->response );
|
||||||
|
if ( ! empty( $type->branch ) ) {
|
||||||
|
$this->type->branch = ! empty( $branch->cache['current_branch'] )
|
||||||
|
? $branch->cache['current_branch']
|
||||||
|
: $type->branch;
|
||||||
|
}
|
||||||
|
$this->set_default_credentials();
|
||||||
|
$this->settings_hook( $this );
|
||||||
|
$this->add_settings_subtab();
|
||||||
|
$this->add_install_fields( $this );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set default credentials if option not set.
|
||||||
|
*/
|
||||||
|
protected function set_default_credentials() {
|
||||||
|
$running_servers = Singleton::get_instance( 'Base', $this )->get_running_git_servers();
|
||||||
|
$set_credentials = false;
|
||||||
|
if ( ! isset( static::$options['gitea_access_token'] ) ) {
|
||||||
|
static::$options['gitea_access_token'] = null;
|
||||||
|
$set_credentials = true;
|
||||||
|
}
|
||||||
|
if ( empty( static::$options['gitea_access_token'] ) &&
|
||||||
|
in_array( 'gitea', $running_servers, true )
|
||||||
|
) {
|
||||||
|
$this->gitea_error_notices();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $set_credentials ) {
|
||||||
|
add_site_option( 'github_updater', static::$options );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the remote file and parse headers.
|
||||||
|
*
|
||||||
|
* @param string $file Filename.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_info( $file ) {
|
||||||
|
return $this->get_remote_api_info( 'gitea', $file, "/repos/:owner/:repo/raw/:branch/{$file}" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get remote info for tags.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_tag() {
|
||||||
|
return $this->get_remote_api_tag( 'gitea', '/repos/:owner/:repo/releases' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the remote CHANGES.md file.
|
||||||
|
*
|
||||||
|
* @param string $changes Changelog filename.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_remote_changes( $changes ) {
|
||||||
|
return $this->get_remote_api_changes( 'gitea', $changes, "/repos/:owner/:repo/raw/:branch/{$changes}" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read and parse remote readme.txt.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_remote_readme() {
|
||||||
|
return $this->get_remote_api_readme( 'gitea', '/repos/:owner/:repo/raw/:branch/readme.txt' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the repository meta from API.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_repo_meta() {
|
||||||
|
return $this->get_remote_api_repo_meta( 'gitea', '/repos/:owner/:repo' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create array of branches and download links as array.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_remote_branches() {
|
||||||
|
return $this->get_remote_api_branches( 'gitea', '/repos/:owner/:repo/branches' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Gitea release asset.
|
||||||
|
*
|
||||||
|
* @return false
|
||||||
|
*/
|
||||||
|
public function get_release_asset() {
|
||||||
|
// TODO: eventually figure this out.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct $this->type->download_link using Gitea API.
|
||||||
|
*
|
||||||
|
* @param boolean $branch_switch for direct branch changing.
|
||||||
|
*
|
||||||
|
* @return string $endpoint
|
||||||
|
*/
|
||||||
|
public function construct_download_link( $branch_switch = false ) {
|
||||||
|
self::$method = 'download_link';
|
||||||
|
$download_link_base = $this->get_api_url( '/repos/:owner/:repo/archive/', true );
|
||||||
|
$endpoint = '';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If a branch has been given, use branch.
|
||||||
|
* If branch is master (default) and tags are used, use newest tag.
|
||||||
|
*/
|
||||||
|
if ( 'master' !== $this->type->branch || empty( $this->type->tags ) ) {
|
||||||
|
$endpoint .= $this->type->branch . '.zip';
|
||||||
|
} else {
|
||||||
|
$endpoint .= $this->type->newest_tag . '.zip';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create endpoint for branch switching.
|
||||||
|
if ( $branch_switch ) {
|
||||||
|
$endpoint = $branch_switch . '.zip';
|
||||||
|
}
|
||||||
|
|
||||||
|
$endpoint = $this->add_access_token_endpoint( $this, $endpoint );
|
||||||
|
$download_link = $download_link_base . $endpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter download link so developers can point to specific ZipFile
|
||||||
|
* to use as a download link during a branch switch.
|
||||||
|
*
|
||||||
|
* @since 8.8.0
|
||||||
|
*
|
||||||
|
* @param string $download_link Download URL.
|
||||||
|
* @param /stdClass $this->type Repository object.
|
||||||
|
* @param string $branch_switch Branch or tag for rollback or branch switching.
|
||||||
|
*/
|
||||||
|
return apply_filters( 'github_updater_post_construct_download_link', $download_link, $this->type, $branch_switch );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Gitea API endpoints.
|
||||||
|
*
|
||||||
|
* @param Gitea_API|API $git
|
||||||
|
* @param string $endpoint
|
||||||
|
*
|
||||||
|
* @return string $endpoint
|
||||||
|
*/
|
||||||
|
public function add_endpoints( $git, $endpoint ) {
|
||||||
|
switch ( $git::$method ) {
|
||||||
|
case 'file':
|
||||||
|
case 'readme':
|
||||||
|
case 'meta':
|
||||||
|
case 'tags':
|
||||||
|
case 'changes':
|
||||||
|
case 'translation':
|
||||||
|
case 'download_link':
|
||||||
|
break;
|
||||||
|
case 'branches':
|
||||||
|
$endpoint = add_query_arg( 'per_page', '100', $endpoint );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$endpoint = $this->add_access_token_endpoint( $git, $endpoint );
|
||||||
|
|
||||||
|
return $endpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response call and return only array of tag numbers.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call for tags.
|
||||||
|
*
|
||||||
|
* @return \stdClass|array Array of tag numbers, object is error.
|
||||||
|
*/
|
||||||
|
public function parse_tag_response( $response ) {
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$arr = [];
|
||||||
|
array_map(
|
||||||
|
function ( $e ) use ( &$arr ) {
|
||||||
|
$arr[] = $e->tag_name;
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
},
|
||||||
|
(array) $response
|
||||||
|
);
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array of meta variables.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call.
|
||||||
|
*
|
||||||
|
* @return array $arr Array of meta variables.
|
||||||
|
*/
|
||||||
|
public function parse_meta_response( $response ) {
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
$arr = [];
|
||||||
|
$response = [ $response ];
|
||||||
|
|
||||||
|
array_filter(
|
||||||
|
$response,
|
||||||
|
function ( $e ) use ( &$arr ) {
|
||||||
|
$arr['private'] = $e->private;
|
||||||
|
$arr['last_updated'] = $e->updated_at;
|
||||||
|
$arr['watchers'] = $e->watchers_count;
|
||||||
|
$arr['forks'] = $e->forks_count;
|
||||||
|
$arr['open_issues'] = isset( $e->open_issues_count ) ? $e->open_issues_count : 0;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array with changelog in base64.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call.
|
||||||
|
*
|
||||||
|
* @return array|\stdClass $arr Array of changes in base64, object if error.
|
||||||
|
*/
|
||||||
|
public function parse_changelog_response( $response ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse API response and return array of branch data.
|
||||||
|
*
|
||||||
|
* @param \stdClass $response API response.
|
||||||
|
*
|
||||||
|
* @return array Array of branch data.
|
||||||
|
*/
|
||||||
|
public function parse_branch_response( $response ) {
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
$branches = [];
|
||||||
|
foreach ( $response as $branch ) {
|
||||||
|
$branches[ $branch->name ]['download'] = $this->construct_download_link( $branch->name );
|
||||||
|
$branches[ $branch->name ]['commit_hash'] = $branch->commit->id;
|
||||||
|
$branches[ $branch->name ]['commit_timestamp'] = $branch->commit->timestamp;
|
||||||
|
}
|
||||||
|
return $branches;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse tags and create download links.
|
||||||
|
*
|
||||||
|
* @param \stdClass|array $response Response from API call.
|
||||||
|
* @param array $repo_type
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function parse_tags( $response, $repo_type ) {
|
||||||
|
$tags = [];
|
||||||
|
$rollback = [];
|
||||||
|
|
||||||
|
foreach ( (array) $response as $tag ) {
|
||||||
|
$download_link = implode(
|
||||||
|
'/',
|
||||||
|
[
|
||||||
|
$repo_type['base_uri'],
|
||||||
|
'repos',
|
||||||
|
$this->type->owner,
|
||||||
|
$this->type->slug,
|
||||||
|
'archive/',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$tags[] = $tag;
|
||||||
|
$rollback[ $tag ] = $download_link . $tag . '.zip';
|
||||||
|
}
|
||||||
|
|
||||||
|
return [ $tags, $rollback ];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add settings for Gitea Access Token.
|
||||||
|
*
|
||||||
|
* @param array $auth_required
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function add_settings( $auth_required ) {
|
||||||
|
if ( $auth_required['gitea'] ) {
|
||||||
|
add_settings_section(
|
||||||
|
'gitea_settings',
|
||||||
|
esc_html__( 'Gitea Access Token', 'github-updater' ),
|
||||||
|
[ $this, 'print_section_gitea_token' ],
|
||||||
|
'github_updater_gitea_install_settings'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $auth_required['gitea_private'] ) {
|
||||||
|
add_settings_section(
|
||||||
|
'gitea_id',
|
||||||
|
esc_html__( 'Gitea Private Settings', 'github-updater' ),
|
||||||
|
[ $this, 'print_section_gitea_info' ],
|
||||||
|
'github_updater_gitea_install_settings'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $auth_required['gitea'] ) {
|
||||||
|
add_settings_field(
|
||||||
|
'gitea_access_token',
|
||||||
|
esc_html__( 'Gitea Access Token', 'github-updater' ),
|
||||||
|
[ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ],
|
||||||
|
'github_updater_gitea_install_settings',
|
||||||
|
'gitea_settings',
|
||||||
|
[
|
||||||
|
'id' => 'gitea_access_token',
|
||||||
|
'token' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add values for individual repo add_setting_field().
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function add_repo_setting_field() {
|
||||||
|
$setting_field['page'] = 'github_updater_gitea_install_settings';
|
||||||
|
$setting_field['section'] = 'gitea_id';
|
||||||
|
$setting_field['callback_method'] = [
|
||||||
|
Singleton::get_instance( 'Settings', $this ),
|
||||||
|
'token_callback_text',
|
||||||
|
];
|
||||||
|
|
||||||
|
return $setting_field;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add subtab to Settings page.
|
||||||
|
*/
|
||||||
|
private function add_settings_subtab() {
|
||||||
|
add_filter(
|
||||||
|
'github_updater_add_settings_subtabs',
|
||||||
|
function ( $subtabs ) {
|
||||||
|
return array_merge( $subtabs, [ 'gitea' => esc_html__( 'Gitea', 'github-updater' ) ] );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print the Gitea Settings text.
|
||||||
|
*/
|
||||||
|
public function print_section_gitea_info() {
|
||||||
|
esc_html_e( 'Enter your repository specific Gitea Access Token.', 'github-updater' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print the Gitea Access Token Settings text.
|
||||||
|
*/
|
||||||
|
public function print_section_gitea_token() {
|
||||||
|
esc_html_e( 'Enter your Gitea Access Token.', 'github-updater' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add remote install settings fields.
|
||||||
|
*
|
||||||
|
* @param string $type
|
||||||
|
*/
|
||||||
|
public function add_install_settings_fields( $type ) {
|
||||||
|
add_settings_field(
|
||||||
|
'gitea_access_token',
|
||||||
|
esc_html__( 'Gitea Access Token', 'github-updater' ),
|
||||||
|
[ $this, 'gitea_access_token' ],
|
||||||
|
'github_updater_install_' . $type,
|
||||||
|
$type
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gitea Access Token for remote install.
|
||||||
|
*/
|
||||||
|
public function gitea_access_token() {
|
||||||
|
?>
|
||||||
|
<label for="gitea_access_token">
|
||||||
|
<input class="gitea_setting" type="password" style="width:50%;" id="gitea_access_token" name="gitea_access_token" value="" autocomplete="new-password">
|
||||||
|
<br>
|
||||||
|
<span class="description">
|
||||||
|
<?php esc_html_e( 'Enter Gitea Access Token for private Gitea repositories.', 'github-updater' ); ?>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display Gitea error admin notices.
|
||||||
|
*/
|
||||||
|
public function gitea_error_notices() {
|
||||||
|
add_action( is_multisite() ? 'network_admin_notices' : 'admin_notices', [ $this, 'gitea_error' ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate error message for missing Gitea Access Token.
|
||||||
|
*/
|
||||||
|
public function gitea_error() {
|
||||||
|
$auth_required = $this->get_class_vars( 'Settings', 'auth_required' );
|
||||||
|
$error_code = $this->get_error_codes();
|
||||||
|
|
||||||
|
if ( ! isset( $error_code['gitea'] ) &&
|
||||||
|
empty( static::$options['gitea_access_token'] ) &&
|
||||||
|
$auth_required['gitea']
|
||||||
|
) {
|
||||||
|
self::$error_code['gitea'] = [ 'error' => true ];
|
||||||
|
if ( ! \PAnD::is_admin_notice_active( 'gitea-error-1' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div data-dismissible="gitea-error-1" class="error notice is-dismissible">
|
||||||
|
<p>
|
||||||
|
<?php esc_html_e( 'You must set a Gitea Access Token.', 'github-updater' ); ?>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add remote install feature, create endpoint.
|
||||||
|
*
|
||||||
|
* @param array $headers
|
||||||
|
* @param array $install
|
||||||
|
*
|
||||||
|
* @return mixed $install
|
||||||
|
*/
|
||||||
|
public function remote_install( $headers, $install ) {
|
||||||
|
$options['gitea_access_token'] = isset( static::$options['gitea_access_token'] ) ? static::$options['gitea_access_token'] : null;
|
||||||
|
|
||||||
|
$base = $headers['base_uri'] . '/api/v1';
|
||||||
|
|
||||||
|
$install['download_link'] = "{$base}/repos/{$install['github_updater_repo']}/archive/{$install['github_updater_branch']}.zip";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add/Save access token if present.
|
||||||
|
*/
|
||||||
|
if ( ! empty( $install['gitea_access_token'] ) ) {
|
||||||
|
$install['options'][ $install['repo'] ] = $install['gitea_access_token'];
|
||||||
|
$install['options']['gitea_access_token'] = $install['gitea_access_token'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$token = ! empty( $install['options']['gitea_access_token'] )
|
||||||
|
? $install['options']['gitea_access_token']
|
||||||
|
: $options['gitea_access_token'];
|
||||||
|
|
||||||
|
if ( ! empty( $token ) ) {
|
||||||
|
$install['download_link'] = add_query_arg( 'access_token', $token, $install['download_link'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( static::$options['gitea_access_token'] ) ) {
|
||||||
|
unset( $install['options']['gitea_access_token'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $install;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater\API;
|
||||||
|
|
||||||
|
use Fragen\GitHub_Updater\API;
|
||||||
|
use Fragen\GitHub_Updater\Traits\GHU_Trait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Language_Pack_API
|
||||||
|
*/
|
||||||
|
class Language_Pack_API extends API {
|
||||||
|
use GHU_Trait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param \stdClass $type
|
||||||
|
*/
|
||||||
|
public function __construct( $type ) {
|
||||||
|
parent::__construct();
|
||||||
|
self::$method = 'translation';
|
||||||
|
$this->type = $type;
|
||||||
|
$this->response = $this->get_repo_cache();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get/process Language Packs.
|
||||||
|
*
|
||||||
|
* @param array $headers Array of headers of Language Pack.
|
||||||
|
*
|
||||||
|
* @return bool When invalid response.
|
||||||
|
*/
|
||||||
|
public function get_language_pack( $headers ) {
|
||||||
|
$response = ! empty( $this->response['languages'] ) ? $this->response['languages'] : false;
|
||||||
|
|
||||||
|
if ( ! $response ) {
|
||||||
|
$response = $this->get_language_pack_json( $this->type->git, $headers, $response );
|
||||||
|
|
||||||
|
if ( $response ) {
|
||||||
|
foreach ( $response as $locale ) {
|
||||||
|
$package = $this->process_language_pack_package( $this->type->git, $locale, $headers );
|
||||||
|
|
||||||
|
$response->{$locale->language}->package = $package;
|
||||||
|
$response->{$locale->language}->type = $this->type->type;
|
||||||
|
$response->{$locale->language}->version = $this->type->local_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set_repo_cache( 'languages', $response );
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->type->language_packs = $response;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get language-pack.json from appropriate host.
|
||||||
|
*
|
||||||
|
* @param string $git ( github|bitbucket|gitlab|gitea ).
|
||||||
|
* @param array $headers
|
||||||
|
* @param mixed $response API response.
|
||||||
|
*
|
||||||
|
* @return array|bool|mixed
|
||||||
|
*/
|
||||||
|
private function get_language_pack_json( $git, $headers, $response ) {
|
||||||
|
switch ( $git ) {
|
||||||
|
case 'github':
|
||||||
|
$response = $this->api( '/repos/' . $headers['owner'] . '/' . $headers['repo'] . '/contents/language-pack.json' );
|
||||||
|
$response = isset( $response->content )
|
||||||
|
? json_decode( base64_decode( $response->content ) )
|
||||||
|
: null;
|
||||||
|
break;
|
||||||
|
case 'bitbucket':
|
||||||
|
$response = $this->api( '/2.0/repositories/' . $headers['owner'] . '/' . $headers['repo'] . '/src/master/language-pack.json' );
|
||||||
|
break;
|
||||||
|
case 'gitlab':
|
||||||
|
$id = rawurlencode( $headers['owner'] . '/' . $headers['repo'] );
|
||||||
|
$response = $this->api( '/projects/' . $id . '/repository/files/language-pack.json' );
|
||||||
|
$response = isset( $response->content )
|
||||||
|
? json_decode( base64_decode( $response->content ) )
|
||||||
|
: null;
|
||||||
|
break;
|
||||||
|
case 'gitea':
|
||||||
|
$response = $this->api( '/repos/' . $headers['owner'] . '/' . $headers['repo'] . '/raw/master/language-pack.json' );
|
||||||
|
$response = isset( $response->content )
|
||||||
|
? json_decode( base64_decode( $response->content ) )
|
||||||
|
: null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $this->validate_response( $response ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process $package for update transient.
|
||||||
|
*
|
||||||
|
* @param string $git ( github|bitbucket|gitlab|gitea ).
|
||||||
|
* @param string $locale
|
||||||
|
* @param array $headers
|
||||||
|
*
|
||||||
|
* @return array|null|string
|
||||||
|
*/
|
||||||
|
private function process_language_pack_package( $git, $locale, $headers ) {
|
||||||
|
$package = null;
|
||||||
|
switch ( $git ) {
|
||||||
|
case 'github':
|
||||||
|
$package = [ 'https://github.com', $headers['owner'], $headers['repo'], 'blob/master' ];
|
||||||
|
$package = implode( '/', $package ) . $locale->package;
|
||||||
|
$package = add_query_arg( [ 'raw' => 'true' ], $package );
|
||||||
|
break;
|
||||||
|
case 'bitbucket':
|
||||||
|
$package = [ 'https://bitbucket.org', $headers['owner'], $headers['repo'], 'raw/master' ];
|
||||||
|
$package = implode( '/', $package ) . $locale->package;
|
||||||
|
break;
|
||||||
|
case 'gitlab':
|
||||||
|
$package = [ 'https://gitlab.com', $headers['owner'], $headers['repo'], 'raw/master' ];
|
||||||
|
$package = implode( '/', $package ) . $locale->package;
|
||||||
|
break;
|
||||||
|
case 'gitea':
|
||||||
|
// TODO: make sure this works as expected.
|
||||||
|
$package = [ $headers['uri'], 'raw/master' ];
|
||||||
|
$package = implode( '/', $package ) . $local->package;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $package;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater\API;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Zipfile_API
|
||||||
|
*
|
||||||
|
* Remote install from a Zipfile.
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
*/
|
||||||
|
class Zipfile_API {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add remote install settings fields.
|
||||||
|
*
|
||||||
|
* @param string $type plugin|theme.
|
||||||
|
*/
|
||||||
|
public function add_install_settings_fields( $type ) {
|
||||||
|
add_settings_field(
|
||||||
|
'zipfile_slug',
|
||||||
|
esc_html__( 'Zipfile Slug', 'github-updater' ),
|
||||||
|
[ $this, 'zipfile_slug' ],
|
||||||
|
'github_updater_install_' . $type,
|
||||||
|
$type
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set repo slug for remote install.
|
||||||
|
*/
|
||||||
|
public function zipfile_slug() {
|
||||||
|
?>
|
||||||
|
<label for="zipfile_slug">
|
||||||
|
<input class="zipfile_setting" type="text" style="width:50%;" id="zipfile_slug" name="zipfile_slug" value="" placeholder="my-repo-slug">
|
||||||
|
<br>
|
||||||
|
<span class="description">
|
||||||
|
<?php esc_html_e( 'Enter plugin or theme slug.', 'github-updater' ); ?>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add remote install feature, create endpoint.
|
||||||
|
*
|
||||||
|
* @param array $headers
|
||||||
|
* @param array $install
|
||||||
|
*
|
||||||
|
* @return mixed $install
|
||||||
|
*/
|
||||||
|
public function remote_install( $headers, $install ) {
|
||||||
|
$install['download_link'] = ! empty( $headers['uri'] ) ? $headers['uri'] : $headers['original'];
|
||||||
|
$install['github_updater_install_repo'] = $install['zipfile_slug'];
|
||||||
|
|
||||||
|
return $install;
|
||||||
|
}
|
||||||
|
}
|
||||||
957
wp-content/plugins/github-updater/src/GitHub_Updater/Base.php
Normal file
@@ -0,0 +1,957 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater;
|
||||||
|
|
||||||
|
use Fragen\Singleton;
|
||||||
|
use Fragen\GitHub_Updater\Traits\GHU_Trait;
|
||||||
|
use Fragen\GitHub_Updater\Traits\Basic_Auth_Loader;
|
||||||
|
use Fragen\GitHub_Updater\API\Bitbucket_API;
|
||||||
|
use Fragen\GitHub_Updater\API\Language_Pack_API;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Base
|
||||||
|
*
|
||||||
|
* Update a WordPress plugin or theme from a Git-based repo.
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
*/
|
||||||
|
class Base {
|
||||||
|
use GHU_Trait, Basic_Auth_Loader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Variable for holding extra theme and plugin headers.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $extra_headers = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds the values to be used in the fields callbacks.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $options;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds git server types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $git_servers = [ 'github' => 'GitHub' ];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds extra repo header types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected static $extra_repo_headers = [
|
||||||
|
'Languages' => 'Languages',
|
||||||
|
'CIJob' => 'CI Job',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds an array of installed git APIs.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $installed_apis = [ 'github_api' => true ];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the object calling Basic_Auth_Loader.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @var \stdClass
|
||||||
|
*/
|
||||||
|
public $caller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store details of all repositories that are installed.
|
||||||
|
*
|
||||||
|
* @var \stdClass
|
||||||
|
*/
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
$this->set_installed_apis();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set boolean for installed API classes.
|
||||||
|
*/
|
||||||
|
protected function set_installed_apis() {
|
||||||
|
if ( file_exists( __DIR__ . '/API/Bitbucket_API.php' ) ) {
|
||||||
|
self::$installed_apis['bitbucket_api'] = true;
|
||||||
|
self::$git_servers['bitbucket'] = 'Bitbucket';
|
||||||
|
} else {
|
||||||
|
self::$installed_apis['bitbucket_api'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$installed_apis['bitbucket_server_api'] = file_exists( __DIR__ . '/API/Bitbucket_Server_API.php' );
|
||||||
|
|
||||||
|
if ( file_exists( __DIR__ . '/API/GitLab_API.php' ) ) {
|
||||||
|
self::$installed_apis['gitlab_api'] = true;
|
||||||
|
self::$git_servers['gitlab'] = 'GitLab';
|
||||||
|
} else {
|
||||||
|
self::$installed_apis['gitlab_api'] = false;
|
||||||
|
}
|
||||||
|
if ( file_exists( __DIR__ . '/API/Gitea_API.php' ) ) {
|
||||||
|
self::$installed_apis['gitea_api'] = true;
|
||||||
|
self::$git_servers['gitea'] = 'Gitea';
|
||||||
|
} else {
|
||||||
|
self::$installed_apis['gitea_api'] = false;
|
||||||
|
}
|
||||||
|
if ( file_exists( __DIR__ . '/API/Zipfile_API.php' ) ) {
|
||||||
|
self::$installed_apis['zipfile_api'] = true;
|
||||||
|
self::$git_servers['zipfile'] = 'Zipfile';
|
||||||
|
} else {
|
||||||
|
self::$installed_apis['zipfile_api'] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load Plugin, Theme, and Settings with correct capabiltiies and on selective admin pages.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function load() {
|
||||||
|
if ( ! apply_filters( 'github_updater_hide_settings', false ) ) {
|
||||||
|
Singleton::get_instance( 'Settings', $this )->run();
|
||||||
|
}
|
||||||
|
if ( ! Singleton::get_instance( 'Init', $this )->can_update() ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run GitHub Updater upgrade functions.
|
||||||
|
$upgrade = new GHU_Upgrade();
|
||||||
|
$upgrade->run();
|
||||||
|
|
||||||
|
// Load plugin stylesheet.
|
||||||
|
add_action(
|
||||||
|
'admin_enqueue_scripts',
|
||||||
|
function () {
|
||||||
|
wp_register_style( 'github-updater', plugins_url( basename( GITHUB_UPDATER_DIR ) ) . '/css/github-updater.css' );
|
||||||
|
wp_enqueue_style( 'github-updater' );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( isset( $_POST['ghu_refresh_cache'] ) ) {
|
||||||
|
/**
|
||||||
|
* Fires later in cycle when Refreshing Cache.
|
||||||
|
*
|
||||||
|
* @since 6.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'ghu_refresh_transients' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->get_meta_plugins();
|
||||||
|
$this->get_meta_themes();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs actual plugin metadata fetching.
|
||||||
|
*/
|
||||||
|
public function get_meta_plugins() {
|
||||||
|
if ( Singleton::get_instance( 'Init', $this )->can_update() ) {
|
||||||
|
Singleton::get_instance( 'Plugin', $this )->get_remote_plugin_meta();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs actual theme metadata fetching.
|
||||||
|
*/
|
||||||
|
public function get_meta_themes() {
|
||||||
|
if ( Singleton::get_instance( 'Init', $this )->can_update() ) {
|
||||||
|
Singleton::get_instance( 'Theme', $this )->get_remote_theme_meta();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AJAX endpoint for REST updates.
|
||||||
|
*/
|
||||||
|
public function ajax_update() {
|
||||||
|
Singleton::get_instance( 'Rest_Update', $this )->process_request();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run background processes.
|
||||||
|
* Piggyback on built-in update function to get metadata.
|
||||||
|
* Set update transients for remote management.
|
||||||
|
*/
|
||||||
|
public function background_update() {
|
||||||
|
add_action( 'wp_update_plugins', [ $this, 'get_meta_plugins' ] );
|
||||||
|
add_action( 'wp_update_themes', [ $this, 'get_meta_themes' ] );
|
||||||
|
add_action( 'ghu_get_remote_plugin', [ $this, 'run_cron_batch' ], 10, 1 );
|
||||||
|
add_action( 'ghu_get_remote_theme', [ $this, 'run_cron_batch' ], 10, 1 );
|
||||||
|
add_action( 'wp_ajax_nopriv_ithemes_sync_request', [ $this, 'get_meta_remote_management' ] );
|
||||||
|
add_action( 'update_option_auto_updater.lock', [ $this, 'get_meta_remote_management' ] );
|
||||||
|
( new Remote_Management() )->set_update_transients();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls $this->get_meta_plugins() and $this->get_meta_themes()
|
||||||
|
* for remote management services.
|
||||||
|
*/
|
||||||
|
public function get_meta_remote_management() {
|
||||||
|
$this->get_meta_plugins();
|
||||||
|
$this->get_meta_themes();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows developers to use 'github_updater_set_options' hook to set access tokens or other settings.
|
||||||
|
* Saves results of filter hook to self::$options.
|
||||||
|
* Single plugin/theme should not be using both hooks.
|
||||||
|
*
|
||||||
|
* Hook requires return of associative element array.
|
||||||
|
* $key === repo-name and $value === token
|
||||||
|
* e.g. array( 'repo-name' => 'access_token' );
|
||||||
|
*/
|
||||||
|
public function set_options_filter() {
|
||||||
|
$config = apply_filters( 'github_updater_set_options', [] );
|
||||||
|
if ( empty( $config ) ) {
|
||||||
|
$config = function_exists( 'apply_filters_deprecated' )
|
||||||
|
? apply_filters_deprecated( 'github_updater_token_distribution', [ null ], '6.1.0', 'github_updater_set_options' )
|
||||||
|
: apply_filters( 'github_updater_token_distribution', [] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( $config ) ) {
|
||||||
|
$config = $this->sanitize( $config );
|
||||||
|
self::$options = array_merge( get_site_option( 'github_updater' ), $config );
|
||||||
|
update_site_option( 'github_updater', self::$options );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add extra headers to get_plugins() or wp_get_themes().
|
||||||
|
*
|
||||||
|
* @param array $extra_headers
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function add_headers( $extra_headers ) {
|
||||||
|
$ghu_extra_headers = [
|
||||||
|
'RequiresWP' => 'Requires WP',
|
||||||
|
'RequiresPHP' => 'Requires PHP',
|
||||||
|
'ReleaseAsset' => 'Release Asset',
|
||||||
|
];
|
||||||
|
|
||||||
|
$uri_types = [
|
||||||
|
'PluginURI' => ' Plugin URI',
|
||||||
|
'ThemeURI' => ' Theme URI',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ( self::$git_servers as $server ) {
|
||||||
|
foreach ( $uri_types as $uri_key => $uri_value ) {
|
||||||
|
$ghu_extra_headers[ $server . $uri_key ] = $server . $uri_value;
|
||||||
|
}
|
||||||
|
foreach ( self::$extra_repo_headers as $header_key => $header_value ) {
|
||||||
|
$ghu_extra_headers[ $server . $header_key ] = $server . ' ' . $header_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$extra_headers = array_unique( array_merge( self::$extra_headers, $ghu_extra_headers ) );
|
||||||
|
$extra_headers = array_merge( (array) $extra_headers, $ghu_extra_headers );
|
||||||
|
ksort( self::$extra_headers );
|
||||||
|
|
||||||
|
return $extra_headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs on wp-cron job to get remote repo meta in background.
|
||||||
|
*
|
||||||
|
* @param array $batches
|
||||||
|
*/
|
||||||
|
public function run_cron_batch( array $batches ) {
|
||||||
|
foreach ( $batches as $repo ) {
|
||||||
|
$this->get_remote_repo_meta( $repo );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get remote repo meta data for plugins or themes.
|
||||||
|
* Calls remote APIs for data.
|
||||||
|
*
|
||||||
|
* @param \stdClass $repo
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_remote_repo_meta( $repo ) {
|
||||||
|
$file = 'style.css';
|
||||||
|
if ( false !== stripos( $repo->type, 'plugin' ) ) {
|
||||||
|
$file = basename( $repo->file );
|
||||||
|
}
|
||||||
|
|
||||||
|
$repo_api = Singleton::get_instance( 'API', $this )->get_repo_api( $repo->git, $repo );
|
||||||
|
if ( null === $repo_api ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->{$repo->type} = $repo;
|
||||||
|
$this->set_defaults( $repo->type );
|
||||||
|
|
||||||
|
if ( $repo_api->get_remote_info( $file ) ) {
|
||||||
|
if ( ! self::is_wp_cli() ) {
|
||||||
|
if ( ! apply_filters( 'github_updater_run_at_scale', false ) ) {
|
||||||
|
$repo_api->get_repo_meta();
|
||||||
|
$changelog = $this->get_changelog_filename( $repo );
|
||||||
|
if ( $changelog ) {
|
||||||
|
$repo_api->get_remote_changes( $changelog );
|
||||||
|
}
|
||||||
|
$repo_api->get_remote_readme();
|
||||||
|
}
|
||||||
|
if ( ! empty( self::$options['branch_switch'] ) ) {
|
||||||
|
$repo_api->get_remote_branches();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$repo_api->get_remote_tag();
|
||||||
|
$repo->download_link = $repo_api->construct_download_link();
|
||||||
|
$language_pack = new Language_Pack( $repo, new Language_Pack_API( $repo ) );
|
||||||
|
$language_pack->run();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->remove_hooks( $repo_api );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set default values for plugin/theme.
|
||||||
|
*
|
||||||
|
* @param string $type
|
||||||
|
*/
|
||||||
|
protected function set_defaults( $type ) {
|
||||||
|
if ( ! isset( self::$options['branch_switch'] ) ) {
|
||||||
|
self::$options['branch_switch'] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! isset( $this->$type->slug ) ) {
|
||||||
|
$this->$type = new \stdClass();
|
||||||
|
$this->$type->slug = null;
|
||||||
|
} elseif ( ! isset( self::$options[ $this->$type->slug ] ) ) {
|
||||||
|
self::$options[ $this->$type->slug ] = null;
|
||||||
|
add_site_option( 'github_updater', self::$options );
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->$type->remote_version = '0.0.0';
|
||||||
|
$this->$type->newest_tag = '0.0.0';
|
||||||
|
$this->$type->download_link = null;
|
||||||
|
$this->$type->tags = [];
|
||||||
|
$this->$type->rollback = [];
|
||||||
|
$this->$type->branches = [];
|
||||||
|
$this->$type->requires = null;
|
||||||
|
$this->$type->tested = null;
|
||||||
|
$this->$type->donate_link = null;
|
||||||
|
$this->$type->contributors = [];
|
||||||
|
$this->$type->downloaded = 0;
|
||||||
|
$this->$type->last_updated = null;
|
||||||
|
$this->$type->rating = 0;
|
||||||
|
$this->$type->num_ratings = 0;
|
||||||
|
$this->$type->transient = [];
|
||||||
|
$this->$type->repo_meta = [];
|
||||||
|
$this->$type->watchers = 0;
|
||||||
|
$this->$type->forks = 0;
|
||||||
|
$this->$type->open_issues = 0;
|
||||||
|
$this->$type->requires = false;
|
||||||
|
$this->$type->requires_php = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get filename of changelog and return.
|
||||||
|
*
|
||||||
|
* @param \stdClass $repo
|
||||||
|
*
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
protected function get_changelog_filename( $repo ) {
|
||||||
|
$changelogs = [ 'CHANGES.md', 'CHANGELOG.md', 'changes.md', 'changelog.md' ];
|
||||||
|
$changes = null;
|
||||||
|
$local_files = null;
|
||||||
|
|
||||||
|
if ( is_dir( $repo->local_path ) ) {
|
||||||
|
$local_files = scandir( $repo->local_path, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
$changes = array_intersect( (array) $local_files, $changelogs );
|
||||||
|
$changes = array_pop( $changes );
|
||||||
|
|
||||||
|
if ( ! empty( $changes ) ) {
|
||||||
|
return $changes;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove hooks after use.
|
||||||
|
*
|
||||||
|
* @param \stdClass $repo_api
|
||||||
|
*/
|
||||||
|
public function remove_hooks( $repo_api ) {
|
||||||
|
remove_filter( 'extra_theme_headers', [ $this, 'add_headers' ] );
|
||||||
|
remove_filter( 'extra_plugin_headers', [ $this, 'add_headers' ] );
|
||||||
|
|
||||||
|
if ( $repo_api instanceof Bitbucket_API ) {
|
||||||
|
$this->remove_authentication_hooks();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if dupicate wp-cron event exists.
|
||||||
|
*
|
||||||
|
* @param string $event Name of wp-cron event.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function is_duplicate_wp_cron_event( $event ) {
|
||||||
|
$cron = _get_cron_array();
|
||||||
|
foreach ( $cron as $timestamp => $cronhooks ) {
|
||||||
|
if ( key( $cronhooks ) === $event ) {
|
||||||
|
$this->is_cron_overdue( $cron, $timestamp );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check to see if wp-cron event is overdue by 24 hours and report error message.
|
||||||
|
*
|
||||||
|
* @param array $cron
|
||||||
|
* @param int $timestamp
|
||||||
|
*/
|
||||||
|
public function is_cron_overdue( $cron, $timestamp ) {
|
||||||
|
$overdue = ( ( time() - $timestamp ) / HOUR_IN_SECONDS ) > 24;
|
||||||
|
if ( $overdue ) {
|
||||||
|
$error_msg = esc_html__( 'There may be a problem with WP-Cron. A GitHub Updater WP-Cron event is overdue.', 'github-updater' );
|
||||||
|
$error = new \WP_Error( 'github_updater_cron_error', $error_msg );
|
||||||
|
Singleton::get_instance( 'Messages', $this )->create_error_message( $error );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for renaming of sources to ensure correct directory name.
|
||||||
|
*
|
||||||
|
* @since WordPress 4.4.0 The $hook_extra parameter became available.
|
||||||
|
*
|
||||||
|
* @param string $source
|
||||||
|
* @param string $remote_source
|
||||||
|
* @param \Plugin_Upgrader|\Theme_Upgrader $upgrader
|
||||||
|
* @param array $hook_extra
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function upgrader_source_selection( $source, $remote_source, $upgrader, $hook_extra = null ) {
|
||||||
|
global $wp_filesystem;
|
||||||
|
$slug = null;
|
||||||
|
$repo = null;
|
||||||
|
$new_source = null;
|
||||||
|
$upgrader_object = null;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Rename plugins.
|
||||||
|
*/
|
||||||
|
if ( $upgrader instanceof \Plugin_Upgrader ) {
|
||||||
|
$upgrader_object = Singleton::get_instance( 'Plugin', $this );
|
||||||
|
if ( isset( $hook_extra['plugin'] ) ) {
|
||||||
|
$slug = dirname( $hook_extra['plugin'] );
|
||||||
|
$new_source = trailingslashit( $remote_source ) . $slug;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Rename themes.
|
||||||
|
*/
|
||||||
|
if ( $upgrader instanceof \Theme_Upgrader ) {
|
||||||
|
$upgrader_object = Singleton::get_instance( 'Theme', $this );
|
||||||
|
if ( isset( $hook_extra['theme'] ) ) {
|
||||||
|
$slug = $hook_extra['theme'];
|
||||||
|
$new_source = trailingslashit( $remote_source ) . $slug;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$repo = $this->get_repo_slugs( $slug, $upgrader_object );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Not GitHub Updater plugin/theme.
|
||||||
|
*/
|
||||||
|
if ( ! isset( $_POST['github_updater_repo'] ) && empty( $repo ) ) {
|
||||||
|
return $source;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remote install source.
|
||||||
|
*/
|
||||||
|
$install_options = $this->get_class_vars( 'Install', 'install' );
|
||||||
|
if ( empty( $repo ) && isset( $install_options['github_updater_install_repo'] ) ) {
|
||||||
|
$slug = $install_options['github_updater_install_repo'];
|
||||||
|
$new_source = trailingslashit( $remote_source ) . $slug;
|
||||||
|
self::$options['remote_install'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Singleton::get_instance( 'Branch', $this )->set_branch_on_switch( $slug );
|
||||||
|
|
||||||
|
$new_source = $this->fix_misnamed_directory( $new_source, $remote_source, $upgrader_object, $slug );
|
||||||
|
$new_source = $this->fix_release_asset_directory( $new_source, $remote_source, $upgrader_object, $slug );
|
||||||
|
|
||||||
|
$wp_filesystem->move( $source, $new_source );
|
||||||
|
|
||||||
|
return trailingslashit( $new_source );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Correctly rename an initially misnamed directory.
|
||||||
|
* This usually occurs when initial installation not using GitHub Updater.
|
||||||
|
* May cause plugin/theme deactivation.
|
||||||
|
*
|
||||||
|
* @param string $new_source
|
||||||
|
* @param string $remote_source
|
||||||
|
* @param Plugin|Theme $upgrader_object
|
||||||
|
* @param string $slug
|
||||||
|
*
|
||||||
|
* @return string $new_source
|
||||||
|
*/
|
||||||
|
private function fix_misnamed_directory( $new_source, $remote_source, $upgrader_object, $slug ) {
|
||||||
|
if ( ! array_key_exists( $slug, (array) $upgrader_object->config ) &&
|
||||||
|
! isset( self::$options['remote_install'] )
|
||||||
|
) {
|
||||||
|
if ( $upgrader_object instanceof Plugin ) {
|
||||||
|
foreach ( (array) $upgrader_object->config as $plugin ) {
|
||||||
|
if ( $slug === $plugin->slug ) {
|
||||||
|
$new_source = trailingslashit( $remote_source ) . $slug;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( $upgrader_object instanceof Theme ) {
|
||||||
|
foreach ( (array) $upgrader_object->config as $theme ) {
|
||||||
|
if ( $slug === $theme->slug ) {
|
||||||
|
$new_source = trailingslashit( $remote_source ) . $slug;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $new_source;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fix the directory structure of certain release assests.
|
||||||
|
*
|
||||||
|
* GitLab release assets have a different download directory structure.
|
||||||
|
* Bitbucket release assets need to be copied into a containing directory.
|
||||||
|
*
|
||||||
|
* @param string $new_source
|
||||||
|
* @param string $remote_source
|
||||||
|
* @param Plugin|Theme $upgrader_object
|
||||||
|
* @param string $slug
|
||||||
|
*
|
||||||
|
* @return string $new_source
|
||||||
|
*/
|
||||||
|
private function fix_release_asset_directory( $new_source, $remote_source, $upgrader_object, $slug ) {
|
||||||
|
global $wp_filesystem;
|
||||||
|
if ( isset( $upgrader_object->config[ $slug ]->release_asset ) &&
|
||||||
|
$upgrader_object->config[ $slug ]->release_asset ) {
|
||||||
|
if ( 'gitlab' === $upgrader_object->config[ $slug ]->git ) {
|
||||||
|
$new_source = trailingslashit( dirname( $remote_source ) ) . $slug;
|
||||||
|
add_filter( 'upgrader_post_install', [ $this, 'upgrader_post_install' ], 10, 3 );
|
||||||
|
}
|
||||||
|
if ( 'bitbucket' === $upgrader_object->config[ $slug ]->git ) {
|
||||||
|
$temp_source = trailingslashit( dirname( $remote_source ) ) . $slug;
|
||||||
|
$wp_filesystem->move( $remote_source, $temp_source );
|
||||||
|
wp_mkdir_p( $new_source );
|
||||||
|
copy_dir( $temp_source, $new_source );
|
||||||
|
$wp_filesystem->delete( $temp_source, true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $new_source;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete $source when updating from GitLab Release Asset.
|
||||||
|
*
|
||||||
|
* @param bool $true
|
||||||
|
* @param array $hook_extra
|
||||||
|
* @param array $result
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function upgrader_post_install( $true, $hook_extra, $result ) {
|
||||||
|
global $wp_filesystem;
|
||||||
|
|
||||||
|
$wp_filesystem->delete( $result['source'], true );
|
||||||
|
remove_filter( 'upgrader_post_install', [ $this, 'upgrader_post_install' ] );
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set array with normal repo names.
|
||||||
|
* Fix name even if installed without renaming originally, eg <repo>-master
|
||||||
|
*
|
||||||
|
* @param string $slug
|
||||||
|
* @param Base|Plugin|Theme $upgrader_object
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function get_repo_slugs( $slug, $upgrader_object = null ) {
|
||||||
|
$arr = [];
|
||||||
|
$rename = explode( '-', $slug );
|
||||||
|
array_pop( $rename );
|
||||||
|
$rename = implode( '-', $rename );
|
||||||
|
|
||||||
|
if ( null === $upgrader_object ) {
|
||||||
|
$upgrader_object = $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rename = isset( $upgrader_object->config[ $slug ] ) ? $slug : $rename;
|
||||||
|
|
||||||
|
foreach ( (array) $upgrader_object->config as $repo ) {
|
||||||
|
// Check repo slug or directory name for match.
|
||||||
|
$slug_check = [
|
||||||
|
$repo->slug,
|
||||||
|
dirname( $repo->file ),
|
||||||
|
];
|
||||||
|
|
||||||
|
// Exact match.
|
||||||
|
if ( \in_array( $slug, $slug_check, true ) ) {
|
||||||
|
$arr['slug'] = $repo->slug;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Soft match, there may still be an exact $slug match.
|
||||||
|
if ( \in_array( $rename, $slug_check, true ) ) {
|
||||||
|
$arr['slug'] = $repo->slug;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update transient for rollback or branch switch.
|
||||||
|
*
|
||||||
|
* @param string $type plugin|theme.
|
||||||
|
* @param \stdClass $repo
|
||||||
|
* @param bool $set_transient Default false, if true then set update transient.
|
||||||
|
*
|
||||||
|
* @return array $rollback Rollback transient.
|
||||||
|
*/
|
||||||
|
protected function set_rollback_transient( $type, $repo, $set_transient = false ) {
|
||||||
|
$repo_api = Singleton::get_instance( 'API', $this )->get_repo_api( $repo->git, $repo );
|
||||||
|
$this->tag = isset( $_GET['rollback'] ) ? $_GET['rollback'] : false;
|
||||||
|
$slug = 'plugin' === $type ? $repo->file : $repo->slug;
|
||||||
|
$download_link = $repo_api->construct_download_link( $this->tag );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter download link so developers can point to specific ZipFile
|
||||||
|
* to use as a download link during a branch switch.
|
||||||
|
*
|
||||||
|
* @since 8.6.0
|
||||||
|
*
|
||||||
|
* @param string $download_link Download URL.
|
||||||
|
* @param /stdClass $repo
|
||||||
|
* @param string $this->tag Branch or tag for rollback.
|
||||||
|
*/
|
||||||
|
$download_link = apply_filters_deprecated(
|
||||||
|
'github_updater_set_rollback_package',
|
||||||
|
[ $download_link, $repo, $this->tag ],
|
||||||
|
'8.8.0',
|
||||||
|
'github_updater_post_construct_download_link'
|
||||||
|
);
|
||||||
|
|
||||||
|
$rollback = [
|
||||||
|
$type => $slug,
|
||||||
|
'new_version' => $this->tag,
|
||||||
|
'url' => $repo->uri,
|
||||||
|
'package' => $download_link,
|
||||||
|
'branch' => $repo->branch,
|
||||||
|
'branches' => $repo->branches,
|
||||||
|
'type' => $repo->type,
|
||||||
|
];
|
||||||
|
|
||||||
|
if ( 'plugin' === $type ) {
|
||||||
|
$rollback['slug'] = $repo->slug;
|
||||||
|
$rollback = (object) $rollback;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rollback;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check to see if wp-cron/background updating has finished.
|
||||||
|
*
|
||||||
|
* @param null $repo
|
||||||
|
*
|
||||||
|
* @return bool true when waiting for background job to finish.
|
||||||
|
*/
|
||||||
|
protected function waiting_for_background_update( $repo = null ) {
|
||||||
|
$caches = [];
|
||||||
|
if ( null !== $repo ) {
|
||||||
|
$cache = isset( $repo->slug ) ? $this->get_repo_cache( $repo->slug ) : null;
|
||||||
|
|
||||||
|
return empty( $cache );
|
||||||
|
}
|
||||||
|
$repos = array_merge(
|
||||||
|
Singleton::get_instance( 'Plugin', $this )->get_plugin_configs(),
|
||||||
|
Singleton::get_instance( 'Theme', $this )->get_theme_configs()
|
||||||
|
);
|
||||||
|
foreach ( $repos as $git_repo ) {
|
||||||
|
$caches[ $git_repo->slug ] = $this->get_repo_cache( $git_repo->slug );
|
||||||
|
}
|
||||||
|
$waiting = array_filter(
|
||||||
|
$caches,
|
||||||
|
function ( $e ) {
|
||||||
|
return empty( $e );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return ! empty( $waiting );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create repo parts.
|
||||||
|
*
|
||||||
|
* @param string $repo
|
||||||
|
* @param string $type plugin|theme.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
protected function get_repo_parts( $repo, $type ) {
|
||||||
|
$arr['bool'] = false;
|
||||||
|
$pattern = '/' . strtolower( $repo ) . '_/';
|
||||||
|
$type = preg_replace( $pattern, '', $type );
|
||||||
|
$repo_types = [
|
||||||
|
'GitHub' => 'github_' . $type,
|
||||||
|
'Bitbucket' => 'bitbucket_' . $type,
|
||||||
|
'GitLab' => 'gitlab_' . $type,
|
||||||
|
'Gitea' => 'gitea_' . $type,
|
||||||
|
];
|
||||||
|
$repo_base_uris = [
|
||||||
|
'GitHub' => 'https://github.com/',
|
||||||
|
'Bitbucket' => 'https://bitbucket.org/',
|
||||||
|
'GitLab' => 'https://gitlab.com/',
|
||||||
|
'Gitea' => '',
|
||||||
|
];
|
||||||
|
|
||||||
|
if ( array_key_exists( $repo, $repo_types ) ) {
|
||||||
|
$arr['type'] = $repo_types[ $repo ];
|
||||||
|
$arr['git_server'] = strtolower( $repo );
|
||||||
|
$arr['base_uri'] = $repo_base_uris[ $repo ];
|
||||||
|
$arr['bool'] = true;
|
||||||
|
foreach ( self::$extra_repo_headers as $key => $value ) {
|
||||||
|
$arr[ $key ] = $repo . ' ' . $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return correct update row opening and closing tags for Shiny Updates.
|
||||||
|
*
|
||||||
|
* @param string $repo_name
|
||||||
|
* @param string $type plugin|theme.
|
||||||
|
* @param bool $branch_switcher
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function update_row_enclosure( $repo_name, $type, $branch_switcher = false ) {
|
||||||
|
global $wp_version;
|
||||||
|
$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
|
||||||
|
$repo_base = $repo_name;
|
||||||
|
$shiny_classes = ' notice inline notice-warning notice-alt';
|
||||||
|
|
||||||
|
if ( 'plugin' === $type ) {
|
||||||
|
$repo_base = dirname( $repo_name );
|
||||||
|
}
|
||||||
|
|
||||||
|
$open = '<tr class="plugin-update-tr" data-slug="' . esc_attr( $repo_base ) . '" data-plugin="' . esc_attr( $repo_name ) . '">
|
||||||
|
<td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
|
||||||
|
<div class="update-message">';
|
||||||
|
|
||||||
|
$enclosure = [
|
||||||
|
'open' => $open,
|
||||||
|
'close' => '</div></td></tr>',
|
||||||
|
];
|
||||||
|
|
||||||
|
if ( version_compare( $wp_version, '4.6', '>=' ) ) {
|
||||||
|
$open_p = '<p>';
|
||||||
|
$close_p = '</p>';
|
||||||
|
if ( $branch_switcher ) {
|
||||||
|
$open_p = '';
|
||||||
|
$close_p = '';
|
||||||
|
}
|
||||||
|
$enclosure = [
|
||||||
|
'open' => substr_replace( $open, $shiny_classes, -2, 0 ) . $open_p,
|
||||||
|
'close' => $close_p . '</div></td></tr>',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $enclosure;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make branch switch row.
|
||||||
|
*
|
||||||
|
* @param array $data Parameters for creating branch switching row.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function make_branch_switch_row( $data ) {
|
||||||
|
$rollback = empty( $this->config[ $data['slug'] ]->rollback ) ? [] : $this->config[ $data['slug'] ]->rollback;
|
||||||
|
|
||||||
|
printf(
|
||||||
|
/* translators: 1: branch name, 2: jQuery dropdown, 3: closing tag */
|
||||||
|
esc_html__( 'Current branch is `%1$s`, try %2$sanother version%3$s', 'github-updater' ),
|
||||||
|
$data['branch'],
|
||||||
|
'<a href="#" onclick="jQuery(\'#' . $data['id'] . '\').toggle();return false;">',
|
||||||
|
'</a>.'
|
||||||
|
);
|
||||||
|
|
||||||
|
print '<ul id="' . $data['id'] . '" style="display:none; width: 100%;">';
|
||||||
|
|
||||||
|
if ( null !== $data['branches'] ) {
|
||||||
|
foreach ( array_keys( $data['branches'] ) as $branch ) {
|
||||||
|
printf(
|
||||||
|
'<li><a href="%s%s" aria-label="' . esc_html__( 'Switch to branch ', 'github-updater' ) . $branch . '">%s</a></li>',
|
||||||
|
$data['nonced_update_url'],
|
||||||
|
'&rollback=' . rawurlencode( $branch ),
|
||||||
|
esc_attr( $branch )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( $rollback ) ) {
|
||||||
|
$rollback = array_keys( $rollback );
|
||||||
|
usort( $rollback, 'version_compare' );
|
||||||
|
krsort( $rollback );
|
||||||
|
$rollback = array_splice( $rollback, 0, 4, true );
|
||||||
|
array_shift( $rollback ); // Dump current tag.
|
||||||
|
foreach ( $rollback as $tag ) {
|
||||||
|
printf(
|
||||||
|
'<li><a href="%s%s" aria-label="' . esc_html__( 'Switch to release ', 'github-updater' ) . $tag . '">%s</a></li>',
|
||||||
|
$data['nonced_update_url'],
|
||||||
|
'&rollback=' . rawurlencode( $tag ),
|
||||||
|
esc_attr( $tag )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( empty( $rollback ) ) {
|
||||||
|
esc_html_e( 'No previous tags to rollback to.', 'github-updater' );
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</ul>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate update URL.
|
||||||
|
*
|
||||||
|
* @param string $type ( plugin or theme ).
|
||||||
|
* @param string $action
|
||||||
|
* @param string $repo_name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function get_update_url( $type, $action, $repo_name ) {
|
||||||
|
$update_url = esc_attr(
|
||||||
|
add_query_arg(
|
||||||
|
[
|
||||||
|
'action' => $action,
|
||||||
|
$type => rawurlencode( $repo_name ),
|
||||||
|
],
|
||||||
|
self_admin_url( 'update.php' )
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return $update_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse Enterprise, Languages, Release Asset, and CI Job headers for plugins and themes.
|
||||||
|
*
|
||||||
|
* @param array $header
|
||||||
|
* @param array|\WP_Theme $headers
|
||||||
|
* @param array $header_parts
|
||||||
|
* @param array $repo_parts
|
||||||
|
*
|
||||||
|
* @return array $header
|
||||||
|
*/
|
||||||
|
protected function parse_extra_headers( $header, $headers, $header_parts, $repo_parts ) {
|
||||||
|
$hosted_domains = [ 'github.com', 'bitbucket.org', 'gitlab.com' ];
|
||||||
|
$theme = null;
|
||||||
|
|
||||||
|
$header['enterprise_uri'] = null;
|
||||||
|
$header['enterprise_api'] = null;
|
||||||
|
$header['languages'] = null;
|
||||||
|
$header['ci_job'] = false;
|
||||||
|
$header['release_asset'] = false;
|
||||||
|
|
||||||
|
if ( ! empty( $header['host'] ) && ! in_array( $header['host'], $hosted_domains, true ) ) {
|
||||||
|
$header['enterprise_uri'] = $header['base_uri'];
|
||||||
|
$header['enterprise_api'] = trim( $header['enterprise_uri'], '/' );
|
||||||
|
switch ( $header_parts[0] ) {
|
||||||
|
case 'GitHub':
|
||||||
|
$header['enterprise_api'] .= '/api/v3';
|
||||||
|
break;
|
||||||
|
case 'GitLab':
|
||||||
|
$header['enterprise_api'] .= '/api/v4';
|
||||||
|
break;
|
||||||
|
case 'Bitbucket':
|
||||||
|
$header['enterprise_api'] .= '/rest/api';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $headers instanceof \WP_Theme ) {
|
||||||
|
$theme = $headers;
|
||||||
|
$headers = [];
|
||||||
|
$headers['Release Asset'] = '';
|
||||||
|
$header['release_asset'] = 'true' === $theme->get( 'Release Asset' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$self_hosted_parts = array_keys( self::$extra_repo_headers );
|
||||||
|
foreach ( $self_hosted_parts as $part ) {
|
||||||
|
if ( $theme instanceof \WP_Theme ) {
|
||||||
|
$headers[ $repo_parts[ $part ] ] = $theme->get( $repo_parts[ $part ] );
|
||||||
|
}
|
||||||
|
if ( array_key_exists( $repo_parts[ $part ], $headers ) &&
|
||||||
|
! empty( $headers[ $repo_parts[ $part ] ] )
|
||||||
|
) {
|
||||||
|
switch ( $part ) {
|
||||||
|
case 'Languages':
|
||||||
|
$header['languages'] = $headers[ $repo_parts[ $part ] ];
|
||||||
|
break;
|
||||||
|
case 'CIJob':
|
||||||
|
$header['ci_job'] = $headers[ $repo_parts[ $part ] ];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$header['release_asset'] = ! $header['release_asset'] && isset( $headers['Release Asset'] ) ? 'true' === $headers['Release Asset'] : $header['release_asset'];
|
||||||
|
|
||||||
|
return $header;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Bootstrap
|
||||||
|
*/
|
||||||
|
class Bootstrap {
|
||||||
|
/**
|
||||||
|
* Holds main plugin file.
|
||||||
|
*
|
||||||
|
* @var $file
|
||||||
|
*/
|
||||||
|
protected $file;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds main plugin directory.
|
||||||
|
*
|
||||||
|
* @var $dir
|
||||||
|
*/
|
||||||
|
protected $dir;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param string $file Main plugin file.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct( $file ) {
|
||||||
|
$this->file = $file;
|
||||||
|
$this->dir = dirname( $file );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the bootstrap.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run() {
|
||||||
|
add_action(
|
||||||
|
'init',
|
||||||
|
function() {
|
||||||
|
load_plugin_textdomain( 'github-updater' );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
define( 'GITHUB_UPDATER_DIR', $this->dir );
|
||||||
|
|
||||||
|
// Load Autoloader.
|
||||||
|
require_once $this->dir . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
register_activation_hook( $this->file, array( new Init(), 'rename_on_activation' ) );
|
||||||
|
( new Init() )->run();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize Persist Admin notices Dismissal.
|
||||||
|
*
|
||||||
|
* @link https://github.com/collizo4sky/persist-admin-notices-dismissal
|
||||||
|
*/
|
||||||
|
add_action( 'admin_init', array( 'PAnD', 'init' ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
108
wp-content/plugins/github-updater/src/GitHub_Updater/Branch.php
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater;
|
||||||
|
|
||||||
|
use Fragen\GitHub_Updater\Traits\GHU_Trait;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Branch
|
||||||
|
*/
|
||||||
|
class Branch {
|
||||||
|
use GHU_Trait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds repo cache data.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @var null
|
||||||
|
*/
|
||||||
|
public $cache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds site options.
|
||||||
|
*
|
||||||
|
* @var array $options
|
||||||
|
*/
|
||||||
|
private static $options;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Branch constructor.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param null $cache
|
||||||
|
*/
|
||||||
|
public function __construct( $cache = null ) {
|
||||||
|
$this->cache = $cache;
|
||||||
|
$this->load_options();
|
||||||
|
self::$options = $this->get_class_vars( 'Base', 'options' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current repo branch.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param \stdClass $repo
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get_current_branch( $repo ) {
|
||||||
|
$current_branch = ! empty( $this->cache['current_branch'] )
|
||||||
|
? $this->cache['current_branch']
|
||||||
|
: $repo->branch;
|
||||||
|
|
||||||
|
return $current_branch;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set current branch on branch switch.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param string $repo Repository slug.
|
||||||
|
*/
|
||||||
|
public function set_branch_on_switch( $repo ) {
|
||||||
|
$this->cache = $this->get_repo_cache( $repo );
|
||||||
|
|
||||||
|
if ( isset( $_GET['action'], $_GET['rollback'], $this->cache['branches'] ) &&
|
||||||
|
( 'upgrade-plugin' === $_GET['action'] || 'upgrade-theme' === $_GET['action'] )
|
||||||
|
) {
|
||||||
|
$current_branch = array_key_exists( $_GET['rollback'], $this->cache['branches'] )
|
||||||
|
? $_GET['rollback']
|
||||||
|
: 'master';
|
||||||
|
|
||||||
|
$this->set_repo_cache( 'current_branch', $current_branch, $repo );
|
||||||
|
self::$options[ 'current_branch_' . $repo ] = $current_branch;
|
||||||
|
update_site_option( 'github_updater', self::$options );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set current branch on install and update options.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param array $install Array of install data.
|
||||||
|
*/
|
||||||
|
public function set_branch_on_install( $install ) {
|
||||||
|
$this->set_repo_cache( 'current_branch', $install['github_updater_branch'], $install['repo'] );
|
||||||
|
self::$options[ 'current_branch_' . $install['repo'] ] = $install['github_updater_branch'];
|
||||||
|
update_site_option( 'github_updater', self::$options );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater;
|
||||||
|
|
||||||
|
use Fragen\GitHub_Updater\Traits\GHU_Trait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GHU_Upgrade
|
||||||
|
*/
|
||||||
|
class GHU_Upgrade {
|
||||||
|
use GHU_Trait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DB version.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $db_version = 8312;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run update check against db_version.
|
||||||
|
*/
|
||||||
|
public function run() {
|
||||||
|
$options = $this->get_class_vars( 'Base', 'options' );
|
||||||
|
$db_version = isset( $options['db_version'] ) ? (int) $options['db_version'] : 6000;
|
||||||
|
|
||||||
|
if ( $db_version === $this->db_version ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ( $db_version ) {
|
||||||
|
case $db_version < $this->db_version:
|
||||||
|
$this->delete_flush_cache();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$options = array_merge( (array) $options, [ 'db_version' => (int) $this->db_version ] );
|
||||||
|
update_site_option( 'github_updater', $options );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flush caches and delete cached options.
|
||||||
|
*/
|
||||||
|
private function delete_flush_cache() {
|
||||||
|
wp_cache_flush();
|
||||||
|
$this->delete_all_cached_data();
|
||||||
|
}
|
||||||
|
}
|
||||||
151
wp-content/plugins/github-updater/src/GitHub_Updater/Init.php
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater;
|
||||||
|
|
||||||
|
use Fragen\GitHub_Updater\Traits\GHU_Trait;
|
||||||
|
use Fragen\GitHub_Updater\Traits\Basic_Auth_Loader;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Init
|
||||||
|
*/
|
||||||
|
class Init extends Base {
|
||||||
|
use GHU_Trait, Basic_Auth_Loader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constuctor.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
$this->load_options();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rename on activation.
|
||||||
|
*
|
||||||
|
* Correctly renames the slug when GitHub Updater is installed
|
||||||
|
* via FTP or from plugin upload.
|
||||||
|
*
|
||||||
|
* Set current branch to `develop` if appropriate.
|
||||||
|
*
|
||||||
|
* `rename()` causes activation to fail.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function rename_on_activation() {
|
||||||
|
$plugin_dir = trailingslashit( WP_PLUGIN_DIR );
|
||||||
|
$slug = isset( $_GET['plugin'] ) ? $_GET['plugin'] : false;
|
||||||
|
$exploded = explode( '-', dirname( $slug ) );
|
||||||
|
|
||||||
|
if ( in_array( 'develop', $exploded, true ) ) {
|
||||||
|
$options = $this->get_class_vars( 'Base', 'options' );
|
||||||
|
update_site_option( 'github_updater', array_merge( $options, [ 'current_branch_github-updater' => 'develop' ] ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $slug && 'github-updater/github-updater.php' !== $slug ) {
|
||||||
|
@rename( $plugin_dir . dirname( $slug ), $plugin_dir . 'github-updater' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Let's get going.
|
||||||
|
*/
|
||||||
|
public function run() {
|
||||||
|
if ( ! static::is_heartbeat() ) {
|
||||||
|
$this->load_hooks();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( static::is_wp_cli() ) {
|
||||||
|
include_once __DIR__ . '/WP_CLI/CLI.php';
|
||||||
|
include_once __DIR__ . '/WP_CLI/CLI_Integration.php';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load relevant action/filter hooks.
|
||||||
|
* Use 'init' hook for user capabilities.
|
||||||
|
*/
|
||||||
|
protected function load_hooks() {
|
||||||
|
add_action( 'init', [ $this, 'load' ] );
|
||||||
|
add_action( 'init', [ $this, 'background_update' ] );
|
||||||
|
add_action( 'init', [ $this, 'set_options_filter' ] );
|
||||||
|
add_action( 'wp_ajax_github-updater-update', [ $this, 'ajax_update' ] );
|
||||||
|
add_action( 'wp_ajax_nopriv_github-updater-update', [ $this, 'ajax_update' ] );
|
||||||
|
|
||||||
|
// Load hook for shiny updates Basic Authentication headers.
|
||||||
|
if ( self::is_doing_ajax() ) {
|
||||||
|
$this->load_authentication_hooks();
|
||||||
|
}
|
||||||
|
|
||||||
|
add_filter( 'extra_theme_headers', [ $this, 'add_headers' ] );
|
||||||
|
add_filter( 'extra_plugin_headers', [ $this, 'add_headers' ] );
|
||||||
|
add_filter( 'upgrader_source_selection', [ $this, 'upgrader_source_selection' ], 10, 4 );
|
||||||
|
|
||||||
|
// Needed for updating from update-core.php.
|
||||||
|
if ( ! self::is_doing_ajax() ) {
|
||||||
|
add_filter( 'upgrader_pre_download', [ $this, 'upgrader_pre_download' ], 10, 3 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks current user capabilities and admin pages.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function can_update() {
|
||||||
|
global $pagenow;
|
||||||
|
|
||||||
|
// WP-CLI access has full capabilities.
|
||||||
|
if ( static::is_wp_cli() ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$can_user_update = current_user_can( 'update_plugins' ) && current_user_can( 'update_themes' );
|
||||||
|
$this->load_options();
|
||||||
|
|
||||||
|
$admin_pages = [
|
||||||
|
'plugins.php',
|
||||||
|
'plugin-install.php',
|
||||||
|
'themes.php',
|
||||||
|
'theme-install.php',
|
||||||
|
'update-core.php',
|
||||||
|
'update.php',
|
||||||
|
'options-general.php',
|
||||||
|
'options.php',
|
||||||
|
'settings.php',
|
||||||
|
'edit.php',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Needed for sequential shiny updating.
|
||||||
|
if ( isset( $_POST['action'] ) && in_array( $_POST['action'], [ 'update-plugin', 'update-theme' ], true ) ) {
|
||||||
|
$admin_pages[] = 'admin-ajax.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter $admin_pages to be able to adjust the pages where GitHub Updater runs.
|
||||||
|
*
|
||||||
|
* @since 8.0.0
|
||||||
|
*
|
||||||
|
* @param array $admin_pages Default array of admin pages where GitHub Updater runs.
|
||||||
|
*/
|
||||||
|
$admin_pages = array_unique( apply_filters( 'github_updater_add_admin_pages', $admin_pages ) );
|
||||||
|
|
||||||
|
return $can_user_update && in_array( $pagenow, $admin_pages, true );
|
||||||
|
}
|
||||||
|
}
|
||||||
560
wp-content/plugins/github-updater/src/GitHub_Updater/Install.php
Normal file
@@ -0,0 +1,560 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater;
|
||||||
|
|
||||||
|
use Fragen\Singleton;
|
||||||
|
use Fragen\GitHub_Updater\Traits\GHU_Trait;
|
||||||
|
use Fragen\GitHub_Updater\Traits\Basic_Auth_Loader;
|
||||||
|
use Fragen\GitHub_Updater\WP_CLI\CLI_Plugin_Installer_Skin;
|
||||||
|
use Fragen\GitHub_Updater\WP_CLI\CLI_Theme_Installer_Skin;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Install
|
||||||
|
*
|
||||||
|
* Install <author>/<repo> directly from GitHub Updater.
|
||||||
|
*/
|
||||||
|
class Install {
|
||||||
|
use GHU_Trait, Basic_Auth_Loader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class options.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected static $install = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hold local copy of GitHub Updater options.
|
||||||
|
*
|
||||||
|
* @var mixed
|
||||||
|
*/
|
||||||
|
private static $options;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hold local copy of installed APIs.
|
||||||
|
*
|
||||||
|
* @var mixed
|
||||||
|
*/
|
||||||
|
private static $installed_apis;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hold local copy of git servers.
|
||||||
|
*
|
||||||
|
* @var mixed
|
||||||
|
*/
|
||||||
|
private static $git_servers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
self::$options = $this->get_class_vars( 'Base', 'options' );
|
||||||
|
self::$installed_apis = $this->get_class_vars( 'Base', 'installed_apis' );
|
||||||
|
self::$git_servers = $this->get_class_vars( 'Base', 'git_servers' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Let's set up the Install tabs.
|
||||||
|
* Need class-wp-upgrader.php for upgrade classes.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run() {
|
||||||
|
$this->load_js();
|
||||||
|
$this->add_settings_tabs();
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load javascript for Install.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function load_js() {
|
||||||
|
add_action(
|
||||||
|
'admin_enqueue_scripts',
|
||||||
|
function () {
|
||||||
|
wp_register_script( 'ghu-install', plugins_url( basename( GITHUB_UPDATER_DIR ) . '/js/ghu-install-vanilla.js' ), [], false, true );
|
||||||
|
wp_enqueue_script( 'ghu-install' );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds Install tabs to Settings page.
|
||||||
|
*/
|
||||||
|
public function add_settings_tabs() {
|
||||||
|
$install_tabs = [];
|
||||||
|
if ( current_user_can( 'install_plugins' ) ) {
|
||||||
|
$install_tabs['github_updater_install_plugin'] = esc_html__( 'Install Plugin', 'github-updater' );
|
||||||
|
}
|
||||||
|
if ( current_user_can( 'install_themes' ) ) {
|
||||||
|
$install_tabs['github_updater_install_theme'] = esc_html__( 'Install Theme', 'github-updater' );
|
||||||
|
}
|
||||||
|
add_filter(
|
||||||
|
'github_updater_add_settings_tabs',
|
||||||
|
function ( $tabs ) use ( $install_tabs ) {
|
||||||
|
return array_merge( $tabs, $install_tabs );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
add_action(
|
||||||
|
'github_updater_add_admin_page',
|
||||||
|
function ( $tab ) {
|
||||||
|
$this->add_admin_page( $tab );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Settings page data via action hook.
|
||||||
|
*
|
||||||
|
* @uses 'github_updater_add_admin_page' action hook
|
||||||
|
*
|
||||||
|
* @param string $tab Name of tab.
|
||||||
|
*/
|
||||||
|
public function add_admin_page( $tab ) {
|
||||||
|
if ( 'github_updater_install_plugin' === $tab ) {
|
||||||
|
$this->install( 'plugin' );
|
||||||
|
$this->create_form( 'plugin' );
|
||||||
|
}
|
||||||
|
if ( 'github_updater_install_theme' === $tab ) {
|
||||||
|
$this->install( 'theme' );
|
||||||
|
$this->create_form( 'theme' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Install remote plugin or theme.
|
||||||
|
*
|
||||||
|
* @param string $type
|
||||||
|
* @param array $config
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function install( $type, $config = null ) {
|
||||||
|
$this->set_install_post_data( $config );
|
||||||
|
|
||||||
|
if ( isset( $_POST['option_page'] ) && 'github_updater_install' === $_POST['option_page'] ) {
|
||||||
|
if ( empty( $_POST['github_updater_branch'] ) ) {
|
||||||
|
$_POST['github_updater_branch'] = 'master';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exit early if no repo entered.
|
||||||
|
if ( empty( $_POST['github_updater_repo'] ) ) {
|
||||||
|
echo '<h3>';
|
||||||
|
esc_html_e( 'A repository URI is required.', 'github-updater' );
|
||||||
|
echo '</h3>';
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transform URI to owner/repo.
|
||||||
|
$headers = $this->parse_header_uri( $_POST['github_updater_repo'] );
|
||||||
|
$_POST['github_updater_repo'] = $headers['owner_repo'];
|
||||||
|
|
||||||
|
self::$install = $this->sanitize( $_POST );
|
||||||
|
self::$install['repo'] = self::$install['github_updater_install_repo'] = $headers['repo'];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create GitHub endpoint.
|
||||||
|
* Save Access Token if present.
|
||||||
|
* Check for GitHub Self-Hosted.
|
||||||
|
*/
|
||||||
|
if ( 'github' === self::$install['github_updater_api'] ) {
|
||||||
|
self::$install = Singleton::get_instance( 'API\GitHub_API', $this, new \stdClass() )->remote_install( $headers, self::$install );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create Bitbucket endpoint and instantiate class Bitbucket_API.
|
||||||
|
* Save private setting if present.
|
||||||
|
* Ensures `maybe_authenticate_http()` is available.
|
||||||
|
*/
|
||||||
|
if ( 'bitbucket' === self::$install['github_updater_api'] ) {
|
||||||
|
$this->load_authentication_hooks();
|
||||||
|
if ( self::$installed_apis['bitbucket_api'] ) {
|
||||||
|
self::$install = Singleton::get_instance( 'API\Bitbucket_API', $this, new \stdClass() )->remote_install( $headers, self::$install );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( self::$installed_apis['bitbucket_server_api'] ) {
|
||||||
|
self::$install = Singleton::get_instance( 'API\Bitbucket_Server_API', $this, new \stdClass() )->remote_install( $headers, self::$install );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create GitLab endpoint.
|
||||||
|
* Save Access Token if present.
|
||||||
|
* Check for GitLab Self-Hosted.
|
||||||
|
*/
|
||||||
|
if ( 'gitlab' === self::$install['github_updater_api'] ) {
|
||||||
|
if ( self::$installed_apis['gitlab_api'] ) {
|
||||||
|
self::$install = Singleton::get_instance( 'API\GitLab_API', $this, new \stdClass() )->remote_install( $headers, self::$install );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create Gitea endpoint.
|
||||||
|
* Save Access Token if present.
|
||||||
|
*/
|
||||||
|
if ( 'gitea' === self::$install['github_updater_api'] ) {
|
||||||
|
if ( self::$installed_apis['gitea_api'] ) {
|
||||||
|
self::$install = Singleton::get_instance( 'API\Gitea_API', $this, new \stdClass() )->remote_install( $headers, self::$install );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Install from Zipfile.
|
||||||
|
*/
|
||||||
|
if ( 'zipfile' === self::$install['github_updater_api'] ) {
|
||||||
|
self::$install = Singleton::get_instance( 'API\Zipfile_API', $this )->remote_install( $headers, self::$install );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset( self::$install['options'] ) ) {
|
||||||
|
$this->save_options_on_install( self::$install['options'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = self::$install['download_link'];
|
||||||
|
$upgrader = $this->get_upgrader( $type, $url );
|
||||||
|
|
||||||
|
// Install the repo from the $source urldecode() and save branch setting.
|
||||||
|
if ( $upgrader && $upgrader->install( $url ) ) {
|
||||||
|
Singleton::get_instance( 'Branch', $this )->set_branch_on_install( self::$install );
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save options set during installation.
|
||||||
|
*
|
||||||
|
* @param array $install_options Array of options from remote install process.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function save_options_on_install( $install_options ) {
|
||||||
|
self::$options = array_merge( self::$options, $install_options );
|
||||||
|
update_site_option( 'github_updater', self::$options );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set remote install data into $_POST.
|
||||||
|
*
|
||||||
|
* @param array $config Data for a remote install.
|
||||||
|
*/
|
||||||
|
private function set_install_post_data( $config ) {
|
||||||
|
if ( ! isset( $config['uri'] ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$headers = $this->parse_header_uri( $config['uri'] );
|
||||||
|
$api = false !== strpos( $headers['host'], '.com' )
|
||||||
|
? rtrim( $headers['host'], '.com' )
|
||||||
|
: rtrim( $headers['host'], '.org' );
|
||||||
|
|
||||||
|
$api = isset( $config['git'] ) ? $config['git'] : $api;
|
||||||
|
|
||||||
|
$_POST['github_updater_repo'] = $config['uri'];
|
||||||
|
$_POST['github_updater_branch'] = $config['branch'];
|
||||||
|
$_POST['github_updater_api'] = $api;
|
||||||
|
$_POST['option_page'] = 'github_updater_install';
|
||||||
|
|
||||||
|
switch ( $api ) {
|
||||||
|
case 'github':
|
||||||
|
$_POST['github_access_token'] = $config['private'] ?: null;
|
||||||
|
break;
|
||||||
|
case 'bitbucket':
|
||||||
|
$_POST['is_private'] = $config['private'] ? '1' : null;
|
||||||
|
break;
|
||||||
|
case 'gitlab':
|
||||||
|
$_POST['gitlab_access_token'] = $config['private'] ?: null;
|
||||||
|
break;
|
||||||
|
case 'gitea':
|
||||||
|
$_POST['gitea_access_token'] = $config['private'] ?: null;
|
||||||
|
break;
|
||||||
|
case 'zipfile':
|
||||||
|
$_POST['zipfile_slug'] = $config['slug'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the appropriate upgrader for remote installation.
|
||||||
|
*
|
||||||
|
* @param string $type 'plugin' | 'theme'.
|
||||||
|
* @param string $url URL of the repository to be installed.
|
||||||
|
*
|
||||||
|
* @return bool|\Plugin_Upgrader|\Theme_Upgrader
|
||||||
|
*/
|
||||||
|
private function get_upgrader( $type, $url ) {
|
||||||
|
$nonce = wp_nonce_url( $url );
|
||||||
|
$upgrader = false;
|
||||||
|
|
||||||
|
if ( 'plugin' === $type ) {
|
||||||
|
$plugin = self::$install['repo'];
|
||||||
|
|
||||||
|
// Create a new instance of Plugin_Upgrader.
|
||||||
|
$skin = static::is_wp_cli()
|
||||||
|
? new CLI_Plugin_Installer_Skin()
|
||||||
|
: new \Plugin_Installer_Skin( compact( 'type', 'url', 'nonce', 'plugin' ) );
|
||||||
|
$upgrader = new \Plugin_Upgrader( $skin );
|
||||||
|
add_filter(
|
||||||
|
'install_plugin_complete_actions',
|
||||||
|
[
|
||||||
|
$this,
|
||||||
|
'install_plugin_complete_actions',
|
||||||
|
],
|
||||||
|
10,
|
||||||
|
3
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'theme' === $type ) {
|
||||||
|
$theme = self::$install['repo'];
|
||||||
|
|
||||||
|
// Create a new instance of Theme_Upgrader.
|
||||||
|
$skin = static::is_wp_cli()
|
||||||
|
? new CLI_Theme_Installer_Skin()
|
||||||
|
: new \Theme_Installer_Skin( compact( 'type', 'url', 'nonce', 'theme' ) );
|
||||||
|
$upgrader = new \Theme_Upgrader( $skin );
|
||||||
|
add_filter(
|
||||||
|
'install_theme_complete_actions',
|
||||||
|
[
|
||||||
|
$this,
|
||||||
|
'install_theme_complete_actions',
|
||||||
|
],
|
||||||
|
10,
|
||||||
|
3
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $upgrader;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Install Plugin or Install Theme page.
|
||||||
|
*
|
||||||
|
* @param string $type
|
||||||
|
*/
|
||||||
|
public function create_form( $type ) {
|
||||||
|
// Bail if installing.
|
||||||
|
if ( isset( $_POST['option_page'] ) && 'github_updater_install' === $_POST['option_page'] ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->register_settings( $type ); ?>
|
||||||
|
<form method="post">
|
||||||
|
<?php
|
||||||
|
settings_fields( 'github_updater_install' );
|
||||||
|
do_settings_sections( 'github_updater_install_' . $type );
|
||||||
|
if ( 'plugin' === $type ) {
|
||||||
|
submit_button( esc_html__( 'Install Plugin', 'github-updater' ) );
|
||||||
|
}
|
||||||
|
if ( 'theme' === $type ) {
|
||||||
|
submit_button( esc_html__( 'Install Theme', 'github-updater' ) );
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add settings sections.
|
||||||
|
*
|
||||||
|
* @param string $type
|
||||||
|
*/
|
||||||
|
public function register_settings( $type ) {
|
||||||
|
$repo_type = null;
|
||||||
|
|
||||||
|
// Place translatable strings into variables.
|
||||||
|
if ( 'plugin' === $type ) {
|
||||||
|
$repo_type = esc_html__( 'Plugin', 'github-updater' );
|
||||||
|
}
|
||||||
|
if ( 'theme' === $type ) {
|
||||||
|
$repo_type = esc_html__( 'Theme', 'github-updater' );
|
||||||
|
}
|
||||||
|
|
||||||
|
register_setting(
|
||||||
|
'github_updater_install',
|
||||||
|
'github_updater_install_' . $type,
|
||||||
|
[ $this, 'sanitize' ]
|
||||||
|
);
|
||||||
|
|
||||||
|
add_settings_section(
|
||||||
|
$type,
|
||||||
|
/* translators: variable is 'Plugin' or 'Theme' */
|
||||||
|
sprintf( esc_html__( 'GitHub Updater Install %s', 'github-updater' ), $repo_type ),
|
||||||
|
[],
|
||||||
|
'github_updater_install_' . $type
|
||||||
|
);
|
||||||
|
|
||||||
|
add_settings_field(
|
||||||
|
$type . '_repo',
|
||||||
|
/* translators: variable is 'Plugin' or 'Theme' */
|
||||||
|
sprintf( esc_html__( '%s URI', 'github-updater' ), $repo_type ),
|
||||||
|
[ $this, 'get_repo' ],
|
||||||
|
'github_updater_install_' . $type,
|
||||||
|
$type
|
||||||
|
);
|
||||||
|
|
||||||
|
add_settings_field(
|
||||||
|
$type . '_branch',
|
||||||
|
esc_html__( 'Repository Branch', 'github-updater' ),
|
||||||
|
[ $this, 'branch' ],
|
||||||
|
'github_updater_install_' . $type,
|
||||||
|
$type
|
||||||
|
);
|
||||||
|
|
||||||
|
add_settings_field(
|
||||||
|
$type . '_api',
|
||||||
|
esc_html__( 'Remote Repository Host', 'github-updater' ),
|
||||||
|
[ $this, 'install_api' ],
|
||||||
|
'github_updater_install_' . $type,
|
||||||
|
$type
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action hook to add git API install settings fields.
|
||||||
|
*
|
||||||
|
* @since 8.0.0
|
||||||
|
*
|
||||||
|
* @param string $type 'plugin'|'theme'.
|
||||||
|
*/
|
||||||
|
do_action( 'github_updater_add_install_settings_fields', $type );
|
||||||
|
|
||||||
|
// Load install settings fields for existing APIs that are not loaded.
|
||||||
|
$running_servers = $this->get_running_git_servers();
|
||||||
|
$git_servers = $this->get_class_vars( 'Base', 'git_servers' );
|
||||||
|
$servers_not_running = array_diff( array_flip( $git_servers ), $running_servers );
|
||||||
|
if ( ! empty( $servers_not_running ) ) {
|
||||||
|
foreach ( array_keys( $servers_not_running ) as $server ) {
|
||||||
|
$class = 'API\\' . $server . '_API';
|
||||||
|
Singleton::get_instance( $class, $this )->add_install_settings_fields( $type );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repo setting.
|
||||||
|
*/
|
||||||
|
public function get_repo() {
|
||||||
|
?>
|
||||||
|
<label for="github_updater_repo">
|
||||||
|
<input type="text" style="width:50%;" id="github_updater_repo" name="github_updater_repo" value="" autofocus>
|
||||||
|
<br>
|
||||||
|
<span class="description">
|
||||||
|
<?php esc_html_e( 'URI is case sensitive.', 'github-updater' ); ?>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Branch setting.
|
||||||
|
*/
|
||||||
|
public function branch() {
|
||||||
|
?>
|
||||||
|
<label for="github_updater_branch">
|
||||||
|
<input type="text" style="width:50%;" id="github_updater_branch" name="github_updater_branch" value="" placeholder="master">
|
||||||
|
<br>
|
||||||
|
<span class="description">
|
||||||
|
<?php esc_html_e( 'Enter branch name or leave empty for `master`', 'github-updater' ); ?>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API setting.
|
||||||
|
*/
|
||||||
|
public function install_api() {
|
||||||
|
?>
|
||||||
|
<label for="github_updater_api">
|
||||||
|
<select id="github_updater_api" name="github_updater_api">
|
||||||
|
<?php foreach ( self::$git_servers as $key => $value ) : ?>
|
||||||
|
<?php if ( self::$installed_apis[ $key . '_api' ] ) : ?>
|
||||||
|
<option value="<?php esc_attr_e( $key ); ?>" <?php selected( $key ); ?> >
|
||||||
|
<?php esc_html_e( $value ); ?>
|
||||||
|
</option>
|
||||||
|
<?php endif ?>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove activation links after plugin installation as no method to get $plugin_file.
|
||||||
|
*
|
||||||
|
* @param array $install_actions
|
||||||
|
* @param mixed $api
|
||||||
|
* @param string $plugin_file
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function install_plugin_complete_actions( $install_actions, $api, $plugin_file ) {
|
||||||
|
unset( $install_actions['activate_plugin'], $install_actions['network_activate'] );
|
||||||
|
|
||||||
|
return $install_actions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fix activation links after theme installation, no method to get proper theme name.
|
||||||
|
*
|
||||||
|
* @param array $install_actions
|
||||||
|
* @param mixed $api
|
||||||
|
* @param mixed $theme_info
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function install_theme_complete_actions( $install_actions, $api, $theme_info ) {
|
||||||
|
if ( isset( $install_actions['preview'] ) ) {
|
||||||
|
unset( $install_actions['preview'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
$stylesheet = self::$install['repo'];
|
||||||
|
$activate_link = add_query_arg(
|
||||||
|
[
|
||||||
|
'action' => 'activate',
|
||||||
|
// 'template' => rawurlencode( $template ),
|
||||||
|
'stylesheet' => rawurlencode( $stylesheet ),
|
||||||
|
],
|
||||||
|
admin_url( 'themes.php' )
|
||||||
|
);
|
||||||
|
$activate_link = esc_url( wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet ) );
|
||||||
|
|
||||||
|
$install_actions['activate'] = '<a href="' . $activate_link . '" class="activatelink"><span aria-hidden="true">' . esc_attr__( 'Activate', 'github-updater' ) . '</span><span class="screen-reader-text">' . esc_attr__( 'Activate', 'github-updater' ) . ' “' . $stylesheet . '”</span></a>';
|
||||||
|
|
||||||
|
if ( is_network_admin() && current_user_can( 'manage_network_themes' ) ) {
|
||||||
|
$network_activate_link = add_query_arg(
|
||||||
|
[
|
||||||
|
'action' => 'enable',
|
||||||
|
'theme' => rawurlencode( $stylesheet ),
|
||||||
|
],
|
||||||
|
network_admin_url( 'themes.php' )
|
||||||
|
);
|
||||||
|
$network_activate_link = esc_url( wp_nonce_url( $network_activate_link, 'enable-theme_' . $stylesheet ) );
|
||||||
|
|
||||||
|
$install_actions['network_enable'] = '<a href="' . $network_activate_link . '" target="_parent">' . esc_attr_x( 'Network Enable', 'This refers to a network activation in a multisite installation', 'github-updater' ) . '</a>';
|
||||||
|
unset( $install_actions['activate'] );
|
||||||
|
}
|
||||||
|
ksort( $install_actions );
|
||||||
|
|
||||||
|
return $install_actions;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater;
|
||||||
|
|
||||||
|
use Fragen\Singleton;
|
||||||
|
use Fragen\GitHub_Updater\Traits\GHU_Trait;
|
||||||
|
use Fragen\GitHub_Updater\API\Language_Pack_API;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Language_Pack
|
||||||
|
*/
|
||||||
|
class Language_Pack {
|
||||||
|
use GHU_Trait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Variable containing the plugin/theme object.
|
||||||
|
*
|
||||||
|
* @var Plugin|Theme
|
||||||
|
*/
|
||||||
|
protected $repo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Variable containing the Language_Pack_API.
|
||||||
|
*
|
||||||
|
* @var Language_Pack_API
|
||||||
|
*/
|
||||||
|
private $repo_api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Language_Pack constructor.
|
||||||
|
*
|
||||||
|
* @param Plugin|Theme $repo Plugin/Theme object.
|
||||||
|
* @param Language_Pack_API $api Language_Pack_API object.
|
||||||
|
*/
|
||||||
|
public function __construct( $repo, Language_Pack_API $api ) {
|
||||||
|
if ( null === $repo->languages ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->repo = $repo;
|
||||||
|
$this->repo_api = $api;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do the Language Pack integration.
|
||||||
|
*/
|
||||||
|
public function run() {
|
||||||
|
if ( null === $this->repo ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$headers = $this->parse_header_uri( $this->repo->languages );
|
||||||
|
$this->repo_api->get_language_pack( $headers );
|
||||||
|
|
||||||
|
add_filter( 'site_transient_update_plugins', [ $this, 'update_site_transient' ] );
|
||||||
|
add_filter( 'site_transient_update_themes', [ $this, 'update_site_transient' ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add language translations to update_plugins or update_themes transients.
|
||||||
|
*
|
||||||
|
* @param mixed $transient Update transient.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function update_site_transient( $transient ) {
|
||||||
|
$locales = get_available_languages();
|
||||||
|
$locales = ! empty( $locales ) ? $locales : [ get_locale() ];
|
||||||
|
$repos = [];
|
||||||
|
|
||||||
|
if ( ! isset( $transient->translations ) ) {
|
||||||
|
return $transient;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'site_transient_update_plugins' === current_filter() ) {
|
||||||
|
$repos = Singleton::get_instance( 'Plugin', $this )->get_plugin_configs();
|
||||||
|
$translations = wp_get_installed_translations( 'plugins' );
|
||||||
|
}
|
||||||
|
if ( 'site_transient_update_themes' === current_filter() ) {
|
||||||
|
$repos = Singleton::get_instance( 'Theme', $this )->get_theme_configs();
|
||||||
|
$translations = wp_get_installed_translations( 'themes' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$repos = array_filter(
|
||||||
|
$repos,
|
||||||
|
function ( $e ) {
|
||||||
|
return isset( $e->language_packs );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( $repos as $repo ) {
|
||||||
|
foreach ( $locales as $locale ) {
|
||||||
|
$lang_pack_mod = isset( $repo->language_packs->$locale )
|
||||||
|
? strtotime( $repo->language_packs->$locale->updated )
|
||||||
|
: 0;
|
||||||
|
$translation_mod = isset( $translations[ $repo->slug ][ $locale ] )
|
||||||
|
? strtotime( $translations[ $repo->slug ][ $locale ]['PO-Revision-Date'] )
|
||||||
|
: 0;
|
||||||
|
if ( $lang_pack_mod > $translation_mod ) {
|
||||||
|
$transient->translations[] = (array) $repo->language_packs->$locale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$transient->translations = array_unique( $transient->translations, SORT_REGULAR );
|
||||||
|
|
||||||
|
return $transient;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater;
|
||||||
|
|
||||||
|
use Fragen\GitHub_Updater\Traits\GHU_Trait;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Messages
|
||||||
|
*/
|
||||||
|
class Messages {
|
||||||
|
use GHU_Trait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds WP_Error message.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public static $error_message = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display message when API returns other than 200 or 404.
|
||||||
|
*
|
||||||
|
* @param string $type
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function create_error_message( $type = '' ) {
|
||||||
|
global $pagenow;
|
||||||
|
|
||||||
|
$update_pages = [ 'update-core.php', 'plugins.php', 'themes.php' ];
|
||||||
|
$settings_pages = [ 'settings.php', 'options-general.php' ];
|
||||||
|
|
||||||
|
if (
|
||||||
|
( ( ! isset( $_GET['page'] ) || 'github-updater' !== $_GET['page'] ) &&
|
||||||
|
in_array( $pagenow, $settings_pages, true ) ) ||
|
||||||
|
! in_array( $pagenow, array_merge( $update_pages, $settings_pages ), true )
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( is_admin() && ! static::is_doing_ajax() ) {
|
||||||
|
switch ( $type ) {
|
||||||
|
case is_wp_error( $type ):
|
||||||
|
self::$error_message = $type->get_error_message();
|
||||||
|
add_action(
|
||||||
|
is_multisite() ? 'network_admin_notices' : 'admin_notices',
|
||||||
|
[
|
||||||
|
$this,
|
||||||
|
'show_wp_error',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'waiting':
|
||||||
|
if ( ! apply_filters( 'github_updater_disable_wpcron', false ) ) {
|
||||||
|
add_action( is_multisite() ? 'network_admin_notices' : 'admin_notices', [ $this, 'waiting' ] );
|
||||||
|
}
|
||||||
|
// no break.
|
||||||
|
case 'git':
|
||||||
|
default:
|
||||||
|
add_action(
|
||||||
|
is_multisite() ? 'network_admin_notices' : 'admin_notices',
|
||||||
|
[
|
||||||
|
$this,
|
||||||
|
'show_403_error_message',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
add_action(
|
||||||
|
is_multisite() ? 'network_admin_notices' : 'admin_notices',
|
||||||
|
[
|
||||||
|
$this,
|
||||||
|
'show_401_error_message',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create error message for 403 error.
|
||||||
|
* Usually 403 as API rate limit max out.
|
||||||
|
*/
|
||||||
|
public function show_403_error_message() {
|
||||||
|
$_403 = false;
|
||||||
|
$error_code = $this->get_error_codes();
|
||||||
|
foreach ( (array) $error_code as $repo ) {
|
||||||
|
if ( ( ! $_403 && isset( $repo['code'], $repo['git'] ) )
|
||||||
|
&& 403 === $repo['code'] && 'github' === $repo['git'] ) {
|
||||||
|
$_403 = true;
|
||||||
|
if ( ! \PAnD::is_admin_notice_active( '403-error-1' ) ) {
|
||||||
|
return;
|
||||||
|
} ?>
|
||||||
|
<div data-dismissible="403-error-1" class="notice-error notice is-dismissible">
|
||||||
|
<p>
|
||||||
|
<?php
|
||||||
|
esc_html_e( 'GitHub Updater Error Code:', 'github-updater' );
|
||||||
|
echo ' ' . $repo['code'];
|
||||||
|
?>
|
||||||
|
<br>
|
||||||
|
<?php
|
||||||
|
printf(
|
||||||
|
/* translators: %s: wait time */
|
||||||
|
esc_html__( 'GitHub API’s rate limit will reset in %s minutes.', 'github-updater' ),
|
||||||
|
$repo['wait']
|
||||||
|
);
|
||||||
|
echo '<br>';
|
||||||
|
printf(
|
||||||
|
/* translators: %s: GitHub personal access token URL */
|
||||||
|
wp_kses_post( __( 'It looks like you are running into GitHub API rate limits. Be sure and configure a <a href="%s">Personal Access Token</a> to avoid this issue.', 'github-updater' ) ),
|
||||||
|
esc_url( 'https://help.github.com/articles/creating-an-access-token-for-command-line-use/' )
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create error message or 401 (Authentication Error) error.
|
||||||
|
* Usually 401 as private repo with no token set or incorrect user/pass.
|
||||||
|
*/
|
||||||
|
public function show_401_error_message() {
|
||||||
|
$_401 = false;
|
||||||
|
$error_code = $this->get_error_codes();
|
||||||
|
foreach ( (array) $error_code as $repo ) {
|
||||||
|
if ( ( ! $_401 && isset( $repo['code'] ) ) && 401 === $repo['code'] ) {
|
||||||
|
$_401 = true;
|
||||||
|
if ( ! \PAnD::is_admin_notice_active( '401-error-1' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div data-dismissible="401-error-1" class="notice-error notice is-dismissible">
|
||||||
|
<p>
|
||||||
|
<?php
|
||||||
|
esc_html_e( 'GitHub Updater Error Code:', 'github-updater' );
|
||||||
|
echo ' ' . $repo['code'];
|
||||||
|
?>
|
||||||
|
<br>
|
||||||
|
<?php esc_html_e( 'There is probably an access token or password error on the GitHub Updater Settings page.', 'github-updater' ); ?>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate error message for WP_Error.
|
||||||
|
*/
|
||||||
|
public function show_wp_error() {
|
||||||
|
?>
|
||||||
|
<div class="notice-error notice">
|
||||||
|
<p>
|
||||||
|
<?php
|
||||||
|
esc_html_e( 'GitHub Updater Error Code:', 'github-updater' );
|
||||||
|
echo ' ' . self::$error_message;
|
||||||
|
?>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate information message when waiting for WP-Cron to finish.
|
||||||
|
*/
|
||||||
|
public function waiting() {
|
||||||
|
?>
|
||||||
|
<div class="notice-info notice is-dismissible">
|
||||||
|
<p>
|
||||||
|
<?php esc_html_e( 'GitHub Updater Information', 'github-updater' ); ?>
|
||||||
|
<br>
|
||||||
|
<?php esc_html_e( 'Please be patient while WP-Cron finishes making API calls.', 'github-updater' ); ?>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
443
wp-content/plugins/github-updater/src/GitHub_Updater/Plugin.php
Normal file
@@ -0,0 +1,443 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater;
|
||||||
|
|
||||||
|
use Fragen\Singleton;
|
||||||
|
use Fragen\GitHub_Updater\Traits\GHU_Trait;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Plugin
|
||||||
|
*
|
||||||
|
* Update a WordPress plugin from a GitHub repo.
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @author Codepress
|
||||||
|
* @link https://github.com/codepress/github-plugin-updater
|
||||||
|
*/
|
||||||
|
class Plugin extends Base {
|
||||||
|
use GHU_Trait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rollback variable
|
||||||
|
*
|
||||||
|
* @var string branch
|
||||||
|
*/
|
||||||
|
public $tag = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
$this->load_options();
|
||||||
|
|
||||||
|
// Get details of installed git sourced plugins.
|
||||||
|
$this->config = $this->get_plugin_meta();
|
||||||
|
|
||||||
|
if ( null === $this->config ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of configurations for the known plugins.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_plugin_configs() {
|
||||||
|
return $this->config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get details of Git-sourced plugins from those that are installed.
|
||||||
|
*
|
||||||
|
* @return array Indexed array of associative arrays of plugin details.
|
||||||
|
*/
|
||||||
|
protected function get_plugin_meta() {
|
||||||
|
// Ensure get_plugins() function is available.
|
||||||
|
include_once ABSPATH . '/wp-admin/includes/plugin.php';
|
||||||
|
|
||||||
|
$plugins = get_plugins();
|
||||||
|
$git_plugins = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter to add plugins not containing appropriate header line.
|
||||||
|
*
|
||||||
|
* @since 5.4.0
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param array $additions Listing of plugins to add.
|
||||||
|
* Default null.
|
||||||
|
* @param array $plugins Listing of all plugins.
|
||||||
|
* @param string 'plugin' Type being passed.
|
||||||
|
*/
|
||||||
|
$additions = apply_filters( 'github_updater_additions', null, $plugins, 'plugin' );
|
||||||
|
$plugins = array_merge( $plugins, (array) $additions );
|
||||||
|
|
||||||
|
foreach ( (array) $plugins as $plugin => $headers ) {
|
||||||
|
$git_plugin = [];
|
||||||
|
|
||||||
|
foreach ( (array) static::$extra_headers as $value ) {
|
||||||
|
$header = null;
|
||||||
|
|
||||||
|
if ( empty( $headers[ $value ] ) || false === stripos( $value, 'Plugin' ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$header_parts = explode( ' ', $value );
|
||||||
|
$repo_parts = $this->get_repo_parts( $header_parts[0], 'plugin' );
|
||||||
|
|
||||||
|
if ( $repo_parts['bool'] ) {
|
||||||
|
$header = $this->parse_header_uri( $headers[ $value ] );
|
||||||
|
if ( empty( $header ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$header = $this->parse_extra_headers( $header, $headers, $header_parts, $repo_parts );
|
||||||
|
$current_branch = "current_branch_{$header['repo']}";
|
||||||
|
$branch = isset( static::$options[ $current_branch ] )
|
||||||
|
? static::$options[ $current_branch ]
|
||||||
|
: false;
|
||||||
|
|
||||||
|
$git_plugin['type'] = 'plugin';
|
||||||
|
$git_plugin['git'] = $repo_parts['git_server'];
|
||||||
|
$git_plugin['uri'] = "{$header['base_uri']}/{$header['owner_repo']}";
|
||||||
|
$git_plugin['enterprise'] = $header['enterprise_uri'];
|
||||||
|
$git_plugin['enterprise_api'] = $header['enterprise_api'];
|
||||||
|
$git_plugin['owner'] = $header['owner'];
|
||||||
|
$git_plugin['slug'] = $header['repo'];
|
||||||
|
$git_plugin['branch'] = $branch ?: 'master';
|
||||||
|
$git_plugin['file'] = $plugin;
|
||||||
|
$git_plugin['local_path'] = WP_PLUGIN_DIR . "/{$header['repo']}/";
|
||||||
|
|
||||||
|
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $git_plugin['file'] );
|
||||||
|
$git_plugin['author'] = $plugin_data['AuthorName'];
|
||||||
|
$git_plugin['name'] = $plugin_data['Name'];
|
||||||
|
$git_plugin['homepage'] = $plugin_data['PluginURI'];
|
||||||
|
$git_plugin['local_version'] = strtolower( $plugin_data['Version'] );
|
||||||
|
$git_plugin['sections']['description'] = $plugin_data['Description'];
|
||||||
|
$git_plugin['languages'] = $header['languages'];
|
||||||
|
$git_plugin['ci_job'] = $header['ci_job'];
|
||||||
|
$git_plugin['release_asset'] = $header['release_asset'];
|
||||||
|
$git_plugin['broken'] = ( empty( $header['owner'] ) || empty( $header['repo'] ) );
|
||||||
|
|
||||||
|
$git_plugin['banners']['high'] =
|
||||||
|
file_exists( WP_PLUGIN_DIR . "/{$header['repo']}/assets/banner-1544x500.png" )
|
||||||
|
? WP_PLUGIN_URL . "/{$header['repo']}/assets/banner-1544x500.png"
|
||||||
|
: null;
|
||||||
|
|
||||||
|
$git_plugin['banners']['low'] =
|
||||||
|
file_exists( WP_PLUGIN_DIR . "/{$header['repo']}/assets/banner-772x250.png" )
|
||||||
|
? WP_PLUGIN_URL . "/{$header['repo']}/assets/banner-772x250.png"
|
||||||
|
: null;
|
||||||
|
|
||||||
|
$git_plugin['icons'] = [];
|
||||||
|
$icons = [
|
||||||
|
'svg' => 'icon.svg',
|
||||||
|
'1x_png' => 'icon-128x128.png',
|
||||||
|
'1x_jpg' => 'icon-128x128.jpg',
|
||||||
|
'2x_png' => 'icon-256x256.png',
|
||||||
|
'2x_jpg' => 'icon-256x256.jpg',
|
||||||
|
];
|
||||||
|
foreach ( $icons as $key => $filename ) {
|
||||||
|
$key = preg_replace( '/_png|_jpg/', '', $key );
|
||||||
|
$git_plugin['icons'][ $key ] = file_exists( $git_plugin['local_path'] . 'assets/' . $filename )
|
||||||
|
? WP_PLUGIN_URL . "/{$git_plugin['slug']}/assets/{$filename}"
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exit if not git hosted plugin.
|
||||||
|
if ( empty( $git_plugin ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$git_plugins[ $git_plugin['slug'] ] = (object) $git_plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $git_plugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get remote plugin meta to populate $config plugin objects.
|
||||||
|
* Calls to remote APIs to get data.
|
||||||
|
*/
|
||||||
|
public function get_remote_plugin_meta() {
|
||||||
|
$plugins = [];
|
||||||
|
foreach ( (array) $this->config as $plugin ) {
|
||||||
|
/**
|
||||||
|
* Filter to set if WP-Cron is disabled or if user wants to return to old way.
|
||||||
|
*
|
||||||
|
* @since 7.4.0
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param bool
|
||||||
|
*/
|
||||||
|
if ( ! $this->waiting_for_background_update( $plugin ) || static::is_wp_cli()
|
||||||
|
|| apply_filters( 'github_updater_disable_wpcron', false )
|
||||||
|
) {
|
||||||
|
$this->get_remote_repo_meta( $plugin );
|
||||||
|
} else {
|
||||||
|
$plugins[ $plugin->slug ] = $plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
// current_filter() check due to calling hook for shiny updates, don't show row twice.
|
||||||
|
if ( ! $plugin->release_asset && 'init' === current_filter() &&
|
||||||
|
( ! is_multisite() || is_network_admin() )
|
||||||
|
) {
|
||||||
|
add_action( "after_plugin_row_{$plugin->file}", [ $this, 'plugin_branch_switcher' ], 15, 3 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$schedule_event = defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ? is_main_site() : true;
|
||||||
|
|
||||||
|
if ( $schedule_event ) {
|
||||||
|
if ( ! wp_next_scheduled( 'ghu_get_remote_plugin' ) &&
|
||||||
|
! $this->is_duplicate_wp_cron_event( 'ghu_get_remote_plugin' ) &&
|
||||||
|
! apply_filters( 'github_updater_disable_wpcron', false )
|
||||||
|
) {
|
||||||
|
wp_schedule_single_event( time(), 'ghu_get_remote_plugin', [ $plugins ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! static::is_wp_cli() ) {
|
||||||
|
$this->load_pre_filters();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load pre-update filters.
|
||||||
|
*/
|
||||||
|
public function load_pre_filters() {
|
||||||
|
add_filter( 'plugin_row_meta', [ $this, 'plugin_row_meta' ], 10, 2 );
|
||||||
|
add_filter( 'plugins_api', [ $this, 'plugins_api' ], 99, 3 );
|
||||||
|
add_filter( 'site_transient_update_plugins', [ $this, 'update_site_transient' ], 15, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add branch switch row to plugins page.
|
||||||
|
*
|
||||||
|
* @param string $plugin_file
|
||||||
|
* @param \stdClass $plugin_data
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function plugin_branch_switcher( $plugin_file, $plugin_data ) {
|
||||||
|
if ( empty( static::$options['branch_switch'] ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$enclosure = $this->update_row_enclosure( $plugin_file, 'plugin', true );
|
||||||
|
$plugin = $this->get_repo_slugs( dirname( $plugin_file ) );
|
||||||
|
$nonced_update_url = wp_nonce_url(
|
||||||
|
$this->get_update_url( 'plugin', 'upgrade-plugin', $plugin_file ),
|
||||||
|
'upgrade-plugin_' . $plugin_file
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( ! empty( $plugin ) ) {
|
||||||
|
$id = $plugin['slug'] . '-id';
|
||||||
|
$branches = isset( $this->config[ $plugin['slug'] ]->branches )
|
||||||
|
? $this->config[ $plugin['slug'] ]->branches
|
||||||
|
: null;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get current branch.
|
||||||
|
$repo = $this->config[ $plugin['slug'] ];
|
||||||
|
$branch = Singleton::get_instance( 'Branch', $this )->get_current_branch( $repo );
|
||||||
|
|
||||||
|
$branch_switch_data = [];
|
||||||
|
$branch_switch_data['slug'] = $plugin['slug'];
|
||||||
|
$branch_switch_data['nonced_update_url'] = $nonced_update_url;
|
||||||
|
$branch_switch_data['id'] = $id;
|
||||||
|
$branch_switch_data['branch'] = $branch;
|
||||||
|
$branch_switch_data['branches'] = $branches;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create after_plugin_row_
|
||||||
|
*/
|
||||||
|
echo $enclosure['open'];
|
||||||
|
$this->make_branch_switch_row( $branch_switch_data );
|
||||||
|
echo $enclosure['close'];
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add 'View details' link to plugins page.
|
||||||
|
*
|
||||||
|
* @param array $links
|
||||||
|
* @param string $file
|
||||||
|
*
|
||||||
|
* @return array $links
|
||||||
|
*/
|
||||||
|
public function plugin_row_meta( $links, $file ) {
|
||||||
|
$regex_pattern = '/<a href="(.*)">(.*)<\/a>/';
|
||||||
|
$repo = dirname( $file );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sanity check for some commercial plugins.
|
||||||
|
*/
|
||||||
|
if ( ! isset( $links[2] ) ) {
|
||||||
|
return $links;
|
||||||
|
}
|
||||||
|
|
||||||
|
preg_match( $regex_pattern, $links[2], $matches );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove 'Visit plugin site' link in favor or 'View details' link.
|
||||||
|
*/
|
||||||
|
if ( array_key_exists( $repo, $this->config ) ) {
|
||||||
|
if ( null !== $repo ) {
|
||||||
|
unset( $links[2] );
|
||||||
|
$links[] = sprintf(
|
||||||
|
'<a href="%s" class="thickbox">%s</a>',
|
||||||
|
esc_url(
|
||||||
|
add_query_arg(
|
||||||
|
[
|
||||||
|
'tab' => 'plugin-information',
|
||||||
|
'plugin' => $repo,
|
||||||
|
'TB_iframe' => 'true',
|
||||||
|
'width' => 600,
|
||||||
|
'height' => 550,
|
||||||
|
],
|
||||||
|
network_admin_url( 'plugin-install.php' )
|
||||||
|
)
|
||||||
|
),
|
||||||
|
esc_html__( 'View details', 'github-updater' )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $links;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put changelog in plugins_api, return WP.org data as appropriate
|
||||||
|
*
|
||||||
|
* @param bool $false
|
||||||
|
* @param string $action
|
||||||
|
* @param \stdClass $response
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function plugins_api( $false, $action, $response ) {
|
||||||
|
if ( ! ( 'plugin_information' === $action ) ) {
|
||||||
|
return $false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$plugin = isset( $this->config[ $response->slug ] ) ? $this->config[ $response->slug ] : false;
|
||||||
|
|
||||||
|
// Skip if waiting for background update.
|
||||||
|
if ( $this->waiting_for_background_update( $plugin ) ) {
|
||||||
|
return $false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// wp.org plugin.
|
||||||
|
if ( ! $plugin || ( $plugin->dot_org && 'master' === $plugin->branch ) ) {
|
||||||
|
return $false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$response->slug = $plugin->slug;
|
||||||
|
$response->plugin_name = $plugin->name;
|
||||||
|
$response->name = $plugin->name;
|
||||||
|
$response->author = $plugin->author;
|
||||||
|
$response->homepage = $plugin->homepage;
|
||||||
|
$response->donate_link = $plugin->donate_link;
|
||||||
|
$response->version = $plugin->remote_version;
|
||||||
|
$response->sections = $plugin->sections;
|
||||||
|
$response->requires = $plugin->requires;
|
||||||
|
$response->requires_php = $plugin->requires_php;
|
||||||
|
$response->tested = $plugin->tested;
|
||||||
|
$response->downloaded = $plugin->downloaded;
|
||||||
|
$response->last_updated = $plugin->last_updated;
|
||||||
|
$response->download_link = $plugin->download_link;
|
||||||
|
$response->banners = $plugin->banners;
|
||||||
|
$response->icons = ! empty( $plugin->icons ) ? $plugin->icons : [];
|
||||||
|
$response->contributors = $plugin->contributors;
|
||||||
|
if ( ! $this->is_private( $plugin ) ) {
|
||||||
|
$response->num_ratings = $plugin->num_ratings;
|
||||||
|
$response->rating = $plugin->rating;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hook into site_transient_update_plugins to update from GitHub.
|
||||||
|
*
|
||||||
|
* @param \stdClass $transient
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function update_site_transient( $transient ) {
|
||||||
|
foreach ( (array) $this->config as $plugin ) {
|
||||||
|
if ( $this->can_update_repo( $plugin ) ) {
|
||||||
|
$response = [
|
||||||
|
'slug' => $plugin->slug,
|
||||||
|
'plugin' => $plugin->file,
|
||||||
|
'new_version' => $plugin->remote_version,
|
||||||
|
'url' => $plugin->uri,
|
||||||
|
'package' => $plugin->download_link,
|
||||||
|
'icons' => $plugin->icons,
|
||||||
|
'tested' => $plugin->tested,
|
||||||
|
'requires_php' => $plugin->requires_php,
|
||||||
|
'branch' => $plugin->branch,
|
||||||
|
'branches' => array_keys( $plugin->branches ),
|
||||||
|
'type' => "{$plugin->git}-{$plugin->type}",
|
||||||
|
];
|
||||||
|
|
||||||
|
// Skip on RESTful updating.
|
||||||
|
if ( isset( $_GET['action'], $_GET['plugin'] ) &&
|
||||||
|
'github-updater-update' === $_GET['action'] &&
|
||||||
|
$response['slug'] === $_GET['plugin']
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pull update from dot org if not overriding.
|
||||||
|
if ( ! $this->override_dot_org( 'plugin', $plugin ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$transient->response[ $plugin->file ] = (object) $response;
|
||||||
|
} else {
|
||||||
|
/**
|
||||||
|
* Filter to return array of overrides to dot org.
|
||||||
|
*
|
||||||
|
* @since 8.5.0
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
$overrides = apply_filters( 'github_updater_override_dot_org', [] );
|
||||||
|
if ( isset( $transient->response[ $plugin->file ] ) && in_array( $plugin->file, $overrides, true ) ) {
|
||||||
|
unset( $transient->response[ $plugin->file ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set transient on rollback.
|
||||||
|
if ( isset( $_GET['plugin'], $_GET['rollback'] ) && $plugin->file === $_GET['plugin']
|
||||||
|
) {
|
||||||
|
$transient->response[ $plugin->file ] = $this->set_rollback_transient( 'plugin', $plugin );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $transient;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
* @uses https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater;
|
||||||
|
|
||||||
|
use WordPressdotorg\Plugin_Directory\Readme\Parser;
|
||||||
|
use Parsedown;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Readme_Parser
|
||||||
|
*/
|
||||||
|
class Readme_Parser extends Parser {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds absolute filepath to temp readme file.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $readme_path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* Convert file contents string to temporary file.
|
||||||
|
* Pass file path into class-parser.php.
|
||||||
|
* Delete temporary file when finished.
|
||||||
|
*
|
||||||
|
* @param string $file
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct( $file ) {
|
||||||
|
$file_path = trailingslashit( get_temp_dir() ) . md5( $file ) . '-tmp-readme.txt';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter location of temporary readme filepath.
|
||||||
|
*
|
||||||
|
* @since 8.7.0
|
||||||
|
*
|
||||||
|
* @param string $file_path Absolute filepath to temp readme file.
|
||||||
|
*/
|
||||||
|
$this->readme_path = apply_filters( 'github_updater_temp_readme_filepath', $file_path );
|
||||||
|
$this->readme_path = file_put_contents( $this->readme_path, $file ) ? $this->readme_path : false;
|
||||||
|
parent::__construct( $this->readme_path );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse text into markdown.
|
||||||
|
*
|
||||||
|
* @param string $text
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function parse_markdown( $text ) {
|
||||||
|
static $markdown = null;
|
||||||
|
|
||||||
|
if ( null === $markdown ) {
|
||||||
|
$markdown = new Parsedown();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $markdown->text( $text );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return parsed readme.txt as array.
|
||||||
|
*
|
||||||
|
* @return array $data
|
||||||
|
*/
|
||||||
|
public function parse_data() {
|
||||||
|
$data = [];
|
||||||
|
foreach ( get_object_vars( $this ) as $key => $value ) {
|
||||||
|
$data[ $key ] = 'contributors' === $key ? $this->create_contributors( $value ) : $value;
|
||||||
|
}
|
||||||
|
$data = $this->faq_as_h4( $data );
|
||||||
|
$data = $this->readme_section_as_h4( 'changelog', $data );
|
||||||
|
$data = $this->readme_section_as_h4( 'description', $data );
|
||||||
|
|
||||||
|
@unlink( $this->readme_path );
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitize contributors.
|
||||||
|
*
|
||||||
|
* @param array $users
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function sanitize_contributors( $users ) {
|
||||||
|
return $users;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create contributor data.
|
||||||
|
*
|
||||||
|
* @param array $users
|
||||||
|
*
|
||||||
|
* @return array $contributors
|
||||||
|
*/
|
||||||
|
private function create_contributors( $users ) {
|
||||||
|
global $wp_version;
|
||||||
|
$contributors = [];
|
||||||
|
foreach ( (array) $users as $contributor ) {
|
||||||
|
$contributors[ $contributor ]['display_name'] = $contributor;
|
||||||
|
$contributors[ $contributor ]['profile'] = '//profiles.wordpress.org/' . $contributor;
|
||||||
|
$contributors[ $contributor ]['avatar'] = 'https://wordpress.org/grav-redirect.php?user=' . $contributor;
|
||||||
|
if ( version_compare( $wp_version, '5.1-alpha', '<' ) ) {
|
||||||
|
$contributors[ $contributor ] = '//profiles.wordpress.org/' . $contributor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $contributors;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts FAQ from dictionary list to h4 style.
|
||||||
|
*
|
||||||
|
* @param array $data Array of parsed readme data.
|
||||||
|
*
|
||||||
|
* @return array $data
|
||||||
|
*/
|
||||||
|
public function faq_as_h4( $data ) {
|
||||||
|
if ( empty( $data['faq'] ) ) {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
unset( $data['sections']['faq'] );
|
||||||
|
$data['sections']['faq'] = '';
|
||||||
|
foreach ( $data['faq'] as $question => $answer ) {
|
||||||
|
$data['sections']['faq'] .= "<h4>{$question}</h4>\n{$answer}\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts wp.org readme section items to h4 style.
|
||||||
|
*
|
||||||
|
* @param string $section Readme section.
|
||||||
|
* @param array $data Array of parsed readme data.
|
||||||
|
*
|
||||||
|
* @return array $data
|
||||||
|
*/
|
||||||
|
public function readme_section_as_h4( $section, $data ) {
|
||||||
|
if ( empty( $data['sections'][ $section ] ) || false !== strpos( $data['sections'][ $section ], '<h4>' ) ) {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
$pattern = '~<p>=(.*)=</p>~';
|
||||||
|
$replace = '<h4>$1</h4>';
|
||||||
|
|
||||||
|
$data['sections'][ $section ] = preg_replace( $pattern, $replace, $data['sections'][ $section ] );
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace parent method as some users don't have `mb_strrpos()`.
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
*
|
||||||
|
* @param string $desc
|
||||||
|
* @param int $length
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function trim_length( $desc, $length = 150 ) {
|
||||||
|
if ( mb_strlen( $desc ) > $length ) {
|
||||||
|
$desc = mb_substr( $desc, 0, $length ) . ' …';
|
||||||
|
|
||||||
|
// If not a full sentence, and one ends within 20% of the end, trim it to that.
|
||||||
|
if ( function_exists( 'mb_strrpos' ) ) {
|
||||||
|
$pos = mb_strrpos( $desc, '.' );
|
||||||
|
} else {
|
||||||
|
$pos = strrpos( $desc, '.' );
|
||||||
|
}
|
||||||
|
if ( $pos > ( 0.8 * $length ) && '.' !== mb_substr( $desc, -1 ) ) {
|
||||||
|
$desc = mb_substr( $desc, 0, $pos + 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return trim( $desc );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,315 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater;
|
||||||
|
|
||||||
|
use Fragen\GitHub_Updater\Traits\GHU_Trait;
|
||||||
|
use Fragen\Singleton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Remote_Management
|
||||||
|
*/
|
||||||
|
class Remote_Management {
|
||||||
|
use GHU_Trait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds the values for remote management settings.
|
||||||
|
*
|
||||||
|
* @var array $option_remote
|
||||||
|
*/
|
||||||
|
public static $options_remote;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supported remote management services.
|
||||||
|
*
|
||||||
|
* @var array $remote_management
|
||||||
|
*/
|
||||||
|
public static $remote_management = [
|
||||||
|
'ithemes_sync' => 'iThemes Sync',
|
||||||
|
'infinitewp' => 'InfiniteWP',
|
||||||
|
'managewp' => 'ManageWP',
|
||||||
|
'mainwp' => 'MainWP',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds the value for the Remote Management API key.
|
||||||
|
*
|
||||||
|
* @var string $api_key
|
||||||
|
*/
|
||||||
|
private static $api_key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remote_Management constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
$this->load_options();
|
||||||
|
$this->ensure_api_key_is_set();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load site options.
|
||||||
|
*/
|
||||||
|
private function load_options() {
|
||||||
|
self::$options_remote = get_site_option( 'github_updater_remote_management', [] );
|
||||||
|
self::$api_key = get_site_option( 'github_updater_api_key' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure api key is set.
|
||||||
|
*/
|
||||||
|
public function ensure_api_key_is_set() {
|
||||||
|
if ( ! self::$api_key ) {
|
||||||
|
update_site_option( 'github_updater_api_key', md5( uniqid( \rand(), true ) ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load needed action/filter hooks.
|
||||||
|
*/
|
||||||
|
public function load_hooks() {
|
||||||
|
add_action( 'admin_init', [ $this, 'remote_management_page_init' ] );
|
||||||
|
add_action(
|
||||||
|
'github_updater_update_settings',
|
||||||
|
function ( $post_data ) {
|
||||||
|
$this->save_settings( $post_data );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
add_filter( 'github_updater_add_admin_pages', [ $this, 'extra_admin_pages' ] );
|
||||||
|
$this->add_settings_tabs();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return list of pages where GitHub Updater loads/runs.
|
||||||
|
*
|
||||||
|
* @param array $admin_pages Default list of pages where GitHub Updater loads.
|
||||||
|
*
|
||||||
|
* @return array $admin_pages
|
||||||
|
*/
|
||||||
|
public function extra_admin_pages( $admin_pages = [] ) {
|
||||||
|
$extra_admin_pages = [];
|
||||||
|
foreach ( array_keys( self::$remote_management ) as $key ) {
|
||||||
|
if ( ! empty( self::$options_remote[ $key ] ) ) {
|
||||||
|
$extra_admin_pages = [ 'index.php' ];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_merge( $admin_pages, $extra_admin_pages );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save Remote Management settings.
|
||||||
|
*
|
||||||
|
* @uses 'github_updater_update_settings' action hook
|
||||||
|
* @uses 'github_updater_save_redirect' filter hook
|
||||||
|
*
|
||||||
|
* @param array $post_data $_POST data.
|
||||||
|
*/
|
||||||
|
public function save_settings( $post_data ) {
|
||||||
|
if ( isset( $post_data['option_page'] ) &&
|
||||||
|
'github_updater_remote_management' === $post_data['option_page']
|
||||||
|
) {
|
||||||
|
$options = isset( $post_data['github_updater_remote_management'] )
|
||||||
|
? $post_data['github_updater_remote_management']
|
||||||
|
: [];
|
||||||
|
|
||||||
|
update_site_option( 'github_updater_remote_management', (array) $this->sanitize( $options ) );
|
||||||
|
|
||||||
|
add_filter(
|
||||||
|
'github_updater_save_redirect',
|
||||||
|
function ( $option_page ) {
|
||||||
|
return array_merge( $option_page, [ 'github_updater_remote_management' ] );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds Remote Management tab to Settings page.
|
||||||
|
*/
|
||||||
|
public function add_settings_tabs() {
|
||||||
|
$install_tabs = [ 'github_updater_remote_management' => esc_html__( 'Remote Management', 'github-updater' ) ];
|
||||||
|
add_filter(
|
||||||
|
'github_updater_add_settings_tabs',
|
||||||
|
function ( $tabs ) use ( $install_tabs ) {
|
||||||
|
return array_merge( $tabs, $install_tabs );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
add_filter(
|
||||||
|
'github_updater_add_admin_page',
|
||||||
|
function ( $tab, $action ) {
|
||||||
|
$this->add_admin_page( $tab, $action );
|
||||||
|
},
|
||||||
|
10,
|
||||||
|
2
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Settings page data via action hook.
|
||||||
|
*
|
||||||
|
* @uses 'github_updater_add_admin_page' action hook
|
||||||
|
*
|
||||||
|
* @param string $tab Tab name.
|
||||||
|
* @param string $action Form action.
|
||||||
|
*/
|
||||||
|
public function add_admin_page( $tab, $action ) {
|
||||||
|
if ( 'github_updater_remote_management' === $tab ) {
|
||||||
|
$action = add_query_arg( 'tab', $tab, $action ); ?>
|
||||||
|
<form class="settings" method="post" action="<?php esc_attr_e( $action ); ?>">
|
||||||
|
<?php
|
||||||
|
settings_fields( 'github_updater_remote_management' );
|
||||||
|
do_settings_sections( 'github_updater_remote_settings' );
|
||||||
|
submit_button();
|
||||||
|
?>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
$reset_api_action = add_query_arg( [ 'github_updater_reset_api_key' => true ], $action );
|
||||||
|
?>
|
||||||
|
<form class="settings no-sub-tabs" method="post" action="<?php esc_attr_e( $reset_api_action ); ?>">
|
||||||
|
<?php submit_button( esc_html__( 'Reset RESTful key', 'github-updater' ) ); ?>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Settings for Remote Management.
|
||||||
|
*/
|
||||||
|
public function remote_management_page_init() {
|
||||||
|
register_setting(
|
||||||
|
'github_updater_remote_management',
|
||||||
|
'github_updater_remote_settings',
|
||||||
|
[ $this, 'sanitize' ]
|
||||||
|
);
|
||||||
|
|
||||||
|
add_settings_section(
|
||||||
|
'remote_management',
|
||||||
|
esc_html__( 'Remote Management', 'github-updater' ),
|
||||||
|
[ $this, 'print_section_remote_management' ],
|
||||||
|
'github_updater_remote_settings'
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( self::$remote_management as $id => $name ) {
|
||||||
|
add_settings_field(
|
||||||
|
$id,
|
||||||
|
null,
|
||||||
|
[ $this, 'token_callback_checkbox_remote' ],
|
||||||
|
'github_updater_remote_settings',
|
||||||
|
'remote_management',
|
||||||
|
[
|
||||||
|
'id' => $id,
|
||||||
|
'title' => esc_html( $name ),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print the Remote Management text.
|
||||||
|
*/
|
||||||
|
public function print_section_remote_management() {
|
||||||
|
if ( empty( self::$api_key ) ) {
|
||||||
|
$this->load_options();
|
||||||
|
}
|
||||||
|
$api_url = add_query_arg(
|
||||||
|
[
|
||||||
|
'action' => 'github-updater-update',
|
||||||
|
'key' => self::$api_key,
|
||||||
|
],
|
||||||
|
admin_url( 'admin-ajax.php' )
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
<p>
|
||||||
|
<?php
|
||||||
|
printf(
|
||||||
|
wp_kses_post(
|
||||||
|
/* translators: %s: Link to wiki */
|
||||||
|
__( 'Please refer to the <a href="%s">wiki</a> for complete list of attributes. RESTful endpoints begin at:', 'github-updater' )
|
||||||
|
),
|
||||||
|
'https://github.com/afragen/github-updater/wiki/Remote-Management---RESTful-Endpoints'
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
<br>
|
||||||
|
<span style="font-family:monospace;"><?php echo $api_url; ?></span>
|
||||||
|
<p>
|
||||||
|
<?php esc_html_e( 'Use of Remote Management services may result increase some page load speeds only for `admin` level users in the dashboard.', 'github-updater' ); ?>
|
||||||
|
</p>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the settings option array and print one of its values.
|
||||||
|
* For remote management settings.
|
||||||
|
*
|
||||||
|
* @param array $args Checkbox args.
|
||||||
|
*
|
||||||
|
* @return bool|void
|
||||||
|
*/
|
||||||
|
public function token_callback_checkbox_remote( $args ) {
|
||||||
|
$checked = isset( self::$options_remote[ $args['id'] ] ) ? self::$options_remote[ $args['id'] ] : null;
|
||||||
|
?>
|
||||||
|
<label for="<?php esc_attr_e( $args['id'] ); ?>">
|
||||||
|
<input type="checkbox" id="<?php esc_attr_e( $args['id'] ); ?>" name="github_updater_remote_management[<?php esc_attr_e( $args['id'] ); ?>]" value="1" <?php checked( '1', $checked ); ?> >
|
||||||
|
<?php echo $args['title']; ?>
|
||||||
|
</label>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset RESTful API key.
|
||||||
|
* Deleting site option will cause it to be re-created.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function reset_api_key() {
|
||||||
|
if ( isset( $_REQUEST['tab'], $_REQUEST['github_updater_reset_api_key'] ) &&
|
||||||
|
'github_updater_remote_management' === $_REQUEST['tab']
|
||||||
|
) {
|
||||||
|
$_POST = $_REQUEST;
|
||||||
|
$_POST['_wp_http_referer'] = $_SERVER['HTTP_REFERER'];
|
||||||
|
delete_site_option( 'github_updater_api_key' );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set site transients for 'update_plugins' and 'update_themes' for remote management.
|
||||||
|
*
|
||||||
|
* Only call if any remote management options are present and only if on a page specified
|
||||||
|
* to run remote management.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function set_update_transients() {
|
||||||
|
if ( empty( self::$options_remote ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$remote_management_pages = $this->extra_admin_pages();
|
||||||
|
if ( $this->is_current_page( $remote_management_pages ) ) {
|
||||||
|
add_filter( 'github_updater_add_admin_pages', [ $this, 'extra_admin_pages' ] );
|
||||||
|
add_filter( 'site_transient_update_plugins', [ Singleton::get_instance( 'Plugin', $this ), 'update_site_transient' ], 10, 1 );
|
||||||
|
add_filter( 'site_transient_update_themes', [ Singleton::get_instance( 'Theme', $this ), 'update_site_transient' ], 10, 1 );
|
||||||
|
|
||||||
|
Singleton::get_instance( 'Base', $this )->get_meta_remote_management();
|
||||||
|
|
||||||
|
$current_plugins = get_site_transient( 'update_plugins' );
|
||||||
|
$current_themes = get_site_transient( 'update_themes' );
|
||||||
|
set_site_transient( 'update_plugins', $current_plugins );
|
||||||
|
set_site_transient( 'update_themes', $current_themes );
|
||||||
|
|
||||||
|
remove_filter( 'github_updater_add_admin_pages', [ $this, 'extra_admin_pages' ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,314 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen, Mikael Lindqvist
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater;
|
||||||
|
|
||||||
|
use Fragen\Singleton;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Rest_Update
|
||||||
|
*
|
||||||
|
* Updates a single plugin or theme, in a way suitable for rest requests.
|
||||||
|
* This class inherits from Base in order to be able to call the
|
||||||
|
* set_defaults function.
|
||||||
|
*/
|
||||||
|
class Rest_Update extends Base {
|
||||||
|
/**
|
||||||
|
* Holds REST Upgrader Skin.
|
||||||
|
*
|
||||||
|
* @var Rest_Upgrader_Skin $upgrader_skin
|
||||||
|
*/
|
||||||
|
protected $upgrader_skin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
$this->load_options();
|
||||||
|
$this->upgrader_skin = new Rest_Upgrader_Skin();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update plugin.
|
||||||
|
*
|
||||||
|
* @param string $plugin_slug
|
||||||
|
* @param string $tag
|
||||||
|
*
|
||||||
|
* @throws \UnexpectedValueException Plugin not found or not updatable.
|
||||||
|
*/
|
||||||
|
public function update_plugin( $plugin_slug, $tag = 'master' ) {
|
||||||
|
$plugin = null;
|
||||||
|
$is_plugin_active = false;
|
||||||
|
|
||||||
|
foreach ( (array) Singleton::get_instance( 'Plugin', $this )->get_plugin_configs() as $config_entry ) {
|
||||||
|
if ( $config_entry->slug === $plugin_slug ) {
|
||||||
|
$plugin = $config_entry;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $plugin ) {
|
||||||
|
throw new \UnexpectedValueException( 'Plugin not found or not updatable with GitHub Updater: ' . $plugin_slug );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( is_plugin_active( $plugin->file ) ) {
|
||||||
|
$is_plugin_active = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->get_remote_repo_meta( $plugin );
|
||||||
|
$repo_api = Singleton::get_instance( 'API', $this )->get_repo_api( $plugin->git, $plugin );
|
||||||
|
|
||||||
|
$update = [
|
||||||
|
'slug' => $plugin->slug,
|
||||||
|
'plugin' => $plugin->file,
|
||||||
|
'new_version' => null,
|
||||||
|
'url' => $plugin->uri,
|
||||||
|
'package' => $repo_api->construct_download_link( $tag ),
|
||||||
|
];
|
||||||
|
|
||||||
|
add_filter(
|
||||||
|
'site_transient_update_plugins',
|
||||||
|
function ( $current ) use ( $plugin, $update ) {
|
||||||
|
$current->response[ $plugin->file ] = (object) $update;
|
||||||
|
|
||||||
|
return $current;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$upgrader = new \Plugin_Upgrader( $this->upgrader_skin );
|
||||||
|
$upgrader->upgrade( $plugin->file );
|
||||||
|
|
||||||
|
if ( $is_plugin_active ) {
|
||||||
|
$activate = is_multisite() ? activate_plugin( $plugin->file, null, true ) : activate_plugin( $plugin->file );
|
||||||
|
if ( ! $activate ) {
|
||||||
|
$this->upgrader_skin->messages[] = 'Plugin reactivated successfully.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a single theme.
|
||||||
|
*
|
||||||
|
* @param string $theme_slug
|
||||||
|
* @param string $tag
|
||||||
|
*
|
||||||
|
* @throws \UnexpectedValueException Theme not found or not updatable.
|
||||||
|
*/
|
||||||
|
public function update_theme( $theme_slug, $tag = 'master' ) {
|
||||||
|
$theme = null;
|
||||||
|
|
||||||
|
foreach ( (array) Singleton::get_instance( 'Theme', $this )->get_theme_configs() as $config_entry ) {
|
||||||
|
if ( $config_entry->slug === $theme_slug ) {
|
||||||
|
$theme = $config_entry;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $theme ) {
|
||||||
|
throw new \UnexpectedValueException( 'Theme not found or not updatable with GitHub Updater: ' . $theme_slug );
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->get_remote_repo_meta( $theme );
|
||||||
|
$repo_api = Singleton::get_instance( 'API', $this )->get_repo_api( $theme->git, $theme );
|
||||||
|
|
||||||
|
$update = [
|
||||||
|
'theme' => $theme->slug,
|
||||||
|
'new_version' => null,
|
||||||
|
'url' => $theme->uri,
|
||||||
|
'package' => $repo_api->construct_download_link( $tag ),
|
||||||
|
];
|
||||||
|
|
||||||
|
add_filter(
|
||||||
|
'site_transient_update_themes',
|
||||||
|
function ( $current ) use ( $theme, $update ) {
|
||||||
|
$current->response[ $theme->slug ] = $update;
|
||||||
|
|
||||||
|
return $current;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$upgrader = new \Theme_Upgrader( $this->upgrader_skin );
|
||||||
|
$upgrader->upgrade( $theme->slug );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is there an error?
|
||||||
|
*/
|
||||||
|
public function is_error() {
|
||||||
|
return $this->upgrader_skin->error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get messages during update.
|
||||||
|
*/
|
||||||
|
public function get_messages() {
|
||||||
|
return $this->upgrader_skin->messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process request.
|
||||||
|
*
|
||||||
|
* Relies on data in $_REQUEST, prints out json and exits.
|
||||||
|
* If the request came through a webhook, and if the branch in the
|
||||||
|
* webhook matches the branch specified by the url, use the latest
|
||||||
|
* update available as specified in the webhook payload.
|
||||||
|
*
|
||||||
|
* @throws \UnexpectedValueException Under multiple bad or missing params.
|
||||||
|
*/
|
||||||
|
public function process_request() {
|
||||||
|
$start = microtime( true );
|
||||||
|
try {
|
||||||
|
if ( ! isset( $_REQUEST['key'] ) ||
|
||||||
|
get_site_option( 'github_updater_api_key' ) !== $_REQUEST['key']
|
||||||
|
) {
|
||||||
|
throw new \UnexpectedValueException( 'Bad API key.' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow access into the REST Update process.
|
||||||
|
*
|
||||||
|
* @since 7.6.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
do_action( 'github_updater_pre_rest_process_request' );
|
||||||
|
|
||||||
|
$tag = 'master';
|
||||||
|
if ( isset( $_REQUEST['tag'] ) ) {
|
||||||
|
$tag = $_REQUEST['tag'];
|
||||||
|
} elseif ( isset( $_REQUEST['committish'] ) ) {
|
||||||
|
$tag = $_REQUEST['committish'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->get_webhook_source();
|
||||||
|
$current_branch = $this->get_local_branch();
|
||||||
|
$override = isset( $_REQUEST['override'] );
|
||||||
|
if ( $tag !== $current_branch && ! $override ) {
|
||||||
|
throw new \UnexpectedValueException( 'Webhook tag and current branch are not matching. Consider using `override` query arg.' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset( $_REQUEST['plugin'] ) ) {
|
||||||
|
$this->update_plugin( $_REQUEST['plugin'], $tag );
|
||||||
|
} elseif ( isset( $_REQUEST['theme'] ) ) {
|
||||||
|
$this->update_theme( $_REQUEST['theme'], $tag );
|
||||||
|
} else {
|
||||||
|
throw new \UnexpectedValueException( 'No plugin or theme specified for update.' );
|
||||||
|
}
|
||||||
|
} catch ( \Exception $e ) {
|
||||||
|
$http_response = [
|
||||||
|
'success' => false,
|
||||||
|
'messages' => $e->getMessage(),
|
||||||
|
'webhook' => $_GET,
|
||||||
|
'elapsed_time' => round( ( microtime( true ) - $start ) * 1000, 2 ) . ' ms',
|
||||||
|
];
|
||||||
|
$this->log_exit( $http_response, 417 );
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = [
|
||||||
|
'success' => true,
|
||||||
|
'messages' => $this->get_messages(),
|
||||||
|
'webhook' => $_GET,
|
||||||
|
'elapsed_time' => round( ( microtime( true ) - $start ) * 1000, 2 ) . ' ms',
|
||||||
|
];
|
||||||
|
|
||||||
|
if ( $this->is_error() ) {
|
||||||
|
$response['success'] = false;
|
||||||
|
$this->log_exit( $response, 417 );
|
||||||
|
}
|
||||||
|
$this->log_exit( $response, 200 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current branch of the local repository referenced in the webhook.
|
||||||
|
*
|
||||||
|
* @return string $current_branch Default return is 'master'.
|
||||||
|
*/
|
||||||
|
private function get_local_branch() {
|
||||||
|
$repo = false;
|
||||||
|
if ( isset( $_REQUEST['plugin'] ) ) {
|
||||||
|
$repos = Singleton::get_instance( 'Plugin', $this )->get_plugin_configs();
|
||||||
|
$repo = isset( $repos[ $_REQUEST['plugin'] ] ) ? $repos[ $_REQUEST['plugin'] ] : false;
|
||||||
|
}
|
||||||
|
if ( isset( $_REQUEST['theme'] ) ) {
|
||||||
|
$repos = Singleton::get_instance( 'Theme', $this )->get_theme_configs();
|
||||||
|
$repo = isset( $repos[ $_REQUEST['theme'] ] ) ? $repos[ $_REQUEST['theme'] ] : false;
|
||||||
|
}
|
||||||
|
$current_branch = $repo ?
|
||||||
|
Singleton::get_instance( 'Branch', $this )->get_current_branch( $repo ) :
|
||||||
|
'master';
|
||||||
|
|
||||||
|
return $current_branch;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the source of the webhook to $_GET variable.
|
||||||
|
*/
|
||||||
|
private function get_webhook_source() {
|
||||||
|
switch ( $_SERVER ) {
|
||||||
|
case isset( $_SERVER['HTTP_X_GITHUB_EVENT'] ):
|
||||||
|
$webhook_source = 'GitHub webhook';
|
||||||
|
break;
|
||||||
|
case isset( $_SERVER['HTTP_X_EVENT_KEY'] ):
|
||||||
|
$webhook_source = 'Bitbucket webhook';
|
||||||
|
break;
|
||||||
|
case isset( $_SERVER['HTTP_X_GITLAB_EVENT'] ):
|
||||||
|
$webhook_source = 'GitLab webhook';
|
||||||
|
break;
|
||||||
|
case isset( $_SERVER['HTTP_X_GITEA_EVENT'] ):
|
||||||
|
$webhook_source = 'Gitea webhook';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$webhook_source = 'browser';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$_GET['webhook_source'] = $webhook_source;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append $response to debug.log and wp_die().
|
||||||
|
*
|
||||||
|
* @param array $response
|
||||||
|
* @param int $code
|
||||||
|
*
|
||||||
|
* 128 == JSON_PRETTY_PRINT
|
||||||
|
* 64 == JSON_UNESCAPED_SLASHES
|
||||||
|
*/
|
||||||
|
private function log_exit( $response, $code ) {
|
||||||
|
$json_encode_flags = 128 | 64;
|
||||||
|
|
||||||
|
error_log( json_encode( $response, $json_encode_flags ) );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action hook after processing REST process.
|
||||||
|
*
|
||||||
|
* @since 8.6.0
|
||||||
|
*
|
||||||
|
* @param array $response
|
||||||
|
* @param int $code HTTP response.
|
||||||
|
*/
|
||||||
|
do_action( 'github_updater_post_rest_process_request', $response, $code );
|
||||||
|
|
||||||
|
unset( $response['success'] );
|
||||||
|
if ( 200 === $code ) {
|
||||||
|
wp_die( wp_send_json_success( $response, $code ) );
|
||||||
|
} else {
|
||||||
|
wp_die( wp_send_json_error( $response, $code ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GitHub Updater
|
||||||
|
*
|
||||||
|
* @author Andy Fragen, Mikael Lindqvist
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link https://github.com/afragen/github-updater
|
||||||
|
* @package github-updater
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Fragen\GitHub_Updater;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit if called directly.
|
||||||
|
*/
|
||||||
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Rest_Upgrader_Skin
|
||||||
|
*
|
||||||
|
* Extends WP_Upgrader_Skin and collects outputed messages for later
|
||||||
|
* processing, rather than printing them out.
|
||||||
|
*/
|
||||||
|
class Rest_Upgrader_Skin extends \WP_Upgrader_Skin {
|
||||||
|
/**
|
||||||
|
* Holds messages.
|
||||||
|
*
|
||||||
|
* @var array $messages
|
||||||
|
*/
|
||||||
|
public $messages = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boolean if errors are present.
|
||||||
|
*
|
||||||
|
* @var bool $error
|
||||||
|
*/
|
||||||
|
public $error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overrides the feedback method.
|
||||||
|
* Adds the feedback string to the messages array.
|
||||||
|
*
|
||||||
|
* @param string $string
|
||||||
|
*/
|
||||||
|
public function feedback( $string ) {
|
||||||
|
if ( isset( $this->upgrader->strings[ $string ] ) ) {
|
||||||
|
$string = $this->upgrader->strings[ $string ];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( false !== strpos( $string, '%' ) ) {
|
||||||
|
$args = func_get_args();
|
||||||
|
$args = array_splice( $args, 1 );
|
||||||
|
if ( $args ) {
|
||||||
|
$args = array_map( 'strip_tags', $args );
|
||||||
|
$args = array_map( 'esc_html', $args );
|
||||||
|
$string = vsprintf( $string, $args );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( empty( $string ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->messages[] = $string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the error flag to true, then let the base class handle the rest.
|
||||||
|
*
|
||||||
|
* @param mixed $errors
|
||||||
|
*/
|
||||||
|
public function error( $errors ) {
|
||||||
|
$this->error = true;
|
||||||
|
parent::error( $errors );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do nothing.
|
||||||
|
*
|
||||||
|
* @param mixed $type
|
||||||
|
*/
|
||||||
|
protected function decrement_update_count( $type ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do nothing.
|
||||||
|
*/
|
||||||
|
public function header() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do nothing.
|
||||||
|
*/
|
||||||
|
public function footer() {
|
||||||
|
}
|
||||||
|
}
|
||||||