Merged in feature/inital-setup (pull request #1)

Feature/inital setup

Approved-by: Rachit Bhargava
This commit is contained in:
Jay Sharma
2023-10-05 18:16:25 +00:00
committed by Rachit Bhargava
14649 changed files with 3247170 additions and 2 deletions

4
.gitignore vendored
View File

@@ -5,7 +5,7 @@
# Node artifact files
node_modules/
dist/
#dist/
# Compiled Java class files
*.class
@@ -21,7 +21,7 @@ dist/
# Maven
target/
dist/
#dist/
# JetBrains IDE
.idea/

113
1 Normal file
View File

@@ -0,0 +1,113 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "11"
labels:
app: medicalalert-web
name: medicalalert-web
namespace: medicalalert-web
spec:
progressDeadlineSeconds: 600
replicas: 3
revisionHistoryLimit: 10
selector:
matchLabels:
app: medicalalert-web
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
annotations:
kubectl.kubernetes.io/restartedAt: "2023-06-08T17:04:19-04:00"
creationTimestamp: null
labels:
app: medicalalert-web
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
containers:
- env:
- name: ENVIRONMENT
value: "$ENV"
image: 716593996126.dkr.ecr.us-east-1.amazonaws.com/medicalalert-web:$VERSION
envFrom:
- secretRef:
name: medicalalert-web-secrets
- configMapRef:
name: medicalalert-web-cm
imagePullPolicy: Always
name: medicalalert-web
ports:
- containerPort: 80
name: http
protocol: TCP
startupProbe:
exec:
command:
- /root/redinessprobe-wp.sh
initialDelaySeconds: 90
periodSeconds: 10
timeoutSeconds: 10
failureThreshold: 5
successThreshold: 1
readinessProbe:
exec:
command:
- /bin/sh
- -c
- "wget -qO- 127.0.0.1/status |grep start && echo redinessprobe-success || exit 9"
initialDelaySeconds: 30
periodSeconds: 5
successThreshold: 1
failureThreshold: 5
timeoutSeconds: 10
livenessProbe:
tcpSocket:
port: 80
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 10
resources:
limits:
cpu: 500m
memory: 1024Mi
requests:
cpu: 300m
memory: 700Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /usr/share/nginx/subdomain/www/wp-content/uploads
name: persistent-storage
- mountPath: /etc/nginx/conf.d/
name: default-conf
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: regcred
nodeSelector:
kubernetes.io/os: linux
restartPolicy: Always
schedulerName: default-scheduler
terminationGracePeriodSeconds: 30
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: efs-claim-medicalalert
- name: default-conf
configMap:
defaultMode: 420
name: medicalalert-web-default-conf-cm

10
Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
FROM wyveo/nginx-php-fpm:php74
RUN mkdir -p /var/lib/nginx/cache /usr/share/nginx/subdomain; cd /usr/share/nginx/subdomain ; mkdir www
COPY wp/ /usr/share/nginx/subdomain/www
RUN sed -i 's/;pm.status_path/pm.status_path/g' /etc/php/7.4/fpm/pool.d/www.conf
#RUN rm /etc/nginx/conf.d/default.conf
#COPY build/default.conf /etc/nginx/conf.d/default.conf
COPY redinessprobe-wp.sh /root/redinessprobe-wp.sh
RUN chmod +x /etc/nginx/conf.d/default.conf /root/redinessprobe-wp.sh
RUN chmod +xw -R /usr/share/nginx/
#USER nginx

324
bitbucket-pipelines.yml Normal file
View File

@@ -0,0 +1,324 @@
definitions:
set-variables: &set-variables
- variables:
- name: VERSION
default: "latest"
set-variables-jobs: &set-variables-jobs-dev
- variables:
- name: ENV
default: "dev"
allowed-values: # Optionally restrict variable values
- "dev"
- name: JOBNAME
default: "mysql-backup"
allowed-values: # Optionally restrict variable values
- "wp-auto-patch"
- "mysql-backup"
- "wp-data-backup"
- "mysql-restore"
- "wp-data-restore"
- name: SUBDOMAIN
default: dev01
allowed-values: # Optionally restrict variable values
- "dev01"
- "www"
- "dev02"
- "dev03"
- "dev04"
- "dev05"
- name: RESTORE_VERSION
default: "PASTE_RESTORE_VERSION_FILE_NAME"
set-variables-jobs: &set-variables-jobs
- variables:
- name: ENV
default: "qa"
allowed-values: # Optionally restrict variable values
- "qa"
- "stage"
- "prod"
- name: JOBNAME
default: "mysql-backup"
allowed-values: # Optionally restrict variable values
- "wp-auto-patch"
- "mysql-backup"
- "wp-data-backup"
- "mysql-restore"
- "wp-data-restore"
- name: SUBDOMAIN
default: www
allowed-values: # Optionally restrict variable values
- "www"
- name: RESTORE_VERSION
default: "PASTE_RESTORE_VERSION_FILE_NAME"
set-variables-subdomain: &set-variables-subdomain
- variables:
- name: ENV
default: "dev"
allowed-values: # Optionally restrict variable values
- "dev"
- name: URL_DOMAIN
default: dev01.dev-medicalalert.com
allowed-values: # Optionally restrict variable values
- "dev01.dev-medicalalert.com"
- "dev02.dev-medicalalert.com"
- "dev03.dev-medicalalert.com"
- "dev04.dev-medicalalert.com"
- "dev05.dev-medicalalert.com"
- name: MYSQL_FILE_NAME
default: "MYSQL_FILE_NAME_TO_DEPLOY"
- name: STATIC_FILE_NAME
default: "STATIC_FILE_NAME_TO_DEPLOY"
steps:
- step: &deploy
name: deploy to $ENV environment
image: atlassian/default-image:3
script:
# check if env file exists
- if [ -e setenv.sh ]; then
- cat setenv.sh
- source setenv.sh
- fi
- echo "This is for $ENV environment"
- chmod 755 ./validation.sh && ./validation.sh default && echo validation-done || exit 9
- ls -lrth && cd build/${ENV}
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install
- curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x ./kubectl && mv ./kubectl /usr/local/bin/kubectl
- export DB_PASSWORD=$(aws ssm get-parameters --names $ENV-medicalalert-masterdbpass --query "Parameters[*].{Value:Value}" --output text)
- export DB_PASSWORD=`echo -n "$DB_PASSWORD" | base64` && sed -i "/DB_PASSWORD/c\ DB_PASSWORD:\ $DB_PASSWORD" secrets.yaml
- envsubst < deployment.tpl > deployment.yaml
- cat deployment.yaml
- pipe: atlassian/aws-eks-kubectl-run:2.2.0
variables:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
CLUSTER_NAME: $CLUSTER
KUBECTL_COMMAND: "apply"
RESOURCE_PATH: "../${ENV}"
KUBECTL_ARGS: ""
KUBECTL_APPLY_ARGS: "-f"
DEBUG: "true"
after-script:
- aws eks update-kubeconfig --name caresage-eks-cluster-$ENV --region us-east-1
- sleep 10 && while kubectl get po -A |egrep -i '0/1|crash'; do sleep 10; echo "--- still getting 0/1 or crash pods | fix the issue"; done
pipelines:
# our custom pipeline, what shows up Bitbucket web app
custom:
deploy-dev:
- <<: *set-variables
- step:
<<: *deploy
deployment: dev
name: "deploy to dev"
deploy-qa:
- <<: *set-variables
- step:
<<: *deploy
deployment: qa
name: "deploy to qa"
release-stg:
- <<: *set-variables
- step:
<<: *deploy
deployment: stage
name: "deploy to stage"
release-prod:
- <<: *set-variables
- step:
<<: *deploy
deployment: prod
name: "deploy to prod"
common-jobs-dev:
- <<: *set-variables-jobs-dev
- step:
name: vars for common-jobs-dev
script:
- echo "export JOBNAME=$JOBNAME" >> setenv.sh
- echo "export ENV=$ENV" >> setenv.sh
- echo "export CLUSTER=caresage-eks-cluster-$ENV" >> setenv.sh
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
- echo "export RESTORE_VERSION=$RESTORE_VERSION" >> setenv.sh
- echo "export SUBDOMAIN=$SUBDOMAIN" >> setenv.sh
- echo "export BITBUCKET_REPO_SLUG=$BITBUCKET_REPO_SLUG" >> setenv.sh
- echo "export TOKEN=$TOKEN" >> setenv.sh
artifacts: # define the artifacts to be passed to each future step
- setenv.sh
- step:
name: common jobs for SQL and WWW backup and restore DEV
image: atlassian/pipelines-awscli
script:
- source setenv.sh && chmod 755 ./common-jobs-bitbucket.sh
- if [ "$JOBNAME" = "mysql-restore" ] && [ "$SUBDOMAIN" = "www" ] ; then ./common-jobs-bitbucket.sh subdomain_deploy; fi
# - [[ "$SUBDOMAIN" != "www" ]] && [[ "$ENV" = "qa" || "$ENV" = "stage" || "$ENV" = "prod" ]] && exit || echo VALIDATION-PASS
- if [[ "$SUBDOMAIN" != "www" ]] && [[ "$ENV" = "qa" || "$ENV" = "stage" || "$ENV" = "prod" ]] ; then echo VALIDATION-FAIL && exit 9 ; else echo VALIDATION-PASS;fi
- ./common-jobs-bitbucket.sh $JOBNAME
common-jobs:
- <<: *set-variables-jobs
- step:
name: vars for common-jobs qa/stage/prod
script:
- echo "export JOBNAME=$JOBNAME" >> setenv.sh
- echo "export ENV=$ENV" >> setenv.sh
- echo "export CLUSTER=caresage-eks-cluster-$ENV" >> setenv.sh
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
- echo "export RESTORE_VERSION=$RESTORE_VERSION" >> setenv.sh
- echo "export SUBDOMAIN=$SUBDOMAIN" >> setenv.sh
- echo "export BITBUCKET_REPO_SLUG=$BITBUCKET_REPO_SLUG" >> setenv.sh
- echo "export TOKEN=$TOKEN" >> setenv.sh
artifacts: # define the artifacts to be passed to each future step
- setenv.sh
- step:
name: common jobs for SQL and WWW backup and restore.
image: atlassian/pipelines-awscli
script:
- source setenv.sh && chmod 755 ./common-jobs-bitbucket.sh
- if [ "$JOBNAME" = "mysql-restore" ] && [ "$SUBDOMAIN" = "www" ] ; then ./common-jobs-bitbucket.sh subdomain_deploy; fi
# - [[ "$SUBDOMAIN" != "www" ]] && [[ "$ENV" = "qa" || "$ENV" = "stage" || "$ENV" = "prod" ]] && exit || echo VALIDATION-PASS
- if [[ "$SUBDOMAIN" != "www" ]] && [[ "$ENV" = "qa" || "$ENV" = "stage" || "$ENV" = "prod" ]] ; then echo VALIDATION-FAIL && exit 9 ; else echo VALIDATION-PASS;fi
- ./common-jobs-bitbucket.sh $JOBNAME
subdomain-deploy:
- <<: *set-variables-subdomain
- step:
name: vars for subdomain
script:
- echo "export SUBDOMAIN=`echo $URL_DOMAIN | awk -F. '{print $1}'`" >> setenv.sh
- echo "export ENV=$ENV" >> setenv.sh
- echo "export CLUSTER=caresage-eks-cluster-$ENV" >> setenv.sh
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
- echo "export RESTORE_VERSION=$RESTORE_VERSION" >> setenv.sh
- echo "export URL_DOMAIN=$URL_DOMAIN" >> setenv.sh
- echo "export MYSQL_FILE_NAME=$MYSQL_FILE_NAME" >> setenv.sh
- echo "export STATIC_FILE_NAME=$STATIC_FILE_NAME" >> setenv.sh
- echo "export BITBUCKET_REPO_SLUG=$BITBUCKET_REPO_SLUG" >> setenv.sh
- echo "export TOKEN=$TOKEN" >> setenv.sh
artifacts:
- setenv.sh
- step:
name: Deploy the wp source code
trigger: manual
image: atlassian/pipelines-awscli
script:
- source setenv.sh
- chmod 755 ./common-jobs-bitbucket.sh && ./common-jobs-bitbucket.sh subdomain_deploy
artifacts:
- setenv.sh
- step:
name: Deploy the mysql database
trigger: manual
image: atlassian/pipelines-awscli
script:
- source setenv.sh
- chmod 755 ./common-jobs-bitbucket.sh && ./common-jobs-bitbucket.sh mysql-restore $MYSQL_FILE_NAME
artifacts:
- setenv.sh
- step:
name: Deploy the static data
trigger: manual
image: atlassian/pipelines-awscli
script:
- source setenv.sh
- chmod 755 ./common-jobs-bitbucket.sh && ./common-jobs-bitbucket.sh wp-data-restore $STATIC_FILE_NAME
release:
- <<: *set-variables
- step:
name: "plan for the release and tag the given version."
image: atlassian/pipelines-awscli
script:
- chmod 755 ./validation.sh && ./validation.sh default
- echo "make sure that release version file and plan has been added to the release repo"
- source release
- export MANIFEST=$(aws ecr batch-get-image --repository-name medicalalert-web --image-ids imageTag=$VERSION --output json | jq --raw-output --join-output '.images[0].imageManifest')
- aws ecr put-image --repository-name medicalalert-web --image-tag $RELEASE --image-manifest "$MANIFEST" && echo ------ image $VERSION has been retagged as $RELEASE || exit 9
- echo "export VERSION=$RELEASE" >> setenv.sh
- echo "export ENV=stage" >> setenv.sh
artifacts: # define the artifacts to be passed to each future step
- setenv.sh
- step:
<<: *deploy
deployment: stage
name: "deploy the release to stage"
trigger: manual
- step:
name: vars for prod
script:
- source release
- echo "export VERSION=$RELEASE" >> setenv.sh
- echo "export ENV=prod" >> setenv.sh
artifacts: # define the artifacts to be passed to each future step
- setenv.sh
- step:
<<: *deploy
deployment: prod
name: "deploy the release to production"
trigger: manual
pull-requests:
develop:
- step:
name: build the application and push that to dev env.
image: atlassian/default-image:3
script:
- chmod 755 ./validation.sh && ./validation.sh default
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install
- export BUILD_D=$BITBUCKET_BRANCH_$BITBUCKET_COMMIT_$BITBUCKET_BUILD_NUMBER
- export IMAGE="medicalalert-web" && export VERSION=$BITBUCKET_BUILD_NUMBER
- aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 716593996126.dkr.ecr.us-east-1.amazonaws.com
- docker build -t ${IMAGE} .
- docker tag ${IMAGE} ${IMAGE}:${VERSION}
- pipe: atlassian/aws-ecr-push-image:1.6.2
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
IMAGE_NAME: $IMAGE
TAGS: $VERSION
services:
- docker
caches:
- docker
- step:
name: vars for dev
script:
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
- echo "export ENV=dev" >> setenv.sh
artifacts: # define the artifacts to be passed to each future step
- setenv.sh
- step:
<<: *deploy
deployment: dev
name: "deploy to dev"
- step:
name: vars for qa
script:
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
- echo "export ENV=qa" >> setenv.sh
artifacts:
- setenv.sh
- step:
<<: *deploy
deployment: qa
name: "deploy to qa"
trigger: manual

17
build/dev/configmap.yaml Executable file
View File

@@ -0,0 +1,17 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: medicalalert-web-cm
namespace: medicalalert-web
labels:
app: medicalalert-web
data:
DB_HOST: dev-medicalalert-ecommerce.c5om7w6xopq1.us-east-1.rds.amazonaws.com
ENV: dev
WP_DEBUG: "false"
DB_CHARSET: utf8
DB_COLLATE: utf8_general_ci
CACHE_HOST: master.redis-cache-all-be-medicalalert.cqsmse.use1.cache.amazonaws.com
CACHE_PORT: "6379"
DB_NAME: "www"
DB_USER: "pantheon"

138
build/dev/deployment.tpl Executable file
View File

@@ -0,0 +1,138 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "11"
labels:
app: medicalalert-web
name: medicalalert-web
namespace: medicalalert-web
spec:
progressDeadlineSeconds: 600
replicas: 3
revisionHistoryLimit: 10
selector:
matchLabels:
app: medicalalert-web
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
annotations:
kubectl.kubernetes.io/restartedAt: "2023-06-08T17:04:19-04:00"
creationTimestamp: null
labels:
app: medicalalert-web
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
containers:
- env:
- name: ENVIRONMENT
value: "$ENV"
image: 716593996126.dkr.ecr.us-east-1.amazonaws.com/medicalalert-web:$VERSION
envFrom:
- secretRef:
name: medicalalert-web-secrets
- configMapRef:
name: medicalalert-web-cm
imagePullPolicy: Always
name: medicalalert-web
ports:
- containerPort: 80
name: http
protocol: TCP
startupProbe:
exec:
command:
- /root/redinessprobe-wp.sh
initialDelaySeconds: 90
periodSeconds: 10
timeoutSeconds: 10
failureThreshold: 5
successThreshold: 1
readinessProbe:
exec:
command:
- /bin/sh
- -c
- "wget -qO- 127.0.0.1/status |grep start && echo redinessprobe-success || exit 9"
initialDelaySeconds: 30
periodSeconds: 5
successThreshold: 1
failureThreshold: 5
timeoutSeconds: 10
livenessProbe:
tcpSocket:
port: 80
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 10
resources:
limits:
cpu: 500m
memory: 1024Mi
requests:
cpu: 300m
memory: 700Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /usr/share/nginx/subdomain/www/wp-content/uploads
name: persistent-storage
- mountPath: /usr/share/nginx/subdomain/dev01
name: persistent-storage-dev01
- mountPath: /usr/share/nginx/subdomain/dev02
name: persistent-storage-dev02
- mountPath: /usr/share/nginx/subdomain/dev03
name: persistent-storage-dev03
- mountPath: /usr/share/nginx/subdomain/dev04
name: persistent-storage-dev04
- mountPath: /usr/share/nginx/subdomain/dev05
name: persistent-storage-dev05
- mountPath: /etc/nginx/conf.d/
name: default-conf
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: regcred
nodeSelector:
kubernetes.io/os: linux
restartPolicy: Always
schedulerName: default-scheduler
terminationGracePeriodSeconds: 30
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: efs-claim-medicalalert
- name: persistent-storage-dev01
persistentVolumeClaim:
claimName: efs-claim-medicalalert-dev01
- name: persistent-storage-dev02
persistentVolumeClaim:
claimName: efs-claim-medicalalert-dev02
- name: persistent-storage-dev03
persistentVolumeClaim:
claimName: efs-claim-medicalalert-dev03
- name: persistent-storage-dev04
persistentVolumeClaim:
claimName: efs-claim-medicalalert-dev04
- name: persistent-storage-dev05
persistentVolumeClaim:
claimName: efs-claim-medicalalert-dev05
- name: default-conf
configMap:
defaultMode: 420
name: medicalalert-web-default-conf-cm

50
build/dev/jobs.tpl Executable file
View File

@@ -0,0 +1,50 @@
apiVersion: batch/v1
kind: Job
metadata:
name: common-jobs
namespace: medicalalert-web
labels:
app: medicalalert-web
rds: enable
spec:
ttlSecondsAfterFinished: 10
template:
metadata:
labels:
app: medicalalert-web
rds: enable
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
containers:
- name: common-jobs
image: ubuntu:latest
envFrom:
- secretRef:
name: medicalalert-web-secrets
- configMapRef:
name: medicalalert-web-cm
command: ["bash"]
args:
- -c
- cp -rf /usr/share/nginx/subdomain/www/wp-content/uploads/common-jobs.sh /root/ && chmod 755 /root/common-jobs.sh && /root/common-jobs.sh $JOBNAME
volumeMounts:
- mountPath: /usr/share/nginx/subdomain/www/wp-content/uploads
name: persistent-storage
imagePullSecrets:
- name: regcred
nodeSelector:
kubernetes.io/os: linux
restartPolicy: Never
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: efs-claim-medicalalert

70
build/dev/pod.tpl Normal file
View File

@@ -0,0 +1,70 @@
apiVersion: v1
kind: Pod
metadata:
name: common-job-pod
namespace: medicalalert-web
labels:
app: medicalalert-web
rds: enable
pod: common
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
containers:
- name: common-job
image: wyveo/nginx-php-fpm:php74
envFrom:
- secretRef:
name: medicalalert-web-secrets
- configMapRef:
name: medicalalert-web-cm
command: ["bash"]
args:
- -c
- sleep infinity
volumeMounts:
- mountPath: /usr/share/nginx/subdomain/www/wp-content/uploads
name: persistent-storage
- mountPath: /usr/share/nginx/subdomain/dev01
name: persistent-storage-dev01
- mountPath: /usr/share/nginx/subdomain/dev02
name: persistent-storage-dev02
- mountPath: /usr/share/nginx/subdomain/dev03
name: persistent-storage-dev03
- mountPath: /usr/share/nginx/subdomain/dev04
name: persistent-storage-dev04
- mountPath: /usr/share/nginx/subdomain/dev05
name: persistent-storage-dev05
imagePullSecrets:
- name: regcred
nodeSelector:
kubernetes.io/os: linux
restartPolicy: Never
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: efs-claim-medicalalert
- name: persistent-storage-dev01
persistentVolumeClaim:
claimName: efs-claim-medicalalert-dev01
- name: persistent-storage-dev02
persistentVolumeClaim:
claimName: efs-claim-medicalalert-dev02
- name: persistent-storage-dev03
persistentVolumeClaim:
claimName: efs-claim-medicalalert-dev03
- name: persistent-storage-dev04
persistentVolumeClaim:
claimName: efs-claim-medicalalert-dev04
- name: persistent-storage-dev05
persistentVolumeClaim:
claimName: efs-claim-medicalalert-dev05

77
build/dev/pvc.yml Executable file
View File

@@ -0,0 +1,77 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: efs-claim-medicalalert
namespace: medicalalert-web
spec:
accessModes:
- ReadWriteMany
storageClassName: efs-sc-dev-ecommerce
resources:
requests:
storage: 5Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: efs-claim-medicalalert-dev05
namespace: medicalalert-web
spec:
accessModes:
- ReadWriteMany
storageClassName: efs-sc-dev-ecommerce
resources:
requests:
storage: 3Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: efs-claim-medicalalert-dev04
namespace: medicalalert-web
spec:
accessModes:
- ReadWriteMany
storageClassName: efs-sc-dev-ecommerce
resources:
requests:
storage: 3Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: efs-claim-medicalalert-dev03
namespace: medicalalert-web
spec:
accessModes:
- ReadWriteMany
storageClassName: efs-sc-dev-ecommerce
resources:
requests:
storage: 3Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: efs-claim-medicalalert-dev02
namespace: medicalalert-web
spec:
accessModes:
- ReadWriteMany
storageClassName: efs-sc-dev-ecommerce
resources:
requests:
storage: 3Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: efs-claim-medicalalert-dev01
namespace: medicalalert-web
spec:
accessModes:
- ReadWriteMany
storageClassName: efs-sc-dev-ecommerce
resources:
requests:
storage: 3Gi

13
build/dev/secrets.yaml Normal file
View File

@@ -0,0 +1,13 @@
apiVersion: v1
data:
CACHE_PASSWORD: UU1FRVQ0ZG15VlE4OXZKWUFSUjdQQXhoUU1FRVQ0ZG15VlE4OXZKWUFSUjdQQXho
DB_PASSWORD: U2xCMU5IUjZWbXhFZHpkM2NqbHJkRGxMUlRaWFRYRTJiMmRHU1hWamMwST0=
TOKEN: QVRDVFQzeEZmR04wbXpCZjF4NDVaSkVIa3l0eWVYX0NvWXJRSHJwbHk4RlUzWG1wTjZHcGNjNHU5RzB5bW5DMzg2SjFQUTFSR3Z3VG10QWN3WUVmc2s5MGt4UDQxVEc3Q0xhSWwtYUs2cFRTY0NqYVVQcUdOY3phWEFxdVFXaGhlWjc5d1FXa3dTd2J6NDVhY1Z4T21ZZWtpTFlIU21TMTBsWV9ibF9wZ1ZxbG9kMVFxSy1uYmV3PTg4NjIyMEM3
kind: Secret
metadata:
annotations:
labels:
app: medicalalert-web
name: medicalalert-web-secrets
namespace: medicalalert-web
type: Opaque

16
build/dev/service.yml Executable file
View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: medicalalert-web
namespace: medicalalert-web
labels:
app: medicalalert-web
spec:
type: NodePort
selector:
app: medicalalert-web
ports:
- protocol: TCP
port: 80
targetPort: 80
nodePort: 30846

View File

@@ -0,0 +1,294 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: medicalalert-web-default-conf-cm
namespace: medicalalert-web
labels:
app: medicalalert-web
data:
default.conf: |
# ---------------------
fastcgi_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=MYAPP:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
# -----------------------------------------
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort on;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_read_timeout 120;
#fastcgi_index index.php;
# --------------------------------
# Only cache positive responses
proxy_cache_valid 200 1h;
proxy_cache_valid 301 302 15m;
server {
listen 80 default; ## listen for ipv4; this line is default and implied
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name dev-medicalalert.com "";
return 301 https://www.$host$request_uri;
root /usr/share/nginx/subdomain/www;
index index.php index.html index.htm;
}
subdomain.conf: |
server {
listen 80;
listen [::]:80;
server_name ~^(?<subdomain>.+)\.dev-medicalalert\.com$;
if ($http_x_forwarded_proto != 'https') {
return 301 https://$host$request_uri;
}
root /usr/share/nginx/subdomain/$subdomain;
index index.php index.html index.htm;
sendfile off;
# Security - Hide nginx version number in error pages and Server header
server_tokens off;
# Add stdout logging
error_log /dev/stdout error;
access_log /dev/stdout;
# reduce the data that needs to be sent over network
gzip on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml application/json text/javascript application/x-javascript application/xml;
gzip_disable "MSIE [1-6]\.";
add_header 'Content-Security-Policy' 'upgrade-insecure-requests';
add_header X-Cache-Status $upstream_cache_status;
add_header Cache-Control "public";
#Cache everything by default
set $no_cache 0;
#Don't cache POST requests
if ($request_method = POST)
{
set $no_cache 1;
}
#Don't cache if the URL contains a query string
if ($query_string != "")
{
set $no_cache 1;
}
#Don't cache the following URLs
if ($request_uri ~* "/(administrator/|wp-login.php)")
{
set $no_cache 1;
}
#Don't cache if there is a cookie called PHPSESSID
if ($http_cookie = "PHPSESSID")
{
set $no_cache 1;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.php
try_files $uri $uri/ /index.php?$args;
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_param SUBDOMAIN $subdomain; # $_SERVER["SUBDOMAIN"]
include fastcgi_params;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/subdomain/$subdomain;
}
# pass the PHP scripts to FastCGI server listening on socket
#
#~ \.php$
location ~ [^/]\.php(/|$) {
proxy_set_header X-Forwarded-Proto $scheme;
try_files $uri $uri/ /index.php?$args;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SUBDOMAIN $subdomain; # $_SERVER["SUBDOMAIN"]
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
proxy_cache_background_update on;
proxy_cache_lock on;
}
# deny access to . files, for security
#
location ~ /\. {
log_not_found off;
deny all;
}
}
localhost.conf: |
server {
listen 80;
listen [::]:80;
server_name localhost 127.0.0.1;
root /usr/share/nginx/subdomain/www;
index index.php index.html index.htm;
sendfile off;
server_tokens off;
error_log /dev/stdout error;
access_log /dev/stdout;
# reduce the data that needs to be sent over network
gzip on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml application/json text/javascript application/x-javascript application/xml;
gzip_disable "MSIE [1-6]\.";
add_header 'Content-Security-Policy' 'upgrade-insecure-requests';
add_header X-Cache-Status $upstream_cache_status;
add_header Cache-Control "public";
#Cache everything by default
set $no_cache 0;
#Don't cache POST requests
if ($request_method = POST)
{
set $no_cache 1;
}
#Don't cache if the URL contains a query string
if ($query_string != "")
{
set $no_cache 1;
}
#Don't cache the following URLs
if ($request_uri ~* "/(administrator/|wp-login.php)")
{
set $no_cache 1;
}
#Don't cache if there is a cookie called PHPSESSID
if ($http_cookie = "PHPSESSID")
{
set $no_cache 1;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.php
try_files $uri $uri/ /index.php?$args;
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_param SUBDOMAIN www; # $_SERVER["SUBDOMAIN"]
include fastcgi_params;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/subdomain/www;
}
# pass the PHP scripts to FastCGI server listening on socket
#
#~ \.php$
location ~ [^/]\.php(/|$) {
proxy_set_header X-Forwarded-Proto $scheme;
try_files $uri $uri/ /index.php?$args;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SUBDOMAIN www; # $_SERVER["SUBDOMAIN"]
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
proxy_cache_background_update on;
proxy_cache_lock on;
}
# deny access to . files, for security
#
location ~ /\. {
log_not_found off;
deny all;
}
location ~ ^/(status|ping)$ {
access_log off;
allow 127.0.0.1;
deny all;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}

13
build/dev/web-hpa.yml Normal file
View File

@@ -0,0 +1,13 @@
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: medicalalert-web-hpa
namespace: medicalalert-web
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: medicalalert-web
minReplicas: 3
maxReplicas: 6
targetCPUUtilizationPercentage: 70

17
build/prod/configmap.yaml Normal file
View File

@@ -0,0 +1,17 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: medicalalert-web-cm
namespace: medicalalert-web
labels:
app: medicalalert-web
data:
DB_HOST: prod-medicalalert-ecommerce.c5om7w6xopq1.us-east-1.rds.amazonaws.com
ENV: prod
WP_DEBUG: "false"
DB_CHARSET: utf8
DB_COLLATE: utf8_general_ci
CACHE_HOST: master.redis-cache-all-be-caresage.cqsmse.use1.cache.amazonaws.com
CACHE_PORT: "6379"
DB_NAME: "www"
DB_USER: "pantheon"

113
build/prod/deployment.tpl Normal file
View File

@@ -0,0 +1,113 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "11"
labels:
app: medicalalert-web
name: medicalalert-web
namespace: medicalalert-web
spec:
progressDeadlineSeconds: 600
replicas: 3
revisionHistoryLimit: 10
selector:
matchLabels:
app: medicalalert-web
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
annotations:
kubectl.kubernetes.io/restartedAt: "2023-06-08T17:04:19-04:00"
creationTimestamp: null
labels:
app: medicalalert-web
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
containers:
- env:
- name: ENVIRONMENT
value: "$ENV"
image: 716593996126.dkr.ecr.us-east-1.amazonaws.com/medicalalert-web:$VERSION
envFrom:
- secretRef:
name: medicalalert-web-secrets
- configMapRef:
name: medicalalert-web-cm
imagePullPolicy: Always
name: medicalalert-web
ports:
- containerPort: 80
name: http
protocol: TCP
startupProbe:
exec:
command:
- /root/redinessprobe-wp.sh
initialDelaySeconds: 90
periodSeconds: 10
timeoutSeconds: 10
failureThreshold: 5
successThreshold: 1
readinessProbe:
exec:
command:
- /bin/sh
- -c
- "wget -qO- 127.0.0.1/status |grep start && echo redinessprobe-success || exit 9"
initialDelaySeconds: 30
periodSeconds: 5
successThreshold: 1
failureThreshold: 5
timeoutSeconds: 10
livenessProbe:
tcpSocket:
port: 80
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 10
resources:
limits:
cpu: 500m
memory: 1024Mi
requests:
cpu: 300m
memory: 700Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /usr/share/nginx/subdomain/www/wp-content/uploads
name: persistent-storage
- mountPath: /etc/nginx/conf.d/
name: default-conf
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: regcred
nodeSelector:
kubernetes.io/os: linux
restartPolicy: Always
schedulerName: default-scheduler
terminationGracePeriodSeconds: 30
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: efs-claim-medicalalert
- name: default-conf
configMap:
defaultMode: 420
name: medicalalert-web-default-conf-cm

45
build/prod/pod.tpl Normal file
View File

@@ -0,0 +1,45 @@
apiVersion: v1
kind: Pod
metadata:
name: common-job-pod
namespace: medicalalert-web
labels:
app: medicalalert-web
rds: enable
pod: common
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
containers:
- name: common-job
image: wyveo/nginx-php-fpm:php74
envFrom:
- secretRef:
name: medicalalert-web-secrets
- configMapRef:
name: medicalalert-web-cm
command: ["bash"]
args:
- -c
- sleep infinity
volumeMounts:
- mountPath: /usr/share/nginx/subdomain/www/wp-content/uploads
name: persistent-storage
imagePullSecrets:
- name: regcred
nodeSelector:
kubernetes.io/os: linux
restartPolicy: Never
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: efs-claim-medicalalert

12
build/prod/pvc.yml Normal file
View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: efs-claim-medicalalert
namespace: medicalalert-web
spec:
accessModes:
- ReadWriteMany
storageClassName: efs-sc-prod-ecommerce
resources:
requests:
storage: 5Gi

13
build/prod/secrets.yaml Normal file
View File

@@ -0,0 +1,13 @@
apiVersion: v1
data:
CACHE_PASSWORD: UU1FRVQ0ZG15VlE4OXZKWUFSUjdQQXhoUU1FRVQ0ZG15VlE4OXZKWUFSUjdQQXho
DB_PASSWORD: NUtJTklPbFNSdmRYZEVVNWZDd29JTGxleUJoSHNLVnU=
TOKEN: QVRDVFQzeEZmR04wWC1yOWcyb090X3c2WGY0bUdkQl94QlZ5Ymd2RWozU09aR055bEJtLXZzTkxDcHhRZE5IZTV0WTh4ZHc5MW9reDlZSlI3WlhGMk56SmFZaXpzSlBBWmFEMG5Hakp3RG92YkJZWTVaTzJRRC0wNEN3c0cxV3FZeWM2UzRkMHA2RWpOY0plOTZmLWVfalgwM3FDZlA0NEtkQkFCeGtzQTZQTEdWdGFidGMwSjdFPUZBMjdBRjgx
kind: Secret
metadata:
annotations:
labels:
app: medicalalert-web
name: medicalalert-web-secrets
namespace: medicalalert-web
type: Opaque

16
build/prod/service.yml Normal file
View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: medicalalert-web
namespace: medicalalert-web
labels:
app: medicalalert-web
spec:
type: NodePort
selector:
app: medicalalert-web
ports:
- protocol: TCP
port: 80
targetPort: 80
nodePort: 30846

View File

@@ -0,0 +1,293 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: medicalalert-web-default-conf-cm
namespace: medicalalert-web
labels:
app: medicalalert-web
data:
default.conf: |
# ---------------------
fastcgi_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=MYAPP:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
# -----------------------------------------
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort on;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_read_timeout 120;
#fastcgi_index index.php;
# --------------------------------
# Only cache positive responses
proxy_cache_valid 200 1h;
proxy_cache_valid 301 302 15m;
server {
listen 80 default; ## listen for ipv4; this line is default and implied
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name medicalalert.com "";
return 301 https://www.$host$request_uri;
root /usr/share/nginx/subdomain/www;
index index.php index.html index.htm;
}
subdomain.conf: |
server {
listen 80;
listen [::]:80;
server_name ~^(?<subdomain>.+)\.medicalalert\.com$;
if ($http_x_forwarded_proto != 'https') {
return 301 https://$host$request_uri;
}
root /usr/share/nginx/subdomain/$subdomain;
index index.php index.html index.htm;
sendfile off;
# Security - Hide nginx version number in error pages and Server header
server_tokens off;
# Add stdout logging
error_log /dev/stdout error;
access_log /dev/stdout;
# reduce the data that needs to be sent over network
gzip on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml application/json text/javascript application/x-javascript application/xml;
gzip_disable "MSIE [1-6]\.";
add_header 'Content-Security-Policy' 'upgrade-insecure-requests';
add_header X-Cache-Status $upstream_cache_status;
add_header Cache-Control "public";
#Cache everything by default
set $no_cache 0;
#Don't cache POST requests
if ($request_method = POST)
{
set $no_cache 1;
}
#Don't cache if the URL contains a query string
if ($query_string != "")
{
set $no_cache 1;
}
#Don't cache the following URLs
if ($request_uri ~* "/(administrator/|wp-login.php)")
{
set $no_cache 1;
}
#Don't cache if there is a cookie called PHPSESSID
if ($http_cookie = "PHPSESSID")
{
set $no_cache 1;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.php
try_files $uri $uri/ /index.php?$args;
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_param SUBDOMAIN $subdomain; # $_SERVER["SUBDOMAIN"]
include fastcgi_params;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/subdomain/$subdomain;
}
# pass the PHP scripts to FastCGI server listening on socket
#
#~ \.php$
location ~ [^/]\.php(/|$) {
proxy_set_header X-Forwarded-Proto $scheme;
try_files $uri $uri/ /index.php?$args;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SUBDOMAIN $subdomain; # $_SERVER["SUBDOMAIN"]
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
proxy_cache_background_update on;
proxy_cache_lock on;
}
# deny access to . files, for security
#
location ~ /\. {
log_not_found off;
deny all;
}
}
localhost.conf: |
server {
listen 80;
listen [::]:80;
server_name localhost 127.0.0.1;
root /usr/share/nginx/subdomain/www;
index index.php index.html index.htm;
sendfile off;
server_tokens off;
error_log /dev/stdout error;
access_log /dev/stdout;
# reduce the data that needs to be sent over network
gzip on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml application/json text/javascript application/x-javascript application/xml;
gzip_disable "MSIE [1-6]\.";
add_header 'Content-Security-Policy' 'upgrade-insecure-requests';
add_header X-Cache-Status $upstream_cache_status;
add_header Cache-Control "public";
#Cache everything by default
set $no_cache 0;
#Don't cache POST requests
if ($request_method = POST)
{
set $no_cache 1;
}
#Don't cache if the URL contains a query string
if ($query_string != "")
{
set $no_cache 1;
}
#Don't cache the following URLs
if ($request_uri ~* "/(administrator/|wp-login.php)")
{
set $no_cache 1;
}
#Don't cache if there is a cookie called PHPSESSID
if ($http_cookie = "PHPSESSID")
{
set $no_cache 1;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.php
try_files $uri $uri/ /index.php?$args;
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_param SUBDOMAIN www; # $_SERVER["SUBDOMAIN"]
include fastcgi_params;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/subdomain/www;
}
# pass the PHP scripts to FastCGI server listening on socket
#
#~ \.php$
location ~ [^/]\.php(/|$) {
proxy_set_header X-Forwarded-Proto $scheme;
try_files $uri $uri/ /index.php?$args;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SUBDOMAIN www; # $_SERVER["SUBDOMAIN"]
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
proxy_cache_background_update on;
proxy_cache_lock on;
}
# deny access to . files, for security
#
location ~ /\. {
log_not_found off;
deny all;
}
location ~ ^/(status|ping)$ {
access_log off;
allow 127.0.0.1;
deny all;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}

13
build/prod/web-hpa.yml Normal file
View File

@@ -0,0 +1,13 @@
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: medicalalert-web-hpa
namespace: medicalalert-web
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: medicalalert-web
minReplicas: 3
maxReplicas: 6
targetCPUUtilizationPercentage: 70

17
build/qa/configmap.yaml Normal file
View File

@@ -0,0 +1,17 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: medicalalert-web-cm
namespace: medicalalert-web
labels:
app: medicalalert-web
data:
DB_HOST: qa-medicalalert-ecommerce.c5om7w6xopq1.us-east-1.rds.amazonaws.com
ENV: qa
WP_DEBUG: "false"
DB_CHARSET: utf8
DB_COLLATE: utf8_general_ci
CACHE_HOST: master.redis-cache-all-be-caresage.cqsmse.use1.cache.amazonaws.com
CACHE_PORT: "6379"
DB_NAME: "www"
DB_USER: "pantheon"

113
build/qa/deployment.tpl Normal file
View File

@@ -0,0 +1,113 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "11"
labels:
app: medicalalert-web
name: medicalalert-web
namespace: medicalalert-web
spec:
progressDeadlineSeconds: 600
replicas: 3
revisionHistoryLimit: 10
selector:
matchLabels:
app: medicalalert-web
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
annotations:
kubectl.kubernetes.io/restartedAt: "2023-06-08T17:04:19-04:00"
creationTimestamp: null
labels:
app: medicalalert-web
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
containers:
- env:
- name: ENVIRONMENT
value: "$ENV"
image: 716593996126.dkr.ecr.us-east-1.amazonaws.com/medicalalert-web:$VERSION
envFrom:
- secretRef:
name: medicalalert-web-secrets
- configMapRef:
name: medicalalert-web-cm
imagePullPolicy: Always
name: medicalalert-web
ports:
- containerPort: 80
name: http
protocol: TCP
startupProbe:
exec:
command:
- /root/redinessprobe-wp.sh
initialDelaySeconds: 90
periodSeconds: 10
timeoutSeconds: 10
failureThreshold: 5
successThreshold: 1
readinessProbe:
exec:
command:
- /bin/sh
- -c
- "wget -qO- 127.0.0.1/status |grep start && echo redinessprobe-success || exit 9"
initialDelaySeconds: 30
periodSeconds: 5
successThreshold: 1
failureThreshold: 5
timeoutSeconds: 10
livenessProbe:
tcpSocket:
port: 80
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 10
resources:
limits:
cpu: 500m
memory: 1024Mi
requests:
cpu: 300m
memory: 700Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /usr/share/nginx/subdomain/www/wp-content/uploads
name: persistent-storage
- mountPath: /etc/nginx/conf.d/
name: default-conf
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: regcred
nodeSelector:
kubernetes.io/os: linux
restartPolicy: Always
schedulerName: default-scheduler
terminationGracePeriodSeconds: 30
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: efs-claim-medicalalert
- name: default-conf
configMap:
defaultMode: 420
name: medicalalert-web-default-conf-cm

45
build/qa/pod.tpl Normal file
View File

@@ -0,0 +1,45 @@
apiVersion: v1
kind: Pod
metadata:
name: common-job-pod
namespace: medicalalert-web
labels:
app: medicalalert-web
rds: enable
pod: common
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
containers:
- name: common-job
image: wyveo/nginx-php-fpm:php74
envFrom:
- secretRef:
name: medicalalert-web-secrets
- configMapRef:
name: medicalalert-web-cm
command: ["bash"]
args:
- -c
- sleep infinity
volumeMounts:
- mountPath: /usr/share/nginx/subdomain/www/wp-content/uploads
name: persistent-storage
imagePullSecrets:
- name: regcred
nodeSelector:
kubernetes.io/os: linux
restartPolicy: Never
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: efs-claim-medicalalert

12
build/qa/pvc.yml Normal file
View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: efs-claim-medicalalert
namespace: medicalalert-web
spec:
accessModes:
- ReadWriteMany
storageClassName: efs-sc-qa-ecommerce
resources:
requests:
storage: 5Gi

13
build/qa/secrets.yaml Normal file
View File

@@ -0,0 +1,13 @@
apiVersion: v1
data:
CACHE_PASSWORD: UU1FRVQ0ZG15VlE4OXZKWUFSUjdQQXhoUU1FRVQ0ZG15VlE4OXZKWUFSUjdQQXho
DB_PASSWORD: NUtJTklPbFNSdmRYZEVVNWZDd29JTGxleUJoSHNLVnU=
TOKEN: QVRDVFQzeEZmR04wWC1yOWcyb090X3c2WGY0bUdkQl94QlZ5Ymd2RWozU09aR055bEJtLXZzTkxDcHhRZE5IZTV0WTh4ZHc5MW9reDlZSlI3WlhGMk56SmFZaXpzSlBBWmFEMG5Hakp3RG92YkJZWTVaTzJRRC0wNEN3c0cxV3FZeWM2UzRkMHA2RWpOY0plOTZmLWVfalgwM3FDZlA0NEtkQkFCeGtzQTZQTEdWdGFidGMwSjdFPUZBMjdBRjgx
kind: Secret
metadata:
annotations:
labels:
app: medicalalert-web
name: medicalalert-web-secrets
namespace: medicalalert-web
type: Opaque

16
build/qa/service.yml Normal file
View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: medicalalert-web
namespace: medicalalert-web
labels:
app: medicalalert-web
spec:
type: NodePort
selector:
app: medicalalert-web
ports:
- protocol: TCP
port: 80
targetPort: 80
nodePort: 30846

View File

@@ -0,0 +1,293 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: medicalalert-web-default-conf-cm
namespace: medicalalert-web
labels:
app: medicalalert-web
data:
default.conf: |
# ---------------------
fastcgi_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=MYAPP:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
# -----------------------------------------
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort on;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_read_timeout 120;
#fastcgi_index index.php;
# --------------------------------
# Only cache positive responses
proxy_cache_valid 200 1h;
proxy_cache_valid 301 302 15m;
server {
listen 80 default; ## listen for ipv4; this line is default and implied
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name qa-medicalalert.com "";
return 301 https://www.$host$request_uri;
root /usr/share/nginx/subdomain/www;
index index.php index.html index.htm;
}
subdomain.conf: |
server {
listen 80;
listen [::]:80;
server_name ~^(?<subdomain>.+)\.qa-medicalalert\.com$;
if ($http_x_forwarded_proto != 'https') {
return 301 https://$host$request_uri;
}
root /usr/share/nginx/subdomain/$subdomain;
index index.php index.html index.htm;
sendfile off;
# Security - Hide nginx version number in error pages and Server header
server_tokens off;
# Add stdout logging
error_log /dev/stdout error;
access_log /dev/stdout;
# reduce the data that needs to be sent over network
gzip on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml application/json text/javascript application/x-javascript application/xml;
gzip_disable "MSIE [1-6]\.";
add_header 'Content-Security-Policy' 'upgrade-insecure-requests';
add_header X-Cache-Status $upstream_cache_status;
add_header Cache-Control "public";
#Cache everything by default
set $no_cache 0;
#Don't cache POST requests
if ($request_method = POST)
{
set $no_cache 1;
}
#Don't cache if the URL contains a query string
if ($query_string != "")
{
set $no_cache 1;
}
#Don't cache the following URLs
if ($request_uri ~* "/(administrator/|wp-login.php)")
{
set $no_cache 1;
}
#Don't cache if there is a cookie called PHPSESSID
if ($http_cookie = "PHPSESSID")
{
set $no_cache 1;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.php
try_files $uri $uri/ /index.php?$args;
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_param SUBDOMAIN $subdomain; # $_SERVER["SUBDOMAIN"]
include fastcgi_params;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/subdomain/$subdomain;
}
# pass the PHP scripts to FastCGI server listening on socket
#
#~ \.php$
location ~ [^/]\.php(/|$) {
proxy_set_header X-Forwarded-Proto $scheme;
try_files $uri $uri/ /index.php?$args;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SUBDOMAIN $subdomain; # $_SERVER["SUBDOMAIN"]
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
proxy_cache_background_update on;
proxy_cache_lock on;
}
# deny access to . files, for security
#
location ~ /\. {
log_not_found off;
deny all;
}
}
localhost.conf: |
server {
listen 80;
listen [::]:80;
server_name localhost 127.0.0.1;
root /usr/share/nginx/subdomain/www;
index index.php index.html index.htm;
sendfile off;
server_tokens off;
error_log /dev/stdout error;
access_log /dev/stdout;
# reduce the data that needs to be sent over network
gzip on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml application/json text/javascript application/x-javascript application/xml;
gzip_disable "MSIE [1-6]\.";
add_header 'Content-Security-Policy' 'upgrade-insecure-requests';
add_header X-Cache-Status $upstream_cache_status;
add_header Cache-Control "public";
#Cache everything by default
set $no_cache 0;
#Don't cache POST requests
if ($request_method = POST)
{
set $no_cache 1;
}
#Don't cache if the URL contains a query string
if ($query_string != "")
{
set $no_cache 1;
}
#Don't cache the following URLs
if ($request_uri ~* "/(administrator/|wp-login.php)")
{
set $no_cache 1;
}
#Don't cache if there is a cookie called PHPSESSID
if ($http_cookie = "PHPSESSID")
{
set $no_cache 1;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.php
try_files $uri $uri/ /index.php?$args;
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_param SUBDOMAIN www; # $_SERVER["SUBDOMAIN"]
include fastcgi_params;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/subdomain/www;
}
# pass the PHP scripts to FastCGI server listening on socket
#
#~ \.php$
location ~ [^/]\.php(/|$) {
proxy_set_header X-Forwarded-Proto $scheme;
try_files $uri $uri/ /index.php?$args;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SUBDOMAIN www; # $_SERVER["SUBDOMAIN"]
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
proxy_cache_background_update on;
proxy_cache_lock on;
}
# deny access to . files, for security
#
location ~ /\. {
log_not_found off;
deny all;
}
location ~ ^/(status|ping)$ {
access_log off;
allow 127.0.0.1;
deny all;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}

13
build/qa/web-hpa.yml Normal file
View File

@@ -0,0 +1,13 @@
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: medicalalert-web-hpa
namespace: medicalalert-web
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: medicalalert-web
minReplicas: 3
maxReplicas: 6
targetCPUUtilizationPercentage: 70

17
build/stage/1 Normal file
View File

@@ -0,0 +1,17 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: medicalalert-web-cm
namespace: medicalalert-web
labels:
app: medicalalert-web
data:
DB_HOST: stage-medicalalert-ecommerce.c5om7w6xopq1.us-east-1.rds.amazonaws.com
ENV: stage
WP_DEBUG: "false"
DB_CHARSET: utf8
DB_COLLATE: utf8_general_ci
CACHE_HOST: master.redis-cache-all-be-caresage.cqsmse.use1.cache.amazonaws.com
CACHE_PORT: "6379"
DB_NAME: "www"
DB_USER: "pantheon"

View File

@@ -0,0 +1,17 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: medicalalert-web-cm
namespace: medicalalert-web
labels:
app: medicalalert-web
data:
DB_HOST: stage-medicalalert-ecommerce.c5om7w6xopq1.us-east-1.rds.amazonaws.com
ENV: stage
WP_DEBUG: "false"
DB_CHARSET: utf8
DB_COLLATE: utf8_general_ci
CACHE_HOST: master.redis-cache-all-be-caresage.cqsmse.use1.cache.amazonaws.com
CACHE_PORT: "6379"
DB_NAME: "www"
DB_USER: "pantheon"

113
build/stage/deployment.tpl Normal file
View File

@@ -0,0 +1,113 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "11"
labels:
app: medicalalert-web
name: medicalalert-web
namespace: medicalalert-web
spec:
progressDeadlineSeconds: 600
replicas: 3
revisionHistoryLimit: 10
selector:
matchLabels:
app: medicalalert-web
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
annotations:
kubectl.kubernetes.io/restartedAt: "2023-06-08T17:04:19-04:00"
creationTimestamp: null
labels:
app: medicalalert-web
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
containers:
- env:
- name: ENVIRONMENT
value: "$ENV"
image: 716593996126.dkr.ecr.us-east-1.amazonaws.com/medicalalert-web:$VERSION
envFrom:
- secretRef:
name: medicalalert-web-secrets
- configMapRef:
name: medicalalert-web-cm
imagePullPolicy: Always
name: medicalalert-web
ports:
- containerPort: 80
name: http
protocol: TCP
startupProbe:
exec:
command:
- /root/redinessprobe-wp.sh
initialDelaySeconds: 90
periodSeconds: 10
timeoutSeconds: 10
failureThreshold: 5
successThreshold: 1
readinessProbe:
exec:
command:
- /bin/sh
- -c
- "wget -qO- 127.0.0.1/status |grep start && echo redinessprobe-success || exit 9"
initialDelaySeconds: 30
periodSeconds: 5
successThreshold: 1
failureThreshold: 5
timeoutSeconds: 10
livenessProbe:
tcpSocket:
port: 80
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 10
resources:
limits:
cpu: 500m
memory: 1024Mi
requests:
cpu: 300m
memory: 700Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /usr/share/nginx/subdomain/www/wp-content/uploads
name: persistent-storage
- mountPath: /etc/nginx/conf.d/
name: default-conf
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: regcred
nodeSelector:
kubernetes.io/os: linux
restartPolicy: Always
schedulerName: default-scheduler
terminationGracePeriodSeconds: 30
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: efs-claim-medicalalert
- name: default-conf
configMap:
defaultMode: 420
name: medicalalert-web-default-conf-cm

44
build/stage/pod.tpl Normal file
View File

@@ -0,0 +1,44 @@
apiVersion: v1
kind: Pod
metadata:
name: common-job-pod
namespace: medicalalert-web
labels:
app: medicalalert-web
rds: enable
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
containers:
- name: common-job
image: wyveo/nginx-php-fpm:php74
envFrom:
- secretRef:
name: medicalalert-web-secrets
- configMapRef:
name: medicalalert-web-cm
command: ["bash"]
args:
- -c
- sleep infinity
volumeMounts:
- mountPath: /usr/share/nginx/subdomain/www/wp-content/uploads
name: persistent-storage
imagePullSecrets:
- name: regcred
nodeSelector:
kubernetes.io/os: linux
restartPolicy: Never
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: efs-claim-medicalalert

12
build/stage/pvc.yml Normal file
View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: efs-claim-medicalalert
namespace: medicalalert-web
spec:
accessModes:
- ReadWriteMany
storageClassName: efs-sc-stage-ecommerce
resources:
requests:
storage: 5Gi

13
build/stage/secrets.yaml Normal file
View File

@@ -0,0 +1,13 @@
apiVersion: v1
data:
CACHE_PASSWORD: UU1FRVQ0ZG15VlE4OXZKWUFSUjdQQXhoUU1FRVQ0ZG15VlE4OXZKWUFSUjdQQXho
DB_PASSWORD: NUtJTklPbFNSdmRYZEVVNWZDd29JTGxleUJoSHNLVnU=
TOKEN: QVRDVFQzeEZmR04wWC1yOWcyb090X3c2WGY0bUdkQl94QlZ5Ymd2RWozU09aR055bEJtLXZzTkxDcHhRZE5IZTV0WTh4ZHc5MW9reDlZSlI3WlhGMk56SmFZaXpzSlBBWmFEMG5Hakp3RG92YkJZWTVaTzJRRC0wNEN3c0cxV3FZeWM2UzRkMHA2RWpOY0plOTZmLWVfalgwM3FDZlA0NEtkQkFCeGtzQTZQTEdWdGFidGMwSjdFPUZBMjdBRjgx
kind: Secret
metadata:
annotations:
labels:
app: medicalalert-web
name: medicalalert-web-secrets
namespace: medicalalert-web
type: Opaque

16
build/stage/service.yml Normal file
View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: medicalalert-web
namespace: medicalalert-web
labels:
app: medicalalert-web
spec:
type: NodePort
selector:
app: medicalalert-web
ports:
- protocol: TCP
port: 80
targetPort: 80
nodePort: 30846

View File

@@ -0,0 +1,294 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: medicalalert-web-default-conf-cm
namespace: medicalalert-web
labels:
app: medicalalert-web
data:
default.conf: |
# ---------------------
fastcgi_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=MYAPP:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
# -----------------------------------------
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort on;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_read_timeout 120;
#fastcgi_index index.php;
# --------------------------------
# Only cache positive responses
proxy_cache_valid 200 1h;
proxy_cache_valid 301 302 15m;
server {
listen 80 default; ## listen for ipv4; this line is default and implied
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name stage-medicalalert.com "";
return 301 https://www.$host$request_uri;
root /usr/share/nginx/subdomain/www;
index index.php index.html index.htm;
}
subdomain.conf: |
server {
listen 80;
listen [::]:80;
server_name ~^(?<subdomain>.+)\.stage-medicalalert\.com$;
if ($http_x_forwarded_proto != 'https') {
return 301 https://$host$request_uri;
}
root /usr/share/nginx/subdomain/$subdomain;
index index.php index.html index.htm;
sendfile off;
# Security - Hide nginx version number in error pages and Server header
server_tokens off;
# Add stdout logging
error_log /dev/stdout error;
access_log /dev/stdout;
# reduce the data that needs to be sent over network
gzip on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml application/json text/javascript application/x-javascript application/xml;
gzip_disable "MSIE [1-6]\.";
add_header 'Content-Security-Policy' 'upgrade-insecure-requests';
add_header X-Cache-Status $upstream_cache_status;
add_header Cache-Control "public";
#Cache everything by default
set $no_cache 0;
#Don't cache POST requests
if ($request_method = POST)
{
set $no_cache 1;
}
#Don't cache if the URL contains a query string
if ($query_string != "")
{
set $no_cache 1;
}
#Don't cache the following URLs
if ($request_uri ~* "/(administrator/|wp-login.php)")
{
set $no_cache 1;
}
#Don't cache if there is a cookie called PHPSESSID
if ($http_cookie = "PHPSESSID")
{
set $no_cache 1;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.php
try_files $uri $uri/ /index.php?$args;
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_param SUBDOMAIN $subdomain; # $_SERVER["SUBDOMAIN"]
include fastcgi_params;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/subdomain/$subdomain;
}
# pass the PHP scripts to FastCGI server listening on socket
#
#~ \.php$
location ~ [^/]\.php(/|$) {
proxy_set_header X-Forwarded-Proto $scheme;
try_files $uri $uri/ /index.php?$args;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SUBDOMAIN $subdomain; # $_SERVER["SUBDOMAIN"]
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
proxy_cache_background_update on;
proxy_cache_lock on;
}
# deny access to . files, for security
#
location ~ /\. {
log_not_found off;
deny all;
}
}
localhost.conf: |
server {
listen 80;
listen [::]:80;
server_name localhost;
root /usr/share/nginx/subdomain/www;
index index.php index.html index.htm;
sendfile off;
server_tokens off;
error_log /dev/stdout error;
access_log /dev/stdout;
# reduce the data that needs to be sent over network
gzip on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml application/json text/javascript application/x-javascript application/xml;
gzip_disable "MSIE [1-6]\.";
add_header 'Content-Security-Policy' 'upgrade-insecure-requests';
add_header X-Cache-Status $upstream_cache_status;
add_header Cache-Control "public";
#Cache everything by default
set $no_cache 0;
#Don't cache POST requests
if ($request_method = POST)
{
set $no_cache 1;
}
#Don't cache if the URL contains a query string
if ($query_string != "")
{
set $no_cache 1;
}
#Don't cache the following URLs
if ($request_uri ~* "/(administrator/|wp-login.php)")
{
set $no_cache 1;
}
#Don't cache if there is a cookie called PHPSESSID
if ($http_cookie = "PHPSESSID")
{
set $no_cache 1;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.php
try_files $uri $uri/ /index.php?$args;
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_param SUBDOMAIN www; # $_SERVER["SUBDOMAIN"]
include fastcgi_params;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/subdomain/www;
}
# pass the PHP scripts to FastCGI server listening on socket
#
#~ \.php$
location ~ [^/]\.php(/|$) {
proxy_set_header X-Forwarded-Proto $scheme;
try_files $uri $uri/ /index.php?$args;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SUBDOMAIN www; # $_SERVER["SUBDOMAIN"]
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
proxy_cache_background_update on;
proxy_cache_lock on;
}
# deny access to . files, for security
#
location ~ /\. {
log_not_found off;
deny all;
}
location ~ ^/(status|ping)$ {
access_log off;
allow 127.0.0.1;
deny all;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}

13
build/stage/web-hpa.yml Normal file
View File

@@ -0,0 +1,13 @@
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: medicalalert-web-hpa
namespace: medicalalert-web
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: medicalalert-web
minReplicas: 3
maxReplicas: 6
targetCPUUtilizationPercentage: 70

262
common-jobs-bitbucket.sh Normal file
View File

@@ -0,0 +1,262 @@
#!/bin/bash
exec > >(tee -a script.log) 2>&1
# Install the required packages #
# --------------------------------------------------------------
apk upgrade && apk add curl wget zip unzip
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x ./kubectl && mv ./kubectl /usr/local/bin/kubectl
. ./setenv.sh
# ----------------------------------------------------------------------
export NEW_URL=https://$URL_DOMAIN
export CLUSTER=caresage-eks-cluster-$ENV
if [[ "$ENV" = "prod" ]] ; then
export APP=`echo $URL_DOMAIN | awk -F[.-] '{print $2}'`
else
export APP=`echo $URL_DOMAIN | awk -F[.-] '{print $3}'`
fi
export NAMESPACE=$APP-web
export REPO=$BITBUCKET_REPO_SLUG
export REPLACE=`echo $NEW_URL | awk -F[./] '{print $4"."$5}'`
export MAIN_DOMAIN=`echo $NEW_URL | awk -F[./] '{print $4"."$5}'`
export URL_DOMAIN=$URL_DOMAIN
# ---------------------------
echo "export NEW_URL=https://$URL_DOMAIN" >> setenv.sh
if [[ "$ENV" = "prod" ]] ; then
echo "export APP=`echo $URL_DOMAIN | awk -F[.-] '{print $2}'`" >> setenv.sh
else
echo "export APP=`echo $URL_DOMAIN | awk -F[.-] '{print $3}'`" >> setenv.sh
fi
echo "export NAMESPACE=$APP-web" >> setenv.sh
echo "export REPO=$BITBUCKET_REPO_SLUG" >> setenv.sh
echo "export REPLACE=`echo $NEW_URL | awk -F[./] '{print $4"."$5}'`" >> setenv.sh
echo "export MAIN_DOMAIN=`echo $NEW_URL | awk -F[./] '{print $4"."$5}'`" >> setenv.sh
echo "export URL_DOMAIN=$URL_DOMAIN" >> setenv.sh
echo "export TOKEN=$TOKEN" >> setenv.sh
# ---------------------------------------------------------------
echo "JOBNAME -- $JOBNAME"
echo "ENV -- $ENV"
echo "CLUSTER -- $CLUSTER"
echo "VERSION -- $BITBUCKET_BUILD_NUMBER"
echo "RESTORE_VERSION -- $RESTORE_VERSION"
echo "URL_DOMAIN -- $URL_DOMAIN"
echo "SUBDOMAIN -- $SUBDOMAIN"
echo "VERSION -- $VERSION"
echo "RESTORE_VERSION -- $RESTORE_VERSION"
echo "DB_NAME -- $DB_NAME"
echo "MYSQL_FILE_NAME -- $MYSQL_FILE_NAME"
echo "STATIC_FILE_NAME -- $STATIC_FILE_NAME"
cat ./setenv.sh
# -------------------------------------------------------------------------------------------------------------------------
opt=$1
deploy_version=$2
# Check if it is already running #
# -------------------------------------
aws eks update-kubeconfig --name caresage-eks-cluster-$ENV --region us-east-1
echo "common-job-pod will be deleted if already there and thus make sure you run single common job for a given repo"
echo ""
if ( kubectl get po -A | grep common-job-pod ) && [[ "$SUBDOMAIN" = "www" ]] ; then
echo "common-job-pod-running and maindomain is $URL_DOMAIN and common-job-pod will not be deleted"
else
kubectl get po -A | grep common-job-pod && kubectl delete po common-job-pod -n $NAMESPACE || echo "----common-job-pod-t0-be-created"
fi
# validation checks #
#----------------------------------
#validation () { chmod 755 ./validation.sh && ./validation.sh; } && validation
case $opt in
wp-auto-patch)
# The auto patch to be executed for dev01 to be specific
# ----------------------------------------------------------
if [[ "$SUBDOMAIN" != "dev01" ]] ; then echo VALIDATION-NOPASS-AUTO-PATCH-IS-FOR-DEV01 && exit 9 ; else echo VALIDATION-PASS-AUTO-PATCH-IS-FOR-DEV01;fi
aws eks update-kubeconfig --name caresage-eks-cluster-$ENV --region us-east-1
kubectl apply -f build/$ENV/pod.tpl && kubectl apply -f build/$ENV/pvc.yml && sleep 15
kubectl cp setenv.sh $NAMESPACE/common-job-pod:/tmp/setenv.sh
kubectl exec common-job-pod -n $NAMESPACE -- sh -c 'chmod 755 /tmp/setenv.sh'
kubectl exec common-job-pod -n $NAMESPACE -- apt update
kubectl exec common-job-pod -n $NAMESPACE -- apt install wget zip unzip curl git rsync -y
# ---------------------------------------------------------------------------------------------------------------------------------------------------------
kubectl exec common-job-pod -n $NAMESPACE -- sh -c '. /tmp/setenv.sh;
cd /tmp;
git clone --branch="develop" https://x-token-auth:$TOKEN@bitbucket.org/connectamerica/$REPO.git;
cd $REPO/;
git config user.email "{botid}@bots.bitbucket.org" ;
git checkout -b feature/$VERSION-$ENV-$SUBDOMAIN && git push --set-upstream origin feature/$VERSION-$ENV-$SUBDOMAIN;
rsync -a --exclude 'wp-content/uploads' /usr/share/nginx/subdomain/$SUBDOMAIN/ wp;
git add --all && git commit -m "auto-patch $VERSION-$ENV-$SUBDOMAIN-$(date +%Y-%m-%dT%H_%M_%S)" && git push'
#--------------------------------------------------------------------------------------------------------------
kubectl delete po common-job-pod -n $NAMESPACE
cat script.log | egrep -v "SQL|rewrite|Rewrite|warning|Warning|create mode" | egrep -i "not in gzip format|fail|fatal|exception|terminated|command not found|error|unexpected|cannot access|No such file" && exit 9 || echo VALIDATION_PASS_$opt
;;
subdomain_deploy)
echo "Deploy the wordpress source code from the branch to pvc mount of subdomain..."
aws eks update-kubeconfig --name caresage-eks-cluster-$ENV --region us-east-1
echo "common-job-pod will be deleted if already there and thus make sure you run single common job for a given repo"
echo ""
kubectl get po -A | grep common-job-pod && kubectl delete po common-job-pod -n $NAMESPACE || echo ----common-job-pod-t0-be-created
kubectl apply -f build/$ENV/pod.tpl && kubectl apply -f build/$ENV/pvc.yml && sleep 15 && echo pod-created
kubectl cp wp $NAMESPACE/common-job-pod:/tmp && echo "wp copy to /tmp done" || exit 9
kubectl cp setenv.sh $NAMESPACE/common-job-pod:/tmp/setenv.sh && echo "setenv copy done" || exit 9
kubectl exec common-job-pod -n $NAMESPACE -- sh -c 'chmod 755 /tmp/setenv.sh'
kubectl exec common-job-pod -n $NAMESPACE -- sh -c '. /tmp/setenv.sh ; cp -rf /tmp/wp/* /usr/share/nginx/subdomain/$SUBDOMAIN/'
echo $SUBDOMAIN | grep www && echo "maindomain $URL_DOMAIN" || kubectl delete po common-job-pod -n $NAMESPACE
cat script.log | egrep -v "SQL|rewrite|Rewrite|warning|Warning|create mode" | egrep -i "not in gzip format|fail|fatal|exception|terminated|command not found|error|unexpected|cannot access|No such file" && exit 9 || echo VALIDATION_PASS_$opt
;;
mysql-backup)
echo "Running mysql backup with s3..."
aws eks update-kubeconfig --name caresage-eks-cluster-$ENV --region us-east-1
kubectl apply -f build/$ENV/pod.tpl && kubectl apply -f build/$ENV/pvc.yml && sleep 15
kubectl cp setenv.sh $NAMESPACE/common-job-pod:/tmp/setenv.sh
kubectl exec common-job-pod -n $NAMESPACE -- sh -c 'chmod 755 /tmp/setenv.sh'
kubectl exec common-job-pod -n $NAMESPACE -- apt update
kubectl exec common-job-pod -n $NAMESPACE -- apt install zip wget unzip curl mariadb-client -y
kubectl exec common-job-pod -n $NAMESPACE -- sh -c '. /tmp/setenv.sh ;mysqldump -h $DB_HOST --single-transaction --quick --lock-tables=false --user=$DB_USER --password=$DB_PASSWORD $SUBDOMAIN --skip-lock-tables | gzip > /tmp/$NAMESPACE-pantheon.sql.gz'
kubectl cp $NAMESPACE/common-job-pod:/tmp/$NAMESPACE-pantheon.sql.gz $NAMESPACE-pantheon-$VERSION-$ENV-$SUBDOMAIN-$(date +%Y-%m-%dT%H_%M_%S).sql.gz
FILE=`ls $NAMESPACE-pantheon-*.sql.gz`
aws s3 cp $FILE s3://commonjobs/$NAMESPACE/$opt/
curl --request POST -F files=@"$FILE" --url "https://api.bitbucket.org/2.0/repositories/connectamerica/$REPO/downloads" \
--header "Authorization: Bearer $TOKEN"
kubectl delete po common-job-pod -n $NAMESPACE
cat script.log | egrep -v "SQL|rewrite|Rewrite|warning|Warning|create mode" | egrep -i "not in gzip format|fail|fatal|exception|terminated|command not found|error|unexpected|cannot access|No such file" && exit 9 || echo VALIDATION_PASS_$opt
;;
wp-data-backup)
aws eks update-kubeconfig --name caresage-eks-cluster-$ENV --region us-east-1
kubectl apply -f build/$ENV/pod.tpl && kubectl apply -f build/$ENV/pvc.yml && sleep 15
kubectl cp setenv.sh $NAMESPACE/common-job-pod:/tmp/setenv.sh
kubectl exec common-job-pod -n $NAMESPACE -- sh -c 'chmod 755 /tmp/setenv.sh'
kubectl exec common-job-pod -n $NAMESPACE -- apt update
kubectl exec common-job-pod -n $NAMESPACE -- apt install wget zip unzip curl -y
kubectl exec common-job-pod -n $NAMESPACE -- sh -c '. /tmp/setenv.sh;cd /usr/share/nginx/subdomain/$SUBDOMAIN/wp-content/uploads;zip -r /tmp/upload.zip .'
kubectl cp $NAMESPACE/common-job-pod:/tmp/upload.zip $NAMESPACE-$VERSION-$ENV-$SUBDOMAIN-$(date +%Y-%m-%dT%H_%M_%S).zip
FILE=`ls $NAMESPACE-*.zip`
aws s3 cp $FILE s3://commonjobs/$NAMESPACE/$opt/
kubectl delete po common-job-pod -n $NAMESPACE
cat script.log | egrep -v "SQL|rewrite|Rewrite|warning|Warning|create mode" | egrep -i "not in gzip format|fail|fatal|exception|terminated|command not found|error|unexpected|cannot access|No such file" && exit 9 || echo VALIDATION_PASS_$opt
;;
mysql-restore)
aws eks update-kubeconfig --name caresage-eks-cluster-$ENV --region us-east-1
kubectl apply -f build/$ENV/pod.tpl && kubectl apply -f build/$ENV/pvc.yml && sleep 15
kubectl cp setenv.sh $NAMESPACE/common-job-pod:/tmp/setenv.sh
kubectl exec common-job-pod -n $NAMESPACE -- sh -c 'chmod 755 /tmp/setenv.sh'
[ -n "$RESTORE_VERSION" ] && FILE=$RESTORE_VERSION || FILE=$deploy_version
kubectl exec common-job-pod -n $NAMESPACE -- apt update
kubectl exec common-job-pod -n $NAMESPACE -- apt install zip wget unzip curl mariadb-client -y
#Check if file is present in bitbucket download else check on s3
# -------------------------------------------------------------------
curl -s -L -O -H "Authorization: Bearer $TOKEN" https://api.bitbucket.org/2.0/repositories/connectamerica/$REPO/downloads/$FILE && echo file_downloaded || aws s3 cp s3://commonjobs/$NAMESPACE/mysql-backup/$FILE $FILE
kubectl cp $FILE $NAMESPACE/common-job-pod:/tmp/$FILE
#Create schema if not present #
# -------------------------------
kubectl exec common-job-pod -n $NAMESPACE -- sh -c '. /tmp/setenv.sh; mysql -h $DB_HOST --user=$DB_USER --password=$DB_PASSWORD -e "create schema IF NOT EXISTS $SUBDOMAIN"'
kubectl exec common-job-pod -n $NAMESPACE -- sh -c '. /tmp/setenv.sh; export FILE=`ls /tmp/*.sql.gz` ; gunzip -c $FILE | mysql -h $DB_HOST --user=$DB_USER --password=$DB_PASSWORD $SUBDOMAIN'
kubectl exec common-job-pod -n $NAMESPACE -- sh -c 'wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar ; chmod u+x wp-cli.phar;mv wp-cli.phar /usr/local/bin/wp; php /usr/local/bin/wp --info'
# ----------------------------------------------------------------------------------------------------------------------------------------------------
kubectl exec common-job-pod -n $NAMESPACE -- sh -c '. /tmp/setenv.sh; OLD_URL=`wp option get siteurl --allow-root --path=/usr/share/nginx/subdomain/$SUBDOMAIN`; echo "export OLD_URL=$OLD_URL" >> /tmp/setenv.sh; echo "export FIND=$(echo $OLD_URL|cut -d. -f2,3)" >> /tmp/setenv.sh; echo "export OLD_MAIN_DOMAIN=$(echo $OLD_URL|cut -d. -f2,3)" >> /tmp/setenv.sh; echo "export OLD_URL_DOMAIN=$(echo $OLD_URL| cut -d/ -f3)" >> /tmp/setenv.sh; echo "export OLD_SUBDOMAIN=$(echo $OLD_URL| cut -d/ -f3|cut -d. -f1)" >> /tmp/setenv.sh'
# -----------------------------------------------------------------------------------------
kubectl cp $NAMESPACE/common-job-pod:/tmp/setenv.sh setenv.sh && . ./setenv.sh
# -----------------------------------------------------------------------------------------
if [[ "$OLD_SUBDOMAIN" = "www" ]] && [[ "$SUBDOMAIN" = "www" ]]; then
kubectl exec common-job-pod -n $NAMESPACE -- sh -c 'cat /tmp/setenv.sh ; . /tmp/setenv.sh; wp search-replace --allow-root --path=/usr/share/nginx/subdomain/$SUBDOMAIN "$OLD_URL_DOMAIN" "$URL_DOMAIN" --all-tables'
kubectl exec common-job-pod -n $NAMESPACE -- sh -c 'cat /tmp/setenv.sh ; . /tmp/setenv.sh; wp search-replace --allow-root --path=/usr/share/nginx/subdomain/$SUBDOMAIN ".$OLD_MAIN_DOMAIN" ".$MAIN_DOMAIN" --all-tables'
elif [[ "$OLD_SUBDOMAIN" = "www" ]] && [[ "$SUBDOMAIN" != "www" ]]; then
kubectl exec common-job-pod -n $NAMESPACE -- sh -c 'cat /tmp/setenv.sh ; . /tmp/setenv.sh; wp search-replace --allow-root --path=/usr/share/nginx/subdomain/$SUBDOMAIN "$OLD_URL_DOMAIN" "$URL_DOMAIN" --all-tables'
kubectl exec common-job-pod -n $NAMESPACE -- sh -c 'cat /tmp/setenv.sh ; . /tmp/setenv.sh; wp search-replace --allow-root --path=/usr/share/nginx/subdomain/$SUBDOMAIN ".$OLD_MAIN_DOMAIN" ".$URL_DOMAIN" --all-tables'
elif [[ "$OLD_SUBDOMAIN" != "www" ]] && [[ "$SUBDOMAIN" = "www" ]]; then
kubectl exec common-job-pod -n $NAMESPACE -- sh -c 'cat /tmp/setenv.sh ; . /tmp/setenv.sh; wp search-replace --allow-root --path=/usr/share/nginx/subdomain/$SUBDOMAIN ".$OLD_URL_DOMAIN" ".$MAIN_DOMAIN" --all-tables'
kubectl exec common-job-pod -n $NAMESPACE -- sh -c 'cat /tmp/setenv.sh ; . /tmp/setenv.sh; wp search-replace --allow-root --path=/usr/share/nginx/subdomain/$SUBDOMAIN "$OLD_URL_DOMAIN" "$URL_DOMAIN" --all-tables'
elif [[ "$OLD_SUBDOMAIN" != "www" ]] && [[ "$SUBDOMAIN" != "www" ]]; then
kubectl exec common-job-pod -n $NAMESPACE -- sh -c 'cat /tmp/setenv.sh ; . /tmp/setenv.sh; wp search-replace --allow-root --path=/usr/share/nginx/subdomain/$SUBDOMAIN "$OLD_URL_DOMAIN" "$URL_DOMAIN" --all-tables'
else
echo "======== fix the issues ============="
fi
# ----------------------------------------------------------------------------------------------------------------------------------------
kubectl exec common-job-pod -n $NAMESPACE -- sh -c '. /tmp/setenv.sh; wp search-replace --allow-root --path=/usr/share/nginx/subdomain/$SUBDOMAIN "http://$URL_DOMAIN" "$NEW_URL" --all-tables'
kubectl delete po common-job-pod -n $NAMESPACE
cat script.log | egrep -v "SQL|rewrite|Rewrite|warning|Warning|create mode" | egrep -i "not in gzip format|fail|fatal|exception|terminated|command not found|error|unexpected|cannot access|No such file" && exit 9 || echo VALIDATION_PASS_$opt
;;
wp-data-restore)
aws eks update-kubeconfig --name caresage-eks-cluster-$ENV --region us-east-1
kubectl apply -f build/$ENV/pod.tpl && kubectl apply -f build/$ENV/pvc.yml && sleep 15
kubectl get po common-job-pod -n $NAMESPACE | grep -i pending && exit 9 || echo ----common-pod-NOT-in-pending-state --
kubectl cp setenv.sh $NAMESPACE/common-job-pod:/tmp/setenv.sh
kubectl exec common-job-pod -n $NAMESPACE -- sh -c 'chmod 755 /tmp/setenv.sh'
[ -n "$RESTORE_VERSION" ] && FILE=$RESTORE_VERSION || FILE=$deploy_version
kubectl exec common-job-pod -n $NAMESPACE -- apt update
kubectl exec common-job-pod -n $NAMESPACE -- apt install wget zip unzip curl -y
aws s3 cp s3://commonjobs/$NAMESPACE/wp-data-backup/$FILE $FILE
kubectl cp $FILE $NAMESPACE/common-job-pod:/tmp/$FILE
kubectl exec common-job-pod -n $NAMESPACE -- sh -c '. /tmp/setenv.sh; mkdir -p /usr/share/nginx/subdomain/$SUBDOMAIN/wp-content/uploads'
kubectl exec common-job-pod -n $NAMESPACE -- sh -c '. /tmp/setenv.sh;export FILE=`ls /tmp/*.zip`;unzip -o $FILE -d /usr/share/nginx/subdomain/$SUBDOMAIN/wp-content/uploads'
kubectl delete po common-job-pod -n $NAMESPACE
cat script.log | egrep -v "SQL|rewrite|Rewrite|warning|Warning|create mode" | egrep -i "not in gzip format|fail|fatal|exception|terminated|command not found|error|unexpected|cannot access|No such file" && exit 9 || echo VALIDATION_PASS_$opt
;;
*)
echo "common job shell script utility taking variables from env"
echo "Usage: $0 {mysql-backup|wp-data-backup|mysql-restore|wp-data-restore}"
echo "mysql-backup : Run MySQL backup utility and upload"
echo "mysql-restore : Run MySQL backup utility and upload it to bitbucket."
echo "wp-data-backup : Run web server backup utility and uplaod."
echo "wp-data-restore : Run web server backup utility and uplaod to bitbucket." ;;
esac

