ec91ad78 by Jeff Balicki

create product

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent c3e9dd24
Showing 70 changed files with 9355 additions and 0 deletions
......@@ -1883,3 +1883,195 @@
INFO [7c00f1aa] Finished in 0.203 seconds with exit status 0 (successful).
INFO [3a026d41] Running si crlg-staging as tenzing_www@web-1
INFO [3a026d41] Finished in 2.232 seconds with exit status 0 (successful).
INFO ---------------------------------------------------------------------------
INFO START 2023-02-09 19:22:00 -0500 cap staging deploy
INFO ---------------------------------------------------------------------------
INFO [0a367bfe] Running /usr/bin/env mkdir -p /tmp as tenzing_www@web-1
INFO [0a367bfe] Finished in 1.449 seconds with exit status 0 (successful).
INFO Uploading /tmp/git-ssh-crlg-staging-staging-jeffbalicki.sh 100.0%
INFO [9856fb79] Running /usr/bin/env chmod 700 /tmp/git-ssh-crlg-staging-staging-jeffbalicki.sh as tenzing_www@web-1
INFO [9856fb79] Finished in 0.231 seconds with exit status 0 (successful).
INFO [61f2cc32] Running /usr/bin/env git ls-remote git@git.gotenzing.com:jeffmbalicki/st_joseph.git HEAD as tenzing_www@web-1
INFO [61f2cc32] Finished in 0.949 seconds with exit status 0 (successful).
INFO [1c12df78] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/shared /var/www/html/production/crlg-staging/releases as tenzing_www@web-1
INFO [1c12df78] Finished in 0.229 seconds with exit status 0 (successful).
INFO [1b67be8e] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/shared/wp-content/wflogs /var/www/html/production/crlg-staging/shared/wp-content/uploads /var/www/html/production/crlg-staging/shared/wp-content/storage /var/www/html/production/crlg-staging/shared/wp-content/languages /var/www/html/production/crlg-staging/shared/wp-content/cache /var/www/html/production/crlg-staging/shared/wp-content/wp-rocket-config as tenzing_www@web-1
INFO [1b67be8e] Finished in 0.234 seconds with exit status 0 (successful).
INFO [bc7f6321] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/shared as tenzing_www@web-1
INFO [bc7f6321] Finished in 0.214 seconds with exit status 0 (successful).
INFO The repository mirror is at /var/www/html/production/crlg-staging/repo
INFO [e622611a] Running /usr/bin/env git remote set-url origin git@git.gotenzing.com:jeffmbalicki/st_joseph.git as tenzing_www@web-1
INFO [e622611a] Finished in 0.214 seconds with exit status 0 (successful).
INFO [5ef6cda3] Running /usr/bin/env git remote update --prune as tenzing_www@web-1
INFO [5ef6cda3] Finished in 1.358 seconds with exit status 0 (successful).
INFO [6a852bb6] Running /usr/bin/env git clone -b master --recursive . /var/www/html/production/crlg-staging/releases/20230210002205 as tenzing_www@web-1
INFO [6a852bb6] Finished in 4.505 seconds with exit status 0 (successful).
INFO [20c79c74] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/releases/20230210002205 as tenzing_www@web-1
INFO [20c79c74] Finished in 0.217 seconds with exit status 0 (successful).
INFO [99c252f9] Running /usr/bin/env git archive master | /usr/bin/env tar -x -f - -C /var/www/html/production/crlg-staging/releases/20230210002205 as tenzing_www@web-1
INFO [99c252f9] Finished in 3.290 seconds with exit status 0 (successful).
INFO [5006bfd8] Running /usr/bin/env echo "24a7e393deac85dab4f34fb070835b64189433e2" >> REVISION as tenzing_www@web-1
INFO [5006bfd8] Finished in 0.211 seconds with exit status 0 (successful).
INFO [b988e297] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/releases/20230210002205 as tenzing_www@web-1
INFO [b988e297] Finished in 0.206 seconds with exit status 0 (successful).
INFO [e22fd090] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/.env /var/www/html/production/crlg-staging/releases/20230210002205/.env as tenzing_www@web-1
INFO [e22fd090] Finished in 0.207 seconds with exit status 0 (successful).
INFO [7501d791] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/releases/20230210002205/wp-content as tenzing_www@web-1
INFO [7501d791] Finished in 0.210 seconds with exit status 0 (successful).
INFO [d016cfe8] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/wflogs /var/www/html/production/crlg-staging/releases/20230210002205/wp-content/wflogs as tenzing_www@web-1
INFO [d016cfe8] Finished in 0.229 seconds with exit status 0 (successful).
INFO [1892fdc2] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/uploads /var/www/html/production/crlg-staging/releases/20230210002205/wp-content/uploads as tenzing_www@web-1
INFO [1892fdc2] Finished in 0.206 seconds with exit status 0 (successful).
INFO [e04c27a6] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/storage /var/www/html/production/crlg-staging/releases/20230210002205/wp-content/storage as tenzing_www@web-1
INFO [e04c27a6] Finished in 0.216 seconds with exit status 0 (successful).
INFO [c4152b74] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/languages /var/www/html/production/crlg-staging/releases/20230210002205/wp-content/languages as tenzing_www@web-1
INFO [c4152b74] Finished in 0.215 seconds with exit status 0 (successful).
INFO [6010e9f3] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/cache /var/www/html/production/crlg-staging/releases/20230210002205/wp-content/cache as tenzing_www@web-1
INFO [6010e9f3] Finished in 0.218 seconds with exit status 0 (successful).
INFO [cc50bd49] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/wp-rocket-config /var/www/html/production/crlg-staging/releases/20230210002205/wp-content/wp-rocket-config as tenzing_www@web-1
INFO [cc50bd49] Finished in 0.207 seconds with exit status 0 (successful).
INFO [7dd39256] Running cd '/var/www/html/production/crlg-staging/releases/20230210002205'; /usr/bin/php73 /home/tenzing_www/composer.phar install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader as tenzing_www@web-1
INFO [7dd39256] Finished in 1.059 seconds with exit status 0 (successful).
INFO [7c88c448] Running si crlg-staging as tenzing_www@web-1
INFO [7c88c448] Finished in 9.214 seconds with exit status 0 (successful).
INFO [2278610c] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/releases/20230210002205 /var/www/html/production/crlg-staging/releases/current as tenzing_www@web-1
INFO [2278610c] Finished in 0.438 seconds with exit status 0 (successful).
INFO [e1da1f6f] Running /usr/bin/env mv /var/www/html/production/crlg-staging/releases/current /var/www/html/production/crlg-staging as tenzing_www@web-1
INFO [e1da1f6f] Finished in 0.206 seconds with exit status 0 (successful).
INFO Keeping 2 of 3 deployed releases on web-1
INFO [12512cbc] Running /usr/bin/env rm -rf /var/www/html/production/crlg-staging/releases/20230209211230 as tenzing_www@web-1
INFO [12512cbc] Finished in 0.727 seconds with exit status 0 (successful).
INFO [83ff0362] Running cd '/var/www/html/production/crlg-staging/releases/20230210002205/'; rm -Rf .git/ as tenzing_www@web-1
INFO [83ff0362] Finished in 0.223 seconds with exit status 0 (successful).
INFO [e789176f] Running /usr/bin/env echo "Branch master (at 24a7e393deac85dab4f34fb070835b64189433e2) deployed as release 20230210002205 by jeffbalicki" >> /var/www/html/production/crlg-staging/revisions.log as tenzing_www@web-1
INFO [e789176f] Finished in 0.211 seconds with exit status 0 (successful).
INFO [0230273f] Running si crlg-staging as tenzing_www@web-1
INFO [0230273f] Finished in 2.465 seconds with exit status 0 (successful).
INFO ---------------------------------------------------------------------------
INFO START 2023-02-09 19:34:38 -0500 cap staging deploy
INFO ---------------------------------------------------------------------------
INFO [dd5f8c89] Running /usr/bin/env mkdir -p /tmp as tenzing_www@web-1
INFO [dd5f8c89] Finished in 1.387 seconds with exit status 0 (successful).
INFO Uploading /tmp/git-ssh-crlg-staging-staging-jeffbalicki.sh 100.0%
INFO [ddb6b26e] Running /usr/bin/env chmod 700 /tmp/git-ssh-crlg-staging-staging-jeffbalicki.sh as tenzing_www@web-1
INFO [ddb6b26e] Finished in 0.255 seconds with exit status 0 (successful).
INFO [58d9977d] Running /usr/bin/env git ls-remote git@git.gotenzing.com:jeffmbalicki/st_joseph.git HEAD as tenzing_www@web-1
INFO [58d9977d] Finished in 0.971 seconds with exit status 0 (successful).
INFO [77b381d4] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/shared /var/www/html/production/crlg-staging/releases as tenzing_www@web-1
INFO [77b381d4] Finished in 0.248 seconds with exit status 0 (successful).
INFO [b44b8d1b] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/shared/wp-content/wflogs /var/www/html/production/crlg-staging/shared/wp-content/uploads /var/www/html/production/crlg-staging/shared/wp-content/storage /var/www/html/production/crlg-staging/shared/wp-content/languages /var/www/html/production/crlg-staging/shared/wp-content/cache /var/www/html/production/crlg-staging/shared/wp-content/wp-rocket-config as tenzing_www@web-1
INFO [b44b8d1b] Finished in 0.247 seconds with exit status 0 (successful).
INFO [b752fe06] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/shared as tenzing_www@web-1
INFO [b752fe06] Finished in 0.257 seconds with exit status 0 (successful).
INFO The repository mirror is at /var/www/html/production/crlg-staging/repo
INFO [455a4528] Running /usr/bin/env git remote set-url origin git@git.gotenzing.com:jeffmbalicki/st_joseph.git as tenzing_www@web-1
INFO [455a4528] Finished in 0.260 seconds with exit status 0 (successful).
INFO [4a56128e] Running /usr/bin/env git remote update --prune as tenzing_www@web-1
INFO [4a56128e] Finished in 1.035 seconds with exit status 0 (successful).
INFO [b62d6017] Running /usr/bin/env git clone -b master --recursive . /var/www/html/production/crlg-staging/releases/20230210003442 as tenzing_www@web-1
INFO [b62d6017] Finished in 2.952 seconds with exit status 0 (successful).
INFO [c5f350c1] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/releases/20230210003442 as tenzing_www@web-1
INFO [c5f350c1] Finished in 0.267 seconds with exit status 0 (successful).
INFO [8f803513] Running /usr/bin/env git archive master | /usr/bin/env tar -x -f - -C /var/www/html/production/crlg-staging/releases/20230210003442 as tenzing_www@web-1
INFO [8f803513] Finished in 3.545 seconds with exit status 0 (successful).
INFO [299a54f5] Running /usr/bin/env echo "24a7e393deac85dab4f34fb070835b64189433e2" >> REVISION as tenzing_www@web-1
INFO [299a54f5] Finished in 0.260 seconds with exit status 0 (successful).
INFO [e1e5ce07] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/releases/20230210003442 as tenzing_www@web-1
INFO [e1e5ce07] Finished in 0.256 seconds with exit status 0 (successful).
INFO [46e937c1] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/.env /var/www/html/production/crlg-staging/releases/20230210003442/.env as tenzing_www@web-1
INFO [46e937c1] Finished in 0.247 seconds with exit status 0 (successful).
INFO [65f0114b] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/releases/20230210003442/wp-content as tenzing_www@web-1
INFO [65f0114b] Finished in 0.245 seconds with exit status 0 (successful).
INFO [fbca6af9] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/wflogs /var/www/html/production/crlg-staging/releases/20230210003442/wp-content/wflogs as tenzing_www@web-1
INFO [fbca6af9] Finished in 0.250 seconds with exit status 0 (successful).
INFO [e2833818] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/uploads /var/www/html/production/crlg-staging/releases/20230210003442/wp-content/uploads as tenzing_www@web-1
INFO [e2833818] Finished in 0.250 seconds with exit status 0 (successful).
INFO [47ac3081] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/storage /var/www/html/production/crlg-staging/releases/20230210003442/wp-content/storage as tenzing_www@web-1
INFO [47ac3081] Finished in 0.261 seconds with exit status 0 (successful).
INFO [475beb05] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/languages /var/www/html/production/crlg-staging/releases/20230210003442/wp-content/languages as tenzing_www@web-1
INFO [475beb05] Finished in 0.278 seconds with exit status 0 (successful).
INFO [4ec90508] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/cache /var/www/html/production/crlg-staging/releases/20230210003442/wp-content/cache as tenzing_www@web-1
INFO [4ec90508] Finished in 0.245 seconds with exit status 0 (successful).
INFO [1f79e7c4] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/wp-rocket-config /var/www/html/production/crlg-staging/releases/20230210003442/wp-content/wp-rocket-config as tenzing_www@web-1
INFO [1f79e7c4] Finished in 0.247 seconds with exit status 0 (successful).
INFO [07a7446c] Running cd '/var/www/html/production/crlg-staging/releases/20230210003442'; /usr/bin/php73 /home/tenzing_www/composer.phar install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader as tenzing_www@web-1
INFO [07a7446c] Finished in 1.080 seconds with exit status 0 (successful).
INFO [39be5161] Running si crlg-staging as tenzing_www@web-1
INFO [39be5161] Finished in 13.924 seconds with exit status 0 (successful).
INFO [03453718] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/releases/20230210003442 /var/www/html/production/crlg-staging/releases/current as tenzing_www@web-1
INFO [03453718] Finished in 0.390 seconds with exit status 0 (successful).
INFO [56f754e4] Running /usr/bin/env mv /var/www/html/production/crlg-staging/releases/current /var/www/html/production/crlg-staging as tenzing_www@web-1
INFO [56f754e4] Finished in 0.247 seconds with exit status 0 (successful).
INFO Keeping 2 of 3 deployed releases on web-1
INFO [88897a5f] Running /usr/bin/env rm -rf /var/www/html/production/crlg-staging/releases/20230209221055 as tenzing_www@web-1
INFO [88897a5f] Finished in 0.853 seconds with exit status 0 (successful).
INFO [744b21d8] Running cd '/var/www/html/production/crlg-staging/releases/20230210003442/'; rm -Rf .git/ as tenzing_www@web-1
INFO [744b21d8] Finished in 0.268 seconds with exit status 0 (successful).
INFO [ab55c45e] Running /usr/bin/env echo "Branch master (at 24a7e393deac85dab4f34fb070835b64189433e2) deployed as release 20230210003442 by jeffbalicki" >> /var/www/html/production/crlg-staging/revisions.log as tenzing_www@web-1
INFO [ab55c45e] Finished in 0.251 seconds with exit status 0 (successful).
INFO [86034fd4] Running si crlg-staging as tenzing_www@web-1
INFO [86034fd4] Finished in 2.516 seconds with exit status 0 (successful).
INFO ---------------------------------------------------------------------------
INFO START 2023-02-09 19:45:15 -0500 cap staging deploy
INFO ---------------------------------------------------------------------------
INFO [7ca0b311] Running /usr/bin/env mkdir -p /tmp as tenzing_www@web-1
INFO [7ca0b311] Finished in 1.315 seconds with exit status 0 (successful).
INFO Uploading /tmp/git-ssh-crlg-staging-staging-jeffbalicki.sh 100.0%
INFO [43cbd4c1] Running /usr/bin/env chmod 700 /tmp/git-ssh-crlg-staging-staging-jeffbalicki.sh as tenzing_www@web-1
INFO [43cbd4c1] Finished in 0.220 seconds with exit status 0 (successful).
INFO [29e5366b] Running /usr/bin/env git ls-remote git@git.gotenzing.com:jeffmbalicki/st_joseph.git HEAD as tenzing_www@web-1
INFO [29e5366b] Finished in 0.925 seconds with exit status 0 (successful).
INFO [342135b5] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/shared /var/www/html/production/crlg-staging/releases as tenzing_www@web-1
INFO [342135b5] Finished in 0.225 seconds with exit status 0 (successful).
INFO [d9ba6d70] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/shared/wp-content/wflogs /var/www/html/production/crlg-staging/shared/wp-content/uploads /var/www/html/production/crlg-staging/shared/wp-content/storage /var/www/html/production/crlg-staging/shared/wp-content/languages /var/www/html/production/crlg-staging/shared/wp-content/cache /var/www/html/production/crlg-staging/shared/wp-content/wp-rocket-config as tenzing_www@web-1
INFO [d9ba6d70] Finished in 0.222 seconds with exit status 0 (successful).
INFO [106331b4] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/shared as tenzing_www@web-1
INFO [106331b4] Finished in 0.211 seconds with exit status 0 (successful).
INFO The repository mirror is at /var/www/html/production/crlg-staging/repo
INFO [3aaf498e] Running /usr/bin/env git remote set-url origin git@git.gotenzing.com:jeffmbalicki/st_joseph.git as tenzing_www@web-1
INFO [3aaf498e] Finished in 0.214 seconds with exit status 0 (successful).
INFO [51380cfc] Running /usr/bin/env git remote update --prune as tenzing_www@web-1
INFO [51380cfc] Finished in 1.064 seconds with exit status 0 (successful).
INFO [47953396] Running /usr/bin/env git clone -b master --recursive . /var/www/html/production/crlg-staging/releases/20230210004519 as tenzing_www@web-1
INFO [47953396] Finished in 3.199 seconds with exit status 0 (successful).
INFO [708596e9] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/releases/20230210004519 as tenzing_www@web-1
INFO [708596e9] Finished in 0.223 seconds with exit status 0 (successful).
INFO [9dd49d83] Running /usr/bin/env git archive master | /usr/bin/env tar -x -f - -C /var/www/html/production/crlg-staging/releases/20230210004519 as tenzing_www@web-1
INFO [9dd49d83] Finished in 3.626 seconds with exit status 0 (successful).
INFO [295d92ac] Running /usr/bin/env echo "c3e9dd24904455e24d6695ed50a1d8cfce782b8b" >> REVISION as tenzing_www@web-1
INFO [295d92ac] Finished in 0.208 seconds with exit status 0 (successful).
INFO [852e3cc7] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/releases/20230210004519 as tenzing_www@web-1
INFO [852e3cc7] Finished in 0.212 seconds with exit status 0 (successful).
INFO [a9736fcd] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/.env /var/www/html/production/crlg-staging/releases/20230210004519/.env as tenzing_www@web-1
INFO [a9736fcd] Finished in 0.214 seconds with exit status 0 (successful).
INFO [31994e43] Running /usr/bin/env mkdir -p /var/www/html/production/crlg-staging/releases/20230210004519/wp-content as tenzing_www@web-1
INFO [31994e43] Finished in 0.228 seconds with exit status 0 (successful).
INFO [2513f838] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/wflogs /var/www/html/production/crlg-staging/releases/20230210004519/wp-content/wflogs as tenzing_www@web-1
INFO [2513f838] Finished in 0.231 seconds with exit status 0 (successful).
INFO [ded24eb0] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/uploads /var/www/html/production/crlg-staging/releases/20230210004519/wp-content/uploads as tenzing_www@web-1
INFO [ded24eb0] Finished in 0.209 seconds with exit status 0 (successful).
INFO [6f3722d2] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/storage /var/www/html/production/crlg-staging/releases/20230210004519/wp-content/storage as tenzing_www@web-1
INFO [6f3722d2] Finished in 0.210 seconds with exit status 0 (successful).
INFO [176adf88] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/languages /var/www/html/production/crlg-staging/releases/20230210004519/wp-content/languages as tenzing_www@web-1
INFO [176adf88] Finished in 0.208 seconds with exit status 0 (successful).
INFO [b6f27d34] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/cache /var/www/html/production/crlg-staging/releases/20230210004519/wp-content/cache as tenzing_www@web-1
INFO [b6f27d34] Finished in 0.209 seconds with exit status 0 (successful).
INFO [f4a125a8] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/shared/wp-content/wp-rocket-config /var/www/html/production/crlg-staging/releases/20230210004519/wp-content/wp-rocket-config as tenzing_www@web-1
INFO [f4a125a8] Finished in 0.207 seconds with exit status 0 (successful).
INFO [5ed704c4] Running cd '/var/www/html/production/crlg-staging/releases/20230210004519'; /usr/bin/php73 /home/tenzing_www/composer.phar install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader as tenzing_www@web-1
INFO [5ed704c4] Finished in 0.910 seconds with exit status 0 (successful).
INFO [b4e0dac6] Running si crlg-staging as tenzing_www@web-1
INFO [b4e0dac6] Finished in 6.346 seconds with exit status 0 (successful).
INFO [a2fe07fb] Running /usr/bin/env ln -s /var/www/html/production/crlg-staging/releases/20230210004519 /var/www/html/production/crlg-staging/releases/current as tenzing_www@web-1
INFO [a2fe07fb] Finished in 0.525 seconds with exit status 0 (successful).
INFO [d69ecd68] Running /usr/bin/env mv /var/www/html/production/crlg-staging/releases/current /var/www/html/production/crlg-staging as tenzing_www@web-1
INFO [d69ecd68] Finished in 0.222 seconds with exit status 0 (successful).
INFO Keeping 2 of 3 deployed releases on web-1
INFO [a25b28f3] Running /usr/bin/env rm -rf /var/www/html/production/crlg-staging/releases/20230210002205 as tenzing_www@web-1
INFO [a25b28f3] Finished in 0.976 seconds with exit status 0 (successful).
INFO [ea6a8ba2] Running cd '/var/www/html/production/crlg-staging/releases/20230210004519/'; rm -Rf .git/ as tenzing_www@web-1
INFO [ea6a8ba2] Finished in 0.237 seconds with exit status 0 (successful).
INFO [1ac260f6] Running /usr/bin/env echo "Branch master (at c3e9dd24904455e24d6695ed50a1d8cfce782b8b) deployed as release 20230210004519 by jeffbalicki" >> /var/www/html/production/crlg-staging/revisions.log as tenzing_www@web-1
INFO [1ac260f6] Finished in 0.206 seconds with exit status 0 (successful).
INFO [f13ca3fd] Running si crlg-staging as tenzing_www@web-1
INFO [f13ca3fd] Finished in 2.212 seconds with exit status 0 (successful).
......
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
1. Role Based Price For WooCommerce Settings
2. WC Price Editor View (For the product which has the issue)
If applicable, add screenshots to help explain your problem.
**Software Versions**
1. WordPress :
2. WooCommerce :
3. Role Based Price For WooCommerce :
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
name: PHP CI/CD
env:
VS_WORKFLOW_TYPE: "php-cicd"
on:
push:
branches:
- master
- main
paths:
- '**.php'
jobs:
apigen_docs:
name: "ApiGen Docs"
runs-on: ubuntu-latest
steps:
- name: "📥 Fetching Repository Contents"
uses: actions/checkout@main
- name: "💾 Github Repository Metadata"
uses: varunsridharan/action-repository-meta@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "💫 VS Utility"
uses: varunsridharan/action-vs-utility@main
- name: " Repository - Before Hook"
run: |
echo " "
if [ -f $VS_BEFORE_HOOK_FILE_LOCATION ]; then
echo "✅ Before Hook File Found : $VS_BEFORE_HOOK_FILE_LOCATION"
sh $VS_BEFORE_HOOK_FILE_LOCATION
else
echo "⚠️ No Before Hook File Found : $VS_BEFORE_HOOK_FILE_LOCATION"
fi
echo " "
- name: "📚 Generating Code Documentation"
uses: varunsridharan/action-apigen@2.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: " Repository - After Hook"
run: |
echo " "
if [ -f $VS_AFTER_HOOK_FILE_LOCATION ]; then
echo "✅ After Hook File Found : $VS_AFTER_HOOK_FILE_LOCATION"
sh $VS_AFTER_HOOK_FILE_LOCATION
else
echo "⚠️ No After Hook File Found : $VS_AFTER_HOOK_FILE_LOCATION"
fi
echo " "
\ No newline at end of file
name: Twitter Post On Release
env:
VS_WORKFLOW_TYPE: "twitter-post"
on:
release:
types:
- published
jobs:
twitter_post:
name: "🐦 Tweet"
runs-on: ubuntu-latest
steps:
- name: "📥 Fetching Repository Contents"
uses: actions/checkout@main
- name: "💾 Github Repository Metadata"
uses: varunsridharan/action-repository-meta@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "💫 VS Utility"
uses: varunsridharan/action-vs-utility@main
env:
SVA_ONL_TOKEN: ${{ secrets.SVA_ONL_TOKEN }}
- name: " Repository - Before Hook"
run: |
echo " "
if [ -f $VS_BEFORE_HOOK_FILE_LOCATION ]; then
echo "✅ Before Hook File Found : $VS_BEFORE_HOOK_FILE_LOCATION"
sh $VS_BEFORE_HOOK_FILE_LOCATION
else
echo "⚠️ No Before Hook File Found : $VS_BEFORE_HOOK_FILE_LOCATION"
fi
echo " "
- name: "🚀 Publishing Tweet 🐦 "
uses: m1ner79/Github-Twittction@master
with:
twitter_status: ${{ env.TWITTER_STATUS }}
twitter_consumer_key: ${{ secrets.TWITTER_API_KEY }}
twitter_consumer_secret: ${{ secrets.TWITTER_API_SECRET_KEY }}
twitter_access_token_key: ${{ secrets.TWITTER_ACCESS_TOKEN }}
twitter_access_token_secret: ${{ secrets.TWITTER_ACCESS_SECRET_TOKEN }}
- name: " Repository - After Hook"
run: |
echo " "
if [ -f $VS_AFTER_HOOK_FILE_LOCATION ]; then
echo "✅ After Hook File Found : $VS_AFTER_HOOK_FILE_LOCATION"
sh $VS_AFTER_HOOK_FILE_LOCATION
else
echo "⚠️ No After Hook File Found : $VS_AFTER_HOOK_FILE_LOCATION"
fi
echo " "
\ No newline at end of file
name: "Release - WordPress.org"
env:
DIST_LOCATION: "./dist/"
VS_WORKFLOW_TYPE: "wordpress-org-release"
on:
release:
types:
- published
jobs:
publish-wordpress-org:
name: "🚀 WordPress Publisher"
runs-on: ubuntu-latest
steps:
- name: "📥 Fetching Repository Contents"
uses: actions/checkout@main
- name: "💾 Github Repository Metadata"
uses: varunsridharan/action-repository-meta@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "💫 VS Utility"
uses: varunsridharan/action-vs-utility@main
- name: " Repository - Before Hook"
run: |
echo " "
if [ -f $VS_BEFORE_HOOK_FILE_LOCATION ]; then
echo "✅ Before Hook File Found : $VS_BEFORE_HOOK_FILE_LOCATION"
sh $VS_BEFORE_HOOK_FILE_LOCATION
else
echo "⚠️ No Before Hook File Found : $VS_BEFORE_HOOK_FILE_LOCATION"
fi
echo " "
- name: "💽 Installing Composer"
uses: g-actions/composer-action@main
with:
command: install --no-dev
- name: "🚀 Publishing Release"
uses: varunsridharan/action-wp-org-deploy@main
with:
WORDPRESS_PASSWORD: ${{ secrets.WP_PASSWORD }}
WORDPRESS_USERNAME: ${{ secrets.WP_USERNAME }}
SLUG: ${{ env.GITHUB_REPOSITORY_NAME }}
IGNORE_FILE: ${{ env.WORDPRESS_DIST_IGNORE }}
ASSETS_IGNORE_FILE: ${{ env.WORDPRESS_ASSETS_DIST_IGNORE }}
DIST_LOCATION: ${{ env.DIST_LOCATION }}
- name: "📦 Upload ZIP To Release in Github"
uses: Roang-zero1/github-upload-release-artifacts-action@master
with:
args: ${{ env.DIST_LOCATION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: " Repository - After Hook"
run: |
echo " "
if [ -f $VS_AFTER_HOOK_FILE_LOCATION ]; then
echo "✅ After Hook File Found : $VS_AFTER_HOOK_FILE_LOCATION"
sh $VS_AFTER_HOOK_FILE_LOCATION
else
echo "⚠️ No After Hook File Found : $VS_AFTER_HOOK_FILE_LOCATION"
fi
echo " "
\ No newline at end of file
plugins/price-add-to-cart-visibility/Thumbs.db
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<?php
/**
* Plugin Main File
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/core
* @since 3.0
*/
if ( ! defined( 'WPINC' ) ) {
die;
}
class WooCommerce_Role_Based_Price {
protected static $_instance = null;
protected static $functions = null;
protected static $admin = null; # Required Plugin Class Instance
protected static $settings = null; # Required Plugin Class Instance
protected static $frontend = null; # Required Plugin Class Instance
protected static $shortcode_handler = null; # Required Plugin Class Instance
public $version = '3.3.5'; # Required Plugin Class INstance
public $plugin_vars = array(); # Required Plugin Class INstance
/**
* Class Constructor
*/
public function __construct() {
$this->define_constant();
$this->load_required_files();
$this->init_hooks();
do_action( 'wc_rbp_loaded' );
}
/**
* Define Required Constant
*/
private function define_constant() {
$this->define( 'WC_RBP_NAME', 'Role Based Price For WooCommerce' ); # Plugin Name
$this->define( 'WC_RBP_SLUG', 'woocommerce-role-based-price' ); # Plugin Slug
$this->define( 'WC_RBP_TXT', 'woocommerce-role-based-price' ); #plugin lang Domain
$this->define( 'WC_RBP_DB', 'wc_rbp_' );
$this->define( 'WC_RBP_V', $this->version ); # Plugin Version
$this->define( 'WC_RBP_LANGUAGE_PATH', WC_RBP_PATH . 'languages' ); # Plugin Language Folder
$this->define( 'WC_RBP_ADMIN', WC_RBP_INC . 'admin/' ); # Plugin Admin Folder
$this->define( 'WC_RBP_SETTINGS', WC_RBP_ADMIN . 'settings/' ); # Plugin Settings Folder
$this->define( 'WC_RBP_PLUGIN', WC_RBP_PATH . 'plugins/' );
$this->define( 'WC_RBP_URL', plugins_url( '', __FILE__ ) . '/' ); # Plugin URL
$this->define( 'WC_RBP_PLUGIN_URL', WC_RBP_URL . 'plugins/' ); # Plugin URL
$this->define( 'WC_RBP_CSS', WC_RBP_URL . 'includes/css/' ); # Plugin CSS URL
$this->define( 'WC_RBP_IMG', WC_RBP_URL . 'includes/img/' ); # Plugin IMG URL
$this->define( 'WC_RBP_JS', WC_RBP_URL . 'includes/js/' ); # Plugin JS URL
}
/**
* Define constant if not already set
*
* @param string $name
* @param string|bool $value
*/
protected function define( $key, $value ) {
if ( ! defined( $key ) ) {
define( $key, $value );
}
}
/**
* Loads Required Plugins For Plugin
*/
private function load_required_files() {
$this->load_files( WC_RBP_INC . 'abstract-*.php' );
$this->load_files( WC_RBP_INC . 'helpers/class-admin-notice.php' );
$this->load_files( WC_RBP_INC . 'class-*.php' );
$this->load_files( WC_RBP_ADMIN . 'settings_framework/class-wp-plugin-options.php' );
$this->load_files( WC_RBP_ADMIN . 'settings_framework/class-wp-*.php' );
if ( wc_rbp_is_request( 'admin' ) ) {
$this->load_files( WC_RBP_ADMIN . 'class-*.php' );
}
do_action( 'wc_rbp_before_addons_load' );
$this->load_addons();
}
/**
* Loads Files Based On Give Path & regex
*/
protected function load_files( $path, $type = 'require' ) {
foreach ( glob( $path ) as $files ) {
if ( $type == 'require' ) {
require_once( $files );
} elseif ( $type == 'include' ) {
include_once( $files );
}
}
}
public function load_addons() {
$addons = wc_rbp_get_active_addons();
if ( ! empty( $addons ) ) {
foreach ( $addons as $addon ) {
if ( apply_filters( 'wc_rbp_load_addon', true, $addon ) ) {
do_action( 'wc_rbp_before_' . $addon . '_addon_load' );
$this->load_addon( $addon );
do_action( 'wc_rbp_after_' . $addon . '_addon_load' );
}
}
}
}
public function load_addon( $file ) {
$other_file = apply_filters( 'wc_rbp_addon_file_location', $file );
if ( file_exists( WC_RBP_PLUGIN . $file ) ) {
$this->load_files( WC_RBP_PLUGIN . $file );
} elseif ( file_exists( $other_file ) ) {
$this->load_files( $other_file );
} else {
if ( has_action( 'wc_rbp_addon_' . $file . '_load' ) ) {
do_action( 'wc_rbp_addon_' . $file . '_load' );
} else {
wc_rbp_deactivate_addon( $file );
}
}
}
public function init_hooks() {
add_action( 'plugins_loaded', array( $this, 'after_plugins_loaded' ) );
add_filter( 'load_textdomain_mofile', array( $this, 'load_plugin_mo_files' ), 10, 2 );
add_action( 'init', array( $this, 'init' ), 0 );
}
/**
* Creates or returns an instance of this class.
*/
public static function get_instance() {
if ( null == self::$_instance ) {
self::$_instance = new self;
}
return self::$_instance;
}
# Returns Plugin's Functions Instance
/**
* Throw error on object clone.
*
* Cloning instances of the class is forbidden.
*
* @since 1.0
* @return void
*/
public function __clone() {
_doing_it_wrong( __FUNCTION__, __( 'Cloning instances of the class is forbidden.', WC_RBP_TXT ), WC_RBP_V );
}
# Returns Plugin's Functions Instance
/**
* Disable unserializing of the class
*
* Unserializing instances of the class is forbidden.
*
* @since 1.0
* @return void
*/
public function __wakeup() {
_doing_it_wrong( __FUNCTION__, __( 'Unserializing instances of the class is forbidden.', WC_RBP_TXT ), WC_RBP_V );
}
# Returns Plugin's Settings Instance
/**
* Inits loaded Class
*/
public function init() {
do_action( 'wc_rbp_before_init' );
self::$functions = new WooCommerce_Role_Based_Price_Functions;
self::$settings = new WooCommerce_Role_Based_Price_Settings_Framework;
self::$shortcode_handler = new WooCommerce_Role_Based_Price_Shortcode_Handler;
if ( wc_rbp_is_request( 'admin' ) ) {
self::$admin = new WooCommerce_Role_Based_Price_Admin;
} else {
self::$frontend = new WooCommerce_Role_Based_Price_Product_Pricing;
}
do_action( 'wc_rbp_init' );
}
# Returns Plugin's Admin Instance
public function func() {
return self::$functions;
}
public function frontend() {
return self::$frontend;
}
public function settings() {
return self::$settings;
}
public function admin() {
return self::$admin;
}
/**
* Set Plugin Text Domain
*/
public function after_plugins_loaded() {
load_plugin_textdomain( WC_RBP_TXT, false, WC_RBP_LANGUAGE_PATH );
}
/**
* load translated mo file based on wp settings
*/
public function load_plugin_mo_files( $mofile, $domain ) {
if ( WC_RBP_TXT === $domain ) {
return WC_RBP_LANGUAGE_PATH . '/' . get_locale() . '.mo';
}
return $mofile;
}
}
\ No newline at end of file
<?php
/**
*
* Addons Handler
*
* @link https://codecanyon.net/item/advanced-product-reviews-for-woocommerce/15385857
* @package APRWC
* @subpackage APRWC/FrontEnd
* @since 2.0
*/
if( ! defined('WPINC') ) {
die;
}
class WooCommerce_Role_Based_Price_Addon_Handler {
public function __construct() {
add_filter('wc_rbp_addon_sections', array( $this, 'register_section' ));
add_filter('wc_rbp_addon_fields', array( $this, 'register_fields' ));
add_action('wp_enqueue_scripts', array( $this, 'frontend_style' ));
add_action('wp_enqueue_scripts', array( $this, 'frontend_script' ));
if( is_admin() ) {
add_action('wc_rbp_admin_styles', array( $this, 'admin_style' ));
add_action('wc_rbp_admin_scripts', array( $this, 'admin_script' ));
}
add_action('wc_rbp_loaded', array( $this, 'init_class' ));
}
public function register_section($settings_section) {
return $settings_section;
}
public function register_fields($settings_fields) {
return $settings_fields;
}
public function init_class() {
}
public function admin_style($screen = '') {
}
public function admin_script($screen = '') {
}
public function frontend_style() {
}
public function frontend_script() {
}
public function addon_path($file = __DIR__) {
return plugin_dir_path($file);
}
public function addon_url($file = __FILE__) {
return plugin_dir_url($file);
}
}
\ No newline at end of file
<?php
/**
* Plugin's Admin code
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/Admin
* @since 3.0
*/
if ( ! defined( 'WPINC' ) ) {
die;
}
class WooCommerce_Role_Based_Price_Admin {
/**
* Initialize the class and set its properties.
*
* @since 0.1
*/
public function __construct() {
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ), 99 );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_action( 'admin_init', array( $this, 'admin_init' ) );
add_filter( 'woocommerce_screen_ids', array( $this, 'set_wc_screen_ids' ), 99 );
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_links' ), 10, 2 );
add_filter( 'plugin_action_links_' . WC_RBP_FILE, array( $this, 'plugin_action_links' ), 10, 10 );
//add_action( 'admin_menu',array($this,'add_welcome_menu'));
}
public function set_wc_screen_ids( $screens ) {
$screen = $screens;
$screen[] = 'woocommerce_page_woocommerce-role-based-price-settings';
$screen[] = 'product_page_rbp_global_addons';
return $screen;
}
/**
* Inits Admin Sttings
*/
public function admin_init() {
//$this->handle_welcome_page();
new WooCommerce_Role_Based_Price_Admin_Ajax_Handler;
new WooCommerce_Role_Based_Price_Addons;
}
public function handle_welcome_page() {
if ( ! get_transient( '_welcome_redirect_wcrbp' ) ) {
return;
}
delete_transient( '_welcome_redirect_wcrbp' );
if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
return;
}
wp_safe_redirect( add_query_arg( array( 'page' => 'wcrbp_welcome_page' ), admin_url( 'plugins.php' ) ) );
}
public function add_welcome_menu() {
if ( ! get_transient( '_welcome_redirect_wcrbp' ) ) {
//return;
}
if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
return;
}
add_submenu_page( 'plugins.php', __( 'Role Based Price For WooCommerce Welcome Page', 'WPW' ), __( 'Role Based Price For WooCommerce Welcome Page', 'WPW' ), 'read', 'wcrbp_welcome_page', array(
$this,
'wcrbp_welcome_page_content',
) );
}
public function wcrbp_welcome_page_content() {
include( WC_RBP_ADMIN . 'views/plugin-welcome-page.php' );
}
/**
* Register the stylesheets for the admin area.
*/
public function enqueue_styles() {
$current_screen = wc_rbp_current_screen();
$addon_url = admin_url( 'admin-ajax.php?action=wc_rbp_addon_custom_css' );
wp_register_style( WC_RBP_SLUG . '_backend_style', WC_RBP_CSS . 'backend.css', array(), WC_RBP_V, 'all' );
wp_register_style( WC_RBP_SLUG . '_addons_style', $addon_url, array(), WC_RBP_V, 'all' );
wp_register_style( WC_RBP_SLUG . '_settings_selectize_style', WC_RBP_CSS . 'selectize.js.css', array(), WC_RBP_V, 'all' );
wp_register_style( WC_RBP_SLUG . '_tabs_style', WC_RBP_CSS . 'tabs.css', array(), WC_RBP_V, 'all' );
wp_enqueue_style( WC_RBP_SLUG . '_backend_style' );
wp_enqueue_style( WC_RBP_SLUG . '_addons_style' );
if ( 'woocommerce_page_woocommerce-role-based-price-settings' == $current_screen ) {
wp_enqueue_style( WC_RBP_SLUG . '_settings_selectize_style' );
add_thickbox();
}
if ( 'product' == $current_screen ) {
wp_enqueue_style( WC_RBP_SLUG . '_tabs_style' );
wp_enqueue_style( WC_RBP_SLUG . '_settings_selectize_style' );
}
do_action( 'wc_rbp_admin_styles', $current_screen );
}
/**
* Register the JavaScript for the admin area.
*/
public function enqueue_scripts() {
$current_screen = wc_rbp_current_screen();
$addon_url = admin_url( 'admin-ajax.php?action=wc_rbp_addon_custom_js' );
wp_register_script( WC_RBP_SLUG . '_backend_script', WC_RBP_JS . 'backend.js', array( 'jquery' ), WC_RBP_V, false );
wp_register_script( WC_RBP_SLUG . '_addons_script', $addon_url, array( 'jquery' ), WC_RBP_V, false );
wp_register_script( WC_RBP_SLUG . '_settings_selectize.js', WC_RBP_JS . 'selectize.js', array( 'jquery' ), WC_RBP_V, false );
wp_register_script( WC_RBP_SLUG . '_settings_checkbox.js', WC_RBP_JS . 'checkbox.js', array( 'jquery' ), WC_RBP_V, false );
wp_register_script( WC_RBP_SLUG . '_settings_js', WC_RBP_JS . 'settings-page.js', array(
'jquery',
WC_RBP_SLUG . '_settings_selectize.js',
), WC_RBP_V, false );
wp_register_script( WC_RBP_SLUG . '_settings_checkbox.js', WC_RBP_JS . 'checkbox.js', array( 'jquery' ), WC_RBP_V, false );
wp_register_script( WC_RBP_SLUG . '_jquery-tabs-script', WC_RBP_JS . 'tabs.js', array( 'jquery' ), WC_RBP_V, false );
wp_enqueue_script( WC_RBP_SLUG . '_backend_script', WC_RBP_JS . 'backend.js', array( 'jquery' ), WC_RBP_V, false );
if ( in_array( $current_screen, wc_rbp_get_screen_ids() ) ) {
}
if ( 'woocommerce_page_woocommerce-role-based-price-settings' == $current_screen ) {
wp_enqueue_script( WC_RBP_SLUG . '_settings_selectize.js' );
wp_enqueue_script( WC_RBP_SLUG . '_settings_checkbox.js' );
wp_enqueue_script( WC_RBP_SLUG . '_settings_js' );
$msg = '<h3>' . __( 'Thanks For Your Continued Support For %1$s' ) . '</h3>';
$msg .= __( 'We Are Already In A Process For Created Version 4.0 For This Plugin' );
$msg .= '<br/><br/><a href="https://forms.gle/waxC4Mm9SZFWuq3A8" class="button button-secondary">' . __( 'Join Newsletter / Request Beta Access' ) . '</a>';
$msg = sprintf( $msg, WC_RBP_NAME );
wc_rbp_admin_update( $msg, 1, array(), array() );
}
if ( 'product' == $current_screen ) {
wp_enqueue_script( WC_RBP_SLUG . '_settings_checkbox.js' );
wp_enqueue_script( WC_RBP_SLUG . '_jquery-tabs-script' );
wp_enqueue_script( WC_RBP_SLUG . '_jquery-product-script' );
wp_enqueue_script( WC_RBP_SLUG . '_settings_selectize.js' );
}
do_action( 'wc_rbp_admin_scripts', $current_screen );
wp_enqueue_script( WC_RBP_SLUG . '_addons_script', $addon_url, array( 'jquery' ), WC_RBP_V, false );
}
/**
* Adds Some Plugin Options
*
* @param array $plugin_meta
* @param string $plugin_file
*
* @return array
* @since 0.11
*/
public function plugin_action_links( $action, $file, $plugin_meta, $status ) {
$url = admin_url( 'admin.php?page=woocommerce-role-based-price-settings' );
$addonurl = admin_url( 'admin.php?page=woocommerce-role-based-price-settings&tab=wcrbpaddons' );
$actions[] = sprintf( '<a href="%s">%s</a>', $url, __( 'Settings', WC_RBP_TXT ) );
$actions[] = sprintf( '<a href="%s">%s</a>', $addonurl, __( 'Add-ons', WC_RBP_TXT ) );
$action = array_merge( $actions, $action );
return $action;
}
/**
* Adds Some Plugin Options
*
* @param array $plugin_meta
* @param string $plugin_file
*
* @return array
* @since 0.11
*/
public function plugin_row_links( $plugin_meta, $plugin_file ) {
if ( WC_RBP_FILE == $plugin_file ) {
$plugin_meta[] = sprintf( '<a href="%s">%s</a>', '#', __( 'Docs', WC_RBP_TXT ) );
$plugin_meta[] = sprintf( '<a href="%s">%s</a>', 'https://github.com/varunsridharan/woocommerce-role-based-price', __( 'View On Github', WC_RBP_TXT ) );
$plugin_meta[] = sprintf( '<a href="%s">%s</a>', 'https://github.com/varunsridharan/woocommerce-role-based-price/issues', __( 'Report Issue', WC_RBP_TXT ) );
$plugin_meta[] = sprintf( '&hearts; <a href="%s">%s</a>', 'https://www.paypal.me/varunsridharan23', __( 'Donate', WC_RBP_TXT ) );
$plugin_meta[] = sprintf( '<a href="%s">%s</a>', 'http://varunsridharan.in/plugin-support/', __( 'Contact Author', WC_RBP_TXT ) );
}
return $plugin_meta;
}
}
<?php
/**
* The admin-specific functionality of the plugin.
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/Admin
* @since 3.0
*/
if( ! defined('WPINC') ) {
die;
}
class WooCommerce_Role_Based_Price_Admin_Ajax_Handler {
public function __construct() {
add_action('wp_ajax_wc_rbp_clear_variation_cache', array( $this, 'clear_variation_cache' ));
add_action('wp_ajax_wc_rbp_save_product_prices', array( $this, 'save_product_rbp_price' ));
add_action('wp_ajax_nopriv_wc_rbp_addon_custom_css', array( $this, 'render_addon_css' ));
add_action('wp_ajax_wc_rbp_addon_custom_css', array( $this, 'render_addon_css' ));
add_action('wp_ajax_nopriv_wc_rbp_addon_custom_js', array( $this, 'render_addon_js' ));
add_action('wp_ajax_wc_rbp_addon_custom_js', array( $this, 'render_addon_js' ));
add_action('wp_ajax_wc_rbp_metabox_refersh', array( $this, 'refresh_metabox' ));
}
public function clear_variation_cache() {
if( ! isset($_REQUEST['post_id']) ) {
wp_send_json_error(__('Invalid Product ID', WC_RBP_TXT));
}
$id = sanitize_text_field($_REQUEST['post_id']);
$parent = wp_get_post_parent_id($id);
if( $parent !== FALSE ) {
$allowed_roles = array_keys(wc_rbp_get_user_roles_selectbox());
foreach( $allowed_roles as $role ) {
wc_rbp_delete_variation_data($id, $role);
}
}
wp_send_json_success(array( __("Success") ));
}
public function refresh_metabox() {
if( ! isset($_REQUEST['pid']) ) {
wp_send_json_error(__('Invalid Product ID', WC_RBP_TXT));
}
if( ! isset($_REQUEST['parentID']) ) {
wp_send_json_error(__('Invalid Product ID', WC_RBP_TXT));
}
$id = sanitize_text_field($_REQUEST['pid']);
$parentid = sanitize_text_field($_REQUEST['parentID']);
$metabox = new WooCommerce_Role_Based_Price_Product_Metabox;
ob_start();
//$metabox->generate_variation_selectbox($parentid,$id);
$metabox->render_price_editor_metabox($id);
$content = ob_get_contents();
ob_end_clean();
wp_send_json_success($content);
wp_die();
}
public function render_addon_css() {
header('Content-Type: text/css');
do_action('wc_rbp_addon_styles');
wp_die();
}
public function render_addon_js() {
header('Content-Type: text/javascript');
do_action('wc_rbp_addon_scripts');
wp_die();
}
public function save_product_rbp_price() {
$is_verifyed_nounce = wp_verify_nonce($_POST['wc_rbp_nounce'], 'wc_rbp_save_product_prices');
$error = array();
$type = isset($_POST['type']) ? $_POST['type'] : 'default';
$success = array( 'hidden_fields' => wc_rbp_get_editor_fields($type) );
$posted_values = $_POST;
if( $is_verifyed_nounce ) {
do_action_ref_array('wc_rbp_product_save_' . $type, array( &$posted_values, &$success, &$error ));
} else {
$error['html'] = '<h3>' . __("Unable To Process Your Request Please Try Again later", WC_RBP_TXT) . '</h3>';
}
if( empty($error) ) {
wp_send_json_success($success);
} else {
$error['hidden_fields'] = wc_rbp_get_editor_fields($type);
wp_send_json_error($error);
}
wp_die();
}
}
\ No newline at end of file
<?php
/**
* The admin-specific functionality of the plugin.
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/Admin
* @since 3.0
*/
if( ! defined('WPINC') ) {
die;
}
class WooCommerce_Role_Based_Price_Admin_Sample_Class {
public function __construct() {
}
}
\ No newline at end of file
<?php
class WooCommerce_Role_Based_Price_Product_Metabox {
public function __construct() {
add_action('add_meta_boxes_product', array( $this, 'add_metabox' ));
}
public function add_metabox($post) {
add_meta_box('wc-rbp-product-editor', __('Role Based Price For WooCommerce Editor', WC_RBP_TXT), array(
$this,
'render_price_editor_metabox',
), 'product', 'advanced', 'high');
}
public function render_price_editor_metabox($post) {
if( is_object($post) ) {
$id = $post->ID;
} else {
$id = $post;
}
$prod = NULL;
$prodType = $this->get_post_type($id);
$url = admin_url('admin-ajax.php?action=wc_rbp_save_product_prices');
$render_info = '<div class="wc-rbp-metabox-container" method="POST" action="' . $url . '" > ';
$render_info .= wc_rbp_get_ajax_overlay();
$this->allowed_roles = wc_rbp_allowed_roles();
$this->registered_roles = wc_rbp_get_wp_roles();
$args = array();
$args['render_default'] = TRUE;
$args['html'] = '';
$args['postid'] = $id;
$args['mb'] = $this;
$args['parentID'] = isset($_REQUEST['parentID']) ? sanitize_text_field($_REQUEST['parentID']) : $id;
$args['selectedID'] = isset($_REQUEST['pid']) ? sanitize_text_field($_REQUEST['pid']) : $id;
$args = apply_filters_ref_array('wc_rbp_metabox_render', array( &$args ));
if( $args['render_default'] ) {
$render_info .= $this->render_default_metabox($id, $post, $args);
} else {
$render_info .= $args['html'];
}
$render_info .= '</div>';
echo $render_info;
}
public function get_post_type($id) {
$product_type = '';
if( $terms = wp_get_object_terms($id, 'product_type') ) {
$product_type = sanitize_title(current($terms)->name);
} else {
$product_type = apply_filters('default_product_type', 'simple');
}
return $product_type;
}
public function render_default_metabox($id, $post, $args, $type = 'default') {
$product_type = $this->get_post_type($id);
$render_info = '';
$post_type = get_post_type($id);
if( $product_type == 'variable' || $post_type == 'product_variation' ) {
$render_info .= $this->generate_variation_selectbox($args['parentID'], $id);
} else {
ob_start();
do_action("wc_rbp_metabox_header", $id, $product_type, $post, $this);
$render_info .= ob_get_contents();
ob_end_clean();
}
$prod = wc_get_product($id);
$prodType = 'simple';
if( is_object($prod) ) {
if( wc_rbp_is_wc_v('>=', '3.0.0') ) {
$prodType = $prod->get_type();
} else {
$prodType = $prod->product_type;
}
}
ob_start();
do_action('wc_rbp_before_metabox_content', $prod, $prodType);
$render_info .= ob_get_contents();
ob_end_clean();
$tabs = $this->get_metabox_tabs($id, $prodType);
$content = $this->get_metabox_content($id, $tabs, $prod, $prodType);
$render_info .= wc_rbp_generate_tabs($tabs, $content);
$render_info .= wc_rbp_get_editor_fields($type);
$render_info .= '<input type="hidden" id="wc_rbp_product_id" name="product_id" value="' . $id . '" /> ';
ob_start();
do_action('wc_rbp_after_metabox_content', $prod, $prodType);
$render_info .= ob_get_contents();
ob_end_clean();
$render_info .= $this->render_metabox_footer($id);
return $render_info;
}
public function generate_variation_selectbox($id, $selected = '') {
$header = $this->render_selectbox_header();
$args = array(
'post_type' => 'product_variation',
'post_status' => array( 'private', 'publish' ),
'posts_per_page' => -1,
'orderby' => array( 'menu_order' => 'ASC', 'ID' => 'DESC' ),
'post_parent' => $id,
'fields' => 'ids',
);
$variations = get_children($args);
$return = ' <optgroup label="' . __("Variations", WC_RBP_TXT) . '"> ';
foreach( $variations as $ids ) {
$prod = wc_get_product($ids);
$name = '#' . $ids . ' | ';
if( wc_rbp_is_wc_v('>=', '3.0') ) {
$name .= ' ' . wc_get_formatted_variation($prod, TRUE);
} else {
$name .= ' ' . $prod->get_formatted_variation_attributes(TRUE);
}
$selecteds = '';
if( $selected == $ids ) {
$selecteds = 'selected';
}
$return .= '<option data-type="variation" value="' . $ids . '" ' . $selecteds . '>' . $name . '</option>';
}
$return .= ' </optgroup> ';
$footer = $this->render_selectbox_footer();
$return = apply_filters("role_based_price_metabox_variation_select", $return, $selected, $id);
$return = $header . $return . $footer;
return $return;
}
public function render_selectbox_header($placeholder = '') {
if( empty($placeholder) ) {
$placeholder = __("Select A Variation : ", WC_RBP_TXT);
}
$header = '<select id="wc_rbp_variation_select" style="width: 30%; display: inline-block; vertical-align: middle; margin-left: 10px;" name="wc_rbp_variation_select" class="wcrbpvariationbx"> <option value="">' . $placeholder . '</option>';
return apply_filters("role_based_price_admin_selectbox_header", $header);
}
public function render_selectbox_footer() {
return apply_filters("role_based_price_admin_selectbox_header", '</select>');
}
public function get_metabox_tabs($id, $prodType) {
$tabs = apply_filters('wc_rbp_before_default_product_tabs', array(), $id, $prodType);
$registered_roles = $this->registered_roles;
foreach( $this->allowed_roles as $role ) {
if( isset($registered_roles[$role]) ) {
$icon = 'dashicons dashicons-admin-users';
$tabs[$role] = array(
'title' => $registered_roles[$role]['name'],
'icon' => $icon,
'show_status' => TRUE,
);
}
}
$tabs = apply_filters('wc_rbp_after_default_product_tabs', $tabs, $id, $prodType);
return $tabs;
}
public function get_metabox_content($id, $tabs, $prod, $prodType) {
$content = array();
foreach( $tabs as $tab_id => $val ) {
ob_start();
do_action('wc_rbp_price_edit_tab_' . $tab_id . '_before', $id, $prodType, $prod, $tab_id);
do_action('wc_rbp_price_edit_tab_' . $tab_id, $id, $prodType, $prod, $tab_id);
do_action('wc_rbp_price_edit_tab_' . $tab_id . '_after', $id, $prodType, $prod, $tab_id);
$content[$tab_id] = ob_get_contents();
ob_end_clean();
}
return $content;
}
public function render_metabox_footer($id) {
$base_price = $this->get_base_price($id);
$clbtn = '';
$product_type = wp_get_post_terms($id, 'product_type', array( 'fields' => 'names' ));
if( in_array('variable', $product_type) || get_post_type($id) == 'product_variation' ) {
$clbtn = '<button style="float:left;" type="button" id="wc_rbp_clear_trasient" class="button button-secondary">' . __('Clear Cache', WC_RBP_TXT) . '</button>';
}
return ' <h2 class="" style="margin: 0px -12px -12px; border-top: 1px solid #eee; text-align:right;">
<span class="wc_rbp_base_product_price">' . $base_price . '</span>
' . $clbtn . '
<button type="button" id="wc_rbp_update_price" class="button button-primary">' . __('Save Price', WC_RBP_TXT) . '</button></h2> ';
}
public function get_base_price($id) {
$pro = wc_get_product($id);
$price = '';
if( is_object($pro) ) {
$price = array();
$this->hook_filter(TRUE);
$price['regular_price'] = wc_rbp_price_types('regular_price') . ' : ';
$price['regular_price'] .= wc_price($pro->get_regular_price());
$price['selling_price'] = wc_rbp_price_types('selling_price') . ' : ';
$price['selling_price'] .= wc_price($pro->get_sale_price());
$this->hook_filter(FALSE);
$price = implode(' | ', $price);
}
$head = '<span class="headTxt">' . __("WC Product Price : ") . '</span>' . $price;
return $head;
}
public function hook_filter($hook = TRUE) {
if( $hook == TRUE ) {
add_filter('role_based_price_status', array( $this, 'base_price_return_false' ));
}
if( ! $hook == TRUE ) {
remove_filter('role_based_price_status', array( $this, 'base_price_return_false' ));
}
}
public function base_price_return_false($s) {
return FALSE;
}
}
return new WooCommerce_Role_Based_Price_Product_Metabox;
\ No newline at end of file
<?php
/**
* The admin-specific functionality of the plugin.
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/Admin
* @since 3.0
*/
if( ! defined('WPINC') ) {
die;
}
class WooCommerce_Role_Based_Price_Admin_Price_Editor_Fields {
public function __construct() {
add_action("wc_rbp_before_metabox_content", array( $this, 'register_price_fields' ));
add_filter('wc_rbp_before_default_product_tabs', array( $this, 'add_general_tab' ));
add_action('wc_rbp_price_edit_tab_general', array( $this, 'add_status_field' ), 10, 4);
}
public function add_general_tab($tabs) {
$tabs['general'] = array( 'title' => __('General', WC_RBP_TXT),
'icon' => 'dashicons-admin-tools',
'show_status' => FALSE,
);
return $tabs;
}
public function add_status_field($product_id, $prodType, $prod, $tab_id) {
$status = product_rbp_status($product_id) == 'true' ? 'checked' : '';
$content = '<div class="wc_rbp_price_container wc_rbp_popup_section wc_rbp_popup_section_' . $tab_id . '">';
$content .= '<div class="enable_field_container">';
$content .= '<p class="form-field ">';
$content .= '<label class="enable_text" for="enable_role_based_price">' . __('Enable Role Based Pricing', WC_RBP_TXT) . ' </label> ';
$content .= ' <input type="checkbox" data-secondaryColor="#999" data-size="small" class="wc_rbp_checkbox" id="enable_role_based_price" name="enable_role_based_price" ' . $status . '/> ';
$content .= '</p>';
$content .= '</div>';
$content .= '</div>';
echo $content;
}
public function register_price_fields() {
$allowed_roles = wc_rbp_allowed_roles();
foreach( $allowed_roles as $role ) {
add_action('wc_rbp_price_edit_tab_' . $role, array( $this, 'generate_price_field' ), 10, 4);
}
}
public function generate_price_field($product_id, $prodType, $prod, $tab_id) {
global $product;
$allowed_price = wc_rbp_allowed_price();
$price_exists = wc_rbp_price_types();
$output_html = '<div class="wc_rbp_price_container wc_rbp_popup_section wc_rbp_popup_section_' . $tab_id . '">';
foreach( $allowed_price as $price ) {
$field_id = 'role_based_price[' . $tab_id . '][' . $price . ']';
$defaults = array(
'type' => 'text',
'label' => $price_exists[$price],
'description' => __('Enter Product\'s ') . $price_exists[$price],
'class' => array(),
'label_class' => array(),
'input_class' => array( 'wc_input_price', $price, 'wc_rbp_' . $price ),
'return' => TRUE,
'custom_attributes' => array(),
);
$output_html .= '<div class="wc_rbp_pop_field_50 wc_rbp_pop_field_' . $price . '">';
$price = wc_rbp_price($product_id, $tab_id, $price);
$output_html .= woocommerce_form_field($field_id, $defaults, $price);
$output_html .= '</div>';
}
$output_html .= '</div>';
echo $output_html;
}
}
return new WooCommerce_Role_Based_Price_Admin_Price_Editor_Fields;
\ No newline at end of file
<?php
/**
* WooCommerce Product Role Based Price Edit Functions
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/Admin
* @since 3.0
*/
if( ! defined('WPINC') ) {
die;
}
class WooCommerce_Role_Based_Price_Admin_Product_Functions {
public function __construct() {
add_action('wc_rbp_product_save_default', array( $this, 'simple_save_product_price' ), 1, 3);
}
public function simple_save_product_price(&$posted_values, &$success, &$error) {
$post_id = $posted_values['product_id'];
do_action_ref_array('wc_rbp_product_save_before', array( &$posted_values ));
if( isset($posted_values['role_based_price']) ) {
$status = isset($posted_values['enable_role_based_price']) ? TRUE : FALSE;
wc_rbp_update_role_based_price_status($post_id, $status);
wc_rbp_update_role_based_price($post_id, $posted_values['role_based_price']);
clean_post_cache($post_id);
$success['html'] = '<h3>' . __("Product Price Updated.", WC_RBP_TXT) . '</h3>';
} else {
$error['html'] = '<h3>' . __("Price Not Defined. Please Try Again", WC_RBP_TXT) . '</h3>';
}
do_action_ref_array('wc_rbp_product_save_after', array( &$posted_values ));
}
}
return new WooCommerce_Role_Based_Price_Admin_Product_Functions;
\ No newline at end of file
<?php
/**
* Class for registering settings and sections and for display of the settings form(s).
* For detailed instructions see: https://github.com/keesiemeijer/WP-Settings
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/WordPress/Settings
* @since 3.0
* @version 2.0
* @author keesiemeijer
*/
if( ! class_exists('WooCommerce_Role_Based_Price_Settings_WP_Fields') ) {
class WooCommerce_Role_Based_Price_Settings_WP_Fields {
public $version = 2.0;
/**
* Validated settings errors
*
* @since 0.1
*
* @var array
*/
public $settings_errors;
/**
* constructor
*/
public function __construct($errors = array()) {
$this->settings_errors = (array) $errors;
}
/**
* Displays a text input setting field.
*
* @param array $args
* @param string $type Type attribute
*/
public function callback_text($args) {
$args['size'] = ( isset($args['size']) && $args['size'] ) ? $args['size'] : 'regular';
$type = ! empty($args['text_type']) ? esc_attr($args['text_type']) : 'text';
$args = $this->get_arguments($args); // escapes all attributes
$value = (string) esc_attr($this->get_option($args));
$error = $this->get_setting_error($args['id']);
$html = sprintf('<input type="%6$s" id="%1$s_%2$s" name="%1$s[%2$s]" value="%3$s"%4$s%5$s/>', $args['section'], $args['id'], $value, $args['attr'], $error, $type);
echo $args['before'] . $html . $args['after'] . $this->description($args['desc']);
}
/**
* Displays a textarea.
*
* @param array $args
*/
public function callback_textarea($args) {
$size = ( isset($args['size']) && $args['size'] ) ? $args['size'] : 'regular';
$args = $this->get_arguments($args); // escapes all attributes
$value = (string) esc_textarea($this->get_option($args));
$error = $this->get_setting_error($args['id']);
$html = sprintf('<textarea id="%1$s_%2$s" name="%1$s[%2$s]"%4$s%5$s>%3$s</textarea>', $args['section'], $args['id'], $value, $args['attr'], $error);
echo $args['before'] . $html . $args['after'] . $this->description($args['desc']);
}
/**
* Displays a textarea.
*
* @param array $args
*/
public function callback_richtext($args) {
$settings = isset($args['richtext_settings']) ? $args['richtext_settings'] : array();
$size = ( isset($args['size']) && $args['size'] ) ? $args['size'] : 'regular';
$args = $this->get_arguments($args); // escapes all attributes
$value = $this->get_option($args);
$error = $this->get_setting_error($args['id']);
$settings['textarea_name'] = $args['section'] . '[' . $args['id'] . ']';
$content = wp_editor($value, $args['id'], $settings);
echo $args['before'] . $content . $args['after'] . $this->description($args['desc']);
}
/**
* Displays a select dropdown.
*
* @param array $args
*/
public function callback_select($args) {
$args = $this->get_arguments($args); // escapes all attributes
$value = array_map('esc_attr', array_values((array) $this->get_option($args)));
$multiple = ( preg_match('/multiple="multiple"/', strtolower($args['attr'])) ) ? '[]' : '';
$value = ( '[]' === $multiple ) ? $value : $value[0];
$html = sprintf('<select id="%1$s_%2$s" name="%1$s[%2$s]%4$s"%3$s>', $args['section'], $args['id'], $args['attr'], $multiple);
foreach( (array) $args['options'] as $opt => $label ) {
if( '[]' === $multiple ) {
$selected = ( in_array($opt, $value) ) ? ' selected="selected" ' : '';
} else {
$selected = selected($value, $opt, FALSE);
}
$html .= sprintf('<option value="%s"%s>%s</option>', $opt, $selected, $label);
}
$html .= sprintf('</select>');
echo $args['before'] . $html . $args['after'] . $this->description($args['desc']);
}
/**
* Displays a single checkbox.
*
* @param array $args
*/
public function callback_checkbox($args) {
$args = $this->get_arguments($args); // escapes all attributes
$value = (string) esc_attr($this->get_option($args));
$error = $this->get_setting_error($args['id'], ' style="border: 1px solid red; padding: 2px 1em 2px 0; "');
$html = '';
$input = sprintf('<input type="checkbox" id="%1$s_%2$s" name="%1$s[%2$s]" value="on"%4$s%5$s />', $args['section'], $args['id'], $value, checked($value, 'on', FALSE), $args['attr']);
$html .= sprintf('<label for="%1$s_%2$s"%5$s>%3$s %4$s</label>', $args['section'], $args['id'], $input, $args['desc'], $error);
echo $html . '';
}
/**
* Displays multiple checkboxes.
*
* @param array $args
*/
public function callback_multicheckbox($args) {
$args = $this->get_arguments($args); // escapes all attributes
$value = array_map('esc_attr', array_values((array) $this->get_option($args)));
$count = count($args['options']);
$html = '<fieldset>';
$i = 0;
foreach( (array) $args['options'] as $opt => $label ) {
$error = $this->get_setting_error($opt, ' style="border: 1px solid red; padding: 2px 1em 2px 0; "');
$checked = ( in_array($opt, $value) ) ? ' checked="checked" ' : '';
$input = sprintf('<input type="checkbox" id="%1$s_%2$s_%3$s" name="%1$s[%2$s][%3$s]" value="%3$s"%4$s%5$s />', $args['section'], $args['id'], $opt, $checked, $args['attr']);
$html .= sprintf('<label for="%1$s_%2$s_%4$s"%6$s>%3$s %5$s</label>', $args['section'], $args['id'], $input, $opt, $label, $error);
$html .= ( isset($args['row_after'][$opt]) && $args['row_after'][$opt] ) ? $args['row_after'][$opt] : '';
$html .= ( ++$i < $count ) ? '<br/>' : '';
}
echo $html . '</fieldset>' . $this->description($args['desc']);
}
/**
* Displays radio buttons.
*
* @param array $args
*/
public function callback_radio($args) {
$args = $this->get_arguments($args); // escapes all attributes
$value = (string) esc_attr($this->get_option($args));
$options = array_keys((array) $args['options']);
// make sure one radio button is checked
if( empty($value) && ( isset($options[0]) && $options[0] ) ) {
$value = $options[0];
} else if( ! empty($value) && ( isset($options[0]) && $options[0] ) ) {
if( ! in_array($value, $options) )
$value = $options[0];
}
$html = '<fieldset>';
$i = 0;
$count = count($args['options']);
foreach( (array) $args['options'] as $opt => $label ) {
$input = sprintf('<input type="radio" id="%1$s_%2$s_%3$s" name="%1$s[%2$s]" value="%3$s"%4$s%5$s />', $args['section'], $args['id'], $opt, checked($value, $opt, FALSE), $args['attr']);
$html .= sprintf('<label for="%1$s_%2$s_%4$s">%3$s%5$s</label>', $args['section'], $args['id'], $input, $opt, ' <span>' . $label . '</span>');
$html .= ( isset($args['row_after'][$opt]) && $args['row_after'][$opt] ) ? $args['row_after'][$opt] : '';
$html .= ( ++$i < $count ) ? '<br/>' : '';
}
echo '</fieldset>' . $html . $this->description($args['desc']);
}
/**
* Displays type 'content' field.
*
* @param array $args
*/
public function callback_content($args) {
if( isset($args['content']) )
echo $args['content'];
if( isset($args['desc']) )
echo $this->description($args['desc']);
}
/**
* Displays field with the action hook '{$page_hook}_add_extra_field'.
*
* @param array $args
*/
function callback_extra_field($args) {
if( isset($args['callback']) && $args['callback'] ) {
if( isset($args['page_hook']) && $args['page_hook'] )
do_action($args['page_hook'] . '_add_extra_field', $args);
}
}
/**
* Returns a field description.
*
* @param string $desc Description of field.
*/
public function description($desc = '') {
if( $desc ) {
//return sprintf( '<p class="description">%s</p>', $desc );
}
}
/**
* Returns validation errors for a settings field.
*
* @param string $setting_id Settings field ID.
* @param string $style Style to override the default error style.
*
* @return string Empty string or inline style attribute.
*/
protected function get_setting_error($setting_id, $attr = '') {
$display_error = '';
if( ! empty($this->settings_errors) ) {
foreach( $this->settings_errors as $error ) {
if( isset($error['setting']) && $error['setting'] === $setting_id ) {
if( '' === $attr ) {
// todo: don't use inline styles
$display_error = ' style="border: 1px solid red;"';
} else {
$display_error = $attr;
}
}
}
}
return $display_error;
}
/**
* Escapes and creates additional attributes for a setting field.
*
* @param string|array $args Arguments of a setting field.
* @param string $input Type of field.
* @param string $size Size of field (class name).
*
* @return array All arguments and attributes
*/
protected function get_arguments($args = '', $class = FALSE) {
// escape section, id and options used in attributes
$args['section'] = esc_attr($args['section']);
$args['id'] = esc_attr($args['id']);
if( isset($args['options']) && $args['options'] ) {
$options = array();
foreach( (array) $args['options'] as $key => $value ) {
$options[esc_attr($key)] = $value;
}
$args['options'] = $options;
}
// additional parameters
$attr_string = '';
$defaults = $attr = array();
if( isset($args['attr']) && $args['attr'] ) {
$attr = $args['attr'];
}
// set defaults for a textarea field
if( 'textarea' === $args['type'] ) {
$defaults = array( 'rows' => '5', 'cols' => '55' );
}
// todo: add action to add additional defaults
$attr['class'] = isset($attr['class']) ? trim($attr['class']) : '';
if( isset($args['size']) && $args['size'] ) {
if( 'text' === $args['type'] || 'textarea' === $args['type'] ) {
$attr['class'] .= sprintf(' %1$s-%2$s', $args['size'], $args['type']);
}
}
if( $class ) {
if( ! preg_match('/\s' . preg_quote((string) $class, '/') . '\s/', $attr['class']) ) {
$attr['class'] = ' ' . (string) $class;
}
}
if( '' === $attr['class'] ) {
unset($attr['class']);
}
// create attribute string
foreach( $attr as $key => $arg ) {
$arg = ( 'class' === $arg ) ? sanitize_html_class($arg) : esc_attr($arg);
$attr_string .= ' ' . trim($key) . '="' . trim($arg) . '"';
}
$args['attr'] = $attr_string;
return $args;
}
/**
* Returns the value of a setting field.
*
* @param array $args Arguments of setting field
*
* @return string
*/
public function get_option($args) {
if( isset($args['value']) ) {
return $args['value'];
}
// get the value for the setting field from the database
$options = get_option($args['section']);
// return the value if it exists
if( isset($options[$args['id']]) ) {
return $options[$args['id']];
}
// return the default value
return ( isset($args['default']) ) ? $args['default'] : '';
}
} // class
} // class exists
\ No newline at end of file
<?php
/**
* The admin-specific functionality of the plugin.
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/Admin
* @since 3.0
*/
if( ! defined('WPINC') ) {
die;
}
class WooCommerce_Role_Based_Price_Admin_Settings_Options {
public function __construct() {
add_filter('wc_rbp_settings_pages', array( $this, 'settings_pages' ));
add_filter('wc_rbp_settings_section', array( $this, 'settings_section' ));
add_filter('wc_rbp_settings_fields', array( $this, 'settings_fields' ));
}
public function settings_pages($page) {
$page[] = array( 'id' => 'general', 'slug' => 'general', 'title' => __('General', WC_RBP_TXT) );
$page[] = array(
'id' => 'addonssettings',
'slug' => 'addonssettings',
'title' => __('Extensions Options', WC_RBP_TXT),
);
$page[] = array( 'id' => 'addons', 'slug' => 'wcrbpaddons', 'title' => __('Extensions', WC_RBP_TXT) );
return $page;
}
public function settings_section($section) {
$section['general'][] = array( 'id' => 'general', 'title' => __('General', WC_RBP_TXT) );
$section['addons'][] = array( 'id' => 'addons', 'title' => '' );
$addonSettings = array(
'addon_sample' => array(
'id' => 'addonssettings',
'title' => __('No Addons Activated / Installed.', WC_RBP_TXT),
),
);
$addonSettings = apply_filters('wc_rbp_addon_sections', $addonSettings);
if( count($addonSettings) > 1 )
unset($addonSettings['addon_sample']);
$section['addonssettings'] = $addonSettings;
return $section;
}
public function settings_fields($fields) {
$fields['general']['general'][] = array(
'id' => WC_RBP_DB . 'allowed_roles',
'multiple' => 'true',
'type' => 'select',
'label' => __('Allowed User Roles', WC_RBP_TXT),
'desc' => __('User Roles To List In Product Edit Page', WC_RBP_TXT),
'options' => wc_rbp_sort_array_by_array(wc_rbp_get_user_roles_selectbox(), wc_rbp_allowed_roles()),
'attr' => array(
'class' => 'wc-rbp-enhanced-select',
'multiple' => 'multiple',
),
);
$fields['general']['general'][] = array(
'id' => WC_RBP_DB . 'allowed_price',
'type' => 'select',
'multiple' => TRUE,
'label' => __('Allowed Product Pricing', WC_RBP_TXT),
'desc' => __('Price Fields To List In Product Edit Page', WC_RBP_TXT),
'options' => wc_rbp_sort_array_by_array(wc_rbp_avaiable_price_type(), wc_rbp_allowed_price()),
'attr' => array(
'class' => 'wc-rbp-enhanced-select',
'style' => 'width:auto;max-width:35%;',
'multiple' => 'multiple',
),
);
$price_type = wc_rbp_avaiable_price_type();
foreach( $price_type as $pK => $pV ) {
$fields['general']['general'][] = array(
'id' => WC_RBP_DB . $pK . '_label',
'type' => 'text',
'label' => $pV . __(' Label ', WC_RBP_TXT),
'default' => $pV,
'attr' => array(
'style' => 'width:auto;max-width:35%;',
),
);
}
if( class_exists('woocommerce_wpml') ) {
$fields['general']['general'][] = array(
'id' => WC_RBP_DB . 'enable_wpml_integration',
'type' => 'checkbox',
'label' => __('WPML Integration', WC_RBP_TXT),
'desc' => __('check if you have installed wpml and the price are showing wrong. ', WC_RBP_TXT),
'attr' => array( 'class' => 'wc_rbp_checkbox', ),
);
}
$addonSettings = array( 'addon_sample' => array() );
$addonSettings = apply_filters('wc_rbp_addon_fields', $addonSettings);
unset($addonSettings['addon_sample']);
$fields['addonssettings'] = $addonSettings;
return $fields;
}
}
return new WooCommerce_Role_Based_Price_Admin_Settings_Options;
\ No newline at end of file
<?php
/**
* Class for registering settings and sections and for display of the settings form(s).
* For detailed instructions see: https://github.com/keesiemeijer/WP-Settings
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/WordPress/Settings
* @since 3.0
* @version 2.0
* @author keesiemeijer
*/
if( ! defined('WPINC') ) {
die;
}
class WooCommerce_Role_Based_Price_Settings_Framework {
public $settings;
private $page_hook = '';
private $settings_page;
private $settings_section;
private $settings_fields;
private $create_function;
private $settings_key;
private $settings_values;
function __construct($page_hook = '') {
$this->settings_section = array();
$this->settings_fields = array();
$this->create_function = array();
$this->add_settings_pages();
//$this->get_settings();
$this->add_settings_section();
$this->create_callback_function();
$this->page_hook = $page_hook;
if( empty($page_hook) ) {
add_action('admin_menu', array( $this, 'admin_menu' ));
}
add_action('admin_init', array( $this, 'admin_init' ));
}
private function add_settings_pages() {
$pages = array();
$pages = apply_filters('wc_rbp_settings_pages', $pages);
$this->settings_page = $pages;
}
private function add_settings_section() {
$section = array();
$section = apply_filters('wc_rbp_settings_section', $section);
$this->settings_section = $section;
}
private function create_callback_function() {
$sec = $this->settings_section;
foreach( $sec as $sk => $s ) {
if( is_array($s) ) {
$c = count($s);
$a = 0;
while( $a < $c ) {
if( isset($s[$a]['validate_callback']) ) {
$this->create_function[] = $s[$a]['id'];
$s[$a]['validate_callback'] = '';
$file = addslashes(WC_RBP_SETTINGS . 'validate-' . $s[$a]['id'] . '.php');
$s[$a]['validate_callback'] = create_function('$fields', 'do_action("wc_rbp_settings_validate",$fields); do_action("wc_rbp_settings_validate_' . $s[$a]['id'] . '",$fields);');
}
$a++;
}
}
$this->settings_section[$sk] = $s;
}
}
function admin_menu() {
$this->page_hook = add_submenu_page('woocommerce', __('Role Based Price Settings', WC_RBP_TXT), __('Role Based Price Settings', WC_RBP_TXT), 'manage_woocommerce', WC_RBP_SLUG . '-settings', array(
$this,
'admin_page',
));
}
function admin_init() {
$this->settings = new WooCommerce_Role_Based_Price_WP_Settings();
$this->add_settings_fields();
$this->settings->add_pages($this->settings_page);
$sections = $this->settings_section;
foreach( $sections as $page_id => $section_value ) {
$pages = $this->settings->add_sections($page_id, $section_value);
}
$fields = $this->settings_field;
foreach( $fields as $page_id => $section_fields ) {
foreach( $section_fields as $section_id => $sfields ) {
if( is_array($sfields) ) {
foreach( $sfields as $f ) {
$pages = $this->settings->add_field($page_id, $section_id, $f);
}
} else {
$pages = $this->settings->add_field($page_id, $section_id, $sfields);
}
}
}
$this->settings->init($pages, WC_RBP_DB);
}
private function add_settings_fields() {
global $fields;
$fields = array();
$fields = apply_filters('wc_rbp_settings_fields', $fields);
$this->settings_field = $fields;
}
public function admin_page() {
echo '<div class="wrap wc_rbp_settings">';
settings_errors();
$this->settings->render_header();
//echo $this->settings->debug;
$this->settings->render_form();
echo '</div>';
}
function get_option($id = '') {
if( ! empty($this->settings_values) && ! empty($id) ) {
if( isset($this->settings_values[$id]) ) {
return $this->settings_values[$id];
}
}
return FALSE;
}
function get_settings($key = '') {
$values = array();
foreach( $this->settings_page as $settings ) {
$this->settings_key[] = WC_RBP_DB . $settings['slug'];
$db_val = get_option(WC_RBP_DB . $settings['slug']);
if( is_array($db_val) ) {
unset($db_val['section_id']);
$values = array_merge($db_val, $values);
}
}
$this->settings_values = $values;
return $values;
}
}
\ No newline at end of file
<?php
/**
* Class for registering settings and sections and for display of the settings form(s).
* For detailed instructions see: https://github.com/keesiemeijer/WP-Settings
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/WordPress/Settings
* @since 3.0
* @version 2.0
* @author keesiemeijer
*/
if( ! class_exists('WooCommerce_Role_Based_Price_WP_Settings') ) {
class WooCommerce_Role_Based_Price_WP_Settings {
/**
* Version of WP_Settings_Settings class
*
* @since 2.0
* @var
*/
public $version = 2.0;
/**
* Current settings page.
*
* @since 2.0
* @var array
*/
public $current_page = array();
/**
* Debug errors and notices.
*
* @since 2.0
* @var string
*/
public $debug = '';
/**
* Admin pages.
*
* @since 2.0
* @var array
*/
private $pages = array();
/**
* Admin pages.
*
* @since 2.0
* @var array
*/
private $fields;
/**
* Unique plugin admin page hook suffix.
*
* @since 2.0
* @var array
*/
private $page_hook;
/**
* Fields that need Javascript. (e.g. colorpicker)
*
* @since 2.0
* @var array
*/
private $script_types;
/**
* Fields that need the label_argument in add_settings_field()
*
* @since 2.0
* @var array
*/
private $label_for = array( 'text', 'select', 'textarea' );
/**
* array of Javascrips needed for the current settings page
*
* @since 2.0
* @var array
*/
private $load_scripts = array();
/**
* Multiple forms on one settings page.
*
* @since 2.0
* @var bool
*/
private $multiple_forms = FALSE;
/**
* valid admin pages and fields arrays.
*
* @since 2.0
* @var bool
*/
private $valid_pages = FALSE;
/**
* Registers settings using the WorPres settings Api.
*
* @uses WP_Settings_Settings_Fields class
* @since 2.0 *
*
* @param array $pages Array with admin pages.
* @param string $page_hook Unique plugin admin page hook suffix.
*/
public function init($pages, $page_hook = '') {
$this->pages = (array) $pages;
$this->page_hook = trim(sanitize_title((string) $page_hook));
// Debug strings don't use Gettext functions for translation.
if( ! class_exists('WooCommerce_Role_Based_Price_Settings_WP_Fields') ) {
$this->debug .= "Error: class WooCommerce_Role_Based_Price_Settings_WP_Fields doesn't exist<br/>";
}
if( '' === $this->page_hook ) {
$this->debug .= "Error: parameter 'page_hook' not provided in settings_admin_init()<br/>";
}
// Let external scripts do debugging .
$this->debug .= apply_filters("{$this->page_hook}_debug", $this->debug, $this->pages);
if( $this->debug ) {
return $this->valid_pages = FALSE; // Don't display the form and navigation.
}
// Passed validation (required to show form and navigation).
$this->valid_pages = TRUE;
$this->current_page = $this->get_current_admin_page();
if( isset($this->current_page['multiform']) && $this->current_page['multiform'] ) {
$this->multiple_forms = ( count($this->current_page['sections']) > 1 ) ? TRUE : FALSE;
}
// Instanciate the form fields.
$this->fields = new WooCommerce_Role_Based_Price_Settings_WP_Fields(get_settings_errors());
// Array of fields that needs the 'label_for' parameter (add_settings_field()).
$this->label_for = apply_filters("{$this->page_hook}_label_for", $this->label_for);
// Array of fields that needs javascript (e.g. 'color_picker').
$this->script_types = apply_filters("{$this->page_hook}_script_field_types", array());
$this->add_settings_sections();
// Register all the settings.
$this->register_settings();
// only load javascript if it's needed for the current admin page
if( ! empty($this->load_scripts) ) {
$this->load_scripts = array_unique($this->load_scripts);
add_action('admin_print_scripts-' . $this->page_hook, array( $this, 'enqueue_scripts' ));
}
} // admin_init()
/**
* Adds setting sections
*
* @since 2.0
* @return void
*/
private function add_settings_sections() {
foreach( $this->current_page['sections'] as $section ) {
$section_description = '__return_false';
if( isset($section['desc']) && $section['desc'] ) {
$section_description = array( $this, 'render_section_description' );
}
$title = ( isset($section['title']) ) ? $section['title'] : ''; // optional
// Add page hook to sections and page ids.
$page_id = ( $this->multiple_forms ) ? $section['id'] : $this->current_page['id'];
$page_id = $this->page_hook . '' . $page_id;
$section_id = $this->page_hook . '' . $section['id'];
// Add database option(s) to debug messages.
$this->debug .= ( '' === $this->debug ) ? 'Database option(s) created for this page:<br/>' : '';
$this->debug .= "database option: " . $section_id . '<br/>'; // database option name
add_settings_section($section_id, $title, $section_description, $page_id);
if( isset($section['fields']) && ! empty($section['fields']) ) {
// Add fields to sections.
$this->add_settings_fields($section_id, $section['fields'], $page_id);
}
}
}
/**
* Adds all fields to a settings section.
*
* @since 2.0
*
* @param string $sections_id ID of section to add fields to.
* @param array $fields Array with section fields
* @param string $page_id Page id.
* @param bool $use_defaults Use default values for the settings fields.
*/
private function add_settings_fields($sections_id, $fields, $page_id) {
$opt_defaults = array();
$defaults = array(
'section' => $sections_id,
'id' => '',
'type' => '',
'label' => '',
'desc' => '',
'size' => FALSE,
'options' => '',
'default' => '',
'content' => '',
'attr' => FALSE,
'before' => '',
'after' => '',
'_type' => '',
);
// Check if database option exist (use defaults if it doesn't).
$use_defaults = ( FALSE === get_option($sections_id) ) ? TRUE : FALSE;
foreach( $fields as $field ) {
// Field (rows) can be added by external scripts.
$multiple = ( isset($field['fields']) && $field['fields'] ) ? TRUE : FALSE;
$options = ( $multiple ) ? (array) $field['fields'] : array( $field );
foreach( $options as $key => $opt ) {
$args = wp_parse_args($opt, $defaults);
$args['default'] = ( $use_defaults ) ? $args['default'] : '';
$opt_defaults[$opt['id']] = $args['default'];
if( in_array($args['type'], $this->script_types) ) {
$this->load_scripts[] = $args['type']; // field needs javascript
}
if( in_array($args['type'], $this->label_for) ) {
$args['label_for'] = $sections_id . '' . $args['id'];
}
if( $multiple ) {
$field['fields'][$key] = $args;
}
}
if( $multiple ) {
$args = $field;
}
// ability to add fields with an action hook
if( ! method_exists($this->fields, 'callback_' . $field['type']) ) {
$args['callback'] = $field['type'];
$args['page_hook'] = $this->page_hook;
$field['type'] = 'extra_field';
}
if( method_exists($this->fields, 'callback_' . $field['type']) ) {
add_settings_field($sections_id . '[' . $field['id'] . ']', isset($args['label']) ? $args['label'] : '', array(
$this->fields,
'callback_' . $field['type'],
), $page_id, $sections_id, $args);
}
}
// add the option or validation errors show twice on the first submit (todo: Why?).
if( $use_defaults ) {
add_option($sections_id, $opt_defaults);
}
}
/**
* Registers settings
*
* @since 2.0
* @return void
*/
private function register_settings() {
foreach( $this->pages as $page ) {
foreach( $page['sections'] as $section ) {
// Use section ids for multiple forms.
if( isset($page['multiform']) && $page['multiform'] ) {
$page['id'] = ( count($page['sections']) > 1 ) ? $section['id'] : $page['id'];
}
$page_id = $this->page_hook . '' . $page['id'];
$sections_id = $this->page_hook . '' . $section['id'];
if( isset($section['validate_callback']) && $section['validate_callback'] ) {
register_setting($page_id, $sections_id, $section['validate_callback']);
} else {
register_setting($page_id, $sections_id);
}
}
}
}
/**
* Gets all settings from all sections
*
* @since 2.0
* @return array Array with settings.
*/
public function get_settings($section = '') {
$settings = array();
if( ! empty($section) ) {
return get_option($this->page_hook . '' . $section);
}
foreach( (array) $this->pages as $page ) {
if( ! isset($page['sections']) ) {
continue;
}
foreach( $page['sections'] as $section ) {
if( ! isset($section['id']) ) {
continue;
}
$option = get_option($this->page_hook . '' . $section['id']);
if( $option ) {
unset($option['section_id']);
$settings[$section['id']] = $option;
}
}
}
return $settings;
}
/**
* Returns the current settings page.
*
* @since 2.0
*
* @param array $admin_pages . Array of settings pages.
*
* @return array Current settings page.
*/
public function get_current_admin_page() {
foreach( (array) $this->pages as $page ) {
if( isset($_GET['tab']) && $_GET['tab'] ) {
if( ( $_GET['tab'] === $page['id'] ) || ( $_GET['tab'] === $page['slug'] ) )
$current_page = $page;
}
}
// Set the first settings page as current if it's not a tab.
if( empty($current_page) ) {
$current_page = $this->pages[0];
}
return $current_page;
}
/**
* Adds a admin page.
*
* @since 2.0
*
* @param array $page Page array.
*
* @return array Admin pages array with the page added.
*/
public function add_page($page) {
return $this->pages[] = $page;
}
/**
* Adds multiple admin pages.
*
* @since 2.0
*
* @param array $pages Array with pages.
*
* @return array Admin pages array with the pages added.
*/
public function add_pages($pages) {
foreach( $pages as $page ) {
$this->add_page($page);
}
return $this->pages;
}
/**
* Adds a section to an admin page.
*
* @since 2.0
*
* @param string $page Page id.
* @param array $section Section array.
*
* @return array Admin pages array with the section added.
*/
public function add_section($page, $section) {
foreach( $this->pages as $key => $_page ) {
if( $page !== $_page['id'] ) {
continue;
}
if( isset($this->pages[$key][$page]['sections']) ) {
$this->pages[$key]['sections'] = array();
}
$this->pages[$key]['sections'][] = $section;
}
return $this->pages;
}
/**
* Adds multiple sections to an admin page.
*
* @since 2.0
*
* @param array $string Page id
* @param array $sections Array with sections.
*
* @return array Admin pages array with the sections added.
*/
public function add_sections($page, $sections) {
foreach( $sections as $section ) {
$this->pages = $this->add_section($page, $section);
}
return $this->pages;
}
/**
* Adds a form field to a section.
*
* @since 2.0
*
* @param string $page Page id.
* @param string $section Section id.
* @param array $field Field array.
*
* @return array Admin pages array with the field added.
*/
public function add_field($page, $section, $field) {
foreach( $this->pages as $key => $_page ) {
if( $page !== $_page['id'] ) {
continue;
}
if( ! isset($this->pages[$key]['sections']) ) {
continue;
}
$_sections = $this->pages[$key]['sections'];
foreach( $_sections as $_key => $_section ) {
if( $section !== $_section['id'] ) {
continue;
}
if( ! isset($this->pages[$key]['sections'][$_key]['fields']) ) {
$this->pages[$key]['sections'][$_key]['fields'] = array();
}
$this->pages[$key]['sections'][$_key]['fields'][] = $field;
}
}
return $this->pages;
}
/**
* Adds multiple form fields to a section.
*
* @since 2.0
*
* @param string $page Page id.
* @param string $section Section id.
* @param array $fields Array with fields.
*
* @return array Admin pages array with the fields added.
*/
public function add_fields($page, $section, $fields) {
foreach( $fields as $field ) {
$this->pages = $this->add_field($page, $section, $field);
}
return $this->pages;
}
/**
* Enqueue javascript for fields that need them.
*
* @since 2.0
* @return void
*/
public function enqueue_scripts() {
$screen = get_current_screen();
// Only load scripts on plugin pages.
if( $screen->id === $this->page_hook ) {
do_action("{$this->page_hook}_scripts", $this->load_scripts);
}
}
/**
* Display the description of a section.
*
* @since 2.0
*
* @param array $section Description of section.
*
* @return void
*/
public function render_section_description($section) {
foreach( $this->current_page['sections'] as $setting ) {
if( $this->page_hook . '' . $setting['id'] === $section['id'] )
echo sprintf('<p class="section_desc">%s</p>', $setting['desc']);
}
}
/**
* Display Plugin Title and if needed tabbed navigation.
*
* @since 2.0
*
* @param string $plugin_title Plugin title.
* @param string $tab_id Page id. Manually set the active tab.
*
* @return void
*/
public function render_header($plugin_title = '', $tab_id = FALSE) {
if( ! empty($plugin_title) )
echo get_screen_icon() . '<h2>' . (string) $plugin_title . '</h2>';
// if ( !$this->valid_pages )
// return;
$page_title_count = 0;
foreach( $this->pages as $page ) {
if( isset($page['title']) && $page['title'] )
++$page_title_count;
}
$html = '';
$current = $this->current_page;
$page_ids = wp_list_pluck($this->pages, 'id');
$cur_tab_id = ( $tab_id ) ? (string) $tab_id : $current['id'];
$cur_tab_id = ( in_array($cur_tab_id, $page_ids) ) ? $cur_tab_id : $current['id'];
$i = 0;
foreach( $this->pages as $page ) {
if( ( isset($page['title']) && $page['title'] ) ) {
if( $page_title_count > 1 ) {
$html .= ( 0 === $i ) ? '<h2 class="nav-tab-wrapper">' : '';
$active = '';
if( $cur_tab_id === $page['id'] )
$active = ' nav-tab-active';
// Get the url of the current settings page.
$tab_url = remove_query_arg(array( 'tab', 'settings-updated' ));
// Add query arg 'tab' if it's not the first settings page.
if( $this->pages[0]['id'] !== $page['id'] )
$tab_url = add_query_arg('tab', $page['slug'], $tab_url);
$html .= sprintf('<a href="%1$s" class="nav-tab%2$s" id="%3$s-tab">%4$s</a>', esc_url($tab_url), $active, esc_attr($page['id']), $page['title']);
$html .= ( ++$i === $page_title_count ) ? '</h3>' : '';
}
if( $page_title_count === 1 ) {
if( isset($current['title']) && $current['title'] === $page['title'] ) {
$html .= '<h3>' . $page['title'] . '</h3>';
break;
}
}
}
}
echo $html;
} // render_header()
/**
* Prints out all settings sections added to a particular settings page
*
* Part of the Settings API. Use this in a settings page callback function
* to output all the sections and fields that were added to that $page with
* add_settings_section() and add_settings_field()
*
* @global $wp_settings_sections Storage array of all settings sections added to admin pages
* @global $wp_settings_fields Storage array of settings fields and info about their pages/sections
* @since 2.7.0
*
* @param string $page The slug name of the page whose settings sections you want to output
*/
function do_settings_sections($page) {
global $wp_settings_sections, $wp_settings_fields;
if( ! isset($wp_settings_sections[$page]) )
return;
$section_count = count($wp_settings_sections[$page]);
if( $section_count > 1 ) {
echo '<ul class="subsubsub wc_rbp_settings_submenu">';
foreach( (array) $wp_settings_sections[$page] as $section ) {
echo '<li> <a href="#' . $section['id'] . '">' . $section['title'] . '</a> | </li>';
}
echo '</ul> <br/>';
}
foreach( (array) $wp_settings_sections[$page] as $section ) {
if( $section_count > 1 ) {
echo '<div id="settings_' . $section['id'] . '" class="hidden wc_rbp_settings_content">';
}
if( $section['title'] )
echo "<h2>{$section['title']}</h2>\n";
if( $section['callback'] )
call_user_func($section['callback'], $section);
if( ! isset($wp_settings_fields) || ! isset($wp_settings_fields[$page]) || ! isset($wp_settings_fields[$page][$section['id']]) )
continue;
echo '<table class="wc_rbp_settings_table">';
$this->do_settings_fields($page, $section['id']);
echo '</table>';
if( $section_count > 1 ) {
echo '</div>';
}
}
}
/**
* Print out the settings fields for a particular settings section
*
* Part of the Settings API. Use this in a settings page to output
* a specific section. Should normally be called by do_settings_sections()
* rather than directly.
*
* @global $wp_settings_fields Storage array of settings fields and their pages/sections
*
* @since 2.7.0
*
* @param string $page Slug title of the admin page who's settings fields you want to show.
* @param string $section Slug title of the settings section who's fields you want to show.
*/
function do_settings_fields($page, $section) {
global $wp_settings_fields;
if( ! isset($wp_settings_fields[$page][$section]) )
return;
foreach( (array) $wp_settings_fields[$page][$section] as $field ) {
$class = '';
if( ! empty($field['args']['class']) ) {
$class = ' class="' . esc_attr($field['args']['class']) . '"';
}
echo "<tr{$class}>";
$desc = sprintf('<p class="description">%s</p>', $field['args']['desc']);
if( ! empty($field['args']['label_for']) ) {
echo '<th scope="row"><label for="' . esc_attr($field['args']['label_for']) . '">' . $field['title'] . $desc . '</label></th>';
} else {
echo '<th scope="row">' . $field['title'] . $desc . '</th>';
}
echo '<td>';
call_user_func($field['callback'], $field['args']);
echo '</td>';
echo '</tr>';
}
}
/**
* Displays the form(s) and sections.
*
* @since 2.0
* @return void
*/
public function render_form() {
if( ! $this->valid_pages ) {
return;
}
$page = $this->current_page;
if( ! empty($page) ) {
$ids = wp_list_pluck($page['sections'], 'id');
$forms = ( $this->multiple_forms ) ? $page['sections'] : array( $page );
// Section ids hidden inputs.
$section_ids = '';
foreach( $ids as $id ) {
$section_ids .= "<input id='{$this->page_hook}_{$id}_section_id' type='hidden' value='{$id}' name='{$this->page_hook}_{$id}[section_id]'>";
}
foreach( $forms as $form ) {
echo '<form method="post" action="options.php">';
// print hidden section_id fields
echo $section_ids;
// lets you add additional fields
echo apply_filters("{$this->page_hook}_form_fields", '', $form['id'], $form);
settings_fields($this->page_hook . '' . $form['id']);
$this->do_settings_sections($this->page_hook . '' . $form['id']);
$submit = ( isset($form['submit']) && $form['submit'] ) ? $form['submit'] : '';
if( ( '' === $submit ) && isset($page['submit']) && $page['submit'] ) {
$submit = $page['submit'];
}
$text = isset($submit['text']) ? $submit['text'] : NULL;
$type = isset($submit['$type']) ? $submit['text'] : 'primary';
$name = isset($submit['$name']) ? $submit['name'] : 'submit';
$other_attributes = array( 'id' => $form['id'] );
submit_button($text, $type, $name, TRUE, $other_attributes);
echo '</form>';
}
}
} // render_form()
} // class
} // class exists
\ No newline at end of file
<?php echo $category; ?>
<div class="wp-list-table widefat plugin-install">
<div class="the-list wc_rbp_addon_listing">
\ No newline at end of file
<?php
$slug = $wc_rbp_plugin_data['addon_slug'];
$cat_slug = implode(' wc-rbp-addon-', array_keys($wc_rbp_plugin_data['Category']));
$wrapperClass = 'plugin-card plugin-card-' . $slug . ' wc-rbp-addon-all wc-rbp-addon-' . $cat_slug;
if( $wc_rbp_plugin_data['is_active'] ) {
$wrapperClass .= ' wc-rbp-addon-active';
} else {
$wrapperClass .= ' wc-rbp-addon-inactive';
}
?>
<div class="<?php echo $wrapperClass; ?>" id="<?php echo $slug; ?>">
<?php wc_rbp_get_ajax_overlay(); ?>
<div class="plugin-card-top">
<div class="name column-name">
<h3>
<?php echo $wc_rbp_plugin_data['Name']; ?>
[
<small><?php _e('V', WC_RBP_TXT); ?><?php echo $wc_rbp_plugin_data['Version']; ?></small>
]
<?php $this->get_addon_icon($wc_rbp_plugin_data); ?>
</h3>
</div>
<div class="desc column-description">
<p><?php echo $wc_rbp_plugin_data['Description']; ?></p>
<p class="authors">
<cite>
<?php _e('By', WC_RBP_TXT); ?>
<a href="<?php echo $wc_rbp_plugin_data['AuthorURI']; ?>"> <?php echo $wc_rbp_plugin_data['Author']; ?></a>
</cite>
</p>
</div>
</div>
<div class="plugin-card-top wc-rbp-addons-required-plugins">
<?php if( ! empty($required_plugins) ): ?>
<div>
<h3><?php _e('Required Plugins :', WC_RBP_TXT); ?></h3>
<ul>
<?php
$echo = '';
foreach( $required_plugins as $plugin ) {
$plugin_status = $this->check_plugin_status($plugin['Slug']);
$status_val = __('InActive', WC_RBP_TXT);
$class = 'deactivated';
if( $plugin_status === 'notexist' ) {
$status_val = __('Plugin Does Not Exist', WC_RBP_TXT);
$class = 'notexist';
} else if( $plugin_status === TRUE ) {
$status_val = __('Active', WC_RBP_TXT);
$class = 'active';
}
if( ! isset($plugin['Version']) ) {
$plugin['version'] = '';
}
echo '<li class="' . $class . '">';
echo '<span class="wc_rbp_required_addon_plugin_name"> <a href="' . $plugin['URL'] . '" > ' . $plugin['Name'] . ' [' . $plugin['Version'] . '] </a> </span> : ';
echo '<span class="wc_rbp_required_addon_plugin_status ' . $class . '">' . $status_val . '</span>';
echo '</li>';
unset($plugin_status);
}
?>
</ul>
<?php /*<p> <span><?php _e('Above Mentioned Plugin name with version are Tested Up to',WC_RBP_TXT);?></span> </p> */ ?>
</div>
<?php endif; ?>
<?php if( ! empty($wc_rbp_plugin_data['screenshots']) ) : ?>
<div class="addon-screenshots">
<h3><?php _e("Screenshots", WC_RBP_TXT); ?></h3>
<ul>
<?php
$i = 1;
$url = $wc_rbp_plugin_data['addon_url'];
foreach( $wc_rbp_plugin_data['screenshots'] as $screen ) {
echo '<li><a class="thickbox" href="' . $url . basename($screen) . '?TB_iframe=true">' . $i . '</a></li>';
$i++;
}
?>
</ul>
</div>
<?php endif; ?>
<small><strong><?php _e('Addon Slug : ', WC_RBP_TXT); ?></strong><?php echo $wc_rbp_plugin_slug; ?></small>
</div>
<div class="plugin-card-bottom">
<div class="column-updated" data-pluginslug="<?php echo $slug; ?>">
<?php echo $this->get_addon_action_button($wc_rbp_plugin_slug, $required_plugins); ?>
</div>
<div class="column-downloaded"><strong><?php _e('Last Updated:', WC_RBP_TXT); ?></strong>
<span title="<?php echo $wc_rbp_plugin_data['last_update']; ?>"><?php echo $wc_rbp_plugin_data['last_update']; ?></span>
</div>
<div class="column-downloaded wc_rbp_ajax_response"></div>
</div>
</div>
\ No newline at end of file
<div class="wc_rbp_price_editor_footer">
<p>
<button name="close" onclick="Custombox.close();" id="close_modal"
class="button button-secondary"> <?php _e('Close', WC_RBP_TXT); ?> </button>
<button name="update_price" id="update_price"
class="button button-primary"> <?php _e('Update Price', WC_RBP_TXT); ?> </button>
</p>
</div>
</div>
</div>
\ No newline at end of file
<div class="wc-rbp-modal wc-rbp-modal-ajax" style="display: block;">
<button type="button" class="close" onclick="Custombox.close();"><span>&times;</span></button>
<h4 class="title"><?php _e('Role Based Price Editor'); ?> </h4>
<div class="wc-rbp-modal-content text">
\ No newline at end of file
<?php global $type, $product_id; ?>
<div class="wc_rbp_price_editor_fields" style="display:none;">
<form method="post" action="<?php echo admin_url('admin-ajax.php'); ?>" id="wc_rbp_price_editor_form">
<div class="wc_rbp_hidden_fields">
<?php echo wc_rbp_get_editor_fields($type); ?>
</div>
<div class="hide hidden wc_rbp_price_editor_ajax_response"></div>
<?php
$tabs = array();
$allowed_roles = wc_rbp_allowed_roles();
$registered_roles = wc_rbp_get_wp_roles();
foreach( $allowed_roles as $role ) {
if( isset($registered_roles[$role]) ) {
$tabs[$role] = $registered_roles[$role]['name'];
}
}
$tabs = apply_filters('wc_rbp_price_editor_tabs', $tabs, $product_id, $type);
$tab_pos = wc_rbp_option('price_editor_tab_pos');
extract(wc_rbp_get_tab_pos($tab_pos));
if( $type == 'simple' ) {
echo '<input type="hidden" name="product_id" value="' . $product_id . '" /> ';
}
do_action('wc_rbp_price_edit_top', $product_id, $type);
echo '<div class="tab_container">';
echo '<div class="wc_rbp_tabs" data-tabsPosition="' . $tab_pos . '"
data-horizontalPosition="' . $horizontalPosition . '"
data-verticalPosition="' . $verticalPosition . '">';
foreach( $tabs as $tabID => $name ) {
echo '<div data-pws-tab-name="' . $name . '" data-pws-tab="' . $tabID . '" class="pws_hide pws_tab_single" data-pws-tab-id="' . $tabID . '">';
do_action('wc_rbp_price_edit_tab_before', $product_id, $type, $tabID);
do_action('wc_rbp_price_edit_tab_' . $tabID . '_before', $product_id, $type, $tabID);
do_action('wc_rbp_price_edit_tab_' . $tabID, $product_id, $type, $tabID);
do_action('wc_rbp_price_edit_tab_' . $tabID . '_after', $product_id, $type, $tabID);
do_action('wc_rbp_price_edit_tab_after', $product_id, $type, $tabID);
echo '</div>';
}
echo '</div>';
echo '</div>';
do_action('wc_rbp_price_edit_bottom', $product_id, $type);
?>
</form>
</div>
\ No newline at end of file
<div class="wrap about-wrap">
<h1><?php _e("Welcome To", WC_RBP_TXT);
echo ' ' . __("Role Based Price For WooCommerce", WC_RBP_TXT) . ' ' . WC_RBP_V; ?></h1>
<p class="about-text">
<?php echo WC_RBP_NAME;
_e(" now with improved speed and stability"); ?>
</p>
<div class="wp-badge"><?php echo WC_RBP_V; ?></div>
</div>
<style>
.wp-badge {
background-image : url("https://plugins.svn.wordpress.org/woocommerce-role-based-price/assets/icon-256x256.jpg") !important;
background-position : center top !important;
background-size : 100% auto !important;
padding-top : 140px !important;
padding-bottom : 3px !important;
height : auto !important;
}
</style>
\ No newline at end of file
<?php
/**
* The admin-specific functionality of the plugin.
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/Admin
* @since 3.0
*/
if( ! defined('WPINC') ) {
die;
}
class WooCommerce_Role_Based_Price_Addons {
public function __construct() {
add_action('wp_ajax_wc_rbp_get_addons_html', array( $this, 'list_addons_ajax' ));
add_action(WC_RBP_DB . '_form_fields', array( $this, 'list_addons' ), 10, 2);
add_action('wp_ajax_wc_rbp_activate_addon', array( $this, 'activate_plugin' ));
add_action('wp_ajax_wc_rbp_deactivate_addon', array( $this, 'deactivate_plugin' ));
}
public function list_addons_ajax() {
$this->list_addons('', 'addons');
}
public function list_addons($none, $form_id) {
if( $form_id != 'addons' ) {
return;
}
$this->plugins_data = $this->search_and_get_addons();
$this->generate_view();
}
public function search_and_get_addons() {
$search_dirs = apply_filters('wc_rbp_addons_dir', array());
$addons_others = array();
$internal_addons = $this->get_plugins(WC_RBP_PLUGIN);
if( ! empty($search_dirs) ) {
foreach( $search_dirs as $dir ) {
$dir_addons = $this->get_plugins($dir);
$addons_others = array_merge($addons_others, $dir_addons);
unset($dir_addons);
}
}
$return = array_merge($internal_addons, $addons_others);
return $return;
}
/**
* Check the plugins directory and retrieve all plugin files with plugin data.
* The file with the plugin data is the file that will be included and therefore
* needs to have the main execution for the plugin. This does not mean
* everything must be contained in the file and it is recommended that the file
* be split for maintainability. Keep everything in one file for extreme
* optimization purposes.
*
* @since 1.5.0
*
* @param string $plugin_folder Optional. Relative path to single plugin folder.
*
* @return array Key is the plugin file path and the value is an array of the plugin data.
*/
public function get_plugins($plugin_folder = '') {
$wp_plugins = array();
$plugin_root = WC_RBP_PLUGIN;
if( ! empty($plugin_folder) ) {
$plugin_root = $plugin_folder;
}
$plugins_dir = @ opendir($plugin_root);
$plugin_files = array();
if( $plugins_dir ) {
while( ( $file = readdir($plugins_dir) ) !== FALSE ) {
if( substr($file, 0, 1) == '.' ) {
continue;
}
if( is_dir($plugin_root . '/' . $file) ) {
$plugins_subdir = @ opendir($plugin_root . '/' . $file);
if( $plugins_subdir ) {
while( ( $subfile = readdir($plugins_subdir) ) !== FALSE ) {
if( substr($subfile, 0, 1) == '.' ) {
continue;
}
if( substr($subfile, -4) == '.php' ) {
$plugin_files[] = "$file/$subfile";
}
}
closedir($plugins_subdir);
}
} else {
if( substr($file, -4) == '.php' ) {
$plugin_files[] = $file;
}
}
}
closedir($plugins_dir);
}
if( empty($plugin_files) ) {
return $wp_plugins;
}
foreach( $plugin_files as $plugin_file ) {
if( ! is_readable("$plugin_root/$plugin_file") ) {
continue;
}
$plugin_data = $this->get_plugin_data("$plugin_root/$plugin_file", FALSE, TRUE);
$plugin_base = $plugin_root . dirname($plugin_file);
if( empty ($plugin_data['Name']) ) {
continue;
}
$is_active = wc_rbp_check_active_addon("$plugin_file");
$plugin_data["is_active"] = $is_active;
$plugin_data["installed"] = TRUE;
$plugin_data["addon_root"] = $plugin_root . dirname($plugin_file) . '/';
$plugin_data["addon_url"] = plugin_dir_url("$plugin_root/$plugin_file");
$plugin_data["addon_slug"] = sanitize_title(dirname($plugin_file));
$plugin_data["addon_folder"] = dirname($plugin_file) . '/';
$plugin_data['screenshots'] = glob($plugin_base . '/screenshot*.*');
$wp_plugins[plugin_basename($plugin_file)] = $plugin_data;
}
return $wp_plugins;
}
/**
* Parses the plugin contents to retrieve plugin's metadata.
* The metadata of the plugin's data searches for the following in the plugin's
* header. All plugin data must be on its own line. For plugin description, it
* must not have any newlines or only parts of the description will be displayed
* and the same goes for the plugin data. The below is formatted for printing.
*
* ** Plugin Name: Name of the plugin
* ** Plugin Icon: (Icon URL / DATA Code)
* ** Description: some Description about plugin
* ** Version: 01
* ** Author: Author Name
* ** Author URL: Author URL
* ** Last Update: YYYY-MM-DD
* ** Required Plugins: plugin-folder/plugin-file.php | Version , plugin-folder/plugin-file.php | 2.0*
*
* @param string $plugin_file Path to the plugin file
* @param bool $markup Optional. If the returned data should have HTML markup applied. Default true.
* @param bool $translate Optional. If the returned data should be translated. Default true.
*/
public function get_plugin_data($plugin_file, $markup = TRUE, $translate = TRUE) {
$default_headers = array(
'Name' => 'Plugin Name',
'PluginURI' => 'Plugin URI',
'icon' => 'Plugin Icon',
'Version' => 'Version',
'Description' => 'Description',
'Author' => 'Author',
'AuthorURI' => 'Author URI',
'last_update' => 'Last Update',
'rplugins' => 'Required Plugins',
'Category' => 'Category',
);
$plugin_data = get_file_data($plugin_file, $default_headers, 'wc_rbp_plugin');
if( empty($plugin_data['TextDomain']) ) {
$plugin_data['TextDomain'] = WC_RBP_TXT;
}
if( empty($plugin_data['DomainPath']) ) {
$plugin_data['DomainPath'] = FALSE;
}
if( empty($plugin_data['Category']) ) {
$plugin_data['Category'] = 'general';
}
$cat = explode(',', $plugin_data['Category']);
$plugin_data['Category'] = array();
foreach( $cat as $c ) {
$key = sanitize_key($c);
$plugin_data['Category'][$key] = $c;
}
if( $markup || $translate ) {
$plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup, $translate);
} else {
$plugin_data['Title'] = $plugin_data['name'];
$plugin_data['AuthorName'] = $plugin_data['author'];
}
return $plugin_data;
}
public function generate_view() {
$category = $this->get_addon_category();
$category = $this->get_html_addon_category($category);
include( WC_RBP_ADMIN . 'views/addons-header.php' );
foreach( $this->plugins_data as $addon_slug => $data ) {
$wc_rbp_plugin_data = $data;
$wc_rbp_plugin_slug = $addon_slug;
$required_plugins = $this->extract_required_plugins($wc_rbp_plugin_data);
include( WC_RBP_ADMIN . 'views/addons-single.php' );
unset($wc_rbp_plugin_data);
}
include( WC_RBP_ADMIN . 'views/addons-footer.php' );
}
public function get_addon_category() {
$category = array();
$category['all'] = __('All', WC_RBP_TXT);
$category['active'] = __('Active', WC_RBP_TXT);
$category['inactive'] = __('InActive', WC_RBP_TXT);
foreach( $this->plugins_data as $data ) {
$cat = $data['Category'];
foreach( $cat as $id => $c ) {
if( ! in_array($c, $category) ) {
$category[$id] = $c;
}
}
}
return $category;
}
public function get_html_addon_category($cats) {
$label = __("Search Addons", WC_RBP_TXT);
$output = '<div class="wp-filter"> <ul class="filter-links wc_rbp_addons_category addons_category">';
foreach( $cats as $cat => $catv ) {
$output .= '<li id="' . $cat . '" class="' . $cat . ' category"><a href="javascript:void(0);" data-category="' . $cat . '">' . $catv . '</a> | </li>';
}
$output .= '</ul>';
$output .= '<div class="addons-search-form">';
$output .= '<input type="search" placeholder="' . $label . '" class="wp-filter-search" value="" name="s" />';
$output .= '</div>';
$output .= '</div>';
return $output;
}
public function extract_required_plugins($wc_rbp_plugin_data) {
$plugins = $wc_rbp_plugin_data['rplugins'];
$plugins_return = array();
$plugins = explode(',', $plugins);
$default_args = array( 'Name' => '', 'URL' => '', 'Version' => '', 'Slug' => '' );
foreach( $plugins as $plugin ) {
if( empty($plugin) ) {
continue;
}
$tmp_arr = array();
$plugin = str_replace(array( '[', ']' ), '', $plugin);
$plug = explode('|', $plugin);
foreach( $plug as $p ) {
$s = preg_split("/ : /", $p);
$s[0] = isset($s[0]) ? trim($s[0]) : "";
$s[1] = isset($s[1]) ? trim($s[1]) : "";
$tmp_arr[$s[0]] = $s[1];
}
if( ! empty($tmp_arr) ) {
$tmp_arr = wp_parse_args($tmp_arr, $default_args);
$plugins_return[] = $tmp_arr;
}
}
return $plugins_return;
}
public function deactivate_plugin() {
$status = $this->addon_actions('deactivate');
if( $status === 'invalidcode' ) {
wp_send_json_error(array( 'msg' => '<span class="wc_rbp_ajax_error">' . __('Unable to process you request. please try again later', WC_RBP_TXT) . '</span>' ));
} else if( $status === 'verifyfailed' ) {
wp_send_json_error(array( 'msg' => '<span class="wc_rbp_ajax_ajaxerror">' . __('Unable To De-Activate Addon. Please Try Again Later', WC_RBP_TXT) . '</span>' ));
} else if( $status === TRUE ) {
wp_send_json_success(array( 'msg' => '<span class="wc_rbp_ajax_success">' . __('Addon De-Activated', WC_RBP_TXT) . '</span>' ));
} else if( $status === 'alreadyactive' ) {
wp_send_json_success(array( 'msg' => '<span class="wc_rbp_ajax_success">' . __('Addon Already De-Activated', WC_RBP_TXT) . '</span>' ));
} else {
wp_send_json_error(array( 'msg' => '<span class="wc_rbp_ajax_error">' . __('Unable To De-Activate Addon. Please Try Again Later', WC_RBP_TXT) . '</span>' ));
}
wp_die();
}
public function addon_actions($action = 'activate') {
if( ! isset($_REQUEST['wc_rbp_security_code']) ) {
return 'invalidcode';
}
$nonce_action = 'wc_rbp_' . $action . '_addon';
$verify = wp_verify_nonce(sanitize_text_field($_REQUEST['wc_rbp_security_code']), $nonce_action);
if( ! $verify ) {
return 'verifyfailed';
}
$function_call = 'wc_rbp_' . $action . '_addon';
$status = $function_call(sanitize_text_field($_REQUEST['addon_slug']));
if( $status ) {
return TRUE;
} else if( ! $status ) {
return 'alreadyactive';
}
return FALSE;
}
public function activate_plugin() {
$status = $this->addon_actions();
if( $status === 'invalidcode' ) {
wp_send_json_error(array( 'msg' => '<span class="wc_rbp_ajax_error">' . __('Unable to process you request. please try again later', WC_RBP_TXT) . '</span>' ));
} else if( $status === 'verifyfailed' ) {
wp_send_json_error(array( 'msg' => '<span class="wc_rbp_ajax_ajaxerror">' . __('Unable To Activate Addon. Please Try Again Later', WC_RBP_TXT) . '</span>' ));
} else if( $status === TRUE ) {
wp_send_json_success(array( 'msg' => '<span class="wc_rbp_ajax_success">' . __('Addon Activated', WC_RBP_TXT) . '</span>' ));
} else if( $status === 'alreadyactive' ) {
wp_send_json_success(array( 'msg' => '<span class="wc_rbp_ajax_success">' . __('Addon Already Activated', WC_RBP_TXT) . '</span>' ));
} else {
wp_send_json_error(array( 'msg' => '<span class="wc_rbp_ajax_error">' . __('Unable To Activate Addon. Please Try Again Later', WC_RBP_TXT) . '</span>' ));
}
wp_die();
}
public function get_addon_action_button($plugin_slug, $required_plugins) {
$is_active = wc_rbp_check_active_addon($plugin_slug);
$extraClass = '';
$activate_button_text = __('Activate', WC_RBP_TXT);
$inactivate_button_text = __('Deactivate', WC_RBP_TXT);
$requried_satisfied = $this->check_if_requried_satisfied($required_plugins);
$activate_button_url = $this->get_addon_action_link($plugin_slug);
$inactivate_button_url = $this->get_addon_action_link($plugin_slug, 'deactivate');
$activate_button_html = '<button type="button" data-slug="' . $plugin_slug . '" ';
$inactivate_button_html = '<button type="button" data-slug="' . $plugin_slug . '" ';
$activate_button_html .= 'class="wc-rbp-activate-now button button-primary ';
$inactivate_button_html .= 'class="wc-rbp-deactivate-now button button-secondary ';
if( $is_active ) {
$activate_button_html .= ' hidden hide "';
$inactivate_button_html .= '"';
} else {
$activate_button_html .= '"';
$inactivate_button_html .= ' hidden hide "';
}
if( ! $requried_satisfied ) {
$activate_button_html .= ' disabled="disabled" ';
}
$activate_button_html .= ' href="' . $activate_button_url . '" >' . $activate_button_text . '</button>';
$inactivate_button_html .= ' href="' . $inactivate_button_url . '" >' . $inactivate_button_text . '</button>';
$html_btn = $activate_button_html . $inactivate_button_html;
return $html_btn;
}
public function check_if_requried_satisfied($requireds) {
$success = 0;
$failed = 0;
foreach( $requireds as $plugin ) {
$plugin_status = $this->check_plugin_status($plugin['Slug']);
if( $plugin_status === TRUE ) {
$success++;
} else {
$failed++;
}
}
if( $success == count($requireds) ) {
return TRUE;
}
return FALSE;
}
public function check_plugin_status($slug) {
$val_plugin = validate_plugin($slug);
if( is_wp_error($val_plugin) ) {
return 'notexist';
} else if( is_plugin_active($slug) ) {
return TRUE;
} else if( is_plugin_inactive($slug) ) {
return FALSE;
}
return FALSE;
}
public function get_addon_action_link($plugin_slug, $type = "active") {
$is_active = wc_rbp_check_active_addon($plugin_slug);
$action = 'wc_rbp_activate_addon';
if( $type == 'deactivate' ) {
$action = 'wc_rbp_deactivate_addon';
}
$url = admin_url('admin-ajax.php?action=' . $action . '&addon_slug=' . $plugin_slug);
$url = wp_nonce_url($url, $action, 'wc_rbp_security_code');
return $url;
}
public function get_addon_icon($data, $echo = TRUE) {
$icon = WC_RBP_IMG . 'addon_icon.jpg';
if( file_exists($data['addon_root'] . 'icon.png') ) {
$icon = $data['addon_url'] . 'icon.png';
} else if( file_exists($data['addon_root'] . 'icon.jpg') ) {
$icon = $data['addon_url'] . 'icon.jpg';
} else if( file_exists($data['addon_root'] . $data['addon_slug'] . '-icon.png') ) {
$icon = $data['addon_url'] . $data['addon_slug'] . '-icon.png';
} else if( file_exists($data['addon_root'] . $data['addon_slug'] . '-icon.jpg') ) {
$icon = $data['addon_url'] . $data['addon_slug'] . '-icon.jpg';
} else if( isset($data['icon']) ) {
if( filter_var($data['icon'], FILTER_VALIDATE_URL) !== FALSE ) {
$icon = $data['icon'];
}
}
$icon = '<img src="' . $icon . '" class="plugin-icon" />';
if( $echo ) {
echo $icon;
} else {
return $icon;
}
}
}
\ No newline at end of file
<?php
/**
* Dependency Checker
*
* Checks if required Dependency plugin is enabled
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/FrontEnd
* @since 3.0
*/
if( ! defined('WPINC') ) {
die;
}
class WooCommerce_Role_Based_Price_Functions {
/**
* Define the core functionality of the plugin.
*
* Set the plugin name and the plugin version that can be used throughout the plugin.
* Load the dependencies, define the locale, and set the hooks for the admin area and
* the public-facing side of the site.
*
* @since 1.0.0
*/
public function __construct() {
add_filter('woocommerce_product_object', array( $this, 'setup_product_prices' ));
}
public function setup_product_prices($product) {
if( $product == NULL ) {
return $product;
}
$product->wc_rbp = wc_rbp_get_product_price($product->ID);
$product->wc_rbp_status = wc_rbp_product_status($product->ID);
do_action_ref_array('wc_rbp_product_class_attribute', array( &$product ));
return $product;
}
}
\ No newline at end of file
<?php
/**
* The admin-specific functionality of the plugin.
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/Admin
* @since 3.0
*/
if( ! defined('WPINC') ) {
die;
}
class WooCommerce_Role_Based_Price_Product_Pricing {
public $already_given_prices = NULL;
public function __construct($is_hook = TRUE) {
$this->already_given_prices = array();
if( $is_hook == TRUE ) {
add_action('woocommerce_init', array( $this, 'wc_init' ));
}
}
public function wc_init() {
if( wc_rbp_is_wc_v('>=', '3.0.1') ) {
add_filter('woocommerce_product_get_regular_price', array( &$this, 'get_regular_price' ), 99, 2);
add_filter('woocommerce_product_get_sale_price', array( &$this, 'get_selling_price' ), 99, 2);
add_filter('woocommerce_product_get_price', array( &$this, 'get_price' ), 99, 2);
add_filter('woocommerce_product_variation_get_regular_price', array( &$this, 'get_regular_price' ), 99, 2);
add_filter('woocommerce_product_variation_get_sale_price', array( &$this, 'get_selling_price' ), 99, 2);
add_filter('woocommerce_product_variation_get_price', array( &$this, 'get_price' ), 99, 2);
} else {
add_filter('woocommerce_get_regular_price', array( &$this, 'get_regular_price' ), 99, 2);
add_filter('woocommerce_get_sale_price', array( &$this, 'get_selling_price' ), 99, 2);
add_filter('woocommerce_get_price', array( &$this, 'get_price' ), 99, 2);
}
add_filter('woocommerce_get_variation_regular_price', array( &$this, 'get_variation_regular_price' ), 99, 4);
add_filter('woocommerce_get_variation_price', array( &$this, 'get_variation_price' ), 99, 4);
add_filter('woocommerce_get_price_html', array( &$this, 'get_price_html' ), 99, 2);
}
/**
* @param $price
* @param $product
*
* @return mixed|string
*/
public function get_selling_price($price, $product) {
$price = $this->get_product_price($price, $product, 'selling_price');
$price = apply_filters("wc_rbp_product_selling_price", $price, $product, $this);
return $price;
}
public function get_product_price($base_price, $product, $price_meta_key = 'regular_price', $current_user = '') {
if( ! apply_filters('role_based_price_status', TRUE) ) {
return $base_price;
}
$wc_rbp_price = FALSE;
$opposite_key = 'selling_price';
if( $price_meta_key == 'selling_price' ) {
$opposite_key = 'regular_price';
}
$product_id = $this->check_product_get_id($product);
if( empty($current_user) ) {
$current_user = wc_rbp_get_current_user();
}
$product_type = wp_get_post_terms($product_id, 'product_type', array( 'fields' => 'names' ));
if( in_array('variable', $product_type) ) {
return $base_price;
}
$key = md5($base_price . '-' . $product_id . '-' . $price_meta_key . '-' . $opposite_key . '-' . $current_user);
if( isset($this->already_given_prices[$key]) ) {
$wc_rbp_price = $this->already_given_prices[$key];
} else {
$wc_rbp_status = product_rbp_status($product_id);
$allowed_roles = wc_rbp_allowed_roles();
if( in_array($current_user, $allowed_roles) ) {
$rbp_price = wc_rbp_price($product_id, $current_user, 'all', array());
if( $wc_rbp_status ) {
if( $rbp_price === FALSE ) {
$wc_rbp_price = $base_price;
} else {
if( $price_meta_key == 'all' ) {
$wc_rbp_price = $rbp_price[$price_meta_key];
}
if( isset($rbp_price[$price_meta_key]) && isset($rbp_price[$opposite_key]) ) {
if( $rbp_price[$price_meta_key] === "" && $rbp_price[$opposite_key] === "" ) {
$wc_rbp_price = $base_price;
}
if( ( $rbp_price[$price_meta_key] === 0 || $rbp_price[$price_meta_key] === '0' ) || ( $rbp_price[$opposite_key] === 0 || $rbp_price[$opposite_key] === '0' ) ) {
$wc_rbp_price = 0;
} else if( $rbp_price[$price_meta_key] === "" && $rbp_price[$opposite_key] !== "" ) {
$wc_rbp_price = $rbp_price[$opposite_key];
} else if( $rbp_price[$price_meta_key] !== "" && $rbp_price[$opposite_key] === "" ) {
$wc_rbp_price = $rbp_price[$price_meta_key];
} else if( $rbp_price[$price_meta_key] !== "" ) {
$wc_rbp_price = $rbp_price[$price_meta_key];
}
} else if( isset($rbp_price[$price_meta_key]) && ! isset($rbp_price[$opposite_key]) ) {
if( $rbp_price[$price_meta_key] === "" ) {
$wc_rbp_price = $base_price;
} else if( $rbp_price[$price_meta_key] === "0" || $rbp_price[$price_meta_key] === 0 ) {
$wc_rbp_price = 0;
} else if( $rbp_price[$price_meta_key] !== "" ) {
$wc_rbp_price = $rbp_price[$price_meta_key];
}
} else if( isset($rbp_price[$opposite_key]) && ! isset($rbp_price[$price_meta_key]) ) {
if( $rbp_price[$opposite_key] === "" ) {
$wc_rbp_price = $base_price;
}
if( $rbp_price[$opposite_key] === "0" || $rbp_price[$opposite_key] === 0 ) {
$wc_rbp_price = 0;
} else if( $rbp_price[$opposite_key] !== "" ) {
$wc_rbp_price = $rbp_price[$opposite_key];
}
}
}
} else {
$wc_rbp_price = $base_price;
}
} else {
$wc_rbp_price = $base_price;
}
}
//$return = apply_filters('wc_rbp_product_price_value',$return,$price,$product_id,$product,$price_meta_key,$current_user);
$wc_rbp_price = apply_filters('wc_rbp_product_price_value', $wc_rbp_price, $base_price, $product_id, $product, $price_meta_key, $current_user);
if( $wc_rbp_price !== '' ) {
$this->already_given_prices[$key] = $wc_rbp_price;
}
$return = wc_format_decimal($wc_rbp_price);
$wpml_integration_status = wc_rbp_option('enable_wpml_integration');
if( $wpml_integration_status == 'on' ) {
if( class_exists('woocommerce_wpml') ) {
$return = apply_filters('wcml_raw_price_amount', $return);
}
}
return $return;
}
public function check_product_get_id($product) {
$product_id = 0;
if( wc_rbp_is_wc_v('>=', '3.0.1') ) {
if( is_numeric($product) ) {
return $product;
} else if( $this->is_simple_product($product) ) {
$product_id = $product->get_id();
} else if( $this->is_variable_product($product) ) {
$product_id = $product->get_id();
} else if( $this->is_variation_product($product) ) {
$product_id = $product->get_id();
}
/**
* $product_id needs to be set also if conditions above are not true.
*/
$product_id = $product->get_id();
} else {
if( is_numeric($product) ) {
return $product;
} else if( $this->is_simple_product($product) ) {
$product_id = $product->id;
} else if( $this->is_variable_product($product) ) {
$product_id = $product->id;
} else if( $this->is_variation_product($product) ) {
$product_id = $product->variation_id;
}
}
return $product_id;
}
private function is_simple_product($product) {
$class = $this->get_product_class($product);
$classes = apply_filters("wc_rbp_simple_product_class", array( 'WC_Product_Simple', 'WC_Product_Yith_Bundle' ));
if( in_array($class, $classes) ) {
return TRUE;
}
return FALSE;
}
private function get_product_class($product) {
$class = get_class($product);
$class = str_replace('_RBP', '', $class);
return $class;
}
private function is_variable_product($product) {
$class = $this->get_product_class($product);
if( $class == 'WC_Product_Variable' ) {
return TRUE;
}
return FALSE;
}
private function is_variation_product($product) {
$class = $this->get_product_class($product);
if( $class == 'WC_Product_Variation' ) {
return TRUE;
}
return FALSE;
}
/**
* Returns the product's active price.
*
* @param string $price
* @param string $product
*
* @return string price
*/
public function get_price($price = '', $product = '') {
if( empty($product) ) {
return $price;
}
$sale_price = $product->get_sale_price();
$wcrbp_price = ( $sale_price !== '' && $sale_price > 0 ) ? $sale_price : $this->get_regular_price($price, $product);
$wcrbp_price = wc_format_decimal($wcrbp_price);
$wcrbp_price = apply_filters("wc_rbp_product_get_price", $wcrbp_price, $product, $this);
return $wcrbp_price;
}
/**
* Returns the product's regular price
*
* @param $price
* @param $product
*
* @return string price
*/
public function get_regular_price($price, $product) {
$price = $this->get_product_price($price, $product);
$price = apply_filters("wc_rbp_product_regular_price", $price, $product, $this);
return $price;
}
/**
* Get the min or max variation active price.
*
* @param $price
* @param $product
* @param string $min_or_max - min or max
* @param boolean $display Whether the value is going to be displayed
*
* @return string price
*/
public function get_variation_price($price, $product, $min_or_max, $display) {
return $this->get_variation_regular_price($price, $product, $min_or_max, $display, 'selling_price');
}
/**
* Get the min or max variation regular price.
*
* @param string $min_or_max - min or max
* @param boolean $display Whether the value is going to be displayed
*
* @return string price
*/
public function get_variation_regular_price($price, $product, $min_or_max, $display, $price_meta_key = 'regular_price') {
$return = $price;
$display = array();
$pid = 0;
if( wc_rbp_is_wc_v('>=', '3.0') ) {
$pid = $product->get_id();
} else {
$pid = $product->id;
}
$role = wc_rbp_get_current_user();
$opp_key = wc_rbp_get_oppo_metakey($price_meta_key);
$prices = wc_rbp_get_variation_data($pid, $role);
foreach( $prices as $id => $arr ) {
if( ! is_array($arr) ) {
continue;
}
}
if( empty($prices[$price_meta_key]) && empty($prices[$opp_key]) ) {
if( empty($prices['base_' . $price_meta_key]) && ! empty($prices['base_' . $opp_key]) ) {
$prices = $prices['base_' . $opp_key];
} else {
$prices = $prices['base_' . $price_meta_key];
}
} else if( empty($prices[$price_meta_key]) && ! empty($prices[$opp_key]) ) {
$prices = $prices[$opp_key];
} else {
$prices = $prices[$price_meta_key];
}
if( $min_or_max == 'min' ) {
asort($prices);
} else {
arsort($prices);
}
if( $display ) {
$variation_id = key($prices);
$return = $display[$variation_id];
} else {
$return = current($prices);
}
return $return;
}
public function get_price_html($price = '', $product) {
if( 'WC_Product_Variable' == get_class($product) ) {
$product_id = $this->check_product_get_id($product);
$wc_rbp_status = $this->product_rbp_status($product_id, $product);
if( ! $wc_rbp_status ) {
return $price;
}
if( wc_rbp_is_wc_v('>=', '3.0') ) {
return $this->get_price_html_wc3($price, $product);
} else {
return $this->get_price_html_below_wc3($price, $product);
}
}
return $price;
}
public function product_rbp_status($id, $product) {
$type = $product->get_type();
if( $type == 'variable' ) {
$variations = $product->get_children();
if( is_array($variations) ) {
foreach( $variations as $i ) {
$status = product_rbp_status($i);
if( $status ) {
return TRUE;
}
}
}
} else {
$status = product_rbp_status($id);
if( $status ) {
return TRUE;
}
}
return FALSE;
}
public function get_price_html_wc3($price = '', $product) {
$prices = $product->get_variation_prices(TRUE);
if( empty($prices['price']) ) {
return apply_filters('woocommerce_variable_empty_price_html', '', $this);
}
$prices = array();
$prices['min_price'] = $product->get_variation_price('min', FALSE);
$prices['max_price'] = $product->get_variation_price('max', FALSE);
$prices['min_reg_price'] = $product->get_variation_regular_price('min', TRUE);
$prices['max_reg_price'] = $product->get_variation_regular_price('max', TRUE);
$prices = $this->get_variation_tax_status_price($prices, $product);
/*if( $prices['min_price'] !== $prices['max_price'] ) {
$price = apply_filters('woocommerce_variable_price_html', wc_format_price_range($prices['min_price'], $prices['max_price']) . $product->get_price_suffix(), $product);
} else if( $product->is_on_sale() && $prices['min_reg_price'] === $prices['max_reg_price'] ) {
$price = apply_filters('woocommerce_variable_price_html', wc_format_sale_price(wc_price($prices['max_reg_price']), wc_price($prices['min_price'])) . $product->get_price_suffix(), $product);
} else {
$price = apply_filters('woocommerce_variable_price_html', wc_price($prices['min_price']) . $product->get_price_suffix(), $product);
}*/
if( $prices['min_price'] !== $prices['max_price'] ) {
$price = wc_format_price_range($prices['min_price'], $prices['max_price']);
} else if( $product->is_on_sale() && $prices['min_reg_price'] === $prices['max_reg_price'] ) {
$price = wc_format_sale_price(wc_price($prices['max_reg_price']), wc_price($prices['min_price']));
} else {
$price = wc_price($prices['min_price']);
}
return $price;
}
public function get_variation_tax_status_price($prices, $product) {
if( 'incl' === get_option('woocommerce_tax_display_shop') ) {
if( wc_rbp_is_wc_v('>=', '3.0') ) {
$prices['min_price'] = '' === $prices['min_price'] ? '' : wc_get_price_including_tax($product, array(
'qty' => 1,
'price' => $prices['min_price'],
));
$prices['max_price'] = '' === $prices['max_price'] ? '' : wc_get_price_including_tax($product, array(
'qty' => 1,
'price' => $prices['max_price'],
));
$prices['min_reg_price'] = '' === $prices['min_reg_price'] ? '' : wc_get_price_including_tax($product, array(
'qty' => 1,
'price' => $prices['min_reg_price'],
));
$prices['max_reg_price'] = '' === $prices['max_reg_price'] ? '' : wc_get_price_including_tax($product, array(
'qty' => 1,
'price' => $prices['max_reg_price'],
));
} else {
$prices[0] = '' === $prices[0] ? '' : $product->get_price_including_tax(1, $prices[0]);
$prices[1] = '' === $prices[1] ? '' : $product->get_price_including_tax(1, $prices[1]);
}
} else {
if( wc_rbp_is_wc_v('>=', '3.0') ) {
$prices['min_price'] = '' === $prices['min_price'] ? '' : wc_get_price_excluding_tax($product, array(
'qty' => 1,
'price' => $prices['min_price'],
));
$prices['max_price'] = '' === $prices['max_price'] ? '' : wc_get_price_excluding_tax($product, array(
'qty' => 1,
'price' => $prices['max_price'],
));
$prices['min_reg_price'] = '' === $prices['min_reg_price'] ? '' : wc_get_price_excluding_tax($product, array(
'qty' => 1,
'price' => $prices['min_reg_price'],
));
$prices['max_reg_price'] = '' === $prices['max_reg_price'] ? '' : wc_get_price_excluding_tax($product, array(
'qty' => 1,
'price' => $prices['max_reg_price'],
));
} else {
$prices[0] = '' === $prices[0] ? '' : $product->get_price_including_tax(1, $prices[0]);
$prices[1] = '' === $prices[1] ? '' : $product->get_price_including_tax(1, $prices[1]);
}
}
return $prices;
}
/**
* Returns the price in html format.
*
* @access public
*
* @param string $price (default: '')
*
* @return string
*/
public function get_price_html_below_wc3($price = '', $product) {
// Ensure variation prices are synced with variations
if( $product->get_variation_regular_price('min') === FALSE || $product->get_variation_price('min') === FALSE || $product->get_variation_price('min') === '' || $product->get_price() === '' ) {
$product->variable_product_sync($product->get_id());
}
// Get the price
if( $product->get_price() === '' ) {
$price = apply_filters('woocommerce_variable_empty_price_html', '', $product);
} else {
// Main price
$prices = array( $product->get_variation_price('min', FALSE), $product->get_variation_price('max', FALSE) );
$prices = $this->get_variation_tax_status_price($prices, $product);
$price = $prices[0] !== $prices[1] ? sprintf(_x(' % 1$s & ndash;%2$s', 'Price range: from - to', 'woocommerce'), wc_price($prices[0]), wc_price($prices[1])) : wc_price($prices[0]);
// Sale
$prices = array(
$product->get_variation_regular_price('min', TRUE),
$product->get_variation_regular_price('max', TRUE),
);
sort($prices);
$prices = $this->get_variation_tax_status_price($prices, $product);
$saleprice = $prices[0] !== $prices[1] ? sprintf(_x(' % 1$s & ndash;%2$s', 'Price range: from - to', 'woocommerce'), wc_price($prices[0]), wc_price($prices[1])) : wc_price($prices[0]);
if( $prices[0] == 0 && $prices[1] == 0 ) {
$price = __('Free! ', 'woocommerce');
$price = apply_filters('woocommerce_variable_free_price_html', $price, $product);
} else if( $price !== $saleprice ) {
if( wc_rbp_is_wc_v(' >= ', '3.0') ) {
$price = apply_filters('woocommerce_variable_sale_price_html', wc_format_price_range($saleprice, $price) . $product->get_price_suffix(), $product);
} else {
$price = apply_filters('woocommerce_variable_sale_price_html', $product->get_price_html_from_to($saleprice, $price) . $product->get_price_suffix(), $product);
}
} else {
$price = apply_filters('woocommerce_variable_price_html', $price . $product->get_price_suffix(), $product);
}
}
return $price;
}
}
<?php
/**
* Simple Product Role Based Price Settings
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @since 1.0
* @package WooCommerce_Role_Based_Price
* @subpackage WooCommerce_Role_Based_Price/admin
* @author Varun Sridharan <varunsridharan23@gmail.com>
*/
if( ! defined('WPINC') ) {
exit;
}
class WooCommerce_Role_Based_Price_Shortcode_Handler {
private static $_instance = NULL;
private static $db_prices = NULL;
public function __construct() {
add_shortcode('wc_rbp', array( $this, 'shortcodehandler' ));
}
function is_aeliacs_active() {
return isset($GLOBALS['woocommerce-aelia-currencyswitcher']) && is_object($GLOBALS['woocommerce-aelia-currencyswitcher']);
}
public function shortcodehandler($attrs) {
$vars = shortcode_atts(array(
'id' => NULL,
'price' => 'regular_price',
'role' => 'current',
), $attrs, 'wc_rbp');
if( $vars['id'] == NULL ) {
global $product;
$id = '';
if( wc_rbp_is_wc_v('>=', '3.0.1') ) {
$id = $product->get_id();
} else {
$product->id;
}
if( ! isset($id) ) {
return __('Invalid Product ID Given', WC_RBP_TXT);
}
$vars['id'] = $id;
}
if( $vars['role'] == NULL ) {
return __('Invalid User Role Given', WC_RBP_TXT);
}
if( $vars['price'] == 'product_regular_price' || $vars['price'] == 'product_selling_price' ) {
return self::get_base_product_price($vars['id'], $vars['price']);
}
if( $vars['price'] != 'regular_price' && $vars['price'] != 'selling_price' ) {
return __('Invalid Price Type Given', WC_RBP_TXT);
}
$product_status = product_rbp_status($vars['id']);
$this->rbpPP = '';
if( $product_status ) {
$this->rbpPP = new WooCommerce_Role_Based_Price_Product_Pricing;
if( $vars['role'] == 'current' ) {
$vars['role'] = wc_rbp_get_current_user();
}
return self::get_selprice($vars['role'], $vars['price'], $vars['id']);
}
return '';
}
public function get_base_product_price($id, $price) {
if( ! defined('WC_RBP_SHORTCODE_PRODUCT_BASE_PRICING') ) {
define('WC_RBP_SHORTCODE_PRODUCT_BASE_PRICING', TRUE);
}
$product = new WC_Product($id);
if( $price == 'product_regular_price' ) {
return $product->get_regular_price();
}
if( $price == 'product_selling_price' ) {
return $product->get_sale_price();
}
}
public function get_selprice($role, $price = 'all', $product_id) {
$product = wc_get_product($product_id);
$p = $this->rbpPP->get_product_price('', $product, $price, $role);
return wc_price($p);
}
}
\ No newline at end of file
table.wc_rbp_settings_table {
box-shadow : none;
border : 0 none;
border-spacing : 0;
clear : both;
margin : 0;
max-width : 900px;
min-width : 800px;
width : auto;
background : #fff;
border : 1px solid #e1e1e1;
}
table.wc_rbp_settings_table th {
font-weight : bold;
text-align : left;
font-size : 14px;
padding : 8px 15px;
line-height : 28px;
border-bottom : 1px solid #e1e1e1;
}
table.wc_rbp_settings_table td {
padding : 13px 15px;
border-top : 1px solid #f5f5f5;
width : 70% !important;
}
table.wc_rbp_settings_table td:first-child {
width : 26%;
}
table.wc_rbp_settings_table td.wcff-sortable {
cursor : move;
}
table.wc_rbp_settings_table td.add {
width : 40px;
}
table.wc_rbp_settings_table td.remove {
width : 20px;
}
table.wc_rbp_settings_table tr > th {
width : 30% !important;
vertical-align : middle;
background : #F9F9F9;
border-top : 1px solid #f0f0f0;
border-right : 1px solid #E1E1E1;
}
table.wc_rbp_settings_table > tbody > tr:first-child > td,
table.wc_rbp_settings_table > tbody > tr:first-child > th {
border-top : 0 none;
}
table.wc_rbp_settings_table tr > th label {
display : block;
font-size : 13px;
line-height : 1.4em;
font-weight : bold;
padding : 0;
margin : 0 0 3px;
color : #333;
}
table.wc_rbp_settings_table tr > th p {
display : block;
line-height : 1.4em;
padding : 0 !important;
margin : 3px 0 0 !important;
font-size : 12px;
font-style : italic;
/*line-height: 16px;*/
color : #666;
}
table.wc_rbp_settings_table select,
table.wc_rbp_settings_table textarea,
table.wc_rbp_settings_table input[type=text],
table.wc_rbp_settings_table input[type=password],
table.wc_rbp_settings_table input[type=email],
table.wc_rbp_settings_table input[type=number] {
width : 100%;
padding : 3px;
height : auto;
}
table.wc_rbp_settings_table textarea {
resize : vertical;
}
.wc_rbp_settings .wc_rbp_settings_submenu {
display : block !important;
margin : 10px 0 0 !important;
width : 100%;
}
.wc_rbp_settings .addon-screenshots ul {
padding : 0;
}
.wc_rbp_settings .addon-screenshots ul li {
display : inline-block;
margin-right : 10px;
padding : 0;
}
.wc_rbp_settings .addon-screenshots ul li a {
border : 1px solid #ccc;
padding : 2px 8px;
}
.wc_rbp_settings .addon-screenshots ul li a:hover {
background : #444;
color : white;
}
.wc_rbp_settings .addons-search-form {
display : inline-block;
float : right;
padding : 5px 0;
right : 0;
}
.wc_rbp_settings .addons-search-form .wp-filter-search {
line-height : 20px;
margin : 4px 0;
padding : 6px 5px;
}
.wc_rbp_addon_listing .plugin-icon {
border : 1px solid #ccc;
border-radius : 5px;
}
div.wc-rbp-enhanced-select {
display : inline-block;
margin-right : 10px !important;
vertical-align : middle;
min-width : 200px;
width : 100% !important;
}
div.wc-rbp-enhanced-select div.selectize-dropdown {
width : 100% !important;
}
.wc_rbp_base_product_price {
display : inline-block;
margin-right : 25px;
margin-top : 5px;
font-style : italic;
font-weight : bold;
}
.wc_rbp_base_product_price .headTxt {
color : red !important;
font-style : normal !important;
font-weight : normal !important;
}
/***@todo : check it */
div.jqibox {
z-index : 100010 !important;
}
/***@todo : check it */
div.jqifade {
background-color : black !important;
}
.enable_text {
color : black;
font-size : 14px;
font-weight : bold;
margin-right : 10px;
}
.wc_rbp_settings_content {
display : inline-block;
float : none;
margin-top : 10px;
width : 100%;
}
.subsubsub.addons_category {
display : block;
font-size : 14px;
margin : 10px 0;
width : 100%;
}
#wc-rbp-product-editor .selectize-control {
display : inline-block !important;
margin-left : 10px !important;
vertical-align : middle !important;
}
#wc-rbp-product-editor .selectize-control > .selectize-input {
padding : 5px 10px !important;
}
#wc-rbp-product-editor .selectize-dropdown.single {
font-weight : normal !important;
}
.wc_rbp_price_editor_footer {
border-top : 1px solid #ccc;
margin-top : 20px;
padding-top : 20px !important;
}
.wc_rbp_price_editor_footer > p {
margin : 0 !important;
}
.wc_rbp_price_editor_footer #update_price {
float : right;
}
.wc_rbp_ajax_overlay {
background : black none repeat scroll 0 0;
opacity : 0.3;
position : fixed;
z-index : 2147483647;
display : none;
}
.wc_rbp_ajax_overlay .sk-folding-cube {
height : 75px;
margin : 0 auto;
top : 50%;
width : 75px;
}
/**
* WC RBP Price Editor Tab Styles
*/
.wc_rbp_popup_section {
border-bottom : 1px solid #ccc;
margin-bottom : 10px;
padding-bottom : 10px;
}
.wc_rbp_popup_section:last-child {
border-bottom : 0px solid #ccc;
margin-bottom : 10px;
padding-bottom : 10px;
}
div.wc_rbp_popup_section > div.wc_rbp_pop_field {
display : inline-block;
margin-right : 7px;
margin-left : 0;
width : 99%;
}
div.wc_rbp_popup_section div.wc_rbp_pop_field_50 {
display : inline-block;
margin-right : calc(50% - 49%);
margin-left : 0;
width : 49%;
}
div.wc_rbp_popup_section div.wc_rbp_pop_field_50:last-child {
display : inline-block;
margin-right : 0;
margin-left : calc(50% - 49%);
}
.wc_rbp_addon_listing .plugin-card-top.wc-rbp-addons-required-plugins {
min-height : auto;
padding : 5px 20px;
}
.wc_rbp_addon_listing .plugin-card-top.wc-rbp-addons-required-plugins > div > p {
margin : 0;
}
.wc_rbp_addon_listing .plugin-card-top.wc-rbp-addons-required-plugins ul {
list-style : inside none disc;
display : inline-block;
margin-bottom : 10px;
margin-top : 10px;
}
.wc_rbp_required_addon_plugin_name {
color : #0073aa;
}
.wc_rbp_required_addon_plugin_status.active {
color : green;
font-weight : bold;
}
.wc_rbp_required_addon_plugin_status.deactivated {
color : red;
font-weight : bold;
}
.wc-rbp-addons-required-plugins li {
padding : 0 10px;
}
.wc-rbp-addons-required-plugins li.notexist {
background : #ffe1e1 none repeat scroll 0 0;
border : 1px solid red;
font-weight : bold;
}
.wc-rbp-addons-required-plugins li.notexist .wc_rbp_required_addon_plugin_name {
color : white;
}
.wc_rbp_addon_listing .plugin-card-top.wc-rbp-addons-required-plugins h3 {
color : navy;
font-size : 14px;
margin-bottom : 0;
}
.wc_rbp_addon_listing .desc.column-description {
margin-right : 0;
}
.wc_rbp_addon_listing .name.column-name {
margin-right : 0;
}
.wc_rbp_addon_listing .plugin-card-bottom .column-updated {
width : calc(100% - 300px);
}
.wc_rbp_addon_listing .wc_rbp_ajax_overlay {
border-radius : 3px;
opacity : 0.13;
position : absolute;
}
.wc_rbp_addon_listing .sk-folding-cube {
height : 50px;
margin : 10px auto;
top : 30%;
width : 50px;
}
.column-downloaded.wc_rbp_ajax_response {
float : none;
max-width : none;
display : block;
max-width : 330px;
}
.column-downloaded.wc_rbp_ajax_response span {
margin-top : 0;
}
.wc_rbp_ajax_error {
color : red;
display : block;
font-size : 13px;
font-weight : bold;
margin-top : 5px;
}
.wc_rbp_ajax_success {
color : green;
display : block;
font-size : 13px;
font-weight : bold;
margin-top : 5px;
}
.sk-folding-cube {
margin : 20px auto;
width : 40px;
height : 40px;
position : relative;
-webkit-transform : rotateZ(45deg);
transform : rotateZ(45deg);
}
.sk-folding-cube .sk-cube {
float : left;
width : 50%;
height : 50%;
position : relative;
-webkit-transform : scale(1.1);
-ms-transform : scale(1.1);
transform : scale(1.1);
}
.sk-folding-cube .sk-cube:before {
content : '';
position : absolute;
top : 0;
left : 0;
width : 100%;
height : 100%;
background-color : #FFF;
-webkit-animation : sk-foldCubeAngle 2.4s infinite linear both;
animation : sk-foldCubeAngle 2.4s infinite linear both;
-webkit-transform-origin : 100% 100%;
-ms-transform-origin : 100% 100%;
transform-origin : 100% 100%;
}
.sk-folding-cube .sk-cube2 {
-webkit-transform : scale(1.1) rotateZ(90deg);
transform : scale(1.1) rotateZ(90deg);
}
.sk-folding-cube .sk-cube3 {
-webkit-transform : scale(1.1) rotateZ(180deg);
transform : scale(1.1) rotateZ(180deg);
}
.sk-folding-cube .sk-cube4 {
-webkit-transform : scale(1.1) rotateZ(270deg);
transform : scale(1.1) rotateZ(270deg);
}
.sk-folding-cube .sk-cube2:before {
-webkit-animation-delay : 0.3s;
animation-delay : 0.3s;
}
.sk-folding-cube .sk-cube3:before {
-webkit-animation-delay : 0.6s;
animation-delay : 0.6s;
}
.sk-folding-cube .sk-cube4:before {
-webkit-animation-delay : 0.9s;
animation-delay : 0.9s;
}
@-webkit-keyframes sk-foldCubeAngle {
0%,
10% {
-webkit-transform : perspective(140px) rotateX(-180deg);
transform : perspective(140px) rotateX(-180deg);
opacity : 0;
}
25%,
75% {
-webkit-transform : perspective(140px) rotateX(0deg);
transform : perspective(140px) rotateX(0deg);
opacity : 1;
}
90%,
100% {
-webkit-transform : perspective(140px) rotateY(180deg);
transform : perspective(140px) rotateY(180deg);
opacity : 0;
}
}
@keyframes sk-foldCubeAngle {
0%,
10% {
-webkit-transform : perspective(140px) rotateX(-180deg);
transform : perspective(140px) rotateX(-180deg);
opacity : 0;
}
25%,
75% {
-webkit-transform : perspective(140px) rotateX(0deg);
transform : perspective(140px) rotateX(0deg);
opacity : 1;
}
90%,
100% {
-webkit-transform : perspective(140px) rotateY(180deg);
transform : perspective(140px) rotateY(180deg);
opacity : 0;
}
}
.bar {
width : auto;
min-width : 100px;
max-width : 600px;
height : 20px;
border : 1px solid #2980b9;
border-radius : 3px;
background-image : repeating-linear-gradient(-45deg, #2980b9, #2980b9 11px, #eee 10px, #eee 20px /* determines size */
);
background-size : 28px 28px;
animation : move .5s linear infinite;
}
@keyframes move {
0% {
background-position : 0 0;
}
100% {
background-position : 28px 0;
}
}
/**
* Styled Checkbox CSS Code
*/
.switchery {
background-color : #fff;
border : 1px solid #dfdfdf;
border-radius : 20px;
cursor : pointer;
display : inline-block;
height : 30px;
position : relative;
vertical-align : middle;
width : 50px;
-moz-user-select : none;
-khtml-user-select : none;
-webkit-user-select : none;
-ms-user-select : none;
user-select : none;
box-sizing : content-box;
background-clip : content-box
}
.switchery > small {
background : #fff;
border-radius : 100%;
box-shadow : 0 1px 3px rgba(0, 0, 0, 0.4);
height : 30px;
position : absolute;
top : 0;
width : 30px
}
.switchery-small {
border-radius : 20px;
height : 20px;
width : 33px
}
.switchery-small > small {
height : 20px;
width : 20px
}
.switchery-large {
border-radius : 40px;
height : 40px;
width : 66px
}
.switchery-large > small {
height : 40px;
width : 40px
}
.wcrbp-tab-nav {
margin-bottom : -1px;
}
.wcrbp-tab-nav > li {
margin : 0;
display : inline-block;
}
.wcrbp-tab-nav > .wcrbp-tab-active {
border : 1px solid #dfdfdf;
border-bottom-color : transparent;
background : #fdfdfd;
}
.wcrbp-tab-nav > li > a {
display : block;
padding : 3px 5px 5px;
text-decoration : none;
}
.wcrbp-tab-nav > li > a:active,
.wcrbp-tab-nav > li > a:focus {
outline : none;
box-shadow : none;
}
.wcrbp-tab-nav i,
.wcrbp-tab-nav img {
vertical-align : middle;
margin-right : .3em;
}
.wcrbp-tab-nav i {
width : 16px;
height : 16px;
font-size : 16px;
}
.wcrbp-tab-nav img {
width : 12px;
height : 12px;
display : inline-block;
}
.wcrbp-tab-active > a {
color : #333;
}
.wcrbp-tab-panel {
padding : 10px 5px 0;
border : solid 1px #dfdfdf;
background : #fdfdfd;
display : none;
}
.wcrbp-tabs-left {
overflow : hidden;
/* margin: -6px -12px -12px;*/
margin : -6px -12px 0;
}
.wcrbp-tabs-left > .wcrbp-tab-nav {
float : left;
margin : 0 -1px 0 0;
background : #fdfdfd;
border-right : 1px solid #dfdfdf;
z-index : 9;
}
.wcrbp-tabs-left > .wcrbp-tab-nav > li {
display : block;
}
.wcrbp-tabs-left > .wcrbp-tab-nav > li:first-child {
border-top : none;
}
.wcrbp-tabs-left > .wcrbp-tab-nav > li > a {
padding : 5px 20px 8px 10px;
}
.wcrbp-tabs-left > ul > li.wcrbp-tab-active {
border : 1px solid #dfdfdf;
border-right-color : #fdfdfd;
border-left : 2px #2ea2cc;
box-shadow : 0 2px 0 rgba(0, 0, 0, 0.02), 0 1px 0 rgba(0, 0, 0, 0.02);
position : relative;
right : -1px;
}
.wcrbp-tabs-left > .wcrbp-tab-panels {
overflow : auto;
border-left : 1px solid #dfdfdf;
z-index : 1;
}
.wcrbp-tabs-left > .wcrbp-tab-panels > .wcrbp-tab-panel {
padding : 3px 20px 0;
background : transparent;
border : none;
}
.wcrbp-tabs-no-controls {
border : 0;
background : transparent;
}
.wcrbp-tabs-no-controls .hndle,
.wcrbp-tabs-no-controls .handlediv {
display : none;
}
.wcrbp-tabs-no-controls .inside {
margin : 0;
padding : 0;
}
.wcrbp-tabs-box .wcrbp-tab-nav li {
background : #ebebeb;
border : 1px solid #dedede;
margin-right : 5px;
}
.wcrbp-tabs-box .wcrbp-tab-nav li:hover {
background : #fff;
}
.wcrbp-tabs-box .wcrbp-tab-nav a {
color : #777;
}
.wcrbp-tabs-box .wcrbp-tab-nav .wcrbp-tab-active {
border-bottom-color : transparent;
}
.wcrbp-tabs-box .wcrbp-tab-nav .wcrbp-tab-active,
.wcrbp-tabs-box .wcrbp-tab-nav .wcrbp-tab-active:hover {
background : #f5f5f5;
}
.wcrbp-tabs-box .wcrbp-tab-nav .wcrbp-tab-active a {
color : #555;
}
.wcrbp-tabs-box .wcrbp-tab-panel {
background : #f5f5f5;
border : solid 1px #dedede;
}
.wcrbp-tab-nav .wc-rbp-tab-status {
border-radius : 30px;
float : right;
height : 10px !important;
margin-left : 10px;
margin-top : 3%;
width : 10px !important;
}
.wcrbp-tab-nav .wc-rbp-tab-status.bgred {
background : red;
}
.wcrbp-tab-nav .wc-rbp-tab-status.bggreen {
background : green;
}
.wcrbp-tab-nav .wc-rbp-tab-status.bgblue {
background : #14A4B7;
}
/**
* selectize.css (v0.12.1)
* Copyright (c) 2013–2015 Brian Reavis & contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
* @author Brian Reavis <brian@thirdroute.com>
*/
.selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder {visibility : visible !important;background : #f2f2f2 !important;background : rgba(0, 0, 0, 0.06) !important;border : 0 none !important;-webkit-box-shadow : inset 0 0 12px 4px #ffffff;box-shadow : inset 0 0 12px 4px #ffffff;}
.selectize-control.plugin-drag_drop .ui-sortable-placeholder::after {content : '!';visibility : hidden;}
.selectize-control.plugin-drag_drop .ui-sortable-helper {-webkit-box-shadow : 0 2px 5px rgba(0, 0, 0, 0.2);box-shadow : 0 2px 5px rgba(0, 0, 0, 0.2);}
.selectize-dropdown-header {position : relative;padding : 5px 8px;border-bottom : 1px solid #d0d0d0;background : #f8f8f8;-webkit-border-radius : 3px 3px 0 0;-moz-border-radius : 3px 3px 0 0;border-radius : 3px 3px 0 0;}
.selectize-dropdown-header-close {position : absolute;right : 8px;top : 50%;color : #303030;opacity : 0.4;margin-top : -12px;line-height : 20px;font-size : 20px !important;}
.selectize-dropdown-header-close:hover {color : #000000;}
.selectize-dropdown.plugin-optgroup_columns .optgroup {border-right : 1px solid #f2f2f2;border-top : 0 none;float : left;-webkit-box-sizing : border-box;-moz-box-sizing : border-box;box-sizing : border-box;}
.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child {border-right : 0 none;}
.selectize-dropdown.plugin-optgroup_columns .optgroup:before {display : none;}
.selectize-dropdown.plugin-optgroup_columns .optgroup-header {border-top : 0 none;}
.selectize-control.plugin-remove_button [data-value] {position : relative;padding-right : 24px !important;}
.selectize-control.plugin-remove_button [data-value] .remove {z-index : 1; /* fixes ie bug (see #392) */position : absolute;top : 0;right : 0;bottom : 0;width : 17px;text-align : center;font-weight : bold;font-size : 12px;color : inherit;text-decoration : none;vertical-align : middle;display : inline-block;padding : 2px 0 0 0;border-left : 1px solid #d0d0d0;-webkit-border-radius : 0 2px 2px 0;-moz-border-radius : 0 2px 2px 0;border-radius : 0 2px 2px 0;-webkit-box-sizing : border-box;-moz-box-sizing : border-box;box-sizing : border-box;}
.selectize-control.plugin-remove_button [data-value] .remove:hover {background : rgba(0, 0, 0, 0.05);}
.selectize-control.plugin-remove_button [data-value].active .remove {border-left-color : #cacaca;}
.selectize-control.plugin-remove_button .disabled [data-value] .remove:hover {background : none;}
.selectize-control.plugin-remove_button .disabled [data-value] .remove {border-left-color : #ffffff;}
.selectize-control {position : relative;}
.selectize-dropdown, .selectize-input, .selectize-input input {color : #303030;font-family : inherit;font-size : 13px;line-height : 18px;-webkit-font-smoothing : inherit;}
.selectize-input, .selectize-control.single .selectize-input.input-active {background : #ffffff;cursor : text;display : inline-block;}
.selectize-input {border : 1px solid #d0d0d0;padding : 8px 8px;display : inline-block;width : 100%;overflow : hidden;position : relative;z-index : 1;-webkit-box-sizing : border-box;-moz-box-sizing : border-box;box-sizing : border-box;-webkit-box-shadow : inset 0 1px 1px rgba(0, 0, 0, 0.1);box-shadow : inset 0 1px 1px rgba(0, 0, 0, 0.1);-webkit-border-radius : 3px;-moz-border-radius : 3px;border-radius : 3px;}
.selectize-control.multi .selectize-input.has-items {padding : 6px 8px 3px;}
.selectize-input.full {background-color : #ffffff;}
.selectize-input.disabled, .selectize-input.disabled * {cursor : default !important;}
.selectize-input.focus {-webkit-box-shadow : inset 0 1px 2px rgba(0, 0, 0, 0.15);box-shadow : inset 0 1px 2px rgba(0, 0, 0, 0.15);}
.selectize-input.dropdown-active {-webkit-border-radius : 3px 3px 0 0;-moz-border-radius : 3px 3px 0 0;border-radius : 3px 3px 0 0;}
.selectize-input > * {vertical-align : baseline;display : -moz-inline-stack;display : inline-block;zoom : 1;*display : inline;}
.selectize-control.multi .selectize-input > div {cursor : pointer;margin : 0 3px 3px 0;padding : 2px 6px;background : #f2f2f2;color : #303030;border : 0 solid #d0d0d0;}
.selectize-control.multi .selectize-input > div.active {background : #e8e8e8;color : #303030;border : 0 solid #cacaca;}
.selectize-control.multi .selectize-input.disabled > div, .selectize-control.multi .selectize-input.disabled > div.active {color : #7d7d7d;background : #ffffff;border : 0 solid #ffffff;}
.selectize-input > input {display : inline-block !important;padding : 0 !important;min-height : 0 !important;max-height : none !important;max-width : 100% !important;margin : 0 2px 0 0 !important;text-indent : 0 !important;border : 0 none !important;background : none !important;line-height : inherit !important;-webkit-user-select : auto !important;-webkit-box-shadow : none !important;box-shadow : none !important;}
.selectize-input > input::-ms-clear {display : none;}
.selectize-input > input:focus {outline : none !important;}
.selectize-input::after {content : ' ';display : block;clear : left;}
.selectize-input.dropdown-active::before {content : ' ';display : block;position : absolute;background : #f0f0f0;height : 1px;bottom : 0;left : 0;right : 0;}
.selectize-dropdown {position : absolute;z-index : 10;border : 1px solid #d0d0d0;background : #ffffff;margin : -1px 0 0 0;border-top : 0 none;-webkit-box-sizing : border-box;-moz-box-sizing : border-box;box-sizing : border-box;-webkit-box-shadow : 0 1px 3px rgba(0, 0, 0, 0.1);box-shadow : 0 1px 3px rgba(0, 0, 0, 0.1);-webkit-border-radius : 0 0 3px 3px;-moz-border-radius : 0 0 3px 3px;border-radius : 0 0 3px 3px;}
.selectize-dropdown [data-selectable] {cursor : pointer;overflow : hidden;}
.selectize-dropdown [data-selectable] .highlight {background : rgba(125, 168, 208, 0.2);-webkit-border-radius : 1px;-moz-border-radius : 1px;border-radius : 1px;}
.selectize-dropdown [data-selectable], .selectize-dropdown .optgroup-header {padding : 5px 8px;}
.selectize-dropdown .optgroup:first-child .optgroup-header {border-top : 0 none;}
.selectize-dropdown .optgroup-header {color : #303030;background : #ffffff;cursor : default;}
.selectize-dropdown .active {background-color : #f5fafd;color : #495c68;}
.selectize-dropdown .active.create {color : #495c68;}
.selectize-dropdown .create {color : rgba(48, 48, 48, 0.5);}
.selectize-dropdown-content {overflow-y : auto;overflow-x : hidden;max-height : 200px;}
.selectize-control.single .selectize-input, .selectize-control.single .selectize-input input {cursor : pointer;}
.selectize-control.single .selectize-input.input-active, .selectize-control.single .selectize-input.input-active input {cursor : text;}
.selectize-control.single .selectize-input:after {content : ' ';display : block;position : absolute;top : 50%;right : 15px;margin-top : -3px;width : 0;height : 0;border-style : solid;border-width : 5px 5px 0 5px;border-color : #808080 transparent transparent transparent;}
.selectize-control.single .selectize-input.dropdown-active:after {margin-top : -4px;border-width : 0 5px 5px 5px;border-color : transparent transparent #808080 transparent;}
.selectize-control.rtl.single .selectize-input:after {left : 15px;right : auto;}
.selectize-control.rtl .selectize-input > input {margin : 0 4px 0 -2px !important;}
.selectize-control .selectize-input.disabled {opacity : 0.5;background-color : #fafafa;}
/*** selectize.default.css (v0.12.1) - Default Theme* Copyright (c) 2013–2015 Brian Reavis & contributors** Licensed under the Apache License, Version 2.0 (the "License"); you may not use this* file except in compliance with the License. You may obtain a copy of the License at:* http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software distributed under* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF* ANY KIND, either express or implied. See the License for the specific language* governing permissions and limitations under the License.** @author Brian Reavis <brian@thirdroute.com>*/
.selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder {visibility : visible !important;background : #f2f2f2 !important;background : rgba(0, 0, 0, 0.06) !important;border : 0 none !important;-webkit-box-shadow : inset 0 0 12px 4px #ffffff;box-shadow : inset 0 0 12px 4px #ffffff;}
.selectize-control.plugin-drag_drop .ui-sortable-placeholder::after {content : '!';visibility : hidden;}
.selectize-control.plugin-drag_drop .ui-sortable-helper {-webkit-box-shadow : 0 2px 5px rgba(0, 0, 0, 0.2);box-shadow : 0 2px 5px rgba(0, 0, 0, 0.2);}
.selectize-dropdown-header {position : relative;padding : 5px 8px;border-bottom : 1px solid #d0d0d0;background : #f8f8f8;-webkit-border-radius : 3px 3px 0 0;-moz-border-radius : 3px 3px 0 0;border-radius : 3px 3px 0 0;}
.selectize-dropdown-header-close {position : absolute;right : 8px;top : 50%;color : #303030;opacity : 0.4;margin-top : -12px;line-height : 20px;font-size : 20px !important;}
.selectize-dropdown-header-close:hover {color : #000000;}
.selectize-dropdown.plugin-optgroup_columns .optgroup {border-right : 1px solid #f2f2f2;border-top : 0 none;float : left;-webkit-box-sizing : border-box;-moz-box-sizing : border-box;box-sizing : border-box;}
.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child {border-right : 0 none;}
.selectize-dropdown.plugin-optgroup_columns .optgroup:before {display : none;}
.selectize-dropdown.plugin-optgroup_columns .optgroup-header {border-top : 0 none;}
.selectize-control.plugin-remove_button [data-value] {position : relative;padding-right : 24px !important;}
.selectize-control.plugin-remove_button [data-value] .remove {z-index : 1; /* fixes ie bug (see #392) */position : absolute;top : 0;right : 0;bottom : 0;width : 17px;text-align : center;font-weight : bold;font-size : 12px;color : inherit;text-decoration : none;vertical-align : middle;display : inline-block;padding : 2px 0 0 0;border-left : 1px solid #0073bb;-webkit-border-radius : 0 2px 2px 0;-moz-border-radius : 0 2px 2px 0;border-radius : 0 2px 2px 0;-webkit-box-sizing : border-box;-moz-box-sizing : border-box;box-sizing : border-box;}
.selectize-control.plugin-remove_button [data-value] .remove:hover {background : rgba(0, 0, 0, 0.05);}
.selectize-control.plugin-remove_button [data-value].active .remove {border-left-color : #00578d;}
.selectize-control.plugin-remove_button .disabled [data-value] .remove:hover {background : none;}
.selectize-control.plugin-remove_button .disabled [data-value] .remove {border-left-color : #aaaaaa;}
.selectize-control {position : relative;}
.selectize-dropdown, .selectize-input, .selectize-input input {color : #303030;font-family : inherit;font-size : 13px;line-height : 18px;-webkit-font-smoothing : inherit;}
.selectize-input, .selectize-control.single .selectize-input.input-active {background : #ffffff;cursor : text;display : inline-block;}
.selectize-input {border : 1px solid #d0d0d0;padding : 8px 8px;display : inline-block;width : 100%;overflow : hidden;position : relative;z-index : 1;-webkit-box-sizing : border-box;-moz-box-sizing : border-box;box-sizing : border-box;-webkit-box-shadow : inset 0 1px 1px rgba(0, 0, 0, 0.1);box-shadow : inset 0 1px 1px rgba(0, 0, 0, 0.1);-webkit-border-radius : 3px;-moz-border-radius : 3px;border-radius : 3px;}
.selectize-control.multi .selectize-input.has-items {padding : 5px 8px 2px;}
.selectize-input.full {background-color : #ffffff;}
.selectize-input.disabled, .selectize-input.disabled * {cursor : default !important;}
.selectize-input.focus {-webkit-box-shadow : inset 0 1px 2px rgba(0, 0, 0, 0.15);box-shadow : inset 0 1px 2px rgba(0, 0, 0, 0.15);}
.selectize-input.dropdown-active {-webkit-border-radius : 3px 3px 0 0;-moz-border-radius : 3px 3px 0 0;border-radius : 3px 3px 0 0;}
.selectize-input > * {vertical-align : baseline;display : -moz-inline-stack;display : inline-block;zoom : 1;*display : inline;}
.selectize-control.multi .selectize-input > div {cursor : pointer;margin : 0 3px 3px 0;padding : 2px 6px;background : #1da7ee;color : #ffffff;border : 1px solid #0073bb;}
.selectize-control.multi .selectize-input > div.active {background : #92c836;color : #ffffff;border : 1px solid #00578d;}
.selectize-control.multi .selectize-input.disabled > div, .selectize-control.multi .selectize-input.disabled > div.active {color : #ffffff;background : #d2d2d2;border : 1px solid #aaaaaa;}
.selectize-input > input {display : inline-block !important;padding : 0 !important;min-height : 0 !important;max-height : none !important;max-width : 100% !important;margin : 0 1px !important;text-indent : 0 !important;border : 0 none !important;background : none !important;line-height : inherit !important;-webkit-user-select : auto !important;-webkit-box-shadow : none !important;box-shadow : none !important;}
.selectize-input > input::-ms-clear {display : none;}
.selectize-input > input:focus {outline : none !important;}
.selectize-input::after {content : ' ';display : block;clear : left;}
.selectize-input.dropdown-active::before {content : ' ';display : block;position : absolute;background : #f0f0f0;height : 1px;bottom : 0;left : 0;right : 0;}
.selectize-dropdown {position : absolute;z-index : 10;border : 1px solid #d0d0d0;background : #ffffff;margin : -1px 0 0 0;border-top : 0 none;-webkit-box-sizing : border-box;-moz-box-sizing : border-box;box-sizing : border-box;-webkit-box-shadow : 0 1px 3px rgba(0, 0, 0, 0.1);box-shadow : 0 1px 3px rgba(0, 0, 0, 0.1);-webkit-border-radius : 0 0 3px 3px;-moz-border-radius : 0 0 3px 3px;border-radius : 0 0 3px 3px;}
.selectize-dropdown [data-selectable] {cursor : pointer;overflow : hidden;}
.selectize-dropdown [data-selectable] .highlight {background : rgba(125, 168, 208, 0.2);-webkit-border-radius : 1px;-moz-border-radius : 1px;border-radius : 1px;}
.selectize-dropdown [data-selectable], .selectize-dropdown .optgroup-header {padding : 5px 8px;}
.selectize-dropdown .optgroup:first-child .optgroup-header {border-top : 0 none;}
.selectize-dropdown .optgroup-header {color : #303030;background : #ffffff;cursor : default;}
.selectize-dropdown .active {background-color : #f5fafd;color : #495c68;}
.selectize-dropdown .active.create {color : #495c68;}
.selectize-dropdown .create {color : rgba(48, 48, 48, 0.5);}
.selectize-dropdown-content {overflow-y : auto;overflow-x : hidden;max-height : 200px;}
.selectize-control.single .selectize-input, .selectize-control.single .selectize-input input {cursor : pointer;}
.selectize-control.single .selectize-input.input-active, .selectize-control.single .selectize-input.input-active input {cursor : text;}
.selectize-control.single .selectize-input:after {content : ' ';display : block;position : absolute;top : 50%;right : 15px;margin-top : -3px;width : 0;height : 0;border-style : solid;border-width : 5px 5px 0 5px;border-color : #808080 transparent transparent transparent;}
.selectize-control.single .selectize-input.dropdown-active:after {margin-top : -4px;border-width : 0 5px 5px 5px;border-color : transparent transparent #808080 transparent;}
.selectize-control.rtl.single .selectize-input:after {left : 15px;right : auto;}
.selectize-control.rtl .selectize-input > input {margin : 0 4px 0 -2px !important;}
.selectize-control .selectize-input.disabled {opacity : 0.5;background-color : #fafafa;}
.selectize-control.multi .selectize-input.has-items {padding-left : 5px;padding-right : 5px;}
.selectize-control.multi .selectize-input.disabled [data-value] {color : #999;text-shadow : none;background : none;-webkit-box-shadow : none;box-shadow : none;}
.selectize-control.multi .selectize-input.disabled [data-value], .selectize-control.multi .selectize-input.disabled [data-value] .remove {border-color : #e6e6e6;}
.selectize-control.multi .selectize-input.disabled [data-value] .remove {background : none;}
.selectize-control.multi .selectize-input [data-value] {text-shadow : 0 1px 0 rgba(0, 51, 83, 0.3);-webkit-border-radius : 3px;-moz-border-radius : 3px;border-radius : 3px;background-color : #1b9dec;background-image : -moz-linear-gradient(top, #1da7ee, #178ee9);background-image : -webkit-gradient(linear, 0 0, 0 100%, from(#1da7ee), to(#178ee9));background-image : -webkit-linear-gradient(top, #1da7ee, #178ee9);background-image : -o-linear-gradient(top, #1da7ee, #178ee9);background-image : linear-gradient(to bottom, #1da7ee, #178ee9);background-repeat : repeat-x;filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff1da7ee', endColorstr='#ff178ee9', GradientType=0);-webkit-box-shadow : 0 1px 0 rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.03);box-shadow : 0 1px 0 rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.03);}
.selectize-control.multi .selectize-input [data-value].active {background-color : #0085d4;background-image : -moz-linear-gradient(top, #008fd8, #0075cf);background-image : -webkit-gradient(linear, 0 0, 0 100%, from(#008fd8), to(#0075cf));background-image : -webkit-linear-gradient(top, #008fd8, #0075cf);background-image : -o-linear-gradient(top, #008fd8, #0075cf);background-image : linear-gradient(to bottom, #008fd8, #0075cf);background-repeat : repeat-x;filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff008fd8', endColorstr='#ff0075cf', GradientType=0);}
.selectize-control.single .selectize-input {-webkit-box-shadow : 0 1px 0 rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.8);box-shadow : 0 1px 0 rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.8);background-color : #f9f9f9;background-image : -moz-linear-gradient(top, #fefefe, #f2f2f2);background-image : -webkit-gradient(linear, 0 0, 0 100%, from(#fefefe), to(#f2f2f2));background-image : -webkit-linear-gradient(top, #fefefe, #f2f2f2);background-image : -o-linear-gradient(top, #fefefe, #f2f2f2);background-image : linear-gradient(to bottom, #fefefe, #f2f2f2);background-repeat : repeat-x;filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffefefe', endColorstr='#fff2f2f2', GradientType=0);}
.selectize-control.single .selectize-input, .selectize-dropdown.single {border-color : #b8b8b8;}
.selectize-dropdown .optgroup-header {padding-top : 7px;font-weight : bold;font-size : 0.85em;}
.selectize-dropdown .optgroup {border-top : 1px solid #f0f0f0;}
.selectize-dropdown .optgroup:first-child {border-top : 0 none;}
\ No newline at end of file
.pws_tabs_container.pws_scale .pws_hide,.pws_tabs_list{-moz-transition:all .3s ease-in-out .3s;-o-transition:all .3s ease-in-out .3s}.pws_tabs_container,.pws_tabs_controll a{font-size:16px}@media only screen and (max-width:60em){.pws_tabs_container.pws_tabs_responsive{width:100%!important}.pws_tabs_container.pws_tabs_responsive ul.pws_tabs_controll{width:100%}.pws_tabs_container.pws_tabs_responsive ul.pws_tabs_controll li{vertical-align:top;text-align:center}.pws_tabs_container.pws_tabs_responsive ul.pws_tabs_controll li a{margin:0;font-size:1em;line-height:1.125em;overflow:hidden}.pws_tabs_container.pws_tabs_responsive ul.pws_tabs_controll li a i{display:block;margin:0 0 5px}.pws_tabs_container.pws_tabs_responsive.pws_tabs_vertical{display:block;position:relative}.pws_tabs_container.pws_tabs_responsive.pws_tabs_vertical:after{display:block;content:'';clear:both}.pws_tabs_container.pws_tabs_responsive.pws_tabs_vertical ul.pws_tabs_controll{width:100%;position:relative;float:none}.pws_tabs_container.pws_tabs_responsive.pws_tabs_vertical ul.pws_tabs_controll li{display:inline-block}.pws_tabs_container.pws_tabs_responsive.pws_tabs_vertical ul.pws_tabs_controll li a{margin:0}.pws_tabs_container.pws_tabs_responsive.pws_tabs_vertical .pws_tabs_list{position:relative;float:none}}@media only screen and (max-width:37.5em){.pws_tabs_container.pws_tabs_responsive{width:100%!important;position:relative}.pws_tabs_container.pws_tabs_responsive .pws_responsive_small_menu{width:100%;height:40px;background-color:#9bd7d5;display:block}.pws_tabs_container.pws_tabs_responsive .pws_responsive_small_menu a{width:40px;height:40px;display:block;overflow:hidden;color:#fff;font-size:32px;font-size:2em;text-align:center;padding:3px 0 0;cursor:pointer;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.pws_tabs_container.pws_tabs_responsive .pws_responsive_small_menu a:hover{background-color:#70c5c2}.pws_tabs_container.pws_tabs_responsive ul.pws_tabs_controll.pws_tabs_menu_popup{display:block;position:absolute;overflow:hidden;top:40px;left:0;z-index:99;margin:0;padding:0;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.pws_tabs_container.pws_tabs_responsive ul.pws_tabs_controll.pws_tabs_menu_popup li{display:block;float:none}.pws_tabs_container.pws_tabs_responsive ul.pws_tabs_controll.pws_tabs_menu_popup li a i{display:inline-block;margin:0 .1875em 0 0}.pws_tabs_container.pws_tabs_responsive.pws_tabs_rtl ul.pws_tabs_controll.pws_tabs_menu_popup li a i{display:inline-block;margin:0 0 0 .1875em}}.pws_tabs_container{width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.pws_tabs_container ul.pws_tabs_controll{list-style:none;margin:0;padding:0}.pws_tabs_container ul.pws_tabs_controll li{display:inline-block}.pws_tabs_container ul.pws_tabs_controll li a{display:block;background-color:#9bd7d5;padding:.9375em 1.25em;text-decoration:none;color:#fff;margin-right:3px;cursor:pointer}.pws_tabs_container ul.pws_tabs_controll li a:hover{background-color:#70c5c2}.pws_tabs_container ul.pws_tabs_controll li a i{margin-right:8px}.pws_tabs_container ul.pws_tabs_controll li a.pws_tab_noname i{margin-right:0;margin-left:0}.pws_tabs_container ul.pws_tabs_controll li a.pws_tab_active{background-color:#fff;color:#505050}.pws_tabs_list{display:block;background-color:#fff;height:auto;padding:1.25em;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-transition:all .3s ease-in-out .3s;transition:all .3s ease-in-out .3s;overflow:hidden;position:relative}.pws_tab_single{display:block;-webkit-transition:all .3s ease-in-out 0;-moz-transition:all .3s ease-in-out 0;-o-transition:all .3s ease-in-out 0;transition:all .3s ease-in-out 0}.pws_tabs_container.pws_tabs_rtl{text-align:right;direction:rtl}.pws_tabs_container.pws_tabs_rtl ul.pws_tabs_controll li a{margin-right:0;margin-left:3px}.pws_tabs_container.pws_tabs_rtl ul.pws_tabs_controll li a i{margin-left:8px;margin-right:0}.pws_tabs_container.pws_tabs_vertical{display:block;position:relative}.pws_tabs_container.pws_tabs_vertical:after{display:block;content:'';clear:both}.pws_tabs_container.pws_tabs_vertical>ul.pws_tabs_controll{width:auto;position:relative;float:left}.pws_tabs_container.pws_tabs_vertical>ul.pws_tabs_controll li{display:block}.pws_tabs_container.pws_tabs_vertical>ul.pws_tabs_controll li a{margin-right:0;margin-left:0;margin-bottom:3px}.pws_tabs_container.pws_tabs_vertical>.pws_tabs_list{position:relative;float:left}.pws_tabs_container.pws_tabs_responsive.pws_theme_violet .pws_responsive_small_menu{background-color:#c72c66}.pws_tabs_container.pws_tabs_responsive.pws_theme_violet .pws_responsive_small_menu a:hover{background-color:#a6164c}.pws_tabs_container.pws_theme_violet ul.pws_tabs_controll li a{background-color:#c72c66}.pws_tabs_container.pws_theme_violet ul.pws_tabs_controll li a:hover{background-color:#a6164c}.pws_tabs_container.pws_theme_violet ul.pws_tabs_controll li a.pws_tab_active{background-color:#fff}.pws_tabs_container.pws_tabs_responsive.pws_theme_green .pws_responsive_small_menu{background-color:#86c447}.pws_tabs_container.pws_tabs_responsive.pws_theme_green .pws_responsive_small_menu a:hover{background-color:#539312}.pws_tabs_container.pws_theme_green ul.pws_tabs_controll li a{background-color:#86c447}.pws_tabs_container.pws_theme_green ul.pws_tabs_controll li a:hover{background-color:#539312}.pws_tabs_container.pws_theme_green ul.pws_tabs_controll li a.pws_tab_active{background-color:#fff}.pws_tabs_container.pws_tabs_responsive.pws_theme_yellow .pws_responsive_small_menu{background-color:#fdb813}.pws_tabs_container.pws_tabs_responsive.pws_theme_yellow .pws_responsive_small_menu a:hover{background-color:orange}.pws_tabs_container.pws_theme_yellow ul.pws_tabs_controll li a{background-color:#fdb813}.pws_tabs_container.pws_theme_yellow ul.pws_tabs_controll li a:hover{background-color:orange}.pws_tabs_container.pws_theme_yellow ul.pws_tabs_controll li a.pws_tab_active{background-color:#fff}.pws_tabs_container.pws_tabs_responsive.pws_theme_gold .pws_responsive_small_menu{background-color:#f89827}.pws_tabs_container.pws_tabs_responsive.pws_theme_gold .pws_responsive_small_menu a:hover{background-color:#fa7b00}.pws_tabs_container.pws_theme_gold ul.pws_tabs_controll li a{background-color:#f89827}.pws_tabs_container.pws_theme_gold ul.pws_tabs_controll li a:hover{background-color:#fa7b00}.pws_tabs_container.pws_theme_gold ul.pws_tabs_controll li a.pws_tab_active{background-color:#fff}.pws_tabs_container.pws_tabs_responsive.pws_theme_orange .pws_responsive_small_menu{background-color:#f15b42}.pws_tabs_container.pws_tabs_responsive.pws_theme_orange .pws_responsive_small_menu a:hover{background-color:#fd2e0b}.pws_tabs_container.pws_theme_orange ul.pws_tabs_controll li a{background-color:#f15b42}.pws_tabs_container.pws_theme_orange ul.pws_tabs_controll li a:hover{background-color:#fd2e0b}.pws_tabs_container.pws_theme_orange ul.pws_tabs_controll li a.pws_tab_active{background-color:#fff}.pws_tabs_container.pws_tabs_responsive.pws_theme_red .pws_responsive_small_menu{background-color:#e41937}.pws_tabs_container.pws_tabs_responsive.pws_theme_red .pws_responsive_small_menu a:hover{background-color:#d70726}.pws_tabs_container.pws_theme_red ul.pws_tabs_controll li a{background-color:#e41937}.pws_tabs_container.pws_theme_red ul.pws_tabs_controll li a:hover{background-color:#d70726}.pws_tabs_container.pws_theme_red ul.pws_tabs_controll li a.pws_tab_active{background-color:#fff}.pws_tabs_container.pws_tabs_responsive.pws_theme_purple .pws_responsive_small_menu{background-color:#672e8d}.pws_tabs_container.pws_tabs_responsive.pws_theme_purple .pws_responsive_small_menu a:hover{background-color:#470871}.pws_tabs_container.pws_theme_purple ul.pws_tabs_controll li a{background-color:#672e8d}.pws_tabs_container.pws_theme_purple ul.pws_tabs_controll li a:hover{background-color:#470871}.pws_tabs_container.pws_theme_purple ul.pws_tabs_controll li a.pws_tab_active{background-color:#fff}.pws_tabs_container.pws_tabs_responsive.pws_theme_grey .pws_responsive_small_menu{background-color:#4d4d4f}.pws_tabs_container.pws_tabs_responsive.pws_theme_grey .pws_responsive_small_menu a:hover{background-color:#000}.pws_tabs_container.pws_theme_grey ul.pws_tabs_controll li a{background-color:#4d4d4f}.pws_tabs_container.pws_theme_grey ul.pws_tabs_controll li a:hover{background-color:#000}.pws_tabs_container.pws_theme_grey ul.pws_tabs_controll li a.pws_tab_active{background-color:#fff}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_violet .pws_responsive_small_menu{background-color:#c72c66}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_violet .pws_responsive_small_menu a:hover{background-color:#a6164c}.pws_tabs_container.pws_theme_dark_violet .pws_tabs_list{background-color:#fafafa}.pws_tabs_container.pws_theme_dark_violet ul.pws_tabs_controll li a{background-color:#c72c66}.pws_tabs_container.pws_theme_dark_violet ul.pws_tabs_controll li a:hover{background-color:#a6164c}.pws_tabs_container.pws_theme_dark_violet ul.pws_tabs_controll li a.pws_tab_active{background-color:#fafafa}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_green .pws_responsive_small_menu{background-color:#86c447}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_green .pws_responsive_small_menu a:hover{background-color:#539312}.pws_tabs_container.pws_theme_dark_green .pws_tabs_list{background-color:#fafafa}.pws_tabs_container.pws_theme_dark_green ul.pws_tabs_controll li a{background-color:#86c447}.pws_tabs_container.pws_theme_dark_green ul.pws_tabs_controll li a:hover{background-color:#539312}.pws_tabs_container.pws_theme_dark_green ul.pws_tabs_controll li a.pws_tab_active{background-color:#fafafa}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_yellow .pws_responsive_small_menu{background-color:#fdb813}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_yellow .pws_responsive_small_menu a:hover{background-color:orange}.pws_tabs_container.pws_theme_dark_yellow .pws_tabs_list{background-color:#fafafa}.pws_tabs_container.pws_theme_dark_yellow ul.pws_tabs_controll li a{background-color:#fdb813}.pws_tabs_container.pws_theme_dark_yellow ul.pws_tabs_controll li a:hover{background-color:orange}.pws_tabs_container.pws_theme_dark_yellow ul.pws_tabs_controll li a.pws_tab_active{background-color:#fafafa}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_gold .pws_responsive_small_menu{background-color:#f89827}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_gold .pws_responsive_small_menu a:hover{background-color:#fa7b00}.pws_tabs_container.pws_theme_dark_gold .pws_tabs_list{background-color:#fafafa}.pws_tabs_container.pws_theme_dark_gold ul.pws_tabs_controll li a{background-color:#f89827}.pws_tabs_container.pws_theme_dark_gold ul.pws_tabs_controll li a:hover{background-color:#fa7b00}.pws_tabs_container.pws_theme_dark_gold ul.pws_tabs_controll li a.pws_tab_active{background-color:#fafafa}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_orange .pws_responsive_small_menu{background-color:#f15b42}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_orange .pws_responsive_small_menu a:hover{background-color:#fd2e0b}.pws_tabs_container.pws_theme_dark_orange .pws_tabs_list{background-color:#fafafa}.pws_tabs_container.pws_theme_dark_orange ul.pws_tabs_controll li a{background-color:#f15b42}.pws_tabs_container.pws_theme_dark_orange ul.pws_tabs_controll li a:hover{background-color:#fd2e0b}.pws_tabs_container.pws_theme_dark_orange ul.pws_tabs_controll li a.pws_tab_active{background-color:#fafafa}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_red .pws_responsive_small_menu{background-color:#e41937}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_red .pws_responsive_small_menu a:hover{background-color:#d70726}.pws_tabs_container.pws_theme_dark_red .pws_tabs_list{background-color:#fafafa}.pws_tabs_container.pws_theme_dark_red ul.pws_tabs_controll li a{background-color:#e41937}.pws_tabs_container.pws_theme_dark_red ul.pws_tabs_controll li a:hover{background-color:#d70726}.pws_tabs_container.pws_theme_dark_red ul.pws_tabs_controll li a.pws_tab_active{background-color:#fafafa}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_purple .pws_responsive_small_menu{background-color:#672e8d}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_purple .pws_responsive_small_menu a:hover{background-color:#470871}.pws_tabs_container.pws_theme_dark_purple .pws_tabs_list{background-color:#fafafa}.pws_tabs_container.pws_theme_dark_purple ul.pws_tabs_controll li a{background-color:#672e8d}.pws_tabs_container.pws_theme_dark_purple ul.pws_tabs_controll li a:hover{background-color:#470871}.pws_tabs_container.pws_theme_dark_purple ul.pws_tabs_controll li a.pws_tab_active{background-color:#fafafa}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_grey .pws_responsive_small_menu{background-color:#4d4d4f}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_grey .pws_responsive_small_menu a:hover{background-color:#000}.pws_tabs_container.pws_theme_dark_grey .pws_tabs_list{background-color:#fafafa}.pws_tabs_container.pws_theme_dark_grey ul.pws_tabs_controll li a{background-color:#4d4d4f}.pws_tabs_container.pws_theme_dark_grey ul.pws_tabs_controll li a:hover{background-color:#000}.pws_tabs_container.pws_theme_dark_grey ul.pws_tabs_controll li a.pws_tab_active{background-color:#fafafa}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_cyan .pws_responsive_small_menu{background-color:#9bd7d5}.pws_tabs_container.pws_tabs_responsive.pws_theme_dark_cyan .pws_responsive_small_menu a:hover{background-color:#70c5c2}.pws_tabs_container.pws_theme_dark_cyan .pws_tabs_list{background-color:#fafafa}.pws_tabs_container.pws_theme_dark_cyan ul.pws_tabs_controll li a{background-color:#9bd7d5}.pws_tabs_container.pws_theme_dark_cyan ul.pws_tabs_controll li a:hover{background-color:#70c5c2}.pws_tabs_container.pws_theme_dark_cyan ul.pws_tabs_controll li a.pws_tab_active{background-color:#fafafa}.pws_tabs_noeffect .pws_tabs_list{-webkit-transition:all .1s ease-in-out 0;-moz-transition:all .1s ease-in-out 0;-o-transition:all .1s ease-in-out 0;transition:all .1s ease-in-out 0}.pws_tabs_noeffect .pws_tab_single{-webkit-transition:none;-moz-transition:none;-o-transition:none;transition:none}.pws_tabs_container.pws_none .pws_hide{display:none}.pws_tabs_container.pws_none .pws_show{display:block}.pws_tabs_container.pws_scale .pws_hide{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);opacity:0;-webkit-transform:scale(.9);-moz-transform:scale(.9);-o-transform:scale(.9);-ms-transform:scale(.9);transform:scale(.9);-webkit-transition:all .3s ease-in-out .3s;transition:all .3s ease-in-out .3s}.pws_tabs_container.pws_scale .pws_show,.pws_tabs_container.pws_slideleft .pws_hide{-webkit-transition:all .3s ease-in-out .3s;-moz-transition:all .3s ease-in-out .3s;-o-transition:all .3s ease-in-out .3s}.pws_tabs_container.pws_scale .pws_show{z-index:1;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);opacity:1;-webkit-transform:scale(1);-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);transform:scale(1);transition:all .3s ease-in-out .3s}.pws_tabs_container.pws_slideleft .pws_hide{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);-o-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);opacity:0;transition:all .3s ease-in-out .3s}.pws_tabs_container.pws_slideleft .pws_show,.pws_tabs_container.pws_slideright .pws_hide{-webkit-transition:all .3s ease-in-out .3s;-moz-transition:all .3s ease-in-out .3s;-o-transition:all .3s ease-in-out .3s}.pws_tabs_container.pws_slideleft .pws_show{-webkit-transform:translateX(0);-moz-transform:translateX(0);-o-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);opacity:1;transition:all .3s ease-in-out .3s}.pws_tabs_container.pws_slideright .pws_hide{-webkit-transform:translateX(200%);-moz-transform:translateX(200%);-o-transform:translateX(200%);-ms-transform:translateX(200%);transform:translateX(200%);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);opacity:0;transition:all .3s ease-in-out .3s}.pws_tabs_container.pws_slideright .pws_show,.pws_tabs_container.pws_slidetop .pws_hide{-webkit-transition:all .3s ease-in-out .3s;-moz-transition:all .3s ease-in-out .3s;-o-transition:all .3s ease-in-out .3s}.pws_tabs_container.pws_slideright .pws_show{-webkit-transform:translateX(0);-moz-transform:translateX(0);-o-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);opacity:1;transition:all .3s ease-in-out .3s}.pws_tabs_container.pws_slidetop .pws_hide{-webkit-transform:translateY(-100%);-moz-transform:translateY(-100%);-o-transform:translateY(-100%);-ms-transform:translateY(-100%);transform:translateY(-100%);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);opacity:0;transition:all .3s ease-in-out .3s}.pws_tabs_container.pws_slidedown .pws_hide,.pws_tabs_container.pws_slidetop .pws_show{-webkit-transition:all .3s ease-in-out .3s;-moz-transition:all .3s ease-in-out .3s;-o-transition:all .3s ease-in-out .3s}.pws_tabs_container.pws_slidetop .pws_show{-webkit-transform:translateY(0);-moz-transform:translateY(0);-o-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);opacity:1;transition:all .3s ease-in-out .3s}.pws_tabs_container.pws_slidedown .pws_hide{-webkit-transform:translateY(200%);-moz-transform:translateY(200%);-o-transform:translateY(200%);-ms-transform:translateY(200%);transform:translateY(200%);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);opacity:0;transition:all .3s ease-in-out .3s}.pws_tabs_container.pws_slidedown .pws_show{-webkit-transform:translateY(0);-moz-transform:translateY(0);-o-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);opacity:1;-webkit-transition:all .3s ease-in-out .3s;-moz-transition:all .3s ease-in-out .3s;-o-transition:all .3s ease-in-out .3s;transition:all .3s ease-in-out .3s}
\ No newline at end of file
<?php
/**
* Common Plugin Functions
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/core
* @since 3.0
*/
if ( ! defined( 'WPINC' ) ) {
die;
}
global $wc_rbp_db_settins_values, $wc_rbp_db_array;
$wc_rbp_db_settins_values = array();
$wc_rbp_db_array = array();
add_action( 'wc_rbp_loaded', 'wc_rbp_get_settings_from_db' );
if ( ! function_exists( 'wc_rbp_option' ) ) {
function wc_rbp_option( $key = '', $return_failure = '' ) {
global $wc_rbp_db_settins_values;
if ( $key == '' ) {
return $wc_rbp_db_settins_values;
}
if ( isset( $wc_rbp_db_settins_values[ WC_RBP_DB . $key ] ) ) {
return $wc_rbp_db_settins_values[ WC_RBP_DB . $key ];
}
return $return_failure;
}
}
if ( ! function_exists( 'wc_rbp_get_settings_from_db' ) ) {
/**
* Retrives All Plugin Options From DB
*/
function wc_rbp_get_settings_from_db() {
global $wc_rbp_db_settins_values;
$section = array();
$section = apply_filters( 'wc_rbp_settings_section', $section );
$values = array();
foreach ( $section as $settings ) {
foreach ( $settings as $set ) {
$db_val = get_option( WC_RBP_DB . $set['id'] );
if ( is_array( $db_val ) ) {
unset( $db_val['section_id'] );
$values = array_merge( $db_val, $values );
}
}
}
$wc_rbp_db_settins_values = $values;
}
}
if ( ! function_exists( 'wc_rbp_is_request' ) ) {
/**
* What type of request is this?
* string $type ajax, frontend or admin
*
* @return bool
*/
function wc_rbp_is_request( $type ) {
switch ( $type ) {
case 'admin' :
return is_admin();
case 'ajax' :
return defined( 'DOING_AJAX' );
case 'cron' :
return defined( 'DOING_CRON' );
case 'frontend' :
return ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' );
}
}
}
if ( ! function_exists( 'wc_rbp_current_screen' ) ) {
/**
* Gets Current Screen ID from wordpress
*
* @return string [Current Screen ID]
*/
function wc_rbp_current_screen() {
$screen = get_current_screen();
return $screen->id;
}
}
if ( ! function_exists( 'wc_rbp_get_screen_ids' ) ) {
/**
* Returns Predefined Screen IDS
*
* @return [Array]
*/
function wc_rbp_get_screen_ids() {
$screen_ids = array();
$screen_ids[] = 'woocommerce_page_woocommerce-role-based-price-settings';
return $screen_ids;
}
}
if ( ! function_exists( 'wc_rbp_dependency_message' ) ) {
/**
* Returns the plugin dependency message
*/
function wc_rbp_dependency_message() {
$text = __( WC_RBP_NAME . ' requires <b> WooCommerce </b> To Be Installed.. <br/> <i>Plugin Deactivated</i> ', WC_RBP_TXT );
return $text;
}
}
if ( ! function_exists( 'wc_rbp_custom_wp_user_roles' ) ) {
function wc_rbp_custom_wp_user_roles() {
$all_roles = array();
if ( function_exists( 'wp_roles' ) ) {
$all_roles = wp_roles()->roles;
}
return $all_roles;
}
}
if ( ! function_exists( 'wc_rbp_get_wp_roles' ) ) {
/**
* Returns Registered WP User Roles
*
* @return [[Type]] [[Description]]
*/
function wc_rbp_get_wp_roles() {
$user_roles = wc_rbp_custom_wp_user_roles();
$user_roles['logedout'] = array( 'name' => __( 'Visitor / LogedOut User', WC_RBP_TXT ) );
$user_roles = apply_filters( 'wc_rbp_wp_user_roles', $user_roles );
return $user_roles;
}
}
if ( ! function_exists( 'wc_rbp_get_template' ) ) {
function wc_rbp_get_template( $name, $args = array(), $main_path = '', $theme_path = 'woocommerce' ) {
if ( empty( $main_path ) ) {
$main_path = WC_RBP_PATH . '/templates/';
}
ob_start();
wc_get_template( $name, $args, $theme_path, $main_path );
$return_value = ob_get_clean();
ob_flush();
return $return_value;
}
}
if ( ! function_exists( 'wc_rbp_get_user_roles_selectbox' ) ) {
function wc_rbp_get_user_roles_selectbox() {
$user_roles = wc_rbp_get_wp_roles();
$list_roles = array();
$roles = array_keys( $user_roles );
foreach ( $roles as $role ) {
$list_roles[ $role ] = $user_roles[ $role ]['name'];
}
return $list_roles;
}
}
if ( ! function_exists( 'wc_rbp_get_current_user' ) ) {
/**
* Gets Current Logged in User Role / User Object.
* returns user role if $userroleonly set to true
* or returns the user object
*
* @param [boolean] [$userroleonly = true / false]
*
* @return [string / object]
*/
function wc_rbp_get_current_user( $userroleonly = true ) {
global $current_user;
$user_role = $current_user;
if ( $userroleonly ) {
$user_roles = $current_user->roles;
$user_role = array_shift( $user_roles );
if ( $user_role == null ) {
$user_role = 'logedout';
}
}
return apply_filters( 'wc_rbp_active_user', $user_role, $userroleonly );
}
}
if ( ! function_exists( 'wc_rbp_get_oppo_metakey' ) ) {
function wc_rbp_get_oppo_metakey( $key ) {
if ( $key == 'selling_price' ) {
return 'regular_price';
}
return 'selling_price';
}
}
if ( ! function_exists( 'wc_rbp_get_userrole_by_id' ) ) {
/**
* Get user roles by user ID.
*
* @param int $id
*
* @return array
*/
function wc_rbp_get_userrole_by_id( $id ) {
$user = new WP_User( $id );
if ( empty ( $user->roles ) or ! is_array( $user->roles ) ) {
return '';
}
foreach ( $user->roles as $role ) {
return $role;
}
return null;
}
}
if ( ! function_exists( 'wc_rbp_avaiable_price_type' ) ) {
/**
* Returns avaiable_price type with label
*
* @return [[Type]] [[Description]]
*/
function wc_rbp_avaiable_price_type( $key = '' ) {
$avaiable_price = array();
$avaiable_price['regular_price'] = __( 'Regular Price', WC_RBP_TXT );
$avaiable_price['selling_price'] = __( 'Selling Price', WC_RBP_TXT );
$avaiable_price = apply_filters( 'wc_rbp_avaiable_price', $avaiable_price );
if ( ! empty( $key ) ) {
if ( isset( $avaiable_price[ $key ] ) ) {
return $avaiable_price[ $key ];
}
}
return $avaiable_price;
}
}
if ( ! function_exists( 'wc_rbp_price_types' ) ) {
function wc_rbp_price_types( $key = '' ) {
$price = wc_rbp_avaiable_price_type();
foreach ( $price as $price_id => $priceVal ) {
$lable = wc_rbp_option( $price_id . '_label', $priceVal );
$price[ $price_id ] = $lable;
}
if ( ! empty( $key ) ) {
if ( isset( $price[ $key ] ) ) {
return $price[ $key ];
}
}
return $price;
}
}
if ( ! function_exists( 'wc_rbp_do_settings_sections' ) ) {
/**
* Prints out all settings sections added to a particular settings page
*
* Part of the Settings API. Use this in a settings page callback function
* to output all the sections and fields that were added to that $page with
* add_settings_section() and add_settings_field()
*
* @global $wp_settings_sections Storage array of all settings sections added to admin pages
* @global $wp_settings_fields Storage array of settings fields and info about their pages/sections
* @since 2.7.0
*
* @param string $page The slug name of the page whose settings sections you want to output
*/
function wc_rbp_do_settings_sections( $page ) {
global $wp_settings_sections, $wp_settings_fields;
if ( ! isset( $wp_settings_sections[ $page ] ) )
return;
$section_count = count( $wp_settings_sections[ $page ] );
if ( $section_count > 1 ) {
echo '<ul class="subsubsub wc_rbp_settings_submenu">';
foreach ( (array) $wp_settings_sections[ $page ] as $section ) {
echo '<li> <a href="#' . $section['id'] . '">' . $section['title'] . '</a> | </li>';
}
echo '</ul> <br/>';
}
foreach ( (array) $wp_settings_sections[ $page ] as $section ) {
if ( $section_count > 1 ) {
echo '<div id="settings_' . $section['id'] . '" class="hidden wc_rbp_settings_content">';
}
if ( $section['title'] )
echo "<h2>{$section['title']}</h2>\n";
if ( $section['callback'] )
call_user_func( $section['callback'], $section );
if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) )
continue;
echo '<table class="form-table">';
do_settings_fields( $page, $section['id'] );
echo '</table>';
if ( $section_count > 1 ) {
echo '</div>';
}
}
}
}
if ( ! function_exists( 'wc_rbp_get_form_hidden_fields' ) ) {
/**
* Returns Required WC RBP hidden Fields
*/
function wc_rbp_get_form_hidden_fields( $action, $wp_nounce_name, $referer = true ) {
$return = '<input type="hidden" name="wcrbp-action" value="' . $action . '" />';
$return .= wp_nonce_field( $action, $wp_nounce_name, $referer, false );
return $return;
}
}
if ( ! function_exists( 'wc_rbp_get_editor_fields' ) ) {
function wc_rbp_get_editor_fields( $type ) {
$fields = wc_rbp_get_form_hidden_fields( 'wc_rbp_save_product_prices', 'wc_rbp_nounce' );
$fields .= '<input type="hidden" name="type" value="' . $type . '" />';
return $fields;
}
}
if ( ! function_exists( 'wc_rbp_get_ajax_overlay' ) ) {
/**
* Prints WC RBP Ajax Loading Code
*/
function wc_rbp_get_ajax_overlay( $echo = true ) {
$return = '<div class="wc_rbp_ajax_overlay">
<div class="sk-folding-cube">
<div class="sk-cube1 sk-cube"></div>
<div class="sk-cube2 sk-cube"></div>
<div class="sk-cube4 sk-cube"></div>
<div class="sk-cube3 sk-cube"></div>
</div>
</div>';
if ( $echo ) {
echo $return;
} else {
return $return;
}
}
}
if ( ! function_exists( 'wc_rbp_check_active_addon' ) ) {
function wc_rbp_check_active_addon( $slug ) {
$addons = wc_rbp_get_active_addons();
if ( in_array( $slug, $addons ) ) {
return true;
}
return false;
}
}
if ( ! function_exists( 'wc_rbp_get_active_addons' ) ) {
/**
* Returns Active Addons List
*
* @return [[Type]] [[Description]]
*/
function wc_rbp_get_active_addons() {
$addons = get_option( WC_RBP_DB . 'active_addons', array() );
return $addons;
}
}
if ( ! function_exists( 'wc_rbp_update_active_addons' ) ) {
/**
* Returns Active Addons List
*
* @return [[Type]] [[Description]]
*/
function wc_rbp_update_active_addons( $addons ) {
update_option( WC_RBP_DB . 'active_addons', $addons );
return true;
}
}
if ( ! function_exists( 'wc_rbp_activate_addon' ) ) {
function wc_rbp_activate_addon( $slug ) {
$active_list = wc_rbp_get_active_addons();
if ( ! in_array( $slug, $active_list ) ) {
$active_list[] = $slug;
wc_rbp_update_active_addons( $active_list );
return true;
}
return false;
}
}
if ( ! function_exists( 'wc_rbp_deactivate_addon' ) ) {
function wc_rbp_deactivate_addon( $slug ) {
$active_list = wc_rbp_get_active_addons();
if ( in_array( $slug, $active_list ) ) {
$key = array_search( $slug, $active_list );
unset( $active_list[ $key ] );
wc_rbp_update_active_addons( $active_list );
return true;
}
return false;
}
}
if ( ! function_exists( 'wc_rbp_admin_notice' ) ) {
function wc_rbp_admin_notice( $msg, $type = 'updated' ) {
$notice = ' <div class="' . $type . ' settings-error notice is-dismissible" id="setting-error-settings_updated">
<p>' . $msg . '</p><button class="notice-dismiss" type="button"><span class="screen-reader-text">Dismiss this notice.</span></button></div>';
return $notice;
}
}
if ( ! function_exists( 'wc_rbp_generate_tabs' ) ) {
function wc_rbp_generate_tabs( $tabs, $content, $args = array() ) {
$default_args = array(
'show_image' => true,
'tab_style' => 'left', // 'default', 'box' or 'left'. Optional
'tab_wrapper' => true,
);
$args = wp_parse_args( $args, $default_args );
$wraper_start = '<div class="wcrbp-tabs wcrbp-tabs-' . $args['tab_style'] . '">';
$wraper_end = '</div>';
$tabs_code = '<ul class="wcrbp-tab-nav">';
$i = 0;
foreach ( $tabs as $key => $tab_data ) {
if ( is_string( $tab_data ) ) {
$tab_data = array( 'title' => $tab_data );
}
$tab_data = wp_parse_args( $tab_data, array( 'icon' => '', 'title' => '', 'show_status' => true ) );
if ( filter_var( $tab_data['icon'], FILTER_VALIDATE_URL ) ) {
$icon = '<img src="' . $tab_data['icon'] . '">';
} else {
if ( false !== strpos( $tab_data['icon'], 'dashicons' ) ) {
$tab_data['icon'] .= ' dashicons';
}
$tab_data['icon'] = array_filter( array_map( 'trim', explode( ' ', $tab_data['icon'] ) ) );
$tab_data['icon'] = implode( ' ', array_unique( $tab_data['icon'] ) );
$icon = $tab_data['icon'] ? '<i class="' . $tab_data['icon'] . '"></i>' : '';
}
$show_status = 'no';
$status_tag = '';
if ( $tab_data['show_status'] ) {
$show_status = 'yes';
$status_tag = '<i class="wc-rbp-tab-status"></i>';
}
$class = "wcrbp-tab-$key";
if ( ! $i ) {
$class .= ' wcrbp-tab-active';
}
$tabs_code .= sprintf( '<li data-status="%s" class="%s" data-panel="%s"><a href="#">%s%s%s</a></li>', $show_status, $class, $key, $icon, $tab_data['title'], $status_tag );
$i++;
}
$tabs_code .= '</ul>';
$content_data = '<div class="wcrbp-tab-panels">';
foreach ( $content as $id => $data ) {
$content_data .= '<div class="wcrbp-tab-panel wcrbp-tab-panel-' . $id . '">';
$content_data .= $data;
$content_data .= '</div>';
}
$content_data .= '</div>';
$final = $wraper_start . $tabs_code . $content_data . $wraper_end;
return $final;
}
}
if ( ! function_exists( 'wc_rbp_allowed_roles' ) ) {
function wc_rbp_allowed_roles() {
$roles = wc_rbp_option( 'allowed_roles' );
if ( empty( $roles ) ) {
$roles = array_keys( wc_rbp_get_user_roles_selectbox() );
}
return $roles;
}
}
if ( ! function_exists( 'wc_rbp_allowed_price' ) ) {
function wc_rbp_allowed_price() {
$roles = wc_rbp_option( 'allowed_price' );
if ( empty( $roles ) ) {
$roles = array_keys( wc_rbp_avaiable_price_type() );
}
return $roles;
}
}
/** @public Below Function Are Used By The Plugin users */
if ( ! function_exists( 'wc_rbp_update_role_based_price' ) ) {
/**
* Updates Products Role Based Price Array In DB
*
* @param int $post_id Post ID To Update
* @param array $price_array Price List
*
* @return boolean [[Description]]
*/
function wc_rbp_update_role_based_price( $post_id, $price_array, $force_update_parent = true ) {
update_post_meta( $post_id, '_role_based_price', $price_array );
if ( $force_update_parent ) {
$parent = wp_get_post_parent_id( $post_id );
if ( $parent !== false ) {
wc_rbp_update_variations_data( $parent );
}
}
return true;
}
}
if ( ! function_exists( 'wc_rbp_get_variation_cache_key' ) ) {
function wc_rbp_get_variation_cache_key( $product_id = '', $user_role = '' ) {
return '_wcrbp_p_' . $product_id . '_' . $user_role;
}
}
if ( ! function_exists( 'wc_rbp_delete_variation_data' ) ) {
function wc_rbp_delete_variation_data( $product_id = '', $user_role = '' ) {
$old_cache_array = array(
'_wcrbp_p_' . $product_id . '_' . $user_role,
'wcrbp_p_' . $product_id . '_' . $user_role,
wc_rbp_get_variation_cache_key( $product_id, $user_role ),
);
foreach ( $old_cache_array as $key ) {
delete_transient( $key );
}
}
}
if ( ! function_exists( 'wc_rbp_get_variation_data' ) ) {
function wc_rbp_get_variation_data( $product_id = '', $user_role = '' ) {
$key = wc_rbp_get_variation_cache_key( $product_id, $user_role );
$prices = get_transient( $key );
if ( is_array( $prices ) && isset( $prices['wc_rbp_version'] ) ) {
if ( WC_RBP_VARIABLE_VERSION == $prices['wc_rbp_version'] ) {
return $prices;
}
}
if ( ! is_array( $prices ) && ! isset( $prices['wc_rbp_version'] ) ) {
wc_rbp_delete_variation_data( $product_id, $user_role );
}
wc_rbp_update_variations_data( $product_id, array( $user_role ) );
$prices = get_transient( $key );
return ( empty( $prices ) ) ? array() : $prices;
}
}
if ( ! function_exists( "wc_rbp_update_variations_data" ) ) {
function wc_rbp_update_variations_data( $pid, $role = array(), $aprice = array() ) {
if ( empty( $role ) || ! is_array( $role ) ) {
$allowed_roles = array_keys( wc_rbp_get_user_roles_selectbox() );
} else {
$allowed_roles = $role;
}
$allowed_price = array_keys( wc_rbp_avaiable_price_type() );
$product = wc_get_product( $pid );
if ( ! $product ) {
return;
}
$pricing = new WooCommerce_Role_Based_Price_Product_Pricing( false );
foreach ( $allowed_roles as $_role ) {
$cache_key = wc_rbp_get_variation_cache_key( $pid, $_role );
$prices = array(
'base_selling_price' => array(),
'base_regular_price' => array(),
'last_updated' => time(),
'wc_rbp_version' => WC_RBP_VARIABLE_VERSION,
);
foreach ( $allowed_price as $A_price ) {
foreach ( $product->get_children() as $vid ) {
$price = get_post_meta( $vid, '_regular_price', true );
if ( $A_price == 'selling_price' ) {
$price = get_post_meta( $vid, '_sale_price', true );
}
$prices[ 'base_' . $A_price ][ $vid ] = $price;
$pprice = $pricing->get_product_price( $price, $vid, $A_price, $_role );
if ( $pprice === '' ) {
continue;
}
$prices[ $A_price ][ $vid ] = $pprice;
}
}
set_transient( $cache_key, $prices, 240 * HOUR_IN_SECONDS );
}
}
}
if ( ! function_exists( 'wc_rbp_get_product_price' ) ) {
/**
* Gets Product price from DB
* #TODO Integrate Wth product_rbp_price function to make it faster
*/
function wc_rbp_get_product_price( $post_id, $supress_filter = false ) {
$price = get_post_meta( $post_id, '_role_based_price' );
if ( ! empty( $price ) ) {
$price = $price[0];
} else {
$price = array();
}
if ( ! $supress_filter )
$price = apply_filters( 'wc_rbp_product_prices', $price );
return $price;
}
}
if ( ! function_exists( 'wc_rbp_product_get_db' ) ) {
function wc_rbp_product_get_db( $post_id, $type = 'price', $function = '' ) {
global $wc_rbp_db_array;
$return_val = $function( $post_id );
$wc_rbp_db_array[ $post_id ][ $type ] = $return_val;
$return_val = $wc_rbp_db_array[ $post_id ][ $type ];
return $return_val;
}
}
if ( ! function_exists( "wc_rbp_product_variable" ) ) {
function wc_rbp_product_variable( $post_id, $type = 'price', $function = '' ) {
if ( $type == 'price' ) {
$function = 'wc_rbp_get_product_price';
} elseif ( $type == 'status' ) {
$function = 'wc_rbp_product_status';
}
return wc_rbp_product_get_db( $post_id, $type, $function );
}
}
if ( ! function_exists( 'product_rbp_price' ) ) {
/**
* Gets product price from DB
*/
function product_rbp_price( $post_id ) {
$price = wc_rbp_product_variable( $post_id, 'price' );
$price = apply_filters( "product_rbp_price", $price, $post_id );
return $price;
}
}
if ( ! function_exists( 'product_rbp_status' ) ) {
/**
* Returns Products Role Based Price Array In DB
*
* @param int $post_id Post ID To Update
* @param array $price_array Price List
*
* @return boolean [[Description]]
* #TODO Integrate WC_RBP_PRODUCT_STATUS Function For Speed Outpu
*/
function product_rbp_status( $post_id ) {
global $product;
$price = wc_rbp_product_variable( $post_id, 'status' );
$price = apply_filters( "product_rbp_status", $price, $post_id );
return $price;
}
}
if ( ! function_exists( 'wc_rbp_settings_products_json' ) ) {
function wc_rbp_settings_products_json( $ids ) {
$json_ids = array();
if ( ! empty( $ids ) ) {
if ( is_string( $ids ) ) {
$ids = explode( ',', $ids );
}
foreach ( $ids as $product_id ) {
$product = wc_get_product( $product_id );
if ( $product ) {
$json_ids[ $product_id ] = wp_kses_post( $product->get_formatted_name() );
}
}
}
return $json_ids;
}
}
if ( ! function_exists( 'wc_rbp_update_role_based_price_status' ) ) {
/**
* Updates Products Role Based Price Array In DB
*
* @param int $post_id Post ID To Update
* @param array $price_array Price List
*
* @return boolean [[Description]]
*/
function wc_rbp_update_role_based_price_status( $post_id, $status = true ) {
update_post_meta( $post_id, '_enable_role_based_price', $status );
return true;
}
}
if ( ! function_exists( 'wc_rbp_product_status' ) ) {
/**
* Retrives Status value from Databse.
*
* @param [[Type]] $post_id [[Description]]
*
* @return [[Type]] [[Description]]
* #TODO Integrate With product_rbp_status
*/
function wc_rbp_product_status( $post_id, $supress_filter = false ) {
$cstatus = false;
$status = get_post_meta( $post_id, '_enable_role_based_price', true );
if ( $status == '1' || $status == 'true' ) {
$cstatus = true;
}
if ( ! $supress_filter )
$cstatus = apply_filters( 'wc_rbp_product_status', $cstatus, $post_id );
return $cstatus;
}
}
if ( ! function_exists( 'wc_rbp_price' ) ) {
/**
* Returns Price Based On Give Value
*
* @role : enter role slug / use all to get all roles values
* @price : use selling_price / regular_price or use all to get all values for the given role
*/
function wc_rbp_price( $post_id, $role, $price = 'regular_price', $args = array() ) {
$dbprice = product_rbp_price( $post_id );
$return = false;
if ( $price == 'all' && $role == 'all' ) {
$return = $dbprice;
} elseif ( $price == 'all' && $role !== 'all' ) {
if ( isset( $dbprice[ $role ] ) ) {
$return = $dbprice[ $role ];
}
} elseif ( isset( $dbprice[ $role ][ $price ] ) ) {
$return = $dbprice[ $role ][ $price ];
}
$return = apply_filters( 'wc_rbp_product_price', $return, $role, $price, $post_id, $args );
return $return;
}
}
if ( ! function_exists( 'wc_rbp_active_price' ) ) {
function wc_rbp_active_price( $post_id, $role, $args = array(), $product = null ) {
$price = wc_rbp_price( $post_id, $role, 'all', $args );
if ( isset( $price['selling_price'] ) ) {
if ( ! empty( $price['selling_price'] ) ) {
return $price['selling_price'];
}
}
return $price['regular_price'];
}
}
if ( ! function_exists( 'wc_rbp_sort_array_by_array' ) ) {
function wc_rbp_sort_array_by_array( array $array, array $orderArray ) {
$ordered = array();
foreach ( $orderArray as $key ) {
if ( array_key_exists( $key, $array ) ) {
$ordered[ $key ] = $array[ $key ];
unset( $array[ $key ] );
}
}
return $ordered + $array;
}
}
if ( ! function_exists( 'wc_rbp_remove_notice' ) ) {
function wc_rbp_remove_notice( $id ) {
WooCommerce_Plugin_Boiler_Plate_Admin_Notices::getInstance()
->deleteNotice( $id );
return true;
}
}
if ( ! function_exists( 'wc_rbp_notice' ) ) {
function wc_rbp_notice( $message, $type = 'update', $args = array() ) {
$notice = '';
$defaults = array( 'times' => 1, 'screen' => array(), 'users' => array(), 'wraper' => true, 'id' => '' );
$args = wp_parse_args( $args, $defaults );
extract( $args );
if ( $type == 'error' ) {
$notice = new WooCommerce_Role_Based_Price_Admin_Error_Notice( $message, $id, $times, $screen, $users );
}
if ( $type == 'update' ) {
$notice = new WooCommerce_Role_Based_Price_Admin_Updated_Notice( $message, $id, $times, $screen, $users );
}
if ( $type == 'upgrade' ) {
$notice = new WooCommerce_Role_Based_Price_Admin_UpdateNag_Notice( $message, $id, $times, $screen, $users );
}
$msgID = $notice->getId();
$message = str_replace( '$msgID$', $msgID, $message );
$notice->setContent( $message );
$notice->setWrapper( $wraper );
WooCommerce_Role_Based_Price_Admin_Notices::getInstance()
->addNotice( $notice );
}
}
if ( ! function_exists( 'wc_rbp_admin_error' ) ) {
function wc_rbp_admin_error( $message, $times = 1, $id, $screen = array(), $args = array() ) {
$args['id'] = $id;
$args['times'] = $times;
$args['screen'] = $screen;
wc_rbp_notice( $message, 'error', $args );
}
}
if ( ! function_exists( 'wc_rbp_admin_update' ) ) {
function wc_rbp_admin_update( $message, $times = 1, $id, $screen = array(), $args = array() ) {
$args['id'] = $id;
$args['times'] = $times;
$args['screen'] = $screen;
wc_rbp_notice( $message, 'update', $args );
}
}
if ( ! function_exists( 'wc_rbp_admin_upgrade' ) ) {
function wc_rbp_admin_upgrade( $message, $times = 1, $id, $screen = array(), $args = array() ) {
$args['id'] = $id;
$args['times'] = $times;
$args['screen'] = $screen;
wc_rbp_notice( $message, 'upgrade', $args );
}
}
if ( ! function_exists( 'wc_rbp_remove_link' ) ) {
function wc_rbp_remove_link( $attributes = '', $msgID = '$msgID$', $text = 'Remove Notice' ) {
if ( ! empty( $msgID ) ) {
$removeKey = PLUGIN_DB . 'MSG';
$url = admin_url() . '?' . $removeKey . '=' . $msgID;
//$url = wp_nonce_url($url, 'WCQDREMOVEMSG');
$url = urldecode( $url );
$tag = '<a ' . $attributes . ' href="' . $url . '">' . __( $text, WC_RBP_TXT ) . '</a>';
return $tag;
}
}
}
if ( ! function_exists( 'wc_rbp_is_wc_v' ) ) {
function wc_rbp_is_wc_v( $compare = '>=', $version = '3.0' ) {
$version = empty( $version ) ? WOOCOMMERCE_VERSION : $version;
if ( version_compare( WOOCOMMERCE_VERSION, $version, $compare ) ) {
return true;
} else {
return false;
}
}
}
\ No newline at end of file
<?php
/**
* Fired during plugin activation.
*
* This class defines all code necessary to run during the plugin's activation.
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/core
* @since 3.0
*/
class WooCommerce_Role_Based_Price_Activator {
public function __construct() {
}
/**
* Short Description. (use period)
*
* Long Description.
*
* @since 1.0.0
*/
public static function activate() {
require_once( WC_RBP_INC . 'helpers/class-version-check.php' );
require_once( WC_RBP_INC . 'helpers/class-dependencies.php' );
if( WooCommerce_Role_Based_Price_Dependencies(WC_RBP_DEPEN) ) {
WooCommerce_Role_Based_Price_Version_Check::activation_check('3.7');
$message = '<h3> <center> ' . __("Thank you for installing <strong>Role Based Price For WooCommerce</strong> : <strong>Version 3.0 </strong>", WC_RBP_TXT) . '</center> </h3>';
$message .= '<p>' . __("We have worked entire 1 year to improve our plugin to best of our ability and we hope you will enjoy working with it. We are always open for your sugestions and feature requests", WC_RBP_TXT) . '</p>';
$message .= '</hr>';
$message .= '<p>' . __("If you have installed <strong>WPRB</strong> for the 1st time or upgrading from <strong> Version 2.8.7</strong> then you will need to update its' settings once again or this plugin will not function properly. ", WC_RBP_TXT);
$url = admin_url('admin.php?page=woocommerce-role-based-price-settings');
$message .= '<a href="' . $url . '" class="button button-primary">' . __("Click Here to update the settings", WC_RBP_TXT) . '</a> </p>';
wc_rbp_admin_update($message, 1, 'activate_message', array(), array( 'wraper' => FALSE, 'times' => 1 ));
set_transient('_welcome_redirect_wcrbp', TRUE, 60);
} else {
if( is_plugin_active(WC_RBP_FILE) ) {
deactivate_plugins(WC_RBP_FILE);
}
wp_die(wc_rbp_dependency_message());
}
}
}
\ No newline at end of file
<?php
class WooCommerce_Role_Based_Price_Admin_Notices {
protected static $instance;
protected $noticesArrayName;
protected $REQUESTID;
protected $notices;
/**
* Costructor (private since this is a singleton)
*/
private function __construct() {
self::$instance = NULL;
$this->noticesArrayName = WC_RBP_DB . 'AdminNotices';
$this->REQUESTID = WC_RBP_DB . 'MSG';
$this->notices = array();
$this->loadNotices();
$this->auto_remove_Notice();
add_action('admin_notices', array( $this, 'displayNotices' ));
}
/**
* Loads notices from DB
*/
private function loadNotices() {
$notices = get_option($this->noticesArrayName);
if( is_array($notices) ) {
$this->notices = $notices;
}
}
/**
* Removes Notice By Getting ID From GET / POST METHOD
*/
public function auto_remove_Notice() {
if( isset($_REQUEST[$this->REQUESTID]) ) {
$nonce = sanitize_text_field($_REQUEST['_wpnonce']);
$this->deleteNotice(sanitize_text_field($_REQUEST[$this->REQUESTID]));
if( wp_get_referer() ) {
wp_safe_redirect(wp_get_referer());
}
}
}
/**
* Deletes a notice
*
* @param int $notId The notice unique id
*/
public function deleteNotice($notId) {
foreach( $this->notices as $key => $notice ) {
if( $notice->getId() === $notId ) {
unset($this->notices[$key]);
break;
}
}
$this->storeNotices();
}
/**
* Stores notices in DB
*/
private function storeNotices() {
update_option($this->noticesArrayName, $this->notices);
}
/**
* Returns an instance of this class.
*
* @since 1.0.0
* @return WP_Admin_Notices
*/
public static function getInstance() {
if( NULL == self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Action hook to display notices.
* Just echoes notices that should be displayed.
*/
public function displayNotices() {
foreach( $this->notices as $key => $notice ) {
if( $this->isTimeToDisplay($notice) ) {
echo $notice->getContentFormated($notice->getWrapper());
$notice->incrementDisplayedTimes();
}
if( $notice->getTimes() > 0 ) {
if( $notice->isTimeToDie() ) {
unset($this->notices[$key]);
}
}
}
$this->storeNotices();
}
/**
* Checks if is time to display a notice
*
* @param WooCommerce_Role_Based_Price_Admin_Notice $notice
*
* @return bool
*/
private function isTimeToDisplay(WooCommerce_Role_Based_Price_Admin_Notice $notice) {
$screens = $notice->getScreen();
if( ! empty($screens) ) {
$curScreen = get_current_screen();
if( ! is_array($screens) || ! in_array($curScreen->id, $screens) ) {
return FALSE;
}
}
$usersArray = $notice->getUsers();
if( ! empty($usersArray) ) {
$curUser = get_current_user_id();
if( ! is_array($usersArray) || ! in_array($curUser, $usersArray) || $usersArray[$curUser] >= $notice->getTimes() ) {
return FALSE;
}
} else if( $notice->getTimes() == 0 ) {
return TRUE;
} else if( $notice->getTimes() <= $notice->getDisplayedTimes() ) {
return FALSE;
}
return TRUE;
}
/**
* Adds a notice to be displayed
*
* @param erpAdminMessage $notice
*/
public function addNotice(WooCommerce_Role_Based_Price_Admin_Notice $notice) {
$this->notices[] = $notice;
$this->storeNotices();
}
}
/**
* Abstract class of a notice
*
* @author Panagiotis Vagenas <pan.vagenas@gmail.com>
*/
abstract class WooCommerce_Role_Based_Price_Admin_Notice {
protected $content;
protected $type;
protected $screen;
protected $id;
protected $times = 1;
protected $users = array();
protected $displayedTimes = 0;
protected $displayedToUsers = array();
protected $WithWraper = TRUE;
protected $is_dismissible = TRUE;
/**
*
* @param type $content Coantent to be displayed
* @param type $times How many times this notice will be displayed
* @param array $screen The admin screens this notice will be displayed into (empty for all screens)
* @param array $users Array of users this notice concernes (empty for all users)
*/
public function __construct($content, $id = '', $times = 1, $screen = array(), $users = array(), $WithWraper = TRUE) {
$this->content = $content;
$this->screen = $screen;
if( empty($id) ) {
$this->id = uniqid();
} else {
$this->id = $id;
}
$this->times = $times;
$this->users = $users;
$this->WithWraper = $WithWraper;
}
/**
* Get the content of the notice
*
* @param bool $wrapInParTag If the content should be wrapped in a paragraph tag
*
* @return string Formated content
*/
public function getContentFormated($wrapInParTag = TRUE) {
$class = $this->type;
$extrC = '';
if( $this->is_dismissible ) {
$class .= ' notice is-dismissible';
}
$before = '<div id="wc_pbp_notice_' . $this->id . '" class="' . $class . '">';
$before .= $wrapInParTag ? '<p>' : '';
$after = $wrapInParTag ? '</p>' : '';
$after .= '</div>';
return $before . $this->getContent() . $after . $extrC;
}
/**
* Get the notice string unformated
*
* @return string
*/
public function getContent() {
return $this->content;
}
/**
*
* @param string $content
*
* @return \WooCommerce_Role_Based_Price_Admin_Notice
*/
public function setContent($content) {
$this->content = $content;
return $this;
}
/**
* Increment displayed times of the notice
*
* @return \WooCommerce_Role_Based_Price_Admin_Notice
*/
public function incrementDisplayedTimes() {
$this->displayedTimes++;
if( array_key_exists(get_current_user_id(), $this->displayedToUsers) ) {
$this->displayedToUsers[get_current_user_id()]++;
} else {
$this->displayedToUsers[get_current_user_id()] = 1;
}
return $this;
}
/**
* Checks if the notice should me destroyed
*
* @return boolean True iff notice is deprecated
*/
public function isTimeToDie() {
if( empty($this->users) ) {
return $this->displayedTimes >= $this->times;
} else {
$i = 0;
foreach( $this->users as $key => $value ) {
if( isset($this->displayedToUsers[$value]) && $this->displayedToUsers[$value] >= $this->times ) {
$i++;
}
}
if( $i >= count($this->users) ) {
return TRUE;
}
}
return FALSE;
}
/**
* Get the $WithWraper Value
*/
public function getWrapper() {
return $this->WithWraper;
}
/**
* Set the $WithWraper Value
*
* @param boolean $screen
*/
public function setWrapper($wrapper = TRUE) {
$this->WithWraper = $wrapper;
return $this;
}
/**
* Get the current screen slug
*
* @return string Current screen slug
*/
public function getScreen() {
return $this->screen;
}
/**
* Set the screens the notice will be displayed
*
* @param array $screen
*
* @return \WooCommerce_Role_Based_Price_Admin_Notice
*/
public function setScreen($screen) {
$this->screen = $screen;
return $this;
}
/**
*
* @return string
*/
public function getId() {
return $this->id;
}
/**
*
* @return int
*/
public function getTimes() {
return $this->times;
}
/**
*
* @param int $times
*
* @return \WooCommerce_Role_Based_Price_Admin_Notice
*/
public function setTimes($times) {
$this->times = $times;
return $this;
}
/**
*
* @return array
*/
public function getUsers() {
return $this->users;
}
/**
*
* @param array $users
*
* @return \WooCommerce_Role_Based_Price_Admin_Notice
*/
public function setUsers(Array $users) {
$this->users = $users;
return $this;
}
/**
*
* @return int
*/
public function getDisplayedTimes() {
return $this->displayedTimes;
}
/**
*
* @param int $displayedTimes
*
* @return \WooCommerce_Role_Based_Price_Admin_Notice
*/
public function setDisplayedTimes($displayedTimes) {
$this->displayedTimes = $displayedTimes;
return $this;
}
/**
*
* @return array
*/
public function getDisplayedToUsers() {
return $this->displayedToUsers;
}
/**
*
* @param array $displayedToUsers
*
* @return \WooCommerce_Role_Based_Price_Admin_Notice
*/
public function setDisplayedToUsers(Array $displayedToUsers) {
$this->displayedToUsers = $displayedToUsers;
return $this;
}
}
/**
* Type of notices
*/
class WooCommerce_Role_Based_Price_Admin_Error_Notice extends WooCommerce_Role_Based_Price_Admin_Notice {
protected $type = 'error';
}
class WooCommerce_Role_Based_Price_Admin_Updated_Notice extends WooCommerce_Role_Based_Price_Admin_Notice {
protected $type = 'updated';
}
class WooCommerce_Role_Based_Price_Admin_UpdateNag_Notice extends WooCommerce_Role_Based_Price_Admin_Notice {
protected $type = 'update-nag';
}
/**
* Hook action to admin init
*/
if( ! has_action('init', array( 'WooCommerce_Role_Based_Price_Admin_Notices', 'getInstance' )) ) {
add_action('init', array( 'WooCommerce_Role_Based_Price_Admin_Notices', 'getInstance' ));
}
\ No newline at end of file
<?php
/**
* Fired during plugin deactivation.
*
* This class defines all code necessary to run during the plugin's deactivation.
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/core
* @since 3.0
*/
class WooCommerce_Role_Based_Price_Deactivator {
/**
* Short Description. (use period)
*
* Long Description.
*
* @since 1.0.0
*/
public static function deactivate() {
}
public static function dependency_deactivate() {
if( is_plugin_active(WC_RBP_FILE) ) {
add_action('update_option_active_plugins', array( __CLASS__, 'deactivate_dependent' ));
}
}
public static function deactivate_dependent() {
delete_transient('_welcome_redirect_wcrbp');
deactivate_plugins(WC_RBP_FILE);
}
}
\ No newline at end of file
<?php
/**
* Dependency Checker
*
* Checks if required Dependency plugin is enabled
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/core
* @since 3.0
*/
if( ! class_exists('WooCommerce_Role_Based_Price_Dependencies') ) {
class WooCommerce_Role_Based_Price_Dependencies {
private static $active_plugins;
public static function init() {
self::$active_plugins = (array) get_option('active_plugins', array());
if( is_multisite() )
self::$active_plugins = array_merge(self::$active_plugins, get_site_option('active_sitewide_plugins', array()));
}
public static function active_check($pluginToCheck = '') {
if( ! self::$active_plugins )
self::init();
return in_array($pluginToCheck, self::$active_plugins) || array_key_exists($pluginToCheck, self::$active_plugins);
}
}
}
/**
* WC Detection
*/
if( ! function_exists('WooCommerce_Role_Based_Price_Dependencies') ) {
function WooCommerce_Role_Based_Price_Dependencies($pluginToCheck = 'woocommerce/woocommerce.php') {
return WooCommerce_Role_Based_Price_Dependencies::active_check($pluginToCheck);
}
}
?>
\ No newline at end of file
<?php
/**
* Check the version of WordPress
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/core
* @since 3.0
*/
class WooCommerce_Role_Based_Price_Version_Check {
static $version;
/**
* The primary sanity check, automatically disable the plugin on activation if it doesn't meet minimum requirements
*
* @since 1.0.0
*/
public static function activation_check($version) {
self::$version = $version;
if( ! self::compatible_version() ) {
deactivate_plugins(WC_RBP_FILE);
wp_die(__(WC_RBP_NAME . ' requires WordPress ' . self::$version . ' or higher!', WC_RBP_TXT));
}
}
/**
* Check current version against $prefix_version_check
*
* @since 1.0.0
*/
public static function compatible_version() {
if( version_compare($GLOBALS['wp_version'], self::$version, '<') ) {
return FALSE;
}
return TRUE;
}
/**
* The backup sanity check, in case the plugin is activated in a weird way, or the versions change after activation
*
* @since 1.0.0
*/
public function check_version() {
if( ! self::compatible_version() ) {
if( is_plugin_active(WC_RBP_FILE) ) {
deactivate_plugins(WC_RBP_FILE);
add_action('admin_notices', array( $this, 'disabled_notice' ));
if( isset($_GET['activate']) ) {
unset($_GET['activate']);
}
}
}
}
/**
* Text to display in the notice
*
* @since 1.0.0
*/
public function disabled_notice() {
echo '<strong>' . esc_html__(WC_RBP_NAME . ' requires WordPress ' . self::$version . ' or higher!', WC_RBP_TXT) . '</strong>';
}
}
\ No newline at end of file
;
( function( $, window, document ) {
'use strict';
$.WCRBP = $.WCRBP || {};
/**
* Global Functions
*/
/* $.WCRBP.validate_selling_price = function (e) {
var sale_price_field = $(this),
regular_price_field;
regular_price_field = sale_price_field.parents('.wc_rbp_price_container').find('.wc_rbp_regular_price');
var sale_price = parseFloat(window.accounting.unformat(sale_price_field.val(), woocommerce_admin.mon_decimal_point));
var regular_price = parseFloat(window.accounting.unformat(regular_price_field.val(), woocommerce_admin.mon_decimal_point));
if ( sale_price >= regular_price ) {
$(document.body).triggerHandler('wc_add_error_tip', [$(this), 'i18_sale_less_than_regular_error']);
if ( 'change' === e.type ) {
if ( sale_price >= regular_price ) {
$(this).val('');
$('div#wc-rbp-product-editor #wc_rbp_update_price').removeAttr('disabled');
}
} else {
$('div#wc-rbp-product-editor #wc_rbp_update_price').attr('disabled', 'disabled');
}
} else {
$(document.body).triggerHandler('wc_remove_error_tip', [$(this), 'i18_sale_less_than_regular_error']);
$('div#wc-rbp-product-editor #wc_rbp_update_price').removeAttr('disabled');
}
};*/
$.WCRBP.tab_navigation = function( e ) {
e.preventDefault();
var $li = jQuery( this ).parent(),
panel = $li.data( 'panel' ),
$wrapper = $li.closest( '.wcrbp-tabs' ),
$panel = $wrapper.find( '.wcrbp-tab-panel-' + panel );
$li.addClass( 'wcrbp-tab-active' ).siblings().removeClass( 'wcrbp-tab-active' );
$panel.show().siblings().hide();
};
$.WCRBP.render_wootabs = function() {
$( ".wcrbp-tab-nav" ).on( "click", 'a', $.WCRBP.tab_navigation );
if( !$( '.wcrbp-tab-active' ).is( 'visible' ) ) {
var activePane = $( '.wcrbp-tab-panel[style*="block"]' ).index();
if( activePane >= 0 ) {
$( '.wcrbp-tab-nav li' ).removeClass( 'wcrbp-tab-active' );
$( '.wcrbp-tab-nav li' ).eq( activePane ).addClass( 'wcrbp-tab-active' );
}
}
$( '.wcrbp-tab-active a' ).trigger( 'click' );
$( '.wcrbp-tabs-no-wrapper' ).closest( '.postbox' ).addClass( 'wcrbp-tabs-no-controls' );
};
$.WCRBP.block = function( $elem ) {
$elem.block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
} );
};
$.WCRBP.unblock = function( $elem ) {
$elem.unblock();
};
$.WCRBP.render_price_status = function() {
$( '.wcrbp-tab-nav > li' ).each( function() {
if( $( this ).attr( 'data-status' ) == 'yes' ) {
var $this = $( this ),
divClass = 'div.wcrbp-tab-panel-' + $this.attr( 'data-panel' ),
filled = 0,
unfilled = 0,
totalf = 0;
$( divClass ).find( 'input[type=text]' ).each( function() {
if( $( this ).hasClass( "include_count" ) || !$( this ).hasClass( "exclude_count" ) ) {
if( $( this ).val() == '' ) {
unfilled = unfilled + 1;
} else {
filled = filled + 1;
}
}
} );
totalf = filled + unfilled;
$this.find( '.wc-rbp-tab-status' ).removeClass( 'bgred' );
$this.find( '.wc-rbp-tab-status' ).removeClass( 'bggreen' );
$this.find( '.wc-rbp-tab-status' ).removeClass( 'bgblue' );
if( filled == 0 && unfilled > 0 ) {
$this.find( '.wc-rbp-tab-status' ).addClass( 'bgred' );
} else if( filled > 0 && unfilled > 0 ) {
$this.find( '.wc-rbp-tab-status' ).addClass( 'bgblue' );
} else if( filled > 0 && unfilled == 0 ) {
$this.find( '.wc-rbp-tab-status' ).addClass( 'bggreen' );
}
}
} );
};
$.WCRBP.add_variation_selectbox = function() {
if( $( ".wcrbpvariationbx" ).size() > 0 ) {
$( ".wcrbpvariationbx" ).appendTo( "#wc-rbp-product-editor .hndle span" );
}
if( jQuery( '.wcrbpvariationbx' ).size() > 0 ) {
jQuery( '.wcrbpvariationbx' ).selectize( {
plugins: [ 'remove_button', 'restore_on_backspace' ],
persist: false,
create: false,
onChange: function( value ) {
$.WCRBP.block( $( 'div#wc-rbp-product-editor div.inside' ) );
var $select = this;
var $parentID = $( 'input#post_ID' ).val();
$.ajax( {
url: ajaxurl + '?action=wc_rbp_metabox_refersh&pid=' + value + '&parentID=' + $parentID,
method: "GET",
data: '',
} ).done( function( response ) {
if( response.success === true ) {
$select.destroy();
$( '.wcrbpvariationbx' ).remove();
$( '#wc-rbp-product-editor .inside' ).html( response.data );
$.WCRBP.render_wootabs();
$.WCRBP.add_variation_selectbox();
$( "#wc-rbp-product-editor .inside input.wc_rbp_checkbox" ).wcrbp_checkbox();
$.WCRBP.unblock( $( 'div#wc-rbp-product-editor div.inside' ) );
$.WCRBP.render_price_status();
}
} )
}
} );
}
};
$.WCRBP.move_selectbox_metabox = function() {
$( '#wc-rbp-product-editor' ).find( '.hndle' ).unbind( 'click' );
$( '#wc-rbp-product-editor' ).on( 'click', '.hndle', function( event ) {
event.preventDefault();
if( $( event.target ).filter( 'input, option, label, select, div, span' ).size() ) {
jQuery( '#wc-rbp-product-editor' ).toggleClass( 'closed' );
}
return;
} );
};
$.WCRBP.action_save_product_prices = function() {
var $clickedBtn = $( this ),
$data = $( 'div#wc-rbp-product-editor :input' ).serialize(),
$form = $( '.wc-rbp-metabox-container' ),
$action = $form.attr( 'action' ),
$method = $form.attr( 'method' );
$clickedBtn.attr( 'disabled', 'disable' );
$.WCRBP.block( $( 'div#wc-rbp-product-editor div.inside' ) );
$.ajax( {
url: $action,
method: $method,
data: $data,
} ).done( function( data ) {
$clickedBtn.removeAttr( 'disabled' );
$.WCRBP.unblock( $( 'div#wc-rbp-product-editor div.inside' ) );
$( 'div.wc_rbp_hidden_fields' ).html( data.data.hidden_fields );
$( 'div.wc_rbp_price_editor_ajax_response' ).html( data.data.html ).fadeIn( 'slow' );
setTimeout( 2000, function() {
jQuery( 'div.wc_rbp_price_editor_ajax_response' ).fadeOut( 'slow' );
} );
} )
};
$.WCRBP.action_clear_product_prices = function() {
var $clickedBtn = $( this );
$clickedBtn.attr( 'disabled', 'disable' );
$.WCRBP.block( $( 'div#wc-rbp-product-editor div.inside' ) );
$.ajax( {
url: ajaxurl,
method: 'post',
data: { post_id: $( "#post_ID" ).val(), action: "wc_rbp_clear_variation_cache" }
} ).done( function( data ) {
$clickedBtn.removeAttr( 'disabled' );
$.WCRBP.unblock( $( 'div#wc-rbp-product-editor div.inside' ) );
$( 'div.wc_rbp_price_editor_ajax_response' ).html( data.data.html ).fadeIn( 'slow' );
setTimeout( 2000, function() {
jQuery( 'div.wc_rbp_price_editor_ajax_response' ).fadeOut( 'slow' );
} );
} )
};
$.WCRBP.basic_init_metabox = function() {
//$(document.body).on('keyup change', '.wc_rbp_selling_price', $.WCRBP.validate_selling_price);
if( $( "input.wc_rbp_checkbox" ).size() > 0 ) {
$( "input.wc_rbp_checkbox" ).wcrbp_checkbox();
}
if( $( ".wcrbpvariationbx" ).size() > 0 ) {
$.WCRBP.add_variation_selectbox();
}
if( $( ".wcrbp-tabs" ).size() > 0 ) {
$.WCRBP.block( $( 'div#wc-rbp-product-editor div.inside' ) );
$.WCRBP.render_wootabs();
$.WCRBP.move_selectbox_metabox();
$.WCRBP.render_price_status();
}
$( 'body' ).on( 'blur', '#wc-rbp-product-editor :input', function() {
$.WCRBP.render_price_status();
} );
$( "body" ).on( "click", 'div#wc-rbp-product-editor #wc_rbp_update_price', $.WCRBP.action_save_product_prices );
$( "body" )
.on( "click", 'div#wc-rbp-product-editor #wc_rbp_clear_trasient', $.WCRBP.action_clear_product_prices );
};
/**
* Internal Functions
*/
$.fn.wcrbp_checkbox = function() {
return this.each( function() {
var $this = $( this ),
size = $this.attr( 'data-size' ),
color = $this.attr( 'data-color' ),
secondaryColor = $this.attr( 'data-secondaryColor' ),
jackColor = $this.attr( "data-jackColor" ),
jackSecondaryColor = $this.attr( "data-jackSecondaryColor" ),
className = $this.attr( "data-className" ),
disabled = $this.attr( 'data-disabled' ),
disabledOpacity = $this.attr( "data-disabledOpacity" ),
speed = $this.attr( "data-speed" );
new Switchery( this, {
size: size,
color: color,
secondaryColor: secondaryColor,
jackColor: jackColor,
jackSecondaryColor: jackSecondaryColor,
className: className,
disabled: disabled,
disabledOpacity: disabledOpacity,
speed: speed
} );
} );
};
$( document ).ready( function() {
$.WCRBP.basic_init_metabox();
} );
$( window ).load( function() {
if( $( '#wc-rbp-product-editor' ).size() > 0 ) {
$.WCRBP.move_selectbox_metabox();
$.WCRBP.unblock( $( 'div#wc-rbp-product-editor div.inside' ) );
}
} )
} )( jQuery, window, document );
(function(){function require(name){var module=require.modules[name];if(!module)throw new Error('failed to require "'+name+'"');if(!("exports"in module)&&typeof module.definition==="function"){module.client=module.component=true;module.definition.call(this,module.exports={},module);delete module.definition}return module.exports}require.loader="component";require.helper={};require.helper.semVerSort=function(a,b){var aArray=a.version.split(".");var bArray=b.version.split(".");for(var i=0;i<aArray.length;++i){var aInt=parseInt(aArray[i],10);var bInt=parseInt(bArray[i],10);if(aInt===bInt){var aLex=aArray[i].substr((""+aInt).length);var bLex=bArray[i].substr((""+bInt).length);if(aLex===""&&bLex!=="")return 1;if(aLex!==""&&bLex==="")return-1;if(aLex!==""&&bLex!=="")return aLex>bLex?1:-1;continue}else if(aInt>bInt){return 1}else{return-1}}return 0};require.latest=function(name,returnPath){function showError(name){throw new Error('failed to find latest module of "'+name+'"')}var versionRegexp=/(.*)~(.*)@v?(\d+\.\d+\.\d+[^\/]*)$/;var remoteRegexp=/(.*)~(.*)/;if(!remoteRegexp.test(name))showError(name);var moduleNames=Object.keys(require.modules);var semVerCandidates=[];var otherCandidates=[];for(var i=0;i<moduleNames.length;i++){var moduleName=moduleNames[i];if(new RegExp(name+"@").test(moduleName)){var version=moduleName.substr(name.length+1);var semVerMatch=versionRegexp.exec(moduleName);if(semVerMatch!=null){semVerCandidates.push({version:version,name:moduleName})}else{otherCandidates.push({version:version,name:moduleName})}}}if(semVerCandidates.concat(otherCandidates).length===0){showError(name)}if(semVerCandidates.length>0){var module=semVerCandidates.sort(require.helper.semVerSort).pop().name;if(returnPath===true){return module}return require(module)}var module=otherCandidates.sort(function(a,b){return a.name>b.name})[0].name;if(returnPath===true){return module}return require(module)};require.modules={};require.register=function(name,definition){require.modules[name]={definition:definition}};require.define=function(name,exports){require.modules[name]={exports:exports}};require.register("abpetkov~transitionize@0.0.3",function(exports,module){module.exports=Transitionize;function Transitionize(element,props){if(!(this instanceof Transitionize))return new Transitionize(element,props);this.element=element;this.props=props||{};this.init()}Transitionize.prototype.isSafari=function(){return/Safari/.test(navigator.userAgent)&&/Apple Computer/.test(navigator.vendor)};Transitionize.prototype.init=function(){var transitions=[];for(var key in this.props){transitions.push(key+" "+this.props[key])}this.element.style.transition=transitions.join(", ");if(this.isSafari())this.element.style.webkitTransition=transitions.join(", ")}});require.register("ftlabs~fastclick@v0.6.11",function(exports,module){function FastClick(layer){"use strict";var oldOnClick,self=this;this.trackingClick=false;this.trackingClickStart=0;this.targetElement=null;this.touchStartX=0;this.touchStartY=0;this.lastTouchIdentifier=0;this.touchBoundary=10;this.layer=layer;if(!layer||!layer.nodeType){throw new TypeError("Layer must be a document node")}this.onClick=function(){return FastClick.prototype.onClick.apply(self,arguments)};this.onMouse=function(){return FastClick.prototype.onMouse.apply(self,arguments)};this.onTouchStart=function(){return FastClick.prototype.onTouchStart.apply(self,arguments)};this.onTouchMove=function(){return FastClick.prototype.onTouchMove.apply(self,arguments)};this.onTouchEnd=function(){return FastClick.prototype.onTouchEnd.apply(self,arguments)};this.onTouchCancel=function(){return FastClick.prototype.onTouchCancel.apply(self,arguments)};if(FastClick.notNeeded(layer)){return}if(this.deviceIsAndroid){layer.addEventListener("mouseover",this.onMouse,true);layer.addEventListener("mousedown",this.onMouse,true);layer.addEventListener("mouseup",this.onMouse,true)}layer.addEventListener("click",this.onClick,true);layer.addEventListener("touchstart",this.onTouchStart,false);layer.addEventListener("touchmove",this.onTouchMove,false);layer.addEventListener("touchend",this.onTouchEnd,false);layer.addEventListener("touchcancel",this.onTouchCancel,false);if(!Event.prototype.stopImmediatePropagation){layer.removeEventListener=function(type,callback,capture){var rmv=Node.prototype.removeEventListener;if(type==="click"){rmv.call(layer,type,callback.hijacked||callback,capture)}else{rmv.call(layer,type,callback,capture)}};layer.addEventListener=function(type,callback,capture){var adv=Node.prototype.addEventListener;if(type==="click"){adv.call(layer,type,callback.hijacked||(callback.hijacked=function(event){if(!event.propagationStopped){callback(event)}}),capture)}else{adv.call(layer,type,callback,capture)}}}if(typeof layer.onclick==="function"){oldOnClick=layer.onclick;layer.addEventListener("click",function(event){oldOnClick(event)},false);layer.onclick=null}}FastClick.prototype.deviceIsAndroid=navigator.userAgent.indexOf("Android")>0;FastClick.prototype.deviceIsIOS=/iP(ad|hone|od)/.test(navigator.userAgent);FastClick.prototype.deviceIsIOS4=FastClick.prototype.deviceIsIOS&&/OS 4_\d(_\d)?/.test(navigator.userAgent);FastClick.prototype.deviceIsIOSWithBadTarget=FastClick.prototype.deviceIsIOS&&/OS ([6-9]|\d{2})_\d/.test(navigator.userAgent);FastClick.prototype.needsClick=function(target){"use strict";switch(target.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(target.disabled){return true}break;case"input":if(this.deviceIsIOS&&target.type==="file"||target.disabled){return true}break;case"label":case"video":return true}return/\bneedsclick\b/.test(target.className)};FastClick.prototype.needsFocus=function(target){"use strict";switch(target.nodeName.toLowerCase()){case"textarea":return true;case"select":return!this.deviceIsAndroid;case"input":switch(target.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return false}return!target.disabled&&!target.readOnly;default:return/\bneedsfocus\b/.test(target.className)}};FastClick.prototype.sendClick=function(targetElement,event){"use strict";var clickEvent,touch;if(document.activeElement&&document.activeElement!==targetElement){document.activeElement.blur()}touch=event.changedTouches[0];clickEvent=document.createEvent("MouseEvents");clickEvent.initMouseEvent(this.determineEventType(targetElement),true,true,window,1,touch.screenX,touch.screenY,touch.clientX,touch.clientY,false,false,false,false,0,null);clickEvent.forwardedTouchEvent=true;targetElement.dispatchEvent(clickEvent)};FastClick.prototype.determineEventType=function(targetElement){"use strict";if(this.deviceIsAndroid&&targetElement.tagName.toLowerCase()==="select"){return"mousedown"}return"click"};FastClick.prototype.focus=function(targetElement){"use strict";var length;if(this.deviceIsIOS&&targetElement.setSelectionRange&&targetElement.type.indexOf("date")!==0&&targetElement.type!=="time"){length=targetElement.value.length;targetElement.setSelectionRange(length,length)}else{targetElement.focus()}};FastClick.prototype.updateScrollParent=function(targetElement){"use strict";var scrollParent,parentElement;scrollParent=targetElement.fastClickScrollParent;if(!scrollParent||!scrollParent.contains(targetElement)){parentElement=targetElement;do{if(parentElement.scrollHeight>parentElement.offsetHeight){scrollParent=parentElement;targetElement.fastClickScrollParent=parentElement;break}parentElement=parentElement.parentElement}while(parentElement)}if(scrollParent){scrollParent.fastClickLastScrollTop=scrollParent.scrollTop}};FastClick.prototype.getTargetElementFromEventTarget=function(eventTarget){"use strict";if(eventTarget.nodeType===Node.TEXT_NODE){return eventTarget.parentNode}return eventTarget};FastClick.prototype.onTouchStart=function(event){"use strict";var targetElement,touch,selection;if(event.targetTouches.length>1){return true}targetElement=this.getTargetElementFromEventTarget(event.target);touch=event.targetTouches[0];if(this.deviceIsIOS){selection=window.getSelection();if(selection.rangeCount&&!selection.isCollapsed){return true}if(!this.deviceIsIOS4){if(touch.identifier===this.lastTouchIdentifier){event.preventDefault();return false}this.lastTouchIdentifier=touch.identifier;this.updateScrollParent(targetElement)}}this.trackingClick=true;this.trackingClickStart=event.timeStamp;this.targetElement=targetElement;this.touchStartX=touch.pageX;this.touchStartY=touch.pageY;if(event.timeStamp-this.lastClickTime<200){event.preventDefault()}return true};FastClick.prototype.touchHasMoved=function(event){"use strict";var touch=event.changedTouches[0],boundary=this.touchBoundary;if(Math.abs(touch.pageX-this.touchStartX)>boundary||Math.abs(touch.pageY-this.touchStartY)>boundary){return true}return false};FastClick.prototype.onTouchMove=function(event){"use strict";if(!this.trackingClick){return true}if(this.targetElement!==this.getTargetElementFromEventTarget(event.target)||this.touchHasMoved(event)){this.trackingClick=false;this.targetElement=null}return true};FastClick.prototype.findControl=function(labelElement){"use strict";if(labelElement.control!==undefined){return labelElement.control}if(labelElement.htmlFor){return document.getElementById(labelElement.htmlFor)}return labelElement.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")};FastClick.prototype.onTouchEnd=function(event){"use strict";var forElement,trackingClickStart,targetTagName,scrollParent,touch,targetElement=this.targetElement;if(!this.trackingClick){return true}if(event.timeStamp-this.lastClickTime<200){this.cancelNextClick=true;return true}this.cancelNextClick=false;this.lastClickTime=event.timeStamp;trackingClickStart=this.trackingClickStart;this.trackingClick=false;this.trackingClickStart=0;if(this.deviceIsIOSWithBadTarget){touch=event.changedTouches[0];targetElement=document.elementFromPoint(touch.pageX-window.pageXOffset,touch.pageY-window.pageYOffset)||targetElement;targetElement.fastClickScrollParent=this.targetElement.fastClickScrollParent}targetTagName=targetElement.tagName.toLowerCase();if(targetTagName==="label"){forElement=this.findControl(targetElement);if(forElement){this.focus(targetElement);if(this.deviceIsAndroid){return false}targetElement=forElement}}else if(this.needsFocus(targetElement)){if(event.timeStamp-trackingClickStart>100||this.deviceIsIOS&&window.top!==window&&targetTagName==="input"){this.targetElement=null;return false}this.focus(targetElement);if(!this.deviceIsIOS4||targetTagName!=="select"){this.targetElement=null;event.preventDefault()}return false}if(this.deviceIsIOS&&!this.deviceIsIOS4){scrollParent=targetElement.fastClickScrollParent;if(scrollParent&&scrollParent.fastClickLastScrollTop!==scrollParent.scrollTop){return true}}if(!this.needsClick(targetElement)){event.preventDefault();this.sendClick(targetElement,event)}return false};FastClick.prototype.onTouchCancel=function(){"use strict";this.trackingClick=false;this.targetElement=null};FastClick.prototype.onMouse=function(event){"use strict";if(!this.targetElement){return true}if(event.forwardedTouchEvent){return true}if(!event.cancelable){return true}if(!this.needsClick(this.targetElement)||this.cancelNextClick){if(event.stopImmediatePropagation){event.stopImmediatePropagation()}else{event.propagationStopped=true}event.stopPropagation();event.preventDefault();return false}return true};FastClick.prototype.onClick=function(event){"use strict";var permitted;if(this.trackingClick){this.targetElement=null;this.trackingClick=false;return true}if(event.target.type==="submit"&&event.detail===0){return true}permitted=this.onMouse(event);if(!permitted){this.targetElement=null}return permitted};FastClick.prototype.destroy=function(){"use strict";var layer=this.layer;if(this.deviceIsAndroid){layer.removeEventListener("mouseover",this.onMouse,true);layer.removeEventListener("mousedown",this.onMouse,true);layer.removeEventListener("mouseup",this.onMouse,true)}layer.removeEventListener("click",this.onClick,true);layer.removeEventListener("touchstart",this.onTouchStart,false);layer.removeEventListener("touchmove",this.onTouchMove,false);layer.removeEventListener("touchend",this.onTouchEnd,false);layer.removeEventListener("touchcancel",this.onTouchCancel,false)};FastClick.notNeeded=function(layer){"use strict";var metaViewport;var chromeVersion;if(typeof window.ontouchstart==="undefined"){return true}chromeVersion=+(/Chrome\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1];if(chromeVersion){if(FastClick.prototype.deviceIsAndroid){metaViewport=document.querySelector("meta[name=viewport]");if(metaViewport){if(metaViewport.content.indexOf("user-scalable=no")!==-1){return true}if(chromeVersion>31&&window.innerWidth<=window.screen.width){return true}}}else{return true}}if(layer.style.msTouchAction==="none"){return true}return false};FastClick.attach=function(layer){"use strict";return new FastClick(layer)};if(typeof define!=="undefined"&&define.amd){define(function(){"use strict";return FastClick})}else if(typeof module!=="undefined"&&module.exports){module.exports=FastClick.attach;module.exports.FastClick=FastClick}else{window.FastClick=FastClick}});require.register("component~indexof@0.0.3",function(exports,module){module.exports=function(arr,obj){if(arr.indexOf)return arr.indexOf(obj);for(var i=0;i<arr.length;++i){if(arr[i]===obj)return i}return-1}});require.register("component~classes@1.2.1",function(exports,module){var index=require("component~indexof@0.0.3");var re=/\s+/;var toString=Object.prototype.toString;module.exports=function(el){return new ClassList(el)};function ClassList(el){if(!el)throw new Error("A DOM element reference is required");this.el=el;this.list=el.classList}ClassList.prototype.add=function(name){if(this.list){this.list.add(name);return this}var arr=this.array();var i=index(arr,name);if(!~i)arr.push(name);this.el.className=arr.join(" ");return this};ClassList.prototype.remove=function(name){if("[object RegExp]"==toString.call(name)){return this.removeMatching(name)}if(this.list){this.list.remove(name);return this}var arr=this.array();var i=index(arr,name);if(~i)arr.splice(i,1);this.el.className=arr.join(" ");return this};ClassList.prototype.removeMatching=function(re){var arr=this.array();for(var i=0;i<arr.length;i++){if(re.test(arr[i])){this.remove(arr[i])}}return this};ClassList.prototype.toggle=function(name,force){if(this.list){if("undefined"!==typeof force){if(force!==this.list.toggle(name,force)){this.list.toggle(name)}}else{this.list.toggle(name)}return this}if("undefined"!==typeof force){if(!force){this.remove(name)}else{this.add(name)}}else{if(this.has(name)){this.remove(name)}else{this.add(name)}}return this};ClassList.prototype.array=function(){var str=this.el.className.replace(/^\s+|\s+$/g,"");var arr=str.split(re);if(""===arr[0])arr.shift();return arr};ClassList.prototype.has=ClassList.prototype.contains=function(name){return this.list?this.list.contains(name):!!~index(this.array(),name)}});require.register("component~event@0.1.4",function(exports,module){var bind=window.addEventListener?"addEventListener":"attachEvent",unbind=window.removeEventListener?"removeEventListener":"detachEvent",prefix=bind!=="addEventListener"?"on":"";exports.bind=function(el,type,fn,capture){el[bind](prefix+type,fn,capture||false);return fn};exports.unbind=function(el,type,fn,capture){el[unbind](prefix+type,fn,capture||false);return fn}});require.register("component~query@0.0.3",function(exports,module){function one(selector,el){return el.querySelector(selector)}exports=module.exports=function(selector,el){el=el||document;return one(selector,el)};exports.all=function(selector,el){el=el||document;return el.querySelectorAll(selector)};exports.engine=function(obj){if(!obj.one)throw new Error(".one callback required");if(!obj.all)throw new Error(".all callback required");one=obj.one;exports.all=obj.all;return exports}});require.register("component~matches-selector@0.1.5",function(exports,module){var query=require("component~query@0.0.3");var proto=Element.prototype;var vendor=proto.matches||proto.webkitMatchesSelector||proto.mozMatchesSelector||proto.msMatchesSelector||proto.oMatchesSelector;module.exports=match;function match(el,selector){if(!el||el.nodeType!==1)return false;if(vendor)return vendor.call(el,selector);var nodes=query.all(selector,el.parentNode);for(var i=0;i<nodes.length;++i){if(nodes[i]==el)return true}return false}});require.register("component~closest@0.1.4",function(exports,module){var matches=require("component~matches-selector@0.1.5");module.exports=function(element,selector,checkYoSelf,root){element=checkYoSelf?{parentNode:element}:element;root=root||document;while((element=element.parentNode)&&element!==document){if(matches(element,selector))return element;if(element===root)return}}});require.register("component~delegate@0.2.3",function(exports,module){var closest=require("component~closest@0.1.4"),event=require("component~event@0.1.4");exports.bind=function(el,selector,type,fn,capture){return event.bind(el,type,function(e){var target=e.target||e.srcElement;e.delegateTarget=closest(target,selector,true,el);if(e.delegateTarget)fn.call(el,e)},capture)};exports.unbind=function(el,type,fn,capture){event.unbind(el,type,fn,capture)}});require.register("component~events@1.0.9",function(exports,module){var events=require("component~event@0.1.4");var delegate=require("component~delegate@0.2.3");module.exports=Events;function Events(el,obj){if(!(this instanceof Events))return new Events(el,obj);if(!el)throw new Error("element required");if(!obj)throw new Error("object required");this.el=el;this.obj=obj;this._events={}}Events.prototype.sub=function(event,method,cb){this._events[event]=this._events[event]||{};this._events[event][method]=cb};Events.prototype.bind=function(event,method){var e=parse(event);var el=this.el;var obj=this.obj;var name=e.name;var method=method||"on"+name;var args=[].slice.call(arguments,2);function cb(){var a=[].slice.call(arguments).concat(args);obj[method].apply(obj,a)}if(e.selector){cb=delegate.bind(el,e.selector,name,cb)}else{events.bind(el,name,cb)}this.sub(name,method,cb);return cb};Events.prototype.unbind=function(event,method){if(0==arguments.length)return this.unbindAll();if(1==arguments.length)return this.unbindAllOf(event);var bindings=this._events[event];if(!bindings)return;var cb=bindings[method];if(!cb)return;events.unbind(this.el,event,cb)};Events.prototype.unbindAll=function(){for(var event in this._events){this.unbindAllOf(event)}};Events.prototype.unbindAllOf=function(event){var bindings=this._events[event];if(!bindings)return;for(var method in bindings){this.unbind(event,method)}};function parse(event){var parts=event.split(/ +/);return{name:parts.shift(),selector:parts.join(" ")}}});require.register("switchery",function(exports,module){var transitionize=require("abpetkov~transitionize@0.0.3"),fastclick=require("ftlabs~fastclick@v0.6.11"),classes=require("component~classes@1.2.1"),events=require("component~events@1.0.9");module.exports=Switchery;var defaults={color:"#64bd63",secondaryColor:"#dfdfdf",jackColor:"#fff",jackSecondaryColor:null,className:"switchery",disabled:false,disabledOpacity:.5,speed:"0.4s",size:"default"};function Switchery(element,options){if(!(this instanceof Switchery))return new Switchery(element,options);this.element=element;this.options=options||{};for(var i in defaults){if(this.options[i]==null){this.options[i]=defaults[i]}}if(this.element!=null&&this.element.type=="checkbox")this.init();if(this.isDisabled()===true)this.disable()}Switchery.prototype.hide=function(){this.element.style.display="none"};Switchery.prototype.show=function(){var switcher=this.create();this.insertAfter(this.element,switcher)};Switchery.prototype.create=function(){this.switcher=document.createElement("span");this.jack=document.createElement("small");this.switcher.appendChild(this.jack);this.switcher.className=this.options.className;this.events=events(this.switcher,this);return this.switcher};Switchery.prototype.insertAfter=function(reference,target){reference.parentNode.insertBefore(target,reference.nextSibling)};Switchery.prototype.setPosition=function(clicked){var checked=this.isChecked(),switcher=this.switcher,jack=this.jack;if(clicked&&checked)checked=false;else if(clicked&&!checked)checked=true;if(checked===true){this.element.checked=true;if(window.getComputedStyle)jack.style.left=parseInt(window.getComputedStyle(switcher).width)-parseInt(window.getComputedStyle(jack).width)+"px";else jack.style.left=parseInt(switcher.currentStyle["width"])-parseInt(jack.currentStyle["width"])+"px";if(this.options.color)this.colorize();this.setSpeed()}else{jack.style.left=0;this.element.checked=false;this.switcher.style.boxShadow="inset 0 0 0 0 "+this.options.secondaryColor;this.switcher.style.borderColor=this.options.secondaryColor;this.switcher.style.backgroundColor=this.options.secondaryColor!==defaults.secondaryColor?this.options.secondaryColor:"#fff";this.jack.style.backgroundColor=this.options.jackSecondaryColor!==this.options.jackColor?this.options.jackSecondaryColor:this.options.jackColor;this.setSpeed()}};Switchery.prototype.setSpeed=function(){var switcherProp={},jackProp={"background-color":this.options.speed,left:this.options.speed.replace(/[a-z]/,"")/2+"s"};if(this.isChecked()){switcherProp={border:this.options.speed,"box-shadow":this.options.speed,"background-color":this.options.speed.replace(/[a-z]/,"")*3+"s"}}else{switcherProp={border:this.options.speed,"box-shadow":this.options.speed}}transitionize(this.switcher,switcherProp);transitionize(this.jack,jackProp)};Switchery.prototype.setSize=function(){var small="switchery-small",normal="switchery-default",large="switchery-large";switch(this.options.size){case"small":classes(this.switcher).add(small);break;case"large":classes(this.switcher).add(large);break;default:classes(this.switcher).add(normal);break}};Switchery.prototype.colorize=function(){var switcherHeight=this.switcher.offsetHeight/2;this.switcher.style.backgroundColor=this.options.color;this.switcher.style.borderColor=this.options.color;this.switcher.style.boxShadow="inset 0 0 0 "+switcherHeight+"px "+this.options.color;this.jack.style.backgroundColor=this.options.jackColor};Switchery.prototype.handleOnchange=function(state){if(document.dispatchEvent){var event=document.createEvent("HTMLEvents");event.initEvent("change",true,true);this.element.dispatchEvent(event)}else{this.element.fireEvent("onchange")}};Switchery.prototype.handleChange=function(){var self=this,el=this.element;if(el.addEventListener){el.addEventListener("change",function(){self.setPosition()})}else{el.attachEvent("onchange",function(){self.setPosition()})}};Switchery.prototype.handleClick=function(){var switcher=this.switcher;fastclick(switcher);this.events.bind("click","bindClick")};Switchery.prototype.bindClick=function(){var parent=this.element.parentNode.tagName.toLowerCase(),labelParent=parent==="label"?false:true;this.setPosition(labelParent);this.handleOnchange(this.element.checked)};Switchery.prototype.markAsSwitched=function(){this.element.setAttribute("data-switchery",true)};Switchery.prototype.markedAsSwitched=function(){return this.element.getAttribute("data-switchery")};Switchery.prototype.init=function(){this.hide();this.show();this.setSize();this.setPosition();this.markAsSwitched();this.handleChange();this.handleClick()};Switchery.prototype.isChecked=function(){return this.element.checked};Switchery.prototype.isDisabled=function(){return this.options.disabled||this.element.disabled||this.element.readOnly};Switchery.prototype.destroy=function(){this.events.unbind()};Switchery.prototype.enable=function(){if(this.options.disabled)this.options.disabled=false;if(this.element.disabled)this.element.disabled=false;if(this.element.readOnly)this.element.readOnly=false;this.switcher.style.opacity=1;this.events.bind("click","bindClick")};Switchery.prototype.disable=function(){if(!this.options.disabled)this.options.disabled=true;if(!this.element.disabled)this.element.disabled=true;if(!this.element.readOnly)this.element.readOnly=true;this.switcher.style.opacity=this.options.disabledOpacity;this.destroy()}});if(typeof exports=="object"){module.exports=require("switchery")}else if(typeof define=="function"&&define.amd){define("Switchery",[],function(){return require("switchery")})}else{(this||window)["Switchery"]=require("switchery")}})();
\ No newline at end of file
/*! selectize.js - v0.12.4 | https://github.com/selectize/selectize.js | Apache License (v2) */
!function(a,b){"function"==typeof define&&define.amd?define("sifter",b):"object"==typeof exports?module.exports=b():a.Sifter=b()}(this,function(){var a=function(a,b){this.items=a,this.settings=b||{diacritics:!0}};a.prototype.tokenize=function(a){if(a=e(String(a||"").toLowerCase()),!a||!a.length)return[];var b,c,d,g,i=[],j=a.split(/ +/);for(b=0,c=j.length;b<c;b++){if(d=f(j[b]),this.settings.diacritics)for(g in h)h.hasOwnProperty(g)&&(d=d.replace(new RegExp(g,"g"),h[g]));i.push({string:j[b],regex:new RegExp(d,"i")})}return i},a.prototype.iterator=function(a,b){var c;c=g(a)?Array.prototype.forEach||function(a){for(var b=0,c=this.length;b<c;b++)a(this[b],b,this)}:function(a){for(var b in this)this.hasOwnProperty(b)&&a(this[b],b,this)},c.apply(a,[b])},a.prototype.getScoreFunction=function(a,b){var c,e,f,g,h;c=this,a=c.prepareSearch(a,b),f=a.tokens,e=a.options.fields,g=f.length,h=a.options.nesting;var i=function(a,b){var c,d;return a?(a=String(a||""),d=a.search(b.regex),d===-1?0:(c=b.string.length/a.length,0===d&&(c+=.5),c)):0},j=function(){var a=e.length;return a?1===a?function(a,b){return i(d(b,e[0],h),a)}:function(b,c){for(var f=0,g=0;f<a;f++)g+=i(d(c,e[f],h),b);return g/a}:function(){return 0}}();return g?1===g?function(a){return j(f[0],a)}:"and"===a.options.conjunction?function(a){for(var b,c=0,d=0;c<g;c++){if(b=j(f[c],a),b<=0)return 0;d+=b}return d/g}:function(a){for(var b=0,c=0;b<g;b++)c+=j(f[b],a);return c/g}:function(){return 0}},a.prototype.getSortFunction=function(a,c){var e,f,g,h,i,j,k,l,m,n,o;if(g=this,a=g.prepareSearch(a,c),o=!a.query&&c.sort_empty||c.sort,m=function(a,b){return"$score"===a?b.score:d(g.items[b.id],a,c.nesting)},i=[],o)for(e=0,f=o.length;e<f;e++)(a.query||"$score"!==o[e].field)&&i.push(o[e]);if(a.query){for(n=!0,e=0,f=i.length;e<f;e++)if("$score"===i[e].field){n=!1;break}n&&i.unshift({field:"$score",direction:"desc"})}else for(e=0,f=i.length;e<f;e++)if("$score"===i[e].field){i.splice(e,1);break}for(l=[],e=0,f=i.length;e<f;e++)l.push("desc"===i[e].direction?-1:1);return j=i.length,j?1===j?(h=i[0].field,k=l[0],function(a,c){return k*b(m(h,a),m(h,c))}):function(a,c){var d,e,f;for(d=0;d<j;d++)if(f=i[d].field,e=l[d]*b(m(f,a),m(f,c)))return e;return 0}:null},a.prototype.prepareSearch=function(a,b){if("object"==typeof a)return a;b=c({},b);var d=b.fields,e=b.sort,f=b.sort_empty;return d&&!g(d)&&(b.fields=[d]),e&&!g(e)&&(b.sort=[e]),f&&!g(f)&&(b.sort_empty=[f]),{options:b,query:String(a||"").toLowerCase(),tokens:this.tokenize(a),total:0,items:[]}},a.prototype.search=function(a,b){var c,d,e,f,g=this;return d=this.prepareSearch(a,b),b=d.options,a=d.query,f=b.score||g.getScoreFunction(d),a.length?g.iterator(g.items,function(a,e){c=f(a),(b.filter===!1||c>0)&&d.items.push({score:c,id:e})}):g.iterator(g.items,function(a,b){d.items.push({score:1,id:b})}),e=g.getSortFunction(d,b),e&&d.items.sort(e),d.total=d.items.length,"number"==typeof b.limit&&(d.items=d.items.slice(0,b.limit)),d};var b=function(a,b){return"number"==typeof a&&"number"==typeof b?a>b?1:a<b?-1:0:(a=i(String(a||"")),b=i(String(b||"")),a>b?1:b>a?-1:0)},c=function(a,b){var c,d,e,f;for(c=1,d=arguments.length;c<d;c++)if(f=arguments[c])for(e in f)f.hasOwnProperty(e)&&(a[e]=f[e]);return a},d=function(a,b,c){if(a&&b){if(!c)return a[b];for(var d=b.split(".");d.length&&(a=a[d.shift()]););return a}},e=function(a){return(a+"").replace(/^\s+|\s+$|/g,"")},f=function(a){return(a+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},g=Array.isArray||"undefined"!=typeof $&&$.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},h={a:"[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]",b:"[b␢βΒB฿𐌁ᛒ]",c:"[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]",d:"[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]",e:"[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]",f:"[fƑƒḞḟ]",g:"[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]",h:"[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]",i:"[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]",j:"[jȷĴĵɈɉʝɟʲ]",k:"[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]",l:"[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]",n:"[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]",o:"[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]",p:"[pṔṕṖṗⱣᵽƤƥᵱ]",q:"[qꝖꝗʠɊɋꝘꝙq̃]",r:"[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]",s:"[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]",t:"[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]",u:"[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]",v:"[vṼṽṾṿƲʋꝞꝟⱱʋ]",w:"[wẂẃẀẁŴŵẄẅẆẇẈẉ]",x:"[xẌẍẊẋχ]",y:"[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]",z:"[zŹźẐẑŽžŻżẒẓẔẕƵƶ]"},i=function(){var a,b,c,d,e="",f={};for(c in h)if(h.hasOwnProperty(c))for(d=h[c].substring(2,h[c].length-1),e+=d,a=0,b=d.length;a<b;a++)f[d.charAt(a)]=c;var g=new RegExp("["+e+"]","g");return function(a){return a.replace(g,function(a){return f[a]}).toLowerCase()}}();return a}),function(a,b){"function"==typeof define&&define.amd?define("microplugin",b):"object"==typeof exports?module.exports=b():a.MicroPlugin=b()}(this,function(){var a={};a.mixin=function(a){a.plugins={},a.prototype.initializePlugins=function(a){var c,d,e,f=this,g=[];if(f.plugins={names:[],settings:{},requested:{},loaded:{}},b.isArray(a))for(c=0,d=a.length;c<d;c++)"string"==typeof a[c]?g.push(a[c]):(f.plugins.settings[a[c].name]=a[c].options,g.push(a[c].name));else if(a)for(e in a)a.hasOwnProperty(e)&&(f.plugins.settings[e]=a[e],g.push(e));for(;g.length;)f.require(g.shift())},a.prototype.loadPlugin=function(b){var c=this,d=c.plugins,e=a.plugins[b];if(!a.plugins.hasOwnProperty(b))throw new Error('Unable to find "'+b+'" plugin');d.requested[b]=!0,d.loaded[b]=e.fn.apply(c,[c.plugins.settings[b]||{}]),d.names.push(b)},a.prototype.require=function(a){var b=this,c=b.plugins;if(!b.plugins.loaded.hasOwnProperty(a)){if(c.requested[a])throw new Error('Plugin has circular dependency ("'+a+'")');b.loadPlugin(a)}return c.loaded[a]},a.define=function(b,c){a.plugins[b]={name:b,fn:c}}};var b={isArray:Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}};return a}),function(a,b){"function"==typeof define&&define.amd?define("selectize",["jquery","sifter","microplugin"],b):"object"==typeof exports?module.exports=b(require("jquery"),require("sifter"),require("microplugin")):a.Selectize=b(a.jQuery,a.Sifter,a.MicroPlugin)}(this,function(a,b,c){"use strict";var d=function(a,b){if("string"!=typeof b||b.length){var c="string"==typeof b?new RegExp(b,"i"):b,d=function(a){var b=0;if(3===a.nodeType){var e=a.data.search(c);if(e>=0&&a.data.length>0){var f=a.data.match(c),g=document.createElement("span");g.className="highlight";var h=a.splitText(e),i=(h.splitText(f[0].length),h.cloneNode(!0));g.appendChild(i),h.parentNode.replaceChild(g,h),b=1}}else if(1===a.nodeType&&a.childNodes&&!/(script|style)/i.test(a.tagName))for(var j=0;j<a.childNodes.length;++j)j+=d(a.childNodes[j]);return b};return a.each(function(){d(this)})}};a.fn.removeHighlight=function(){return this.find("span.highlight").each(function(){this.parentNode.firstChild.nodeName;var a=this.parentNode;a.replaceChild(this.firstChild,this),a.normalize()}).end()};var e=function(){};e.prototype={on:function(a,b){this._events=this._events||{},this._events[a]=this._events[a]||[],this._events[a].push(b)},off:function(a,b){var c=arguments.length;return 0===c?delete this._events:1===c?delete this._events[a]:(this._events=this._events||{},void(a in this._events!=!1&&this._events[a].splice(this._events[a].indexOf(b),1)))},trigger:function(a){if(this._events=this._events||{},a in this._events!=!1)for(var b=0;b<this._events[a].length;b++)this._events[a][b].apply(this,Array.prototype.slice.call(arguments,1))}},e.mixin=function(a){for(var b=["on","off","trigger"],c=0;c<b.length;c++)a.prototype[b[c]]=e.prototype[b[c]]};var f=/Mac/.test(navigator.userAgent),g=65,h=13,i=27,j=37,k=38,l=80,m=39,n=40,o=78,p=8,q=46,r=16,s=f?91:17,t=f?18:17,u=9,v=1,w=2,x=!/android/i.test(window.navigator.userAgent)&&!!document.createElement("input").validity,y=function(a){return"undefined"!=typeof a},z=function(a){return"undefined"==typeof a||null===a?null:"boolean"==typeof a?a?"1":"0":a+""},A=function(a){return(a+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},B={};B.before=function(a,b,c){var d=a[b];a[b]=function(){return c.apply(a,arguments),d.apply(a,arguments)}},B.after=function(a,b,c){var d=a[b];a[b]=function(){var b=d.apply(a,arguments);return c.apply(a,arguments),b}};var C=function(a){var b=!1;return function(){b||(b=!0,a.apply(this,arguments))}},D=function(a,b){var c;return function(){var d=this,e=arguments;window.clearTimeout(c),c=window.setTimeout(function(){a.apply(d,e)},b)}},E=function(a,b,c){var d,e=a.trigger,f={};a.trigger=function(){var c=arguments[0];return b.indexOf(c)===-1?e.apply(a,arguments):void(f[c]=arguments)},c.apply(a,[]),a.trigger=e;for(d in f)f.hasOwnProperty(d)&&e.apply(a,f[d])},F=function(a,b,c,d){a.on(b,c,function(b){for(var c=b.target;c&&c.parentNode!==a[0];)c=c.parentNode;return b.currentTarget=c,d.apply(this,[b])})},G=function(a){var b={};if("selectionStart"in a)b.start=a.selectionStart,b.length=a.selectionEnd-b.start;else if(document.selection){a.focus();var c=document.selection.createRange(),d=document.selection.createRange().text.length;c.moveStart("character",-a.value.length),b.start=c.text.length-d,b.length=d}return b},H=function(a,b,c){var d,e,f={};if(c)for(d=0,e=c.length;d<e;d++)f[c[d]]=a.css(c[d]);else f=a.css();b.css(f)},I=function(b,c){if(!b)return 0;var d=a("<test>").css({position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}).text(b).appendTo("body");H(c,d,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]);var e=d.width();return d.remove(),e},J=function(a){var b=null,c=function(c,d){var e,f,g,h,i,j,k,l;c=c||window.event||{},d=d||{},c.metaKey||c.altKey||(d.force||a.data("grow")!==!1)&&(e=a.val(),c.type&&"keydown"===c.type.toLowerCase()&&(f=c.keyCode,g=f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||32===f,f===q||f===p?(l=G(a[0]),l.length?e=e.substring(0,l.start)+e.substring(l.start+l.length):f===p&&l.start?e=e.substring(0,l.start-1)+e.substring(l.start+1):f===q&&"undefined"!=typeof l.start&&(e=e.substring(0,l.start)+e.substring(l.start+1))):g&&(j=c.shiftKey,k=String.fromCharCode(c.keyCode),k=j?k.toUpperCase():k.toLowerCase(),e+=k)),h=a.attr("placeholder"),!e&&h&&(e=h),i=I(e,a)+4,i!==b&&(b=i,a.width(i),a.triggerHandler("resize")))};a.on("keydown keyup update blur",c),c()},K=function(a){var b=document.createElement("div");return b.appendChild(a.cloneNode(!0)),b.innerHTML},L=function(a,b){b||(b={});var c="Selectize";console.error(c+": "+a),b.explanation&&(console.group&&console.group(),console.error(b.explanation),console.group&&console.groupEnd())},M=function(c,d){var e,f,g,h,i=this;h=c[0],h.selectize=i;var j=window.getComputedStyle&&window.getComputedStyle(h,null);if(g=j?j.getPropertyValue("direction"):h.currentStyle&&h.currentStyle.direction,g=g||c.parents("[dir]:first").attr("dir")||"",a.extend(i,{order:0,settings:d,$input:c,tabIndex:c.attr("tabindex")||"",tagType:"select"===h.tagName.toLowerCase()?v:w,rtl:/rtl/i.test(g),eventNS:".selectize"+ ++M.count,highlightedValue:null,isOpen:!1,isDisabled:!1,isRequired:c.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",caretPos:0,loading:0,loadedSearches:{},$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===d.loadThrottle?i.onSearchChange:D(i.onSearchChange,d.loadThrottle)}),i.sifter=new b(this.options,{diacritics:d.diacritics}),i.settings.options){for(e=0,f=i.settings.options.length;e<f;e++)i.registerOption(i.settings.options[e]);delete i.settings.options}if(i.settings.optgroups){for(e=0,f=i.settings.optgroups.length;e<f;e++)i.registerOptionGroup(i.settings.optgroups[e]);delete i.settings.optgroups}i.settings.mode=i.settings.mode||(1===i.settings.maxItems?"single":"multi"),"boolean"!=typeof i.settings.hideSelected&&(i.settings.hideSelected="multi"===i.settings.mode),i.initializePlugins(i.settings.plugins),i.setupCallbacks(),i.setupTemplates(),i.setup()};return e.mixin(M),"undefined"!=typeof c?c.mixin(M):L("Dependency MicroPlugin is missing",{explanation:'Make sure you either: (1) are using the "standalone" version of Selectize, or (2) require MicroPlugin before you load Selectize.'}),a.extend(M.prototype,{setup:function(){var b,c,d,e,g,h,i,j,k,l,m=this,n=m.settings,o=m.eventNS,p=a(window),q=a(document),u=m.$input;if(i=m.settings.mode,j=u.attr("class")||"",b=a("<div>").addClass(n.wrapperClass).addClass(j).addClass(i),c=a("<div>").addClass(n.inputClass).addClass("items").appendTo(b),d=a('<input type="text" autocomplete="off" />').appendTo(c).attr("tabindex",u.is(":disabled")?"-1":m.tabIndex),h=a(n.dropdownParent||b),e=a("<div>").addClass(n.dropdownClass).addClass(i).hide().appendTo(h),g=a("<div>").addClass(n.dropdownContentClass).appendTo(e),(l=u.attr("id"))&&(d.attr("id",l+"-selectized"),a("label[for='"+l+"']").attr("for",l+"-selectized")),m.settings.copyClassesToDropdown&&e.addClass(j),b.css({width:u[0].style.width}),m.plugins.names.length&&(k="plugin-"+m.plugins.names.join(" plugin-"),b.addClass(k),e.addClass(k)),(null===n.maxItems||n.maxItems>1)&&m.tagType===v&&u.attr("multiple","multiple"),m.settings.placeholder&&d.attr("placeholder",n.placeholder),!m.settings.splitOn&&m.settings.delimiter){var w=m.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");m.settings.splitOn=new RegExp("\\s*"+w+"+\\s*")}u.attr("autocorrect")&&d.attr("autocorrect",u.attr("autocorrect")),u.attr("autocapitalize")&&d.attr("autocapitalize",u.attr("autocapitalize")),m.$wrapper=b,m.$control=c,m.$control_input=d,m.$dropdown=e,m.$dropdown_content=g,e.on("mouseenter","[data-selectable]",function(){return m.onOptionHover.apply(m,arguments)}),e.on("mousedown click","[data-selectable]",function(){return m.onOptionSelect.apply(m,arguments)}),F(c,"mousedown","*:not(input)",function(){return m.onItemSelect.apply(m,arguments)}),J(d),c.on({mousedown:function(){return m.onMouseDown.apply(m,arguments)},click:function(){return m.onClick.apply(m,arguments)}}),d.on({mousedown:function(a){a.stopPropagation()},keydown:function(){return m.onKeyDown.apply(m,arguments)},keyup:function(){return m.onKeyUp.apply(m,arguments)},keypress:function(){return m.onKeyPress.apply(m,arguments)},resize:function(){m.positionDropdown.apply(m,[])},blur:function(){return m.onBlur.apply(m,arguments)},focus:function(){return m.ignoreBlur=!1,m.onFocus.apply(m,arguments)},paste:function(){return m.onPaste.apply(m,arguments)}}),q.on("keydown"+o,function(a){m.isCmdDown=a[f?"metaKey":"ctrlKey"],m.isCtrlDown=a[f?"altKey":"ctrlKey"],m.isShiftDown=a.shiftKey}),q.on("keyup"+o,function(a){a.keyCode===t&&(m.isCtrlDown=!1),a.keyCode===r&&(m.isShiftDown=!1),a.keyCode===s&&(m.isCmdDown=!1)}),q.on("mousedown"+o,function(a){if(m.isFocused){if(a.target===m.$dropdown[0]||a.target.parentNode===m.$dropdown[0])return!1;m.$control.has(a.target).length||a.target===m.$control[0]||m.blur(a.target)}}),p.on(["scroll"+o,"resize"+o].join(" "),function(){m.isOpen&&m.positionDropdown.apply(m,arguments)}),p.on("mousemove"+o,function(){m.ignoreHover=!1}),this.revertSettings={$children:u.children().detach(),tabindex:u.attr("tabindex")},u.attr("tabindex",-1).hide().after(m.$wrapper),a.isArray(n.items)&&(m.setValue(n.items),delete n.items),x&&u.on("invalid"+o,function(a){a.preventDefault(),m.isInvalid=!0,m.refreshState()}),m.updateOriginalInput(),m.refreshItems(),m.refreshState(),m.updatePlaceholder(),m.isSetup=!0,u.is(":disabled")&&m.disable(),m.on("change",this.onChange),u.data("selectize",m),u.addClass("selectized"),m.trigger("initialize"),n.preload===!0&&m.onSearchChange("")},setupTemplates:function(){var b=this,c=b.settings.labelField,d=b.settings.optgroupLabelField,e={optgroup:function(a){return'<div class="optgroup">'+a.html+"</div>"},optgroup_header:function(a,b){return'<div class="optgroup-header">'+b(a[d])+"</div>"},option:function(a,b){return'<div class="option">'+b(a[c])+"</div>"},item:function(a,b){return'<div class="item">'+b(a[c])+"</div>"},option_create:function(a,b){return'<div class="create">Add <strong>'+b(a.input)+"</strong>&hellip;</div>"}};b.settings.render=a.extend({},e,b.settings.render)},setupCallbacks:function(){var a,b,c={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(a in c)c.hasOwnProperty(a)&&(b=this.settings[c[a]],b&&this.on(a,b))},onClick:function(a){var b=this;b.isFocused||(b.focus(),a.preventDefault())},onMouseDown:function(b){var c=this,d=b.isDefaultPrevented();a(b.target);if(c.isFocused){if(b.target!==c.$control_input[0])return"single"===c.settings.mode?c.isOpen?c.close():c.open():d||c.setActiveItem(null),!1}else d||window.setTimeout(function(){c.focus()},0)},onChange:function(){this.$input.trigger("change")},onPaste:function(b){var c=this;return c.isFull()||c.isInputHidden||c.isLocked?void b.preventDefault():void(c.settings.splitOn&&setTimeout(function(){var b=c.$control_input.val();if(b.match(c.settings.splitOn))for(var d=a.trim(b).split(c.settings.splitOn),e=0,f=d.length;e<f;e++)c.createItem(d[e])},0))},onKeyPress:function(a){if(this.isLocked)return a&&a.preventDefault();var b=String.fromCharCode(a.keyCode||a.which);return this.settings.create&&"multi"===this.settings.mode&&b===this.settings.delimiter?(this.createItem(),a.preventDefault(),!1):void 0},onKeyDown:function(a){var b=(a.target===this.$control_input[0],this);if(b.isLocked)return void(a.keyCode!==u&&a.preventDefault());switch(a.keyCode){case g:if(b.isCmdDown)return void b.selectAll();break;case i:return void(b.isOpen&&(a.preventDefault(),a.stopPropagation(),b.close()));case o:if(!a.ctrlKey||a.altKey)break;case n:if(!b.isOpen&&b.hasOptions)b.open();else if(b.$activeOption){b.ignoreHover=!0;var c=b.getAdjacentOption(b.$activeOption,1);c.length&&b.setActiveOption(c,!0,!0)}return void a.preventDefault();case l:if(!a.ctrlKey||a.altKey)break;case k:if(b.$activeOption){b.ignoreHover=!0;var d=b.getAdjacentOption(b.$activeOption,-1);d.length&&b.setActiveOption(d,!0,!0)}return void a.preventDefault();case h:return void(b.isOpen&&b.$activeOption&&(b.onOptionSelect({currentTarget:b.$activeOption}),a.preventDefault()));case j:return void b.advanceSelection(-1,a);case m:return void b.advanceSelection(1,a);case u:return b.settings.selectOnTab&&b.isOpen&&b.$activeOption&&(b.onOptionSelect({currentTarget:b.$activeOption}),b.isFull()||a.preventDefault()),void(b.settings.create&&b.createItem()&&a.preventDefault());case p:case q:return void b.deleteSelection(a)}return!b.isFull()&&!b.isInputHidden||(f?a.metaKey:a.ctrlKey)?void 0:void a.preventDefault()},onKeyUp:function(a){var b=this;if(b.isLocked)return a&&a.preventDefault();var c=b.$control_input.val()||"";b.lastValue!==c&&(b.lastValue=c,b.onSearchChange(c),b.refreshOptions(),b.trigger("type",c))},onSearchChange:function(a){var b=this,c=b.settings.load;c&&(b.loadedSearches.hasOwnProperty(a)||(b.loadedSearches[a]=!0,b.load(function(d){c.apply(b,[a,d])})))},onFocus:function(a){var b=this,c=b.isFocused;return b.isDisabled?(b.blur(),a&&a.preventDefault(),!1):void(b.ignoreFocus||(b.isFocused=!0,"focus"===b.settings.preload&&b.onSearchChange(""),c||b.trigger("focus"),b.$activeItems.length||(b.showInput(),b.setActiveItem(null),b.refreshOptions(!!b.settings.openOnFocus)),b.refreshState()))},onBlur:function(a,b){var c=this;if(c.isFocused&&(c.isFocused=!1,!c.ignoreFocus)){if(!c.ignoreBlur&&document.activeElement===c.$dropdown_content[0])return c.ignoreBlur=!0,void c.onFocus(a);var d=function(){c.close(),c.setTextboxValue(""),c.setActiveItem(null),c.setActiveOption(null),c.setCaret(c.items.length),c.refreshState(),b&&b.focus&&b.focus(),c.ignoreFocus=!1,c.trigger("blur")};c.ignoreFocus=!0,c.settings.create&&c.settings.createOnBlur?c.createItem(null,!1,d):d()}},onOptionHover:function(a){this.ignoreHover||this.setActiveOption(a.currentTarget,!1)},onOptionSelect:function(b){var c,d,e=this;b.preventDefault&&(b.preventDefault(),b.stopPropagation()),d=a(b.currentTarget),d.hasClass("create")?e.createItem(null,function(){e.settings.closeAfterSelect&&e.close()}):(c=d.attr("data-value"),"undefined"!=typeof c&&(e.lastQuery=null,e.setTextboxValue(""),e.addItem(c),e.settings.closeAfterSelect?e.close():!e.settings.hideSelected&&b.type&&/mouse/.test(b.type)&&e.setActiveOption(e.getOption(c))))},onItemSelect:function(a){var b=this;b.isLocked||"multi"===b.settings.mode&&(a.preventDefault(),b.setActiveItem(a.currentTarget,a))},load:function(a){var b=this,c=b.$wrapper.addClass(b.settings.loadingClass);b.loading++,a.apply(b,[function(a){b.loading=Math.max(b.loading-1,0),a&&a.length&&(b.addOption(a),b.refreshOptions(b.isFocused&&!b.isInputHidden)),b.loading||c.removeClass(b.settings.loadingClass),b.trigger("load",a)}])},setTextboxValue:function(a){var b=this.$control_input,c=b.val()!==a;c&&(b.val(a).triggerHandler("update"),this.lastValue=a)},getValue:function(){return this.tagType===v&&this.$input.attr("multiple")?this.items:this.items.join(this.settings.delimiter)},setValue:function(a,b){var c=b?[]:["change"];E(this,c,function(){this.clear(b),this.addItems(a,b)})},setActiveItem:function(b,c){var d,e,f,g,h,i,j,k,l=this;if("single"!==l.settings.mode){if(b=a(b),!b.length)return a(l.$activeItems).removeClass("active"),l.$activeItems=[],void(l.isFocused&&l.showInput());if(d=c&&c.type.toLowerCase(),"mousedown"===d&&l.isShiftDown&&l.$activeItems.length){for(k=l.$control.children(".active:last"),g=Array.prototype.indexOf.apply(l.$control[0].childNodes,[k[0]]),h=Array.prototype.indexOf.apply(l.$control[0].childNodes,[b[0]]),g>h&&(j=g,g=h,h=j),e=g;e<=h;e++)i=l.$control[0].childNodes[e],l.$activeItems.indexOf(i)===-1&&(a(i).addClass("active"),l.$activeItems.push(i));c.preventDefault()}else"mousedown"===d&&l.isCtrlDown||"keydown"===d&&this.isShiftDown?b.hasClass("active")?(f=l.$activeItems.indexOf(b[0]),l.$activeItems.splice(f,1),b.removeClass("active")):l.$activeItems.push(b.addClass("active")[0]):(a(l.$activeItems).removeClass("active"),l.$activeItems=[b.addClass("active")[0]]);l.hideInput(),this.isFocused||l.focus()}},setActiveOption:function(b,c,d){var e,f,g,h,i,j=this;j.$activeOption&&j.$activeOption.removeClass("active"),j.$activeOption=null,b=a(b),b.length&&(j.$activeOption=b.addClass("active"),!c&&y(c)||(e=j.$dropdown_content.height(),f=j.$activeOption.outerHeight(!0),c=j.$dropdown_content.scrollTop()||0,g=j.$activeOption.offset().top-j.$dropdown_content.offset().top+c,h=g,i=g-e+f,g+f>e+c?j.$dropdown_content.stop().animate({scrollTop:i},d?j.settings.scrollDuration:0):g<c&&j.$dropdown_content.stop().animate({scrollTop:h},d?j.settings.scrollDuration:0)))},selectAll:function(){var a=this;"single"!==a.settings.mode&&(a.$activeItems=Array.prototype.slice.apply(a.$control.children(":not(input)").addClass("active")),a.$activeItems.length&&(a.hideInput(),a.close()),a.focus())},hideInput:function(){var a=this;a.setTextboxValue(""),a.$control_input.css({opacity:0,position:"absolute",left:a.rtl?1e4:-1e4}),a.isInputHidden=!0},showInput:function(){this.$control_input.css({opacity:1,position:"relative",left:0}),this.isInputHidden=!1},focus:function(){var a=this;a.isDisabled||(a.ignoreFocus=!0,a.$control_input[0].focus(),window.setTimeout(function(){a.ignoreFocus=!1,a.onFocus()},0))},blur:function(a){this.$control_input[0].blur(),this.onBlur(null,a)},getScoreFunction:function(a){return this.sifter.getScoreFunction(a,this.getSearchOptions())},getSearchOptions:function(){var a=this.settings,b=a.sortField;return"string"==typeof b&&(b=[{field:b}]),{fields:a.searchField,conjunction:a.searchConjunction,sort:b}},search:function(b){var c,d,e,f=this,g=f.settings,h=this.getSearchOptions();if(g.score&&(e=f.settings.score.apply(this,[b]),"function"!=typeof e))throw new Error('Selectize "score" setting must be a function that returns a function');if(b!==f.lastQuery?(f.lastQuery=b,d=f.sifter.search(b,a.extend(h,{score:e})),f.currentResults=d):d=a.extend(!0,{},f.currentResults),g.hideSelected)for(c=d.items.length-1;c>=0;c--)f.items.indexOf(z(d.items[c].id))!==-1&&d.items.splice(c,1);return d},refreshOptions:function(b){var c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;"undefined"==typeof b&&(b=!0);var t=this,u=a.trim(t.$control_input.val()),v=t.search(u),w=t.$dropdown_content,x=t.$activeOption&&z(t.$activeOption.attr("data-value"));for(g=v.items.length,"number"==typeof t.settings.maxOptions&&(g=Math.min(g,t.settings.maxOptions)),h={},i=[],c=0;c<g;c++)for(j=t.options[v.items[c].id],k=t.render("option",j),l=j[t.settings.optgroupField]||"",m=a.isArray(l)?l:[l],e=0,f=m&&m.length;e<f;e++)l=m[e],t.optgroups.hasOwnProperty(l)||(l=""),h.hasOwnProperty(l)||(h[l]=document.createDocumentFragment(),i.push(l)),h[l].appendChild(k);for(this.settings.lockOptgroupOrder&&i.sort(function(a,b){var c=t.optgroups[a].$order||0,d=t.optgroups[b].$order||0;return c-d}),n=document.createDocumentFragment(),c=0,g=i.length;c<g;c++)l=i[c],t.optgroups.hasOwnProperty(l)&&h[l].childNodes.length?(o=document.createDocumentFragment(),o.appendChild(t.render("optgroup_header",t.optgroups[l])),o.appendChild(h[l]),n.appendChild(t.render("optgroup",a.extend({},t.optgroups[l],{html:K(o),dom:o})))):n.appendChild(h[l]);if(w.html(n),t.settings.highlight&&v.query.length&&v.tokens.length)for(w.removeHighlight(),c=0,g=v.tokens.length;c<g;c++)d(w,v.tokens[c].regex);if(!t.settings.hideSelected)for(c=0,g=t.items.length;c<g;c++)t.getOption(t.items[c]).addClass("selected");p=t.canCreate(u),p&&(w.prepend(t.render("option_create",{input:u})),s=a(w[0].childNodes[0])),t.hasOptions=v.items.length>0||p,t.hasOptions?(v.items.length>0?(r=x&&t.getOption(x),r&&r.length?q=r:"single"===t.settings.mode&&t.items.length&&(q=t.getOption(t.items[0])),q&&q.length||(q=s&&!t.settings.addPrecedence?t.getAdjacentOption(s,1):w.find("[data-selectable]:first"))):q=s,t.setActiveOption(q),b&&!t.isOpen&&t.open()):(t.setActiveOption(null),b&&t.isOpen&&t.close())},addOption:function(b){var c,d,e,f=this;if(a.isArray(b))for(c=0,d=b.length;c<d;c++)f.addOption(b[c]);else(e=f.registerOption(b))&&(f.userOptions[e]=!0,f.lastQuery=null,f.trigger("option_add",e,b))},registerOption:function(a){var b=z(a[this.settings.valueField]);return"undefined"!=typeof b&&null!==b&&!this.options.hasOwnProperty(b)&&(a.$order=a.$order||++this.order,this.options[b]=a,b)},registerOptionGroup:function(a){var b=z(a[this.settings.optgroupValueField]);return!!b&&(a.$order=a.$order||++this.order,this.optgroups[b]=a,b)},addOptionGroup:function(a,b){b[this.settings.optgroupValueField]=a,(a=this.registerOptionGroup(b))&&this.trigger("optgroup_add",a,b)},removeOptionGroup:function(a){this.optgroups.hasOwnProperty(a)&&(delete this.optgroups[a],this.renderCache={},this.trigger("optgroup_remove",a))},clearOptionGroups:function(){this.optgroups={},this.renderCache={},this.trigger("optgroup_clear")},updateOption:function(b,c){var d,e,f,g,h,i,j,k=this;if(b=z(b),f=z(c[k.settings.valueField]),null!==b&&k.options.hasOwnProperty(b)){if("string"!=typeof f)throw new Error("Value must be set in option data");j=k.options[b].$order,f!==b&&(delete k.options[b],g=k.items.indexOf(b),g!==-1&&k.items.splice(g,1,f)),c.$order=c.$order||j,k.options[f]=c,h=k.renderCache.item,i=k.renderCache.option,h&&(delete h[b],delete h[f]),i&&(delete i[b],delete i[f]),k.items.indexOf(f)!==-1&&(d=k.getItem(b),e=a(k.render("item",c)),d.hasClass("active")&&e.addClass("active"),d.replaceWith(e)),k.lastQuery=null,k.isOpen&&k.refreshOptions(!1)}},removeOption:function(a,b){var c=this;a=z(a);var d=c.renderCache.item,e=c.renderCache.option;d&&delete d[a],e&&delete e[a],delete c.userOptions[a],delete c.options[a],c.lastQuery=null,c.trigger("option_remove",a),c.removeItem(a,b)},clearOptions:function(){var a=this;a.loadedSearches={},a.userOptions={},a.renderCache={},a.options=a.sifter.items={},a.lastQuery=null,a.trigger("option_clear"),a.clear()},getOption:function(a){return this.getElementWithValue(a,this.$dropdown_content.find("[data-selectable]"))},getAdjacentOption:function(b,c){var d=this.$dropdown.find("[data-selectable]"),e=d.index(b)+c;return e>=0&&e<d.length?d.eq(e):a()},getElementWithValue:function(b,c){if(b=z(b),"undefined"!=typeof b&&null!==b)for(var d=0,e=c.length;d<e;d++)if(c[d].getAttribute("data-value")===b)return a(c[d]);return a()},getItem:function(a){return this.getElementWithValue(a,this.$control.children())},addItems:function(b,c){for(var d=a.isArray(b)?b:[b],e=0,f=d.length;e<f;e++)this.isPending=e<f-1,this.addItem(d[e],c)},addItem:function(b,c){var d=c?[]:["change"];E(this,d,function(){var d,e,f,g,h,i=this,j=i.settings.mode;return b=z(b),i.items.indexOf(b)!==-1?void("single"===j&&i.close()):void(i.options.hasOwnProperty(b)&&("single"===j&&i.clear(c),"multi"===j&&i.isFull()||(d=a(i.render("item",i.options[b])),h=i.isFull(),i.items.splice(i.caretPos,0,b),i.insertAtCaret(d),(!i.isPending||!h&&i.isFull())&&i.refreshState(),i.isSetup&&(f=i.$dropdown_content.find("[data-selectable]"),i.isPending||(e=i.getOption(b),g=i.getAdjacentOption(e,1).attr("data-value"),i.refreshOptions(i.isFocused&&"single"!==j),g&&i.setActiveOption(i.getOption(g))),!f.length||i.isFull()?i.close():i.positionDropdown(),i.updatePlaceholder(),i.trigger("item_add",b,d),i.updateOriginalInput({silent:c})))))})},removeItem:function(b,c){var d,e,f,g=this;d=b instanceof a?b:g.getItem(b),b=z(d.attr("data-value")),e=g.items.indexOf(b),e!==-1&&(d.remove(),d.hasClass("active")&&(f=g.$activeItems.indexOf(d[0]),g.$activeItems.splice(f,1)),g.items.splice(e,1),g.lastQuery=null,!g.settings.persist&&g.userOptions.hasOwnProperty(b)&&g.removeOption(b,c),e<g.caretPos&&g.setCaret(g.caretPos-1),g.refreshState(),g.updatePlaceholder(),g.updateOriginalInput({silent:c}),g.positionDropdown(),g.trigger("item_remove",b,d))},createItem:function(b,c){var d=this,e=d.caretPos;b=b||a.trim(d.$control_input.val()||"");var f=arguments[arguments.length-1];if("function"!=typeof f&&(f=function(){}),"boolean"!=typeof c&&(c=!0),!d.canCreate(b))return f(),!1;d.lock();var g="function"==typeof d.settings.create?this.settings.create:function(a){var b={};return b[d.settings.labelField]=a,b[d.settings.valueField]=a,b},h=C(function(a){if(d.unlock(),!a||"object"!=typeof a)return f();var b=z(a[d.settings.valueField]);return"string"!=typeof b?f():(d.setTextboxValue(""),d.addOption(a),d.setCaret(e),d.addItem(b),d.refreshOptions(c&&"single"!==d.settings.mode),void f(a))}),i=g.apply(this,[b,h]);return"undefined"!=typeof i&&h(i),!0},refreshItems:function(){this.lastQuery=null,this.isSetup&&this.addItem(this.items),this.refreshState(),this.updateOriginalInput()},refreshState:function(){this.refreshValidityState(),this.refreshClasses()},refreshValidityState:function(){if(!this.isRequired)return!1;var a=!this.items.length;this.isInvalid=a,this.$control_input.prop("required",a),this.$input.prop("required",!a)},refreshClasses:function(){var b=this,c=b.isFull(),d=b.isLocked;b.$wrapper.toggleClass("rtl",b.rtl),b.$control.toggleClass("focus",b.isFocused).toggleClass("disabled",b.isDisabled).toggleClass("required",b.isRequired).toggleClass("invalid",b.isInvalid).toggleClass("locked",d).toggleClass("full",c).toggleClass("not-full",!c).toggleClass("input-active",b.isFocused&&!b.isInputHidden).toggleClass("dropdown-active",b.isOpen).toggleClass("has-options",!a.isEmptyObject(b.options)).toggleClass("has-items",b.items.length>0),b.$control_input.data("grow",!c&&!d)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(a){var b,c,d,e,f=this;if(a=a||{},f.tagType===v){for(d=[],b=0,c=f.items.length;b<c;b++)e=f.options[f.items[b]][f.settings.labelField]||"",d.push('<option value="'+A(f.items[b])+'" selected="selected">'+A(e)+"</option>");d.length||this.$input.attr("multiple")||d.push('<option value="" selected="selected"></option>'),
f.$input.html(d.join(""))}else f.$input.val(f.getValue()),f.$input.attr("value",f.$input.val());f.isSetup&&(a.silent||f.trigger("change",f.$input.val()))},updatePlaceholder:function(){if(this.settings.placeholder){var a=this.$control_input;this.items.length?a.removeAttr("placeholder"):a.attr("placeholder",this.settings.placeholder),a.triggerHandler("update",{force:!0})}},open:function(){var a=this;a.isLocked||a.isOpen||"multi"===a.settings.mode&&a.isFull()||(a.focus(),a.isOpen=!0,a.refreshState(),a.$dropdown.css({visibility:"hidden",display:"block"}),a.positionDropdown(),a.$dropdown.css({visibility:"visible"}),a.trigger("dropdown_open",a.$dropdown))},close:function(){var a=this,b=a.isOpen;"single"===a.settings.mode&&a.items.length&&(a.hideInput(),a.$control_input.blur()),a.isOpen=!1,a.$dropdown.hide(),a.setActiveOption(null),a.refreshState(),b&&a.trigger("dropdown_close",a.$dropdown)},positionDropdown:function(){var a=this.$control,b="body"===this.settings.dropdownParent?a.offset():a.position();b.top+=a.outerHeight(!0),this.$dropdown.css({width:a.outerWidth(),top:b.top,left:b.left})},clear:function(a){var b=this;b.items.length&&(b.$control.children(":not(input)").remove(),b.items=[],b.lastQuery=null,b.setCaret(0),b.setActiveItem(null),b.updatePlaceholder(),b.updateOriginalInput({silent:a}),b.refreshState(),b.showInput(),b.trigger("clear"))},insertAtCaret:function(b){var c=Math.min(this.caretPos,this.items.length);0===c?this.$control.prepend(b):a(this.$control[0].childNodes[c]).before(b),this.setCaret(c+1)},deleteSelection:function(b){var c,d,e,f,g,h,i,j,k,l=this;if(e=b&&b.keyCode===p?-1:1,f=G(l.$control_input[0]),l.$activeOption&&!l.settings.hideSelected&&(i=l.getAdjacentOption(l.$activeOption,-1).attr("data-value")),g=[],l.$activeItems.length){for(k=l.$control.children(".active:"+(e>0?"last":"first")),h=l.$control.children(":not(input)").index(k),e>0&&h++,c=0,d=l.$activeItems.length;c<d;c++)g.push(a(l.$activeItems[c]).attr("data-value"));b&&(b.preventDefault(),b.stopPropagation())}else(l.isFocused||"single"===l.settings.mode)&&l.items.length&&(e<0&&0===f.start&&0===f.length?g.push(l.items[l.caretPos-1]):e>0&&f.start===l.$control_input.val().length&&g.push(l.items[l.caretPos]));if(!g.length||"function"==typeof l.settings.onDelete&&l.settings.onDelete.apply(l,[g])===!1)return!1;for("undefined"!=typeof h&&l.setCaret(h);g.length;)l.removeItem(g.pop());return l.showInput(),l.positionDropdown(),l.refreshOptions(!0),i&&(j=l.getOption(i),j.length&&l.setActiveOption(j)),!0},advanceSelection:function(a,b){var c,d,e,f,g,h,i=this;0!==a&&(i.rtl&&(a*=-1),c=a>0?"last":"first",d=G(i.$control_input[0]),i.isFocused&&!i.isInputHidden?(f=i.$control_input.val().length,g=a<0?0===d.start&&0===d.length:d.start===f,g&&!f&&i.advanceCaret(a,b)):(h=i.$control.children(".active:"+c),h.length&&(e=i.$control.children(":not(input)").index(h),i.setActiveItem(null),i.setCaret(a>0?e+1:e))))},advanceCaret:function(a,b){var c,d,e=this;0!==a&&(c=a>0?"next":"prev",e.isShiftDown?(d=e.$control_input[c](),d.length&&(e.hideInput(),e.setActiveItem(d),b&&b.preventDefault())):e.setCaret(e.caretPos+a))},setCaret:function(b){var c=this;if(b="single"===c.settings.mode?c.items.length:Math.max(0,Math.min(c.items.length,b)),!c.isPending){var d,e,f,g;for(f=c.$control.children(":not(input)"),d=0,e=f.length;d<e;d++)g=a(f[d]).detach(),d<b?c.$control_input.before(g):c.$control.append(g)}c.caretPos=b},lock:function(){this.close(),this.isLocked=!0,this.refreshState()},unlock:function(){this.isLocked=!1,this.refreshState()},disable:function(){var a=this;a.$input.prop("disabled",!0),a.$control_input.prop("disabled",!0).prop("tabindex",-1),a.isDisabled=!0,a.lock()},enable:function(){var a=this;a.$input.prop("disabled",!1),a.$control_input.prop("disabled",!1).prop("tabindex",a.tabIndex),a.isDisabled=!1,a.unlock()},destroy:function(){var b=this,c=b.eventNS,d=b.revertSettings;b.trigger("destroy"),b.off(),b.$wrapper.remove(),b.$dropdown.remove(),b.$input.html("").append(d.$children).removeAttr("tabindex").removeClass("selectized").attr({tabindex:d.tabindex}).show(),b.$control_input.removeData("grow"),b.$input.removeData("selectize"),a(window).off(c),a(document).off(c),a(document.body).off(c),delete b.$input[0].selectize},render:function(b,c){var d,e,f="",g=!1,h=this;return"option"!==b&&"item"!==b||(d=z(c[h.settings.valueField]),g=!!d),g&&(y(h.renderCache[b])||(h.renderCache[b]={}),h.renderCache[b].hasOwnProperty(d))?h.renderCache[b][d]:(f=a(h.settings.render[b].apply(this,[c,A])),"option"===b||"option_create"===b?f.attr("data-selectable",""):"optgroup"===b&&(e=c[h.settings.optgroupValueField]||"",f.attr("data-group",e)),"option"!==b&&"item"!==b||f.attr("data-value",d||""),g&&(h.renderCache[b][d]=f[0]),f[0])},clearCache:function(a){var b=this;"undefined"==typeof a?b.renderCache={}:delete b.renderCache[a]},canCreate:function(a){var b=this;if(!b.settings.create)return!1;var c=b.settings.createFilter;return a.length&&("function"!=typeof c||c.apply(b,[a]))&&("string"!=typeof c||new RegExp(c).test(a))&&(!(c instanceof RegExp)||c.test(a))}}),M.count=0,M.defaults={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:!1,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,maxOptions:1e3,maxItems:null,hideSelected:null,addPrecedence:!1,selectOnTab:!1,preload:!1,allowEmptyOption:!1,closeAfterSelect:!1,scrollDuration:60,loadThrottle:300,loadingClass:"loading",dataAttr:"data-data",optgroupField:"optgroup",valueField:"value",labelField:"text",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"selectize-control",inputClass:"selectize-input",dropdownClass:"selectize-dropdown",dropdownContentClass:"selectize-dropdown-content",dropdownParent:null,copyClassesToDropdown:!0,render:{}},a.fn.selectize=function(b){var c=a.fn.selectize.defaults,d=a.extend({},c,b),e=d.dataAttr,f=d.labelField,g=d.valueField,h=d.optgroupField,i=d.optgroupLabelField,j=d.optgroupValueField,k=function(b,c){var h,i,j,k,l=b.attr(e);if(l)for(c.options=JSON.parse(l),h=0,i=c.options.length;h<i;h++)c.items.push(c.options[h][g]);else{var m=a.trim(b.val()||"");if(!d.allowEmptyOption&&!m.length)return;for(j=m.split(d.delimiter),h=0,i=j.length;h<i;h++)k={},k[f]=j[h],k[g]=j[h],c.options.push(k);c.items=j}},l=function(b,c){var k,l,m,n,o=c.options,p={},q=function(a){var b=e&&a.attr(e);return"string"==typeof b&&b.length?JSON.parse(b):null},r=function(b,e){b=a(b);var i=z(b.val());if(i||d.allowEmptyOption)if(p.hasOwnProperty(i)){if(e){var j=p[i][h];j?a.isArray(j)?j.push(e):p[i][h]=[j,e]:p[i][h]=e}}else{var k=q(b)||{};k[f]=k[f]||b.text(),k[g]=k[g]||i,k[h]=k[h]||e,p[i]=k,o.push(k),b.is(":selected")&&c.items.push(i)}},s=function(b){var d,e,f,g,h;for(b=a(b),f=b.attr("label"),f&&(g=q(b)||{},g[i]=f,g[j]=f,c.optgroups.push(g)),h=a("option",b),d=0,e=h.length;d<e;d++)r(h[d],f)};for(c.maxItems=b.attr("multiple")?null:1,n=b.children(),k=0,l=n.length;k<l;k++)m=n[k].tagName.toLowerCase(),"optgroup"===m?s(n[k]):"option"===m&&r(n[k])};return this.each(function(){if(!this.selectize){var e,f=a(this),g=this.tagName.toLowerCase(),h=f.attr("placeholder")||f.attr("data-placeholder");h||d.allowEmptyOption||(h=f.children('option[value=""]').text());var i={placeholder:h,options:[],optgroups:[],items:[]};"select"===g?l(f,i):k(f,i),e=new M(f,a.extend(!0,{},c,i,b))}})},a.fn.selectize.defaults=M.defaults,a.fn.selectize.support={validity:x},M.define("drag_drop",function(b){if(!a.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');if("multi"===this.settings.mode){var c=this;c.lock=function(){var a=c.lock;return function(){var b=c.$control.data("sortable");return b&&b.disable(),a.apply(c,arguments)}}(),c.unlock=function(){var a=c.unlock;return function(){var b=c.$control.data("sortable");return b&&b.enable(),a.apply(c,arguments)}}(),c.setup=function(){var b=c.setup;return function(){b.apply(this,arguments);var d=c.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:c.isLocked,start:function(a,b){b.placeholder.css("width",b.helper.css("width")),d.css({overflow:"visible"})},stop:function(){d.css({overflow:"hidden"});var b=c.$activeItems?c.$activeItems.slice():null,e=[];d.children("[data-value]").each(function(){e.push(a(this).attr("data-value"))}),c.setValue(e),c.setActiveItem(b)}})}}()}}),M.define("dropdown_header",function(b){var c=this;b=a.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(a){return'<div class="'+a.headerClass+'"><div class="'+a.titleRowClass+'"><span class="'+a.labelClass+'">'+a.title+'</span><a href="javascript:void(0)" class="'+a.closeClass+'">&times;</a></div></div>'}},b),c.setup=function(){var d=c.setup;return function(){d.apply(c,arguments),c.$dropdown_header=a(b.html(b)),c.$dropdown.prepend(c.$dropdown_header)}}()}),M.define("optgroup_columns",function(b){var c=this;b=a.extend({equalizeWidth:!0,equalizeHeight:!0},b),this.getAdjacentOption=function(b,c){var d=b.closest("[data-group]").find("[data-selectable]"),e=d.index(b)+c;return e>=0&&e<d.length?d.eq(e):a()},this.onKeyDown=function(){var a=c.onKeyDown;return function(b){var d,e,f,g;return!this.isOpen||b.keyCode!==j&&b.keyCode!==m?a.apply(this,arguments):(c.ignoreHover=!0,g=this.$activeOption.closest("[data-group]"),d=g.find("[data-selectable]").index(this.$activeOption),g=b.keyCode===j?g.prev("[data-group]"):g.next("[data-group]"),f=g.find("[data-selectable]"),e=f.eq(Math.min(f.length-1,d)),void(e.length&&this.setActiveOption(e)))}}();var d=function(){var a,b=d.width,c=document;return"undefined"==typeof b&&(a=c.createElement("div"),a.innerHTML='<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>',a=a.firstChild,c.body.appendChild(a),b=d.width=a.offsetWidth-a.clientWidth,c.body.removeChild(a)),b},e=function(){var e,f,g,h,i,j,k;if(k=a("[data-group]",c.$dropdown_content),f=k.length,f&&c.$dropdown_content.width()){if(b.equalizeHeight){for(g=0,e=0;e<f;e++)g=Math.max(g,k.eq(e).height());k.css({height:g})}b.equalizeWidth&&(j=c.$dropdown_content.innerWidth()-d(),h=Math.round(j/f),k.css({width:h}),f>1&&(i=j-h*(f-1),k.eq(f-1).css({width:i})))}};(b.equalizeHeight||b.equalizeWidth)&&(B.after(this,"positionDropdown",e),B.after(this,"refreshOptions",e))}),M.define("remove_button",function(b){b=a.extend({label:"&times;",title:"Remove",className:"remove",append:!0},b);var c=function(b,c){c.className="remove-single";var d=b,e='<a href="javascript:void(0)" class="'+c.className+'" tabindex="-1" title="'+A(c.title)+'">'+c.label+"</a>",f=function(a,b){return a+b};b.setup=function(){var g=d.setup;return function(){if(c.append){var h=a(d.$input.context).attr("id"),i=(a("#"+h),d.settings.render.item);d.settings.render.item=function(a){return f(i.apply(b,arguments),e)}}g.apply(b,arguments),b.$control.on("click","."+c.className,function(a){a.preventDefault(),d.isLocked||d.clear()})}}()},d=function(b,c){var d=b,e='<a href="javascript:void(0)" class="'+c.className+'" tabindex="-1" title="'+A(c.title)+'">'+c.label+"</a>",f=function(a,b){var c=a.search(/(<\/[^>]+>\s*)$/);return a.substring(0,c)+b+a.substring(c)};b.setup=function(){var g=d.setup;return function(){if(c.append){var h=d.settings.render.item;d.settings.render.item=function(a){return f(h.apply(b,arguments),e)}}g.apply(b,arguments),b.$control.on("click","."+c.className,function(b){if(b.preventDefault(),!d.isLocked){var c=a(b.currentTarget).parent();d.setActiveItem(c),d.deleteSelection()&&d.setCaret(d.items.length)}})}}()};return"single"===this.settings.mode?void c(this,b):void d(this,b)}),M.define("restore_on_backspace",function(a){var b=this;a.text=a.text||function(a){return a[this.settings.labelField]},this.onKeyDown=function(){var c=b.onKeyDown;return function(b){var d,e;return b.keyCode===p&&""===this.$control_input.val()&&!this.$activeItems.length&&(d=this.caretPos-1,d>=0&&d<this.items.length)?(e=this.options[this.items[d]],this.deleteSelection(b)&&(this.setTextboxValue(a.text.apply(this,[e])),this.refreshOptions(!0)),void b.preventDefault()):c.apply(this,arguments)}}()}),M});
\ No newline at end of file
;
( function ($, window, document, undefined) {
'use strict';
$.WCRBP_SETTINGS = $.WCRBP_SETTINGS || {};
$.WCRBP_SETTINGS.addons_html = '';
$.WCRBP_SETTINGS.http_reffer = '';
$.WCRBP_SETTINGS.handle_settings_page_url = function () {
var id = window.location.hash;
jQuery('.wc_rbp_settings_submenu a').removeClass('current');
jQuery('.wc_rbp_settings_submenu a[href="' + id + '" ]').addClass('current');
if ( id == '' ) {
jQuery('.wc_rbp_settings_submenu a:first').addClass('current');
id = jQuery('.wc_rbp_settings_submenu a:first').attr('href');
}
$.WCRBP_SETTINGS.http_reffer = jQuery('input[name=_wp_http_referer').val();
$.WCRBP_SETTINGS.show_settings(id);
}
$.WCRBP_SETTINGS.show_settings = function (elem) {
jQuery('div.wc_rbp_settings_content').hide();
elem = elem.replace('#', '#settings_');
jQuery(elem).show();
}
$.WCRBP_SETTINGS.settings_click_handler = function () {
var id = jQuery(this).attr('href');
jQuery('.wc_rbp_settings_submenu a').removeClass('current');
jQuery(this).addClass('current');
$.WCRBP_SETTINGS.show_settings(id);
jQuery('input[name=_wp_http_referer').val($.WCRBP_SETTINGS.http_reffer + id);
}
$.WCRBP_SETTINGS.handle_activate_deactivate_addons = function (elem, $class) {
if ( typeof ( $class ) === 'undefined' ) $class = '.wc-rbp-deactivate-now';
var clicked = elem;
var slug = elem.parent().attr('data-pluginslug');
var parent_div = '.plugin-card-' + slug;
var height = jQuery(parent_div).innerHeight();
var width = jQuery(parent_div).innerWidth();
jQuery(parent_div + ' .wc_rbp_ajax_overlay').css('height', height + 'px').css('width', width + 'px').fadeIn();
clicked.attr('disabled', 'disable');
var link = clicked.attr('href');
jQuery.ajax({
method: 'GET',
url: link,
}).done(function (response) {
var status = response.success;
jQuery(parent_div + ' .wc_rbp_ajax_overlay').fadeOut();
clicked.removeAttr('disabled');
if ( status ) {
clicked.hide();
jQuery(parent_div).find($class).fadeIn();
}
jQuery(parent_div).find('.wc_rbp_ajax_response').hide().html(response.data.msg).fadeIn(function () {
setTimeout(function () {
jQuery(parent_div).find('.wc_rbp_ajax_response').fadeOut();
}, 5000);
});
jQuery.ajax({
method: 'GET',
url: ajaxurl + '?action=wc_rbp_get_addons_html',
}).done(function (response) {
addons_html = jQuery(response);
});
});
}
$(document).ready(function () {
if ( jQuery('div.wc_rbp_addon_listing').size() > 0 ) {
jQuery('p.submit').remove();
}
jQuery('select.wc-rbp-enhanced-select').selectize({
plugins: ['remove_button', 'restore_on_backspace', 'drag_drop'],
persist: false,
create: true,
});
jQuery('.wc_rbp_settings_submenu a').click($.WCRBP_SETTINGS.settings_click_handler);
if ( jQuery('.wc_rbp_settings_submenu').size() > 0 ) {
$.WCRBP_SETTINGS.handle_settings_page_url();
}
jQuery('.wc_rbp_addon_listing').on('click', '.wc-rbp-activate-now', function () {
$.WCRBP_SETTINGS.handle_activate_deactivate_addons(jQuery(this), '.wc-rbp-deactivate-now')
});
jQuery('.wc_rbp_addon_listing').on('click', '.wc-rbp-deactivate-now', function () {
$.WCRBP_SETTINGS.handle_activate_deactivate_addons(jQuery(this), '.wc-rbp-activate-now')
});
$.WCRBP_SETTINGS.addons_html = jQuery('.wc_rbp_addon_listing').clone();
jQuery('ul.wc_rbp_addons_category li a:first').addClass('current');
jQuery('ul.wc_rbp_addons_category li a').click(function () {
var cat = jQuery(this).attr('data-category');
var NewDis = 'div.wc-rbp-addon-' + cat;
jQuery('ul.wc_rbp_addons_category li a').removeClass('current');
jQuery(this).addClass('current');
jQuery('.wc_rbp_addon_listing').html($.WCRBP_SETTINGS.addons_html.find(NewDis).clone());
});
jQuery('ul.wc_rbp_addons_category li a').each(function () {
var category = jQuery(this).attr('data-category');
var catCount = jQuery('.wc-rbp-addon-' + category).size();
jQuery(this).append(' <span class="catCount"> (' + catCount + ') </span>');
});
jQuery('div.addons-search-form input.wp-filter-search').keyup(function () {
var val = jQuery(this).val();
var html_source = $.WCRBP_SETTINGS.addons_html.clone();
if ( val == '' ) {
jQuery('.wc_rbp_addon_listing').html(html_source);
jQuery('.wc-rbp-addon-all').show();
} else {
html_source = jQuery(html_source).find(".plugin-card:contains('" + val + "')").not().remove();
jQuery('.wc_rbp_addon_listing').html(html_source);
}
})
});
} )(jQuery, window, document);
!function(t,s,i,a){function e(s,i){this.element=t(s),this.$elem=t(this.element),this.settings=t.extend({},l,i),this._defaults=l,this._name=n,this.init()}var n="pwstabs",l={effect:"scale",defaultTab:1,containerWidth:"100%",tabsPosition:"horizontal",horizontalPosition:"top",verticalPosition:"left",responsive:!1,theme:"",rtl:!1};e.prototype={init:function(){var i=["scale","slideleft","slideright","slidetop","slidedown","none"],a=this.$elem,e=a.children("[data-pws-tab]");a.addClass("pws_tabs_list"),a.wrap('<div class="pws_tabs_container"></div>');var n=a.closest(".pws_tabs_container");if("100%"!==this.settings.containerWidth&&n.css("width",this.settings.containerWidth),"vertical"==this.settings.tabsPosition){if(n.closest(".pws_tab_single").length){var l=n.closest(".pws_tab_single").innerWidth();n.css("width",l)}"left"==this.settings.verticalPosition?n.addClass("pws_tabs_vertical pws_tabs_vertical_left"):n.addClass("pws_tabs_vertical pws_tabs_vertical_right")}else"top"==this.settings.horizontalPosition?n.addClass("pws_tabs_horizontal pws_tabs_horizontal_top"):n.addClass("pws_tabs_horizontal pws_tabs_horizontal_bottom");this.settings.rtl&&n.addClass("pws_tabs_rtl"),"none"==this.settings.effect&&n.addClass("pws_tabs_noeffect"),this.settings.theme&&n.addClass(this.settings.theme),t.inArray(this.settings.effect,i)>=0?n.addClass("pws_"+this.settings.effect):n.addClass("pws_scale"),e.addClass("pws_hide").hide(),"vertical"==this.settings.tabsPosition?"left"==this.settings.verticalPosition?n.prepend('<ul class="pws_tabs_controll"></ul>'):n.append('<ul class="pws_tabs_controll"></ul>'):"top"==this.settings.horizontalPosition?n.prepend('<ul class="pws_tabs_controll"></ul>'):n.append('<ul class="pws_tabs_controll"></ul>');var d=n.children(".pws_tabs_controll"),o=1;e.each(function(){t(this).attr("data-pws-tab-id",o);var s=t(this).data("pws-tab"),i=t(this).data("pws-tab-name");d.append('<li><a data-tab-id="'+s+'">'+i+"</a></li>"),t(this).addClass("pws_tab_single"),o++});var h=d.find("a"),p=d.find("li"),r=a.children('[data-pws-tab-id="'+this.settings.defaultTab+'"]');if(a.children("[data-pws-tab-icon]").each(function(){var s=t(this).attr("data-pws-tab"),i=t(this).attr("data-pws-tab-name"),a=t(this).attr("data-pws-tab-icon");""==i&&d.find('[data-tab-id="'+s+'"]').addClass("pws_tab_noname"),d.find('[data-tab-id="'+s+'"]').prepend('<i class="fa '+a+'"></i>')}),"vertical"==this.settings.tabsPosition){var _=n.innerWidth()/450,c=parseInt(h.css("font-size"))/_,w=parseInt(h.css("padding-left"))+parseInt(h.css("padding-right")),u=h.html().length*c+w,b=d.outerHeight(),f=n.outerWidth()-u,v=a.outerHeight();d.width(u),a.outerWidth(f),b>v&&a.css("min-height",b)}if(r.addClass("pws_show").show(),d.find('[data-tab-id="'+r.data("pws-tab")+'"]').addClass("pws_tab_active"),h.on("click",function(s){s.preventDefault(),h.removeClass("pws_tab_active"),t(this).addClass("pws_tab_active");var i=t(this).data("tab-id"),n=a.children('[data-pws-tab="'+i+'"]');e.removeClass("pws_show"),setTimeout(function(){e.hide(),n.show()},400),setTimeout(function(){n.addClass("pws_show")},450)}),this.settings.responsive){n.addClass("pws_tabs_responsive");var g=parseInt(d.children("li").length),m=100/g,C=Math.max.apply(null,p.map(function(){return t(this).height()}).get());t(s).on("resize load",{pluginSettings:this.settings},function(i){var e=i.data.pluginSettings,l=e.tabsPosition,o=e.containerWidth;t(s).width()<=960&&(n.width(""),p.css("width",m+"%"),h.each(function(){t(this).height(C)}),"vertical"==l&&(d.width(""),a.width(""),a.css("min-height",""),a.height(r.height()))),t(s).width()<=600?(n.find(".pws_responsive_small_menu").length<1&&t('<div class="pws_responsive_small_menu"><a data-visible="0"><i class="fa fa-bars"></i></a></div>').insertBefore(d),d.addClass("pws_tabs_menu_popup"),h.height(""),p.width(""),n.find("ul.pws_tabs_menu_popup").hide(),n.find(".pws_responsive_small_menu a").click(function(s){s.preventDefault(),"0"==t(this).attr("data-visible")?(n.find("ul.pws_tabs_menu_popup").show(),t(this).attr("data-visible","1")):(n.find("ul.pws_tabs_menu_popup").hide(),t(this).attr("data-visible","0"))}),n.find("ul.pws_tabs_menu_popup li a").on("click",function(s){s.preventDefault(),t(this).closest(".pws_tabs_menu_popup").hide(),n.find(".pws_responsive_small_menu a").attr("data-visible","0")})):t(s).width()>960?(n.css("width",o),p.width(""),h.height(""),n.find(".pws_responsive_small_menu").remove(),d.removeClass("pws_tabs_menu_popup"),d.show()):t(s).width()>600&&(n.find(".pws_responsive_small_menu").remove(),d.removeClass("pws_tabs_menu_popup"),d.show(),h.on("click",function(s){s.preventDefault(),t(this).parent().parent().show()}))})}}},t.fn[n]=function(t){return this.each(function(){new e(this,t)})}}(jQuery,window,document);
\ No newline at end of file
# Copyright (C) 2018 Role Based Price For WooCommerce
# This file is distributed under the same license as the Role Based Price For WooCommerce package.
msgid ""
msgstr ""
"Project-Id-Version: Role Based Price For WooCommerce 3.3\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-role-based-price\n"
"POT-Creation-Date: 2018-03-12 04:57:30+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
#: bootstrap.php:157
msgid "Cloning instances of the class is forbidden."
msgstr ""
#: bootstrap.php:171
msgid "Unserializing instances of the class is forbidden."
msgstr ""
#: includes/admin/class-admin-init.php:72
msgid "Role Based Price For WooCommerce Welcome Page"
msgstr ""
#: includes/admin/class-admin-init.php:170
msgid "Settings"
msgstr ""
#: includes/admin/class-admin-init.php:171
msgid "Add-ons"
msgstr ""
#: includes/admin/class-admin-init.php:188
msgid "Docs"
msgstr ""
#: includes/admin/class-admin-init.php:189
msgid "View On Github"
msgstr ""
#: includes/admin/class-admin-init.php:190
msgid "Report Issue"
msgstr ""
#: includes/admin/class-admin-init.php:191
msgid "Donate"
msgstr ""
#: includes/admin/class-admin-init.php:192
msgid "Contact Author"
msgstr ""
#: includes/admin/class-ajax-handler.php:29
#: includes/admin/class-ajax-handler.php:46
#: includes/admin/class-ajax-handler.php:50
msgid "Invalid Product ID"
msgstr ""
#: includes/admin/class-ajax-handler.php:41
msgid "Success"
msgstr ""
#: includes/admin/class-ajax-handler.php:87
msgid "Unable To Process Your Request Please Try Again later"
msgstr ""
#: includes/admin/class-metabox.php:10
msgid "Role Based Price For WooCommerce Editor"
msgstr ""
#: includes/admin/class-metabox.php:126
msgid "Variations"
msgstr ""
#: includes/admin/class-metabox.php:154
msgid "Select A Variation : "
msgstr ""
#: includes/admin/class-metabox.php:205
msgid "Clear Cache"
msgstr ""
#: includes/admin/class-metabox.php:211
msgid "Save Price"
msgstr ""
#: includes/admin/class-metabox.php:228
msgid "WC Product Price : "
msgstr ""
#: includes/admin/class-price-editor-fields.php:24
#: includes/admin/settings_framework/class-wp-plugin-options.php:23
#: includes/admin/settings_framework/class-wp-plugin-options.php:34
msgid "General"
msgstr ""
#: includes/admin/class-price-editor-fields.php:36
msgid "Enable Role Based Pricing"
msgstr ""
#: includes/admin/class-price-editor-fields.php:63
msgid "Enter Product's "
msgstr ""
#: includes/admin/class-product-functions.php:29
msgid "Product Price Updated."
msgstr ""
#: includes/admin/class-product-functions.php:31
msgid "Price Not Defined. Please Try Again"
msgstr ""
#: includes/admin/settings_framework/class-wp-plugin-options.php:27
msgid "Extensions Options"
msgstr ""
#: includes/admin/settings_framework/class-wp-plugin-options.php:29
msgid "Extensions"
msgstr ""
#: includes/admin/settings_framework/class-wp-plugin-options.php:39
msgid "No Addons Activated / Installed."
msgstr ""
#: includes/admin/settings_framework/class-wp-plugin-options.php:55
msgid "Allowed User Roles"
msgstr ""
#: includes/admin/settings_framework/class-wp-plugin-options.php:56
msgid "User Roles To List In Product Edit Page"
msgstr ""
#: includes/admin/settings_framework/class-wp-plugin-options.php:69
msgid "Allowed Product Pricing"
msgstr ""
#: includes/admin/settings_framework/class-wp-plugin-options.php:70
msgid "Price Fields To List In Product Edit Page"
msgstr ""
#: includes/admin/settings_framework/class-wp-plugin-options.php:85
msgid " Label "
msgstr ""
#: includes/admin/settings_framework/class-wp-plugin-options.php:97
msgid "WPML Integration"
msgstr ""
#: includes/admin/settings_framework/class-wp-plugin-options.php:98
msgid "check if you have installed wpml and the price are showing wrong. "
msgstr ""
#: includes/admin/settings_framework/class-wp-settings-framework.php:78
msgid "Role Based Price Settings"
msgstr ""
#: includes/admin/views/addons-single.php:21
msgid "V"
msgstr ""
#: includes/admin/views/addons-single.php:31
msgid "By"
msgstr ""
#: includes/admin/views/addons-single.php:40
msgid "Required Plugins :"
msgstr ""
#: includes/admin/views/addons-single.php:46 includes/class-extensions.php:214
msgid "InActive"
msgstr ""
#: includes/admin/views/addons-single.php:49
msgid "Plugin Does Not Exist"
msgstr ""
#: includes/admin/views/addons-single.php:52 includes/class-extensions.php:213
msgid "Active"
msgstr ""
#: includes/admin/views/addons-single.php:74
msgid "Screenshots"
msgstr ""
#: includes/admin/views/addons-single.php:89
msgid "Addon Slug : "
msgstr ""
#: includes/admin/views/addons-single.php:95
msgid "Last Updated:"
msgstr ""
#: includes/admin/views/ajax-modal-footer.php:4
msgid "Close"
msgstr ""
#: includes/admin/views/ajax-modal-footer.php:6
msgid "Update Price"
msgstr ""
#: includes/admin/views/ajax-modal-header.php:3
msgid "Role Based Price Editor"
msgstr ""
#: includes/admin/views/plugin-welcome-page.php:2
msgid "Welcome To"
msgstr ""
#: includes/admin/views/plugin-welcome-page.php:3
#: plugins/wc-product-importer/wc-product-importer.php:79
msgid "Role Based Price For WooCommerce"
msgstr ""
#: includes/admin/views/plugin-welcome-page.php:6
msgid " now with improved speed and stability"
msgstr ""
#: includes/class-extensions.php:212
msgid "All"
msgstr ""
#: includes/class-extensions.php:228
msgid "Search Addons"
msgstr ""
#: includes/class-extensions.php:277 includes/class-extensions.php:312
msgid "Unable to process you request. please try again later"
msgstr ""
#: includes/class-extensions.php:279 includes/class-extensions.php:285
msgid "Unable To De-Activate Addon. Please Try Again Later"
msgstr ""
#: includes/class-extensions.php:281
msgid "Addon De-Activated"
msgstr ""
#: includes/class-extensions.php:283
msgid "Addon Already De-Activated"
msgstr ""
#: includes/class-extensions.php:314 includes/class-extensions.php:320
msgid "Unable To Activate Addon. Please Try Again Later"
msgstr ""
#: includes/class-extensions.php:316
msgid "Addon Activated"
msgstr ""
#: includes/class-extensions.php:318
msgid "Addon Already Activated"
msgstr ""
#: includes/class-extensions.php:329
msgid "Activate"
msgstr ""
#: includes/class-extensions.php:330
msgid "Deactivate"
msgstr ""
#: includes/class-product-pricing.php:484
#: includes/class-product-pricing.php:494
msgctxt "Price range: from - to"
msgid " % 1$s & ndash;%2$s"
msgstr ""
#: includes/class-product-pricing.php:498
msgid "Free! "
msgstr ""
#: includes/class-shortcode-handler.php:47
msgid "Invalid Product ID Given"
msgstr ""
#: includes/class-shortcode-handler.php:53
msgid "Invalid User Role Given"
msgstr ""
#: includes/class-shortcode-handler.php:61
msgid "Invalid Price Type Given"
msgstr ""
#: includes/functions.php:132
msgid "Visitor / LogedOut User"
msgstr ""
#: includes/functions.php:230
msgid "Regular Price"
msgstr ""
#: includes/functions.php:231
msgid "Selling Price"
msgstr ""
#: includes/helpers/class-activator.php:32
msgid "Thank you for installing <strong>Role Based Price For WooCommerce</strong> : <strong>Version 3.0 </strong>"
msgstr ""
#: includes/helpers/class-activator.php:33
msgid "We have worked entire 1 year to improve our plugin to best of our ability and we hope you will enjoy working with it. We are always open for your sugestions and feature requests"
msgstr ""
#: includes/helpers/class-activator.php:36
msgid "If you have installed <strong>WPRB</strong> for the 1st time or upgrading from <strong> Version 2.8.7</strong> then you will need to update its' settings once again or this plugin will not function properly. "
msgstr ""
#: includes/helpers/class-activator.php:39
msgid "Click Here to update the settings"
msgstr ""
#: plugins/aelia-currencyswitcher-integration/aelia-currencyswitcher-integration.php:82
#: plugins/aelia-currencyswitcher-integration/wc_rbp_fields.php:3
msgid "Aelia Currency Switcher"
msgstr ""
#: plugins/aelia-currencyswitcher-integration/aelia-currencyswitcher-integration.php:93
msgid "Allowed Currency"
msgstr ""
#: plugins/aelia-currencyswitcher-integration/aelia-currencyswitcher-integration.php:94
msgid "Allowed Currency To Show In Role Based Price Listing"
msgstr ""
#: plugins/aelia-currencyswitcher-integration/wc_rbp_fields.php:23
msgid "Enter Product's %s For %s Currency"
msgstr ""
#: plugins/price-add-to-cart-visibility/price-add-to-cart-visibility.php:78
msgid "Hide Price For"
msgstr ""
#: plugins/price-add-to-cart-visibility/price-add-to-cart-visibility.php:79
msgid "Product Price will be hidden for the selected user roles"
msgstr ""
#: plugins/price-add-to-cart-visibility/price-add-to-cart-visibility.php:91
msgid "Hide Add To Cart Button"
msgstr ""
#: plugins/price-add-to-cart-visibility/price-add-to-cart-visibility.php:92
msgid "Product Add To Cart Button will be hidden for the selected user roles"
msgstr ""
#: plugins/price-add-to-cart-visibility/price-add-to-cart-visibility.php:103
msgid "Hide Product Variations"
msgstr ""
#: plugins/price-add-to-cart-visibility/price-add-to-cart-visibility.php:104
msgid "if checked Variable product variation will be hidden from product page "
msgstr ""
#: plugins/price-add-to-cart-visibility/price-add-to-cart-visibility.php:114
msgid "Custom Message"
msgstr ""
#: plugins/price-add-to-cart-visibility/price-add-to-cart-visibility.php:115
msgid "Used when product price is hidden.. use <code>[currency]</code> to get current store currency"
msgstr ""
#: plugins/price-add-to-cart-visibility/price-add-to-cart-visibility.php:125
msgid "Price & AddToCart Visibility"
msgstr ""
#: plugins/price-add-to-cart-visibility/price-add-to-cart-visibility.php:126
msgid "Hide Product Price & Add To Cart button based on users role and set custom messsage to show if price is hidden"
msgstr ""
#: plugins/wc-product-exporter/wc-product-exporter.php:119
msgid "Role Based Price For WooCommerce All"
msgstr ""
#: plugins/wc-product-exporter/wc-product-exporter.php:123
msgid "WC RBP Status"
msgstr ""
#: plugins/wc-product-exporter/wc-product-exporter.php:127
msgid "WC Role Based "
msgstr ""
#: plugins/wc-product-exporter/wc-product-exporter.php:127
msgid " Price "
msgstr ""
#: plugins/wc-product-importer/wc-product-importer.php:62
#: plugins/wc-product-importer/wc-product-importer.php:63
msgid "Price Status"
msgstr ""
#. Plugin Name of the plugin/theme
msgid "Role Based Price For WooCommerce"
msgstr ""
#. Plugin URI of the plugin/theme
msgid "https://wordpress.org/plugins/woocommerce-role-based-price/"
msgstr ""
#. Description of the plugin/theme
msgid "Sell product in different price for different user role based on your settings."
msgstr ""
#. Author of the plugin/theme
msgid "Varun Sridharan"
msgstr ""
#. Author URI of the plugin/theme
msgid "http://varunsridharan.in"
msgstr ""
<?php
/**
* Plugin Name: Aelia Currency Switcher Integration
* Plugin URI:
* Version: 1.0
* Description: Works With Aelia Currency Switcher Integration And Allows you to set product's role based price on currency based
* Author: Varun Sridharan
* Author URI: http://varunsridharan.in
* Created: 2016-03-04
* Last Update: 2017-03-23
* Required Plugins: [ Name : Aelia Currency Switcher for WooCommerce | URL : http://aelia.co/shop/currency-switcher-woocommerce/ | Version : 3.8.2 | Slug : woocommerce-aelia-currencyswitcher/woocommerce-aelia-currencyswitcher.php]
* Category:Integration,Currency Switcher
*/
if( ! defined('WC_RBP_PLUGIN') ) {
die;
}
if( ! class_exists('WC_Aelia_CurrencySwitcher') ) {
return;
}
require_once( __DIR__ . '/functions.php' );
class Aelia_Currency_Switcher_Integration_WC_RBP {
public function __construct() {
$this->ss_id = 'aeliacurrencyswitcher_integration';
$this->field_slug = 'wc_rbp_acs';
add_filter('wc_rbp_addon_sections', array( $this, 'add_settings_section' ));
add_filter('wc_rbp_addon_fields', array( $this, 'add_fields' ));
add_action('wc_rbp_init', array( $this, 'render' ));
add_action('wc_rbp_addon_styles', array( $this, 'add_style' ));
add_action('wc_rbp_product_save_default', array( $this, 'save_product_price' ));
add_action('wc_rbp_product_class_attribute', array( $this, 'add_acs_price_data_simple' ));
add_action('wc_rbp_product_price_value', array( $this, 'change_wc_rbp_price' ), 50, 6);
add_filter('wc_rbp_product_price', array( $this, 'change_wc_rbp_product_price' ), 10, 20);
if( wc_rbp_is_request('frontend') ) {
add_filter('wc_aelia_currencyswitcher_product_currency_prices', array( $this, 'my_custom_prices' ), 15, 3);
}
}
public function add_acs_price_data_simple(&$product) {
$product->wc_rbp_acs = wc_rbp_get_acs_product_price($product->ID);
}
public function add_style() {
echo '.acs_popup_section .wc_rbp_acs_tabs_container { padding-left: 5px; padding-right: 5px !important; }';
}
public function save_product_price($posted_values) {
if( ! isset($posted_values[$this->field_slug]) ) {
return;
}
$product_id = $posted_values['product_id'];
$wc_rbp_acs_values = $posted_values[$this->field_slug];
wc_rbp_update_acs_role_based_price($product_id, $wc_rbp_acs_values);
}
public function render() {
$this->base_currency = get_option('woocommerce_currency');
$allowed_roles = wc_rbp_allowed_roles();
foreach( $allowed_roles as $role ) {
add_action('wc_rbp_price_edit_tab_' . $role . '_after', array( $this, 'render_fields' ), 10, 4);
}
}
public function render_fields($post_id, $prodType, $prod, $tab_id) {
$product_id = $post_id;
$allowed_currency = wc_rbp_option('acs_allowed_currencies');
$allowed_price = wc_rbp_allowed_price();
$ex_price = wc_rbp_price_types();
if( empty($allowed_currency) ) {
$allowed_currency = $this->get_enabled_currencies();
}
include( __DIR__ . '/wc_rbp_fields.php' );
}
private function get_enabled_currencies() {
return apply_filters('wc_aelia_cs_enabled_currencies', array( get_option('woocommerce_currency') ));
}
public function add_settings_section($section) {
$section[] = array(
'id' => 'aeliacurrencyswitcher_integration',
'title' => __('Aelia Currency Switcher', WC_RBP_TXT),
'desc' => '',
);
return $section;
}
public function add_fields($fields) {
$fields[$this->ss_id][] = array(
'id' => WC_RBP_DB . 'acs_allowed_currencies',
'multiple' => 'true',
'type' => 'select',
'label' => __('Allowed Currency', WC_RBP_TXT),
'desc' => __('Allowed Currency To Show In Role Based Price Listing', WC_RBP_TXT),
'options' => $this->get_currency_key_val(),
'attr' => array(
'class' => 'wc-rbp-enhanced-select',
'multiple' => 'multiple',
),
);
return $fields;
}
private function get_currency_key_val() {
$wc_currencies = get_woocommerce_currencies();
$enabled_currency = $this->get_enabled_currencies();
$return_currency = array();
foreach( $enabled_currency as $curr ) {
if( isset($wc_currencies[$curr]) ) {
$symbol = get_woocommerce_currency_symbol($curr);
$symbol = ! empty($symbol) ? ' [ ' . $symbol . ' ] ' : '';
$return_currency[$curr] = $wc_currencies[$curr] . $symbol;
}
}
return $return_currency;
}
public function change_wc_rbp_price($return, $price, $product_id, $product, $price_meta_key, $current_user) {
$status = product_rbp_status($product_id, $product);
if( ! $status ) {
return $return;
}
if( empty($current_user) ) {
$current_user = wc_rbp_get_current_user();
}
return $this->get_acs_role_price($return, $product_id, $current_user, $price_meta_key);
}
public function get_acs_role_price($return, $product_id, $userrole, $price_meta_key = 'regular_price', $from_currency = NULL, $to_currency = NULL) {
$allowed_price = wc_rbp_allowed_price();
$allowed_roles = wc_rbp_allowed_roles();
if( in_array($userrole, $allowed_roles) ) {
if( in_array($price_meta_key, $allowed_price) ) {
$send_currency = array();
$allowed_currency = wc_rbp_option('acs_allowed_currencies');
if( empty($allowed_currency) ) {
$allowed_currency = $this->get_enabled_currencies();
}
if( empty($from_currency) ) {
$from_currency = get_option('woocommerce_currency');
}
if( empty($to_currency) ) {
$to_currency = get_woocommerce_currency();
}
$wc_rbp_status = product_rbp_status($product_id, NULL);
if( ! $wc_rbp_status ) {
return $return;
}
if( $this->base_currency == $to_currency ) {
$price = wc_rbp_price($product_id, $userrole, $price_meta_key);
if( ! empty($price) ) {
return $price;
}
} else {
$rbp_price = wc_rbp_acs_price($product_id, $userrole, $to_currency, 'currency');
$price = '';
$opposite_key = 'selling_price';
if( $price_meta_key == 'selling_price' ) {
$opposite_key = 'regular_price';
}
if( isset($rbp_price[$price_meta_key]) && isset($rbp_price[$opposite_key]) ) {
if( $rbp_price[$price_meta_key] == "" && $rbp_price[$opposite_key] == "" ) {
$price = $return;
} else if( $rbp_price[$price_meta_key] == "" && $rbp_price[$opposite_key] != "" ) {
$price = $rbp_price[$opposite_key];
} else if( $rbp_price[$price_meta_key] != "" && $rbp_price[$opposite_key] == "" ) {
$price = $rbp_price[$price_meta_key];
} else if( $rbp_price[$price_meta_key] != "" ) {
$price = $rbp_price[$price_meta_key];
}
} else if( isset($rbp_price[$price_meta_key]) && ! isset($rbp_price[$opposite_key]) ) {
if( $rbp_price[$price_meta_key] == "" ) {
$price = $base_price;
} else if( $rbp_price[$price_meta_key] != "" ) {
$price = $rbp_price[$price_meta_key];
}
} else if( isset($rbp_price[$opposite_key]) && ! isset($rbp_price[$price_meta_key]) ) {
if( $rbp_price[$opposite_key] == "" ) {
$price = $base_price;
} else if( $rbp_price[$opposite_key] != "" ) {
$price = $rbp_price[$opposite_key];
}
}
return $price;
}
} else {
$price_meta_key = wc_rbp_get_oppo_metakey($price_meta_key);
$price = $this->get_acs_role_price($return, $product_id, $userrole, $price_meta_key, $from_currency, $to_currency);
if( ! empty($price) ) {
return $price;
}
}
} else {
$this->hook_function_disableenable(TRUE);
$product = new WC_Product($product_id);
if( $price_meta_key == 'regular_price' ) {
$return = $product->get_regular_price();
}
if( $price_meta_key == 'selling_price' ) {
$return = $product->get_sale_price();
}
$this->hook_function_disableenable(FALSE);
}
return apply_filters('wc_aelia_cs_convert', $return, $from_currency, $to_currency);
}
public function hook_function_disableenable($disable = FALSE) {
if( $disable ) {
add_filter('role_based_price_status', array( $this, 'disable_rbp_price' ));
} else {
remove_filter('role_based_price_status', array( $this, 'disable_rbp_price' ));
}
}
public function disable_rbp_price() {
return FALSE;
}
public function change_wc_rbp_product_price($return, $role, $price, $post_id, $args) {
if( ! isset($args['currency']) ) {
return $return;
}
$allowed_price = wc_rbp_allowed_price();
if( $role == 'all' && $price == 'all' ) {
$allowed_roles = wc_rbp_allowed_roles();
foreach( $allowed_roles as $aroles ) {
foreach( $allowed_price as $aprice ) {
$return[$aroles][$aprice] = $this->get_acs_role_price($return[$aroles][$aprice], $post_id, $aroles, $aprice, NULL, $args['currency']);
}
}
} else if( $role != 'all' && $price == 'all' ) {
foreach( $allowed_price as $aprice ) {
$return[$aprice] = $this->get_acs_role_price($return[$aprice], $post_id, $role, $aprice, NULL, $args['currency']);
}
} else {
if( in_array($type, $allowed_price) ) {
$return = $this->get_acs_role_price($return, $post_id, $role, $price, NULL, $args['currency']);
} else {
$price = wc_rbp_get_oppo_metakey($price);
$return = $this->get_acs_role_price($return, $post_id, $role, $price, NULL, $args['currency']);
}
}
return $return;
}
/**
* Replaces the product prices with custom ones.
*
* @param array product_prices An array of product prices.
* @param int product_id The product ID.
* @param int price_type The price types to be replaced (e.g. regular prices, sale prices, etc).
*
* @return array An array of currency => price entries
* @author Aelia <support@aelia.co>
* @link http://aelia.co/about
*/
public function my_custom_prices($product_prices, $product_id, $price_type) {
/*
$price_type can have one of the following values:
- '_regular_currency_prices' -> Product's regular prices
- '_sale_currency_prices' -> Product's sale prices
- 'variable_regular_currency_prices' -> Variation's regular prices
- 'variable_sale_currency_prices' -> Variation's simple prices
Using $price_type, load the appropriate prices (regular or sale), and store
them in an array, using the currency as the key. If you don't have one of the
prices (e.g. GBP), don't add it to the array. Example:
*/
$status = product_rbp_status($product_id, NULL);
if( ! $status ) {
return $product_prices;
}
$type = "selling_price";
$price = '';
$allowed_currency = wc_rbp_option('acs_allowed_currencies');
$allowed_price = wc_rbp_allowed_price();
$current_user = wc_rbp_get_current_user();
$send_currency = array();
if( empty($allowed_currency) ) {
$allowed_currency = $this->get_enabled_currencies();
}
if( $price_type == 'variable_regular_currency_prices' || $price_type == '_regular_currency_prices' ) {
$type = "regular_price";
}
$allowed_roles = wc_rbp_allowed_roles();
if( in_array($current_user, $allowed_roles) ) {
if( ! in_array($type, $allowed_price) ) {
$send_currency = array();
} else {
foreach( $allowed_currency as $currency ) {
if( $this->base_currency == $currency ) {
$price = wc_rbp_price($product_id, $current_user, $type);
if( $price !== FALSE ) {
if( ! empty($price) )
$send_currency[$currency] = $price;
}
} else {
$price = wc_rbp_acs_price($product_id, $current_user, $currency, $type);
$send_currency[$currency] = $price;
}
}
}
}
$product_prices = array_merge($product_prices, $send_currency);
return $product_prices;
}
}
return new Aelia_Currency_Switcher_Integration_WC_RBP;
\ No newline at end of file
<?php
if( ! function_exists('wc_rbp_update_acs_role_based_price') ) {
/**
* Updates Products Role Based Price Array In DB
*
* @param int $post_id Post ID To Update
* @param array $price_array Price List
*
* @return boolean [[Description]]
*/
function wc_rbp_update_acs_role_based_price($post_id, $price_array) {
update_post_meta($post_id, '_acs_role_based_price', $price_array);
return TRUE;
}
}
if( ! function_exists('wc_rbp_get_acs_product_price') ) {
/**
* Gets Product price from DB
* #TODO Integrate Wth product_rbp_price function to make it faster
*/
function wc_rbp_get_acs_product_price($post_id, $supress_filter = FALSE) {
$price = get_post_meta($post_id, '_acs_role_based_price');
if( ! empty($price) ) {
$price = $price[0];
} else if( empty($price) ) {
$price = array();
}
if( ! $supress_filter )
$price = apply_filters('wc_rbp_product_acs_prices', $price);
return $price;
}
}
if( ! function_exists('product_acs_rbp_price') ) {
/**
* Gets product price from DB
*/
function product_acs_rbp_price($post_id) {
$price = wc_rbp_product_variable($post_id, 'wc_rbp_acs', 'wc_rbp_get_acs_product_price');
return $price;
}
}
if( ! function_exists('wc_rbp_acs_price') ) {
/**
* Returns Price Based On Give Value
*
* @role : enter role slug / use all to get all roles values
* @price : use selling_price / regular_price or use all to get all values for the given role
*/
function wc_rbp_acs_price($post_id, $role, $currency, $price = 'regular_price', $args = array()) {
$dbprice = product_acs_rbp_price($post_id);
$return = FALSE;
if( $price == 'all' && $role == 'all' ) {
$return = $dbprice;
} else if( $price == 'all' && $role !== 'all' ) {
if( isset($dbprice[$role]) ) {
$return = $dbprice[$role];
}
} else if( $price == 'currency' && $role !== 'all' ) {
if( isset($dbprice[$role]) ) {
$return = $dbprice[$role][$currency];
}
} else if( isset($dbprice[$role][$currency][$price]) ) {
$return = $dbprice[$role][$currency][$price];
}
$return = apply_filters('wc_rbp_product_acs_price', $return, $role, $price, $post_id, $args);
return $return;
}
}
\ No newline at end of file
<div class="wc_rbp_popup_section acs_popup_section">
<div class="wc_rbp_pop_field"><h3><?php _e('Aelia Currency Switcher', WC_RBP_TXT); ?></h3></div>
<div class="wc_rbp_pop_field">
<?php
$tabs = array();
$content = array();
$output_html = '';
foreach( $allowed_currency as $currency ) {
if( $this->base_currency == $currency ) {
continue;
}
$symbol = get_woocommerce_currency_symbol($currency);
$symbol = ! empty($symbol) ? ' (' . $symbol . ') ' : ' (' . $currency . ') ';
$tabs[$tab_id . '-' . $currency] = array( 'title' => $currency . ' ' . $symbol );
$output_html = '<div class="wc_rbp_price_container wc_rbp_popup_section wc_rbp_popup_section_' . $tab_id . '_' . $currency . '">';
foreach( $allowed_price as $price ) {
$value = wc_rbp_acs_price($product_id, $tab_id, $currency, $price);
$text = __('Enter Product\'s %s For %s Currency', WC_RBP_TXT);
$field_id = 'wc_rbp_acs[' . $tab_id . '][' . $currency . '][' . $price . ']';
$defaults = array(
'type' => 'text',
'label' => $ex_price[$price] . $symbol,
'description' => sprintf($text, $ex_price[$price], $currency),
'class' => array(),
'label_class' => array(),
'input_class' => array( 'wc_input_price', $price, 'wc_rbp_' . $price ),
'return' => TRUE,
'custom_attributes' => array(),
);
$output_html .= '<div class="wc_rbp_pop_field_50 wc_rbp_pop_field_' . $price . '">';
$output_html .= woocommerce_form_field($field_id, $defaults, $value);
$output_html .= '</div>';
}
$output_html .= '</div>';
$content[$tab_id . '-' . $currency] = $output_html;
}
echo wc_rbp_generate_tabs($tabs, $content, array( 'tab_style' => 'default' ));
?>
</div>
</div>
\ No newline at end of file
<?php
/**
* Plugin Name: Price & Add To Cart Visibility
* Plugin URI:
* Version: 1.0
* Description: Allows to hide products price & add to cart button based on the user roles.
* Author: Varun Sridharan
* Author URI: http://varunsridharan.in
* Last Update: 2016-03-04
* Category: Tools
*/
if( ! defined('WC_RBP_PLUGIN') ) {
die;
}
class Price_add_to_cart_visibility_WC_RBP {
public function __construct() {
add_filter('wc_rbp_addon_sections', array( $this, 'add_settings_section' ));
add_filter('wc_rbp_addon_fields', array( $this, 'add_settings_fields' ));
add_filter('init', array( $this, 'check_remove_add_to_cart' ), 999);
add_filter('woocommerce_get_price_html', array( $this, 'remove_price' ), 999, 2);
}
public function check_remove_add_to_cart() {
$current_role = wc_rbp_get_current_user();
$resticted_role = wc_rbp_option('hide_product_addtocart');
$variable_status = wc_rbp_option('hide_variable_product');
if( empty($resticted_role) ) {
return;
}
if( in_array($current_role, $resticted_role) ) {
add_filter('woocommerce_loop_add_to_cart_link', array( &$this, 'remove_add_to_cart_link' ), 99);
remove_action('woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30);
if( $variable_status ) {
remove_action('woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30);
} else {
remove_action('woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20);
}
}
}
public function remove_add_to_cart_link($link) {
return '';
}
public function remove_price($price) {
$current_role = wc_rbp_get_current_user();
$resticted_role = wc_rbp_option('hide_product_price');
if( ! empty($resticted_role) ) {
if( in_array($current_role, $resticted_role) ) {
$price_notice = wc_rbp_option('pv_custom_message');
$price_notice = apply_filters('wc_rbp_price_visibility_custom_price_message', $price_notice, $current_role);
if( ! empty($price_notice) ) {
$symbol = get_woocommerce_currency_symbol();
$price_notice = str_replace('[currency]', $symbol, $price_notice);
return $price_notice;
}
return '';
}
}
return $price;
}
public function add_settings_fields($fields) {
$fields['price_visibility'][] = array(
'id' => WC_RBP_DB . 'hide_product_price',
'multiple' => 'true',
'type' => 'select',
'label' => __('Hide Price For', WC_RBP_TXT),
'desc' => __('Product Price will be hidden for the selected user roles', WC_RBP_TXT),
'options' => wc_rbp_get_user_roles_selectbox(),
'attr' => array(
'class' => 'wc-rbp-enhanced-select',
'multiple' => 'multiple',
),
);
$fields['price_visibility'][] = array(
'id' => WC_RBP_DB . 'hide_product_addtocart',
'multiple' => 'true',
'type' => 'select',
'label' => __('Hide Add To Cart Button', WC_RBP_TXT),
'desc' => __('Product Add To Cart Button will be hidden for the selected user roles', WC_RBP_TXT),
'options' => wc_rbp_get_user_roles_selectbox(),
'attr' => array(
'class' => 'wc-rbp-enhanced-select',
'multiple' => 'multiple',
),
);
$fields['price_visibility'][] = array(
'id' => WC_RBP_DB . 'hide_variable_product',
'type' => 'checkbox',
'label' => __('Hide Product Variations', WC_RBP_TXT),
'desc' => __('if checked Variable product variation will be hidden from product page ', WC_RBP_TXT),
'attr' => array( 'class' => 'wc_rbp_checkbox', ),
);
$fields['price_visibility'][] = array(
'id' => WC_RBP_DB . 'pv_custom_message',
'value' => html_entity_decode(wc_rbp_option('pv_custom_message')),
'type' => 'richtext',
'richtext_settings' => array( 'textarea_rows' => 5 ),
'label' => __('Custom Message', WC_RBP_TXT),
'desc' => __('Used when product price is hidden.. use <code>[currency]</code> to get current store currency', WC_RBP_TXT),
'attr' => array( 'class' => 'wc_rbp_checkbox', ),
);
return $fields;
}
public function add_settings_section($section) {
$c_section = array();
$c_section['id'] = 'price_visibility';
$c_section['title'] = __('Price & AddToCart Visibility', WC_RBP_TXT);
$c_section['desc'] = __('Hide Product Price & Add To Cart button based on users role and set custom messsage to show if price is hidden', WC_RBP_TXT);
$section[] = $c_section;
return $section;
}
}
return new Price_add_to_cart_visibility_WC_RBP;
\ No newline at end of file
<?php
/**
* Plugin Name: WooCommerce Product Export
* Plugin URI:
* Version: 1.0
* Description: This Addon Integration With Default Product Exporter In WooCommerce And Provides Options To Export Role Based Prices
* Author: Varun Sridharan
* Author URI: http://varunsridharan.in
* Last Update: 2017-07-07
* Category: Tools,Price Export
*/
if( ! defined('WC_RBP_PLUGIN') ) {
die;
}
class wc_product_price_exporter {
public function __construct() {
$this->is_wcrbp_export = FALSE;
$this->key_vals();
add_filter("woocommerce_product_export_product_default_columns", array( $this, 'add_option' ));
add_filter("woocommerce_product_export_row_data", array( $this, 'add_wcrbp_prices' ), 1, 2);
add_action("wp_ajax_woocommerce_do_ajax_product_export", array( $this, 'check_wcrbp_export' ), 1);
}
public function key_vals() {
$allowed_user_roles = wc_rbp_allowed_roles();
$allowed_prices = wc_rbp_allowed_price();
$active_cols = array( 'wcrbp_status' => '' );
$user_roles = array();
foreach( $allowed_user_roles as $role_id ) {
if( ! isset($user_roles['wcrbp_' . $role_id]) ) {
$user_roles['wcrbp_' . $role_id] = array();
}
foreach( $allowed_prices as $price_id ) {
if( ! isset($active_cols['wcrbp_' . $role_id . '_' . $price_id]) ) {
$user_roles['wcrbp_' . $role_id]['wcrbp_' . $role_id . '_' . $price_id] = '';
$active_cols['wcrbp_' . $role_id . '_' . $price_id] = array( 'role' => $role_id,
'price' => $price_id,
);
}
}
}
$this->active_cols = $active_cols;
$this->user_roles = $user_roles;
return $this->active_cols;
}
public function check_wcrbp_export() {
if( isset($_POST['selected_columns']) ) {
if( is_array($_POST['selected_columns']) ) {
if( in_array('wcrbp_price', $_POST['selected_columns']) ) {
$this->remove_post_data('wcrbp_price');
$_POST['selected_columns'] = array_merge($_POST['selected_columns'], array_keys($this->key_vals()));
$this->is_wcrbp_export = TRUE;
} else {
foreach( array_keys($this->user_roles) as $role ) {
if( in_array($role, $_POST['selected_columns']) ) {
$this->remove_post_data($role);
$_POST['selected_columns'] = array_merge($_POST['selected_columns'], array_keys($this->user_roles[$role]));
$this->is_wcrbp_export = TRUE;
}
}
}
}
}
if( $this->is_wcrbp_export ) {
add_filter("woocommerce_product_export_column_names", array( $this, 'custom_col' ));
}
}
public function remove_post_data($key) {
foreach( $_POST['selected_columns'] as $id => $vl ) {
if( $vl == $key ) {
unset($_POST['selected_columns'][$id]);
}
}
}
public function add_wcrbp_prices($row, $product) {
if( $this->is_wcrbp_export ) {
$prices = wc_rbp_price($product->get_id(), 'all', 'all');
if( isset($row['wcrbp_status']) )
$row['wcrbp_status'] = wc_rbp_product_status($product->get_id(), TRUE);
if( ! empty($prices) ) {
foreach( $prices as $user => $price_types ) {
foreach( $price_types as $type => $price ) {
if( isset($row['wcrbp_' . $user . '_' . $type]) ) {
$row['wcrbp_' . $user . '_' . $type] = wc_format_localized_price($price);
}
}
}
}
}
return $row;
}
public function custom_col($cols) {
$new_cols = $this->active_cols;
$allowed_user_roles = wc_rbp_allowed_roles();
$allowed_prices = wc_rbp_allowed_price();
foreach( $allowed_user_roles as $user_role_id ) {
foreach( $allowed_prices as $price ) {
if( ! isset($cols['wcrbp_' . $user_role_id . '_' . $price]) ) {
$cols['wcrbp_' . $user_role_id . '_' . $price] = $user_role_id . '_' . $price;
}
}
}
$cols['wcrbp_status'] = 'wcrbp_status';
return $cols;
}
public function add_option($options) {
$options['wcrbp_price'] = __("Role Based Price For WooCommerce All", WC_RBP_TXT);
$allowed_user_roles = wc_rbp_allowed_roles();
$user_roles = wc_rbp_get_wp_roles();
$options['wcrbp_status'] = __("WC RBP Status", WC_RBP_TXT);
foreach( $user_roles as $user_role_id => $user_role_name ) {
if( in_array($user_role_id, $allowed_user_roles) ) {
if( ! isset($options['wcrbp_' . $user_role_id]) ) {
$options['wcrbp_' . $user_role_id] = __('WC Role Based ', WC_RBP_TXT) . $user_role_name['name'] . __(' Price ', WC_RBP_TXT);
}
}
}
return $options;
}
}
return new wc_product_price_exporter;
\ No newline at end of file
<?php
/**
* Plugin Name: WooCommerce Product Importer
* Plugin URI:
* Version: 1.0
* Description: This Addon Integration With Default Product Importer In WooCommerce And Provides Options To Import, Role Based Prices
* Author: Varun Sridharan
* Author URI: http://varunsridharan.in
* Last Update: 2017-07-07
* Category: Tools,Price Import
*/
if( ! defined('WC_RBP_PLUGIN') ) {
die;
}
class wc_product_price_importer {
public function __construct() {
add_filter("woocommerce_csv_product_import_mapping_options", array( $this, 'add_import_options' ));
add_action("woocommerce_product_import_inserted_product_object", array( $this, 'save_price' ), 10, 2);
}
public function save_price($product, $data) {
$this->generate_options_data();
$obj = $this->options_product_save;
$obk = array_keys($obj);
$final_price = array();
$status = FALSE;
foreach( $data as $id => $value ) {
if( $id == 'wcrbp_status' ) {
if( $value == 'no' ) {
$status = FALSE;
} else if( $value == 'yes' ) {
$status = TRUE;
} else if( floatval($value) == 0 ) {
$status = FALSE;
} else if( floatval($value) == 1 ) {
$status = TRUE;
}
} else if( in_array($id, $obk) ) {
$attribute = $obj[$id];
$role = $attribute['role'];
$price_type = $attribute['price'];
if( $value != '' ) {
$final_price[$role][$price_type] = wc_format_decimal($value);
}
}
}
if( ! empty($final_price) )
wc_rbp_update_role_based_price($product->get_id(), $final_price);
wc_rbp_update_role_based_price_status($product->get_id(), $status);
}
public function generate_options_data() {
if( isset($this->options_updated) ) {
return $this->options_updated;
}
$allowed_user_roles = wc_rbp_allowed_roles();
$allowed_prices = wc_rbp_allowed_price();
$options = array( "wcrbp_status" => __("Price Status") );
$options2 = array( "wcrbp_status" => __("Price Status") );
foreach( wc_rbp_get_wp_roles() as $role_id => $data ) {
if( in_array($role_id, $allowed_user_roles) ) {
foreach( $allowed_prices as $price_id ) {
$options[$role_id . '_' . $price_id] = ' WC Role Based ' . $data['name'] . ' - ' . wc_rbp_price_types($price_id);
$options2[$role_id . '_' . $price_id] = array( 'role' => $role_id, 'price' => $price_id );
}
}
}
$this->options_updated = $options;
$this->options_product_save = $options2;
return $options;
}
public function add_import_options($options) {
$options['wcrbp_options'] = array(
'name' => __("Role Based Price For WooCommerce"),
'options' => $this->generate_options_data(),
);
return $options;
}
}
return new wc_product_price_importer;
\ No newline at end of file
=== Role Based Price For WooCommerce ===
Contributors: varunms,arnis.arbidans
Author URI: http://varunsridharan.in/
Plugin URL: https://wordpress.org/plugins/woocommerce-role-based-price/
Tags: Role Based Price For WooCommerce,WooCommerce,Role based pricing,user role,wc dynamic pricing,wpallimport,wpallexport,product addons,role,selling price,regular price,sale price,selling,discounts,wordpress,ecommerce,membership discounts,membership,digital,downloads,download,drop price,dropshipper,advertising,deals,group pricing,wpml,wpml currencyswitcher,aelia currency swticher, Online Payment,Payment,Online, affiliate, cart, checkout, digital, download, downloadable, e-commerce, ecommerce, inventory, reports, sales, sell, shipping, shop, shopping, stock, store, tax, variable, widgets, woothemes, wordpress ecommerce,discounts, prices, wholesale, woocommerce,advertising, discount, marketing, Membership, price, promotion
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=36Y7KSYPF7KTU
Requires at least: 3.0
Tested up to: 5.2.1
WC requires at least: 3.0
WC tested up to:3.5
Stable tag: 3.3.6
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Sell product in different price for different user role based on your settings.
== Description ==
<h3>Thanks For Your Continued Support For Role Based Price For WooCommerce</h3>
<p>We Are Already In A Process For Created Version 4.0 For This Plugin
<a href="https://forms.gle/waxC4Mm9SZFWuq3A8">Join Newsletter / Request Beta Access</a></p>
<hr/>
This plugin can make your simple WooCommerce shop in to multi currency and price level marketplace where products can be offered at different prices for different customer groups.
For example, Subscribers or Contributors get different prices than new customers. Differentiate your registered users to get your shop more attractive. New roles can be created and managed.
Latest version have been greatly improved for smoother and more speedy functioning, all user interfaces have been improved for more friendly user/webmaster experience. It is now WPML ready straight of of box.
We have added built-in plugin extension marketplace for more PRO level functions that not all might need but we think they are very useful. Please check full feature list below.
[youtube https://www.youtube.com/watch?v=rlX8okqNfs4]
We have worked on this plugin for last 3 years and so far it have been all free but in order for us to continue with this plugin development we had to move few of its’ features/extensions in to PRO(paid) version that is available for very generous price of $59 (+$20 for extended 12 month support) here: <a href="https://1.envato.market/wcrbp">WC Role Based Pricing Pro</a>
= Features + Add-Ons =
* User Friendly UI
* Simple , Variable / Variation , Grouped , External Product Type Supported
* Supports Regular & Selling Price
* Works With WPML
* Developer Friendly
* Easy To Create Addons
* Aelia Currency Switcher Integration
* Price & AddToCart Visiablity
* Shortcode to get product price
* Integration With WC Product Importer / Exporter
= Pro Features + Add-ons =
* Schedule Selling Price
* Dynamic Pricing
* Role Based Payment Gateway Blocker
* Role Based Product Blocker
* RBP temporary custom link access
* List Role Pricing Table
* WPML Currency Switcher Integration
* Bulk Price Updater Integration
* WPAllImport Integration
= Integration =
* Integration With <a href="https://woocommerce.wordpress.com/2017/06/28/woocommerce-3-1-has-landed/">WC Product Importer / Exporter</a>
* Integration With <a href="https://aelia.co/shop/currency-switcher-woocommerce/" > Aelia Currency Swticher </a>
* Integration With <a href="http://www.wpallimport.com/" > WP All Import Plugin </a>
* Integration With <a href="https://codecanyon.net/item/woocommerce-bulk-price-updater/14276992?ref=varunsridharan" >WC Bulk Price Updater </a>
* Integration With <a href="http://wpml.org/" >WPML Currency Switcher </a>
* Integration With <a href="https://wordpress.org/plugins/wc-frontend-manager/">WC Frontend Manager</a>
* Integration With <a href="https://barn2.co.uk/wordpress-plugins/woocommerce-product-table/">WC Product Table</a>
* Integration With <a href="https://codecanyon.net/item/improved-variable-product-attributes-for-woocommerce/9981757?ref=varunsridharan">Improved Variable Product Attributes for WooCommerce </a>
= Get Product's Regular Price With Custom User Role =
`[wc_rbp id='99' role='administrator' price='regular_price']`
= Get Product's Selling Price Based On Logged In User =
`[wc_rbp id='99' role='current' price='selling_price']`
= Get Product's Base Regular Price =
`[wc_rbp id='99' price='product_regular_price']`
= Get Product's Base Selling Price =
`[wc_rbp id='99' price='product_selling_price']`
= Get Product's Regular Price With Custom User Role =
`[wc_rbp id='99' role='administrator' price='regular_price']`
= Get Product's Selling Price Based On Logged In User =
`[wc_rbp id='99' role='current' price='selling_price']`
= Get Product's Base Regular Price =
`[wc_rbp id='99' price='product_regular_price']`
= Get Product's Base Selling Price =
`[wc_rbp id='99' price='product_selling_price']`
= Shortcode Variables Explained =
* `id=99` you need to replace the `99` with your simple/variable product id
* `role=administrator` you need replace `administrator` with your user role id / use `current` to get loggedin user role
* `price` use `regular_price` or `selling_price` to get the value of each
= Plugin Translators =
* <a href="https://profiles.wordpress.org/miladjef/">miladjef</a> {Persian translation}
= Plugin Contributors / Testers =
* <a href="https://profiles.wordpress.org/raj5harma">Raj sharma</a>
* <a href="https://wordpress.org/support/profile/nick6352683" >nick6352683 </a>
* <a href="https://profiles.wordpress.org/arnisarbidans">arnis.arbidans</a>
* <a href="https://profiles.wordpress.org/cuppy90">Cuppy</a>
* <a href="#">Joachim Keuppens</a>
* <a href="https://github.com/diventimage">Divent Image</a>
* <a href="https://github.com/gbreen">gbreen</a>
* <a href="https://github.com/vizulatedev">vizulatedev</a>
* <a href="https://profiles.wordpress.org/cloudcuckoo/">Joeyvan Dongen</a>
* <a href="https://profiles.wordpress.org/timmyhutton" >timmy hutton</a>
== Screenshots ==
1. Plugin Installed
2. Plugin Settings Menu
3. Plugin Settings Page
4. Free Add-ons
5. Paid Add-ons
6. Simple Product Editor
7. Simple Product Editor
8. Variable Product Editor
9. Aelia Currency Switcher Integration Settings
10. Aelia Currency Switcher Simple Product Editor
11. Aelia Currency Switcher Variable Product Editor
== Installation ==
= Minimum Requirements =
* WordPress 3.8 or greater
* PHP version 5.2.4 or greater
* MySQL version 5.0 or greater
= Automatic installation =
Automatic installation is the easiest option as WordPress handles the file transfers itself and you don't need to leave your web browser. To do an automatic install of Role Based Price For WooCommerce, log in to your WordPress dashboard, navigate to the Plugins menu and click Add New.
In the search field type "Role Based Price For WooCommerce" and click Search Plugins. Once you've found our plugin you can view details about it such as the the point release, rating and description. Most importantly of course, you can install it by simply clicking "Install Now"
= Manual installation =
The manual installation method involves downloading our plugin and uploading it to your Web Server via your favourite FTP application. The WordPress codex contains [instructions on how to do this here](http://codex.wordpress.org/Managing_Plugins#Manual_Plugin_Installation).
1. Installing alternatives:
* via Admin Dashboard:
* Go to 'Plugins > Add New', search for "Role Based Price For WooCommerce", click "install"
* OR via direct ZIP upload:
* Upload the ZIP package via 'Plugins > Add New > Upload' in your WP Admin
* OR via FTP upload:
* Upload `woocommerce-role-based-price` folder to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
== Frequently Asked Questions ==
**Get Product's Regular Price With Custom User Role**
`[wc_rbp id='99' role='administrator' price='regular_price']`
**Get Product's Selling Price Based On Logged In User**
`[wc_rbp id='99' role='current' price='selling_price']`
**Dose This Plugin Supports Aelia Currency Switcher ?**
Yes This Plugin Support Aelia Currency Switcher. by activation of Aelia Currency Switcher In Settings Menu
**How I Can Get Support For This Plugin**
* http://varunsridharan.in/plugin-support/
* https://wordpress.org/support/plugin/woocommerce-role-based-price
* https://github.com/varunsridharan/WooCommerce-Role-Based-Price
* Email : varunsridharan23@gmail.com
**I have an idea for your plugin!**
That's great. We are always open to your input, and we would like to add anything we think will be useful to a lot of people. please contact us using above methods.
**I found a bug!**
Oops. Please Use github / WordPress to post bugs. <a href="https://github.com/varunsridharan/WooCommerce-Role-Based-Price"> Open an Issue </a>
**Where can I request new features**
Please open an issue at <a href="https://github.com/varunsridharan/WooCommerce-Role-Based-Price"> GitHub </a> and we will look into it
== Changelog ==
= 3.3.6 [19-09-2019] =
* Minor updates.
= 3.3.5 [29-05-2019] =
* Fixed : https://wordpress.org/support/topic/error-message-in-backend-2/
= 3.3.4 [29-05-2019] =
* Tested : With Latest WordPress & WooCommerce
* Fixed : Minor Issues
= 3.3.3 [27-09-2018] =
* Tweaks : Code Cleanup Done.
* Tested : With Latest WooCommerce & WordPress
= 3.3.2 [12-04-2018] =
* Tested : With Latest WooCommerce & WordPress
* Fixed : Issue With WC Importer
* Tweaks : Minor Bug Fixed
* Tweaks : CodeCleanUP Done.
= 3.3.1 [12-03-2018] =
* Tweaks : Code CleanUP done.
* Tested : Checked With latest WC Version
* Tested : Checked With Latest WP Version
= 3.3 [01-03-2018] =
* Added : Option To Clear Cache Of Variation in product edit view.
* Fixed : Pricing Issue
* Tweaks : Formated Source Code
* Tweaks : Improved Variable Caching Methods.
= 3.2.4 [14-12-2017] =
* Fixed : Variation Product Showing Base price if product role price set to 0
* Tweaks : Minor Bug Fixes
= 3.2.3 [14-12-2017] =
* Fixed : Variation Product Showing Base price if product role price set to 0
* Tweaks : Minor Bug Fixes
= 3.2.2 [29-11-2017] =
* Fixed : Variation Product Showing 0 (Updated--);
= 3.2.1 [29-11-2017] =
* Fixed : Variation Product showing 0 (https://wordpress.org/support/topic/v3-2-problem-variable-products)
* Tweaks : Minor Code Changes
= 3.2 [28-11-2017] =
* Tweaks : Removed Unwanted Codes & Codeclean Up Done
* Tweaks : Improved Speed & Stability For Variation Products
* Tweaks : Overall Plugin Speed Improved
* Tweaks : Minor Bug Fixed
* Added : Added Cache For Variation Pricing
* Added : Tested With Latest WP & WC
= 3.1 [07-07-2017] =
* Added : New Integration With WC Default Product Exporter
* Added : New Integration With WC Default Product Importer
* Fixed : Minor Tweaks Done.
= 3.0.9 [31-05-2017] =
* Fixed : Fatal Error Below WC 3.0.
= 3.0.8 [19-05-2017] =
* Tweaks : Removed Old & Unwated Codes
* Tweaks : Improved Stability With WC 3.0
* Tweaks : Reducded DB query for product prices more than once
* Tweaks : Addon : Improved Integration With Aelia Currency Switcher
= 3.0.7 [15-05-2017] =
* Fixed : Improved Stability With WC 3.0
* Fixed : Changes Settings Framework A Bit
* Fixed : Minor Changes Done.
= 3.0.6 [18-04-2017] =
* Fixed : Tax Issue in variable product with WC 3.0
* Fixed : Sale Price display issue with WC 3.0
= 3.0.5 [13-04-2017] =
* Fixed : Issues With WooCommerce 3.0.1
* Tweaks : Improved Plugin With WC 3.0.1
* Fixed : Minor Bug Fixed.
= 3.0.4 [23-03-2017] =
* Fixed : Currency Price issue with Aelia Currency Switcher.
= 3.0.3 [10-03-2017] =
* Fixed : Variation Selectbox auto removed after selecting variations.
* Tweaks : Changed Some Core Codes.
= 3.0.2 [08-02-2017] =
* Fixed : Tax Price issue in variable product. tax getting add 2 times in base price.
* Tweaks : WC RBP Metabox Code Tweaked
* Tweaks : Improved WPML Integration
* Fixed : Minor Issues
* Tweaks : Minor Core Updates
= 3.0.1 [26-01-2017] =
* Fixed : Parse error: syntax error, unexpected '.', expecting ',' or ';' in ../includes/helpers/class-admin-notice.php on line 6 [https://wordpress.org/support/topic/output-error-after-update/]
= 3.0 [26-01-2017] =
* Total Plugin Redeveloped
* Tested With latest WordPress & WooCommerce
* Made It Developer Friendly
* Easy To Create Addons
* 5+ Plugins Integrated
= 2.8.8 [28-01-2016] =
* Tweak : Recoded for the frontend price
* Fixed : Price issue with the version 2.8.7 which aelia currency switcher active. is now fixed and minor fix
= 2.8.7 [06-01-2016] =
* Fixed : Price issue with the version 2.8.6 or below. which aelia currency switcher active. is now fixed and minor fix
= 2.8.6 [04-01-2016] =
* Fixed : Price not showing after the update
= 2.8.5 [04-01-2016] =
* Fixed : Set 0 Price for a product [https://wordpress.org/support/topic/zero-price-3?replies=12]
= 2.8.4 [01-12-2015] =
* Fixed : Products in currencies come up with wrong prices [https://github.com/technofreaky/WooCommerce-Role-Based-Price/issues/20]
* Fixed : Aelia Currency Switcher options not available in wp-all-import template [https://github.com/technofreaky/WooCommerce-Role-Based-Price/issues/19]
= 2.8.3 [12-11-2015] =
* Fixed : Variation pricing not showing properly {https://github.com/technofreaky/WooCommerce-Role-Based-Price/issues/17}
* Minor Bug Fixes
= 2.8.2 [09-11-2015] =
* Fixed : Selling Price Not Showing As Per Role Based Price Settings {https://github.com/technofreaky/WooCommerce-Role-Based-Price/issues/16}
* Minor Bug Fix
= 2.8.1 [08-11-2015] =
* Fixed : Selling / Regular shown from base product price if any one is empty [https://github.com/technofreaky/WooCommerce-Role-Based-Price/issues/14]
* Updated : Persian Language
= 2.8 [08-11-2015] =
* Fixed : Selling / Regular shown from base product price if any one is empty [https://github.com/technofreaky/WooCommerce-Role-Based-Price/issues/14]
* Fixed [https://github.com/technofreaky/WooCommerce-Role-Based-Price/issues/12]
* Bulk Variable Price Edit In Product Edit View
[https://github.com/technofreaky/WooCommerce-Role-Based-Price/issues/11]
* Added Persian translation [https://github.com/technofreaky/WooCommerce-Role-Based-Price/issues/15]
* Updated POT File
* Minor Bug Fix
= 2.7.4 [04-11-2015] =
* Fixed https://wordpress.org/support/topic/error-676?replies=2#post-7625400
* Minor Bug Fix
= 2.7.3 [04-11-2015] =
* Fixed WooCommerce Product Addons Integration Activation
* Minor Bug Fix
= 2.7.2 [04-11-2015] =
* Added User Configurable Option For Price & Product Hide
* User Configurable Option to hide variations or with add-to-cart button for variable
* Minor Bug Fix
= 2.7.1 [03-11-2015] =
* Fixed Variable Add To Cart Form Hidden.
* Minor Bug Fix
= 2.7 [21-10-2015] =
* Added Support Addon For WooCommerce Product Addons
* Minor Bug Fix
= 2.6 [10-10-2015] =
* Fixed Price output when using custom separator.
* Minor bug fix
= 2.5 [30-09-2015] =
* Code Clean Up
* Changed Addons Activation & Deactivation Stucture
* Fixed Price Seperator Issue [https://wordpress.org/support/plugin/woocommerce-role-based-price]
* Redeveloped Aelia CurrencySwitcher Integration
* Minor House Keeping
* Updated To Latest Version WordPress
* Updated To Latest Version WooCommerce
= 2.4 [16-09-2015] =
* Fixed POPUP Loading Issue With Variable Products.
* Minor Bug Fix With Aelia Currency Switcher Integration
* Code Cleanup
* Added Option Get Product's Base Regular & Selling Price Using Shortcode
= 2.3 [14-09-2015] =
* Fixed POPUP Loading Issue.
= 2.2 [13-09-2015] =
* Changed POPUP View In Product Edit Page
* Product Price Not Showing Correctly When Saved As Empty Field Fixed
* Added Shortcode to get product price.
* Minor Bug Fix
= 2.1 [05-09-2015] =
* Fixed Hide Price Issue When No User LogedIn
* Fixed Hide Add-to-cart issue when no user logedIn
* Made Plugin Compatible With WP Multisite
* Minor Bug Fix
= 2.0 [03-09-2015] =
* Total Plugin ReDeveloped
* Added Integrations To WP All Import Plugin
* Added Integration To Aelia Currency Switcher Plugin
* Updated Code Standards
* Update Plugin For Latest WP & WooCommerce (WP : 4.3 | WC : 2.4.6)
* Minor Bug Fix
= 1.3 [25-06-2015] =
* Major Update [Had Some File Conflict.. please update your plugin too]
= 1.2 [23-06-2015] =
* Fixed Error Message at product price when viewing as visitor
= 1.1 [23-06-2015] =
* Fixed Simple & Variation Product Price At Checkout & Cart Page
* Code CleanUP
* Fixed Minor Issue
* Fixed Variation Role Based Box in Product Edit Page
* Added Plugin Translation Files [wc-rbp]
= 1.0 [22-06-2015] =
* Added Role Based Pricing For Variable / Variation Product [<a href="https://wordpress.org/support/topic/for-variation-products-1?replies=13"> For variation products </a> ]
* Fix Major Bugs
* Update Plugin For Latest WP & WooCommerce (WP : 4.2.2 | WC : 2.3.11)
* Option To Rename User Role (Affected Only For This Plugin) [<a href="https://wordpress.org/support/topic/rename-titles?replies=2"> Rename titles </a> ]
= 0.2 [26-02-2015] =
* Fixed Selling Price Display for role based Issue At [<a href="https://wordpress.org/support/topic/excellent-plugin-but-has-a-small-bug?replies=4#post-6620252">#6620252</a>]
= 0.1 [25-02-2015] =
* Base Version
\ No newline at end of file
<?php
/**
* Summary (no period for file headers)
*
* Description. (use period)
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/core
* @since 3.0
*/
if( ! defined('WP_UNINSTALL_PLUGIN') ) {
exit;
}
\ No newline at end of file
<?php
/**
* Plugin Name: Role Based Price For WooCommerce
* Plugin URI: https://wordpress.org/plugins/woocommerce-role-based-price/
* Description: Sell product in different price for different user role based on your settings.
* Version: 3.3.6
* Author: Varun Sridharan
* Author URI: http://varunsridharan.in
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: woocommerce-role-based-price
* Domain Path: /languages/
*/
if ( ! defined( 'WPINC' ) ) {
die;
}
define( 'WC_RBP_FILE', plugin_basename( __FILE__ ) );
define( 'WC_RBP_PATH', plugin_dir_path( __FILE__ ) ); # Plugin DIR
define( 'WC_RBP_INC', WC_RBP_PATH . 'includes/' ); # Plugin INC Folder
define( 'WC_RBP_DEPEN', 'woocommerce/woocommerce.php' );
define( 'WC_RBP_VARIABLE_VERSION', '3.3.6' );
register_activation_hook( __FILE__, 'wc_rbp_activate_plugin_name' );
register_deactivation_hook( __FILE__, 'wc_rbp_deactivate_plugin_name' );
register_deactivation_hook( WC_RBP_DEPEN, 'wc_rbp_dependency_plugin_deactivate' );
/**
* The code that runs during plugin activation.
* This action is documented in includes/class-plugin-name-activator.php
*/
function wc_rbp_activate_plugin_name() {
require_once( WC_RBP_INC . 'helpers/class-activator.php' );
woocommerce_role_based_price_Activator::activate();
}
/**
* The code that runs during plugin deactivation.
* This action is documented in includes/class-plugin-name-deactivator.php
*/
function wc_rbp_deactivate_plugin_name() {
require_once( WC_RBP_INC . 'helpers/class-deactivator.php' );
woocommerce_role_based_price_Deactivator::deactivate();
}
/**
* The code that runs during plugin deactivation.
* This action is documented in includes/class-plugin-name-deactivator.php
*/
function wc_rbp_dependency_plugin_deactivate() {
require_once( WC_RBP_INC . 'helpers/class-deactivator.php' );
woocommerce_role_based_price_Deactivator::dependency_deactivate();
}
require_once( WC_RBP_INC . 'functions.php' );
require_once( plugin_dir_path( __FILE__ ) . 'bootstrap.php' );
if ( ! function_exists( 'woocommerce_role_based_price' ) ) {
function woocommerce_role_based_price() {
return woocommerce_role_based_price::get_instance();
}
}
woocommerce_role_based_price();
\ No newline at end of file
<wpml-config>
<custom-fields>
<custom-field action="copy">_enable_role_based_price</custom-field>
<custom-field action="copy">_role_based_price</custom-field>
</custom-fields>
</wpml-config>
\ No newline at end of file