%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /dom405686/wp-content/plugins/pws-core/
Upload File :
Create Path :
Current File : //dom405686/wp-content/plugins/pws-core/README.MD

# cORe
This plugin performs all base functionality needed by the Global Services Website Team.
## Organization

    ├── admin/                              # Contains the admin side of the source code. Think actions done behind login
    ├── includes/                           # Contains classes used to initiate the plugin and hook everything into WordPress
    ├── languages/                          # WordPress language files, used to translate plugin into other languages. Currently only english.
    ├── public/                             # Contains classes for front of site features and functions. Think in front of the login
    ├── cORe.php                            # The main plugin file. This is what WordPress looks for when looking in this plugins folder.Everything starts here



# Running locally (on Mac)

Since this is a WordPress plugin it cannot be ran standalone it has to be installed into a WordPress website. So you will need to get WordPress setup and running locally. 

WordPress standard is setup for a LAMP stack but you can use an application called [MAMP](https://www.mamp.info/en/downloads/)(Mac, apache, mysql and PHP) to run and host a WordPress site locally. The free version is fine.

Follow the Setup Instructions for getting MAMP to run. 
## Installing WordPress
First thing is to install [WP-CLI](https://wp-cli.org/#installing) this will allow you to install and manage a WordPress site from the command line and make troubleshooting and developing much easier. 

Next move to the directory in which you would like your WordPress installed. I suggest in the same directory where you clone all of your repos as in a later step its best to clone the GD cORe plugin into the plugins folder for your local site. 

We can now install WordPress using WP-CLI(change passwords and db names to your liking):

Download WordPress:
```bash
wp core download
```
Next we need to create the MySQL DB you can easily do this through MAMPs [phpMYadmin](http://localhost:8888/MAMP/phpmyadmin.php?lang=en) assuming. you are using port 8888 just click the link to access this. On the left you will see a button called new. Click that and enter your db name. Note this db name as we need it in the next step. **Don't change user and password on this command**

Add MAMP MySQL to your path
```bash
export PATH=$PATH:/Applications/MAMP/Library/bin/
```
Create Config File:
```bash
wp config create --dbname=localtestdb --dbuser=root --dbpass=root
```
Edit Config hostname due to using MAMP:
```bash
wp config set DB_HOST 'localhost:/Applications/MAMP/tmp/mysql/mysql.sock'
```
Configure WordPress Build
```bash
wp core install --url=localhost:8888 --title=Test Site --admin_user=admin --admin_password=PASSWORDHERE --admin_email=YOUR EMAIL
```
Lastly we need to tell MAMP where its web root is. Open MAMP preferences and choose "web server" then hit select on web root and set this to the directory you installed WordPress into. 

You can now navigate to http://localhost:8888 and see your fresh WordPress website. 

## Installing GD cORe
WordPress stores all plugins in one directory, this directory is
```
/wp-content/plugins
```

So we will want to clone the GD cORe plugin into this directory. This way we can edit the plugin source directly and it will take effect on our website immediately. 

Once this is done, log into your website at [Here](http://localhost:8888/wp-admin)(assuming you are on the default port 8888)

## Spoofing MWP
The GD cORe plugin works based off what MWP calls an XID. in order to make your server have an XID which is what the core plugin makes your username. We need to edit our MAMP httpd.conf file and add one. 

The MAMP file you need to edit is located at:
```
/Applications/MAMP/conf/apache/httpd.conf
```
Add the following line to the file (changing the unique string to your own) Make the unique string long so that it will never interfere with a real XID or someone else's in test/dev

```
SetEnv XID "UNIQUE STRING OF NUMBERS"
```
## GDCore site authentication (server-side configuration)

Site settings, Lighthouse report creation and Lighthouse report reads always go through the WP Security Public API proxy (`/api/v1/gdcore/{GD_ACCOUNT_UID}/api-settings`, `…/lighthouse/reports` and `…/lighthouse/reports/{id}?format=json|reportJson|reportHtml`). They are signed like any other WPaaS Public API call (the system plugin's `Plugin::sign_http_request()`), using the WPaaS constants `GD_SITE_TOKEN`, `GD_ACCOUNT_UID` (a UUID) and `GD_TEMP_DOMAIN`. Without all three, settings, scans and report reads fail locally; nothing is sent unsigned or directly to GDCore. No extra configuration is needed. Do not put live secrets in this repository or expose them to browser code.

The Public API host is hardcoded per WPaaS environment, as in the system plugin's `wp_public_api_url()`: `dev` and `test` (or `myh.test`) use `https://wp-api.wpsecurity.{dev,test}-godaddy.com`; any other environment uses `https://wp-api.wpsecurity.godaddy.com`. The site's environment, not request input, selects the host. All other GDCore calls (plugins, themes, updater) go unsigned to the production `GD_CORE_API_BASE`. The PHP-only tests run with `php tests/php/site-auth-test.php` (no network). Do not run `yarn build` for these PHP changes; it removes tracked output before rebuilding.

You can now activate and use the GD cORe plugin in a local environment.

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

## License
[GPLv2 or later](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)

Zerion Mini Shell 1.0