68
common-jobs.sh Normal file
View File

@@ -0,0 +1,68 @@
#!/bin/bash
# Install the required packages #
# --------------------------------------------------------------
apt update && apt install curl unzip zip mariadb-client -y
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install
# -------------------------------------------------------------------------------------------------------------------------
opt=$1
case $opt in
mysql-backup)
echo "Running mysql backup with s3..."
export DATABASES=perchon
export MYSQL_USER=perchona
# execute the command now #
# --------------------------------------------------------------------------------------------------------------
mysqldump -h $DB_HOST --single-transaction --quick --lock-tables=false --user=pantheon --password=$DB_PASSWORD \
pantheon --skip-lock-tables | gzip > "/tmp/lifeline-web-pantheon-$(date +%Y-%m-%dT%H_%M_%S).sql.gz"
# ----------------------------------------------------------------------------------------------------------
# upload the same to s3 #
# -----------------------------------------
# aws s3 cp /tmp/lifeline-web-pantheon-*.sql.gz s3://caresage-dev-ws/mysqlbackups/
# aws s3 ls s3://caresage-dev-ws/mysqlbackups/
# upload to bitbucket #
# ---------------------------------------
FILE=`ls /tmp/lifeline-web-pantheon-*.sql.gz`
curl --request POST -F files=@"$FILE" --url 'https://api.bitbucket.org/2.0/repositories/connectamerica/lifeline-ecommerce/downloads' \
--header "Authorization: Bearer $TOKEN"
;;
mysql-backup-bitbucket)
echo "Running bmysql-backup-s3 with bitbucket ..."
export DATABASES=perchona
export MYSQL_USER=perchona
;;
wp-data-backup)
echo "Running wp-data-s3..."
cd /usr/share/nginx/html/wp-content/
zip -r lifeline-web-static-data-$(date +%Y-%m-%dT%H_%M_%S).zip ./uploads && FILE=`ls lifeline-web-static-data-*.zip`
curl --request POST -F files=@"$FILE" --url 'https://api.bitbucket.org/2.0/repositories/connectamerica/lifeline-ecommerce/downloads' \
--header "Authorization: Bearer $TOKEN"
#aws s3 mv lifeline-web-static-data-*.zip s3://caresage-dev-ws/staticbackups/
#aws s3 ls s3://caresage-dev-ws/staticbackups/
;;
wp-data-bitbucket)
echo "Running wp-data-bitbucket ..."
;;
*)
echo "common job shell script utility taking variables from env"
echo "Usage: $0 {mysql-backup|mysql-backup-bitbucket|wp-data-backup}"
echo " mysql-backup : Run MySQL backup utility and upload"
echo " mysql-backup-bitbucket : Run MySQL backup utility and upload it to bitbucket."
echo " wp-data-backup : Run web server backup utility and uplaod."
echo " wp-data-bitbucket : Run web server backup utility and uplaod to bitbucket." ;;
esac

