├── .gitignore ├── README.md ├── assets ├── gitpress.css └── gitpress.js ├── autoloader.php ├── changelog.md ├── classes ├── Actions │ ├── Action.php │ ├── ActionData.php │ ├── CloneRepoAction.php │ ├── CommitAction.php │ ├── PushAction.php │ └── ShouldDoSyncAction.php ├── AdminBar │ └── AdminBar.php ├── Data │ └── Credentials.php └── Notification │ └── Notification.php ├── configuration.php ├── docker-compose.yml ├── gitpress.php ├── simply-static ├── composer.json ├── composer.lock ├── css │ └── admin.css ├── index.php ├── js │ ├── admin-generate.js │ └── admin-settings.js ├── languages │ ├── simply-static-de_DE.mo │ ├── simply-static-de_DE.po │ ├── simply-static-fr_FR.mo │ ├── simply-static-fr_FR.po │ └── simply-static.pot ├── license.txt ├── readme.txt ├── simply-static.php ├── src │ ├── class-ss-archive-creation-job.php │ ├── class-ss-diagnostic.php │ ├── class-ss-options.php │ ├── class-ss-phpuri.php │ ├── class-ss-plugin.php │ ├── class-ss-query.php │ ├── class-ss-sql-permissions.php │ ├── class-ss-upgrade-handler.php │ ├── class-ss-url-extractor.php │ ├── class-ss-url-fetcher.php │ ├── class-ss-util.php │ ├── class-ss-view.php │ ├── index.php │ ├── models │ │ ├── class-ss-model.php │ │ └── class-ss-page.php │ └── tasks │ │ ├── class-ss-cancel-task.php │ │ ├── class-ss-create-zip-archive.php │ │ ├── class-ss-fetch-urls-task.php │ │ ├── class-ss-setup-task.php │ │ ├── class-ss-task.php │ │ ├── class-ss-transfer-files-locally-task.php │ │ └── class-ss-wrapup-task.php ├── static-files │ └── simply-static-1-1621679530.zip ├── uninstall.php ├── vendor │ ├── a5hleyrich │ │ └── wp-background-processing │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── classes │ │ │ ├── wp-async-request.php │ │ │ └── wp-background-process.php │ │ │ ├── composer.json │ │ │ ├── license.txt │ │ │ └── wp-background-processing.php │ ├── autoload.php │ ├── composer │ │ ├── ClassLoader.php │ │ ├── InstalledVersions.php │ │ ├── LICENSE │ │ ├── autoload_classmap.php │ │ ├── autoload_files.php │ │ ├── autoload_namespaces.php │ │ ├── autoload_psr4.php │ │ ├── autoload_real.php │ │ ├── autoload_static.php │ │ ├── installed.json │ │ ├── installed.php │ │ └── platform_check.php │ ├── symfony │ │ ├── css-selector │ │ │ ├── CHANGELOG.md │ │ │ ├── CssSelectorConverter.php │ │ │ ├── Exception │ │ │ │ ├── ExceptionInterface.php │ │ │ │ ├── ExpressionErrorException.php │ │ │ │ ├── InternalErrorException.php │ │ │ │ ├── ParseException.php │ │ │ │ └── SyntaxErrorException.php │ │ │ ├── LICENSE │ │ │ ├── Node │ │ │ │ ├── AbstractNode.php │ │ │ │ ├── AttributeNode.php │ │ │ │ ├── ClassNode.php │ │ │ │ ├── CombinedSelectorNode.php │ │ │ │ ├── ElementNode.php │ │ │ │ ├── FunctionNode.php │ │ │ │ ├── HashNode.php │ │ │ │ ├── NegationNode.php │ │ │ │ ├── NodeInterface.php │ │ │ │ ├── PseudoNode.php │ │ │ │ ├── SelectorNode.php │ │ │ │ └── Specificity.php │ │ │ ├── Parser │ │ │ │ ├── Handler │ │ │ │ │ ├── CommentHandler.php │ │ │ │ │ ├── HandlerInterface.php │ │ │ │ │ ├── HashHandler.php │ │ │ │ │ ├── IdentifierHandler.php │ │ │ │ │ ├── NumberHandler.php │ │ │ │ │ ├── StringHandler.php │ │ │ │ │ └── WhitespaceHandler.php │ │ │ │ ├── Parser.php │ │ │ │ ├── ParserInterface.php │ │ │ │ ├── Reader.php │ │ │ │ ├── Shortcut │ │ │ │ │ ├── ClassParser.php │ │ │ │ │ ├── ElementParser.php │ │ │ │ │ ├── EmptyStringParser.php │ │ │ │ │ └── HashParser.php │ │ │ │ ├── Token.php │ │ │ │ ├── TokenStream.php │ │ │ │ └── Tokenizer │ │ │ │ │ ├── Tokenizer.php │ │ │ │ │ ├── TokenizerEscaping.php │ │ │ │ │ └── TokenizerPatterns.php │ │ │ ├── README.md │ │ │ ├── XPath │ │ │ │ ├── Extension │ │ │ │ │ ├── AbstractExtension.php │ │ │ │ │ ├── AttributeMatchingExtension.php │ │ │ │ │ ├── CombinationExtension.php │ │ │ │ │ ├── ExtensionInterface.php │ │ │ │ │ ├── FunctionExtension.php │ │ │ │ │ ├── HtmlExtension.php │ │ │ │ │ ├── NodeExtension.php │ │ │ │ │ └── PseudoClassExtension.php │ │ │ │ ├── Translator.php │ │ │ │ ├── TranslatorInterface.php │ │ │ │ └── XPathExpr.php │ │ │ └── composer.json │ │ ├── polyfill-iconv │ │ │ ├── Iconv.php │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── Resources │ │ │ │ └── charset │ │ │ │ │ ├── from.big5.php │ │ │ │ │ ├── from.cp037.php │ │ │ │ │ ├── from.cp1006.php │ │ │ │ │ ├── from.cp1026.php │ │ │ │ │ ├── from.cp424.php │ │ │ │ │ ├── from.cp437.php │ │ │ │ │ ├── from.cp500.php │ │ │ │ │ ├── from.cp737.php │ │ │ │ │ ├── from.cp775.php │ │ │ │ │ ├── from.cp850.php │ │ │ │ │ ├── from.cp852.php │ │ │ │ │ ├── from.cp855.php │ │ │ │ │ ├── from.cp856.php │ │ │ │ │ ├── from.cp857.php │ │ │ │ │ ├── from.cp860.php │ │ │ │ │ ├── from.cp861.php │ │ │ │ │ ├── from.cp862.php │ │ │ │ │ ├── from.cp863.php │ │ │ │ │ ├── from.cp864.php │ │ │ │ │ ├── from.cp865.php │ │ │ │ │ ├── from.cp866.php │ │ │ │ │ ├── from.cp869.php │ │ │ │ │ ├── from.cp874.php │ │ │ │ │ ├── from.cp875.php │ │ │ │ │ ├── from.cp932.php │ │ │ │ │ ├── from.cp936.php │ │ │ │ │ ├── from.cp949.php │ │ │ │ │ ├── from.cp950.php │ │ │ │ │ ├── from.iso-8859-1.php │ │ │ │ │ ├── from.iso-8859-10.php │ │ │ │ │ ├── from.iso-8859-11.php │ │ │ │ │ ├── from.iso-8859-13.php │ │ │ │ │ ├── from.iso-8859-14.php │ │ │ │ │ ├── from.iso-8859-15.php │ │ │ │ │ ├── from.iso-8859-16.php │ │ │ │ │ ├── from.iso-8859-2.php │ │ │ │ │ ├── from.iso-8859-3.php │ │ │ │ │ ├── from.iso-8859-4.php │ │ │ │ │ ├── from.iso-8859-5.php │ │ │ │ │ ├── from.iso-8859-6.php │ │ │ │ │ ├── from.iso-8859-7.php │ │ │ │ │ ├── from.iso-8859-8.php │ │ │ │ │ ├── from.iso-8859-9.php │ │ │ │ │ ├── from.koi8-r.php │ │ │ │ │ ├── from.koi8-u.php │ │ │ │ │ ├── from.us-ascii.php │ │ │ │ │ ├── from.windows-1250.php │ │ │ │ │ ├── from.windows-1251.php │ │ │ │ │ ├── from.windows-1252.php │ │ │ │ │ ├── from.windows-1253.php │ │ │ │ │ ├── from.windows-1254.php │ │ │ │ │ ├── from.windows-1255.php │ │ │ │ │ ├── from.windows-1256.php │ │ │ │ │ ├── from.windows-1257.php │ │ │ │ │ ├── from.windows-1258.php │ │ │ │ │ └── translit.php │ │ │ ├── bootstrap.php │ │ │ ├── bootstrap80.php │ │ │ └── composer.json │ │ ├── polyfill-intl-grapheme │ │ │ ├── Grapheme.php │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── bootstrap.php │ │ │ ├── bootstrap80.php │ │ │ └── composer.json │ │ ├── polyfill-intl-normalizer │ │ │ ├── LICENSE │ │ │ ├── Normalizer.php │ │ │ ├── README.md │ │ │ ├── Resources │ │ │ │ ├── stubs │ │ │ │ │ └── Normalizer.php │ │ │ │ └── unidata │ │ │ │ │ ├── canonicalComposition.php │ │ │ │ │ ├── canonicalDecomposition.php │ │ │ │ │ ├── combiningClass.php │ │ │ │ │ └── compatibilityDecomposition.php │ │ │ ├── bootstrap.php │ │ │ ├── bootstrap80.php │ │ │ └── composer.json │ │ ├── polyfill-mbstring │ │ │ ├── LICENSE │ │ │ ├── Mbstring.php │ │ │ ├── README.md │ │ │ ├── Resources │ │ │ │ └── unidata │ │ │ │ │ ├── lowerCase.php │ │ │ │ │ ├── titleCaseRegexp.php │ │ │ │ │ └── upperCase.php │ │ │ ├── bootstrap.php │ │ │ ├── bootstrap80.php │ │ │ └── composer.json │ │ └── polyfill-php72 │ │ │ ├── LICENSE │ │ │ ├── Php72.php │ │ │ ├── README.md │ │ │ ├── bootstrap.php │ │ │ └── composer.json │ └── voku │ │ ├── portable-ascii │ │ ├── CHANGELOG.md │ │ ├── LICENSE.txt │ │ ├── README.md │ │ ├── build │ │ │ ├── composer.json │ │ │ ├── docs │ │ │ │ └── base.md │ │ │ ├── generate_docs.php │ │ │ └── generate_max_key_length.php │ │ ├── composer.json │ │ └── src │ │ │ └── voku │ │ │ └── helper │ │ │ ├── ASCII.php │ │ │ └── data │ │ │ ├── ascii_by_languages.php │ │ │ ├── ascii_extras_by_languages.php │ │ │ ├── ascii_language_max_key.php │ │ │ ├── ascii_ord.php │ │ │ ├── x000.php │ │ │ ├── x001.php │ │ │ ├── x002.php │ │ │ ├── x003.php │ │ │ ├── x004.php │ │ │ ├── x005.php │ │ │ ├── x006.php │ │ │ ├── x007.php │ │ │ ├── x009.php │ │ │ ├── x00a.php │ │ │ ├── x00b.php │ │ │ ├── x00c.php │ │ │ ├── x00d.php │ │ │ ├── x00e.php │ │ │ ├── x00f.php │ │ │ ├── x010.php │ │ │ ├── x011.php │ │ │ ├── x012.php │ │ │ ├── x013.php │ │ │ ├── x014.php │ │ │ ├── x015.php │ │ │ ├── x016.php │ │ │ ├── x017.php │ │ │ ├── x018.php │ │ │ ├── x01d.php │ │ │ ├── x01e.php │ │ │ ├── x01f.php │ │ │ ├── x020.php │ │ │ ├── x021.php │ │ │ ├── x022.php │ │ │ ├── x023.php │ │ │ ├── x024.php │ │ │ ├── x025.php │ │ │ ├── x026.php │ │ │ ├── x027.php │ │ │ ├── x028.php │ │ │ ├── x029.php │ │ │ ├── x02a.php │ │ │ ├── x02c.php │ │ │ ├── x02e.php │ │ │ ├── x02f.php │ │ │ ├── x030.php │ │ │ ├── x031.php │ │ │ ├── x032.php │ │ │ ├── x033.php │ │ │ ├── x04d.php │ │ │ ├── x04e.php │ │ │ ├── x04f.php │ │ │ ├── x050.php │ │ │ ├── x051.php │ │ │ ├── x052.php │ │ │ ├── x053.php │ │ │ ├── x054.php │ │ │ ├── x055.php │ │ │ ├── x056.php │ │ │ ├── x057.php │ │ │ ├── x058.php │ │ │ ├── x059.php │ │ │ ├── x05a.php │ │ │ ├── x05b.php │ │ │ ├── x05c.php │ │ │ ├── x05d.php │ │ │ ├── x05e.php │ │ │ ├── x05f.php │ │ │ ├── x060.php │ │ │ ├── x061.php │ │ │ ├── x062.php │ │ │ ├── x063.php │ │ │ ├── x064.php │ │ │ ├── x065.php │ │ │ ├── x066.php │ │ │ ├── x067.php │ │ │ ├── x068.php │ │ │ ├── x069.php │ │ │ ├── x06a.php │ │ │ ├── x06b.php │ │ │ ├── x06c.php │ │ │ ├── x06d.php │ │ │ ├── x06e.php │ │ │ ├── x06f.php │ │ │ ├── x070.php │ │ │ ├── x071.php │ │ │ ├── x072.php │ │ │ ├── x073.php │ │ │ ├── x074.php │ │ │ ├── x075.php │ │ │ ├── x076.php │ │ │ ├── x077.php │ │ │ ├── x078.php │ │ │ ├── x079.php │ │ │ ├── x07a.php │ │ │ ├── x07b.php │ │ │ ├── x07c.php │ │ │ ├── x07d.php │ │ │ ├── x07e.php │ │ │ ├── x07f.php │ │ │ ├── x080.php │ │ │ ├── x081.php │ │ │ ├── x082.php │ │ │ ├── x083.php │ │ │ ├── x084.php │ │ │ ├── x085.php │ │ │ ├── x086.php │ │ │ ├── x087.php │ │ │ ├── x088.php │ │ │ ├── x089.php │ │ │ ├── x08a.php │ │ │ ├── x08b.php │ │ │ ├── x08c.php │ │ │ ├── x08d.php │ │ │ ├── x08e.php │ │ │ ├── x08f.php │ │ │ ├── x090.php │ │ │ ├── x091.php │ │ │ ├── x092.php │ │ │ ├── x093.php │ │ │ ├── x094.php │ │ │ ├── x095.php │ │ │ ├── x096.php │ │ │ ├── x097.php │ │ │ ├── x098.php │ │ │ ├── x099.php │ │ │ ├── x09a.php │ │ │ ├── x09b.php │ │ │ ├── x09c.php │ │ │ ├── x09d.php │ │ │ ├── x09e.php │ │ │ ├── x09f.php │ │ │ ├── x0a0.php │ │ │ ├── x0a1.php │ │ │ ├── x0a2.php │ │ │ ├── x0a3.php │ │ │ ├── x0a4.php │ │ │ ├── x0ac.php │ │ │ ├── x0ad.php │ │ │ ├── x0ae.php │ │ │ ├── x0af.php │ │ │ ├── x0b0.php │ │ │ ├── x0b1.php │ │ │ ├── x0b2.php │ │ │ ├── x0b3.php │ │ │ ├── x0b4.php │ │ │ ├── x0b5.php │ │ │ ├── x0b6.php │ │ │ ├── x0b7.php │ │ │ ├── x0b8.php │ │ │ ├── x0b9.php │ │ │ ├── x0ba.php │ │ │ ├── x0bb.php │ │ │ ├── x0bc.php │ │ │ ├── x0bd.php │ │ │ ├── x0be.php │ │ │ ├── x0bf.php │ │ │ ├── x0c0.php │ │ │ ├── x0c1.php │ │ │ ├── x0c2.php │ │ │ ├── x0c3.php │ │ │ ├── x0c4.php │ │ │ ├── x0c5.php │ │ │ ├── x0c6.php │ │ │ ├── x0c7.php │ │ │ ├── x0c8.php │ │ │ ├── x0c9.php │ │ │ ├── x0ca.php │ │ │ ├── x0cb.php │ │ │ ├── x0cc.php │ │ │ ├── x0cd.php │ │ │ ├── x0ce.php │ │ │ ├── x0cf.php │ │ │ ├── x0d0.php │ │ │ ├── x0d1.php │ │ │ ├── x0d2.php │ │ │ ├── x0d3.php │ │ │ ├── x0d4.php │ │ │ ├── x0d5.php │ │ │ ├── x0d6.php │ │ │ ├── x0d7.php │ │ │ ├── x0f9.php │ │ │ ├── x0fa.php │ │ │ ├── x0fb.php │ │ │ ├── x0fc.php │ │ │ ├── x0fd.php │ │ │ ├── x0fe.php │ │ │ ├── x0ff.php │ │ │ ├── x1d4.php │ │ │ ├── x1d5.php │ │ │ ├── x1d6.php │ │ │ ├── x1d7.php │ │ │ └── x1f1.php │ │ ├── portable-utf8 │ │ ├── CHANGELOG.md │ │ ├── LICENSE-APACHE │ │ ├── LICENSE-GPL │ │ ├── README.md │ │ ├── SECURITY.md │ │ ├── SUMMARY.md │ │ ├── bootstrap.php │ │ ├── composer.json │ │ └── src │ │ │ └── voku │ │ │ └── helper │ │ │ ├── Bootup.php │ │ │ ├── UTF8.php │ │ │ └── data │ │ │ ├── caseFolding_full.php │ │ │ ├── chr.php │ │ │ ├── emoji.php │ │ │ ├── encodings.php │ │ │ ├── ord.php │ │ │ ├── transliterator_list.php │ │ │ ├── utf8_fix.php │ │ │ └── win1252_to_utf8.php │ │ └── simple_html_dom │ │ ├── .github │ │ ├── CONTRIBUTING.md │ │ ├── FUNDING.yml │ │ └── ISSUE_TEMPLATE.md │ │ ├── CHANGELOG │ │ ├── LICENSE │ │ ├── README.md │ │ ├── README_API.md │ │ ├── build │ │ ├── composer.json │ │ ├── docs │ │ │ └── api.md │ │ └── generate_docs.php │ │ ├── composer.json │ │ └── src │ │ └── voku │ │ └── helper │ │ ├── AbstractDomParser.php │ │ ├── AbstractSimpleHtmlDom.php │ │ ├── AbstractSimpleHtmlDomNode.php │ │ ├── AbstractSimpleXmlDom.php │ │ ├── AbstractSimpleXmlDomNode.php │ │ ├── DomParserInterface.php │ │ ├── HtmlDomParser.php │ │ ├── SelectorConverter.php │ │ ├── SimpleHtmlAttributes.php │ │ ├── SimpleHtmlAttributesInterface.php │ │ ├── SimpleHtmlDom.php │ │ ├── SimpleHtmlDomBlank.php │ │ ├── SimpleHtmlDomInterface.php │ │ ├── SimpleHtmlDomNode.php │ │ ├── SimpleHtmlDomNodeBlank.php │ │ ├── SimpleHtmlDomNodeInterface.php │ │ ├── SimpleXmlDom.php │ │ ├── SimpleXmlDomBlank.php │ │ ├── SimpleXmlDomInterface.php │ │ ├── SimpleXmlDomNode.php │ │ ├── SimpleXmlDomNodeBlank.php │ │ ├── SimpleXmlDomNodeInterface.php │ │ └── XmlDomParser.php └── views │ ├── _activity_log.php │ ├── _export_log.php │ ├── _pagination.php │ ├── diagnostics.php │ ├── generate.php │ ├── layouts │ └── admin.php │ ├── redirect.php │ └── settings.php └── wp-config.php /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | backup/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Gitpress 2 | Run wordpress directly on github pages 3 | 4 | ## Gitpress won the innovation award for may 2021 5 | Read more about this [https://naveen17797.github.io/gitpress-won-the-php-innovation-award/](here) 6 | 7 | ## Want to see live demo ? 8 | Go to my github pages site at [https://naveen17797.github.io/](https://naveen17797.github.io/) 9 | 10 | ## What does this repo do ? 11 | This helps to host your wordpress site in github pages 12 | 13 | ## How does it do it ? 14 | 1. It runs wordpress on your local docker container 15 | 2. It generates static files with the help of the plugin [simply static](https://github.com/patrickposner/simply-static) written by [Patrick Posner](https://patrickposner.dev/) 16 | 3. It pushes all the static files to your github pages 17 | 18 | ## How can i install ? 19 | 1. Clone the repo. 20 | 2. Run `docker-compose up` 21 | 3. Open http://localhost, set up your wordpress site 22 | 4. Add your github username and password ( or token ) 23 | 5. Click on sync site on the top admin bar, thats it. 24 |  25 | 6. Now do that every time when you want to sync your local site to github pages. 26 | 27 | ## I want to backup my database 28 | 29 | 1. Stop the db container 30 | 2. Run `docker-compose stop db` 31 | 3. Run `docker-compose run --rm db-backup` 32 | 4. This will backup your database to backup folder. 33 | 34 | ## I want to restore my backup 35 | 1. Run `docker-compose run --rm db-restore` 36 | 2. This will restore your backup. 37 | 38 | 39 | ## Can i use it in my production environment ? 40 | No 41 | -------------------------------------------------------------------------------- /assets/gitpress.css: -------------------------------------------------------------------------------- 1 | .gitpress-sync { 2 | background-color: #2450c4; 3 | color: white; 4 | padding: 0 5px 0 5px !important; 5 | } 6 | 7 | .gitpress-sync-warning { 8 | background-color: #957000; 9 | color: white; 10 | } 11 | -------------------------------------------------------------------------------- /autoloader.php: -------------------------------------------------------------------------------- 1 | get_action_slug(); 9 | add_action( "wp_ajax_$action", array( $this, 'give_response' ) ); 10 | } 11 | 12 | /** 13 | * @return string 14 | */ 15 | abstract function get_action_slug(); 16 | 17 | /** 18 | * @return ActionData 19 | */ 20 | abstract function handle_action(); 21 | 22 | function give_response() { 23 | return wp_send_json_success( $this->handle_action() ); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /classes/Actions/ActionData.php: -------------------------------------------------------------------------------- 1 | can_run_next_action = $can_run_next_action; 13 | $this->message = $message; 14 | } 15 | 16 | 17 | } -------------------------------------------------------------------------------- /classes/Actions/CloneRepoAction.php: -------------------------------------------------------------------------------- 1 | username; 16 | $url = $credentials->repo_name; 17 | $repo_url = "https://github.com/$username/$url"; 18 | 19 | if ( ! is_dir($credentials->dir_name)) { 20 | $output = gitPressExecCommand( "cd /var/www/html/ && git clone $repo_url" ) 21 | . "\n" . gitPressExecCommand( "chmod 777 -R /var/www/html/$url/" ); 22 | } 23 | else { 24 | $output = "Repo already cloned, proceeding to file generation"; 25 | } 26 | return new ActionData(true, $output); 27 | } 28 | } -------------------------------------------------------------------------------- /classes/Actions/CommitAction.php: -------------------------------------------------------------------------------- 1 | username; 17 | $password = $credentials->password; 18 | $dir = $credentials->dir_name; 19 | $date = date( 'Y-m-d h:i:s' ); 20 | 21 | return new ActionData( true, 22 | gitPressExecCommand( "git -C $dir config user.email gitpress@gmail.com" ) 23 | . gitPressExecCommand( "git -C $dir config user.name $username" ) 24 | . gitPressExecCommand( "git -C $dir config user.password $password" ) 25 | . gitPressExecCommand( "git -C $dir add ." ) 26 | . gitPressExecCommand( "cd $dir" ) . gitPressExecCommand( "git -C $dir commit -am 'saving changes on $date'" ) 27 | ); 28 | } 29 | } -------------------------------------------------------------------------------- /classes/Actions/PushAction.php: -------------------------------------------------------------------------------- 1 | username; 17 | $password = $credentials->password; 18 | $host = $credentials->host; 19 | $url = $credentials->repo_name; 20 | $dir = $credentials->dir_name; 21 | 22 | return new ActionData( 23 | true, 24 | gitPressExecCommand( "git -C $dir remote rm origin" ) . 25 | gitPressExecCommand( "git -C $dir remote add origin https://$password@$host.com/$username/$url" ) . 26 | gitPressExecCommand( "git -C $dir config user.email gitpress@gmail.com" ) 27 | . gitPressExecCommand( "git -C $dir config user.name $username" ) 28 | . gitPressExecCommand( "git -C $dir config user.password $password" ) . 29 | gitPressExecCommand( "git -C $dir push origin master" ) 30 | ); 31 | } 32 | } -------------------------------------------------------------------------------- /classes/Actions/ShouldDoSyncAction.php: -------------------------------------------------------------------------------- 1 | username/$credentials->username.github.io" ); 17 | $repo_exists = wp_remote_retrieve_response_code( $response ) === 200; 18 | $message = $repo_exists ? "Repository $credentials->repo_name is available and public" : "Repository $credentials->repo_name doesnt exist"; 19 | 20 | return new ActionData( $repo_exists, $message ); 21 | } 22 | } -------------------------------------------------------------------------------- /classes/AdminBar/AdminBar.php: -------------------------------------------------------------------------------- 1 | username 25 | || ! $credentials->password ) { 26 | $title = "
Gitpress Sync Stats : Configuration required
"; 27 | $href = get_edit_profile_url(); 28 | } else { 29 | $repo_name = $credentials->repo_name; 30 | $title = "Gitpress : Sync $repo_name
"; 31 | $href = "#"; 32 | } 33 | 34 | $admin_bar->add_menu( array( 35 | 'id' => 'gitpress-sync-stats', 36 | 'parent' => null, 37 | 'group' => null, 38 | 'title' => $title, //you can use img tag with image link. it will show the image icon Instead of the title. 39 | 'href' => $href, 40 | 'meta' => [ 41 | 'title' => __( 'Gitpress Sync Stats', 'gitpress' ), //This title will show on hover 42 | ] 43 | ) ); 44 | 45 | 46 | wp_enqueue_style( 'gitpress-sync', plugin_dir_url( __FILE__ ) . "/../../../assets/gitpress.css" ); 47 | wp_enqueue_script( 'gitpress-sync', plugin_dir_url( __FILE__ ) . "/../../../assets/gitpress.js" ); 48 | 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /classes/Data/Credentials.php: -------------------------------------------------------------------------------- 1 | username = $username; 21 | $this->password = $password; 22 | $this->host = $host; 23 | $this->repo_name = "$username.$host.io"; 24 | $this->dir_name = "/var/www/html/$this->repo_name/"; 25 | } 26 | 27 | 28 | public static function get_instance() { 29 | if ( self::$instance ) { 30 | return self::$instance; 31 | } 32 | /** 33 | * @todo: this is a hack, should stop depending on acf and migrate 34 | * to wordpress options. 35 | */ 36 | $username = get_field( 'git_username', "user_1" ); 37 | $password = get_field( 'git_password', "user_1" ); 38 | $host = get_field( 'hosting_site', "user_1" ); 39 | $host = $host === '' ? $host : 'github'; 40 | 41 | self::$instance = new Credentials( 42 | $username, 43 | $password, 44 | $host 45 | ); 46 | 47 | return self::$instance; 48 | } 49 | 50 | 51 | } -------------------------------------------------------------------------------- /classes/Notification/Notification.php: -------------------------------------------------------------------------------- 1 | 16 |8 | 9 |
10 |redirect_url . '">' . $this->redirect_url . '' ); ?>
13 | 14 | 15 | --------------------------------------------------------------------------------