5
envvars-phpfpm Normal file
View File

@@ -0,0 +1,5 @@
env["CACHE_PASSWORD"] = $CACHE_PASSWORD
env["CACHE_HOST"] = $CACHE_HOST
env["CACHE_PORT"] = $CACHE_PORT
env["DB_PASSWORD"] = $DB_PASSWORD
env["DB_HOST"] = $DB_HOST

50
jobs.tpl Normal file
View File

@@ -0,0 +1,50 @@
apiVersion: batch/v1
kind: Job
metadata:
name: common-jobs
namespace: lifeline-web
labels:
app: lifeline-web
rds: enable
spec:
ttlSecondsAfterFinished: 10
template:
metadata:
labels:
app: lifeline-web
rds: enable
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
containers:
- name: common-jobs
image: ubuntu:latest
envFrom:
- secretRef:
name: lifeline-web-secrets
- configMapRef:
name: lifeline-web-cm
command: ["bash"]
args:
- -c
- cp -rf /usr/share/nginx/subdomain/www/wp-content/uploads/common-jobs.sh /root/ && chmod 755 /root/common-jobs.sh && /root/common-jobs.sh $JOBNAME
volumeMounts:
- mountPath: /usr/share/nginx/subdomain/www/wp-content/uploads
name: persistent-storage
imagePullSecrets:
- name: regcred
nodeSelector:
kubernetes.io/os: linux
restartPolicy: Never
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: efs-claim-lifeline

View File

@@ -0,0 +1,49 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
generation: 1
labels:
role: db-ca
type: rds-mysql-ca
name: mysql-medicalalert
namespace: caresage-exec
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
role: db-ca
type: rds-mysql-ca
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
role: db-ca
type: rds-mysql-ca
spec:
containers:
- args:
- tcp-listen:3306,fork,reuseaddr
- tcp-connect:dev-medicalalert-ecommerce.c5om7w6xopq1.us-east-1.rds.amazonaws.com:3306
image: alpine/socat
imagePullPolicy: Always
name: mysql-100plus
ports:
- containerPort: 3306
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30

14
redinessprobe-wp.sh Normal file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
# -----------------------------------------------------------------------------------------------------
export WP_FILE="/usr/share/nginx/subdomain/www/wp-config.php"
sed -i '/^define.*NONCE_SALT.*/a define(\'\'WP_SITEURL\'', '\'http://localhost/\'');' $WP_FILE || exit 9
sed -i '/^define.*NONCE_SALT.*/a define(\'\'WP_HOME\'', '\'http://localhost/\'');' $WP_FILE || exit 9
wget -q --spider localhost && echo pass-localhost || exit 9
sleep 1
wget -q --spider localhost/wp-login.php && echo pass-wp-login.php|| exit 9
sed -i '/http\:\/\/localhost/d' $WP_FILE || exit 9
# ---------------------------------------------------

1
release Normal file
View File

@@ -0,0 +1 @@
RELEASE=release-1.00

25
setenv.sh Normal file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
case $ENV in
dev)
export CLUSTER=caresage-eks-cluster-$ENV
export URL_DOMAIN=$SUBDOMAIN.$ENV-medicalalert.com
;;
qa)
export CLUSTER=caresage-eks-cluster-$ENV
export URL_DOMAIN=$SUBDOMAIN.$ENV-medicalalert.com
;;
stage)
export CLUSTER=caresage-eks-cluster-$ENV
export URL_DOMAIN=$SUBDOMAIN.$ENV-medicalalert.com
;;
prod)
export CLUSTER=caresage-eks-cluster-$ENV
export URL_DOMAIN=$SUBDOMAIN.medicalalert.com
;;
*)
echo "source env varibales"
echo "Usage: $0 ENV"
;;
esac

83
validation.sh Normal file
View File

@@ -0,0 +1,83 @@
#!/bin/bash
export DIR=`pwd`
exec > >(tee -a $DIR/script.log) 2>&1
function install {
# kubectl
# ----------------
curl -fsSLO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/kubectl
# setenv
# -----------
. ./setenv.sh
# krew
# ---------
set -x; cd "$(mktemp -d)" &&
OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
KREW="krew-${OS}_${ARCH}" &&
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
tar zxvf "${KREW}.tar.gz" &&
./"${KREW}" install krew &&
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" >> ~/.bashrc && . ~/.bashrc
# kubeval
# -------------------
curl -fsSLO https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz
tar xf kubeval-linux-amd64.tar.gz &&
cp kubeval /usr/local/bin
# kube-score
# ---------------
kubectl krew install score
}
install
default () {
cd $DIR/build
find . -type f -exec kubeval '{}' \; | tee -a $DIR/script.log
find . -type f -exec kubectl score --output-format ci '{}' \; | tee -a $DIR/script.log
cat $DIR/script.log | egrep -v -i "script.log|warning|SQL|create mode|rewrite" | egrep -i "fail|fatal|exception|terminated|command not found|error|unexpected|cannot access|No such file|ERR" && exit 9 || echo VALIDATION_PASS_$opt
}
opt=$1
case $opt in
default)
default
;;
env)
env
;;
*)
echo "validation job shell script utility taking variables from env"
echo "Usage: $0 {default|env}"
esac
# -------------------------------------------------------------------------------------------------------------------------------------------
#cat $DIR/script.log | egrep -v -i "script.log|warning|SQL|create mode|rewrite" | egrep -i "fail|fatal|exception|terminated|command not found|error|unexpected|cannot access|No such file|ERR" && exit 9 || echo VALIDATION_PASS_$opt
# --------------------------------------------------------------------------------------------

70
wp-config.php Normal file
View File

@@ -0,0 +1,70 @@
<?php
define( 'WP_CACHE', false ); // Added by WP Rocket
/**
* This config file is yours to hack on. It will work out of the box on Pantheon
* but you may find there are a lot of neat tricks to be used here.
*
* See our documentation for more details:
*
* https://pantheon.io/docs
*/
/**
* This block will be executed if you are NOT running on Pantheon and have NO
* wp-config-local.php. Insert alternate config here if necessary.
*
* If you are only running on Pantheon, you can ignore this block.
*/
// ------------------------------------
define('DB_NAME', $_SERVER["DB_NAME"]);
define('DB_USER', $_SERVER["DB_USER"]);
// --------------------------------------------
define('DB_PASSWORD', $_SERVER["DB_PASSWORD"]);
define('DB_HOST', $_SERVER["DB_HOST"]);
define('CACHE_PASSWORD', $_SERVER["CACHE_PASSWORD"]);
define('CACHE_HOST', $_SERVER["CACHE_HOST"]);
define('CACHE_PORT', '6379');
// ---------------------------------------------------
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
define('AUTH_KEY', 'fad5cfeb464e3cb6d2a72bfe290d84e25478753824970a9455f5cb350a9f8183');
define('SECURE_AUTH_KEY', '4238b8016c46c6b746e9fba4106c771e2f4b688b9445ad64ba7efff9a8272c9d');
define('LOGGED_IN_KEY', '4238b8016c46c6b746e9fba4106c771e2f4b688b9445ad64ba7efff9a8272c9d');
define('NONCE_KEY', '4b6f1e1470301e5d979e8d333616eaf556b4d1e980ae5f959e06dd494bb0d995');
define('AUTH_SALT', 'bc345fc63882f49dbba21248add8beb61b8e68d20ce5d4623de03022a0666c1b');
define('SECURE_AUTH_SALT', '03e361ac295e49d27bd47e6229558724bdf16e3ed9705efd2822c643c20ffdc0');
define('LOGGED_IN_SALT', '90d8f33cc74663986e2bbe86b5d11539180ea434974ea2a1e17eca04f4b54abc');
define('NONCE_SALT', '6640b7f1a18031eaf01b6e7dc3f445b6f582ab9922674c286c2b527c9c579dea');
$table_prefix = 'wp_';
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* You may want to examine $_ENV['PANTHEON_ENVIRONMENT'] to set this to be
* "true" in dev, but false in test and live.
*/
if ( ! defined( 'WP_DEBUG' ) ) {
define('WP_DEBUG', false);
}
define( 'WPMS_ON', true );
define( 'WPMS_SMTP_PASS', 'C#9!Ev-kt$$j' );
define('FORCE_SSL_ADMIN', true);
$_SERVER['HTTPS']='on';
/* That's all, stop editing! Happy Pressing. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

11
wp/.htaccess Normal file
View File

@@ -0,0 +1,11 @@
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

14
wp/.lando.yml Normal file
View File

@@ -0,0 +1,14 @@
name: medicalalert
recipe: pantheon
proxy:
pma:
- pma.wordpress.lndo.site
config:
framework: wordpress
site: medicalalert
id: 5454b5d7-f7b8-4f64-bf8b-bcbcc77582ff
services:
pma:
type: phpmyadmin
host:
- database

1
wp/.user.ini Symbolic link
View File

@@ -0,0 +1 @@
../files/private/.user.ini

1
wp/403.html Normal file
View File

@@ -0,0 +1 @@
No Access !!

101
wp/Best10.php Normal file
View File

@@ -0,0 +1,101 @@
<?php
function postFiveNine()
{
$Campaign_ID = '7013s000000qQP1';
date_default_timezone_set('America/New_York');
$F9Date = date("Y-m-d")."-". date("H:i");
$F9domain = "connect america";
$FORM_ID = ($_POST['form_ID']);
if($FORM_ID == 'Best10') {
$F9list = "Web Form Submissions H";
} else {
$F9list = "";
}
$newphone = preg_replace('/^1|\D/', '', $_POST['phone']);
$cleanPOST = array(
'first_name' => ($_POST['first-name']),
'last_name' => ($_POST['last-name']),
'number1' => $newphone,
'F9domain' => $F9domain,
'F9list' => $F9list,
'salesforce_id' => $Campaign_ID,
'Device_6' => $title,
'WebDialer_Key' => $F9Date,
'F9key' => WebDialer_Key,
'F9CallASAP' => true
);
foreach ($cleanPOST as $key=>$value){
$cleanPOST[stripslashes($key)] = stripslashes($value);
}
$ch = curl_init();
// DEBUG - this should return a message to the user it failed
if (curl_error($ch) != "") {
echo "Error: $error\n";
}
curl_setopt($ch, CURLOPT_URL, "https://api.five9.com/web2campaign/AddToList");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cleanPOST));
curl_exec($ch);
curl_close($ch);
}
function postSalesforce()
{
$oid = "00D1I000000mJ0Q";
$member_status = "Web response";
$lead_source = "Web";
$FORM_ID = ($_POST['form_ID']);
if($FORM_ID == 'Best10') {
$Campaign_ID = "7013s000000qQP1";
} else {
$Campaign_ID = "";
}
$cleanPOST = array(
'first_name' => ($_POST['first-name']),
'last_name' => ($_POST['last-name']),
'phone' => ($_POST['phone']),
'email' => ($_POST['your-email']),
//'street' => ($_POST['street']),
//'city' => ($_POST['city']),
//'state' => ($_POST['state']),
'zip' => ($_POST['zip']),
'Campaign_ID' => $Campaign_ID,
'oid' => $oid,
'lead_source' => $lead_source,
'Custom_Field_1__c' => ($_POST['subid1']),
'Custom_Field_2__c' => ($_POST['subid2']),
'Custom_Field_3__c' => ($_POST['subid3']),
'Custom_Field_4__c' => ($_POST['subid4'])
);
foreach ($cleanPOST as $key=>$value){
$cleanPOST[stripslashes($key)] = stripslashes($value);
}
$ch = curl_init();
if (curl_error($ch) != "") {
exit( "Error: $error\n");
}
curl_setopt($ch, CURLOPT_URL, "https://webto.salesforce.com/servlet/servlet.WebToLead");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cleanPOST));
curl_exec($ch);
curl_close($ch);
}
postSalesforce();
//postFiveNine();

106
wp/LeadChimp.php Normal file
View File

@@ -0,0 +1,106 @@
<?php
/**
* Function postSalesforce
* Send the form data to Salesforce so that the lead is created
*/
function postFiveNine()
{
$Campaign_ID = '701130000026vNy';
date_default_timezone_set('America/New_York');
$F9Date = date("Y-m-d")."-". date("H:i");
$F9domain = "connect america";
$FORM_ID = ($_POST['form_ID']);
if($FORM_ID == 'LeadChimp') {
$F9list = "Web Form Submissions H";
} else {
$F9list = "";
}
$newphone = preg_replace('/^1|\D/', '', $_POST['phone']);
$cleanPOST = array(
'first_name' => ($_POST['first-name']),
'last_name' => ($_POST['last-name']),
'number1' => $newphone,
'F9domain' => $F9domain,
'F9list' => $F9list,
'salesforce_id' => $Campaign_ID,
'Device_6' => $title,
'WebDialer_Key' => $F9Date,
'F9key' => WebDialer_Key,
'F9CallASAP' => true
);
foreach ($cleanPOST as $key=>$value){
$cleanPOST[stripslashes($key)] = stripslashes($value);
}
$ch = curl_init();
// DEBUG - this should return a message to the user it failed
if (curl_error($ch) != "") {
echo "Error: $error\n";
}
curl_setopt($ch, CURLOPT_URL, "https://api.five9.com/web2campaign/AddToList");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cleanPOST));
curl_exec($ch);
curl_close($ch);
}
function postSalesforce()
{
$oid = "00D1I000000mJ0Q";
$member_status = "Web response";
$lead_source = "Web";
$FORM_ID = ($_POST['form_ID']);
if($FORM_ID == 'LeadChimp') {
$Campaign_ID = "7013s0000007BKl";
} else {
$Campaign_ID = "";
}
$cleanPOST = array(
'first_name' => ($_POST['first-name']),
'last_name' => ($_POST['last-name']),
'phone' => ($_POST['phone']),
'email' => ($_POST['your-email']),
//'street' => ($_POST['street']),
//'city' => ($_POST['city']),
//'state' => ($_POST['state']),
'zip' => ($_POST['zip']),
'Campaign_ID' => $Campaign_ID,
'oid' => $oid,
'lead_source' => $lead_source,
'Custom_Field_1__c' => ($_POST['subid1']),
'Custom_Field_2__c' => ($_POST['subid2']),
'Custom_Field_3__c' => ($_POST['subid3']),
'Custom_Field_4__c' => ($_POST['subid4'])
);
foreach ($cleanPOST as $key=>$value){
$cleanPOST[stripslashes($key)] = stripslashes($value);
}
$ch = curl_init();
if (curl_error($ch) != "") {
exit( "Error: $error\n");
}
curl_setopt($ch, CURLOPT_URL, "https://webto.salesforce.com/servlet/servlet.WebToLead");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cleanPOST));
curl_exec($ch);
curl_close($ch);
}
postSalesforce();
postFiveNine();

View File

0
wp/apple-touch-icon.png Normal file
View File

46
wp/clear-default-text.js Normal file
View File

@@ -0,0 +1,46 @@
// JavaScript Document
/*
* Clear Default Text: functions for clearing and replacing default text in
* <input> elements.
*
* by Ross Shannon, http://www.yourhtmlsource.com/
*/
addEvent(window, 'load', init, false);
function init() {
var formInputs = document.getElementsByTagName('input');
for (var i = 0; i < formInputs.length; i++) {
var theInput = formInputs[i];
if (theInput.type == 'text' && theInput.className.match(/\bcleardefault\b/)) {
/* Add event handlers */
addEvent(theInput, 'focus', clearDefaultText, false);
addEvent(theInput, 'blur', replaceDefaultText, false);
/* Save the current value */
if (theInput.value != '') {
theInput.defaultText = theInput.value;
}
}
}
}
function clearDefaultText(e) {
var target = window.event ? window.event.srcElement : e ? e.target : null;
if (!target) return;
if (target.value == target.defaultText) {
target.value = '';
}
}
function replaceDefaultText(e) {
var target = window.event ? window.event.srcElement : e ? e.target : null;
if (!target) return;
if (target.value == '' && target.defaultText) {
target.value = target.defaultText;
}
}

0
wp/conf/imagify.conf Normal file
View File

0
wp/conf/index.php Normal file
View File

BIN
wp/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

326
wp/five9andsf.php Normal file
View File

@@ -0,0 +1,326 @@
<?php
/**
* Function postSalesforce
* Send the form data to Salesforce so that the lead is created
*/
function postSalesforce()
{
$oid = "00D1I000000mJ0Q";
$member_status = "Web response";
$call_time = "00N30000009VwFg";
$comments = "00N1200000BGIy0";
$lead_source = "Web";
$FORM_ID = ($_POST['form_ID']);
$FORM_order_request = 441;
$FORM_brochure_request = 165;
$FORM_caregiver_request = 522;
$FORM_FirstStreet_request = "FirstStreet";
$FORM_CrispMarketing_request = "CrispMarketing";
$FORM_EmergencyMA_request = "EmergencyMA";
$FORM_FlatironMedia_request = "FlatironMedia";
$FORM_LittleBrookeMedia_request = "LittleBrookeMedia";
$FORM_Covalent_request = "Covalent";
$FORM_SkyRocket_request = "SkyRocket";
$FORM_FlexMG_request = "FlexMG";
$FORM_CentSai = "CentSai";
$FORM_Walgreens_sf = "WalgreensReadyResponsesf";
$FORM_IdealComparison = "idealcomparison";
$FORM_Modernize = "modernize";
$FORM_retirementliving = "retirementliving";
switch ( $FORM_ID ) {
case $FORM_CrispMarketing_request :
$Campaign_ID = "7011I000000dFNJQA2";
break;
case $FORM_FirstStreet_request :
$Campaign_ID = "7011I000000dGfiQAE";
break;
case $FORM_EmergencyMA_request :
$Campaign_ID = "7011I000000dFw1QAE";
break;
case $FORM_FlatironMedia_request :
$Campaign_ID = "7011I000000dEfDQAU";
break;
case $FORM_LittleBrookeMedia_request :
$Campaign_ID = "7011I000000dDkkQAE";
$lead_source_domain_name = "http://littlebrookemedia.com";
$Sub_ID = ($_POST['sub_id']);
break;
case $FORM_SkyRocket_request :
$Campaign_ID = "7011I000000dEfSQAU";
$lead_source_domain_name = "http://skyrocket.com";
break;
case $FORM_Covalent_request :
$Campaign_ID = "7011I000000dEfBQAU";
break;
case $FORM_FlexMG_request :
$Campaign_ID = "7011I000000dEfAQAU";
$lead_source_domain_name = "http://flexmg.com";
break;
case $FORM_Walgreens_sf :
$Campaign_ID = "7011I000000Il5M";
$lead_source_domain_name = "https://walgreensreadyresponse.com";
break;
case $FORM_IdealComparison :
$Campaign_ID = "7011I0000001bYy";
break;
case $FORM_CentSai :
$Campaign_ID = "7011I000000QiHi";
break;
case $FORM_Modernize :
$Campaign_ID = "7013s0000006xal";
break;
case $FORM_retirementliving :
$Campaign_ID = "7013s00000070Vs";
break;
default:
$Campaign_ID = "7011I000000dDwA";
}
$cleanPOST = array(
'first_name' => ($_POST['first-name']),
'last_name' => ($_POST['last-name']),
'phone' => ($_POST['phone']),
'email' => ($_POST['your-email']),
'street' => ($_POST['street']),
'city' => ($_POST['city']),
'state' => ($_POST['state']),
'zip' => ($_POST['zip']),
'member_status' => $member_status,
'Campaign_ID' => $Campaign_ID,
'oid' => $oid,
'lead_source' => $lead_source,
'Custom_Field_1__c' => ($_POST['CustomField1']),
'Custom_Field_2__c' => ($_POST['CustomField2']),
'Custom_Field_3__c' => ($_POST['CustomField3']),
'Custom_Field_4__c' => ($_POST['CustomField4'])
);
foreach ($cleanPOST as $key=>$value){
$cleanPOST[stripslashes($key)] = stripslashes($value);
}
// Once the POST data is in an array we can send it to Salesforce.
//Add a return URL to the data sent which then redirects the user to that URL.
// You could do the redirect in the PHP file itself
$ch = curl_init();
if (curl_error($ch) != "") {
exit( "Error: $error\n");
}
curl_setopt($ch, CURLOPT_URL, "https://webto.salesforce.com/servlet/servlet.WebToLead");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cleanPOST));
// DEBUG use this to see the variables as it is run
//error_log(__METHOD__ . http_build_query($cleanPOST));
//error_log(__FUNCTION__ . "\n" . print_r($_POST, 1));
//ob_start();
//var_dump($_POST);
//error_log(basename(__FILE__) . "\n" . ob_get_clean());
curl_exec($ch);
curl_close($ch);
}
/**
* Function postFiveNine
* Send the form data to Five9 so that the call can be made
*
*/
function postFiveNine()
{
$Campaign_ID = '701130000026vNy';
date_default_timezone_set('America/New_York');
$F9Date = date("Y-m-d")."-". date("H:i");
$F9domain = "connect america";
$FORM_ID = ($_POST['form_ID']);
$FORM_order_request = 441;
$FORM_brochure_request = 165;
$FORM_caregiver_request = 522;
$FORM_FirstStreet_request = "FirstStreet";
$FORM_CrispMarketing_request = "CrispMarketing";
$FORM_EmergencyMA_request = "EmergencyMA";
$FORM_FlatironMedia_request = "FlatironMedia";
$FORM_LittleBrookeMedia_request = "LittleBrookeMedia";
$FORM_Covalent_request = "Covalent";
$FORM_FlexMG_request = "FlexMG";
$FORM_SkyRocket_request = "SkyRocket";
$FORM_Walgreens_f9 = "WalgreensReadyResponsef9";
$FORM_Modernize = "modernize";
switch ($FORM_ID) {
case $FORM_FirstStreet_request :
$F9list = "FirstStreet";
break;
case $FORM_CrispMarketing_request :
$F9list = "Affiliates";
break;
case $FORM_EmergencyMA_request :
$F9list = "";
break;
case $FORM_FlatironMedia_request :
$F9list = "TestEmailtoCampaign";
break;
case $FORM_LittleBrookeMedia_request :
$F9list = "LittleBrook";
break;
case $FORM_Covalent_request :
$F9list = "Covalent";
break;
case $FORM_FlexMG_request :
$F9list = "FlexMG";
break;
case $FORM_Walgreens_f9 :
$F9list = "Web Form Submissions H";
break;
case $FORM_SkyRocket_request :
$F9list = "Web Form Submissions H";
break;
case $FORM_IdealComparison :
$F9list = "Web Form Submissions H";
break;
case $FORM_Modernize :
$F9list = "Outbound Web Leads";
break;
default:
//$F9list = "TestEmailtoCampaign"; // enable for testing
$F9list = "Web Form Submissions L";
}
$newphone = preg_replace('/^1|\D/', '', $_POST['phone']);
if(($_POST['dynamic-five9list']))
$F9list = ($_POST['dynamic-five9list']);
if(($_POST['dynamic-campaign-id']))
$Campaign_ID = ($_POST['dynamic-campaign-id']);
$cleanPOST = array(
'first_name' => ($_POST['first-name']),
'last_name' => ($_POST['last-name']),
'number1' => $newphone,
'F9domain' => $F9domain,
'F9list' => $F9list,
'salesforce_id' => $Campaign_ID,
'Device_6' => $title,
'WebDialer_Key' => $F9Date,
'F9key' => WebDialer_Key,
'F9CallASAP' => true
);
foreach ($cleanPOST as $key=>$value){
$cleanPOST[stripslashes($key)] = stripslashes($value);
}
$ch = curl_init();
// DEBUG - this should return a message to the user it failed
if (curl_error($ch) != "") {
echo "Error: $error\n";
}
curl_setopt($ch, CURLOPT_URL, "https://api.five9.com/web2campaign/AddToList");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cleanPOST));
curl_exec($ch);
curl_close($ch);
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//
//
// Function postReturn URL
//
//
//
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function postReturnURL( )
{
$FORM_ID = ($_POST['form_ID']);
// Define form_id from Widget
$FORM_Alert365_request = "Alert365";
$FORM_EmergencyMA_request = "EmergencyMA";
$FORM_EmergencyMA_request = "EmergencyMA";
switch ($FORM_ID) {
case $FORM_Alert365_request :
header("Location:http://alert365.com/ThankYou.html"); // Alert365 Retun URL
break;
case $FORM_Walgreens_f9 :
header("Location:https://www.walgreensreadyresponse.com/"); // Alert365 Retun URL
break;
case $FORM_Walgreens_sf :
header("Location:https://www.walgreensreadyresponse.com/"); // Alert365 Retun URL
break;
case $FORM_EmergencyMA_request :
header("Location:http://emergency.medicalalert.com/ThankYou.html"); // EmergencyMA Retun URL
break;
default:
//$F9list = "TestEmailtoCampaign"; // enable for testing
header("Location:https://medicalalert.com"); // All other Requests
} // end switch
// Once the POST data is in an array we can send it to Five9. Add a return URL to the data
// sent which then redirects the user to that URL.
// You could do the redirect in the PHP file itself
// Create a new cURL resource
$ch = curl_init();
// DEBUG - this should return a message to the user it failed
//if (curl_error($ch) != "") {
// echo "Error: $error\n";
//}
// Point to the Five9 Web to Lead page
//curl_setopt($ch, CURLOPT_URL, "http://api.five9.com/web2campaign/AddToList");
// Set the method to POST
//curl_setopt($ch, CURLOPT_POST, 1);
// this will prevent curl from sending back a retrun page.
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Pass POST data
//curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cleanPOST));
// Debug - uncomment this to see the contents of the variable in the error logs
//error_log(__METHOD__ . http_build_query($cleanPOST));
//error_log(__FUNCTION__ . "\n" . print_r($_POST, 1));
//ob_start();
//var_dump($_POST);
//error_log(basename(__FILE__) . "\n" . ob_get_clean());
// Post to Five9
curl_exec($ch);
// close cURL resource
curl_close($ch);
// should not need this but maybe the rc value will clear the issue.
}
postSalesforce();
postFiveNine();
postReturnURL();
?>

View File

@@ -0,0 +1 @@
google-site-verification: google2804da411db9e9fe.html

17
wp/index.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define( 'WP_USE_THEMES', true );
/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';

384
wp/license.txt Normal file
View File

@@ -0,0 +1,384 @@
WordPress - Web publishing software
Copyright 2011-2023 by the contributors
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 St, Fifth Floor, Boston, MA 02110-1301 USA
This program incorporates work covered by the following copyright and
permission notices:
b2 is (c) 2001, 2002 Michel Valdrighi - https://cafelog.com
Wherever third party code has been used, credit has been given in the code's
comments.
b2 is released under the GPL
and
WordPress - Web publishing software
Copyright 2003-2010 by the contributors
WordPress is released under the GPL
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
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.
<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 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.
WRITTEN OFFER
The source code for any program binaries or compressed scripts that are
included with WordPress can be freely obtained at the following URL:
https://wordpress.org/download/source/

25
wp/pantheon.upstream.yml Normal file
View File

@@ -0,0 +1,25 @@
# IMPORTANT NOTE:
# Do not edit this file unless you are doing so in your custom upstream repository.
# Override the defaults specified here in a site-specific `pantheon.yml` file.
# For more information see: https://pantheon.io/docs/pantheon-upstream-yml
api_version: 1
php_version: 7.4
# See https://pantheon.io/docs/pantheon-yml#specify-a-version-of-mariadb
database:
version: 10.4
# See https://pantheon.io/docs/pantheon-yml/#enforce-https--hsts for valid values.
enforce_https: transitional
# See https://pantheon.io/docs/pantheon-yml#protected-web-paths for usage.
protected_web_paths:
- /private/
- /wp-content/uploads/private/
- /xmlrpc.php
# By default, any 'protected_web_paths' added to the pantheon.yml file
# are combined with the paths from the pantheon.upstream.yml file. If
# 'protected_web_paths_override' is set to true, then the upstream paths
# are disabled.
protected_web_paths_override: false

21
wp/pantheon.yml Normal file
View File

@@ -0,0 +1,21 @@
api_version: 1
enforce_https: full+subdomains
protected_web_paths:
- /.user.ini
workflows:
# Commits
sync_code:
after:
- type: webphp
description: Post to Slack after each code pushed
script: private/scripts/slack_notification.php
# Database Clone
clone_database:
after:
- type: webphp
description: Change SFDC environment after database clone
script: private/scripts/sfdc_env.php

View File

@@ -0,0 +1,82 @@
<?php
if (defined('PANTHEON_ENVIRONMENT') && (PANTHEON_ENVIRONMENT !== 'live')) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php';
global $wpdb;
update_option( 'select-environment', 'staging' );
update_option( 'id_api_salesforce', 'https://connectamerica--full.sandbox.my.salesforce-sites.com/RestServices/services/apexrest/');
$variation_id = 25524;
$post_id = 25523;
$product = wc_get_product( $post_id );
$attributes = array();
$attributes_arr = array(
array(
'name' => 'Price',
'options' => array( '0.00', '24.95', '44.95' ),
'position' => 0,
'visible' => false,
'variation' => true,
),
array(
'id' => wc_attribute_taxonomy_id_by_name( 'Mehtod' ),
'name' => 'Method',
'options' => array( 'Ground', 'One Day', 'Two Day' ),
'position' => 1,
'visible' => false,
'variation' => true,
),
array(
'id' => wc_attribute_taxonomy_id_by_name( 'sf_ID' ),
'name' => 'sf_ID',
'options' => array( 'a4t1I000000PaZMQA0', 'a4t8C000000HmrpQAC', 'a4t8C000000HmruQAC', 'a4t3s000000pYVaAAM', 'a4t3s000000pYVVAA2'),
'position' => 1,
'visible' => false,
'variation' => true,
)
);
if( $attributes_arr ){
foreach( $attributes_arr as $value ) {
$attribute = new WC_Product_Attribute();
if( isset( $value['id'] ) ){
$attribute->set_id( $value['id'] );
}
$attribute->set_name( $value['name'] );
$attribute->set_options( $value['options'] );
$attribute->set_position( $value['position'] );
$attribute->set_visible( $value['visible'] );
$attribute->set_variation( $value['variation'] );
$attributes[] = $attribute;
}
}
$product->set_attributes( $attributes );
$product->save();
$var_25524 = 25524;
$variation_25524 = new WC_Product_Variation();
$variation_25524 = wc_get_product_object( 'variation', $var_25524 );
$variation_25524->set_attributes(array('price' => '0.00','method' => 'Ground','sf_ID' => 'a4t1I000000PaZMQA0'));
$variation_25524->save();
$var_25525 = 25525;
$variation_25525 = new WC_Product_Variation();
$variation_25525 = wc_get_product_object( 'variation', $var_25525 );
$variation_25525->set_attributes(array('price' => '24.95','method' => 'Ground','sf_ID' => 'a4t8C000000HmrpQAC'));
$variation_25525->save();
$var_25527 = 25527;
$variation_25527 = new WC_Product_Variation();
$variation_25527 = wc_get_product_object( 'variation', $var_25527 );
$variation_25527->set_attributes(array('price' => '44.95','method' => 'One Day','sf_ID' => 'a4t8C000000HmruQAC'));
$variation_25527->save();
}

View File

@@ -0,0 +1,183 @@
<?php
// Important constants :)
$pantheon_yellow = '#EFD01B';
// Default values for parameters - this will assume the channel you define the webhook for.
// The full Slack Message API allows you to specify other channels and enhance the messagge further
// if you like: https://api.slack.com/docs/messages/builder
$defaults = array(
'slack_username' => 'Pantheon-Quicksilver',
'always_show_text' => false,
);
// Load our hidden credentials.
// See the README.md for instructions on storing secrets.
$secrets = _get_secrets(array('slack_url'), $defaults);
// Build an array of fields to be rendered with Slack Attachments as a table
// attachment-style formatting:
// https://api.slack.com/docs/attachments
$fields = array(
array(
'title' => 'Site',
'value' => $_ENV['PANTHEON_SITE_NAME'],
'short' => 'true'
),
array( // Render Environment name with link to site, <http://{ENV}-{SITENAME}.pantheon.io|{ENV}>
'title' => 'Environment',
'value' => '<http://' . $_ENV['PANTHEON_ENVIRONMENT'] . '-' . $_ENV['PANTHEON_SITE_NAME'] . '.pantheonsite.io|' . $_ENV['PANTHEON_ENVIRONMENT'] . '>',
'short' => 'true'
),
array( // Render Name with link to Email from Commit message
'title' => 'By',
'value' => $_POST['user_email'],
'short' => 'true'
),
array( // Render workflow phase that the message was sent
'title' => 'Workflow',
'value' => ucfirst($_POST['stage']) . ' ' . str_replace('_', ' ', $_POST['wf_type']),
'short' => 'true'
),
array(
'title' => 'View Dashboard',
'value' => '<https://dashboard.pantheon.io/sites/'. PANTHEON_SITE .'#'. PANTHEON_ENVIRONMENT .'/deploys|View Dashboard>',
'short' => 'true'
),
);
// Customize the message based on the workflow type. Note that slack_notification.php
// must appear in your pantheon.yml for each workflow type you wish to send notifications on.
switch($_POST['wf_type']) {
case 'deploy':
// Find out what tag we are on and get the annotation.
$deploy_tag = `git describe --tags`;
$deploy_message = $_POST['deploy_message'];
// Prepare the slack payload as per:
// https://api.slack.com/incoming-webhooks
$text = 'Deploy to the '. $_ENV['PANTHEON_ENVIRONMENT'];
$text .= ' environment of '. $_ENV['PANTHEON_SITE_NAME'] .' by '. $_POST['user_email'] .' complete!';
$text .= ' <https://dashboard.pantheon.io/sites/'. PANTHEON_SITE .'#'. PANTHEON_ENVIRONMENT .'/deploys|View Dashboard>';
// Build an array of fields to be rendered with Slack Attachments as a table
// attachment-style formatting:
// https://api.slack.com/docs/attachments
$fields[] = array(
'title' => 'Details',
'value' => $text,
'short' => 'false'
);
$fields[] = array(
'title' => 'Deploy Note',
'value' => $deploy_message,
'short' => 'false'
);
break;
case 'sync_code':
// Get the committer, hash, and message for the most recent commit.
$committer = `git log -1 --pretty=%cn`;
$email = `git log -1 --pretty=%ce`;
$message = `git log -1 --pretty=%B`;
$hash = `git log -1 --pretty=%h`;
// Prepare the slack payload as per:
// https://api.slack.com/incoming-webhooks
$text = 'Code sync to the ' . $_ENV['PANTHEON_ENVIRONMENT'] . ' environment of ' . $_ENV['PANTHEON_SITE_NAME'] . ' by ' . $_POST['user_email'] . "!\n";
$text .= 'Most recent commit: ' . rtrim($hash) . ' by ' . rtrim($committer) . ': ' . $message;
// Build an array of fields to be rendered with Slack Attachments as a table
// attachment-style formatting:
// https://api.slack.com/docs/attachments
$fields += array(
array(
'title' => 'Commit',
'value' => rtrim($hash),
'short' => 'true'
),
array(
'title' => 'Commit Message',
'value' => $message,
'short' => 'false'
)
);
break;
case 'clear_cache':
$fields[] = array(
'title' => 'Cleared caches',
'value' => 'Cleared caches on the ' . $_ENV['PANTHEON_ENVIRONMENT'] . ' environment of ' . $_ENV['PANTHEON_SITE_NAME'] . "!\n",
'short' => 'false'
);
break;
default:
$text = $_POST['qs_description'];
break;
}
$attachment = array(
'fallback' => $text,
'pretext' => ($_POST['wf_type'] == 'clear_cache') ? 'Caches cleared :construction:' : 'Deploying :rocket:',
'color' => $pantheon_yellow, // Can either be one of 'good', 'warning', 'danger', or any hex color code
'fields' => $fields
);
_slack_notification($secrets['slack_url'], $secrets['slack_channel'], $secrets['slack_username'], $text, $attachment, $secrets['always_show_text']);
/**
* Get secrets from secrets file.
*
* @param array $requiredKeys List of keys in secrets file that must exist.
*/
function _get_secrets($requiredKeys, $defaults)
{
$secretsFile = $_SERVER['HOME'] . '/files/private/secrets.json';
if (!file_exists($secretsFile)) {
die('No secrets file found. Aborting!');
}
$secretsContents = file_get_contents($secretsFile);
$secrets = json_decode($secretsContents, 1);
if ($secrets == false) {
die('Could not parse json in secrets file. Aborting!');
}
$secrets += $defaults;
$missing = array_diff($requiredKeys, array_keys($secrets));
if (!empty($missing)) {
die('Missing required keys in json secrets file: ' . implode(',', $missing) . '. Aborting!');
}
return $secrets;
}
/**
* Send a notification to slack
*/
function _slack_notification($slack_url, $channel, $username, $text, $attachment, $alwaysShowText = false)
{
$attachment['fallback'] = $text;
$post = array(
'username' => $username,
'channel' => $channel,
'icon_emoji' => ':lightning_cloud:',
'attachments' => array($attachment)
);
if ($alwaysShowText) {
$post['text'] = $text;
}
$payload = json_encode($post);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $slack_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
// Watch for messages with `terminus workflows watch --site=SITENAME`
print("\n==== Posting to Slack ====\n");
$result = curl_exec($ch);
print("RESULT: $result");
// $payload_pretty = json_encode($post,JSON_PRETTY_PRINT); // Uncomment to debug JSON
// print("JSON: $payload_pretty"); // Uncomment to Debug JSON
print("\n===== Post Complete! =====\n");
curl_close($ch);
}

97
wp/readme.html Normal file
View File

@@ -0,0 +1,97 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>WordPress &#8250; ReadMe</title>
<link rel="stylesheet" href="wp-admin/css/install.css?ver=20100228" type="text/css" />
</head>
<body>
<h1 id="logo">
<a href="https://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" /></a>
</h1>
<p style="text-align: center">Semantic Personal Publishing Platform</p>
<h2>First Things First</h2>
<p>Welcome. WordPress is a very special project to me. Every developer and contributor adds something unique to the mix, and together we create something beautiful that I am proud to be a part of. Thousands of hours have gone into WordPress, and we are dedicated to making it better every day. Thank you for making it part of your world.</p>
<p style="text-align: right">&#8212; Matt Mullenweg</p>
<h2>Installation: Famous 5-minute install</h2>
<ol>
<li>Unzip the package in an empty directory and upload everything.</li>
<li>Open <span class="file"><a href="wp-admin/install.php">wp-admin/install.php</a></span> in your browser. It will take you through the process to set up a <code>wp-config.php</code> file with your database connection details.
<ol>
<li>If for some reason this does not work, do not worry. It may not work on all web hosts. Open up <code>wp-config-sample.php</code> with a text editor like WordPad or similar and fill in your database connection details.</li>
<li>Save the file as <code>wp-config.php</code> and upload it.</li>
<li>Open <span class="file"><a href="wp-admin/install.php">wp-admin/install.php</a></span> in your browser.</li>
</ol>
</li>
<li>Once the configuration file is set up, the installer will set up the tables needed for your site. If there is an error, double check your <code>wp-config.php</code> file, and try again. If it fails again, please go to the <a href="https://wordpress.org/support/forums/">WordPress support forums</a> with as much data as you can gather.</li>
<li><strong>If you did not enter a password, note the password given to you.</strong> If you did not provide a username, it will be <code>admin</code>.</li>
<li>The installer should then send you to the <a href="wp-login.php">login page</a>. Sign in with the username and password you chose during the installation. If a password was generated for you, you can then click on &#8220;Profile&#8221; to change the password.</li>
</ol>
<h2>Updating</h2>
<h3>Using the Automatic Updater</h3>
<ol>
<li>Open <span class="file"><a href="wp-admin/update-core.php">wp-admin/update-core.php</a></span> in your browser and follow the instructions.</li>
<li>You wanted more, perhaps? That&#8217;s it!</li>
</ol>
<h3>Updating Manually</h3>
<ol>
<li>Before you update anything, make sure you have backup copies of any files you may have modified such as <code>index.php</code>.</li>
<li>Delete your old WordPress files, saving ones you&#8217;ve modified.</li>
<li>Upload the new files.</li>
<li>Point your browser to <span class="file"><a href="wp-admin/upgrade.php">/wp-admin/upgrade.php</a>.</span></li>
</ol>
<h2>Migrating from other systems</h2>
<p>WordPress can <a href="https://wordpress.org/documentation/article/importing-content/">import from a number of systems</a>. First you need to get WordPress installed and working as described above, before using <a href="wp-admin/import.php">our import tools</a>.</p>
<h2>System Requirements</h2>
<ul>
<li><a href="https://secure.php.net/">PHP</a> version <strong>5.6.20</strong> or greater.</li>
<li><a href="https://www.mysql.com/">MySQL</a> version <strong>5.0</strong> or greater.</li>
</ul>
<h3>Recommendations</h3>
<ul>
<li><a href="https://secure.php.net/">PHP</a> version <strong>7.4</strong> or greater.</li>
<li><a href="https://www.mysql.com/">MySQL</a> version <strong>5.7</strong> or greater OR <a href="https://mariadb.org/">MariaDB</a> version <strong>10.3</strong> or greater.</li>
<li>The <a href="https://httpd.apache.org/docs/2.2/mod/mod_rewrite.html">mod_rewrite</a> Apache module.</li>
<li><a href="https://wordpress.org/news/2016/12/moving-toward-ssl/">HTTPS</a> support.</li>
<li>A link to <a href="https://wordpress.org/">wordpress.org</a> on your site.</li>
</ul>
<h2>Online Resources</h2>
<p>If you have any questions that are not addressed in this document, please take advantage of WordPress&#8217; numerous online resources:</p>
<dl>
<dt><a href="https://wordpress.org/documentation/">HelpHub</a></dt>
<dd>HelpHub is the encyclopedia of all things WordPress. It is the most comprehensive source of information for WordPress available.</dd>
<dt><a href="https://wordpress.org/news/">The WordPress Blog</a></dt>
<dd>This is where you&#8217;ll find the latest updates and news related to WordPress. Recent WordPress news appears in your administrative dashboard by default.</dd>
<dt><a href="https://planet.wordpress.org/">WordPress Planet</a></dt>
<dd>The WordPress Planet is a news aggregator that brings together posts from WordPress blogs around the web.</dd>
<dt><a href="https://wordpress.org/support/forums/">WordPress Support Forums</a></dt>
<dd>If you&#8217;ve looked everywhere and still cannot find an answer, the support forums are very active and have a large community ready to help. To help them help you be sure to use a descriptive thread title and describe your question in as much detail as possible.</dd>
<dt><a href="https://make.wordpress.org/support/handbook/appendix/other-support-locations/introduction-to-irc/">WordPress <abbr>IRC</abbr> (Internet Relay Chat) Channel</a></dt>
<dd>There is an online chat channel that is used for discussion among people who use WordPress and occasionally support topics. The above wiki page should point you in the right direction. (<a href="https://web.libera.chat/#wordpress">irc.libera.chat #wordpress</a>)</dd>
</dl>
<h2>Final Notes</h2>
<ul>
<li>If you have any suggestions, ideas, or comments, or if you (gasp!) found a bug, join us in the <a href="https://wordpress.org/support/forums/">Support Forums</a>.</li>
<li>WordPress has a robust plugin <abbr>API</abbr> (Application Programming Interface) that makes extending the code easy. If you are a developer interested in utilizing this, see the <a href="https://developer.wordpress.org/plugins/">Plugin Developer Handbook</a>. You shouldn&#8217;t modify any of the core code.</li>
</ul>
<h2>Share the Love</h2>
<p>WordPress has no multi-million dollar marketing campaign or celebrity sponsors, but we do have something even better&#8212;you. If you enjoy WordPress please consider telling a friend, setting it up for someone less knowledgeable than yourself, or writing the author of a media article that overlooks us.</p>
<p>WordPress is the official continuation of <a href="https://cafelog.com/">b2/caf&#233;log</a>, which came from Michel V. The work has been continued by the <a href="https://wordpress.org/about/">WordPress developers</a>. If you would like to support WordPress, please consider <a href="https://wordpress.org/donate/">donating</a>.</p>
<h2>License</h2>
<p>WordPress is free software, and is released under the terms of the <abbr>GPL</abbr> (GNU General Public License) version 2 or (at your option) any later version. See <a href="license.txt">license.txt</a>.</p>
</body>
</html>

39
wp/readme.md Normal file
View File

@@ -0,0 +1,39 @@
# WordPress
This is a WordPress repository configured to run on the [Pantheon platform](https://pantheon.io).
Pantheon is website platform optimized and configured to run high performance sites with an amazing developer workflow. There is built-in support for features such as Varnish, Redis, Apache Solr, New Relic, Nginx, PHP-FPM, MySQL, PhantomJS and more. 
## Getting Started
### 1. Spin-up a site
If you do not yet have a Pantheon account, you can create one for free. Once you've verified your email address, you will be able to add sites from your dashboard. Choose "WordPress" to use this distribution.
### 2. Load up the site
When the spin-up process is complete, you will be redirected to the site's dashboard. Click on the link under the site's name to access the Dev environment.
![alt](http://i.imgur.com/2wjCj9j.png?1, '')
### 3. Run the WordPress installer
How about the WordPress database config screen? No need to worry about database connection information as that is taken care of in the background. The only step that you need to complete is the site information and the installation process will be complete.
We will post more information about how this works but we recommend developers take a look at `wp-config.php` to get an understanding.
![alt](http://i.imgur.com/4EOcqYN.png, '')
If you would like to keep a separate set of configuration for local development, you can use a file called `wp-config-local.php`, which is already in our .gitignore file.
### 4. Enjoy!
![alt](http://i.imgur.com/fzIeQBP.png, '')
## Branches
The `default` branch of this repository is where PRs are merged, and has [CI](https://github.com/pantheon-systems/WordPress/tree/default/.circleci) that copies `default` to `master` after removing the CI directories. This allows customers to clone from `master` and implement their own CI without needing to worry about potential merge conflicts.
## Custom Upstreams
If you are using this repository as a starting point for a custom upstream, be sure to review the [documentation](https://pantheon.io/docs/create-custom-upstream#pull-in-core-from-pantheons-upstream) and pull the core files from the `master` branch.

83
wp/robots.txt Normal file
View File

@@ -0,0 +1,83 @@
User-agent: *
Disallow:
Disallow: /19offer.html
Disallow: /alert_button.html
Disallow: /alertbuddylp.html
Disallow: /alonelp.html
Disallow: /app.html
Disallow: /baymedical.html
Disallow: /best10caplp.html
Disallow: /best10lp.html
Disallow: /best10mobilelp.html
Disallow: /bestcompany.html
Disallow: /blairfree.html
Disallow: /blairlp.html
Disallow: /cbs-brochure.html
Disallow: /cff.html
Disallow: /combined.html
Disallow: /consumeraffairslp1.html
Disallow: /consumeraffairslp2.html
Disallow: /consumeraffairslp3.html
Disallow: /consumersadvocatelp.html
Disallow: /consumersadvocatelp1.html
Disallow: /consumersadvocatelp2.html
Disallow: /consumersadvocatelp3.html
Disallow: /customersupport.html
Disallow: /cwdllp.html
Disallow: /dm25.html
Disallow: /dm50.html
Disallow: /dmflashlight.html
Disallow: /elderly_alert_device.html
Disallow: /email50.html
Disallow: /emergency_button.html
Disallow: /entertainmentbooklp.html
Disallow: /essencelp.html
Disallow: /fall_detection.html
Disallow: /first-alert.html
Disallow: /giftslp.html
Disallow: /gps-2.html
Disallow: /great-call.html
Disallow: /habandlp.html
Disallow: /help_button.html
Disallow: /hllp.html
Disallow: /ic-thank-you.html
Disallow: /ideallp.html
Disallow: /lifecall.html
Disallow: /lifeline.html
Disallow: /lifestation.html
Disallow: /lifewatch.html
Disallow: /mabglp.html
Disallow: /medicalalert.html
Disallow: /medical-alert-bracelet.html
Disallow: /medicalguardian.html
Disallow: /medical-order.html
Disallow: /medical-profile.html
Disallow: /medical-select-accessories.html
Disallow: /medical-shipping.html
Disallow: /medical-thank.html
Disallow: /mobile_alert.html
Disallow: /mobile365-brochure.html
Disallow: /mobile-alert-brochure.html
Disallow: /new-years-sale.html
Disallow: /orchardlp.html
Disallow: /panic-button.html
Disallow: /pers-brochure.html
Disallow: /personal-medical-alert-systems.html
Disallow: /prioritylp.html
Disallow: /reachdynamicslp.html
Disallow: /referral-offer.html
Disallow: /riskfreetriallp.html
Disallow: /seniorsafetyreviewlp.html
Disallow: /testimonial.html
Disallow: /thanks.html
Disallow: /thankyou.html
Disallow: /thank-you.html
Disallow: /thank-you-for-your-request.html
Disallow: /top5reviewslp.html
Disallow: /tp-thank-you.html
Disallow: /videolp1.html
Sitemap: https://www.medicalalert.com/sitemap.xml

122
wp/util-functions.js Normal file
View File

@@ -0,0 +1,122 @@
// JavaScript Document
/*
* Cross-browser event handling, by Scott Andrew
*/
function addEvent(element, eventType, lamdaFunction, useCapture) {
if (element.addEventListener) {
element.addEventListener(eventType, lamdaFunction, useCapture);
return true;
} else if (element.attachEvent) {
var r = element.attachEvent('on' + eventType, lamdaFunction);
return r;
} else {
return false;
}
}
/*
* Kills an event's propagation and default action
*/
function knackerEvent(eventObject) {
if (eventObject && eventObject.stopPropagation) {
eventObject.stopPropagation();
}
if (window.event && window.event.cancelBubble ) {
window.event.cancelBubble = true;
}
if (eventObject && eventObject.preventDefault) {
eventObject.preventDefault();
}
if (window.event) {
window.event.returnValue = false;
}
}
/*
* Safari doesn't support canceling events in the standard way, so we must
* hard-code a return of false for it to work.
*/
function cancelEventSafari() {
return false;
}
/*
* Cross-browser style extraction, from the JavaScript & DHTML Cookbook
* <http://www.oreillynet.com/pub/a/javascript/excerpt/JSDHTMLCkbk_chap5/index5.html>
*/
function getElementStyle(elementID, CssStyleProperty) {
var element = document.getElementById(elementID);
if (element.currentStyle) {
return element.currentStyle[toCamelCase(CssStyleProperty)];
} else if (window.getComputedStyle) {
var compStyle = window.getComputedStyle(element, '');
return compStyle.getPropertyValue(CssStyleProperty);
} else {
return '';
}
}
/*
* CamelCases CSS property names. Useful in conjunction with 'getElementStyle()'
* From <http://dhtmlkitchen.com/learn/js/setstyle/index4.jsp>
*/
function toCamelCase(CssProperty) {
var stringArray = CssProperty.toLowerCase().split('-');
if (stringArray.length == 1) {
return stringArray[0];
}
var ret = (CssProperty.indexOf("-") == 0)
? stringArray[0].charAt(0).toUpperCase() + stringArray[0].substring(1)
: stringArray[0];
for (var i = 1; i < stringArray.length; i++) {
var s = stringArray[i];
ret += s.charAt(0).toUpperCase() + s.substring(1);
}
return ret;
}
/*
* Disables all 'test' links, that point to the href '#', by Ross Shannon
*/
function disableTestLinks() {
var pageLinks = document.getElementsByTagName('a');
for (var i=0; i<pageLinks.length; i++) {
if (pageLinks[i].href.match(/[^#]#$/)) {
addEvent(pageLinks[i], 'click', knackerEvent, false);
}
}
}
/*
* Cookie functions
*/
function createCookie(name, value, days) {
var expires = '';
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
var expires = '; expires=' + date.toGMTString();
}
document.cookie = name + '=' + value + expires + '; path=/';
}
function readCookie(name) {
var cookieCrumbs = document.cookie.split(';');
var nameToFind = name + '=';
for (var i = 0; i < cookieCrumbs.length; i++) {
var crumb = cookieCrumbs[i];
while (crumb.charAt(0) == ' ') {
crumb = crumb.substring(1, crumb.length); /* delete spaces */
}
if (crumb.indexOf(nameToFind) == 0) {
return crumb.substring(nameToFind.length, crumb.length);
}
}
return null;
}
function eraseCookie(name) {
createCookie(name, '', -1);
}

1
wp/wordfence-waf.php Symbolic link
View File

@@ -0,0 +1 @@
../files/private/wordfence-waf.php

218
wp/wp-activate.php Normal file
View File

@@ -0,0 +1,218 @@
<?php
/**
* Confirms that the activation key that is sent in an email after a user signs
* up for a new site matches the key for that user and then displays confirmation.
*
* @package WordPress
*/
define( 'WP_INSTALLING', true );
/** Sets up the WordPress Environment. */
require __DIR__ . '/wp-load.php';
require __DIR__ . '/wp-blog-header.php';
if ( ! is_multisite() ) {
wp_redirect( wp_registration_url() );
die();
}
$valid_error_codes = array( 'already_active', 'blog_taken' );
list( $activate_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) );
$activate_cookie = 'wp-activate-' . COOKIEHASH;
$key = '';
$result = null;
if ( isset( $_GET['key'] ) && isset( $_POST['key'] ) && $_GET['key'] !== $_POST['key'] ) {
wp_die( __( 'A key value mismatch has been detected. Please follow the link provided in your activation email.' ), __( 'An error occurred during the activation' ), 400 );
} elseif ( ! empty( $_GET['key'] ) ) {
$key = $_GET['key'];
} elseif ( ! empty( $_POST['key'] ) ) {
$key = $_POST['key'];
}
if ( $key ) {
$redirect_url = remove_query_arg( 'key' );
if ( remove_query_arg( false ) !== $redirect_url ) {
setcookie( $activate_cookie, $key, 0, $activate_path, COOKIE_DOMAIN, is_ssl(), true );
wp_safe_redirect( $redirect_url );
exit;
} else {
$result = wpmu_activate_signup( $key );
}
}
if ( null === $result && isset( $_COOKIE[ $activate_cookie ] ) ) {
$key = $_COOKIE[ $activate_cookie ];
$result = wpmu_activate_signup( $key );
setcookie( $activate_cookie, ' ', time() - YEAR_IN_SECONDS, $activate_path, COOKIE_DOMAIN, is_ssl(), true );
}
if ( null === $result || ( is_wp_error( $result ) && 'invalid_key' === $result->get_error_code() ) ) {
status_header( 404 );
} elseif ( is_wp_error( $result ) ) {
$error_code = $result->get_error_code();
if ( ! in_array( $error_code, $valid_error_codes, true ) ) {
status_header( 400 );
}
}
nocache_headers();
if ( is_object( $wp_object_cache ) ) {
$wp_object_cache->cache_enabled = false;
}
// Fix for page title.
$wp_query->is_404 = false;
/**
* Fires before the Site Activation page is loaded.
*
* @since 3.0.0
*/
do_action( 'activate_header' );
/**
* Adds an action hook specific to this page.
*
* Fires on {@see 'wp_head'}.
*
* @since MU (3.0.0)
*/
function do_activate_header() {
/**
* Fires before the Site Activation page is loaded.
*
* Fires on the {@see 'wp_head'} action.
*
* @since 3.0.0
*/
do_action( 'activate_wp_head' );
}
add_action( 'wp_head', 'do_activate_header' );
/**
* Loads styles specific to this page.
*
* @since MU (3.0.0)
*/
function wpmu_activate_stylesheet() {
?>
<style type="text/css">
.wp-activate-container { width: 90%; margin: 0 auto; }
.wp-activate-container form { margin-top: 2em; }
#submit, #key { width: 100%; font-size: 24px; box-sizing: border-box; }
#language { margin-top: 0.5em; }
.wp-activate-container .error { background: #f66; color: #333; }
span.h3 { padding: 0 8px; font-size: 1.3em; font-weight: 600; }
</style>
<?php
}
add_action( 'wp_head', 'wpmu_activate_stylesheet' );
add_action( 'wp_head', 'wp_strict_cross_origin_referrer' );
add_filter( 'wp_robots', 'wp_robots_sensitive_page' );
get_header( 'wp-activate' );
$blog_details = get_blog_details();
?>
<div id="signup-content" class="widecolumn">
<div class="wp-activate-container">
<?php if ( ! $key ) { ?>
<h2><?php _e( 'Activation Key Required' ); ?></h2>
<form name="activateform" id="activateform" method="post" action="<?php echo network_site_url( $blog_details->path . 'wp-activate.php' ); ?>">
<p>
<label for="key"><?php _e( 'Activation Key:' ); ?></label>
<br /><input type="text" name="key" id="key" value="" size="50" autofocus="autofocus" />
</p>
<p class="submit">
<input id="submit" type="submit" name="Submit" class="submit" value="<?php esc_attr_e( 'Activate' ); ?>" />
</p>
</form>
<?php
} else {
if ( is_wp_error( $result ) && in_array( $result->get_error_code(), $valid_error_codes, true ) ) {
$signup = $result->get_error_data();
?>
<h2><?php _e( 'Your account is now active!' ); ?></h2>
<?php
echo '<p class="lead-in">';
if ( '' === $signup->domain . $signup->path ) {
printf(
/* translators: 1: Login URL, 2: Username, 3: User email address, 4: Lost password URL. */
__( 'Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of &#8220;%2$s&#8221;. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.' ),
network_site_url( $blog_details->path . 'wp-login.php', 'login' ),
$signup->user_login,
$signup->user_email,
wp_lostpassword_url()
);
} else {
printf(
/* translators: 1: Site URL, 2: Username, 3: User email address, 4: Lost password URL. */
__( 'Your site at %1$s is active. You may now log in to your site using your chosen username of &#8220;%2$s&#8221;. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.' ),
sprintf( '<a href="http://%1$s%2$s">%1$s%2$s</a>', $signup->domain, $blog_details->path ),
$signup->user_login,
$signup->user_email,
wp_lostpassword_url()
);
}
echo '</p>';
} elseif ( null === $result || is_wp_error( $result ) ) {
?>
<h2><?php _e( 'An error occurred during the activation' ); ?></h2>
<?php if ( is_wp_error( $result ) ) : ?>
<p><?php echo $result->get_error_message(); ?></p>
<?php endif; ?>
<?php
} else {
$url = isset( $result['blog_id'] ) ? get_home_url( (int) $result['blog_id'] ) : '';
$user = get_userdata( (int) $result['user_id'] );
?>
<h2><?php _e( 'Your account is now active!' ); ?></h2>
<div id="signup-welcome">
<p><span class="h3"><?php _e( 'Username:' ); ?></span> <?php echo $user->user_login; ?></p>
<p><span class="h3"><?php _e( 'Password:' ); ?></span> <?php echo $result['password']; ?></p>
</div>
<?php
if ( $url && network_home_url( '', 'http' ) !== $url ) :
switch_to_blog( (int) $result['blog_id'] );
$login_url = wp_login_url();
restore_current_blog();
?>
<p class="view">
<?php
/* translators: 1: Site URL, 2: Login URL. */
printf( __( 'Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>' ), $url, esc_url( $login_url ) );
?>
</p>
<?php else : ?>
<p class="view">
<?php
printf(
/* translators: 1: Login URL, 2: Network home URL. */
__( 'Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.' ),
network_site_url( $blog_details->path . 'wp-login.php', 'login' ),
network_home_url( $blog_details->path )
);
?>
</p>
<?php
endif;
}
}
?>
</div>
</div>
<?php
get_footer( 'wp-activate' );

400
wp/wp-admin/about.php Normal file

File diff suppressed because one or more lines are too long

207
wp/wp-admin/admin-ajax.php Normal file
View File

@@ -0,0 +1,207 @@
<?php
/**
* WordPress Ajax Process Execution
*
* @package WordPress
* @subpackage Administration
*
* @link https://codex.wordpress.org/AJAX_in_Plugins
*/
/**
* Executing Ajax process.
*
* @since 2.1.0
*/
define( 'DOING_AJAX', true );
if ( ! defined( 'WP_ADMIN' ) ) {
define( 'WP_ADMIN', true );
}
/** Load WordPress Bootstrap */
require_once dirname( __DIR__ ) . '/wp-load.php';
/** Allow for cross-domain requests (from the front end). */
send_origin_headers();
header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
header( 'X-Robots-Tag: noindex' );
// Require a valid action parameter.
if ( empty( $_REQUEST['action'] ) || ! is_scalar( $_REQUEST['action'] ) ) {
wp_die( '0', 400 );
}
/** Load WordPress Administration APIs */
require_once ABSPATH . 'wp-admin/includes/admin.php';
/** Load Ajax Handlers for WordPress Core */
require_once ABSPATH . 'wp-admin/includes/ajax-actions.php';
send_nosniff_header();
nocache_headers();
/** This action is documented in wp-admin/admin.php */
do_action( 'admin_init' );
$core_actions_get = array(
'fetch-list',
'ajax-tag-search',
'wp-compression-test',
'imgedit-preview',
'oembed-cache',
'autocomplete-user',
'dashboard-widgets',
'logged-in',
'rest-nonce',
);
$core_actions_post = array(
'oembed-cache',
'image-editor',
'delete-comment',
'delete-tag',
'delete-link',
'delete-meta',
'delete-post',
'trash-post',
'untrash-post',
'delete-page',
'dim-comment',
'add-link-category',
'add-tag',
'get-tagcloud',
'get-comments',
'replyto-comment',
'edit-comment',
'add-menu-item',
'add-meta',
'add-user',
'closed-postboxes',
'hidden-columns',
'update-welcome-panel',
'menu-get-metabox',
'wp-link-ajax',
'menu-locations-save',
'menu-quick-search',
'meta-box-order',
'get-permalink',
'sample-permalink',
'inline-save',
'inline-save-tax',
'find_posts',
'widgets-order',
'save-widget',
'delete-inactive-widgets',
'set-post-thumbnail',
'date_format',
'time_format',
'wp-remove-post-lock',
'dismiss-wp-pointer',
'upload-attachment',
'get-attachment',
'query-attachments',
'save-attachment',
'save-attachment-compat',
'send-link-to-editor',
'send-attachment-to-editor',
'save-attachment-order',
'media-create-image-subsizes',
'heartbeat',
'get-revision-diffs',
'save-user-color-scheme',
'update-widget',
'query-themes',
'parse-embed',
'set-attachment-thumbnail',
'parse-media-shortcode',
'destroy-sessions',
'install-plugin',
'update-plugin',
'crop-image',
'generate-password',
'save-wporg-username',
'delete-plugin',
'search-plugins',
'search-install-plugins',
'activate-plugin',
'update-theme',
'delete-theme',
'install-theme',
'get-post-thumbnail-html',
'get-community-events',
'edit-theme-plugin-file',
'wp-privacy-export-personal-data',
'wp-privacy-erase-personal-data',
'health-check-site-status-result',
'health-check-dotorg-communication',
'health-check-is-in-debug-mode',
'health-check-background-updates',
'health-check-loopback-requests',
'health-check-get-sizes',
'toggle-auto-updates',
'send-password-reset',
);
// Deprecated.
$core_actions_post_deprecated = array(
'wp-fullscreen-save-post',
'press-this-save-post',
'press-this-add-category',
'health-check-dotorg-communication',
'health-check-is-in-debug-mode',
'health-check-background-updates',
'health-check-loopback-requests',
);
$core_actions_post = array_merge( $core_actions_post, $core_actions_post_deprecated );
// Register core Ajax calls.
if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get, true ) ) {
add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 );
}
if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post, true ) ) {
add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 );
}
add_action( 'wp_ajax_nopriv_generate-password', 'wp_ajax_nopriv_generate_password' );
add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 );
$action = $_REQUEST['action'];
if ( is_user_logged_in() ) {
// If no action is registered, return a Bad Request response.
if ( ! has_action( "wp_ajax_{$action}" ) ) {
wp_die( '0', 400 );
}
/**
* Fires authenticated Ajax actions for logged-in users.
*
* The dynamic portion of the hook name, `$action`, refers
* to the name of the Ajax action callback being fired.
*
* @since 2.1.0
*/
do_action( "wp_ajax_{$action}" );
} else {
// If no action is registered, return a Bad Request response.
if ( ! has_action( "wp_ajax_nopriv_{$action}" ) ) {
wp_die( '0', 400 );
}
/**
* Fires non-authenticated Ajax actions for logged-out users.
*
* The dynamic portion of the hook name, `$action`, refers
* to the name of the Ajax action callback being fired.
*
* @since 2.8.0
*/
do_action( "wp_ajax_nopriv_{$action}" );
}
// Default status.
wp_die( '0' );

View File

@@ -0,0 +1,119 @@
<?php
/**
* WordPress Administration Template Footer
*
* @package WordPress
* @subpackage Administration
*/
// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
/**
* @global string $hook_suffix
*/
global $hook_suffix;
?>
<div class="clear"></div></div><!-- wpbody-content -->
<div class="clear"></div></div><!-- wpbody -->
<div class="clear"></div></div><!-- wpcontent -->
<div id="wpfooter" role="contentinfo">
<?php
/**
* Fires after the opening tag for the admin footer.
*
* @since 2.5.0
*/
do_action( 'in_admin_footer' );
?>
<p id="footer-left" class="alignleft">
<?php
$text = sprintf(
/* translators: %s: https://wordpress.org/ */
__( 'Thank you for creating with <a href="%s">WordPress</a>.' ),
__( 'https://wordpress.org/' )
);
/**
* Filters the "Thank you" text displayed in the admin footer.
*
* @since 2.8.0
*
* @param string $text The content that will be printed.
*/
echo apply_filters( 'admin_footer_text', '<span id="footer-thankyou">' . $text . '</span>' );
?>
</p>
<p id="footer-upgrade" class="alignright">
<?php
/**
* Filters the version/update text displayed in the admin footer.
*
* WordPress prints the current version and update information,
* using core_update_footer() at priority 10.
*
* @since 2.3.0
*
* @see core_update_footer()
*
* @param string $content The content that will be printed.
*/
echo apply_filters( 'update_footer', '' );
?>
</p>
<div class="clear"></div>
</div>
<?php
/**
* Prints scripts or data before the default footer scripts.
*
* @since 1.2.0
*
* @param string $data The data to print.
*/
do_action( 'admin_footer', '' );
/**
* Prints scripts and data queued for the footer.
*
* The dynamic portion of the hook name, `$hook_suffix`,
* refers to the global hook suffix of the current page.
*
* @since 4.6.0
*/
do_action( "admin_print_footer_scripts-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/**
* Prints any scripts and data queued for the footer.
*
* @since 2.8.0
*/
do_action( 'admin_print_footer_scripts' );
/**
* Prints scripts or data after the default footer scripts.
*
* The dynamic portion of the hook name, `$hook_suffix`,
* refers to the global hook suffix of the current page.
*
* @since 2.8.0
*/
do_action( "admin_footer-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
// get_site_option() won't exist when auto upgrading from <= 2.7.
if ( function_exists( 'get_site_option' )
&& false === get_site_option( 'can_compress_scripts' )
) {
compression_test();
}
?>
<div class="clear"></div></div><!-- wpwrap -->
<script type="text/javascript">if(typeof wpOnload==='function')wpOnload();</script>
</body>
</html>

View File

@@ -0,0 +1,15 @@
<?php
/**
* Administration Functions
*
* This file is deprecated, use 'wp-admin/includes/admin.php' instead.
*
* @deprecated 2.5.0
* @package WordPress
* @subpackage Administration
*/
_deprecated_file( basename( __FILE__ ), '2.5.0', 'wp-admin/includes/admin.php' );
/** WordPress Administration API: Includes all Administration functions. */
require_once ABSPATH . 'wp-admin/includes/admin.php';

View File

@@ -0,0 +1,315 @@
<?php
/**
* WordPress Administration Template Header
*
* @package WordPress
* @subpackage Administration
*/
header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
if ( ! defined( 'WP_ADMIN' ) ) {
require_once __DIR__ . '/admin.php';
}
/**
* In case admin-header.php is included in a function.
*
* @global string $title
* @global string $hook_suffix
* @global WP_Screen $current_screen WordPress current screen object.
* @global WP_Locale $wp_locale WordPress date and time locale object.
* @global string $pagenow The filename of the current screen.
* @global string $update_title
* @global int $total_update_count
* @global string $parent_file
* @global string $typenow The post type of the current screen.
*/
global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow,
$update_title, $total_update_count, $parent_file, $typenow;
// Catch plugins that include admin-header.php before admin.php completes.
if ( empty( $current_screen ) ) {
set_current_screen();
}
get_admin_page_title();
$title = strip_tags( $title );
if ( is_network_admin() ) {
/* translators: Network admin screen title. %s: Network title. */
$admin_title = sprintf( __( 'Network Admin: %s' ), get_network()->site_name );
} elseif ( is_user_admin() ) {
/* translators: User dashboard screen title. %s: Network title. */
$admin_title = sprintf( __( 'User Dashboard: %s' ), get_network()->site_name );
} else {
$admin_title = get_bloginfo( 'name' );
}
if ( $admin_title === $title ) {
/* translators: Admin screen title. %s: Admin screen name. */
$admin_title = sprintf( __( '%s &#8212; WordPress' ), $title );
} else {
$screen_title = $title;
if ( 'post' === $current_screen->base && 'add' !== $current_screen->action ) {
$post_title = get_the_title();
if ( ! empty( $post_title ) ) {
$post_type_obj = get_post_type_object( $typenow );
$screen_title = sprintf(
/* translators: Editor admin screen title. 1: "Edit item" text for the post type, 2: Post title. */
__( '%1$s &#8220;%2$s&#8221;' ),
$post_type_obj->labels->edit_item,
$post_title
);
}
}
/* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */
$admin_title = sprintf( __( '%1$s &lsaquo; %2$s &#8212; WordPress' ), $screen_title, $admin_title );
}
if ( wp_is_recovery_mode() ) {
/* translators: %s: Admin screen title. */
$admin_title = sprintf( __( 'Recovery Mode &#8212; %s' ), $admin_title );
}
/**
* Filters the title tag content for an admin page.
*
* @since 3.1.0
*
* @param string $admin_title The page title, with extra context added.
* @param string $title The original page title.
*/
$admin_title = apply_filters( 'admin_title', $admin_title, $title );
wp_user_settings();
_wp_admin_html_begin();
?>
<title><?php echo esc_html( $admin_title ); ?></title>
<?php
wp_enqueue_style( 'colors' );
wp_enqueue_script( 'utils' );
wp_enqueue_script( 'svg-painter' );
$admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix );
?>
<script type="text/javascript">
addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(function(){func();});else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>',
pagenow = '<?php echo esc_js( $current_screen->id ); ?>',
typenow = '<?php echo esc_js( $current_screen->post_type ); ?>',
adminpage = '<?php echo esc_js( $admin_body_class ); ?>',
thousandsSeparator = '<?php echo esc_js( $wp_locale->number_format['thousands_sep'] ); ?>',
decimalPoint = '<?php echo esc_js( $wp_locale->number_format['decimal_point'] ); ?>',
isRtl = <?php echo (int) is_rtl(); ?>;
</script>
<?php
/**
* Enqueue scripts for all admin pages.
*
* @since 2.8.0
*
* @param string $hook_suffix The current admin page.
*/
do_action( 'admin_enqueue_scripts', $hook_suffix );
/**
* Fires when styles are printed for a specific admin page based on $hook_suffix.
*
* @since 2.6.0
*/
do_action( "admin_print_styles-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/**
* Fires when styles are printed for all admin pages.
*
* @since 2.6.0
*/
do_action( 'admin_print_styles' );
/**
* Fires when scripts are printed for a specific admin page based on $hook_suffix.
*
* @since 2.1.0
*/
do_action( "admin_print_scripts-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/**
* Fires when scripts are printed for all admin pages.
*
* @since 2.1.0
*/
do_action( 'admin_print_scripts' );
/**
* Fires in head section for a specific admin page.
*
* The dynamic portion of the hook name, `$hook_suffix`, refers to the hook suffix
* for the admin page.
*
* @since 2.1.0
*/
do_action( "admin_head-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/**
* Fires in head section for all admin pages.
*
* @since 2.1.0
*/
do_action( 'admin_head' );
if ( 'f' === get_user_setting( 'mfold' ) ) {
$admin_body_class .= ' folded';
}
if ( ! get_user_setting( 'unfold' ) ) {
$admin_body_class .= ' auto-fold';
}
if ( is_admin_bar_showing() ) {
$admin_body_class .= ' admin-bar';
}
if ( is_rtl() ) {
$admin_body_class .= ' rtl';
}
if ( $current_screen->post_type ) {
$admin_body_class .= ' post-type-' . $current_screen->post_type;
}
if ( $current_screen->taxonomy ) {
$admin_body_class .= ' taxonomy-' . $current_screen->taxonomy;
}
$admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', (float) get_bloginfo( 'version' ) );
$admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', get_bloginfo( 'version' ) ) );
$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
if ( wp_is_mobile() ) {
$admin_body_class .= ' mobile';
}
if ( is_multisite() ) {
$admin_body_class .= ' multisite';
}
if ( is_network_admin() ) {
$admin_body_class .= ' network-admin';
}
$admin_body_class .= ' no-customize-support no-svg';
if ( $current_screen->is_block_editor() ) {
$admin_body_class .= ' block-editor-page wp-embed-responsive';
}
$error_get_last = error_get_last();
// Print a CSS class to make PHP errors visible.
if ( $error_get_last && WP_DEBUG && WP_DEBUG_DISPLAY && ini_get( 'display_errors' )
// Don't print the class for PHP notices in wp-config.php, as they happen before WP_DEBUG takes effect,
// and should not be displayed with the `error_reporting` level previously set in wp-load.php.
&& ( E_NOTICE !== $error_get_last['type'] || 'wp-config.php' !== wp_basename( $error_get_last['file'] ) )
) {
$admin_body_class .= ' php-error';
}
unset( $error_get_last );
?>
</head>
<?php
/**
* Filters the CSS classes for the body tag in the admin.
*
* This filter differs from the {@see 'post_class'} and {@see 'body_class'} filters
* in two important ways:
*
* 1. `$classes` is a space-separated string of class names instead of an array.
* 2. Not all core admin classes are filterable, notably: wp-admin, wp-core-ui,
* and no-js cannot be removed.
*
* @since 2.3.0
*
* @param string $classes Space-separated list of CSS classes.
*/
$admin_body_classes = apply_filters( 'admin_body_class', '' );
$admin_body_classes = ltrim( $admin_body_classes . ' ' . $admin_body_class );
?>
<body class="wp-admin wp-core-ui no-js <?php echo $admin_body_classes; ?>">
<script type="text/javascript">
document.body.className = document.body.className.replace('no-js','js');
</script>
<?php
// Make sure the customize body classes are correct as early as possible.
if ( current_user_can( 'customize' ) ) {
wp_customize_support_script();
}
?>
<div id="wpwrap">
<?php require ABSPATH . 'wp-admin/menu-header.php'; ?>
<div id="wpcontent">
<?php
/**
* Fires at the beginning of the content section in an admin page.
*
* @since 3.0.0
*/
do_action( 'in_admin_header' );
?>
<div id="wpbody" role="main">
<?php
unset( $blog_name, $total_update_count, $update_title );
$current_screen->set_parentage( $parent_file );
?>
<div id="wpbody-content">
<?php
$current_screen->render_screen_meta();
if ( is_network_admin() ) {
/**
* Prints network admin screen notices.
*
* @since 3.1.0
*/
do_action( 'network_admin_notices' );
} elseif ( is_user_admin() ) {
/**
* Prints user admin screen notices.
*
* @since 3.1.0
*/
do_action( 'user_admin_notices' );
} else {
/**
* Prints admin screen notices.
*
* @since 3.1.0
*/
do_action( 'admin_notices' );
}
/**
* Prints generic admin screen notices.
*
* @since 3.1.0
*/
do_action( 'all_admin_notices' );
if ( 'options-general.php' === $parent_file ) {
require ABSPATH . 'wp-admin/options-head.php';
}

View File

@@ -0,0 +1,87 @@
<?php
/**
* WordPress Generic Request (POST/GET) Handler
*
* Intended for form submission handling in themes and plugins.
*
* @package WordPress
* @subpackage Administration
*/
/** We are located in WordPress Administration Screens */
if ( ! defined( 'WP_ADMIN' ) ) {
define( 'WP_ADMIN', true );
}
if ( defined( 'ABSPATH' ) ) {
require_once ABSPATH . 'wp-load.php';
} else {
require_once dirname( __DIR__ ) . '/wp-load.php';
}
/** Allow for cross-domain requests (from the front end). */
send_origin_headers();
require_once ABSPATH . 'wp-admin/includes/admin.php';
nocache_headers();
/** This action is documented in wp-admin/admin.php */
do_action( 'admin_init' );
$action = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
// Reject invalid parameters.
if ( ! is_scalar( $action ) ) {
wp_die( '', 400 );
}
if ( ! is_user_logged_in() ) {
if ( empty( $action ) ) {
/**
* Fires on a non-authenticated admin post request where no action is supplied.
*
* @since 2.6.0
*/
do_action( 'admin_post_nopriv' );
} else {
// If no action is registered, return a Bad Request response.
if ( ! has_action( "admin_post_nopriv_{$action}" ) ) {
wp_die( '', 400 );
}
/**
* Fires on a non-authenticated admin post request for the given action.
*
* The dynamic portion of the hook name, `$action`, refers to the given
* request action.
*
* @since 2.6.0
*/
do_action( "admin_post_nopriv_{$action}" );
}
} else {
if ( empty( $action ) ) {
/**
* Fires on an authenticated admin post request where no action is supplied.
*
* @since 2.6.0
*/
do_action( 'admin_post' );
} else {
// If no action is registered, return a Bad Request response.
if ( ! has_action( "admin_post_{$action}" ) ) {
wp_die( '', 400 );
}
/**
* Fires on an authenticated admin post request for the given action.
*
* The dynamic portion of the hook name, `$action`, refers to the given
* request action.
*
* @since 2.6.0
*/
do_action( "admin_post_{$action}" );
}
}

420
wp/wp-admin/admin.php Normal file
View File

@@ -0,0 +1,420 @@
<?php
/**
* WordPress Administration Bootstrap
*
* @package WordPress
* @subpackage Administration
*/
/**
* In WordPress Administration Screens
*
* @since 2.3.2
*/
if ( ! defined( 'WP_ADMIN' ) ) {
define( 'WP_ADMIN', true );
}
if ( ! defined( 'WP_NETWORK_ADMIN' ) ) {
define( 'WP_NETWORK_ADMIN', false );
}
if ( ! defined( 'WP_USER_ADMIN' ) ) {
define( 'WP_USER_ADMIN', false );
}
if ( ! WP_NETWORK_ADMIN && ! WP_USER_ADMIN ) {
define( 'WP_BLOG_ADMIN', true );
}
if ( isset( $_GET['import'] ) && ! defined( 'WP_LOAD_IMPORTERS' ) ) {
define( 'WP_LOAD_IMPORTERS', true );
}
require_once dirname( __DIR__ ) . '/wp-load.php';
nocache_headers();
if ( get_option( 'db_upgraded' ) ) {
flush_rewrite_rules();
update_option( 'db_upgraded', false );
/**
* Fires on the next page load after a successful DB upgrade.
*
* @since 2.8.0
*/
do_action( 'after_db_upgrade' );
} elseif ( ! wp_doing_ajax() && empty( $_POST )
&& (int) get_option( 'db_version' ) !== $wp_db_version
) {
if ( ! is_multisite() ) {
wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
exit;
}
/**
* Filters whether to attempt to perform the multisite DB upgrade routine.
*
* In single site, the user would be redirected to wp-admin/upgrade.php.
* In multisite, the DB upgrade routine is automatically fired, but only
* when this filter returns true.
*
* If the network is 50 sites or less, it will run every time. Otherwise,
* it will throttle itself to reduce load.
*
* @since MU (3.0.0)
*
* @param bool $do_mu_upgrade Whether to perform the Multisite upgrade routine. Default true.
*/
if ( apply_filters( 'do_mu_upgrade', true ) ) {
$c = get_blog_count();
/*
* If there are 50 or fewer sites, run every time. Otherwise, throttle to reduce load:
* attempt to do no more than threshold value, with some +/- allowed.
*/
if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int) ( $c / 50 ) ) === 1 ) ) {
require_once ABSPATH . WPINC . '/http.php';
$response = wp_remote_get(
admin_url( 'upgrade.php?step=1' ),
array(
'timeout' => 120,
'httpversion' => '1.1',
)
);
/** This action is documented in wp-admin/network/upgrade.php */
do_action( 'after_mu_upgrade', $response );
unset( $response );
}
unset( $c );
}
}
require_once ABSPATH . 'wp-admin/includes/admin.php';
auth_redirect();
// Schedule Trash collection.
if ( ! wp_next_scheduled( 'wp_scheduled_delete' ) && ! wp_installing() ) {
wp_schedule_event( time(), 'daily', 'wp_scheduled_delete' );
}
// Schedule transient cleanup.
if ( ! wp_next_scheduled( 'delete_expired_transients' ) && ! wp_installing() ) {
wp_schedule_event( time(), 'daily', 'delete_expired_transients' );
}
set_screen_options();
$date_format = __( 'F j, Y' );
$time_format = __( 'g:i a' );
wp_enqueue_script( 'common' );
/**
* $pagenow is set in vars.php.
* $wp_importers is sometimes set in wp-admin/includes/import.php.
* The remaining variables are imported as globals elsewhere, declared as globals here.
*
* @global string $pagenow The filename of the current screen.
* @global array $wp_importers
* @global string $hook_suffix
* @global string $plugin_page
* @global string $typenow The post type of the current screen.
* @global string $taxnow The taxonomy of the current screen.
*/
global $pagenow, $wp_importers, $hook_suffix, $plugin_page, $typenow, $taxnow;
$page_hook = null;
$editing = false;
if ( isset( $_GET['page'] ) ) {
$plugin_page = wp_unslash( $_GET['page'] );
$plugin_page = plugin_basename( $plugin_page );
}
if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) {
$typenow = $_REQUEST['post_type'];
} else {
$typenow = '';
}
if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) {
$taxnow = $_REQUEST['taxonomy'];
} else {
$taxnow = '';
}
if ( WP_NETWORK_ADMIN ) {
require ABSPATH . 'wp-admin/network/menu.php';
} elseif ( WP_USER_ADMIN ) {
require ABSPATH . 'wp-admin/user/menu.php';
} else {
require ABSPATH . 'wp-admin/menu.php';
}
if ( current_user_can( 'manage_options' ) ) {
wp_raise_memory_limit( 'admin' );
}
/**
* Fires as an admin screen or script is being initialized.
*
* Note, this does not just run on user-facing admin screens.
* It runs on admin-ajax.php and admin-post.php as well.
*
* This is roughly analogous to the more general {@see 'init'} hook, which fires earlier.
*
* @since 2.5.0
*/
do_action( 'admin_init' );
if ( isset( $plugin_page ) ) {
if ( ! empty( $typenow ) ) {
$the_parent = $pagenow . '?post_type=' . $typenow;
} else {
$the_parent = $pagenow;
}
$page_hook = get_plugin_page_hook( $plugin_page, $the_parent );
if ( ! $page_hook ) {
$page_hook = get_plugin_page_hook( $plugin_page, $plugin_page );
// Back-compat for plugins using add_management_page().
if ( empty( $page_hook ) && 'edit.php' === $pagenow && get_plugin_page_hook( $plugin_page, 'tools.php' ) ) {
// There could be plugin specific params on the URL, so we need the whole query string.
if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
$query_string = $_SERVER['QUERY_STRING'];
} else {
$query_string = 'page=' . $plugin_page;
}
wp_redirect( admin_url( 'tools.php?' . $query_string ) );
exit;
}
}
unset( $the_parent );
}
$hook_suffix = '';
if ( isset( $page_hook ) ) {
$hook_suffix = $page_hook;
} elseif ( isset( $plugin_page ) ) {
$hook_suffix = $plugin_page;
} elseif ( isset( $pagenow ) ) {
$hook_suffix = $pagenow;
}
set_current_screen();
// Handle plugin admin pages.
if ( isset( $plugin_page ) ) {
if ( $page_hook ) {
/**
* Fires before a particular screen is loaded.
*
* The load-* hook fires in a number of contexts. This hook is for plugin screens
* where a callback is provided when the screen is registered.
*
* The dynamic portion of the hook name, `$page_hook`, refers to a mixture of plugin
* page information including:
* 1. The page type. If the plugin page is registered as a submenu page, such as for
* Settings, the page type would be 'settings'. Otherwise the type is 'toplevel'.
* 2. A separator of '_page_'.
* 3. The plugin basename minus the file extension.
*
* Together, the three parts form the `$page_hook`. Citing the example above,
* the hook name used would be 'load-settings_page_pluginbasename'.
*
* @see get_plugin_page_hook()
*
* @since 2.1.0
*/
do_action( "load-{$page_hook}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
if ( ! isset( $_GET['noheader'] ) ) {
require_once ABSPATH . 'wp-admin/admin-header.php';
}
/**
* Used to call the registered callback for a plugin screen.
*
* This hook uses a dynamic hook name, `$page_hook`, which refers to a mixture of plugin
* page information including:
* 1. The page type. If the plugin page is registered as a submenu page, such as for
* Settings, the page type would be 'settings'. Otherwise the type is 'toplevel'.
* 2. A separator of '_page_'.
* 3. The plugin basename minus the file extension.
*
* Together, the three parts form the `$page_hook`. Citing the example above,
* the hook name used would be 'settings_page_pluginbasename'.
*
* @see get_plugin_page_hook()
*
* @since 1.5.0
*/
do_action( $page_hook );
} else {
if ( validate_file( $plugin_page ) ) {
wp_die( __( 'Invalid plugin page.' ) );
}
if ( ! ( file_exists( WP_PLUGIN_DIR . "/$plugin_page" ) && is_file( WP_PLUGIN_DIR . "/$plugin_page" ) )
&& ! ( file_exists( WPMU_PLUGIN_DIR . "/$plugin_page" ) && is_file( WPMU_PLUGIN_DIR . "/$plugin_page" ) )
) {
/* translators: %s: Admin page generated by a plugin. */
wp_die( sprintf( __( 'Cannot load %s.' ), htmlentities( $plugin_page ) ) );
}
/**
* Fires before a particular screen is loaded.
*
* The load-* hook fires in a number of contexts. This hook is for plugin screens
* where the file to load is directly included, rather than the use of a function.
*
* The dynamic portion of the hook name, `$plugin_page`, refers to the plugin basename.
*
* @see plugin_basename()
*
* @since 1.5.0
*/
do_action( "load-{$plugin_page}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
if ( ! isset( $_GET['noheader'] ) ) {
require_once ABSPATH . 'wp-admin/admin-header.php';
}
if ( file_exists( WPMU_PLUGIN_DIR . "/$plugin_page" ) ) {
include WPMU_PLUGIN_DIR . "/$plugin_page";
} else {
include WP_PLUGIN_DIR . "/$plugin_page";
}
}
require_once ABSPATH . 'wp-admin/admin-footer.php';
exit;
} elseif ( isset( $_GET['import'] ) ) {
$importer = $_GET['import'];
if ( ! current_user_can( 'import' ) ) {
wp_die( __( 'Sorry, you are not allowed to import content into this site.' ) );
}
if ( validate_file( $importer ) ) {
wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
exit;
}
if ( ! isset( $wp_importers[ $importer ] ) || ! is_callable( $wp_importers[ $importer ][2] ) ) {
wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
exit;
}
/**
* Fires before an importer screen is loaded.
*
* The dynamic portion of the hook name, `$importer`, refers to the importer slug.
*
* Possible hook names include:
*
* - `load-importer-blogger`
* - `load-importer-wpcat2tag`
* - `load-importer-livejournal`
* - `load-importer-mt`
* - `load-importer-rss`
* - `load-importer-tumblr`
* - `load-importer-wordpress`
*
* @since 3.5.0
*/
do_action( "load-importer-{$importer}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
// Used in the HTML title tag.
$title = __( 'Import' );
$parent_file = 'tools.php';
$submenu_file = 'import.php';
if ( ! isset( $_GET['noheader'] ) ) {
require_once ABSPATH . 'wp-admin/admin-header.php';
}
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
define( 'WP_IMPORTING', true );
/**
* Whether to filter imported data through kses on import.
*
* Multisite uses this hook to filter all data through kses by default,
* as a super administrator may be assisting an untrusted user.
*
* @since 3.1.0
*
* @param bool $force Whether to force data to be filtered through kses. Default false.
*/
if ( apply_filters( 'force_filtered_html_on_import', false ) ) {
kses_init_filters(); // Always filter imported data with kses on multisite.
}
call_user_func( $wp_importers[ $importer ][2] );
require_once ABSPATH . 'wp-admin/admin-footer.php';
// Make sure rules are flushed.
flush_rewrite_rules( false );
exit;
} else {
/**
* Fires before a particular screen is loaded.
*
* The load-* hook fires in a number of contexts. This hook is for core screens.
*
* The dynamic portion of the hook name, `$pagenow`, is a global variable
* referring to the filename of the current screen, such as 'admin.php',
* 'post-new.php' etc. A complete hook for the latter would be
* 'load-post-new.php'.
*
* @since 2.1.0
*/
do_action( "load-{$pagenow}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/*
* The following hooks are fired to ensure backward compatibility.
* In all other cases, 'load-' . $pagenow should be used instead.
*/
if ( 'page' === $typenow ) {
if ( 'post-new.php' === $pagenow ) {
do_action( 'load-page-new.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
} elseif ( 'post.php' === $pagenow ) {
do_action( 'load-page.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}
} elseif ( 'edit-tags.php' === $pagenow ) {
if ( 'category' === $taxnow ) {
do_action( 'load-categories.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
} elseif ( 'link_category' === $taxnow ) {
do_action( 'load-edit-link-categories.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}
} elseif ( 'term.php' === $pagenow ) {
do_action( 'load-edit-tags.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}
}
if ( ! empty( $_REQUEST['action'] ) ) {
$action = $_REQUEST['action'];
/**
* Fires when an 'action' request variable is sent.
*
* The dynamic portion of the hook name, `$action`, refers to
* the action derived from the `GET` or `POST` request.
*
* @since 2.6.0
*/
do_action( "admin_action_{$action}" );
}

View File

@@ -0,0 +1,156 @@
<?php
/**
* Server-side file upload handler from wp-plupload or other asynchronous upload methods.
*
* @package WordPress
* @subpackage Administration
*/
if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
define( 'DOING_AJAX', true );
}
if ( ! defined( 'WP_ADMIN' ) ) {
define( 'WP_ADMIN', true );
}
if ( defined( 'ABSPATH' ) ) {
require_once ABSPATH . 'wp-load.php';
} else {
require_once dirname( __DIR__ ) . '/wp-load.php';
}
require_once ABSPATH . 'wp-admin/admin.php';
header( 'Content-Type: text/plain; charset=' . get_option( 'blog_charset' ) );
if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
require ABSPATH . 'wp-admin/includes/ajax-actions.php';
send_nosniff_header();
nocache_headers();
wp_ajax_upload_attachment();
die( '0' );
}
if ( ! current_user_can( 'upload_files' ) ) {
wp_die( __( 'Sorry, you are not allowed to upload files.' ) );
}
// Just fetch the detail form for that attachment.
if ( isset( $_REQUEST['attachment_id'] ) && (int) $_REQUEST['attachment_id'] && $_REQUEST['fetch'] ) {
$id = (int) $_REQUEST['attachment_id'];
$post = get_post( $id );
if ( 'attachment' !== $post->post_type ) {
wp_die( __( 'Invalid post type.' ) );
}
switch ( $_REQUEST['fetch'] ) {
case 3:
?>
<div class="media-item-wrapper">
<div class="attachment-details">
<?php
$thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true );
if ( $thumb_url ) {
echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />';
}
// Title shouldn't ever be empty, but use filename just in case.
$file = get_attached_file( $post->ID );
$file_url = wp_get_attachment_url( $post->ID );
$title = $post->post_title ? $post->post_title : wp_basename( $file );
?>
<div class="filename new">
<span class="media-list-title"><strong><?php echo esc_html( wp_html_excerpt( $title, 60, '&hellip;' ) ); ?></strong></span>
<span class="media-list-subtitle"><?php echo wp_basename( $file ); ?></span>
</div>
</div>
<div class="attachment-tools">
<span class="media-item-copy-container copy-to-clipboard-container edit-attachment">
<button type="button" class="button button-small copy-attachment-url" data-clipboard-text="<?php echo $file_url; ?>"><?php _e( 'Copy URL to clipboard' ); ?></button>
<span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
</span>
<?php
if ( current_user_can( 'edit_post', $id ) ) {
echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '">' . _x( 'Edit', 'media item' ) . '</a>';
} else {
echo '<span class="edit-attachment">' . _x( 'Success', 'media item' ) . '</span>';
}
?>
</div>
</div>
<?php
break;
case 2:
add_filter( 'attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2 );
echo get_media_item(
$id,
array(
'send' => false,
'delete' => true,
)
);
break;
default:
add_filter( 'attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2 );
echo get_media_item( $id );
break;
}
exit;
}
check_admin_referer( 'media-form' );
$post_id = 0;
if ( isset( $_REQUEST['post_id'] ) ) {
$post_id = absint( $_REQUEST['post_id'] );
if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) {
$post_id = 0;
}
}
$id = media_handle_upload( 'async-upload', $post_id );
if ( is_wp_error( $id ) ) {
printf(
'<div class="error-div error">%s <strong>%s</strong><br />%s</div>',
sprintf(
'<button type="button" class="dismiss button-link" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">%s</button>',
__( 'Dismiss' )
),
sprintf(
/* translators: %s: Name of the file that failed to upload. */
__( '&#8220;%s&#8221; has failed to upload.' ),
esc_html( $_FILES['async-upload']['name'] )
),
esc_html( $id->get_error_message() )
);
exit;
}
if ( $_REQUEST['short'] ) {
// Short form response - attachment ID only.
echo $id;
} else {
// Long form response - big chunk of HTML.
$type = $_REQUEST['type'];
/**
* Filters the returned ID of an uploaded attachment.
*
* The dynamic portion of the hook name, `$type`, refers to the attachment type.
*
* Possible hook names include:
*
* - `async_upload_audio`
* - `async_upload_file`
* - `async_upload_image`
* - `async_upload_video`
*
* @since 2.5.0
*
* @param int $id Uploaded attachment ID.
*/
echo apply_filters( "async_upload_{$type}", $id );
}

View File

@@ -0,0 +1,325 @@
<?php
/**
* Authorize Application Screen
*
* @package WordPress
* @subpackage Administration
*/
/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';
$error = null;
$new_password = '';
// This is the no-js fallback script. Generally this will all be handled by `auth-app.js`.
if ( isset( $_POST['action'] ) && 'authorize_application_password' === $_POST['action'] ) {
check_admin_referer( 'authorize_application_password' );
$success_url = $_POST['success_url'];
$reject_url = $_POST['reject_url'];
$app_name = $_POST['app_name'];
$app_id = $_POST['app_id'];
$redirect = '';
if ( isset( $_POST['reject'] ) ) {
if ( $reject_url ) {
$redirect = $reject_url;
} else {
$redirect = admin_url();
}
} elseif ( isset( $_POST['approve'] ) ) {
$created = WP_Application_Passwords::create_new_application_password(
get_current_user_id(),
array(
'name' => $app_name,
'app_id' => $app_id,
)
);
if ( is_wp_error( $created ) ) {
$error = $created;
} else {
list( $new_password ) = $created;
if ( $success_url ) {
$redirect = add_query_arg(
array(
'site_url' => urlencode( site_url() ),
'user_login' => urlencode( wp_get_current_user()->user_login ),
'password' => urlencode( $new_password ),
),
$success_url
);
}
}
}
if ( $redirect ) {
// Explicitly not using wp_safe_redirect b/c sends to arbitrary domain.
wp_redirect( $redirect );
exit;
}
}
// Used in the HTML title tag.
$title = __( 'Authorize Application' );
$app_name = ! empty( $_REQUEST['app_name'] ) ? $_REQUEST['app_name'] : '';
$app_id = ! empty( $_REQUEST['app_id'] ) ? $_REQUEST['app_id'] : '';
$success_url = ! empty( $_REQUEST['success_url'] ) ? $_REQUEST['success_url'] : null;
if ( ! empty( $_REQUEST['reject_url'] ) ) {
$reject_url = $_REQUEST['reject_url'];
} elseif ( $success_url ) {
$reject_url = add_query_arg( 'success', 'false', $success_url );
} else {
$reject_url = null;
}
$user = wp_get_current_user();
$request = compact( 'app_name', 'app_id', 'success_url', 'reject_url' );
$is_valid = wp_is_authorize_application_password_request_valid( $request, $user );
if ( is_wp_error( $is_valid ) ) {
wp_die(
__( 'The Authorize Application request is not allowed.' ) . ' ' . implode( ' ', $is_valid->get_error_messages() ),
__( 'Cannot Authorize Application' )
);
}
if ( wp_is_site_protected_by_basic_auth( 'front' ) ) {
wp_die(
__( 'Your website appears to use Basic Authentication, which is not currently compatible with application passwords.' ),
__( 'Cannot Authorize Application' ),
array(
'response' => 501,
'link_text' => __( 'Go Back' ),
'link_url' => $reject_url ? add_query_arg( 'error', 'disabled', $reject_url ) : admin_url(),
)
);
}
if ( ! wp_is_application_passwords_available_for_user( $user ) ) {
if ( wp_is_application_passwords_available() ) {
$message = __( 'Application passwords are not available for your account. Please contact the site administrator for assistance.' );
} else {
$message = __( 'Application passwords are not available.' );
}
wp_die(
$message,
__( 'Cannot Authorize Application' ),
array(
'response' => 501,
'link_text' => __( 'Go Back' ),
'link_url' => $reject_url ? add_query_arg( 'error', 'disabled', $reject_url ) : admin_url(),
)
);
}
wp_enqueue_script( 'auth-app' );
wp_localize_script(
'auth-app',
'authApp',
array(
'site_url' => site_url(),
'user_login' => $user->user_login,
'success' => $success_url,
'reject' => $reject_url ? $reject_url : admin_url(),
)
);
require_once ABSPATH . 'wp-admin/admin-header.php';
?>
<div class="wrap">
<h1><?php echo esc_html( $title ); ?></h1>
<?php if ( is_wp_error( $error ) ) : ?>
<div class="notice notice-error"><p><?php echo $error->get_error_message(); ?></p></div>
<?php endif; ?>
<div class="card auth-app-card">
<h2 class="title"><?php _e( 'An application would like to connect to your account.' ); ?></h2>
<?php if ( $app_name ) : ?>
<p>
<?php
printf(
/* translators: %s: Application name. */
__( 'Would you like to give the application identifying itself as %s access to your account? You should only do this if you trust the application in question.' ),
'<strong>' . esc_html( $app_name ) . '</strong>'
);
?>
</p>
<?php else : ?>
<p><?php _e( 'Would you like to give this application access to your account? You should only do this if you trust the application in question.' ); ?></p>
<?php endif; ?>
<?php
if ( is_multisite() ) {
$blogs = get_blogs_of_user( $user->ID, true );
$blogs_count = count( $blogs );
if ( $blogs_count > 1 ) {
?>
<p>
<?php
/* translators: 1: URL to my-sites.php, 2: Number of sites the user has. */
$message = _n(
'This will grant access to <a href="%1$s">the %2$s site in this installation that you have permissions on</a>.',
'This will grant access to <a href="%1$s">all %2$s sites in this installation that you have permissions on</a>.',
$blogs_count
);
if ( is_super_admin() ) {
/* translators: 1: URL to my-sites.php, 2: Number of sites the user has. */
$message = _n(
'This will grant access to <a href="%1$s">the %2$s site on the network as you have Super Admin rights</a>.',
'This will grant access to <a href="%1$s">all %2$s sites on the network as you have Super Admin rights</a>.',
$blogs_count
);
}
printf(
$message,
admin_url( 'my-sites.php' ),
number_format_i18n( $blogs_count )
);
?>
</p>
<?php
}
}
?>
<?php if ( $new_password ) : ?>
<div class="notice notice-success notice-alt below-h2">
<p class="application-password-display">
<label for="new-application-password-value">
<?php
printf(
/* translators: %s: Application name. */
esc_html__( 'Your new password for %s is:' ),
'<strong>' . esc_html( $app_name ) . '</strong>'
);
?>
</label>
<input id="new-application-password-value" type="text" class="code" readonly="readonly" value="<?php esc_attr( WP_Application_Passwords::chunk_password( $new_password ) ); ?>" />
</p>
<p><?php _e( 'Be sure to save this in a safe location. You will not be able to retrieve it.' ); ?></p>
</div>
<?php
/**
* Fires in the Authorize Application Password new password section in the no-JS version.
*
* In most cases, this should be used in combination with the {@see 'wp_application_passwords_approve_app_request_success'}
* action to ensure that both the JS and no-JS variants are handled.
*
* @since 5.6.0
* @since 5.6.1 Corrected action name and signature.
*
* @param string $new_password The newly generated application password.
* @param array $request The array of request data. All arguments are optional and may be empty.
* @param WP_User $user The user authorizing the application.
*/
do_action( 'wp_authorize_application_password_form_approved_no_js', $new_password, $request, $user );
?>
<?php else : ?>
<form action="<?php echo esc_url( admin_url( 'authorize-application.php' ) ); ?>" method="post" class="form-wrap">
<?php wp_nonce_field( 'authorize_application_password' ); ?>
<input type="hidden" name="action" value="authorize_application_password" />
<input type="hidden" name="app_id" value="<?php echo esc_attr( $app_id ); ?>" />
<input type="hidden" name="success_url" value="<?php echo esc_url( $success_url ); ?>" />
<input type="hidden" name="reject_url" value="<?php echo esc_url( $reject_url ); ?>" />
<div class="form-field">
<label for="app_name"><?php _e( 'New Application Password Name' ); ?></label>
<input type="text" id="app_name" name="app_name" value="<?php echo esc_attr( $app_name ); ?>" required />
</div>
<?php
/**
* Fires in the Authorize Application Password form before the submit buttons.
*
* @since 5.6.0
*
* @param array $request {
* The array of request data. All arguments are optional and may be empty.
*
* @type string $app_name The suggested name of the application.
* @type string $success_url The URL the user will be redirected to after approving the application.
* @type string $reject_url The URL the user will be redirected to after rejecting the application.
* }
* @param WP_User $user The user authorizing the application.
*/
do_action( 'wp_authorize_application_password_form', $request, $user );
?>
<?php
submit_button(
__( 'Yes, I approve of this connection' ),
'primary',
'approve',
false,
array(
'aria-describedby' => 'description-approve',
)
);
?>
<p class="description" id="description-approve">
<?php
if ( $success_url ) {
printf(
/* translators: %s: The URL the user is being redirected to. */
__( 'You will be sent to %s' ),
'<strong><code>' . esc_html(
add_query_arg(
array(
'site_url' => site_url(),
'user_login' => $user->user_login,
'password' => '[------]',
),
$success_url
)
) . '</code></strong>'
);
} else {
_e( 'You will be given a password to manually enter into the application in question.' );
}
?>
</p>
<?php
submit_button(
__( 'No, I do not approve of this connection' ),
'secondary',
'reject',
false,
array(
'aria-describedby' => 'description-reject',
)
);
?>
<p class="description" id="description-reject">
<?php
if ( $reject_url ) {
printf(
/* translators: %s: The URL the user is being redirected to. */
__( 'You will be sent to %s' ),
'<strong><code>' . esc_html( $reject_url ) . '</code></strong>'
);
} else {
_e( 'You will be returned to the WordPress Dashboard, and no changes will be made.' );
}
?>
</p>
</form>
<?php endif; ?>
</div>
</div>
<?php
require_once ABSPATH . 'wp-admin/admin-footer.php';

374
wp/wp-admin/comment.php Normal file
View File

@@ -0,0 +1,374 @@
<?php
/**
* Comment Management Screen
*
* @package WordPress
* @subpackage Administration
*/
/** Load WordPress Bootstrap */
require_once __DIR__ . '/admin.php';
$parent_file = 'edit-comments.php';
$submenu_file = 'edit-comments.php';
/**
* @global string $action
*/
global $action;
wp_reset_vars( array( 'action' ) );
if ( isset( $_POST['deletecomment'] ) ) {
$action = 'deletecomment';
}
if ( 'cdc' === $action ) {
$action = 'delete';
} elseif ( 'mac' === $action ) {
$action = 'approve';
}
if ( isset( $_GET['dt'] ) ) {
if ( 'spam' === $_GET['dt'] ) {
$action = 'spam';
} elseif ( 'trash' === $_GET['dt'] ) {
$action = 'trash';
}
}
if ( isset( $_REQUEST['c'] ) ) {
$comment_id = absint( $_REQUEST['c'] );
$comment = get_comment( $comment_id );
// Prevent actions on a comment associated with a trashed post.
if ( $comment && 'trash' === get_post_status( $comment->comment_post_ID ) ) {
wp_die(
__( 'You cannot edit this comment because the associated post is in the Trash. Please restore the post first, then try again.' )
);
}
} else {
$comment = null;
}
switch ( $action ) {
case 'editcomment':
// Used in the HTML title tag.
$title = __( 'Edit Comment' );
get_current_screen()->add_help_tab(
array(
'id' => 'overview',
'title' => __( 'Overview' ),
'content' =>
'<p>' . __( 'You can edit the information left in a comment if needed. This is often useful when you notice that a commenter has made a typographical error.' ) . '</p>' .
'<p>' . __( 'You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment.' ) . '</p>',
)
);
get_current_screen()->set_help_sidebar(
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
'<p>' . __( '<a href="https://wordpress.org/documentation/article/comments-screen/">Documentation on Comments</a>' ) . '</p>' .
'<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
);
wp_enqueue_script( 'comment' );
require_once ABSPATH . 'wp-admin/admin-header.php';
if ( ! $comment ) {
comment_footer_die( __( 'Invalid comment ID.' ) . sprintf( ' <a href="%s">' . __( 'Go back' ) . '</a>.', 'javascript:history.go(-1)' ) );
}
if ( ! current_user_can( 'edit_comment', $comment_id ) ) {
comment_footer_die( __( 'Sorry, you are not allowed to edit this comment.' ) );
}
if ( 'trash' === $comment->comment_approved ) {
comment_footer_die( __( 'This comment is in the Trash. Please move it out of the Trash if you want to edit it.' ) );
}
$comment = get_comment_to_edit( $comment_id );
require ABSPATH . 'wp-admin/edit-form-comment.php';
break;
case 'delete':
case 'approve':
case 'trash':
case 'spam':
// Used in the HTML title tag.
$title = __( 'Moderate Comment' );
if ( ! $comment ) {
wp_redirect( admin_url( 'edit-comments.php?error=1' ) );
die();
}
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
wp_redirect( admin_url( 'edit-comments.php?error=2' ) );
die();
}
// No need to re-approve/re-trash/re-spam a comment.
if ( str_replace( '1', 'approve', $comment->comment_approved ) === $action ) {
wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) );
die();
}
require_once ABSPATH . 'wp-admin/admin-header.php';
$formaction = $action . 'comment';
$nonce_action = ( 'approve' === $action ) ? 'approve-comment_' : 'delete-comment_';
$nonce_action .= $comment_id;
?>
<div class="wrap">
<h1><?php echo esc_html( $title ); ?></h1>
<?php
switch ( $action ) {
case 'spam':
$caution_msg = __( 'You are about to mark the following comment as spam:' );
$button = _x( 'Mark as spam', 'comment' );
break;
case 'trash':
$caution_msg = __( 'You are about to move the following comment to the Trash:' );
$button = __( 'Move to Trash' );
break;
case 'delete':
$caution_msg = __( 'You are about to delete the following comment:' );
$button = __( 'Permanently delete comment' );
break;
default:
$caution_msg = __( 'You are about to approve the following comment:' );
$button = __( 'Approve comment' );
break;
}
if ( '0' !== $comment->comment_approved ) { // If not unapproved.
$message = '';
switch ( $comment->comment_approved ) {
case '1':
$message = __( 'This comment is currently approved.' );
break;
case 'spam':
$message = __( 'This comment is currently marked as spam.' );
break;
case 'trash':
$message = __( 'This comment is currently in the Trash.' );
break;
}
if ( $message ) {
echo '<div id="message" class="notice notice-info"><p>' . $message . '</p></div>';
}
}
?>
<div id="message" class="notice notice-warning"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php echo $caution_msg; ?></p></div>
<table class="form-table comment-ays">
<tr>
<th scope="row"><?php _e( 'Author' ); ?></th>
<td><?php comment_author( $comment ); ?></td>
</tr>
<?php if ( get_comment_author_email( $comment ) ) { ?>
<tr>
<th scope="row"><?php _e( 'Email' ); ?></th>
<td><?php comment_author_email( $comment ); ?></td>
</tr>
<?php } ?>
<?php if ( get_comment_author_url( $comment ) ) { ?>
<tr>
<th scope="row"><?php _e( 'URL' ); ?></th>
<td><a href="<?php comment_author_url( $comment ); ?>"><?php comment_author_url( $comment ); ?></a></td>
</tr>
<?php } ?>
<tr>
<th scope="row"><?php /* translators: Column name or table row header. */ _e( 'In response to' ); ?></th>
<td>
<?php
$post_id = $comment->comment_post_ID;
if ( current_user_can( 'edit_post', $post_id ) ) {
$post_link = "<a href='" . esc_url( get_edit_post_link( $post_id ) ) . "'>";
$post_link .= esc_html( get_the_title( $post_id ) ) . '</a>';
} else {
$post_link = esc_html( get_the_title( $post_id ) );
}
echo $post_link;
if ( $comment->comment_parent ) {
$parent = get_comment( $comment->comment_parent );
$parent_link = esc_url( get_comment_link( $parent ) );
$name = get_comment_author( $parent );
printf(
/* translators: %s: Comment link. */
' | ' . __( 'In reply to %s.' ),
'<a href="' . $parent_link . '">' . $name . '</a>'
);
}
?>
</td>
</tr>
<tr>
<th scope="row"><?php _e( 'Submitted on' ); ?></th>
<td>
<?php
$submitted = sprintf(
/* translators: 1: Comment date, 2: Comment time. */
__( '%1$s at %2$s' ),
/* translators: Comment date format. See https://www.php.net/manual/datetime.format.php */
get_comment_date( __( 'Y/m/d' ), $comment ),
/* translators: Comment time format. See https://www.php.net/manual/datetime.format.php */
get_comment_date( __( 'g:i a' ), $comment )
);
if ( 'approved' === wp_get_comment_status( $comment ) && ! empty( $comment->comment_post_ID ) ) {
echo '<a href="' . esc_url( get_comment_link( $comment ) ) . '">' . $submitted . '</a>';
} else {
echo $submitted;
}
?>
</td>
</tr>
<tr>
<th scope="row"><?php /* translators: Field name in comment form. */ _ex( 'Comment', 'noun' ); ?></th>
<td class="comment-content">
<?php comment_text( $comment ); ?>
<p class="edit-comment">
<a href="<?php echo esc_url( admin_url( "comment.php?action=editcomment&c={$comment->comment_ID}" ) ); ?>"><?php esc_html_e( 'Edit' ); ?></a>
</p>
</td>
</tr>
</table>
<form action="comment.php" method="get" class="comment-ays-submit">
<p>
<?php submit_button( $button, 'primary', 'submit', false ); ?>
<a href="<?php echo esc_url( admin_url( 'edit-comments.php' ) ); ?>" class="button-cancel"><?php esc_html_e( 'Cancel' ); ?></a>
</p>
<?php wp_nonce_field( $nonce_action ); ?>
<input type="hidden" name="action" value="<?php echo esc_attr( $formaction ); ?>" />
<input type="hidden" name="c" value="<?php echo esc_attr( $comment->comment_ID ); ?>" />
<input type="hidden" name="noredir" value="1" />
</form>
</div>
<?php
break;
case 'deletecomment':
case 'trashcomment':
case 'untrashcomment':
case 'spamcomment':
case 'unspamcomment':
case 'approvecomment':
case 'unapprovecomment':
$comment_id = absint( $_REQUEST['c'] );
if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ), true ) ) {
check_admin_referer( 'approve-comment_' . $comment_id );
} else {
check_admin_referer( 'delete-comment_' . $comment_id );
}
$noredir = isset( $_REQUEST['noredir'] );
$comment = get_comment( $comment_id );
if ( ! $comment ) {
comment_footer_die( __( 'Invalid comment ID.' ) . sprintf( ' <a href="%s">' . __( 'Go back' ) . '</a>.', 'edit-comments.php' ) );
}
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
comment_footer_die( __( 'Sorry, you are not allowed to edit comments on this post.' ) );
}
if ( wp_get_referer() && ! $noredir && false === strpos( wp_get_referer(), 'comment.php' ) ) {
$redir = wp_get_referer();
} elseif ( wp_get_original_referer() && ! $noredir ) {
$redir = wp_get_original_referer();
} elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ), true ) ) {
$redir = admin_url( 'edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
} else {
$redir = admin_url( 'edit-comments.php' );
}
$redir = remove_query_arg( array( 'spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved' ), $redir );
switch ( $action ) {
case 'deletecomment':
wp_delete_comment( $comment );
$redir = add_query_arg( array( 'deleted' => '1' ), $redir );
break;
case 'trashcomment':
wp_trash_comment( $comment );
$redir = add_query_arg(
array(
'trashed' => '1',
'ids' => $comment_id,
),
$redir
);
break;
case 'untrashcomment':
wp_untrash_comment( $comment );
$redir = add_query_arg( array( 'untrashed' => '1' ), $redir );
break;
case 'spamcomment':
wp_spam_comment( $comment );
$redir = add_query_arg(
array(
'spammed' => '1',
'ids' => $comment_id,
),
$redir
);
break;
case 'unspamcomment':
wp_unspam_comment( $comment );
$redir = add_query_arg( array( 'unspammed' => '1' ), $redir );
break;
case 'approvecomment':
wp_set_comment_status( $comment, 'approve' );
$redir = add_query_arg( array( 'approved' => 1 ), $redir );
break;
case 'unapprovecomment':
wp_set_comment_status( $comment, 'hold' );
$redir = add_query_arg( array( 'unapproved' => 1 ), $redir );
break;
}
wp_redirect( $redir );
die;
case 'editedcomment':
$comment_id = absint( $_POST['comment_ID'] );
$comment_post_id = absint( $_POST['comment_post_ID'] );
check_admin_referer( 'update-comment_' . $comment_id );
$updated = edit_comment();
if ( is_wp_error( $updated ) ) {
wp_die( $updated->get_error_message() );
}
$location = ( empty( $_POST['referredby'] ) ? "edit-comments.php?p=$comment_post_id" : $_POST['referredby'] ) . '#comment-' . $comment_id;
/**
* Filters the URI the user is redirected to after editing a comment in the admin.
*
* @since 2.1.0
*
* @param string $location The URI the user will be redirected to.
* @param int $comment_id The ID of the comment being edited.
*/
$location = apply_filters( 'comment_edit_redirect', $location, $comment_id );
wp_redirect( $location );
exit;
default:
wp_die( __( 'Unknown action.' ) );
} // End switch.
require_once ABSPATH . 'wp-admin/admin-footer.php';

142
wp/wp-admin/credits.php Normal file
View File

@@ -0,0 +1,142 @@
<?php
/**
* Credits administration panel.
*
* @package WordPress
* @subpackage Administration
*/
/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';
require_once __DIR__ . '/includes/credits.php';
// Used in the HTML title tag.
$title = __( 'Credits' );
list( $display_version ) = explode( '-', get_bloginfo( 'version' ) );
require_once ABSPATH . 'wp-admin/admin-header.php';
$credits = wp_credits();
?>
<div class="wrap about__container">
<div class="about__header">
<div class="about__header-title">
<h1>
<?php _e( 'Contributors' ); ?>
</h1>
</div>
<div class="about__header-text">
<?php
printf(
/* translators: %s: Version number. */
__( 'WordPress %s was created by a worldwide team of passionate individuals' ),
$display_version
);
?>
</div>
</div>
<nav class="about__header-navigation nav-tab-wrapper wp-clearfix" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>">
<a href="about.php" class="nav-tab"><?php _e( 'What&#8217;s New' ); ?></a>
<a href="credits.php" class="nav-tab nav-tab-active" aria-current="page"><?php _e( 'Credits' ); ?></a>
<a href="freedoms.php" class="nav-tab"><?php _e( 'Freedoms' ); ?></a>
<a href="privacy.php" class="nav-tab"><?php _e( 'Privacy' ); ?></a>
</nav>
<div class="about__section has-1-column has-gutters">
<div class="column aligncenter">
<?php if ( ! $credits ) : ?>
<p>
<?php
printf(
/* translators: 1: https://wordpress.org/about/ */
__( 'WordPress is created by a <a href="%1$s">worldwide team</a> of passionate individuals.' ),
__( 'https://wordpress.org/about/' )
);
?>
<br />
<a href="https://make.wordpress.org/"><?php _e( 'Get involved in WordPress.' ); ?></a>
</p>
<?php else : ?>
<p>
<?php _e( 'Want to see your name in lights on this page?' ); ?>
<br />
<a href="https://make.wordpress.org/"><?php _e( 'Get involved in WordPress.' ); ?></a>
</p>
<?php endif; ?>
</div>
</div>
<?php
if ( ! $credits ) {
echo '</div>';
require_once ABSPATH . 'wp-admin/admin-footer.php';
exit;
}
?>
<hr class="is-large" />
<div class="about__section">
<div class="column is-edge-to-edge">
<?php wp_credits_section_title( $credits['groups']['core-developers'] ); ?>
<?php wp_credits_section_list( $credits, 'core-developers' ); ?>
<?php wp_credits_section_list( $credits, 'contributing-developers' ); ?>
</div>
</div>
<hr />
<div class="about__section">
<div class="column">
<?php wp_credits_section_title( $credits['groups']['props'] ); ?>
<?php wp_credits_section_list( $credits, 'props' ); ?>
</div>
</div>
<hr />
<?php if ( isset( $credits['groups']['translators'] ) || isset( $credits['groups']['validators'] ) ) : ?>
<div class="about__section">
<div class="column">
<?php wp_credits_section_title( $credits['groups']['validators'] ); ?>
<?php wp_credits_section_list( $credits, 'validators' ); ?>
<?php wp_credits_section_list( $credits, 'translators' ); ?>
</div>
</div>
<hr />
<?php endif; ?>
<div class="about__section">
<div class="column">
<?php wp_credits_section_title( $credits['groups']['libraries'] ); ?>
<?php wp_credits_section_list( $credits, 'libraries' ); ?>
</div>
</div>
</div>
<?php
require_once ABSPATH . 'wp-admin/admin-footer.php';
return;
// These are strings returned by the API that we want to be translatable.
__( 'Project Leaders' );
/* translators: %s: The current WordPress version number. */
__( 'Core Contributors to WordPress %s' );
__( 'Noteworthy Contributors' );
__( 'Cofounder, Project Lead' );
__( 'Lead Developer' );
__( 'Release Lead' );
__( 'Release Design Lead' );
__( 'Release Deputy' );
__( 'Core Developer' );
__( 'External Libraries' );

File diff suppressed because it is too large Load Diff

2
wp/wp-admin/css/about-rtl.min.css vendored Normal file

File diff suppressed because one or more lines are too long

1393
wp/wp-admin/css/about.css Normal file

File diff suppressed because it is too large Load Diff

2
wp/wp-admin/css/about.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,858 @@
/*! This file is auto-generated */
#adminmenuback,
#adminmenuwrap,
#adminmenu,
#adminmenu .wp-submenu {
width: 160px;
background-color: #1d2327;
}
#adminmenuback {
position: fixed;
top: 0;
bottom: -120px;
z-index: 1; /* positive z-index to avoid elastic scrolling woes in Safari */
}
.php-error #adminmenuback {
position: absolute;
}
.php-error #adminmenuback,
.php-error #adminmenuwrap {
margin-top: 2em;
}
#adminmenu {
clear: right;
margin: 12px 0;
padding: 0;
list-style: none;
}
.folded #adminmenuback,
.folded #adminmenuwrap,
.folded #adminmenu,
.folded #adminmenu li.menu-top {
width: 36px;
}
/* New Menu icons */
/* hide background-image for icons above */
.menu-icon-dashboard div.wp-menu-image,
.menu-icon-post div.wp-menu-image,
.menu-icon-media div.wp-menu-image,
.menu-icon-links div.wp-menu-image,
.menu-icon-page div.wp-menu-image,
.menu-icon-comments div.wp-menu-image,
.menu-icon-appearance div.wp-menu-image,
.menu-icon-plugins div.wp-menu-image,
.menu-icon-users div.wp-menu-image,
.menu-icon-tools div.wp-menu-image,
.menu-icon-settings div.wp-menu-image,
.menu-icon-site div.wp-menu-image,
.menu-icon-generic div.wp-menu-image {
background-image: none !important;
}
/*------------------------------------------------------------------------------
7.0 - Main Navigation (Left Menu)
------------------------------------------------------------------------------*/
#adminmenuwrap {
position: relative;
float: right;
z-index: 9990;
}
/* side admin menu */
#adminmenu * {
-webkit-user-select: none;
user-select: none;
}
#adminmenu li {
margin: 0;
padding: 0;
}
#adminmenu a {
display: block;
line-height: 1.3;
padding: 2px 5px;
color: #f0f0f1;
}
#adminmenu .wp-submenu a {
color: #c3c4c7;
color: rgba(240, 246, 252, 0.7);
font-size: 13px;
line-height: 1.4;
margin: 0;
padding: 5px 0;
}
#adminmenu .wp-submenu a:hover,
#adminmenu .wp-submenu a:focus {
background: none;
}
#adminmenu a:hover,
#adminmenu li.menu-top > a:focus,
#adminmenu .wp-submenu a:hover,
#adminmenu .wp-submenu a:focus {
color: #72aee6;
}
#adminmenu a:hover,
#adminmenu a:focus,
.folded #adminmenu .wp-submenu-head:hover {
box-shadow: inset -4px 0 0 0 currentColor;
transition: box-shadow .1s linear;
}
#adminmenu li.menu-top {
border: none;
min-height: 34px;
position: relative;
}
#adminmenu .wp-submenu {
list-style: none;
position: absolute;
top: -1000em;
right: 160px;
overflow: visible;
word-wrap: break-word;
padding: 7px 0 8px;
z-index: 9999;
background-color: #2c3338;
box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
}
.js #adminmenu .sub-open,
.js #adminmenu .opensub .wp-submenu,
#adminmenu a.menu-top:focus + .wp-submenu,
.no-js li.wp-has-submenu:hover .wp-submenu {
top: -1px;
}
#adminmenu a.wp-has-current-submenu:focus + .wp-submenu {
top: 0;
}
#adminmenu .wp-has-current-submenu .wp-submenu,
.no-js li.wp-has-current-submenu:hover .wp-submenu,
#adminmenu .wp-has-current-submenu .wp-submenu.sub-open,
#adminmenu .wp-has-current-submenu.opensub .wp-submenu {
position: relative;
z-index: 3;
top: auto;
right: auto;
left: auto;
bottom: auto;
border: 0 none;
margin-top: 0;
box-shadow: none;
}
.folded #adminmenu .wp-has-current-submenu .wp-submenu {
box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
}
/* ensure that wp-submenu's box shadow doesn't appear on top of the focused menu item's background. */
#adminmenu li.menu-top:hover,
#adminmenu li.opensub > a.menu-top,
#adminmenu li > a.menu-top:focus {
position: relative;
background-color: #1d2327;
color: #72aee6;
}
.folded #adminmenu li.menu-top:hover,
.folded #adminmenu li.opensub > a.menu-top,
.folded #adminmenu li > a.menu-top:focus {
z-index: 10000;
}
#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,
#adminmenu li.current a.menu-top,
#adminmenu .wp-menu-arrow,
#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head,
#adminmenu .wp-menu-arrow div {
background: #2271b1;
color: #fff;
}
.folded #adminmenu .wp-submenu.sub-open,
.folded #adminmenu .opensub .wp-submenu,
.folded #adminmenu .wp-has-current-submenu .wp-submenu.sub-open,
.folded #adminmenu .wp-has-current-submenu.opensub .wp-submenu,
.folded #adminmenu a.menu-top:focus + .wp-submenu,
.folded #adminmenu .wp-has-current-submenu a.menu-top:focus + .wp-submenu,
.no-js.folded #adminmenu .wp-has-submenu:hover .wp-submenu {
top: 0;
right: 36px;
}
.folded #adminmenu a.wp-has-current-submenu:focus + .wp-submenu,
.folded #adminmenu .wp-has-current-submenu .wp-submenu {
position: absolute;
top: -1000em;
}
#adminmenu .wp-not-current-submenu .wp-submenu,
.folded #adminmenu .wp-has-current-submenu .wp-submenu {
min-width: 160px;
width: auto;
border-right: 5px solid transparent;
}
#adminmenu .wp-submenu li.current,
#adminmenu .wp-submenu li.current a,
#adminmenu .opensub .wp-submenu li.current a,
#adminmenu a.wp-has-current-submenu:focus + .wp-submenu li.current a,
#adminmenu .wp-submenu li.current a:hover,
#adminmenu .wp-submenu li.current a:focus {
color: #fff;
}
#adminmenu .wp-not-current-submenu li > a,
.folded #adminmenu .wp-has-current-submenu li > a {
padding-left: 16px;
padding-right: 14px;
/* Exclude from the transition the outline for Windows High Contrast mode */
transition: all .1s ease-in-out, outline 0s;
}
#adminmenu .wp-has-current-submenu ul > li > a,
.folded #adminmenu li.menu-top .wp-submenu > li > a {
padding: 5px 12px;
}
#adminmenu a.menu-top,
#adminmenu .wp-submenu-head {
font-size: 14px;
font-weight: 400;
line-height: 1.3;
padding: 0;
}
#adminmenu .wp-submenu-head {
display: none;
}
.folded #adminmenu .wp-menu-name {
position: absolute;
right: -999px;
}
.folded #adminmenu .wp-submenu-head {
display: block;
}
#adminmenu .wp-submenu li {
padding: 0;
margin: 0;
}
#adminmenu .wp-menu-image img {
padding: 9px 0 0;
opacity: 0.6;
filter: alpha(opacity=60);
}
#adminmenu div.wp-menu-name {
padding: 8px 36px 8px 8px;
overflow-wrap: break-word;
word-wrap: break-word;
-ms-word-break: break-all;
word-break: break-word;
-webkit-hyphens: auto;
hyphens: auto;
}
#adminmenu div.wp-menu-image {
float: right;
width: 36px;
height: 34px;
margin: 0;
text-align: center;
}
#adminmenu div.wp-menu-image.svg {
background-repeat: no-repeat;
background-position: center;
background-size: 20px auto;
}
div.wp-menu-image:before {
color: #a7aaad;
color: rgba(240, 246, 252, 0.6);
padding: 7px 0;
transition: all .1s ease-in-out;
}
#adminmenu div.wp-menu-image:before {
color: #a7aaad;
color: rgba(240, 246, 252, 0.6);
}
#adminmenu li.wp-has-current-submenu:hover div.wp-menu-image:before,
#adminmenu .wp-has-current-submenu div.wp-menu-image:before,
#adminmenu .current div.wp-menu-image:before,
#adminmenu a.wp-has-current-submenu:hover div.wp-menu-image:before,
#adminmenu a.current:hover div.wp-menu-image:before,
#adminmenu li.wp-has-current-submenu a:focus div.wp-menu-image:before,
#adminmenu li.wp-has-current-submenu.opensub div.wp-menu-image:before {
color: #fff;
}
#adminmenu li:hover div.wp-menu-image:before,
#adminmenu li a:focus div.wp-menu-image:before,
#adminmenu li.opensub div.wp-menu-image:before {
color: #72aee6;
}
.folded #adminmenu div.wp-menu-image {
width: 35px;
height: 30px;
position: absolute;
z-index: 25;
}
.folded #adminmenu a.menu-top {
height: 34px;
}
/* Sticky admin menu */
.sticky-menu #adminmenuwrap {
position: fixed;
}
/* A new arrow */
.wp-menu-arrow {
display: none !important;
}
ul#adminmenu a.wp-has-current-submenu {
position: relative;
}
ul#adminmenu a.wp-has-current-submenu:after,
ul#adminmenu > li.current > a.current:after {
left: 0;
border: solid 8px transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-left-color: #f0f0f1;
top: 50%;
margin-top: -8px;
}
.folded ul#adminmenu li:hover a.wp-has-current-submenu:after,
.folded ul#adminmenu li.wp-has-current-submenu:focus-within a.wp-has-current-submenu:after {
display: none;
}
.folded ul#adminmenu a.wp-has-current-submenu:after,
.folded ul#adminmenu > li a.current:after {
border-width: 4px;
margin-top: -4px;
}
/* flyout menu arrow */
#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after,
#adminmenu li.wp-has-submenu.wp-not-current-submenu:focus-within:after {
left: 0;
border: 8px solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
top: 10px;
z-index: 10000;
}
.folded ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after,
.folded ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:focus-within:after {
border-width: 4px;
margin-top: -4px;
top: 18px;
}
#adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after,
#adminmenu li.wp-has-submenu.wp-not-current-submenu:focus-within:after {
border-left-color: #2c3338;
}
#adminmenu li.menu-top:hover .wp-menu-image img,
#adminmenu li.wp-has-current-submenu .wp-menu-image img {
opacity: 1;
filter: alpha(opacity=100);
}
#adminmenu li.wp-menu-separator {
height: 5px;
padding: 0;
margin: 0 0 6px;
cursor: inherit;
}
/* @todo: is this even needed given that it's nested beneath the above li.wp-menu-separator? */
#adminmenu div.separator {
height: 2px;
padding: 0;
}
#adminmenu .wp-submenu .wp-submenu-head {
color: #fff;
font-weight: 400;
font-size: 14px;
padding: 5px 11px 5px 4px;
margin: -7px -5px 4px 0;
border-width: 3px 5px 3px 0;
border-style: solid;
border-color: transparent;
}
#adminmenu li.current,
.folded #adminmenu li.wp-menu-open {
border: 0 none;
}
/* @todo: consider to use a single rule for these counters and the list table comments counters. */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod,
#adminmenu .update-plugins {
display: inline-block;
vertical-align: top;
box-sizing: border-box;
margin: 1px 2px -1px 0;
padding: 0 5px;
min-width: 18px;
height: 18px;
border-radius: 9px;
background-color: #d63638;
color: #fff;
font-size: 11px;
line-height: 1.6;
text-align: center;
z-index: 26;
}
#adminmenu li.current a .awaiting-mod,
#adminmenu li a.wp-has-current-submenu .update-plugins {
background-color: #d63638;
color: #fff;
}
#adminmenu li span.count-0 {
display: none;
}
#collapse-button {
display: block;
width: 100%;
height: 34px;
margin: 0;
border: none;
padding: 0;
position: relative;
overflow: visible;
background: none;
color: #a7aaad;
cursor: pointer;
}
#collapse-button:hover {
color: #72aee6;
}
#collapse-button:focus {
color: #72aee6;
/* Only visible in Windows High Contrast mode */
outline: 1px solid transparent;
outline-offset: -1px;
}
#collapse-button .collapse-button-icon,
#collapse-button .collapse-button-label {
/* absolutely positioned to avoid 1px shift in IE when button is pressed */
display: block;
position: absolute;
top: 0;
right: 0;
}
#collapse-button .collapse-button-label {
top: 8px;
}
#collapse-button .collapse-button-icon {
width: 36px;
height: 34px;
}
#collapse-button .collapse-button-label {
padding: 0 36px 0 0;
}
.folded #collapse-button .collapse-button-label {
display: none;
}
#collapse-button .collapse-button-icon:after {
content: "\f148";
display: block;
position: relative;
top: 7px;
text-align: center;
font: normal 20px/1 dashicons !important;
speak: never;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* rtl:ignore */
.folded #collapse-button .collapse-button-icon:after,
.rtl #collapse-button .collapse-button-icon:after {
transform: rotate(180deg);
}
.rtl.folded #collapse-button .collapse-button-icon:after {
transform: none;
}
#collapse-button .collapse-button-icon:after,
#collapse-button .collapse-button-label {
transition: all .1s ease-in-out;
}
/**
* Toolbar menu toggle
*/
li#wp-admin-bar-menu-toggle {
display: none;
}
/* Hide-if-customize for items we can't add classes to */
.customize-support #menu-appearance a[href="themes.php?page=custom-header"],
.customize-support #menu-appearance a[href="themes.php?page=custom-background"] {
display: none;
}
/* Auto-folding of the admin menu */
@media only screen and (max-width: 960px) {
.auto-fold #wpcontent,
.auto-fold #wpfooter {
margin-right: 36px;
}
.auto-fold #adminmenuback,
.auto-fold #adminmenuwrap,
.auto-fold #adminmenu,
.auto-fold #adminmenu li.menu-top {
width: 36px;
}
.auto-fold #adminmenu .wp-submenu.sub-open,
.auto-fold #adminmenu .opensub .wp-submenu,
.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu.sub-open,
.auto-fold #adminmenu .wp-has-current-submenu.opensub .wp-submenu,
.auto-fold #adminmenu a.menu-top:focus + .wp-submenu,
.auto-fold #adminmenu .wp-has-current-submenu a.menu-top:focus + .wp-submenu {
top: 0;
right: 36px;
}
.auto-fold #adminmenu a.wp-has-current-submenu:focus + .wp-submenu,
.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu {
position: absolute;
top: -1000em;
margin-left: -1px;
padding: 7px 0 8px;
z-index: 9999;
}
.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu {
min-width: 150px;
width: auto;
}
.auto-fold #adminmenu .wp-has-current-submenu li > a {
padding-left: 16px;
padding-right: 14px;
}
.auto-fold #adminmenu li.menu-top .wp-submenu > li > a {
padding-right: 12px;
}
.auto-fold #adminmenu .wp-menu-name {
position: absolute;
right: -999px;
}
.auto-fold #adminmenu .wp-submenu-head {
display: block;
}
.auto-fold #adminmenu div.wp-menu-image {
height: 30px;
width: 34px;
position: absolute;
z-index: 25;
}
.auto-fold #adminmenu a.menu-top {
min-height: 34px;
}
.auto-fold #adminmenu li.wp-menu-open {
border: 0 none;
}
.auto-fold #adminmenu .wp-has-current-submenu.menu-top-last {
margin-bottom: 0;
}
.auto-fold ul#adminmenu li:hover a.wp-has-current-submenu:after,
.auto-fold ul#adminmenu li:focus-within a.wp-has-current-submenu:after {
display: none;
}
.auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after,
.auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:focus-within:after {
border-width: 4px;
margin-top: -4px;
top: 16px;
}
.auto-fold ul#adminmenu a.wp-has-current-submenu:after,
.auto-fold ul#adminmenu > li a.current:after {
border-width: 4px;
margin-top: -4px;
}
.auto-fold #adminmenu li.menu-top:hover,
.auto-fold #adminmenu li.opensub > a.menu-top,
.auto-fold #adminmenu li > a.menu-top:focus {
z-index: 10000;
}
.auto-fold #collapse-menu .collapse-button-label {
display: none;
}
/* rtl:ignore */
.auto-fold #collapse-button .collapse-button-icon:after {
transform: rotate(180deg);
}
.rtl.auto-fold #collapse-button .collapse-button-icon:after {
transform: none;
}
}
@media screen and (max-width: 782px) {
.auto-fold #wpcontent {
position: relative;
margin-right: 0;
padding-right: 10px;
}
.sticky-menu #adminmenuwrap {
position: relative;
z-index: auto;
top: 0;
}
/* Sidebar Adjustments */
.auto-fold #adminmenu,
.auto-fold #adminmenuback,
.auto-fold #adminmenuwrap {
position: absolute;
width: 190px;
z-index: 100;
}
.auto-fold #adminmenuback {
position: fixed;
}
.auto-fold #adminmenuback,
.auto-fold #adminmenuwrap {
display: none;
}
.auto-fold .wp-responsive-open #adminmenuback,
.auto-fold .wp-responsive-open #adminmenuwrap {
display: block;
}
.auto-fold #adminmenu li.menu-top {
width: 100%;
}
/* Resize the admin menu items to a comfortable touch size */
.auto-fold #adminmenu li a {
font-size: 16px;
padding: 5px;
}
.auto-fold #adminmenu li.menu-top .wp-submenu > li > a {
padding: 10px 20px 10px 10px;
}
/* Restore the menu names */
.auto-fold #adminmenu .wp-menu-name {
position: static;
}
/* Switch the arrow side */
.auto-fold ul#adminmenu a.wp-has-current-submenu:after,
.auto-fold ul#adminmenu > li.current > a.current:after {
border-width: 8px;
margin-top: -8px;
}
.auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after,
.auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:focus-within:after {
display: none;
}
/* Make the submenus appear correctly when tapped. */
#adminmenu .wp-submenu {
position: relative;
display: none;
}
.auto-fold #adminmenu .selected .wp-submenu,
.auto-fold #adminmenu .wp-menu-open .wp-submenu {
position: relative;
display: block;
top: 0;
right: -1px;
box-shadow: none;
}
.auto-fold #adminmenu .selected .wp-submenu:after,
.auto-fold #adminmenu .wp-menu-open .wp-submenu:after {
display: none;
}
.auto-fold #adminmenu .opensub .wp-submenu {
display: none;
}
.auto-fold #adminmenu .selected .wp-submenu {
display: block;
}
.auto-fold ul#adminmenu li:hover a.wp-has-current-submenu:after,
.auto-fold ul#adminmenu li:focus-within a.wp-has-current-submenu:after {
display: block;
}
.auto-fold #adminmenu a.menu-top:focus + .wp-submenu,
.auto-fold #adminmenu .wp-has-current-submenu a.menu-top:focus + .wp-submenu {
position: relative;
right: -1px;
left: 0;
top: 0;
}
#adminmenu .wp-not-current-submenu .wp-submenu,
.folded #adminmenu .wp-has-current-submenu .wp-submenu {
border-right: none;
}
/* Remove submenu headers and adjust sub meu*/
#adminmenu .wp-submenu .wp-submenu-head {
display: none;
}
/* Toolbar menu toggle */
#wp-responsive-toggle {
position: fixed;
top: 5px;
right: 4px;
padding-left: 10px;
z-index: 99999;
border: none;
box-sizing: border-box;
}
#wpadminbar #wp-admin-bar-menu-toggle a {
display: block;
padding: 0;
overflow: hidden;
outline: none;
text-decoration: none;
border: 1px solid transparent;
background: none;
height: 44px;
margin-right: -1px;
}
.wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle a {
background: #2c3338;
}
li#wp-admin-bar-menu-toggle {
display: block;
}
#wpadminbar #wp-admin-bar-menu-toggle a:hover {
border: 1px solid transparent;
}
#wpadminbar #wp-admin-bar-menu-toggle .ab-icon:before {
content: "\f228";
display: inline-block;
float: right;
font: normal 40px/45px dashicons;
vertical-align: middle;
outline: none;
margin: 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
height: 44px;
width: 50px;
padding: 0;
border: none;
text-align: center;
text-decoration: none;
box-sizing: border-box;
}
.wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle .ab-icon:before {
color: #72aee6;
}
}
/* Smartphone */
@media screen and (max-width: 600px) {
#adminmenuwrap,
#adminmenuback {
display: none;
}
.wp-responsive-open #adminmenuwrap,
.wp-responsive-open #adminmenuback {
display: block;
}
.auto-fold #adminmenu {
top: 46px;
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,857 @@
#adminmenuback,
#adminmenuwrap,
#adminmenu,
#adminmenu .wp-submenu {
width: 160px;
background-color: #1d2327;
}
#adminmenuback {
position: fixed;
top: 0;
bottom: -120px;
z-index: 1; /* positive z-index to avoid elastic scrolling woes in Safari */
}
.php-error #adminmenuback {
position: absolute;
}
.php-error #adminmenuback,
.php-error #adminmenuwrap {
margin-top: 2em;
}
#adminmenu {
clear: left;
margin: 12px 0;
padding: 0;
list-style: none;
}
.folded #adminmenuback,
.folded #adminmenuwrap,
.folded #adminmenu,
.folded #adminmenu li.menu-top {
width: 36px;
}
/* New Menu icons */
/* hide background-image for icons above */
.menu-icon-dashboard div.wp-menu-image,
.menu-icon-post div.wp-menu-image,
.menu-icon-media div.wp-menu-image,
.menu-icon-links div.wp-menu-image,
.menu-icon-page div.wp-menu-image,
.menu-icon-comments div.wp-menu-image,
.menu-icon-appearance div.wp-menu-image,
.menu-icon-plugins div.wp-menu-image,
.menu-icon-users div.wp-menu-image,
.menu-icon-tools div.wp-menu-image,
.menu-icon-settings div.wp-menu-image,
.menu-icon-site div.wp-menu-image,
.menu-icon-generic div.wp-menu-image {
background-image: none !important;
}
/*------------------------------------------------------------------------------
7.0 - Main Navigation (Left Menu)
------------------------------------------------------------------------------*/
#adminmenuwrap {
position: relative;
float: left;
z-index: 9990;
}
/* side admin menu */
#adminmenu * {
-webkit-user-select: none;
user-select: none;
}
#adminmenu li {
margin: 0;
padding: 0;
}
#adminmenu a {
display: block;
line-height: 1.3;
padding: 2px 5px;
color: #f0f0f1;
}
#adminmenu .wp-submenu a {
color: #c3c4c7;
color: rgba(240, 246, 252, 0.7);
font-size: 13px;
line-height: 1.4;
margin: 0;
padding: 5px 0;
}
#adminmenu .wp-submenu a:hover,
#adminmenu .wp-submenu a:focus {
background: none;
}
#adminmenu a:hover,
#adminmenu li.menu-top > a:focus,
#adminmenu .wp-submenu a:hover,
#adminmenu .wp-submenu a:focus {
color: #72aee6;
}
#adminmenu a:hover,
#adminmenu a:focus,
.folded #adminmenu .wp-submenu-head:hover {
box-shadow: inset 4px 0 0 0 currentColor;
transition: box-shadow .1s linear;
}
#adminmenu li.menu-top {
border: none;
min-height: 34px;
position: relative;
}
#adminmenu .wp-submenu {
list-style: none;
position: absolute;
top: -1000em;
left: 160px;
overflow: visible;
word-wrap: break-word;
padding: 7px 0 8px;
z-index: 9999;
background-color: #2c3338;
box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
}
.js #adminmenu .sub-open,
.js #adminmenu .opensub .wp-submenu,
#adminmenu a.menu-top:focus + .wp-submenu,
.no-js li.wp-has-submenu:hover .wp-submenu {
top: -1px;
}
#adminmenu a.wp-has-current-submenu:focus + .wp-submenu {
top: 0;
}
#adminmenu .wp-has-current-submenu .wp-submenu,
.no-js li.wp-has-current-submenu:hover .wp-submenu,
#adminmenu .wp-has-current-submenu .wp-submenu.sub-open,
#adminmenu .wp-has-current-submenu.opensub .wp-submenu {
position: relative;
z-index: 3;
top: auto;
left: auto;
right: auto;
bottom: auto;
border: 0 none;
margin-top: 0;
box-shadow: none;
}
.folded #adminmenu .wp-has-current-submenu .wp-submenu {
box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
}
/* ensure that wp-submenu's box shadow doesn't appear on top of the focused menu item's background. */
#adminmenu li.menu-top:hover,
#adminmenu li.opensub > a.menu-top,
#adminmenu li > a.menu-top:focus {
position: relative;
background-color: #1d2327;
color: #72aee6;
}
.folded #adminmenu li.menu-top:hover,
.folded #adminmenu li.opensub > a.menu-top,
.folded #adminmenu li > a.menu-top:focus {
z-index: 10000;
}
#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,
#adminmenu li.current a.menu-top,
#adminmenu .wp-menu-arrow,
#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head,
#adminmenu .wp-menu-arrow div {
background: #2271b1;
color: #fff;
}
.folded #adminmenu .wp-submenu.sub-open,
.folded #adminmenu .opensub .wp-submenu,
.folded #adminmenu .wp-has-current-submenu .wp-submenu.sub-open,
.folded #adminmenu .wp-has-current-submenu.opensub .wp-submenu,
.folded #adminmenu a.menu-top:focus + .wp-submenu,
.folded #adminmenu .wp-has-current-submenu a.menu-top:focus + .wp-submenu,
.no-js.folded #adminmenu .wp-has-submenu:hover .wp-submenu {
top: 0;
left: 36px;
}
.folded #adminmenu a.wp-has-current-submenu:focus + .wp-submenu,
.folded #adminmenu .wp-has-current-submenu .wp-submenu {
position: absolute;
top: -1000em;
}
#adminmenu .wp-not-current-submenu .wp-submenu,
.folded #adminmenu .wp-has-current-submenu .wp-submenu {
min-width: 160px;
width: auto;
border-left: 5px solid transparent;
}
#adminmenu .wp-submenu li.current,
#adminmenu .wp-submenu li.current a,
#adminmenu .opensub .wp-submenu li.current a,
#adminmenu a.wp-has-current-submenu:focus + .wp-submenu li.current a,
#adminmenu .wp-submenu li.current a:hover,
#adminmenu .wp-submenu li.current a:focus {
color: #fff;
}
#adminmenu .wp-not-current-submenu li > a,
.folded #adminmenu .wp-has-current-submenu li > a {
padding-right: 16px;
padding-left: 14px;
/* Exclude from the transition the outline for Windows High Contrast mode */
transition: all .1s ease-in-out, outline 0s;
}
#adminmenu .wp-has-current-submenu ul > li > a,
.folded #adminmenu li.menu-top .wp-submenu > li > a {
padding: 5px 12px;
}
#adminmenu a.menu-top,
#adminmenu .wp-submenu-head {
font-size: 14px;
font-weight: 400;
line-height: 1.3;
padding: 0;
}
#adminmenu .wp-submenu-head {
display: none;
}
.folded #adminmenu .wp-menu-name {
position: absolute;
left: -999px;
}
.folded #adminmenu .wp-submenu-head {
display: block;
}
#adminmenu .wp-submenu li {
padding: 0;
margin: 0;
}
#adminmenu .wp-menu-image img {
padding: 9px 0 0;
opacity: 0.6;
filter: alpha(opacity=60);
}
#adminmenu div.wp-menu-name {
padding: 8px 8px 8px 36px;
overflow-wrap: break-word;
word-wrap: break-word;
-ms-word-break: break-all;
word-break: break-word;
-webkit-hyphens: auto;
hyphens: auto;
}
#adminmenu div.wp-menu-image {
float: left;
width: 36px;
height: 34px;
margin: 0;
text-align: center;
}
#adminmenu div.wp-menu-image.svg {
background-repeat: no-repeat;
background-position: center;
background-size: 20px auto;
}
div.wp-menu-image:before {
color: #a7aaad;
color: rgba(240, 246, 252, 0.6);
padding: 7px 0;
transition: all .1s ease-in-out;
}
#adminmenu div.wp-menu-image:before {
color: #a7aaad;
color: rgba(240, 246, 252, 0.6);
}
#adminmenu li.wp-has-current-submenu:hover div.wp-menu-image:before,
#adminmenu .wp-has-current-submenu div.wp-menu-image:before,
#adminmenu .current div.wp-menu-image:before,
#adminmenu a.wp-has-current-submenu:hover div.wp-menu-image:before,
#adminmenu a.current:hover div.wp-menu-image:before,
#adminmenu li.wp-has-current-submenu a:focus div.wp-menu-image:before,
#adminmenu li.wp-has-current-submenu.opensub div.wp-menu-image:before {
color: #fff;
}
#adminmenu li:hover div.wp-menu-image:before,
#adminmenu li a:focus div.wp-menu-image:before,
#adminmenu li.opensub div.wp-menu-image:before {
color: #72aee6;
}
.folded #adminmenu div.wp-menu-image {
width: 35px;
height: 30px;
position: absolute;
z-index: 25;
}
.folded #adminmenu a.menu-top {
height: 34px;
}
/* Sticky admin menu */
.sticky-menu #adminmenuwrap {
position: fixed;
}
/* A new arrow */
.wp-menu-arrow {
display: none !important;
}
ul#adminmenu a.wp-has-current-submenu {
position: relative;
}
ul#adminmenu a.wp-has-current-submenu:after,
ul#adminmenu > li.current > a.current:after {
right: 0;
border: solid 8px transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-right-color: #f0f0f1;
top: 50%;
margin-top: -8px;
}
.folded ul#adminmenu li:hover a.wp-has-current-submenu:after,
.folded ul#adminmenu li.wp-has-current-submenu:focus-within a.wp-has-current-submenu:after {
display: none;
}
.folded ul#adminmenu a.wp-has-current-submenu:after,
.folded ul#adminmenu > li a.current:after {
border-width: 4px;
margin-top: -4px;
}
/* flyout menu arrow */
#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after,
#adminmenu li.wp-has-submenu.wp-not-current-submenu:focus-within:after {
right: 0;
border: 8px solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
top: 10px;
z-index: 10000;
}
.folded ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after,
.folded ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:focus-within:after {
border-width: 4px;
margin-top: -4px;
top: 18px;
}
#adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after,
#adminmenu li.wp-has-submenu.wp-not-current-submenu:focus-within:after {
border-right-color: #2c3338;
}
#adminmenu li.menu-top:hover .wp-menu-image img,
#adminmenu li.wp-has-current-submenu .wp-menu-image img {
opacity: 1;
filter: alpha(opacity=100);
}
#adminmenu li.wp-menu-separator {
height: 5px;
padding: 0;
margin: 0 0 6px;
cursor: inherit;
}
/* @todo: is this even needed given that it's nested beneath the above li.wp-menu-separator? */
#adminmenu div.separator {
height: 2px;
padding: 0;
}
#adminmenu .wp-submenu .wp-submenu-head {
color: #fff;
font-weight: 400;
font-size: 14px;
padding: 5px 4px 5px 11px;
margin: -7px 0 4px -5px;
border-width: 3px 0 3px 5px;
border-style: solid;
border-color: transparent;
}
#adminmenu li.current,
.folded #adminmenu li.wp-menu-open {
border: 0 none;
}
/* @todo: consider to use a single rule for these counters and the list table comments counters. */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod,
#adminmenu .update-plugins {
display: inline-block;
vertical-align: top;
box-sizing: border-box;
margin: 1px 0 -1px 2px;
padding: 0 5px;
min-width: 18px;
height: 18px;
border-radius: 9px;
background-color: #d63638;
color: #fff;
font-size: 11px;
line-height: 1.6;
text-align: center;
z-index: 26;
}
#adminmenu li.current a .awaiting-mod,
#adminmenu li a.wp-has-current-submenu .update-plugins {
background-color: #d63638;
color: #fff;
}
#adminmenu li span.count-0 {
display: none;
}
#collapse-button {
display: block;
width: 100%;
height: 34px;
margin: 0;
border: none;
padding: 0;
position: relative;
overflow: visible;
background: none;
color: #a7aaad;
cursor: pointer;
}
#collapse-button:hover {
color: #72aee6;
}
#collapse-button:focus {
color: #72aee6;
/* Only visible in Windows High Contrast mode */
outline: 1px solid transparent;
outline-offset: -1px;
}
#collapse-button .collapse-button-icon,
#collapse-button .collapse-button-label {
/* absolutely positioned to avoid 1px shift in IE when button is pressed */
display: block;
position: absolute;
top: 0;
left: 0;
}
#collapse-button .collapse-button-label {
top: 8px;
}
#collapse-button .collapse-button-icon {
width: 36px;
height: 34px;
}
#collapse-button .collapse-button-label {
padding: 0 0 0 36px;
}
.folded #collapse-button .collapse-button-label {
display: none;
}
#collapse-button .collapse-button-icon:after {
content: "\f148";
display: block;
position: relative;
top: 7px;
text-align: center;
font: normal 20px/1 dashicons !important;
speak: never;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* rtl:ignore */
.folded #collapse-button .collapse-button-icon:after,
.rtl #collapse-button .collapse-button-icon:after {
transform: rotate(180deg);
}
.rtl.folded #collapse-button .collapse-button-icon:after {
transform: none;
}
#collapse-button .collapse-button-icon:after,
#collapse-button .collapse-button-label {
transition: all .1s ease-in-out;
}
/**
* Toolbar menu toggle
*/
li#wp-admin-bar-menu-toggle {
display: none;
}
/* Hide-if-customize for items we can't add classes to */
.customize-support #menu-appearance a[href="themes.php?page=custom-header"],
.customize-support #menu-appearance a[href="themes.php?page=custom-background"] {
display: none;
}
/* Auto-folding of the admin menu */
@media only screen and (max-width: 960px) {
.auto-fold #wpcontent,
.auto-fold #wpfooter {
margin-left: 36px;
}
.auto-fold #adminmenuback,
.auto-fold #adminmenuwrap,
.auto-fold #adminmenu,
.auto-fold #adminmenu li.menu-top {
width: 36px;
}
.auto-fold #adminmenu .wp-submenu.sub-open,
.auto-fold #adminmenu .opensub .wp-submenu,
.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu.sub-open,
.auto-fold #adminmenu .wp-has-current-submenu.opensub .wp-submenu,
.auto-fold #adminmenu a.menu-top:focus + .wp-submenu,
.auto-fold #adminmenu .wp-has-current-submenu a.menu-top:focus + .wp-submenu {
top: 0;
left: 36px;
}
.auto-fold #adminmenu a.wp-has-current-submenu:focus + .wp-submenu,
.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu {
position: absolute;
top: -1000em;
margin-right: -1px;
padding: 7px 0 8px;
z-index: 9999;
}
.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu {
min-width: 150px;
width: auto;
}
.auto-fold #adminmenu .wp-has-current-submenu li > a {
padding-right: 16px;
padding-left: 14px;
}
.auto-fold #adminmenu li.menu-top .wp-submenu > li > a {
padding-left: 12px;
}
.auto-fold #adminmenu .wp-menu-name {
position: absolute;
left: -999px;
}
.auto-fold #adminmenu .wp-submenu-head {
display: block;
}
.auto-fold #adminmenu div.wp-menu-image {
height: 30px;
width: 34px;
position: absolute;
z-index: 25;
}
.auto-fold #adminmenu a.menu-top {
min-height: 34px;
}
.auto-fold #adminmenu li.wp-menu-open {
border: 0 none;
}
.auto-fold #adminmenu .wp-has-current-submenu.menu-top-last {
margin-bottom: 0;
}
.auto-fold ul#adminmenu li:hover a.wp-has-current-submenu:after,
.auto-fold ul#adminmenu li:focus-within a.wp-has-current-submenu:after {
display: none;
}
.auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after,
.auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:focus-within:after {
border-width: 4px;
margin-top: -4px;
top: 16px;
}
.auto-fold ul#adminmenu a.wp-has-current-submenu:after,
.auto-fold ul#adminmenu > li a.current:after {
border-width: 4px;
margin-top: -4px;
}
.auto-fold #adminmenu li.menu-top:hover,
.auto-fold #adminmenu li.opensub > a.menu-top,
.auto-fold #adminmenu li > a.menu-top:focus {
z-index: 10000;
}
.auto-fold #collapse-menu .collapse-button-label {
display: none;
}
/* rtl:ignore */
.auto-fold #collapse-button .collapse-button-icon:after {
transform: rotate(180deg);
}
.rtl.auto-fold #collapse-button .collapse-button-icon:after {
transform: none;
}
}
@media screen and (max-width: 782px) {
.auto-fold #wpcontent {
position: relative;
margin-left: 0;
padding-left: 10px;
}
.sticky-menu #adminmenuwrap {
position: relative;
z-index: auto;
top: 0;
}
/* Sidebar Adjustments */
.auto-fold #adminmenu,
.auto-fold #adminmenuback,
.auto-fold #adminmenuwrap {
position: absolute;
width: 190px;
z-index: 100;
}
.auto-fold #adminmenuback {
position: fixed;
}
.auto-fold #adminmenuback,
.auto-fold #adminmenuwrap {
display: none;
}
.auto-fold .wp-responsive-open #adminmenuback,
.auto-fold .wp-responsive-open #adminmenuwrap {
display: block;
}
.auto-fold #adminmenu li.menu-top {
width: 100%;
}
/* Resize the admin menu items to a comfortable touch size */
.auto-fold #adminmenu li a {
font-size: 16px;
padding: 5px;
}
.auto-fold #adminmenu li.menu-top .wp-submenu > li > a {
padding: 10px 10px 10px 20px;
}
/* Restore the menu names */
.auto-fold #adminmenu .wp-menu-name {
position: static;
}
/* Switch the arrow side */
.auto-fold ul#adminmenu a.wp-has-current-submenu:after,
.auto-fold ul#adminmenu > li.current > a.current:after {
border-width: 8px;
margin-top: -8px;
}
.auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after,
.auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:focus-within:after {
display: none;
}
/* Make the submenus appear correctly when tapped. */
#adminmenu .wp-submenu {
position: relative;
display: none;
}
.auto-fold #adminmenu .selected .wp-submenu,
.auto-fold #adminmenu .wp-menu-open .wp-submenu {
position: relative;
display: block;
top: 0;
left: -1px;
box-shadow: none;
}
.auto-fold #adminmenu .selected .wp-submenu:after,
.auto-fold #adminmenu .wp-menu-open .wp-submenu:after {
display: none;
}
.auto-fold #adminmenu .opensub .wp-submenu {
display: none;
}
.auto-fold #adminmenu .selected .wp-submenu {
display: block;
}
.auto-fold ul#adminmenu li:hover a.wp-has-current-submenu:after,
.auto-fold ul#adminmenu li:focus-within a.wp-has-current-submenu:after {
display: block;
}
.auto-fold #adminmenu a.menu-top:focus + .wp-submenu,
.auto-fold #adminmenu .wp-has-current-submenu a.menu-top:focus + .wp-submenu {
position: relative;
left: -1px;
right: 0;
top: 0;
}
#adminmenu .wp-not-current-submenu .wp-submenu,
.folded #adminmenu .wp-has-current-submenu .wp-submenu {
border-left: none;
}
/* Remove submenu headers and adjust sub meu*/
#adminmenu .wp-submenu .wp-submenu-head {
display: none;
}
/* Toolbar menu toggle */
#wp-responsive-toggle {
position: fixed;
top: 5px;
left: 4px;
padding-right: 10px;
z-index: 99999;
border: none;
box-sizing: border-box;
}
#wpadminbar #wp-admin-bar-menu-toggle a {
display: block;
padding: 0;
overflow: hidden;
outline: none;
text-decoration: none;
border: 1px solid transparent;
background: none;
height: 44px;
margin-left: -1px;
}
.wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle a {
background: #2c3338;
}
li#wp-admin-bar-menu-toggle {
display: block;
}
#wpadminbar #wp-admin-bar-menu-toggle a:hover {
border: 1px solid transparent;
}
#wpadminbar #wp-admin-bar-menu-toggle .ab-icon:before {
content: "\f228";
display: inline-block;
float: left;
font: normal 40px/45px dashicons;
vertical-align: middle;
outline: none;
margin: 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
height: 44px;
width: 50px;
padding: 0;
border: none;
text-align: center;
text-decoration: none;
box-sizing: border-box;
}
.wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle .ab-icon:before {
color: #72aee6;
}
}
/* Smartphone */
@media screen and (max-width: 600px) {
#adminmenuwrap,
#adminmenuback {
display: none;
}
.wp-responsive-open #adminmenuwrap,
.wp-responsive-open #adminmenuback {
display: block;
}
.auto-fold #adminmenu {
top: 46px;
}
}

2
wp/wp-admin/css/admin-menu.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,77 @@
/*! This file is auto-generated */
.wrap [class*="CodeMirror-lint-marker"],
.wp-core-ui [class*="CodeMirror-lint-message"],
.wrap .CodeMirror-lint-marker-multiple {
background-image: none;
}
.wp-core-ui .CodeMirror-lint-marker-error,
.wp-core-ui .CodeMirror-lint-marker-warning {
cursor: help;
}
.wrap .CodeMirror-lint-marker-multiple {
position: absolute;
top: 0;
}
.wrap [class*="CodeMirror-lint-marker"]:before {
font: normal 18px/1 dashicons;
position: relative;
top: -2px;
}
.wp-core-ui [class*="CodeMirror-lint-message"]:before {
font: normal 16px/1 dashicons;
right: 16px;
position: absolute;
}
.wp-core-ui .CodeMirror-lint-message-error,
.wp-core-ui .CodeMirror-lint-message-warning {
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
margin: 5px 0 2px;
padding: 3px 28px 3px 12px;
}
.wp-core-ui .CodeMirror-lint-message-warning {
background-color: #fcf9e8;
border-right: 4px solid #dba617;
}
.wrap .CodeMirror-lint-marker-warning:before,
.wp-core-ui .CodeMirror-lint-message-warning:before {
content: "\f534";
color: #dba617;
}
.wp-core-ui .CodeMirror-lint-message-error {
background-color: #fcf0f1;
border-right: 4px solid #d63638;
}
.wrap .CodeMirror-lint-marker-error:before,
.wp-core-ui .CodeMirror-lint-message-error:before {
content: "\f153";
color: #d63638;
}
.wp-core-ui .CodeMirror-lint-tooltip {
background: none;
border: none;
border-radius: 0;
direction: rtl;
}
.wrap .CodeMirror .CodeMirror-matchingbracket {
background: rgba(219, 166, 23, 0.3);
color: inherit;
}
.CodeMirror {
text-align: right;
}
.wrap .CodeMirror .CodeMirror-linenumber {
color: #646970;
}

View File

@@ -0,0 +1,2 @@
/*! This file is auto-generated */
.wp-core-ui [class*=CodeMirror-lint-message],.wrap .CodeMirror-lint-marker-multiple,.wrap [class*=CodeMirror-lint-marker]{background-image:none}.wp-core-ui .CodeMirror-lint-marker-error,.wp-core-ui .CodeMirror-lint-marker-warning{cursor:help}.wrap .CodeMirror-lint-marker-multiple{position:absolute;top:0}.wrap [class*=CodeMirror-lint-marker]:before{font:normal 18px/1 dashicons;position:relative;top:-2px}.wp-core-ui [class*=CodeMirror-lint-message]:before{font:normal 16px/1 dashicons;right:16px;position:absolute}.wp-core-ui .CodeMirror-lint-message-error,.wp-core-ui .CodeMirror-lint-message-warning{box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 0 2px;padding:3px 28px 3px 12px}.wp-core-ui .CodeMirror-lint-message-warning{background-color:#fcf9e8;border-right:4px solid #dba617}.wp-core-ui .CodeMirror-lint-message-warning:before,.wrap .CodeMirror-lint-marker-warning:before{content:"\f534";color:#dba617}.wp-core-ui .CodeMirror-lint-message-error{background-color:#fcf0f1;border-right:4px solid #d63638}.wp-core-ui .CodeMirror-lint-message-error:before,.wrap .CodeMirror-lint-marker-error:before{content:"\f153";color:#d63638}.wp-core-ui .CodeMirror-lint-tooltip{background:0 0;border:none;border-radius:0;direction:rtl}.wrap .CodeMirror .CodeMirror-matchingbracket{background:rgba(219,166,23,.3);color:inherit}.CodeMirror{text-align:right}.wrap .CodeMirror .CodeMirror-linenumber{color:#646970}

View File

@@ -0,0 +1,76 @@
.wrap [class*="CodeMirror-lint-marker"],
.wp-core-ui [class*="CodeMirror-lint-message"],
.wrap .CodeMirror-lint-marker-multiple {
background-image: none;
}
.wp-core-ui .CodeMirror-lint-marker-error,
.wp-core-ui .CodeMirror-lint-marker-warning {
cursor: help;
}
.wrap .CodeMirror-lint-marker-multiple {
position: absolute;
top: 0;
}
.wrap [class*="CodeMirror-lint-marker"]:before {
font: normal 18px/1 dashicons;
position: relative;
top: -2px;
}
.wp-core-ui [class*="CodeMirror-lint-message"]:before {
font: normal 16px/1 dashicons;
left: 16px;
position: absolute;
}
.wp-core-ui .CodeMirror-lint-message-error,
.wp-core-ui .CodeMirror-lint-message-warning {
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
margin: 5px 0 2px;
padding: 3px 12px 3px 28px;
}
.wp-core-ui .CodeMirror-lint-message-warning {
background-color: #fcf9e8;
border-left: 4px solid #dba617;
}
.wrap .CodeMirror-lint-marker-warning:before,
.wp-core-ui .CodeMirror-lint-message-warning:before {
content: "\f534";
color: #dba617;
}
.wp-core-ui .CodeMirror-lint-message-error {
background-color: #fcf0f1;
border-left: 4px solid #d63638;
}
.wrap .CodeMirror-lint-marker-error:before,
.wp-core-ui .CodeMirror-lint-message-error:before {
content: "\f153";
color: #d63638;
}
.wp-core-ui .CodeMirror-lint-tooltip {
background: none;
border: none;
border-radius: 0;
direction: ltr;
}
.wrap .CodeMirror .CodeMirror-matchingbracket {
background: rgba(219, 166, 23, 0.3);
color: inherit;
}
.CodeMirror {
text-align: left;
}
.wrap .CodeMirror .CodeMirror-linenumber {
color: #646970;
}

2
wp/wp-admin/css/code-editor.min.css vendored Normal file
View File

@@ -0,0 +1,2 @@
/*! This file is auto-generated */
.wp-core-ui [class*=CodeMirror-lint-message],.wrap .CodeMirror-lint-marker-multiple,.wrap [class*=CodeMirror-lint-marker]{background-image:none}.wp-core-ui .CodeMirror-lint-marker-error,.wp-core-ui .CodeMirror-lint-marker-warning{cursor:help}.wrap .CodeMirror-lint-marker-multiple{position:absolute;top:0}.wrap [class*=CodeMirror-lint-marker]:before{font:normal 18px/1 dashicons;position:relative;top:-2px}.wp-core-ui [class*=CodeMirror-lint-message]:before{font:normal 16px/1 dashicons;left:16px;position:absolute}.wp-core-ui .CodeMirror-lint-message-error,.wp-core-ui .CodeMirror-lint-message-warning{box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 0 2px;padding:3px 12px 3px 28px}.wp-core-ui .CodeMirror-lint-message-warning{background-color:#fcf9e8;border-left:4px solid #dba617}.wp-core-ui .CodeMirror-lint-message-warning:before,.wrap .CodeMirror-lint-marker-warning:before{content:"\f534";color:#dba617}.wp-core-ui .CodeMirror-lint-message-error{background-color:#fcf0f1;border-left:4px solid #d63638}.wp-core-ui .CodeMirror-lint-message-error:before,.wrap .CodeMirror-lint-marker-error:before{content:"\f153";color:#d63638}.wp-core-ui .CodeMirror-lint-tooltip{background:0 0;border:none;border-radius:0;direction:ltr}.wrap .CodeMirror .CodeMirror-matchingbracket{background:rgba(219,166,23,.3);color:inherit}.CodeMirror{text-align:left}.wrap .CodeMirror .CodeMirror-linenumber{color:#646970}

View File

@@ -0,0 +1,183 @@
/*! This file is auto-generated */
/* rtl:ignore */
.wp-color-picker {
width: 80px;
direction: ltr;
}
.wp-picker-container .hidden {
display: none;
}
/* Needs higher specificiity. */
.wp-picker-container .wp-color-result.button {
min-height: 30px;
margin: 0 0 6px 6px;
padding: 0 30px 0 0;
font-size: 11px;
}
.wp-color-result-text {
background: #f6f7f7;
border-radius: 2px 0 0 2px;
border-right: 1px solid #c3c4c7;
color: #50575e;
display: block;
line-height: 2.54545455; /* 28px */
padding: 0 6px;
text-align: center;
}
.wp-color-result:hover,
.wp-color-result:focus {
background: #f6f7f7;
border-color: #8c8f94;
color: #1d2327;
}
.wp-color-result:hover:after,
.wp-color-result:focus:after {
color: #1d2327;
border-color: #a7aaad;
border-right: 1px solid #8c8f94;
}
.wp-picker-container {
display: inline-block;
}
.wp-color-result:focus {
border-color: #4f94d4;
box-shadow: 0 0 3px rgba(34, 113, 177, 0.8);
}
.wp-color-result:active {
/* See Trac ticket #39662 */
transform: none !important;
}
.wp-picker-open + .wp-picker-input-wrap {
display: inline-block;
vertical-align: top;
}
.wp-picker-input-wrap label {
display: inline-block;
vertical-align: top;
}
/* For the old `custom-background` page, to override the inline-block and margins from `.form-table td fieldset label`. */
.form-table .wp-picker-input-wrap label {
margin: 0 !important;
}
.wp-picker-input-wrap .button.wp-picker-default,
.wp-picker-input-wrap .button.wp-picker-clear,
.wp-customizer .wp-picker-input-wrap .button.wp-picker-default,
.wp-customizer .wp-picker-input-wrap .button.wp-picker-clear {
margin-right: 6px;
padding: 0 8px;
line-height: 2.54545455; /* 28px */
min-height: 30px;
}
.wp-picker-container .iris-square-slider .ui-slider-handle:focus {
background-color: #50575e
}
.wp-picker-container .iris-picker {
border-radius: 0;
border-color: #dcdcde;
margin-top: 6px;
}
.wp-picker-container input[type="text"].wp-color-picker {
width: 4rem;
font-size: 12px;
font-family: monospace;
line-height: 2.33333333; /* 28px */
margin: 0;
padding: 0 5px;
vertical-align: top;
min-height: 30px;
}
.wp-color-picker::-webkit-input-placeholder {
color: #646970;
}
.wp-color-picker::-moz-placeholder {
color: #646970;
opacity: 1;
}
.wp-color-picker:-ms-input-placeholder {
color: #646970;
}
.wp-picker-container input[type="text"].iris-error {
background-color: #fcf0f1;
border-color: #d63638;
color: #000;
}
.iris-picker .ui-square-handle:focus,
.iris-picker .iris-strip .ui-slider-handle:focus {
border-color: #3582c4;
border-style: solid;
box-shadow: 0 0 0 1px #3582c4;
outline: 2px solid transparent;
}
.iris-picker .iris-palette:focus {
box-shadow: 0 0 0 2px #3582c4;
}
@media screen and (max-width: 782px) {
.wp-picker-container input[type="text"].wp-color-picker {
width: 5rem;
font-size: 16px;
line-height: 1.875; /* 30px */
min-height: 32px;
}
.wp-customizer .wp-picker-container input[type="text"].wp-color-picker {
padding: 0 5px;
}
.wp-picker-input-wrap .button.wp-picker-default,
.wp-picker-input-wrap .button.wp-picker-clear {
padding: 0 8px;
line-height: 2.14285714; /* 30px */
min-height: 32px;
}
.wp-customizer .wp-picker-input-wrap .button.wp-picker-default,
.wp-customizer .wp-picker-input-wrap .button.wp-picker-clear {
padding: 0 8px;
font-size: 14px;
line-height: 2.14285714; /* 30px */
min-height: 32px;
}
.wp-picker-container .wp-color-result.button {
padding: 0 40px 0 0;
font-size: 14px;
line-height: 2.14285714; /* 30px */
}
.wp-customizer .wp-picker-container .wp-color-result.button {
font-size: 14px;
line-height: 2.14285714; /* 30px */
}
.wp-picker-container .wp-color-result-text {
padding: 0 14px;
font-size: inherit;
line-height: inherit;
}
.wp-customizer .wp-picker-container .wp-color-result-text {
padding: 0 10px;
}
}

View File

@@ -0,0 +1,2 @@
/*! This file is auto-generated */
.wp-color-picker{width:80px;direction:ltr}.wp-picker-container .hidden{display:none}.wp-picker-container .wp-color-result.button{min-height:30px;margin:0 0 6px 6px;padding:0 30px 0 0;font-size:11px}.wp-color-result-text{background:#f6f7f7;border-radius:2px 0 0 2px;border-right:1px solid #c3c4c7;color:#50575e;display:block;line-height:2.54545455;padding:0 6px;text-align:center}.wp-color-result:focus,.wp-color-result:hover{background:#f6f7f7;border-color:#8c8f94;color:#1d2327}.wp-color-result:focus:after,.wp-color-result:hover:after{color:#1d2327;border-color:#a7aaad;border-right:1px solid #8c8f94}.wp-picker-container{display:inline-block}.wp-color-result:focus{border-color:#4f94d4;box-shadow:0 0 3px rgba(34,113,177,.8)}.wp-color-result:active{transform:none!important}.wp-picker-open+.wp-picker-input-wrap{display:inline-block;vertical-align:top}.wp-picker-input-wrap label{display:inline-block;vertical-align:top}.form-table .wp-picker-input-wrap label{margin:0!important}.wp-customizer .wp-picker-input-wrap .button.wp-picker-clear,.wp-customizer .wp-picker-input-wrap .button.wp-picker-default,.wp-picker-input-wrap .button.wp-picker-clear,.wp-picker-input-wrap .button.wp-picker-default{margin-right:6px;padding:0 8px;line-height:2.54545455;min-height:30px}.wp-picker-container .iris-square-slider .ui-slider-handle:focus{background-color:#50575e}.wp-picker-container .iris-picker{border-radius:0;border-color:#dcdcde;margin-top:6px}.wp-picker-container input[type=text].wp-color-picker{width:4rem;font-size:12px;font-family:monospace;line-height:2.33333333;margin:0;padding:0 5px;vertical-align:top;min-height:30px}.wp-color-picker::-webkit-input-placeholder{color:#646970}.wp-color-picker::-moz-placeholder{color:#646970;opacity:1}.wp-color-picker:-ms-input-placeholder{color:#646970}.wp-picker-container input[type=text].iris-error{background-color:#fcf0f1;border-color:#d63638;color:#000}.iris-picker .iris-strip .ui-slider-handle:focus,.iris-picker .ui-square-handle:focus{border-color:#3582c4;border-style:solid;box-shadow:0 0 0 1px #3582c4;outline:2px solid transparent}.iris-picker .iris-palette:focus{box-shadow:0 0 0 2px #3582c4}@media screen and (max-width:782px){.wp-picker-container input[type=text].wp-color-picker{width:5rem;font-size:16px;line-height:1.875;min-height:32px}.wp-customizer .wp-picker-container input[type=text].wp-color-picker{padding:0 5px}.wp-picker-input-wrap .button.wp-picker-clear,.wp-picker-input-wrap .button.wp-picker-default{padding:0 8px;line-height:2.14285714;min-height:32px}.wp-customizer .wp-picker-input-wrap .button.wp-picker-clear,.wp-customizer .wp-picker-input-wrap .button.wp-picker-default{padding:0 8px;font-size:14px;line-height:2.14285714;min-height:32px}.wp-picker-container .wp-color-result.button{padding:0 40px 0 0;font-size:14px;line-height:2.14285714}.wp-customizer .wp-picker-container .wp-color-result.button{font-size:14px;line-height:2.14285714}.wp-picker-container .wp-color-result-text{padding:0 14px;font-size:inherit;line-height:inherit}.wp-customizer .wp-picker-container .wp-color-result-text{padding:0 10px}}

View File

@@ -0,0 +1,182 @@
/* rtl:ignore */
.wp-color-picker {
width: 80px;
direction: ltr;
}
.wp-picker-container .hidden {
display: none;
}
/* Needs higher specificiity. */
.wp-picker-container .wp-color-result.button {
min-height: 30px;
margin: 0 6px 6px 0;
padding: 0 0 0 30px;
font-size: 11px;
}
.wp-color-result-text {
background: #f6f7f7;
border-radius: 0 2px 2px 0;
border-left: 1px solid #c3c4c7;
color: #50575e;
display: block;
line-height: 2.54545455; /* 28px */
padding: 0 6px;
text-align: center;
}
.wp-color-result:hover,
.wp-color-result:focus {
background: #f6f7f7;
border-color: #8c8f94;
color: #1d2327;
}
.wp-color-result:hover:after,
.wp-color-result:focus:after {
color: #1d2327;
border-color: #a7aaad;
border-left: 1px solid #8c8f94;
}
.wp-picker-container {
display: inline-block;
}
.wp-color-result:focus {
border-color: #4f94d4;
box-shadow: 0 0 3px rgba(34, 113, 177, 0.8);
}
.wp-color-result:active {
/* See Trac ticket #39662 */
transform: none !important;
}
.wp-picker-open + .wp-picker-input-wrap {
display: inline-block;
vertical-align: top;
}
.wp-picker-input-wrap label {
display: inline-block;
vertical-align: top;
}
/* For the old `custom-background` page, to override the inline-block and margins from `.form-table td fieldset label`. */
.form-table .wp-picker-input-wrap label {
margin: 0 !important;
}
.wp-picker-input-wrap .button.wp-picker-default,
.wp-picker-input-wrap .button.wp-picker-clear,
.wp-customizer .wp-picker-input-wrap .button.wp-picker-default,
.wp-customizer .wp-picker-input-wrap .button.wp-picker-clear {
margin-left: 6px;
padding: 0 8px;
line-height: 2.54545455; /* 28px */
min-height: 30px;
}
.wp-picker-container .iris-square-slider .ui-slider-handle:focus {
background-color: #50575e
}
.wp-picker-container .iris-picker {
border-radius: 0;
border-color: #dcdcde;
margin-top: 6px;
}
.wp-picker-container input[type="text"].wp-color-picker {
width: 4rem;
font-size: 12px;
font-family: monospace;
line-height: 2.33333333; /* 28px */
margin: 0;
padding: 0 5px;
vertical-align: top;
min-height: 30px;
}
.wp-color-picker::-webkit-input-placeholder {
color: #646970;
}
.wp-color-picker::-moz-placeholder {
color: #646970;
opacity: 1;
}
.wp-color-picker:-ms-input-placeholder {
color: #646970;
}
.wp-picker-container input[type="text"].iris-error {
background-color: #fcf0f1;
border-color: #d63638;
color: #000;
}
.iris-picker .ui-square-handle:focus,
.iris-picker .iris-strip .ui-slider-handle:focus {
border-color: #3582c4;
border-style: solid;
box-shadow: 0 0 0 1px #3582c4;
outline: 2px solid transparent;
}
.iris-picker .iris-palette:focus {
box-shadow: 0 0 0 2px #3582c4;
}
@media screen and (max-width: 782px) {
.wp-picker-container input[type="text"].wp-color-picker {
width: 5rem;
font-size: 16px;
line-height: 1.875; /* 30px */
min-height: 32px;
}
.wp-customizer .wp-picker-container input[type="text"].wp-color-picker {
padding: 0 5px;
}
.wp-picker-input-wrap .button.wp-picker-default,
.wp-picker-input-wrap .button.wp-picker-clear {
padding: 0 8px;
line-height: 2.14285714; /* 30px */
min-height: 32px;
}
.wp-customizer .wp-picker-input-wrap .button.wp-picker-default,
.wp-customizer .wp-picker-input-wrap .button.wp-picker-clear {
padding: 0 8px;
font-size: 14px;
line-height: 2.14285714; /* 30px */
min-height: 32px;
}
.wp-picker-container .wp-color-result.button {
padding: 0 0 0 40px;
font-size: 14px;
line-height: 2.14285714; /* 30px */
}
.wp-customizer .wp-picker-container .wp-color-result.button {
font-size: 14px;
line-height: 2.14285714; /* 30px */
}
.wp-picker-container .wp-color-result-text {
padding: 0 14px;
font-size: inherit;
line-height: inherit;
}
.wp-customizer .wp-picker-container .wp-color-result-text {
padding: 0 10px;
}
}

Some files were not shown because too many files have changed in this diff Show More