modified file smtp-mailer
@ -3,7 +3,7 @@
|
||||
* Plugin Name: ActivityPub
|
||||
* Plugin URI: https://github.com/pfefferle/wordpress-activitypub/
|
||||
* Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
|
||||
* Version: 2.3.0
|
||||
* Version: 2.3.1
|
||||
* Author: Matthias Pfefferle & Automattic
|
||||
* Author URI: https://automattic.com/
|
||||
* License: MIT
|
||||
@ -21,7 +21,7 @@ use function Activitypub\site_supports_blocks;
|
||||
require_once __DIR__ . '/includes/compat.php';
|
||||
require_once __DIR__ . '/includes/functions.php';
|
||||
|
||||
\define( 'ACTIVITYPUB_PLUGIN_VERSION', '2.3.0' );
|
||||
\define( 'ACTIVITYPUB_PLUGIN_VERSION', '2.3.1' );
|
||||
|
||||
/**
|
||||
* Initialize the plugin constants.
|
||||
|
@ -98,6 +98,11 @@ class Activity_Dispatcher {
|
||||
return;
|
||||
}
|
||||
|
||||
// do not announce replies
|
||||
if ( $wp_object instanceof WP_Comment ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$transformer = Factory::get_transformer( $wp_object );
|
||||
$transformer->change_wp_user_id( Users::BLOG_USER_ID );
|
||||
|
||||
|
@ -276,7 +276,7 @@ class Comment {
|
||||
}
|
||||
|
||||
// check for local comment
|
||||
if ( \wp_parse_url( \site_url(), \PHP_URL_HOST ) === \wp_parse_url( $url, \PHP_URL_HOST ) ) {
|
||||
if ( \wp_parse_url( \home_url(), \PHP_URL_HOST ) === \wp_parse_url( $url, \PHP_URL_HOST ) ) {
|
||||
$query = \wp_parse_url( $url, \PHP_URL_QUERY );
|
||||
|
||||
if ( $query ) {
|
||||
@ -379,12 +379,7 @@ class Comment {
|
||||
}
|
||||
|
||||
// generate URI based on comment ID
|
||||
return \add_query_arg(
|
||||
array(
|
||||
'c' => $comment->comment_ID,
|
||||
),
|
||||
\trailingslashit( site_url() )
|
||||
);
|
||||
return \add_query_arg( 'c', $comment->comment_ID, \home_url() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,7 @@ class Health_Check {
|
||||
}
|
||||
|
||||
public static function add_tests( $tests ) {
|
||||
if ( ! is_user_type_disabled( 'user' ) ) {
|
||||
if ( ! is_user_disabled( get_current_user_id() ) ) {
|
||||
$tests['direct']['activitypub_test_author_url'] = array(
|
||||
'label' => \__( 'Author URL test', 'activitypub' ),
|
||||
'test' => array( self::class, 'test_author_url' ),
|
||||
|
@ -66,14 +66,26 @@ class Http {
|
||||
/**
|
||||
* Send a GET Request with the needed HTTP Headers
|
||||
*
|
||||
* @param string $url The URL endpoint
|
||||
* @param int $user_id The WordPress User-ID
|
||||
* @param string $url The URL endpoint
|
||||
* @param bool|int $cached If the result should be cached, or its duration. Default: 1hr.
|
||||
*
|
||||
* @return array|WP_Error The GET Response or an WP_ERROR
|
||||
*/
|
||||
public static function get( $url ) {
|
||||
public static function get( $url, $cached = false ) {
|
||||
\do_action( 'activitypub_pre_http_get', $url );
|
||||
|
||||
if ( $cached ) {
|
||||
$transient_key = self::generate_cache_key( $url );
|
||||
|
||||
$response = \get_transient( $transient_key );
|
||||
|
||||
if ( $response ) {
|
||||
\do_action( 'activitypub_safe_remote_get_response', $response, $url );
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
$date = \gmdate( 'D, d M Y H:i:s T' );
|
||||
$signature = Signature::generate_signature( Users::APPLICATION_USER_ID, 'get', $url, $date );
|
||||
|
||||
@ -108,6 +120,14 @@ class Http {
|
||||
|
||||
\do_action( 'activitypub_safe_remote_get_response', $response, $url );
|
||||
|
||||
if ( $cached ) {
|
||||
$cache_duration = $cached;
|
||||
if ( ! is_int( $cache_duration ) ) {
|
||||
$cache_duration = HOUR_IN_SECONDS;
|
||||
}
|
||||
\set_transient( $transient_key, $response, $cache_duration );
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -130,4 +150,8 @@ class Http {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function generate_cache_key( $url ) {
|
||||
return 'activitypub_http_' . \md5( $url );
|
||||
}
|
||||
}
|
||||
|
@ -253,6 +253,11 @@ class Scheduler {
|
||||
} elseif ( empty( $meta ) || ! is_array( $meta ) || is_wp_error( $meta ) ) {
|
||||
if ( $follower->count_errors() >= 5 ) {
|
||||
$follower->delete();
|
||||
\wp_schedule_single_event(
|
||||
\time(),
|
||||
'activitypub_delete_actor_interactions',
|
||||
array( $follower->get_id() )
|
||||
);
|
||||
} else {
|
||||
Followers::add_error( $follower->get__id(), $meta );
|
||||
}
|
||||
|
@ -379,10 +379,10 @@ class Signature {
|
||||
if ( \preg_match( '/keyId="(.*?)"/ism', $signature, $matches ) ) {
|
||||
$parsed_header['keyId'] = trim( $matches[1] );
|
||||
}
|
||||
if ( \preg_match( '/created=([0-9]*)/ism', $signature, $matches ) ) {
|
||||
if ( \preg_match( '/created=["|\']*([0-9]*)["|\']*/ism', $signature, $matches ) ) {
|
||||
$parsed_header['(created)'] = trim( $matches[1] );
|
||||
}
|
||||
if ( \preg_match( '/expires=([0-9]*)/ism', $signature, $matches ) ) {
|
||||
if ( \preg_match( '/expires=["|\']*([0-9]*)["|\']*/ism', $signature, $matches ) ) {
|
||||
$parsed_header['(expires)'] = trim( $matches[1] );
|
||||
}
|
||||
if ( \preg_match( '/algorithm="(.*?)"/ism', $signature, $matches ) ) {
|
||||
@ -434,12 +434,22 @@ class Signature {
|
||||
// created in future
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! array_key_exists( '(created)', $headers ) ) {
|
||||
$signed_data .= $header . ': ' . $signature_block['(created)'] . "\n";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ( '(expires)' === $header ) {
|
||||
if ( ! empty( $signature_block['(expires)'] ) && \intval( $signature_block['(expires)'] ) < \time() ) {
|
||||
// expired in past
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! array_key_exists( '(expires)', $headers ) ) {
|
||||
$signed_data .= $header . ': ' . $signature_block['(expires)'] . "\n";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ( 'date' === $header ) {
|
||||
// allow a bit of leeway for misconfigured clocks.
|
||||
|
@ -4,6 +4,7 @@ namespace Activitypub\Collection;
|
||||
use WP_Error;
|
||||
use WP_Comment_Query;
|
||||
|
||||
use function Activitypub\object_to_uri;
|
||||
use function Activitypub\url_to_commentid;
|
||||
use function Activitypub\object_id_to_comment;
|
||||
use function Activitypub\get_remote_metadata_by_actor;
|
||||
@ -46,7 +47,8 @@ class Interactions {
|
||||
return false;
|
||||
}
|
||||
|
||||
$meta = get_remote_metadata_by_actor( $activity['actor'] );
|
||||
$actor = object_to_uri( $activity['actor'] );
|
||||
$meta = get_remote_metadata_by_actor( $actor );
|
||||
|
||||
if ( ! $meta || \is_wp_error( $meta ) ) {
|
||||
return false;
|
||||
|
@ -7,6 +7,7 @@ use Activitypub\Model\User;
|
||||
use Activitypub\Model\Blog_User;
|
||||
use Activitypub\Model\Application_User;
|
||||
|
||||
use function Activitypub\object_to_uri;
|
||||
use function Activitypub\url_to_authorid;
|
||||
use function Activitypub\is_user_disabled;
|
||||
|
||||
@ -136,6 +137,8 @@ class Users {
|
||||
* @return \Acitvitypub\Model\User The User.
|
||||
*/
|
||||
public static function get_by_resource( $resource ) {
|
||||
$resource = object_to_uri( $resource );
|
||||
|
||||
$scheme = 'acct';
|
||||
$match = array();
|
||||
// try to extract the scheme and the host
|
||||
|
@ -52,6 +52,17 @@ function get_remote_metadata_by_actor( $actor, $cached = true ) {
|
||||
if ( $pre ) {
|
||||
return $pre;
|
||||
}
|
||||
|
||||
if ( is_array( $actor ) ) {
|
||||
if ( array_key_exists( 'id', $actor ) ) {
|
||||
$actor = $actor['id'];
|
||||
} elseif ( array_key_exists( 'url', $actor ) ) {
|
||||
$actor = $actor['url'];
|
||||
} else {
|
||||
return new WP_Error( 'activitypub_no_valid_actor_identifier', \__( 'The "actor" identifier is not valid', 'activitypub' ), array( 'status' => 404, 'actor' => $actor ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( preg_match( '/^@?' . ACTIVITYPUB_USERNAME_REGEXP . '$/i', $actor ) ) {
|
||||
$actor = Webfinger::resolve( $actor );
|
||||
}
|
||||
@ -134,7 +145,7 @@ function url_to_authorid( $url ) {
|
||||
global $wp_rewrite;
|
||||
|
||||
// check if url hase the same host
|
||||
if ( \wp_parse_url( \site_url(), \PHP_URL_HOST ) !== \wp_parse_url( $url, \PHP_URL_HOST ) ) {
|
||||
if ( \wp_parse_url( \home_url(), \PHP_URL_HOST ) !== \wp_parse_url( $url, \PHP_URL_HOST ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,8 @@ namespace Activitypub\Handler;
|
||||
use Activitypub\Collection\Users;
|
||||
use Activitypub\Collection\Followers;
|
||||
|
||||
use function Activitypub\object_to_uri;
|
||||
|
||||
/**
|
||||
* Handle Undo requests
|
||||
*/
|
||||
@ -28,10 +30,10 @@ class Undo {
|
||||
if (
|
||||
isset( $activity['object']['type'] ) &&
|
||||
'Follow' === $activity['object']['type'] &&
|
||||
isset( $activity['object']['object'] ) &&
|
||||
filter_var( $activity['object']['object'], FILTER_VALIDATE_URL )
|
||||
isset( $activity['object']['object'] )
|
||||
) {
|
||||
$user = Users::get_by_resource( $activity['object']['object'] );
|
||||
$user_id = object_to_uri( $activity['object']['object'] );
|
||||
$user = Users::get_by_resource( $user_id );
|
||||
|
||||
if ( ! $user || is_wp_error( $user ) ) {
|
||||
// If we can not find a user,
|
||||
@ -40,8 +42,9 @@ class Undo {
|
||||
}
|
||||
|
||||
$user_id = $user->get__id();
|
||||
$actor = object_to_uri( $activity['actor'] );
|
||||
|
||||
Followers::remove_follower( $user_id, $activity['actor'] );
|
||||
Followers::remove_follower( $user_id, $actor );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -343,10 +343,10 @@ class Post extends Base {
|
||||
case 'core/cover':
|
||||
if ( ! empty( $block['attrs']['id'] ) ) {
|
||||
$alt = '';
|
||||
$check = preg_match( '/<img.*?alt=[\"\'](.*?)[\"\'].*>/i', $block['innerHTML'], $match );
|
||||
$check = preg_match( '/<img.*?alt\s*=\s*([\"\'])(.*?)\1.*>/i', $block['innerHTML'], $match );
|
||||
|
||||
if ( $check ) {
|
||||
$alt = $match[1];
|
||||
$alt = $match[2];
|
||||
}
|
||||
|
||||
$media['image'][] = array(
|
||||
@ -432,8 +432,8 @@ class Post extends Base {
|
||||
/**
|
||||
* Filter the image URL returned for each post.
|
||||
*
|
||||
* @param array|false $thumbnail The image URL, or false if no image is available.
|
||||
* @param int $id The attachment ID.
|
||||
* @param array|false $thumbnail The image URL, or false if no image is available.
|
||||
* @param int $id The attachment ID.
|
||||
* @param string $image_size The image size to retrieve. Set to 'full' by default.
|
||||
*/
|
||||
$thumbnail = apply_filters(
|
||||
@ -451,11 +451,11 @@ class Post extends Base {
|
||||
);
|
||||
|
||||
if ( ! empty( $media['alt'] ) ) {
|
||||
$image['name'] = \esc_attr( $media['alt'] );
|
||||
$image['name'] = \wp_strip_all_tags( \html_entity_decode( $media['alt'] ) );
|
||||
} else {
|
||||
$alt = \get_post_meta( $id, '_wp_attachment_image_alt', true );
|
||||
if ( $alt ) {
|
||||
$image['name'] = \esc_attr( $alt );
|
||||
$image['name'] = \wp_strip_all_tags( \html_entity_decode( $alt ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,10 +3,14 @@ namespace Activitypub\Integration;
|
||||
|
||||
use DateTime;
|
||||
use Activitypub\Webfinger as Webfinger_Util;
|
||||
use Activitypub\Http;
|
||||
use Activitypub\Collection\Users;
|
||||
use Activitypub\Collection\Followers;
|
||||
use Activitypub\Integration\Nodeinfo;
|
||||
use Enable_Mastodon_Apps\Mastodon_API;
|
||||
use Enable_Mastodon_Apps\Entity\Account;
|
||||
use Enable_Mastodon_Apps\Entity\Status;
|
||||
use Enable_Mastodon_Apps\Entity\Media_Attachment;
|
||||
|
||||
use function Activitypub\get_remote_metadata_by_actor;
|
||||
|
||||
@ -23,9 +27,11 @@ class Enable_Mastodon_Apps {
|
||||
*/
|
||||
public static function init() {
|
||||
\add_filter( 'mastodon_api_account_followers', array( self::class, 'api_account_followers' ), 10, 2 );
|
||||
\add_filter( 'mastodon_api_account', array( self::class, 'api_account' ), 20, 2 );
|
||||
\add_filter( 'mastodon_api_account', array( self::class, 'api_account_add_followers' ), 20, 2 );
|
||||
\add_filter( 'mastodon_api_account', array( self::class, 'api_account_external' ), 10, 2 );
|
||||
\add_filter( 'mastodon_api_search', array( self::class, 'api_search' ), 40, 2 );
|
||||
\add_filter( 'mastodon_api_get_posts_query_args', array( self::class, 'api_get_posts_query_args' ) );
|
||||
\add_filter( 'mastodon_api_statuses', array( self::class, 'api_statuses_external' ), 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -95,8 +101,8 @@ class Enable_Mastodon_Apps {
|
||||
*
|
||||
* @return Enable_Mastodon_Apps\Entity\Account The filtered Account
|
||||
*/
|
||||
public static function api_account( $account, $user_id ) {
|
||||
if ( ! $account instanceof Account ) {
|
||||
public static function api_account_add_followers( $account, $user_id ) {
|
||||
if ( ! $account instanceof Account || ! is_numeric( $user_id ) ) {
|
||||
return $account;
|
||||
}
|
||||
|
||||
@ -121,8 +127,9 @@ class Enable_Mastodon_Apps {
|
||||
}
|
||||
}
|
||||
|
||||
$account->acct = $user->get_webfinger();
|
||||
$account->acct = $user->get_preferred_username();
|
||||
$account->note = $user->get_summary();
|
||||
|
||||
$account->followers_count = Followers::count_followers( $user_id );
|
||||
return $account;
|
||||
}
|
||||
@ -136,34 +143,47 @@ class Enable_Mastodon_Apps {
|
||||
* @return Enable_Mastodon_Apps\Entity\Account The filtered Account
|
||||
*/
|
||||
public static function api_account_external( $user_data, $user_id ) {
|
||||
if ( ! preg_match( '/^' . ACTIVITYPUB_USERNAME_REGEXP . '$/', $user_id ) ) {
|
||||
if ( $user_data || is_numeric( $user_id ) ) {
|
||||
// Only augment.
|
||||
return $user_data;
|
||||
}
|
||||
|
||||
$uri = Webfinger_Util::resolve( $user_id );
|
||||
|
||||
if ( ! $uri ) {
|
||||
if ( ! $uri || is_wp_error( $uri ) ) {
|
||||
return $user_data;
|
||||
}
|
||||
|
||||
$acct = Webfinger_Util::uri_to_acct( $uri );
|
||||
$account = self::get_account_for_actor( $uri );
|
||||
if ( $account ) {
|
||||
return $account;
|
||||
}
|
||||
|
||||
return $user_data;
|
||||
}
|
||||
|
||||
private static function get_account_for_actor( $uri ) {
|
||||
if ( ! is_string( $uri ) ) {
|
||||
return null;
|
||||
}
|
||||
$data = get_remote_metadata_by_actor( $uri );
|
||||
|
||||
if ( ! $data || is_wp_error( $data ) ) {
|
||||
return $user_data;
|
||||
return null;
|
||||
}
|
||||
$account = new Account();
|
||||
|
||||
$acct = Webfinger_Util::uri_to_acct( $uri );
|
||||
if ( str_starts_with( $acct, 'acct:' ) ) {
|
||||
$acct = substr( $acct, 5 );
|
||||
}
|
||||
|
||||
if ( $user_data instanceof Account ) {
|
||||
$account = $user_data;
|
||||
} else {
|
||||
$account = new Account();
|
||||
}
|
||||
|
||||
$account->id = strval( $user_id );
|
||||
$account->id = $acct;
|
||||
$account->username = $acct;
|
||||
$account->acct = $acct;
|
||||
$account->display_name = $data['name'];
|
||||
$account->url = $uri;
|
||||
|
||||
if ( ! empty( $data['summary'] ) ) {
|
||||
$account->note = $data['summary'];
|
||||
}
|
||||
@ -178,8 +198,8 @@ class Enable_Mastodon_Apps {
|
||||
}
|
||||
|
||||
if ( isset( $data['image'] ) ) {
|
||||
$account->header = $data['image'];
|
||||
$account->header_static = $data['image'];
|
||||
$account->header = $data['image']['url'];
|
||||
$account->header_static = $data['image']['url'];
|
||||
}
|
||||
|
||||
$account->created_at = new DateTime( $data['published'] );
|
||||
@ -233,4 +253,114 @@ class Enable_Mastodon_Apps {
|
||||
|
||||
return $search_data;
|
||||
}
|
||||
|
||||
public function api_get_posts_query_args( $args ) {
|
||||
if ( isset( $args['author'] ) && is_string( $args['author'] ) ) {
|
||||
$uri = Webfinger_Util::resolve( $args['author'] );
|
||||
if ( $uri && ! is_wp_error( $uri ) ) {
|
||||
$args['activitypub'] = $uri;
|
||||
unset( $args['author'] );
|
||||
}
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
public static function api_statuses_external( $statuses, $args ) {
|
||||
if ( ! isset( $args['activitypub'] ) ) {
|
||||
return $statuses;
|
||||
}
|
||||
|
||||
$data = get_remote_metadata_by_actor( $args['activitypub'] );
|
||||
|
||||
if ( ! $data || is_wp_error( $data ) || ! isset( $data['outbox'] ) ) {
|
||||
return $statuses;
|
||||
}
|
||||
|
||||
$response = Http::get( $data['outbox'], true );
|
||||
if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) !== 200 ) {
|
||||
return $statuses;
|
||||
}
|
||||
|
||||
$outbox = json_decode( wp_remote_retrieve_body( $response ), true );
|
||||
if ( ! $outbox || is_wp_error( $outbox ) || ! isset( $outbox['first'] ) ) {
|
||||
return $statuses;
|
||||
}
|
||||
|
||||
$account = self::get_account_for_actor( $args['activitypub'] );
|
||||
if ( ! $account ) {
|
||||
return $statuses;
|
||||
}
|
||||
|
||||
$response = Http::get( $outbox['first'], true );
|
||||
if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) !== 200 ) {
|
||||
return $statuses;
|
||||
}
|
||||
$posts = json_decode( wp_remote_retrieve_body( $response ), true );
|
||||
|
||||
$activitypub_statuses = array_map(
|
||||
function ( $item ) use ( $account ) {
|
||||
$object = $item['object'];
|
||||
if ( ! isset( $object['type'] ) || 'Note' !== $object['type'] ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$status = new Status();
|
||||
$status->id = Mastodon_API::remap_url( $object['id'] );
|
||||
$status->created_at = new DateTime( $object['published'] );
|
||||
$status->content = $object['content'];
|
||||
$status->account = $account;
|
||||
|
||||
if ( ! empty( $object['inReplyTo'] ) ) {
|
||||
$status->in_reply_to_id = $object['inReplyTo'];
|
||||
}
|
||||
|
||||
if ( ! empty( $object['visibility'] ) ) {
|
||||
$status->visibility = $object['visibility'];
|
||||
}
|
||||
|
||||
$status->uri = $object['url'];
|
||||
|
||||
if ( ! empty( $object['attachment'] ) ) {
|
||||
$status->media_attachments = array_map(
|
||||
function ( $attachment ) {
|
||||
$default_attachment = array(
|
||||
'url' => null,
|
||||
'mediaType' => null,
|
||||
'name' => null,
|
||||
'width' => 0,
|
||||
'height' => 0,
|
||||
'blurhash' => null,
|
||||
);
|
||||
|
||||
$attachment = array_merge( $default_attachment, $attachment );
|
||||
|
||||
$media_attachment = new Media_Attachment();
|
||||
$media_attachment->id = Mastodon_API::remap_url( $attachment['url'], $attachment );
|
||||
$media_attachment->type = strtok( $attachment['mediaType'], '/' );
|
||||
$media_attachment->url = $attachment['url'];
|
||||
$media_attachment->preview_url = $attachment['url'];
|
||||
$media_attachment->description = $attachment['name'];
|
||||
$media_attachment->blurhash = $attachment['blurhash'];
|
||||
$media_attachment->meta = array(
|
||||
'original' => array(
|
||||
'width' => $attachment['width'],
|
||||
'height' => $attachment['height'],
|
||||
'size' => $attachment['width'] . 'x' . $attachment['height'],
|
||||
'aspect' => $attachment['width'] / $attachment['height'],
|
||||
),
|
||||
);
|
||||
return $media_attachment;
|
||||
},
|
||||
$object['attachment']
|
||||
);
|
||||
}
|
||||
|
||||
return $status;
|
||||
},
|
||||
$posts['orderedItems']
|
||||
);
|
||||
|
||||
return $activitypub_statuses;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ Contributors: automattic, pfefferle, mediaformat, mattwiebe, akirk, jeherve, nur
|
||||
Tags: OStatus, fediverse, activitypub, activitystream
|
||||
Requires at least: 5.5
|
||||
Tested up to: 6.5
|
||||
Stable tag: 2.3.0
|
||||
Stable tag: 2.3.1
|
||||
Requires PHP: 5.6
|
||||
License: MIT
|
||||
License URI: http://opensource.org/licenses/MIT
|
||||
@ -133,6 +133,17 @@ For reasons of data protection, it is not possible to see the followers of other
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 2.3.1 =
|
||||
|
||||
* Added: Enable Mastodon Apps: Add remote outbox fetching
|
||||
* Added: Help texts
|
||||
* Fixed: Compatibility issues with Discourse
|
||||
* Fixed: Do not announce replies
|
||||
* Fixed: Also delete interactions with deleted person
|
||||
* Fixed: Check Author-URL only if user is enabled for ActivityPub
|
||||
* Fixed: Generate comment IDs for federation from home_url
|
||||
* Removed: Beta label from the #Hashtag settings
|
||||
|
||||
= 2.3.0 =
|
||||
|
||||
* Added: Mark links as "unhandled-link" and "status-link", for a better UX in the Mastodon App
|
||||
@ -152,13 +163,6 @@ For reasons of data protection, it is not possible to see the followers of other
|
||||
* Changed: Remote Reply: limit enqueue to when needed
|
||||
* Changed: Abstract shared Dialog code
|
||||
|
||||
|
||||
= 2.2.0 =
|
||||
|
||||
* Added: Remote-Reply lightbox
|
||||
* Added: Support `application/ld+json` mime-type with AP profile in WebFinger
|
||||
* Fixed: Prevent scheduler overload
|
||||
|
||||
See full Changelog on [GitHub](https://github.com/Automattic/wordpress-activitypub/blob/master/CHANGELOG.md).
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
@ -30,7 +30,10 @@
|
||||
</label>
|
||||
</p>
|
||||
<p class="description">
|
||||
<?php echo \wp_kses( \__( 'Every author on this blog (with the <code>publish_posts</code> capability) gets their own ActivityPub profile.', 'activitypub' ), array( 'code' => array() ) ); ?>
|
||||
<?php echo \wp_kses( \__( 'Every author on this blog (with the <code>activitypub</code> capability) gets their own ActivityPub profile.', 'activitypub' ), array( 'code' => array() ) ); ?>
|
||||
<?php // translators: %s is a URL. ?>
|
||||
<strong><?php echo \wp_kses( sprintf( \__( 'You can add/remove the capability in the <a href="%s">user settings.</a>', 'activitypub' ), admin_url( '/users.php' ) ), array( 'a' => array( 'href' => array() ) ) ); ?></strong>
|
||||
<?php echo \wp_kses( \__( 'Select all the users you want to update, choose the method from the drop-down list and click on the "Apply" button.', 'activitypub' ), array( 'code' => array() ) ); ?>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
@ -218,11 +221,11 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php \esc_html_e( 'Hashtags (beta)', 'activitypub' ); ?>
|
||||
<?php \esc_html_e( 'Hashtags', 'activitypub' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<label><input type="checkbox" name="activitypub_use_hashtags" id="activitypub_use_hashtags" value="1" <?php echo \checked( '1', \get_option( 'activitypub_use_hashtags', '1' ) ); ?> /> <?php echo wp_kses( \__( 'Add hashtags in the content as native tags and replace the <code>#tag</code> with the tag link. <strong>This feature is experimental! Please disable it, if you find any HTML or CSS errors.</strong>', 'activitypub' ), 'default' ); ?></label>
|
||||
<label><input type="checkbox" name="activitypub_use_hashtags" id="activitypub_use_hashtags" value="1" <?php echo \checked( '1', \get_option( 'activitypub_use_hashtags', '1' ) ); ?> /> <?php echo wp_kses( \__( 'Add hashtags in the content as native tags and replace the <code>#tag</code> with the tag link.', 'activitypub' ), 'default' ); ?></label>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phive xmlns="https://phar.io/phive">
|
||||
<phar name="phpunit" version="^9.5.21" installed="9.5.21" location="./tools/phpunit" copy="true"/>
|
||||
<phar name="phpcs" version="^3.7.1" installed="3.7.1" location="./tools/phpcs" copy="true"/>
|
||||
<phar name="phpcbf" version="^3.7.1" installed="3.7.1" location="./tools/phpcbf" copy="true"/>
|
||||
<phar name="behat/behat" version="^3.13.0" installed="3.13.0" location="./tools/behat" copy="true"/>
|
||||
<phar name="wp-cli/wp-cli" version="^2.9.0" installed="2.9.0" location="./tools/wp-cli" copy="true"/>
|
||||
</phive>
|
@ -0,0 +1,7 @@
|
||||
Copyright <YEAR> <COPYRIGHT HOLDER>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
95
wp-content/upgrade-temp-backup/plugins/authldap/README.md
Normal file
@ -0,0 +1,95 @@
|
||||
# authLDAP
|
||||
|
||||
[![Join the chat at https://gitter.im/heiglandreas/authLdap](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/heiglandreas/authLdap?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
Use your existing LDAP as authentication-backend for your wordpress!
|
||||
|
||||
[![Build Status](https://github.com/heiglandreas/authLdap/actions/workflows/tests.yml/badge.svg)](https://github.com/heiglandreas/authLdap/actions/workflows/tests.yml)
|
||||
[![WordPress Stats](https://img.shields.io/wordpress/plugin/dt/authldap.svg)](https://wordpress.org/plugins/authldap/stats/)
|
||||
[![WordPress Version](https://img.shields.io/wordpress/plugin/v/authldap.svg)](https://wordpress.org/plugins/authldap/)
|
||||
[![WordPress testet](https://img.shields.io/wordpress/v/authldap.svg)](https://wordpress.org/plugins/authldap/)
|
||||
[![Code Climate](https://codeclimate.com/github/heiglandreas/authLdap/badges/gpa.svg)](https://codeclimate.com/github/heiglandreas/authLdap)
|
||||
[![codecov](https://codecov.io/gh/heiglandreas/authLdap/branch/master/graph/badge.svg?token=AYAhEeWtRQ)](https://codecov.io/gh/heiglandreas/authLdap)
|
||||
|
||||
So what are the differences to other Wordpress-LDAP-Authentication-Plugins?
|
||||
|
||||
* **Flexible**: You are totaly free in which LDAP-backend to use. Due to the extensive configuration you can
|
||||
freely decide how to do the authentication of your users. It simply depends on your
|
||||
filters
|
||||
* **Independent**: As soon as a user logs in, it is added/updated to the Wordpress' user-database
|
||||
to allow wordpress to always use the correct data. You only have to administer your users once.
|
||||
* **Failsafe**: Due to the users being created in Wordpress' User-database they can
|
||||
also log in when the LDAP-backend currently is gone.
|
||||
* **Role-Aware**: You can map Wordpress' roles to values of an existing LDAP-attribute.
|
||||
|
||||
## How does the plugin work?
|
||||
|
||||
Well, as a matter of fact it is rather simple. The plugin verifies, that the user
|
||||
seeking authentification can bind to the LDAP using the provided password.
|
||||
|
||||
If that is so, the user is either created or updated in the wordpress-user-database.
|
||||
This update includes the provided password (so the wordpress can authenticate users
|
||||
even without the LDAP), the users name according to the authLDAP-preferences and
|
||||
the status of the user depending on the groups-settings of the authLDAP-preferences
|
||||
|
||||
Writing this plugin would not have been as easy as it has been, without the
|
||||
wonderfull plugin of Alistair Young from http://www.weblogs.uhi.ac.uk/sm00ay/?p=45
|
||||
|
||||
## Configuration
|
||||
|
||||
### Usage Settings
|
||||
|
||||
* **Enable Authentication via LDAP** Whether you want to enable authLdap for login or not
|
||||
* **debug authLdap** When you have problems with authentication via LDAP you can enable a debugging mode here.
|
||||
* **Save entered Password** Decide whether passwords will be cached in your wordpress-installation. **Attention:** Without the cache your users will not be able to log into your site when your LDAP is down!
|
||||
|
||||
### Server Settings
|
||||
|
||||
* **LDAP Uri** This is the URI where your ldap-backend can be reached. More information are actually on the Configuration page
|
||||
* **Filter** This is the real McCoy! The filter you define here specifies how a user will be found. Before applying the filter a %s will be replaced with the given username. This means, when a user logs in using ‘foobar’ as username the following happens:
|
||||
|
||||
* **uid=%1$s** check for any LDAP-Entry that has an attribute ‘uid’ with value ‘foobar’
|
||||
* **(&(objectclass=posixAccount)(|(uid=%1$s)(mail=%1$s)))** check for any LDAP-Entry that has an attribute ‘objectclass’ with value ‘posixAccout’ and either a UID- or a mail-attribute with value ‘foobar’
|
||||
|
||||
This filter is rather powerfull if used wisely.
|
||||
|
||||
### Creating Users
|
||||
|
||||
* **Name-Attribute** Which Attribute from the LDAP contains the Full or the First name of the user trying to log in. This defaults to name
|
||||
* **Second Name Attribute** If the above Name-Attribute only contains the First Name of the user you can here specify an Attribute that contains the second name. This field is empty by default
|
||||
* **User-ID Attribute** This field will be used as login-name for wordpress. Please give the Attribute, that is used to identify the user. This should be the same as you used in the above Filter-Option. This field defaults to uid
|
||||
* **Mail Attribute** Which Attribute holds the eMail-Address of the user? If more than one eMail-Address are stored in the LDAP, only the first given is used. This field defaults to mail
|
||||
* **Web-Attribute** If your users have a personal page (URI) stored in the LDAP, it can be provided here. This field is empty by default
|
||||
|
||||
### User-Groups for Roles
|
||||
|
||||
* **Group-Attribute** This is the attribute that defines the Group-ID that can be matched against the Groups defined further down This field defaults to gidNumber.
|
||||
* **Group-Filter** Here you can add the filter for selecting groups for the currentlly logged in user The Filter should contain the string %s which will be replaced by the login-name of the currently logged in
|
||||
|
||||
|
||||
## FAQ
|
||||
|
||||
<dl>
|
||||
<dt>Can I change a users password with this plugin?</dt>
|
||||
<dd>Short Answer: <strong>No</strong>!<br>Long Answer: As the users credentials are not
|
||||
only used for a wordpress-site when you authenticate against an LDAP but for
|
||||
many other services also chances are great that there is a centralized place
|
||||
where password-changes shall be made. We'll later allow inclusion of a link
|
||||
to such a place but currently it's not available. And as password-hashing and
|
||||
where to store it requires deeper insight into the LDAP-Server then most users
|
||||
have and admins are willing to give, password changes are out of scope of this
|
||||
plugin. If you know exactyl what you do, you might want to have a look at
|
||||
<a href="https://github.com/heiglandreas/authLdap/issues/54#issuecomment-125851029">
|
||||
issue 54</a>
|
||||
wherer a way of adding it is described!
|
||||
</dd>
|
||||
<dt>Can I add a user to the LDAP when she creates a user-account on wordpress?</dt>
|
||||
<dd>Short Answer: <strong>No</strong>!<br>Long Answer: Even though that is technically possible
|
||||
it's not in the scope of this plugin. As creating a user in an LDAP often involves
|
||||
an administrative process that has already been implemented in your departments
|
||||
administration it doesn't make sense to rebuild that - in most cases highly
|
||||
individual - process in this plugin. If you know exactly what you do, have a look at
|
||||
<a href="https://github.com/heiglandreas/authLdap/issues/65">issue 65</a>
|
||||
where <a href="https://github.com/wtfiwtz">wtfiwtz</a> shows how to implement that feature.
|
||||
</dd>
|
||||
</dl>
|
18
wp-content/upgrade-temp-backup/plugins/authldap/SECURITY.md
Normal file
@ -0,0 +1,18 @@
|
||||
# Security-Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| ------- |--------------------|
|
||||
| 2.x | :white_check_mark: |
|
||||
| 1.x | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
* Check our security.txt file for details on how to contact us
|
||||
* Contact us before publicly disclosing the issue anywhere else
|
||||
|
||||
This plugin is developed as OpenSource under the MIT licence.
|
||||
There is no money earned from it. Therefore we are not able to
|
||||
provide any bug-bounties whatsoever. You will be mentioned in the
|
||||
release notes of a fix-release though.
|
13
wp-content/upgrade-temp-backup/plugins/authldap/authLdap.css
Normal file
@ -0,0 +1,13 @@
|
||||
.row {
|
||||
overflow: hidden;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.element {
|
||||
float: right;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.authldap-options input[type=text] {
|
||||
width: 100%;
|
||||
}
|
946
wp-content/upgrade-temp-backup/plugins/authldap/authLdap.php
Normal file
@ -0,0 +1,946 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Plugin Name: AuthLDAP
|
||||
Plugin URI: https://github.com/heiglandreas/authLdap
|
||||
Description: This plugin allows you to use your existing LDAP as authentication base for WordPress
|
||||
Version: 2.6.0
|
||||
Author: Andreas Heigl <andreas@heigl.org>
|
||||
Author URI: http://andreas.heigl.org
|
||||
License: MIT
|
||||
License URI: https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
|
||||
use Org_Heigl\AuthLdap\LdapList;
|
||||
use Org_Heigl\AuthLdap\LdapUri;
|
||||
use Org_Heigl\AuthLdap\Manager\Ldap;
|
||||
use Org_Heigl\AuthLdap\UserRoleHandler;
|
||||
use Org_Heigl\AuthLdap\Wrapper\LdapFactory;
|
||||
|
||||
require_once __DIR__ . '/src/Wrapper/LdapInterface.php';
|
||||
require_once __DIR__ . '/src/Exception/Error.php';
|
||||
require_once __DIR__ . '/src/Exception/InvalidLdapUri.php';
|
||||
require_once __DIR__ . '/src/Exception/Error.php';
|
||||
require_once __DIR__ . '/src/Exception/InvalidLdapUri.php';
|
||||
require_once __DIR__ . '/src/Exception/MissingValidLdapConnection.php';
|
||||
require_once __DIR__ . '/src/Exception/SearchUnsuccessfull.php';
|
||||
require_once __DIR__ . '/src/Manager/Ldap.php';
|
||||
require_once __DIR__ . '/src/Wrapper/Ldap.php';
|
||||
require_once __DIR__ . '/src/Wrapper/LdapFactory.php';
|
||||
require_once __DIR__ . '/src/LdapList.php';
|
||||
require_once __DIR__ . '/src/LdapUri.php';
|
||||
require_once __DIR__ . '/src/UserRoleHandler.php';
|
||||
|
||||
function authLdap_debug($message)
|
||||
{
|
||||
if (authLdap_get_option('Debug')) {
|
||||
error_log('[AuthLDAP] ' . $message, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function authLdap_addmenu()
|
||||
{
|
||||
if (!is_multisite()) {
|
||||
add_options_page(
|
||||
'AuthLDAP',
|
||||
'AuthLDAP',
|
||||
'manage_options',
|
||||
basename(__FILE__),
|
||||
'authLdap_options_panel'
|
||||
);
|
||||
} else {
|
||||
add_submenu_page(
|
||||
'settings.php',
|
||||
'AuthLDAP',
|
||||
'AuthLDAP',
|
||||
'manage_options',
|
||||
'authldap',
|
||||
'authLdap_options_panel'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function authLdap_get_post($name, $default = '')
|
||||
{
|
||||
return isset($_POST[$name]) ? $_POST[$name] : $default;
|
||||
}
|
||||
|
||||
function authLdap_options_panel()
|
||||
{
|
||||
// inclusde style sheet
|
||||
wp_enqueue_style('authLdap-style', plugin_dir_url(__FILE__) . 'authLdap.css');
|
||||
|
||||
if (($_SERVER['REQUEST_METHOD'] == 'POST') && array_key_exists('ldapOptionsSave', $_POST)) {
|
||||
if (!isset($_POST['authLdapNonce'])) {
|
||||
die("Go away!");
|
||||
}
|
||||
if (!wp_verify_nonce($_POST['authLdapNonce'],'authLdapNonce')) {
|
||||
die("Go away!");
|
||||
}
|
||||
|
||||
$new_options = [
|
||||
'Enabled' => authLdap_get_post('authLDAPAuth', false),
|
||||
'CachePW' => authLdap_get_post('authLDAPCachePW', false),
|
||||
'URI' => authLdap_get_post('authLDAPURI'),
|
||||
'URISeparator' => authLdap_get_post('authLDAPURISeparator'),
|
||||
'StartTLS' => authLdap_get_post('authLDAPStartTLS', false),
|
||||
'Filter' => authLdap_get_post('authLDAPFilter'),
|
||||
'NameAttr' => authLdap_get_post('authLDAPNameAttr'),
|
||||
'SecName' => authLdap_get_post('authLDAPSecName'),
|
||||
'UidAttr' => authLdap_get_post('authLDAPUidAttr'),
|
||||
'MailAttr' => authLdap_get_post('authLDAPMailAttr'),
|
||||
'WebAttr' => authLdap_get_post('authLDAPWebAttr'),
|
||||
'Groups' => authLdap_get_post('authLDAPGroups', []),
|
||||
'GroupSeparator' => authLdap_get_post('authLDAPGroupSeparator', ','),
|
||||
'Debug' => authLdap_get_post('authLDAPDebug', false),
|
||||
'GroupBase' => authLdap_get_post('authLDAPGroupBase'),
|
||||
'GroupAttr' => authLdap_get_post('authLDAPGroupAttr'),
|
||||
'GroupFilter' => authLdap_get_post('authLDAPGroupFilter'),
|
||||
'DefaultRole' => authLdap_get_post('authLDAPDefaultRole'),
|
||||
'GroupEnable' => authLdap_get_post('authLDAPGroupEnable', false),
|
||||
'GroupOverUser' => authLdap_get_post('authLDAPGroupOverUser', false),
|
||||
'DoNotOverwriteNonLdapUsers' => authLdap_get_post('authLDAPDoNotOverwriteNonLdapUsers', false),
|
||||
'UserRead' => authLdap_get_post('authLDAPUseUserAccount', false),
|
||||
];
|
||||
if (authLdap_set_options($new_options)) {
|
||||
echo "<div class='updated'><p>Saved Options!</p></div>";
|
||||
} else {
|
||||
echo "<div class='error'><p>Could not save Options!</p></div>";
|
||||
}
|
||||
}
|
||||
|
||||
// Do some initialization for the admin-view
|
||||
$authLDAP = authLdap_get_option('Enabled');
|
||||
$authLDAPCachePW = authLdap_get_option('CachePW');
|
||||
$authLDAPURI = authLdap_get_option('URI');
|
||||
$authLDAPURISeparator = authLdap_get_option('URISeparator');
|
||||
$authLDAPStartTLS = authLdap_get_option('StartTLS');
|
||||
$authLDAPFilter = authLdap_get_option('Filter');
|
||||
$authLDAPNameAttr = authLdap_get_option('NameAttr');
|
||||
$authLDAPSecName = authLdap_get_option('SecName');
|
||||
$authLDAPMailAttr = authLdap_get_option('MailAttr');
|
||||
$authLDAPUidAttr = authLdap_get_option('UidAttr');
|
||||
$authLDAPWebAttr = authLdap_get_option('WebAttr');
|
||||
$authLDAPGroups = authLdap_get_option('Groups');
|
||||
$authLDAPGroupSeparator = authLdap_get_option('GroupSeparator');
|
||||
$authLDAPDebug = authLdap_get_option('Debug');
|
||||
$authLDAPGroupBase = authLdap_get_option('GroupBase');
|
||||
$authLDAPGroupAttr = authLdap_get_option('GroupAttr');
|
||||
$authLDAPGroupFilter = authLdap_get_option('GroupFilter');
|
||||
$authLDAPDefaultRole = authLdap_get_option('DefaultRole');
|
||||
$authLDAPGroupEnable = authLdap_get_option('GroupEnable');
|
||||
$authLDAPGroupOverUser = authLdap_get_option('GroupOverUser');
|
||||
$authLDAPDoNotOverwriteNonLdapUsers = authLdap_get_option('DoNotOverwriteNonLdapUsers');
|
||||
$authLDAPUseUserAccount = authLdap_get_option('UserRead');
|
||||
|
||||
$tChecked = ($authLDAP) ? ' checked="checked"' : '';
|
||||
$tDebugChecked = ($authLDAPDebug) ? ' checked="checked"' : '';
|
||||
$tPWChecked = ($authLDAPCachePW) ? ' checked="checked"' : '';
|
||||
$tGroupChecked = ($authLDAPGroupEnable) ? ' checked="checked"' : '';
|
||||
$tGroupOverUserChecked = ($authLDAPGroupOverUser) ? ' checked="checked"' : '';
|
||||
$tStartTLSChecked = ($authLDAPStartTLS) ? ' checked="checked"' : '';
|
||||
$tDoNotOverwriteNonLdapUsers = ($authLDAPDoNotOverwriteNonLdapUsers) ? ' checked="checked"' : '';
|
||||
$tUserRead = ($authLDAPUseUserAccount) ? ' checked="checked"' : '';
|
||||
|
||||
$roles = new WP_Roles();
|
||||
|
||||
$action = $_SERVER['REQUEST_URI'];
|
||||
if (!extension_loaded('ldap')) {
|
||||
echo '<div class="warning">The LDAP-Extension is not available on your '
|
||||
. 'WebServer. Therefore Everything you can alter here does not '
|
||||
. 'make any sense!</div>';
|
||||
}
|
||||
|
||||
include dirname(__FILE__) . '/view/admin.phtml';
|
||||
}
|
||||
|
||||
/**
|
||||
* get a LDAP server object
|
||||
*
|
||||
* throws exception if there is a problem connecting
|
||||
*
|
||||
* @conf boolean authLDAPDebug true, if debugging should be turned on
|
||||
* @conf string authLDAPURI LDAP server URI
|
||||
*
|
||||
* @return Org_Heigl\AuthLdap\LdapList LDAP server object
|
||||
*/
|
||||
function authLdap_get_server()
|
||||
{
|
||||
static $_ldapserver = null;
|
||||
if (is_null($_ldapserver)) {
|
||||
$authLDAPDebug = authLdap_get_option('Debug');
|
||||
$authLDAPURI = explode(
|
||||
authLdap_get_option('URISeparator', ' '),
|
||||
authLdap_get_option('URI')
|
||||
);
|
||||
$authLDAPStartTLS = authLdap_get_option('StartTLS');
|
||||
|
||||
//$authLDAPURI = 'ldap:/foo:bar@server/trallala';
|
||||
authLdap_debug('connect to LDAP server');
|
||||
require_once dirname(__FILE__) . '/src/LdapList.php';
|
||||
$_ldapserver = new LdapList();
|
||||
foreach ($authLDAPURI as $uri) {
|
||||
$_ldapserver->addLdap(new Ldap(
|
||||
new LdapFactory(),
|
||||
LdapUri::fromString($uri),
|
||||
$authLDAPStartTLS
|
||||
));
|
||||
}
|
||||
}
|
||||
return $_ldapserver;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method authenticates a user using either the LDAP or, if LDAP is not
|
||||
* available, the local database
|
||||
*
|
||||
* For this we store the hashed passwords in the WP_Database to ensure working
|
||||
* conditions even without an LDAP-Connection
|
||||
*
|
||||
* @param null|WP_User|WP_Error
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param boolean $already_md5
|
||||
* @return boolean true, if login was successfull or false, if it wasn't
|
||||
* @conf boolean authLDAP true, if authLDAP should be used, false if not. Defaults to false
|
||||
* @conf string authLDAPFilter LDAP filter to use to find correct user, defaults to '(uid=%s)'
|
||||
* @conf string authLDAPNameAttr LDAP attribute containing user (display) name, defaults to 'name'
|
||||
* @conf string authLDAPSecName LDAP attribute containing second name, defaults to ''
|
||||
* @conf string authLDAPMailAttr LDAP attribute containing user e-mail, defaults to 'mail'
|
||||
* @conf string authLDAPUidAttr LDAP attribute containing user id (the username we log on with), defaults to 'uid'
|
||||
* @conf string authLDAPWebAttr LDAP attribute containing user website, defaults to ''
|
||||
* @conf string authLDAPDefaultRole default role for authenticated user, defaults to ''
|
||||
* @conf boolean authLDAPGroupEnable true, if we try to map LDAP groups to Wordpress roles
|
||||
* @conf boolean authLDAPGroupOverUser true, if LDAP Groups have precedence over existing user roles
|
||||
*/
|
||||
function authLdap_login($user, $username, $password, $already_md5 = false)
|
||||
{
|
||||
// don't do anything when authLDAP is disabled
|
||||
if (!authLdap_get_option('Enabled')) {
|
||||
authLdap_debug(
|
||||
'LDAP disabled in AuthLDAP plugin options (use the first option in the AuthLDAP options to enable it)'
|
||||
);
|
||||
return $user;
|
||||
}
|
||||
|
||||
// If the user has already been authenticated (only in that case we get a
|
||||
// WP_User-Object as $user) we skip LDAP-authentication and simply return
|
||||
// the existing user-object
|
||||
if ($user instanceof WP_User) {
|
||||
authLdap_debug(sprintf(
|
||||
'User %s has already been authenticated - skipping LDAP-Authentication',
|
||||
$user->get('nickname')
|
||||
));
|
||||
return $user;
|
||||
}
|
||||
|
||||
authLdap_debug("User '$username' logging in");
|
||||
|
||||
if ($username == 'admin') {
|
||||
authLdap_debug('Doing nothing for possible local user admin');
|
||||
return $user;
|
||||
}
|
||||
|
||||
global $wpdb, $error;
|
||||
try {
|
||||
$authLDAP = authLdap_get_option('Enabled');
|
||||
$authLDAPFilter = authLdap_get_option('Filter');
|
||||
$authLDAPNameAttr = authLdap_get_option('NameAttr');
|
||||
$authLDAPSecName = authLdap_get_option('SecName');
|
||||
$authLDAPMailAttr = authLdap_get_option('MailAttr');
|
||||
$authLDAPUidAttr = authLdap_get_option('UidAttr');
|
||||
$authLDAPWebAttr = authLdap_get_option('WebAttr');
|
||||
$authLDAPDefaultRole = authLdap_get_option('DefaultRole');
|
||||
$authLDAPGroupEnable = authLdap_get_option('GroupEnable');
|
||||
$authLDAPGroupOverUser = authLdap_get_option('GroupOverUser');
|
||||
$authLDAPUseUserAccount = authLdap_get_option('UserRead');
|
||||
|
||||
if (!$username) {
|
||||
authLdap_debug('Username not supplied: return false');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$password) {
|
||||
authLdap_debug('Password not supplied: return false');
|
||||
$error = __('<strong>Error</strong>: The password field is empty.');
|
||||
return false;
|
||||
}
|
||||
// First check for valid values and set appropriate defaults
|
||||
if (!$authLDAPFilter) {
|
||||
$authLDAPFilter = '(uid=%s)';
|
||||
}
|
||||
if (!$authLDAPNameAttr) {
|
||||
$authLDAPNameAttr = 'name';
|
||||
}
|
||||
if (!$authLDAPMailAttr) {
|
||||
$authLDAPMailAttr = 'mail';
|
||||
}
|
||||
if (!$authLDAPUidAttr) {
|
||||
$authLDAPUidAttr = 'uid';
|
||||
}
|
||||
|
||||
// If already_md5 is TRUE, then we're getting the user/password from the cookie. As we don't want
|
||||
// to store LDAP passwords in any
|
||||
// form, we've already replaced the password with the hashed username and LDAP_COOKIE_MARKER
|
||||
if ($already_md5) {
|
||||
if ($password == md5($username) . md5($ldapCookieMarker)) {
|
||||
authLdap_debug('cookie authentication');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove slashes as noted on https://github.com/heiglandreas/authLdap/issues/108
|
||||
$password = stripslashes_deep($password);
|
||||
|
||||
// No cookie, so have to authenticate them via LDAP
|
||||
$result = false;
|
||||
try {
|
||||
authLdap_debug('about to do LDAP authentication');
|
||||
$result = authLdap_get_server()->Authenticate($username, $password, $authLDAPFilter);
|
||||
} catch (Exception $e) {
|
||||
authLdap_debug('LDAP authentication failed with exception: ' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make optional querying from the admin account #213
|
||||
if (!authLdap_get_option('UserRead')) {
|
||||
// Rebind with the default credentials after the user has been loged in
|
||||
// Otherwise the credentials of the user trying to login will be used
|
||||
// This fixes #55
|
||||
authLdap_get_server()->bind();
|
||||
}
|
||||
|
||||
if (true !== $result) {
|
||||
authLdap_debug('LDAP authentication failed');
|
||||
// TODO what to return? WP_User object, true, false, even an WP_Error object...
|
||||
// all seem to fall back to normal wp user authentication
|
||||
return;
|
||||
}
|
||||
|
||||
authLdap_debug('LDAP authentication successful');
|
||||
$attributes = array_values(
|
||||
array_filter(
|
||||
apply_filters(
|
||||
'authLdap_filter_attributes',
|
||||
[
|
||||
$authLDAPNameAttr,
|
||||
$authLDAPSecName,
|
||||
$authLDAPMailAttr,
|
||||
$authLDAPWebAttr,
|
||||
$authLDAPUidAttr,
|
||||
]
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
try {
|
||||
$attribs = authLdap_get_server()->search(
|
||||
sprintf($authLDAPFilter, $username),
|
||||
$attributes
|
||||
);
|
||||
// First get all the relevant group informations so we can see if
|
||||
// whether have been changes in group association of the user
|
||||
if (!isset($attribs[0]['dn'])) {
|
||||
authLdap_debug('could not get user attributes from LDAP');
|
||||
throw new UnexpectedValueException('dn has not been returned');
|
||||
}
|
||||
if (!isset($attribs[0][strtolower($authLDAPUidAttr)][0])) {
|
||||
authLdap_debug('could not get user attributes from LDAP');
|
||||
throw new UnexpectedValueException('The user-ID attribute has not been returned');
|
||||
}
|
||||
|
||||
$dn = $attribs[0]['dn'];
|
||||
$realuid = $attribs[0][strtolower($authLDAPUidAttr)][0];
|
||||
} catch (Exception $e) {
|
||||
authLdap_debug('Exception getting LDAP user: ' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
$uid = authLdap_get_uid($realuid);
|
||||
|
||||
// This fixes #172
|
||||
if (true == authLdap_get_option('DoNotOverwriteNonLdapUsers', false)) {
|
||||
if (!get_user_meta($uid, 'authLDAP')) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
$roles = [];
|
||||
|
||||
// we only need this if either LDAP groups are disabled or
|
||||
// if the WordPress role of the user overrides LDAP groups
|
||||
if (!$authLDAPGroupEnable || $authLDAPGroupOverUser) {
|
||||
$userRoles = authLdap_user_role($uid);
|
||||
if ($userRoles !== []) {
|
||||
$roles = array_merge($roles, $userRoles);
|
||||
}
|
||||
// TODO, this needs to be revised, it seems, like authldap is taking only the first role
|
||||
// even if in WP there are assigned multiple.
|
||||
}
|
||||
|
||||
// do LDAP group mapping if needed
|
||||
// (if LDAP groups override worpress user role, $role is still empty)
|
||||
if (empty($roles) && $authLDAPGroupEnable) {
|
||||
$mappedRoles = authLdap_groupmap($realuid, $dn);
|
||||
if ($mappedRoles !== []) {
|
||||
$roles = $mappedRoles;
|
||||
authLdap_debug('role from group mapping: ' . json_encode($roles));
|
||||
}
|
||||
}
|
||||
|
||||
// if we don't have a role yet, use default role
|
||||
if (empty($roles) && !empty($authLDAPDefaultRole)) {
|
||||
authLdap_debug('no role yet, set default role');
|
||||
$roles[] = $authLDAPDefaultRole;
|
||||
}
|
||||
|
||||
if (empty($roles)) {
|
||||
// Sorry, but you are not in any group that is allowed access
|
||||
trigger_error('no group found');
|
||||
authLdap_debug('user is not in any group that is allowed access');
|
||||
return false;
|
||||
} else {
|
||||
$wp_roles = new WP_Roles();
|
||||
// not sure if this is needed, but it can't hurt
|
||||
|
||||
// Get rid of unexisting roles.
|
||||
foreach ($roles as $k => $v) {
|
||||
if (!$wp_roles->is_role($v)) {
|
||||
unset($k);
|
||||
}
|
||||
}
|
||||
|
||||
// check if single role or an empty array provided
|
||||
if (empty($roles)) {
|
||||
trigger_error('no group found');
|
||||
authLdap_debug('role is invalid');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// from here on, the user has access!
|
||||
// now, lets update some user details
|
||||
$user_info = [];
|
||||
$user_info['user_login'] = $realuid;
|
||||
$user_info['user_email'] = '';
|
||||
$user_info['user_nicename'] = '';
|
||||
|
||||
// first name
|
||||
if (isset($attribs[0][strtolower((string) $authLDAPNameAttr)][0])) {
|
||||
$user_info['first_name'] = $attribs[0][strtolower((string) $authLDAPNameAttr)][0];
|
||||
}
|
||||
|
||||
// last name
|
||||
if (isset($attribs[0][strtolower((string) $authLDAPSecName)][0])) {
|
||||
$user_info['last_name'] = $attribs[0][strtolower((string) $authLDAPSecName)][0];
|
||||
}
|
||||
|
||||
// mail address
|
||||
if (isset($attribs[0][strtolower((string) $authLDAPMailAttr)][0])) {
|
||||
$user_info['user_email'] = $attribs[0][strtolower((string) $authLDAPMailAttr)][0];
|
||||
}
|
||||
|
||||
// website
|
||||
if (isset($attribs[0][strtolower((string) $authLDAPWebAttr)][0])) {
|
||||
$user_info['user_url'] = $attribs[0][strtolower((string) $authLDAPWebAttr)][0];
|
||||
}
|
||||
// display name, nickname, nicename
|
||||
if (array_key_exists('first_name', $user_info)) {
|
||||
$user_info['display_name'] = $user_info['first_name'];
|
||||
$user_info['nickname'] = $user_info['first_name'];
|
||||
$user_info['user_nicename'] = sanitize_title_with_dashes($user_info['first_name']);
|
||||
if (array_key_exists('last_name', $user_info)) {
|
||||
$user_info['display_name'] .= ' ' . $user_info['last_name'];
|
||||
$user_info['nickname'] .= ' ' . $user_info['last_name'];
|
||||
$user_info['user_nicename'] .= '_' . sanitize_title_with_dashes($user_info['last_name']);
|
||||
}
|
||||
}
|
||||
$user_info['user_nicename'] = substr($user_info['user_nicename'], 0, 50);
|
||||
|
||||
// optionally store the password into the wordpress database
|
||||
if (authLdap_get_option('CachePW')) {
|
||||
// Password will be hashed inside wp_update_user or wp_insert_user
|
||||
$user_info['user_pass'] = $password;
|
||||
} else {
|
||||
// clear the password
|
||||
$user_info['user_pass'] = '';
|
||||
}
|
||||
|
||||
// add uid if user exists
|
||||
if ($uid) {
|
||||
// found user in the database
|
||||
authLdap_debug('The LDAP user has an entry in the WP-Database');
|
||||
$user_info['ID'] = $uid;
|
||||
unset($user_info['display_name'], $user_info['nickname']);
|
||||
$userid = wp_update_user($user_info);
|
||||
} else {
|
||||
// new wordpress account will be created
|
||||
authLdap_debug('The LDAP user does not have an entry in the WP-Database, a new WP account will be created');
|
||||
|
||||
$userid = wp_insert_user($user_info);
|
||||
}
|
||||
|
||||
// if the user exists, wp_insert_user will update the existing user record
|
||||
if (is_wp_error($userid)) {
|
||||
authLdap_debug('Error creating user : ' . $userid->get_error_message());
|
||||
trigger_error('Error creating user: ' . $userid->get_error_message());
|
||||
return $userid;
|
||||
}
|
||||
|
||||
// Update user roles.
|
||||
$user = new \WP_User($userid);
|
||||
|
||||
/**
|
||||
* Add hook for custom User-Role assignment
|
||||
*
|
||||
* @param WP_User $user This user-object will be returned. Can be modified as necessary in the actions.
|
||||
* @param array $roles
|
||||
*/
|
||||
do_action('authldap_user_roles', $user, $roles);
|
||||
|
||||
/**
|
||||
* Add hook for custom updates
|
||||
*
|
||||
* @param int $userid User ID.
|
||||
* @param array $attribs [0] Attributes retrieved from LDAP for the user.
|
||||
*/
|
||||
do_action('authLdap_login_successful', $userid, $attribs[0]);
|
||||
|
||||
authLdap_debug('user id = ' . $userid);
|
||||
|
||||
// flag the user as an ldap user so we can hide the password fields in the user profile
|
||||
update_user_meta($userid, 'authLDAP', true);
|
||||
|
||||
// return a user object upon positive authorization
|
||||
return $user;
|
||||
} catch (Exception $e) {
|
||||
authLdap_debug($e->getMessage() . '. Exception thrown in line ' . $e->getLine());
|
||||
trigger_error($e->getMessage() . '. Exception thrown in line ' . $e->getLine());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user's user id
|
||||
*
|
||||
* Returns null if username not found
|
||||
*
|
||||
* @param string $username username
|
||||
* @param string user id, null if not found
|
||||
*/
|
||||
function authLdap_get_uid($username)
|
||||
{
|
||||
global $wpdb;
|
||||
|
||||
// find out whether the user is already present in the database
|
||||
$uid = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT ID FROM {$wpdb->users} WHERE user_login = %s",
|
||||
$username
|
||||
)
|
||||
);
|
||||
if ($uid) {
|
||||
authLdap_debug("Existing user, uid = {$uid}");
|
||||
return $uid;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user's current role
|
||||
*
|
||||
* Returns empty string if not found.
|
||||
*
|
||||
* @param int $uid wordpress user id
|
||||
* @return array roles, empty if none found
|
||||
*/
|
||||
function authLdap_user_role($uid)
|
||||
{
|
||||
global $wpdb, $wp_roles;
|
||||
|
||||
if (!$uid) {
|
||||
return [];
|
||||
}
|
||||
|
||||
/** @var array<string, bool> $usercapabilities */
|
||||
$usercapabilities = get_user_meta($uid, "{$wpdb->prefix}capabilities", true);
|
||||
if (!is_array($usercapabilities)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
/** @var array<string, array{name: string, capabilities: array<mixed>} $editable_roles */
|
||||
$editable_roles = $wp_roles->roles;
|
||||
|
||||
// By using this approach we are now using the order of the roles from the WP_Roles object
|
||||
// and not from the capabilities any more.
|
||||
$userroles = array_keys(array_intersect_key($editable_roles, $usercapabilities));
|
||||
|
||||
authLdap_debug(sprintf("Existing user's roles: %s", implode(', ', $userroles)));
|
||||
|
||||
return $userroles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get LDAP groups for user and map to role
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $dn
|
||||
* @return array role, empty array if no mapping found, first or all role(s) found otherwise
|
||||
* @conf array authLDAPGroups, associative array, role => ldap_group
|
||||
* @conf string authLDAPGroupBase, base dn to look up groups
|
||||
* @conf string authLDAPGroupAttr, ldap attribute that holds name of group
|
||||
* @conf string authLDAPGroupFilter, LDAP filter to find groups. can contain %s and %dn% placeholders
|
||||
*/
|
||||
function authLdap_groupmap($username, $dn)
|
||||
{
|
||||
$authLDAPGroups = authLdap_sort_roles_by_capabilities(
|
||||
authLdap_get_option('Groups')
|
||||
);
|
||||
$authLDAPGroupBase = authLdap_get_option('GroupBase');
|
||||
$authLDAPGroupAttr = authLdap_get_option('GroupAttr');
|
||||
$authLDAPGroupFilter = authLdap_get_option('GroupFilter');
|
||||
$authLDAPGroupSeparator = authLdap_get_option('GroupSeparator');
|
||||
if (!$authLDAPGroupAttr) {
|
||||
$authLDAPGroupAttr = 'gidNumber';
|
||||
}
|
||||
if (!$authLDAPGroupFilter) {
|
||||
$authLDAPGroupFilter = '(&(objectClass=posixGroup)(memberUid=%s))';
|
||||
}
|
||||
if (!$authLDAPGroupSeparator) {
|
||||
$authLDAPGroupSeparator = ',';
|
||||
}
|
||||
|
||||
if (!is_array($authLDAPGroups) || count(array_filter(array_values($authLDAPGroups))) == 0) {
|
||||
authLdap_debug('No group names defined');
|
||||
return [];
|
||||
}
|
||||
|
||||
try {
|
||||
// To allow searches based on the DN instead of the uid, we replace the
|
||||
// string %dn% with the users DN.
|
||||
$authLDAPGroupFilter = str_replace(
|
||||
'%dn%',
|
||||
ldap_escape($dn, '', LDAP_ESCAPE_FILTER),
|
||||
$authLDAPGroupFilter
|
||||
);
|
||||
authLdap_debug('Group Filter: ' . json_encode($authLDAPGroupFilter));
|
||||
authLdap_debug('Group Base: ' . $authLDAPGroupBase);
|
||||
$groups = authLdap_get_server()->search(
|
||||
sprintf($authLDAPGroupFilter, ldap_escape($username, '', LDAP_ESCAPE_FILTER)),
|
||||
[$authLDAPGroupAttr],
|
||||
$authLDAPGroupBase
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
authLdap_debug('Exception getting LDAP group attributes: ' . $e->getMessage());
|
||||
return [];
|
||||
}
|
||||
|
||||
$grp = [];
|
||||
for ($i = 0; $i < $groups ['count']; $i++) {
|
||||
if ($authLDAPGroupAttr == "dn") {
|
||||
$grp[] = $groups[$i]['dn'];
|
||||
} else {
|
||||
for ($k = 0; $k < $groups[$i][strtolower($authLDAPGroupAttr)]['count']; $k++) {
|
||||
$grp[] = $groups[$i][strtolower($authLDAPGroupAttr)][$k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
authLdap_debug('LDAP groups: ' . json_encode($grp));
|
||||
|
||||
// Check whether the user is member of one of the groups that are
|
||||
// allowed acces to the blog. If the user is not member of one of
|
||||
// The groups throw her out! ;-)
|
||||
$roles = [];
|
||||
foreach ($authLDAPGroups as $key => $val) {
|
||||
$currentGroup = explode($authLDAPGroupSeparator, $val);
|
||||
// Remove whitespaces around the group-ID
|
||||
$currentGroup = array_map('trim', $currentGroup);
|
||||
if (0 < count(array_intersect($currentGroup, $grp))) {
|
||||
$roles[] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
// Default: If the user is member of more than one group only the first one
|
||||
// will be taken into account!
|
||||
// This filter allows you to return multiple user roles. WordPress
|
||||
// supports this functionality, but not natively via UI from Users
|
||||
// overview (you need to use a plugin). However, it's still widely used,
|
||||
// for example, by WooCommerce, etc. Use if you know what you're doing.
|
||||
if (apply_filters('authLdap_allow_multiple_roles', false) === false && count($roles) > 1) {
|
||||
$roles = array_slice($roles, 0, 1);
|
||||
}
|
||||
|
||||
authLdap_debug("Roles from LDAP group: " . json_encode($roles));
|
||||
return $roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function disables the password-change fields in the users preferences.
|
||||
*
|
||||
* It does not make sense to authenticate via LDAP and then allow the user to
|
||||
* change the password only in the wordpress database. And changing the password
|
||||
* LDAP-wide can not be the scope of Wordpress!
|
||||
*
|
||||
* Whether the user is an LDAP-User or not is determined using the authLDAP-Flag
|
||||
* of the users meta-informations
|
||||
*
|
||||
* @return false, if the user whose prefs are viewed is an LDAP-User, true if
|
||||
* he isn't
|
||||
* @conf boolean authLDAP
|
||||
*/
|
||||
function authLdap_show_password_fields($return, $user)
|
||||
{
|
||||
if (!$user) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (get_user_meta($user->ID, 'authLDAP')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function disables the password reset for a user.
|
||||
*
|
||||
* It does not make sense to authenticate via LDAP and then allow the user to
|
||||
* reset the password only in the wordpress database. And changing the password
|
||||
* LDAP-wide can not be the scope of Wordpress!
|
||||
*
|
||||
* Whether the user is an LDAP-User or not is determined using the authLDAP-Flag
|
||||
* of the users meta-informations
|
||||
*
|
||||
* @author chaplina (https://github.com/chaplina)
|
||||
* @conf boolean authLDAP
|
||||
* @return false, if the user is an LDAP-User, true if he isn't
|
||||
*/
|
||||
function authLdap_allow_password_reset($return, $userid)
|
||||
{
|
||||
if (!(isset($userid))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (get_user_meta($userid, 'authLDAP')) {
|
||||
return false;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the given roles by number of capabilities
|
||||
*
|
||||
* @param array $roles
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function authLdap_sort_roles_by_capabilities($roles)
|
||||
{
|
||||
global $wpdb;
|
||||
$myRoles = get_option($wpdb->get_blog_prefix() . 'user_roles');
|
||||
|
||||
authLdap_debug(print_r($roles, true));
|
||||
uasort($myRoles, 'authLdap_sortByCapabilitycount');
|
||||
|
||||
$return = [];
|
||||
|
||||
foreach ($myRoles as $key => $role) {
|
||||
if (isset($roles[$key])) {
|
||||
$return[$key] = $roles[$key];
|
||||
}
|
||||
}
|
||||
|
||||
authLdap_debug(print_r($return, true));
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort according to the number of capabilities
|
||||
*
|
||||
* @param $a
|
||||
* @param $b
|
||||
*/
|
||||
function authLdap_sortByCapabilitycount($a, $b)
|
||||
{
|
||||
if (count($a['capabilities']) > count($b['capabilities'])) {
|
||||
return -1;
|
||||
}
|
||||
if (count($a['capabilities']) < count($b['capabilities'])) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load AuthLDAP Options
|
||||
*
|
||||
* Sets and stores defaults if options are not up to date
|
||||
*/
|
||||
function authLdap_load_options($reload = false)
|
||||
{
|
||||
static $options = null;
|
||||
|
||||
// the current version for options
|
||||
$option_version_plugin = 1;
|
||||
|
||||
$optionFunction = 'get_option';
|
||||
if (is_multisite()) {
|
||||
$optionFunction = 'get_site_option';
|
||||
}
|
||||
if (is_null($options) || $reload) {
|
||||
$options = $optionFunction('authLDAPOptions', []);
|
||||
}
|
||||
|
||||
// check if option version has changed (or if it's there at all)
|
||||
if (!isset($options['Version']) || ($options['Version'] != $option_version_plugin)) {
|
||||
// defaults for all options
|
||||
$options_default = [
|
||||
'Enabled' => false,
|
||||
'CachePW' => false,
|
||||
'URI' => '',
|
||||
'URISeparator' => ' ',
|
||||
'Filter' => '', // '(uid=%s)'
|
||||
'NameAttr' => '', // 'name'
|
||||
'SecName' => '',
|
||||
'UidAttr' => '', // 'uid'
|
||||
'MailAttr' => '', // 'mail'
|
||||
'WebAttr' => '',
|
||||
'Groups' => [],
|
||||
'Debug' => false,
|
||||
'GroupAttr' => '', // 'gidNumber'
|
||||
'GroupFilter' => '', // '(&(objectClass=posixGroup)(memberUid=%s))'
|
||||
'DefaultRole' => '',
|
||||
'GroupEnable' => true,
|
||||
'GroupOverUser' => true,
|
||||
'Version' => $option_version_plugin,
|
||||
'DoNotOverwriteNonLdapUsers' => false,
|
||||
];
|
||||
|
||||
// check if we got a version
|
||||
if (!isset($options['Version'])) {
|
||||
// we just changed to the new option format
|
||||
// read old options, then delete them
|
||||
$old_option_new_option = [
|
||||
'authLDAP' => 'Enabled',
|
||||
'authLDAPCachePW' => 'CachePW',
|
||||
'authLDAPURI' => 'URI',
|
||||
'authLDAPFilter' => 'Filter',
|
||||
'authLDAPNameAttr' => 'NameAttr',
|
||||
'authLDAPSecName' => 'SecName',
|
||||
'authLDAPUidAttr' => 'UidAttr',
|
||||
'authLDAPMailAttr' => 'MailAttr',
|
||||
'authLDAPWebAttr' => 'WebAttr',
|
||||
'authLDAPGroups' => 'Groups',
|
||||
'authLDAPDebug' => 'Debug',
|
||||
'authLDAPGroupAttr' => 'GroupAttr',
|
||||
'authLDAPGroupFilter' => 'GroupFilter',
|
||||
'authLDAPDefaultRole' => 'DefaultRole',
|
||||
'authLDAPGroupEnable' => 'GroupEnable',
|
||||
'authLDAPGroupOverUser' => 'GroupOverUser',
|
||||
];
|
||||
foreach ($old_option_new_option as $old_option => $new_option) {
|
||||
$value = get_option($old_option, null);
|
||||
if (!is_null($value)) {
|
||||
$options[$new_option] = $value;
|
||||
}
|
||||
delete_option($old_option);
|
||||
}
|
||||
delete_option('authLDAPCookieMarker');
|
||||
delete_option('authLDAPCookierMarker');
|
||||
}
|
||||
|
||||
// set default for all options that are missing
|
||||
foreach ($options_default as $key => $default) {
|
||||
if (!isset($options[$key])) {
|
||||
$options[$key] = $default;
|
||||
}
|
||||
}
|
||||
|
||||
// set new version and save
|
||||
$options['Version'] = $option_version_plugin;
|
||||
update_option('authLDAPOptions', $options);
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an individual option
|
||||
*/
|
||||
function authLdap_get_option($optionname, $default = null)
|
||||
{
|
||||
$options = authLdap_load_options();
|
||||
if (isset($options[$optionname]) && $options[$optionname]) {
|
||||
return $options[$optionname];
|
||||
}
|
||||
|
||||
if (null !== $default) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
//authLdap_debug('option name invalid: ' . $optionname);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set new options
|
||||
*/
|
||||
function authLdap_set_options($new_options = [])
|
||||
{
|
||||
// initialize the options with what we currently have
|
||||
$options = authLdap_load_options();
|
||||
|
||||
// set the new options supplied
|
||||
foreach ($new_options as $key => $value) {
|
||||
$options[$key] = $value;
|
||||
}
|
||||
|
||||
// store options
|
||||
$optionFunction = 'update_option';
|
||||
if (is_multisite()) {
|
||||
$optionFunction = 'update_site_option';
|
||||
}
|
||||
if ($optionFunction('authLDAPOptions', $options)) {
|
||||
// reload the option cache
|
||||
authLdap_load_options(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// could not set options
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not send an email after changing the password or the email of the user!
|
||||
*
|
||||
* @param boolean $result The initial resturn value
|
||||
* @param array $user The old userdata
|
||||
* @param array $newUserData The changed userdata
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function authLdap_send_change_email($result, $user, $newUserData)
|
||||
{
|
||||
if (get_user_meta($user['ID'], 'authLDAP')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
$hook = is_multisite() ? 'network_' : '';
|
||||
add_action($hook . 'admin_menu', 'authLdap_addmenu');
|
||||
add_filter('show_password_fields', 'authLdap_show_password_fields', 10, 2);
|
||||
add_filter('allow_password_reset', 'authLdap_allow_password_reset', 10, 2);
|
||||
add_filter('authenticate', 'authLdap_login', 10, 3);
|
||||
/** This only works from WP 4.3.0 on */
|
||||
add_filter('send_password_change_email', 'authLdap_send_change_email', 10, 3);
|
||||
add_filter('send_email_change_email', 'authLdap_send_change_email', 10, 3);
|
||||
$handler = new UserRoleHandler();
|
||||
add_action('authldap_user_roles', [$handler, 'addRolesToUser'], 10, 2);
|
@ -0,0 +1 @@
|
||||
default:
|
@ -0,0 +1,289 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Behat\Behat\Tester\Exception\PendingException;
|
||||
use Behat\Behat\Context\Context;
|
||||
use Behat\Gherkin\Node\PyStringNode;
|
||||
use Behat\Gherkin\Node\TableNode;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Cookie\CookieJar;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use Org_Heigl\AuthLdap\OptionFactory;
|
||||
use Org_Heigl\AuthLdap\Options;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
class FeatureContext implements Context
|
||||
{
|
||||
private ?Response $res = null;
|
||||
/**
|
||||
* Initializes context.
|
||||
*
|
||||
* Every scenario gets its own context instance.
|
||||
* You can also pass arbitrary arguments to the
|
||||
* context constructor through behat.yml.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
exec('wp --allow-root core install --url=localhost --title=Example --admin_user=localadmin --admin_password=P@ssw0rd --admin_email=info@example.com');
|
||||
exec('wp --allow-root plugin activate authldap');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Given a default configuration
|
||||
*/
|
||||
public function aDefaultConfiguration()
|
||||
{
|
||||
$options = new Options();
|
||||
$options->set(Options::URI, 'ldap://cn=admin,dc=example,dc=org:insecure@openldap:389/dc=example,dc=org');
|
||||
$options->set(Options::ENABLED, true);
|
||||
$options->set(Options::FILTER, 'uid=%1$s');
|
||||
$options->set(Options::DEFAULT_ROLE, 'subscriber');
|
||||
$options->set(Options::DEBUG, true);
|
||||
$options->set(Options::NAME_ATTR, 'cn');
|
||||
|
||||
exec(sprintf(
|
||||
'wp --allow-root option update --format=json authLDAPOptions \'%1$s\'',
|
||||
json_encode($options->toArray())
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given configuration value :arg1 is set to :arg2
|
||||
*/
|
||||
public function configurationValueIsSetTo($arg1, $arg2)
|
||||
{
|
||||
exec(sprintf(
|
||||
'wp --allow-root option patch update authLDAPOptions %1$s %2$s --format=json',
|
||||
$arg1,
|
||||
"'" . json_encode($arg2) . "'"
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given an LDAP user :arg1 with name :arg2, password :arg3 and email :arg4 exists
|
||||
*/
|
||||
public function anLdapUserWithNamePasswordAndEmailExists($arg1, $arg2, $arg3, $arg4)
|
||||
{
|
||||
exec(sprintf(
|
||||
'ldapadd -x -H %1$s -D "%2$s" -w %3$s <<LDIF
|
||||
%4$s
|
||||
LDIF',
|
||||
'ldap://openldap',
|
||||
'cn=admin,dc=example,dc=org',
|
||||
'insecure',
|
||||
<<<LDIF
|
||||
dn: uid=$arg1,dc=example,dc=org
|
||||
objectClass: inetOrgPerson
|
||||
objectClass: organizationalPerson
|
||||
objectClass: person
|
||||
objectClass: top
|
||||
objectClass: simpleSecurityObject
|
||||
uid: $arg1
|
||||
cn: $arg2
|
||||
sn: $arg2
|
||||
userPassword: $arg3
|
||||
mail: $arg4
|
||||
LDIF
|
||||
));
|
||||
exec(sprintf(
|
||||
'ldappasswd -H ldap://openldap:389 -x -D "uid=admin,dc=example,dc=org" -w "%3$s" -s "%2$s" "uid=%1$s,dc=example,dc=org"',
|
||||
$arg1,
|
||||
$arg3,
|
||||
'insecure'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given an LDAP group :arg1 exists
|
||||
*/
|
||||
public function anLdapGroupExists($arg1)
|
||||
{
|
||||
exec(sprintf(
|
||||
'ldapadd -x -H %1$s -D "%2$s" -w %3$s <<LDIF
|
||||
%4$s
|
||||
LDIF',
|
||||
'ldap://openldap',
|
||||
'cn=admin,dc=example,dc=org',
|
||||
'insecure',
|
||||
<<<LDIF
|
||||
dn: cn=$arg1,dc=example,dc=org
|
||||
objectClass: groupOfUniqueNames
|
||||
cn: $arg1
|
||||
uniqueMember: cn=admin,dc=example,dc=org
|
||||
LDIF
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given a WordPress user :arg1 with name :arg2 and email :arg3 exists
|
||||
*/
|
||||
public function aWordpressUserWithNameAndEmailExists($arg1, $arg2, $arg3)
|
||||
{
|
||||
exec(sprintf(
|
||||
'wp --allow-root user create %1$s %3$s --display_name=%2$s --porcelain',
|
||||
$arg1,
|
||||
$arg2,
|
||||
$arg3
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given a WordPress role :arg1 exists
|
||||
*/
|
||||
public function aWordpressRoleExists($arg1)
|
||||
{
|
||||
exec(sprintf(
|
||||
'wp --allow-root role create %1$s %1$s',
|
||||
$arg1,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given WordPress user :arg1 has role :arg2
|
||||
*/
|
||||
public function wordpressUserHasRole($arg1, $arg2)
|
||||
{
|
||||
exec(sprintf(
|
||||
'wp --allow-root user add-role %1$s %2$s',
|
||||
$arg1,
|
||||
$arg2
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @When LDAP user :arg1 logs in with password :arg2
|
||||
*/
|
||||
public function ldapUserLogsInWithPassword($arg1, $arg2)
|
||||
{
|
||||
// curl -i 'http://localhost/wp-login.php' -X POST -H 'Cookie: wordpress_test_cookie=test' --data-raw 'log=localadmin&pwd=P%40ssw0rd'
|
||||
$client = new Client();
|
||||
|
||||
$this->res = $client->post('http://wp/wp-login.php', [
|
||||
'cookies' => CookieJar::fromArray([
|
||||
'wordpress_test_cookie' => 'test',
|
||||
'XDEBUG_SESSION' => 'PHPSTORM',
|
||||
], 'http://wp'),
|
||||
'form_params' => [
|
||||
'log' => $arg1,
|
||||
'pwd' => $arg2,
|
||||
],
|
||||
'allow_redirects' => false
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the login suceeds
|
||||
*/
|
||||
public function theLoginSuceeds()
|
||||
{
|
||||
Assert::isInstanceOf($this->res, Response::class);
|
||||
Assert::eq( $this->res->getStatusCode(), 302);
|
||||
Assert::startsWith($this->res->getHeader('Location')[0], 'http://localhost/wp-admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then a new WordPress user :arg1 was created with name :arg2 and email :arg3
|
||||
*/
|
||||
public function aNewWordpressUserWasCreatedWithNameAndEmail($arg1, $arg2, $arg3)
|
||||
{
|
||||
exec(sprintf(
|
||||
'wp --allow-root user get %1$s --format=json 2> /dev/null',
|
||||
$arg1,
|
||||
), $output, $result);
|
||||
Assert::eq(0, $result);
|
||||
$user = json_decode($output[0], true);
|
||||
Assert::eq($user['user_email'], $arg3);
|
||||
Assert::eq($user['display_name'], $arg2);
|
||||
Assert::greaterThan(
|
||||
new DateTimeImmutable($user['user_registered']),
|
||||
(new DateTimeImmutable())->sub(new DateInterval('PT1M')),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the WordPress user :arg1 is member of role :arg2
|
||||
*/
|
||||
public function theWordpressUserIsMemberOfRole($arg1, $arg2)
|
||||
{
|
||||
exec(sprintf(
|
||||
'wp --allow-root user get %1$s --format=json 2> /dev/null',
|
||||
$arg1,
|
||||
), $output, $result);
|
||||
Assert::eq(0, $result);
|
||||
$user = json_decode($output[0], true);
|
||||
$roles = array_map(function($item): string {
|
||||
return trim($item);
|
||||
}, explode(',', $user['roles']));
|
||||
Assert::inArray($arg2, $roles);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given LDAP user :arg1 is member of LDAP group :arg2
|
||||
*/
|
||||
public function ldapUserIsMemberOfLdapGroup($arg1, $arg2)
|
||||
{
|
||||
exec(sprintf(
|
||||
'ldapmodify -x -H %1$s -D "%2$s" -w %3$s 2>&1 <<LDIF
|
||||
%4$s
|
||||
LDIF',
|
||||
'ldap://openldap',
|
||||
'cn=admin,dc=example,dc=org',
|
||||
'insecure',
|
||||
<<<LDIF
|
||||
dn: cn=$arg2,dc=example,dc=org
|
||||
changetype: modify
|
||||
add: uniqueMember
|
||||
uniqueMember: uid=$arg1,dc=example,dc=org
|
||||
LDIF
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given a WordPress user :arg1 does not exist
|
||||
*/
|
||||
public function aWordpressUserDoesNotExist($arg1)
|
||||
{
|
||||
exec(sprintf(
|
||||
'wp --allow-root user delete --yes %1$s',
|
||||
$arg1,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given configuration value :arg1 is set to :arg2 and :arg3
|
||||
*/
|
||||
public function configurationValueIsSetToAnd($arg1, $arg2, $arg3)
|
||||
{
|
||||
$roles = [];
|
||||
foreach ([$arg2, $arg3] as $arg) {
|
||||
$access = explode('=', $arg);
|
||||
$roles[$access[0]] = $access[1];
|
||||
}
|
||||
|
||||
exec(sprintf(
|
||||
'echo %2$s | wp --allow-root option patch update authLDAPOptions %1$s --format=json',
|
||||
$arg1,
|
||||
"'" . json_encode($roles) . "'"
|
||||
), $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the WordPress user :arg1 is not member of role :arg2
|
||||
*/
|
||||
public function theWordpressUserIsNotMemberOfRole($arg1, $arg2)
|
||||
{
|
||||
exec(sprintf(
|
||||
'wp --allow-root user get %1$s --format=json 2> /dev/null',
|
||||
$arg1,
|
||||
), $output, $result);
|
||||
Assert::eq(0, $result);
|
||||
$user = json_decode($output[0], true);
|
||||
$roles = array_map(function($item): string {
|
||||
return trim($item);
|
||||
}, explode(',', $user['roles']));
|
||||
Assert::false(in_array($arg2, $roles));
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
Feature: Log in without group assignment
|
||||
Scenario: Login without group assignment with
|
||||
Given a default configuration
|
||||
And configuration value "GroupEnable" is set to "false"
|
||||
And configuration value "DefaultRole" is set to "subscriber"
|
||||
And an LDAP user "ldapuser" with name "LDAP User", password "P@ssw0rd" and email "ldapuser@example.com" exists
|
||||
And an LDAP group "ldapgroup" exists
|
||||
And LDAP user "ldapuser" is member of LDAP group "ldapgroup"
|
||||
And a WordPress user "wordpressuser" with name "WordPress_User" and email "wordpressuser@example.com" exists
|
||||
And a WordPress role "wordpressrole" exists
|
||||
And WordPress user "wordpressuser" has role "wordpressrole"
|
||||
And a WordPress user "ldapuser" does not exist
|
||||
When LDAP user "ldapuser" logs in with password "P@ssw0rd"
|
||||
Then the login suceeds
|
||||
And a new WordPress user "ldapuser" was created with name "LDAP User" and email "ldapuser@example.com"
|
||||
And the WordPress user "ldapuser" is member of role "subscriber"
|
||||
|
||||
Scenario: Login with group assignment to multiple groups where only first wordpress group is used
|
||||
Given a default configuration
|
||||
And configuration value "GroupEnable" is set to "true"
|
||||
And configuration value "DefaultRole" is set to "subscriber"
|
||||
And configuration value "Groups" is set to "administrator=ldapgroup" and "editor=ldapgroup"
|
||||
And configuration value "GroupAttr" is set to "cn"
|
||||
And configuration value "GroupFilter" is set to "uniquemember=%dn%"
|
||||
And configuration value "GroupOverUser" is set to "true"
|
||||
And an LDAP user "ldapuser" with name "LDAP User", password "P@ssw0rd" and email "ldapuser@example.com" exists
|
||||
And an LDAP group "ldapgroup" exists
|
||||
And LDAP user "ldapuser" is member of LDAP group "ldapgroup"
|
||||
And a WordPress user "wordpressuser" with name "WordPress_User" and email "wordpressuser@example.com" exists
|
||||
And a WordPress role "wordpressrole" exists
|
||||
And WordPress user "wordpressuser" has role "wordpressrole"
|
||||
And a WordPress user "ldapuser" does not exist
|
||||
When LDAP user "ldapuser" logs in with password "P@ssw0rd"
|
||||
Then the login suceeds
|
||||
And a new WordPress user "ldapuser" was created with name "LDAP User" and email "ldapuser@example.com"
|
||||
And the WordPress user "ldapuser" is member of role "administrator"
|
||||
And the WordPress user "ldapuser" is not member of role "editor"
|
||||
And the WordPress user "ldapuser" is not member of role "subscriber"
|
||||
|
||||
Scenario: Second Login with group assignment to multiple groups where only first wordpress group is used.
|
||||
Given a default configuration
|
||||
And configuration value "GroupEnable" is set to "true"
|
||||
And configuration value "DefaultRole" is set to "subscriber"
|
||||
And configuration value "Groups" is set to "administrator=ldapgroup" and "editor=ldapgroup"
|
||||
And configuration value "GroupAttr" is set to "cn"
|
||||
And configuration value "GroupFilter" is set to "uniquemember=%dn%"
|
||||
And configuration value "GroupOverUser" is set to "false"
|
||||
And an LDAP user "ldapuser" with name "LDAP User", password "P@ssw0rd" and email "ldapuser@example.com" exists
|
||||
And an LDAP group "ldapgroup" exists
|
||||
And LDAP user "ldapuser" is member of LDAP group "ldapgroup"
|
||||
And a WordPress user "wordpressuser" with name "WordPress_User" and email "wordpressuser@example.com" exists
|
||||
And a WordPress role "wordpressrole" exists
|
||||
And WordPress user "wordpressuser" has role "wordpressrole"
|
||||
And a WordPress user "ldapuser" does not exist
|
||||
And LDAP user "ldapuser" logs in with password "P@ssw0rd"
|
||||
And WordPress user "ldapuser" has role "wordpressrole"
|
||||
And the WordPress user "ldapuser" is member of role "wordpressrole"
|
||||
When LDAP user "ldapuser" logs in with password "P@ssw0rd"
|
||||
Then the login suceeds
|
||||
And the WordPress user "ldapuser" is member of role "administrator"
|
||||
And the WordPress user "ldapuser" is member of role "wordpressrole"
|
||||
And the WordPress user "ldapuser" is not member of role "editor"
|
||||
And the WordPress user "ldapuser" is not member of role "subscriber"
|
22
wp-content/upgrade-temp-backup/plugins/authldap/phpcs.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset name="Custom Standard" namespace="MyProject\CS\Standard">
|
||||
<description>authLdap codestyle</description>
|
||||
<file>./src</file>
|
||||
<file>./authLdap.php</file>
|
||||
<file>./tests</file>
|
||||
|
||||
<arg name="colors"/>
|
||||
<arg value="sp"/>
|
||||
|
||||
<autoload>./vendor/autoload.php</autoload>
|
||||
|
||||
<rule ref="PSR12">
|
||||
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
|
||||
</rule>
|
||||
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
||||
<properties>
|
||||
<property name="tabIndent" value="true"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
</ruleset>
|
166
wp-content/upgrade-temp-backup/plugins/authldap/readme.txt
Normal file
@ -0,0 +1,166 @@
|
||||
=== authLdap ===
|
||||
Contributors: heiglandreas
|
||||
Tags: ldap, auth, authentication, active directory, AD, openLDAP, Open Directory
|
||||
Requires at least: 2.5.0
|
||||
Tested up to: 6.4.0
|
||||
Requires PHP: 7.4
|
||||
Stable tag: trunk
|
||||
License: MIT
|
||||
License URI: https://opensource.org/licenses/MIT
|
||||
|
||||
Use your existing LDAP flexible as authentication backend for WordPress
|
||||
|
||||
== Description ==
|
||||
|
||||
Use your existing LDAP as authentication-backend for your wordpress!
|
||||
|
||||
So what are the differences to other Wordpress-LDAP-Authentication-Plugins?
|
||||
|
||||
* Flexible: You are totaly free in which LDAP-backend to use. Due to the extensive configuration you can freely decide how to do the authentication of your users. It simply depends on your filters
|
||||
* Independent: As soon as a user logs in, it is added/updated to the Wordpress' user-database to allow wordpress to always use the correct data. You only have to administer your users once.
|
||||
* Failsafe: Due to the users being created in Wordpress' User-database they can also log in when the LDAP-backend currently is gone.
|
||||
* Role-Aware: You can map Wordpress' roles to values of an existing LDAP-attribute.
|
||||
|
||||
For more Information on the configuration have a look at https://github.com/heiglandreas/authLdap
|
||||
|
||||
== Installation ==
|
||||
|
||||
1. Upload the extracted folder `authLdap` to the `/wp-content/plugins/` directory
|
||||
2. Activate the plugin through the 'Plugins' menu in WordPress
|
||||
3. Configure the Plugin via the 'authLdap'-Configuration-Page.
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= Where can I find more Informations about the plugin? =
|
||||
|
||||
Go to https://github.com/heiglandreas/authLdap
|
||||
|
||||
= Where can I report issues with the plugin? =
|
||||
|
||||
Please use the issuetracker at https://github.com/heiglandreas/authLdap/issues
|
||||
|
||||
= Where can I report sensitive security issues with the plugin? =
|
||||
|
||||
In essence: Report a security vulnerability at https://github.com/heiglandreas/authLdap/security/advisories/new
|
||||
|
||||
Please see https://github.com/heiglandreas/authLdap/blob/master/SECURITY.md for more details
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 2.6.0 =
|
||||
|
||||
* Fix reducing assigned WordPress roles to single role on login when WordPress roles shall be kept
|
||||
* Add Behavioural testing and first 3 scenarios
|
||||
|
||||
= 2.5.9 =
|
||||
|
||||
* Adds information about security-contacts
|
||||
* Addresses CVE-2023-41655
|
||||
|
||||
= 2.5.8 =
|
||||
|
||||
* Fix regression from 2.5.7
|
||||
|
||||
= 2.5.7 =
|
||||
|
||||
* Fix regressions from 2.5.4
|
||||
* Fix CI system
|
||||
|
||||
= 2.5.4 =
|
||||
* Update Tested up to
|
||||
|
||||
= 2.5.3 =
|
||||
* Fix issue with broken role-assignement in combination with WooCommerce
|
||||
* Fix spelling issue
|
||||
* Allow DN as role-definition
|
||||
|
||||
= 2.5.0 =
|
||||
* Ignore the order of capabilities to tell the role. In addition the filter `editable_roles` can be used to limit the roles
|
||||
|
||||
= 2.4.11 =
|
||||
* Fix issue with running on PHP8.1
|
||||
|
||||
= 2.4.9 =
|
||||
* Improve group-assignement UI
|
||||
|
||||
= 2.4.8 =
|
||||
* Make textfields in settings-page wider
|
||||
|
||||
= 2.4.7 =
|
||||
* Replace deprecated function
|
||||
* Fix undefined index
|
||||
* Add filter for retrieving other params at login (authLdap_filter_attributes)
|
||||
* Add do_action after successfull login (authLdap_login_successful)
|
||||
|
||||
= 2.4.0 =
|
||||
* Allow to use environment variables for LDAP-URI configuration
|
||||
|
||||
= 2.3.0 =
|
||||
* Allow to not overwrite existing WordPress-Users with LDAP-Users as that can be a security issue.
|
||||
|
||||
= 2.1.0 =
|
||||
* Add search-base for groups. This might come in handy for multisite-instances
|
||||
|
||||
= 2.0.0 =
|
||||
* This new release adds Multi-Site support. It will no longer be possible to use this plugin just in one subsite of a multisite installation!
|
||||
* Adds a warning screen to the config-section when no LDAPextension could be found
|
||||
* Fixes an issue with the max-length of the username
|
||||
|
||||
= 1.5.1 =
|
||||
* Fixes an issue with escaped backslashes and quotes
|
||||
|
||||
= 1.5.0 =
|
||||
* Allows parts of the LDAP-URI to be URLEncoded
|
||||
* Drops support for PHP 5.4
|
||||
|
||||
= 1.4.20 =
|
||||
* Allows multiple LDAP-servers to be queried (given that they use the same attributes)
|
||||
* Fixes issue with URL-Encoded informations (see https://github.com/heiglandreas/authLdap/issues/108)
|
||||
|
||||
= 1.4.19 =
|
||||
* Adds support for TLS
|
||||
|
||||
= 1.4.14 =
|
||||
* Update to showing password-fields check (thanks to @chaplina)
|
||||
|
||||
= 1.4.13 =
|
||||
* Removed generation of default email-address (thanks to @henryk)
|
||||
* Fixes password-hashing when caching passwords (thanks to @litinoveweedle)
|
||||
* Removes the possibility to reset a password for LDAP-based users (thanks to @chaplina)
|
||||
* Removes the password-change-Email from 4.3 on (thanks to @litinoveweedle)
|
||||
* Fixes double authentication-attempt (that resulted in failed authentication) (thanks to @litinoveweedle)
|
||||
|
||||
= 1.4.10 =
|
||||
* Cleanup by removing deprecated code
|
||||
* Fixes issues with undefined variables
|
||||
* Enables internal option-versioning
|
||||
* Setting users nickname initially to the realname instead of the uid
|
||||
* Fixes display of password-change possibility in users profile-page
|
||||
= 1.4.9 =
|
||||
* Fixed an issue with changing display name on every login
|
||||
* Use proper way of looking up user-roles in setups w/o DB-prefix
|
||||
= 1.4.8 =
|
||||
* Updated version string
|
||||
= 1.4.7 =
|
||||
* Use default user to retrieve group menberships and not logging in user.
|
||||
* return the UID from the LDAP instead of the value given by the user
|
||||
* remove unnecessary checkbox
|
||||
* Adds a testsuite
|
||||
* Fixes PSR2 violations
|
||||
|
||||
[…]
|
||||
|
||||
= 1.2.1 =
|
||||
* Fixed an issue with group-ids
|
||||
* Moved the code to GitHub (https://github.com/heiglandreas/authLdap)
|
||||
= 1.1.0 =
|
||||
* Changed the login-process. Now users that are not allowed to login due to
|
||||
missing group-memberships are not created within your blog as was the standard
|
||||
until Version 1.0.3 - Thanks to alex@tayts.com
|
||||
* Changed the default mail-address that is created when no mail-address can be
|
||||
retrieved from the LDAP from me@example.com to $username@example.com so that
|
||||
a new user can be created even though the mail address already exists in your
|
||||
blog - Also thanks to alex@tayts.com
|
||||
* Added support for WordPress-Table-prefixes as the capabilities of a user
|
||||
are interlany stored in a field that is named "$tablePrefix_capabilities" -
|
||||
again thanks to alex@tayts.com and also to sim0n of silicium.mine.nu
|
@ -0,0 +1,6 @@
|
||||
Contact: mailto://andreas@heigl.net
|
||||
Contact: https://github.com/heiglandreas/authLdap/security/advisories/new
|
||||
Expires: 2026-09-07T10:00:00.000Z
|
||||
Encryption: https://andreas.heigl.org/publickey/
|
||||
Encryption: https://heigl.org/.well-known/openpgpkey/hu/sfqdema7hgdj146cwzo4rxgsoujxis31
|
||||
Preferred-Languages: en,de
|
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright Andrea Heigl <andreas@heigl.org>
|
||||
*
|
||||
* Licenses under the MIT-license. For details see the included file LICENSE.md
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Org_Heigl\AuthLdap\Exception;
|
||||
|
||||
use Exception;
|
||||
|
||||
class Error extends Exception
|
||||
{
|
||||
public function __construct($message, $line = null)
|
||||
{
|
||||
parent::__construct($message);
|
||||
if ($line) {
|
||||
$this -> line = $line;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright Andreas Heigl <andreas@heigl.org>
|
||||
*
|
||||
* Licenses under the MIT-license. For details see the included file LICENSE.md
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Org_Heigl\AuthLdap\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
class InvalidLdapUri extends RuntimeException
|
||||
{
|
||||
public static function cannotparse(string $ldapUri): self
|
||||
{
|
||||
return new self(sprintf(
|
||||
'%1$s seems not to be a valid URI',
|
||||
$ldapUri
|
||||
));
|
||||
}
|
||||
|
||||
public static function wrongSchema(string $uri): self
|
||||
{
|
||||
return new self(sprintf(
|
||||
'%1$s does not start with a valid schema',
|
||||
$uri
|
||||
));
|
||||
}
|
||||
|
||||
public static function noSchema(string $uri): self
|
||||
{
|
||||
return new self(sprintf(
|
||||
'%1$s does not provide a schema',
|
||||
$uri
|
||||
));
|
||||
}
|
||||
|
||||
public static function noEnvironmentVariableSet(string $uri): self
|
||||
{
|
||||
return new self(sprintf(
|
||||
'The environment variable %1$s does not provide a URI',
|
||||
$uri
|
||||
));
|
||||
}
|
||||
|
||||
public static function noServerProvided(string $uri): self
|
||||
{
|
||||
return new self(sprintf(
|
||||
'The LDAP-URI %1$s does not provide a server',
|
||||
$uri
|
||||
));
|
||||
}
|
||||
|
||||
public static function noSearchBaseProvided(string $uri): self
|
||||
{
|
||||
return new self(sprintf(
|
||||
'The LDAP-URI %1$s does not provide a search-base',
|
||||
$uri
|
||||
));
|
||||
}
|
||||
|
||||
public static function invalidSearchBaseProvided(string $uri): self
|
||||
{
|
||||
return new self(sprintf(
|
||||
'The LDAP-URI %1$s does not provide a valid search-base',
|
||||
$uri
|
||||
));
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright Andreas Heigl <andreas@heigl.org>
|
||||
*
|
||||
* Licenses under the MIT-license. For details see the included file LICENSE.md
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Org_Heigl\AuthLdap\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class MissingValidLdapConnection extends Error
|
||||
{
|
||||
public static function get(): self
|
||||
{
|
||||
return new self(sprintf(
|
||||
'No valid LDAP connection available'
|
||||
));
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright Andreas Heigl <andreas@heigl.org>
|
||||
*
|
||||
* Licenses under the MIT-license. For details see the included file LICENSE.md
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Org_Heigl\AuthLdap\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class SearchUnsuccessfull extends RuntimeException
|
||||
{
|
||||
public static function fromSearchFilter(string $filter): self
|
||||
{
|
||||
return new self(sprintf(
|
||||
'Search for %1$s was not successfull',
|
||||
$filter
|
||||
));
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Copyright Andreas Heigl <andreas@heigl.org>
|
||||
*
|
||||
* Licensed under the MIT-license. For details see the included file LICENSE.md
|
||||
*/
|
||||
|
||||
namespace Org_Heigl\AuthLdap\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class UnknownOption extends RuntimeException
|
||||
{
|
||||
public static function withKey(string $key): self
|
||||
{
|
||||
return new self(sprintf(
|
||||
'An option "%1$s" is not known',
|
||||
$key
|
||||
));
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) Andreas Heigl<andreas@heigl.org>
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author Andreas Heigl<andreas@heigl.org>
|
||||
* @copyright Andreas Heigl
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT-License
|
||||
* @since 07.07.2016
|
||||
* @link http://github.com/heiglandreas/authLDAP
|
||||
*/
|
||||
|
||||
namespace Org_Heigl\AuthLdap;
|
||||
|
||||
use Exception;
|
||||
use Org_Heigl\AuthLdap\Exception\Error;
|
||||
use Org_Heigl\AuthLdap\Exception\SearchUnsuccessfull;
|
||||
use Org_Heigl\AuthLdap\Manager\Ldap;
|
||||
|
||||
class LdapList
|
||||
{
|
||||
/**
|
||||
* @var Ldap[]
|
||||
*/
|
||||
protected $items = [];
|
||||
|
||||
public function addLdap(Ldap $ldap)
|
||||
{
|
||||
$this->items[] = $ldap;
|
||||
}
|
||||
|
||||
public function authenticate($username, $password, $filter = '(uid=%s)')
|
||||
{
|
||||
/** @var Ldap $item */
|
||||
foreach ($this->items as $key => $item) {
|
||||
if (! $item->authenticate($username, $password, $filter)) {
|
||||
unset($this->items[$key]);
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function bind()
|
||||
{
|
||||
$allFailed = true;
|
||||
foreach ($this->items as $key => $item) {
|
||||
try {
|
||||
$item->bind();
|
||||
} catch (\Exception $e) {
|
||||
unset($this->items[$key]);
|
||||
continue;
|
||||
}
|
||||
$allFailed = false;
|
||||
}
|
||||
|
||||
if ($allFailed) {
|
||||
throw new Error('No bind successfull');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function search($filter, $attributes = array('uid'), $base = '')
|
||||
{
|
||||
foreach ($this->items as $item) {
|
||||
try {
|
||||
$result = $item->search($filter, $attributes, $base);
|
||||
return $result;
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
throw SearchUnsuccessfull::fromSearchFilter($filter);
|
||||
}
|
||||
}
|
179
wp-content/upgrade-temp-backup/plugins/authldap/src/LdapUri.php
Normal file
@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) Andreas Heigl<andreas@heigl.org>
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author Andreas Heigl<andreas@heigl.org>
|
||||
* @copyright Andreas Heigl
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT-License
|
||||
* @since 19.07.2020
|
||||
* @link http://github.com/heiglandreas/authLDAP
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Org_Heigl\AuthLdap;
|
||||
|
||||
use Org_Heigl\AuthLdap\Exception\InvalidLdapUri;
|
||||
|
||||
use function array_map;
|
||||
use function error_get_last;
|
||||
use function getenv;
|
||||
use function is_array;
|
||||
use function is_string;
|
||||
use function parse_url;
|
||||
use function preg_replace_callback;
|
||||
use function rawurlencode;
|
||||
use function strlen;
|
||||
use function strpos;
|
||||
use function substr;
|
||||
use function trim;
|
||||
use function urldecode;
|
||||
|
||||
final class LdapUri
|
||||
{
|
||||
private $server;
|
||||
|
||||
private $scheme;
|
||||
|
||||
private $port = 389;
|
||||
|
||||
private string $baseDn;
|
||||
|
||||
private $username = '';
|
||||
|
||||
private $password = '';
|
||||
|
||||
private function __construct(string $uri)
|
||||
{
|
||||
if (!preg_match('/^(ldap|ldaps|env)/', $uri)) {
|
||||
throw InvalidLdapUri::wrongSchema($uri);
|
||||
}
|
||||
|
||||
if (strpos($uri, 'env:') === 0) {
|
||||
$newUri = getenv(substr($uri, 4));
|
||||
if (false === $newUri) {
|
||||
throw InvalidLdapUri::noEnvironmentVariableSet($uri);
|
||||
}
|
||||
$uri = (string) $newUri;
|
||||
}
|
||||
|
||||
$uri = $this->injectEnvironmentVariables($uri);
|
||||
|
||||
$array = parse_url($uri);
|
||||
if (!is_array($array)) {
|
||||
throw InvalidLdapUri::cannotparse($uri);
|
||||
}
|
||||
|
||||
$url = array_map(static function ($item) {
|
||||
if (is_int($item)) {
|
||||
return $item;
|
||||
}
|
||||
return urldecode($item);
|
||||
}, $array);
|
||||
|
||||
|
||||
if (!isset($url['scheme'])) {
|
||||
throw InvalidLdapUri::noSchema($uri);
|
||||
}
|
||||
if (0 !== strpos($url['scheme'], 'ldap')) {
|
||||
throw InvalidLdapUri::wrongSchema($uri);
|
||||
}
|
||||
if (!isset($url['host'])) {
|
||||
throw InvalidLdapUri::noServerProvided($uri);
|
||||
}
|
||||
if (!isset($url['path'])) {
|
||||
throw InvalidLdapUri::noSearchBaseProvided($uri);
|
||||
}
|
||||
if (1 === strlen($url['path'])) {
|
||||
throw InvalidLdapUri::invalidSearchBaseProvided($uri);
|
||||
}
|
||||
|
||||
$this->server = $url['host'];
|
||||
$this->scheme = $url['scheme'];
|
||||
$this->baseDn = substr($url['path'], 1);
|
||||
if (isset($url['user'])) {
|
||||
$this->username = $url['user'];
|
||||
}
|
||||
if ('' === trim($this->username)) {
|
||||
$this->username = 'anonymous';
|
||||
}
|
||||
if (isset($url['pass'])) {
|
||||
$this->password = $url['pass'];
|
||||
}
|
||||
if ($this->scheme === 'ldaps' && $this->port === 389) {
|
||||
$this->port = 636;
|
||||
}
|
||||
|
||||
// When someone sets the port in the URL we overwrite whatever is set.
|
||||
// We have to assume they know what they are doing!
|
||||
if (isset($url['port'])) {
|
||||
$this->port = $url['port'];
|
||||
}
|
||||
}
|
||||
|
||||
public static function fromString(string $uri): LdapUri
|
||||
{
|
||||
return new LdapUri($uri);
|
||||
}
|
||||
|
||||
private function injectEnvironmentVariables(string $base): string
|
||||
{
|
||||
return preg_replace_callback('/%env:([^%]+)%/', static function (array $matches) {
|
||||
return rawurlencode(getenv($matches[1]));
|
||||
}, $base);
|
||||
}
|
||||
|
||||
public function toString(): string
|
||||
{
|
||||
return $this->scheme . '://' . $this->server . ':' . $this->port;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
|
||||
public function getUsername(): string
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
public function getPassword(): string
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
public function getBaseDn(): string
|
||||
{
|
||||
return $this->baseDn;
|
||||
}
|
||||
|
||||
public function isAnonymous(): bool
|
||||
{
|
||||
if ($this->password === '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->username === 'anonymous') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* $Id: ldap.php 381646 2011-05-06 09:37:31Z heiglandreas $
|
||||
*
|
||||
* authLdap - Authenticate Wordpress against an LDAP-Backend.
|
||||
* Copyright (c) 2008 Andreas Heigl<andreas@heigl.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* This file handles the basic LDAP-Tasks
|
||||
*
|
||||
* @author Andreas Heigl<andreas@heigl.org>
|
||||
* @package authLdap
|
||||
* @category authLdap
|
||||
* @since 2008
|
||||
*/
|
||||
|
||||
namespace Org_Heigl\AuthLdap\Manager;
|
||||
|
||||
use Org_Heigl\AuthLdap\Exception\Error;
|
||||
use Org_Heigl\AuthLdap\Exception\MissingValidLdapConnection;
|
||||
use Org_Heigl\AuthLdap\LdapUri;
|
||||
use Org_Heigl\AuthLdap\Wrapper\LdapFactory;
|
||||
use Org_Heigl\AuthLdap\Wrapper\LdapInterface;
|
||||
|
||||
class Ldap
|
||||
{
|
||||
/**
|
||||
* This property contains the connection handle to the ldap-server
|
||||
*
|
||||
* @var LdapInterface|null
|
||||
*/
|
||||
private ?LdapInterface $connection;
|
||||
|
||||
private LdapUri $uri;
|
||||
|
||||
private LdapFactory $factory;
|
||||
|
||||
private $starttls;
|
||||
|
||||
public function __construct(LdapFactory $factory, LdapUri $uri, $starttls = false)
|
||||
{
|
||||
$this->starttls = $starttls;
|
||||
$this->uri = $uri;
|
||||
$this->factory = $factory;
|
||||
$this->connection = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to the given LDAP-Server
|
||||
*/
|
||||
public function connect(): self
|
||||
{
|
||||
$this->disconnect();
|
||||
|
||||
$this->connection = $this->factory->createFromLdapUri($this->uri->toString());
|
||||
$this->connection->setOption(LDAP_OPT_PROTOCOL_VERSION, 3);
|
||||
$this->connection->setOption(LDAP_OPT_REFERRALS, 0);
|
||||
//if configured try to upgrade encryption to tls for ldap connections
|
||||
if ($this->starttls) {
|
||||
$this->connection->startTls();
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect from a resource if one is available
|
||||
*/
|
||||
public function disconnect(): self
|
||||
{
|
||||
if (null !== $this->connection) {
|
||||
$this->connection->unbind();
|
||||
}
|
||||
$this->connection = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind to an LDAP-Server with the given credentials
|
||||
*
|
||||
* @throws Error
|
||||
*/
|
||||
public function bind(): self
|
||||
{
|
||||
if (!$this->connection) {
|
||||
$this->connect();
|
||||
}
|
||||
if (null === $this->connection) {
|
||||
throw MissingValidLdapConnection::get();
|
||||
}
|
||||
if ($this->uri->isAnonymous()) {
|
||||
$bind = $this->connection->bind();
|
||||
} else {
|
||||
$bind = $this->connection->bind($this->uri->getUsername(), $this->uri->getPassword());
|
||||
}
|
||||
if (!$bind) {
|
||||
throw new Error('bind was not successfull: ' . $this->connection->error());
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method does the actual ldap-serch.
|
||||
*
|
||||
* This is using the filter <var>$filter</var> for retrieving the attributes
|
||||
* <var>$attributes</var>
|
||||
*
|
||||
* @return array<string|int, mixed>
|
||||
* @throws Error
|
||||
*/
|
||||
public function search(string $filter, array $attributes = ['uid'], ?string $base = ''): array
|
||||
{
|
||||
if (null === $this->connection) {
|
||||
throw new Error('No resource handle available');
|
||||
}
|
||||
if (!$base) {
|
||||
$base = $this->uri->getBaseDn();
|
||||
}
|
||||
$result = $this->connection->search($base, $filter, $attributes);
|
||||
if ($result === false) {
|
||||
throw new Error('no result found');
|
||||
}
|
||||
$info = $this->connection->getEntries($result);
|
||||
if ($info === false) {
|
||||
throw new Error('invalid results found');
|
||||
}
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method authenticates the user <var>$username</var> using the
|
||||
* password <var>$password</var>
|
||||
*
|
||||
* @param string $filter OPTIONAL This parameter defines the Filter to be used
|
||||
* when searchin for the username. This MUST contain the string '%s' which
|
||||
* will be replaced by the vaue given in <var>$username</var>
|
||||
* @throws Error
|
||||
*/
|
||||
public function authenticate(string $username, string $password, string $filter = '(uid=%s)'): bool
|
||||
{
|
||||
$this->connect();
|
||||
$this->bind();
|
||||
$res = $this->search(sprintf($filter, $this->factory->escape($username, '', LDAP_ESCAPE_FILTER)));
|
||||
if ($res ['count'] !== 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$dn = $res[0]['dn'];
|
||||
return $username && $password && $this->connection->bind($dn, $password);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Copyright Andreas Heigl <andreas@heigl.org>
|
||||
*
|
||||
* Licensed under the MIT-license. For details see the included file LICENSE.md
|
||||
*/
|
||||
|
||||
namespace Org_Heigl\AuthLdap;
|
||||
|
||||
use function json_decode;
|
||||
|
||||
class OptionFactory
|
||||
{
|
||||
public function fromJson(string $json): Options
|
||||
{
|
||||
$option = new Options();
|
||||
$content = json_decode($json, true);
|
||||
foreach ($content as $key => $value) {
|
||||
$option->set($key, $value);
|
||||
}
|
||||
|
||||
return $option;
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Copyright Andreas Heigl <andreas@heigl.org>
|
||||
*
|
||||
* Licensed under the MIT-license. For details see the included file LICENSE.md
|
||||
*/
|
||||
|
||||
namespace Org_Heigl\AuthLdap;
|
||||
|
||||
use Org_Heigl\AuthLdap\Exception\UnknownOption;
|
||||
use function array_key_exists;
|
||||
|
||||
class Options
|
||||
{
|
||||
public const ENABLED = 'Enabled';
|
||||
public const CACHE_PW = 'CachePW';
|
||||
public const URI = 'URI';
|
||||
public const URI_SEPARATOR = 'URISeparator';
|
||||
public const FILTER = 'Filter';
|
||||
public const NAME_ATTR = 'NameAttr';
|
||||
public const SEC_NAME = 'SecName';
|
||||
public const UID_ATTR = 'UidAttr';
|
||||
public const MAIL_ATTR = 'MailAttr';
|
||||
public const WEB_ATTR = 'WebAttr';
|
||||
public const GROUPS = 'Groups';
|
||||
public const DEBUG = 'Debug';
|
||||
public const GROUP_ATTR = 'GroupAttr';
|
||||
public const GROUP_FILTER = 'GroupFilter';
|
||||
public const DEFAULT_ROLE = 'DefaultRole';
|
||||
public const GROUP_ENABLE = 'GroupEnable';
|
||||
public const GROUP_OVER_USER = 'GroupOverUser';
|
||||
public const VERSION = 'Version';
|
||||
public const DO_NOT_OVERWRITE_NON_LDAP_USERS = 'DoNotOverwriteNonLdapUsers';
|
||||
|
||||
private array $settings = [
|
||||
'Enabled' => false,
|
||||
'CachePW' => false,
|
||||
'URI' => '',
|
||||
'URISeparator' => ' ',
|
||||
'Filter' => '', // '(uid=%s)'
|
||||
'NameAttr' => '', // 'name'
|
||||
'SecName' => '',
|
||||
'UidAttr' => '', // 'uid'
|
||||
'MailAttr' => '', // 'mail'
|
||||
'WebAttr' => '',
|
||||
'Groups' => [],
|
||||
'Debug' => false,
|
||||
'GroupAttr' => '', // 'gidNumber'
|
||||
'GroupFilter' => '', // '(&(objectClass=posixGroup)(memberUid=%s))'
|
||||
'DefaultRole' => '',
|
||||
'GroupEnable' => true,
|
||||
'GroupOverUser' => true,
|
||||
'Version' => 1,
|
||||
'DoNotOverwriteNonLdapUsers' => false,
|
||||
];
|
||||
|
||||
public function get(string $key)
|
||||
{
|
||||
if (! array_key_exists($key, $this->settings)) {
|
||||
throw UnknownOption::withKey($key);
|
||||
}
|
||||
|
||||
return $this->settings[$key];
|
||||
}
|
||||
|
||||
public function has(string $key): bool
|
||||
{
|
||||
return array_key_exists($key, $this->settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function set(string $key, $value): void
|
||||
{
|
||||
if (! array_key_exists($key, $this->settings)) {
|
||||
throw UnknownOption::withKey($key);
|
||||
}
|
||||
|
||||
$this->settings[$key] = $value;
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return $this->settings;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright Andreas Heigl <andreas@heigl.org>
|
||||
*
|
||||
* Licenses under the MIT-license. For details see the included file LICENSE.md
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Org_Heigl\AuthLdap;
|
||||
|
||||
use WP_User;
|
||||
|
||||
use function array_search;
|
||||
use function in_array;
|
||||
use function var_dump;
|
||||
|
||||
class UserRoleHandler
|
||||
{
|
||||
/**
|
||||
* @param WP_User $user
|
||||
* @param string[] $roles
|
||||
* @return void
|
||||
*/
|
||||
public function addRolesToUser(WP_User $user, $roles) : void
|
||||
{
|
||||
if ($roles === []) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($user->roles == $roles) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove unused roles from existing.
|
||||
foreach ($user->roles as $role) {
|
||||
if (!in_array($role, $roles)) {
|
||||
// Remove unused roles.
|
||||
$user->remove_role($role);
|
||||
continue;
|
||||
}
|
||||
// Remove the existing role from roles.
|
||||
if (($key = array_search($role, $roles)) !== false) {
|
||||
unset($roles[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add new ones if not already assigned.
|
||||
foreach ($roles as $role) {
|
||||
$user->add_role($role);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright Andreas Heigl <andreas@heigl.org>
|
||||
*
|
||||
* Licenses under the MIT-license. For details see the included file LICENSE.md
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Org_Heigl\AuthLdap\Wrapper;
|
||||
|
||||
use function ldap_bind;
|
||||
use function ldap_connect;
|
||||
use function ldap_error;
|
||||
use function ldap_escape;
|
||||
use function ldap_get_entries;
|
||||
use function ldap_set_option;
|
||||
use function ldap_start_tls;
|
||||
use function ldap_unbind;
|
||||
use function var_dump;
|
||||
|
||||
final class Ldap implements LdapInterface
|
||||
{
|
||||
private $connection;
|
||||
|
||||
public function __construct(string $ldapUri)
|
||||
{
|
||||
$this->connection = ldap_connect($ldapUri);
|
||||
}
|
||||
|
||||
public function bind($dn = null, $password = null)
|
||||
{
|
||||
if (null === $dn && null === $password) {
|
||||
return ldap_bind($this->connection);
|
||||
}
|
||||
return ldap_bind($this->connection, $dn, $password);
|
||||
}
|
||||
|
||||
public function unbind()
|
||||
{
|
||||
return ldap_unbind($this->connection);
|
||||
}
|
||||
|
||||
public function setOption($option, $value)
|
||||
{
|
||||
return ldap_set_option($this->connection, $option, $value);
|
||||
}
|
||||
|
||||
public function startTls()
|
||||
{
|
||||
return ldap_start_tls($this->connection);
|
||||
}
|
||||
|
||||
public function error()
|
||||
{
|
||||
return ldap_error($this->connection);
|
||||
}
|
||||
|
||||
public function errno()
|
||||
{
|
||||
return ldap_errno($this->connection);
|
||||
}
|
||||
|
||||
public function search(
|
||||
$base,
|
||||
$filter,
|
||||
array $attributes = [],
|
||||
$attributes_only = 0,
|
||||
$sizelimit = -1,
|
||||
$timelimit = -1
|
||||
) {
|
||||
return ldap_search(
|
||||
$this->connection,
|
||||
$base,
|
||||
$filter,
|
||||
$attributes,
|
||||
$attributes_only,
|
||||
$sizelimit,
|
||||
$timelimit
|
||||
);
|
||||
}
|
||||
|
||||
public function getEntries($search_result)
|
||||
{
|
||||
return ldap_get_entries($this->connection, $search_result);
|
||||
}
|
||||
|
||||
public static function escape(string $value, string $ignore = '', int $flags = 0): string
|
||||
{
|
||||
return ldap_escape($value, $ignore, $flags);
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright Andreas Heigl <andreas@heigl.org>
|
||||
*
|
||||
* Licenses under the MIT-license. For details see the included file LICENSE.md
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Org_Heigl\AuthLdap\Wrapper;
|
||||
|
||||
class LdapFactory
|
||||
{
|
||||
public function createFromLdapUri(string $ldapUri): LdapInterface
|
||||
{
|
||||
return new Ldap($ldapUri);
|
||||
}
|
||||
|
||||
public function escape($value, $ignore = '', $flags = 0): string
|
||||
{
|
||||
return Ldap::escape($value, $ignore, $flags);
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright Andreas Heigl <andreas@heigl.org>
|
||||
*
|
||||
* Licenses under the MIT-license. For details see the included file LICENSE.md
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Org_Heigl\AuthLdap\Wrapper;
|
||||
|
||||
interface LdapInterface
|
||||
{
|
||||
public function bind($dn = null, $password = null);
|
||||
|
||||
public function unbind();
|
||||
|
||||
public function setOption($option, $value);
|
||||
|
||||
public function startTls();
|
||||
|
||||
public function error();
|
||||
|
||||
public function errno();
|
||||
|
||||
public function search(
|
||||
$base,
|
||||
$filter,
|
||||
array $attributes = [],
|
||||
$attributes_only = 0,
|
||||
$sizelimit = -1,
|
||||
$timelimit = -1
|
||||
);
|
||||
|
||||
public function getEntries($search_result);
|
||||
|
||||
public static function escape(string $value, string $ignore = '', int $flags = 0): string;
|
||||
}
|
454
wp-content/upgrade-temp-backup/plugins/authldap/view/admin.phtml
Normal file
@ -0,0 +1,454 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c)2014-2014 heiglandreas
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIBILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @category
|
||||
* @author Andreas Heigl<andreas@heigl.org>
|
||||
* @copyright ©2014-2014 Andreas Heigl
|
||||
* @license http://www.opesource.org/licenses/mit-license.php MIT-License
|
||||
* @version 0.0
|
||||
* @since 19.12.14
|
||||
* @link https://github.com/heiglandreas/authLdap
|
||||
*/
|
||||
?><div class="wrap">
|
||||
<?php if (! extension_loaded('ldap')) : ?>
|
||||
<div class="error"><strong>Caveat:</strong> The LDAP-extension is not loaded!
|
||||
Without that extension it is not possible to query an LDAP-Server! Please have a look
|
||||
at <a href="http://php.net/manual/install.php">the PHP-Installation page</a>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<h2>AuthLDAP Options</h2>
|
||||
<form class="authldap-options" method="post" id="authLDAP_options" action="<?php echo $action;?>">
|
||||
<input name="authLdapNonce" type="hidden" value="<?php echo wp_create_nonce('authLdapNonce'); ?>" />
|
||||
<h3 class="title">General Usage of authLDAP</h3>
|
||||
<fieldset class="options">
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th>
|
||||
<label for="authLDAPAuth">Enable Authentication via LDAP?</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="checkbox" name="authLDAPAuth" id="authLDAPAuth" value="1"<?php echo $tChecked; ?>/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="authLDAPDebug">Debug AuthLDAP?</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="checkbox" name="authLDAPDebug" id="authLDAPDebug" value="1"<?php echo $tDebugChecked; ?>/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="authLDAPDoNotOverwriteNonLdapUsers">Do not authenticate existing WordPress-Users</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="checkbox" name="authLDAPDoNotOverwriteNonLdapUsers" id="authLDAPDoNotOverwriteNonLdapUsers" value="1"<?php echo $tDoNotOverwriteNonLdapUsers; ?>/>
|
||||
<p class="description">
|
||||
Shall we prohibit authenticating already in WordPress created users using LDAP? If you enable this, LDAP-Users with the same user-ID
|
||||
as existing WordPress-Users can no longer take over the WordPress-Users account. This also means that LDAP-Users with the same User-ID as existing
|
||||
WordPress-Users will <strong>not</strong> be able to authenticate anymore! Accounts that have been taken over already will not be affected by this setting.
|
||||
</p>
|
||||
<p class="description">This should only be checked if you know what you are doing!</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="authLDAPCachePW">Save entered passwords in the wordpress user table?</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="checkbox" name="authLDAPCachePW" id="authLDAPCachePW" value="1"<?php echo $tPWChecked; ?>/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="authLDAPGroupEnable">Map LDAP Groups to wordpress Roles?</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="checkbox" name="authLDAPGroupEnable" id="authLDAPGroupEnable" value="1"<?php echo $tGroupChecked; ?>/>
|
||||
<p class="description">
|
||||
Search LDAP for user's groups and map to Wordpress Roles.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<h3 class="title">General Server Settings</h3>
|
||||
<fieldset class="options">
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th>
|
||||
<label for="authLDAPURI">LDAP URI</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="authLDAPURI" id="authLDAPURI" placeholder="LDAP-URI"
|
||||
class="regular-text" value="<?php echo $authLDAPURI; ?>"/>
|
||||
<p class="description">
|
||||
The <abbr title="Uniform Ressource Identifier">URI</abbr>
|
||||
for connecting to the LDAP-Server. This usualy takes the form
|
||||
<var><scheme>://<user>:<password>@<server>/<path></var>
|
||||
according to RFC 1738.</p>
|
||||
<p class="description">
|
||||
In this case it schould be something like
|
||||
<var>ldap://uid=adminuser,dc=example,c=com:secret@ldap.example.com/dc=basePath,dc=example,c=com</var>.
|
||||
</p>
|
||||
<p class="description">
|
||||
If your LDAP accepts anonymous login, you can ommit the user and
|
||||
password-Part of the URI
|
||||
</p>
|
||||
<p class="description">
|
||||
You can use the pseudo-schema <em>env</em> to provide your LDAP-URI from an environment-variable. So if you have your
|
||||
LDAP-URI in a variable called <code>LDAP_URI</code> you can enter <code>env:LDAP_URI</code> in this field and at runtime the
|
||||
appropriate value will be taken from the Environment-variable <code>LDAP_URI</code>. If the varialbe is not set, then the value will be empty.
|
||||
</p>
|
||||
<p class="description">
|
||||
You can also provide different parts of the LDP-URI from environment variables by providing
|
||||
<code>%env:[VARIABLENAME]%</code> within your LDAP-URI. So if you want to provide the
|
||||
password from an Environment-variable <code>LDAP_PASSWORD</code> your LDAP-URI looks like
|
||||
<code>ldap://uid=adminuser,dc=example,c=com:%env:LDAP_PASSWORD%@ldap.example.com/dc=basePath,dc=example,c=com</code>
|
||||
</p>
|
||||
<p class="description">
|
||||
<strong>Caveat!</strong><br/>
|
||||
If you are using Environment-variables for parts of the LDAP-URL then those <strong>must not</strong> be URL-Encoded!<br/>
|
||||
Otherwise the different parts <strong>must</strong> be URL-Encoded!
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="authLDAPURISeparator">LDAP URI-Separator</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="authLDAPURISeparator" id="authLDAPURISeparator" placeholder="LDAP-URI Separator"
|
||||
class="regular-text" value="<?php echo $authLDAPURISeparator; ?>"/>
|
||||
<p class="description">
|
||||
A separator that separates multiple LDAP-URIs from one another.
|
||||
You can use that feature to try to authenticate against multiple LDAP-Servers
|
||||
as long as they all have the same attribute-settings. The first LDAP-Server the user can
|
||||
authenticate against will be used to handle the user.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="authLDAPStartTLS" class="description">StartTLS</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="checkbox" name="authLDAPStartTLS" id="authLDAPStartTLS" value="1"<?php echo $tStartTLSChecked; ?>/>
|
||||
<p class="description">
|
||||
Use StartTLS for encryption of ldap connections. This setting is not to be used in combination with ldaps connections (ldap:// only).
|
||||
</p>
|
||||
</td>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="authLDAPFilter" class="description">Filter</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="authLDAPFilter" id="authLDAPFilter" placeholder="(uid=%s)"
|
||||
class="regular-text" value="<?php echo $authLDAPFilter; ?>"/>
|
||||
<p class="description">
|
||||
Please provide a valid filter that can be used for querying the
|
||||
<abbr title="Lightweight Directory Access Protocol">LDAP</abbr>
|
||||
for the correct user. For more information on this
|
||||
feature have a look at <a href="http://andreas.heigl.org/cat/dev/wp/authldap">http://andreas.heigl.org/cat/dev/wp/authldap</a>
|
||||
</p>
|
||||
<p class="description">
|
||||
This field <strong>should</strong> include the string <code>%s</code>
|
||||
that will be replaced with the username provided during log-in
|
||||
</p>
|
||||
<p class="description">
|
||||
If you leave this field empty it defaults to <strong>(uid=%s)</strong>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<h3 class="title">Settings for creating new Users</h3>
|
||||
<fieldset class="options">
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="authLDAPUseUserAccount">User-Read</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="checkbox" name="authLDAPUseUserAccount" id="authLDAPUseUserAccount" value="1"<?php echo $tUserRead; ?>/><br />
|
||||
<p class="description">
|
||||
If checked the plugin will use the user's account to query their own information. If not it will use the admin account.
|
||||
</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="authLDAPNameAttr">Name-Attribute</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="authLDAPNameAttr" id="authLDAPNameAttr" placeholder="name"
|
||||
class="regular-text" value="<?php echo $authLDAPNameAttr; ?>"/><br />
|
||||
<p class="description">
|
||||
Which Attribute from the LDAP contains the Full or the First name
|
||||
of the user trying to log in.
|
||||
</p>
|
||||
<p class="description">
|
||||
This defaults to <strong>name</strong>
|
||||
</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="authLDAPSecName">Second Name Attribute</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="authLDAPSecName" id="authLDAPSecName" placeholder=""
|
||||
class="regular-text" value="<?php echo $authLDAPSecName; ?>" />
|
||||
<p class="description">
|
||||
If the above Name-Attribute only contains the First Name of the
|
||||
user you can here specify an Attribute that contains the second name.
|
||||
</p>
|
||||
<p class="description">
|
||||
This field is empty by default
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="authLDAPUidAttr">User-ID Attribute</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="authLDAPUidAttr" id="authLDAPUidAttr" placeholder="uid"
|
||||
class="regular-text" value="<?php echo $authLDAPUidAttr; ?>" />
|
||||
<p class="description">
|
||||
Please give the Attribute, that is used to identify the user. This
|
||||
should be the same as you used in the above <em>Filter</em>-Option
|
||||
</p>
|
||||
<p class="description">
|
||||
This field defaults to <strong>uid</strong>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="authLDAPMailAttr">Mail Attribute</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="authLDAPMailAttr" id="authLDAPMailAttr" placeholder="mail"
|
||||
class="regular-text" value="<?php echo $authLDAPMailAttr; ?>" />
|
||||
<p class="description">
|
||||
Which Attribute holds the eMail-Address of the user?
|
||||
</p>
|
||||
<p class="description">
|
||||
If more than one eMail-Address are stored in the LDAP, only the first given is used
|
||||
</p>
|
||||
<p class="description">
|
||||
This field defaults to <strong>mail</strong>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="authLDAPWebAttr">Web-Attribute</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="authLDAPWebAttr" id="authLDAPWebAttr" placeholder=""
|
||||
class="regular-text" value="<?php echo $authLDAPWebAttr; ?>" />
|
||||
<p class="description">
|
||||
If your users have a personal page (URI) stored in the LDAP, it can
|
||||
be provided here.
|
||||
</p>
|
||||
<p class="description">
|
||||
This field is empty by default
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="authLDAPDefaultRole">Default Role</label>
|
||||
</th>
|
||||
<td>
|
||||
<select name="authLDAPDefaultRole" id="authLDAPDefaultRole">
|
||||
<option value="" <?php echo ( $authLDAPDefaultRole == '' ? 'selected="selected"' : '' ); ?>>
|
||||
None (deny access)
|
||||
</option>
|
||||
<?php foreach ($roles->get_names() as $group => $vals) : ?>
|
||||
<option value="<?php echo $group; ?>" <?php echo ( $authLDAPDefaultRole == $group ? 'selected="selected"' : '' ); ?>>
|
||||
<?php echo $vals; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<p class="description">
|
||||
Here you can select the default role for users.
|
||||
If you enable LDAP Groups below, they will take precedence over the Default Role.
|
||||
</p>
|
||||
<p class="description">
|
||||
Existing users will retain their roles unless overriden by LDAP Groups below.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<div id="authldaprolemapping">
|
||||
<h3 class="title">Groups for Roles</h3>
|
||||
<fieldset class="options">
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th>
|
||||
<label for="authLDAPGroupOverUser">LDAP Groups override role of existing users?</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="checkbox" name="authLDAPGroupOverUser" id="authLDAPGroupOverUser" value="1"<?php echo $tGroupOverUserChecked; ?>/>
|
||||
<p class="description">
|
||||
If role determined by LDAP Group differs from existing Wordpress User's role, use LDAP Group.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="authLDAPGroupBase">Group-Base</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="authLDAPGroupBase" id="authLDAPGroupBase" placeholder=""
|
||||
class="regular-text" value="<?php echo $authLDAPGroupBase; ?>" />
|
||||
<p class="description">
|
||||
This is the base dn to lookup groups.
|
||||
</p>
|
||||
<p class="description">
|
||||
If empty the base dn of the LDAP URI will be used
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="authLDAPGroupAttr">Group-Attribute</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="authLDAPGroupAttr" id="authLDAPGroupAttr" placeholder="gidNumber"
|
||||
class="regular-text" value="<?php echo $authLDAPGroupAttr; ?>" />
|
||||
<p class="description">
|
||||
This is the attribute that defines the Group-ID that can be matched
|
||||
against the Groups defined further down
|
||||
</p>
|
||||
<p class="description">
|
||||
This field defaults to <strong>gidNumber</strong>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="authLDAPGroupSeparator">Group-Separator</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="authLDAPGroupSeparator" id="authLDAPGroupSeparator" placeholder=","
|
||||
class="regular-text" value="<?php echo $authLDAPGroupSeparator; ?>" />
|
||||
<p class="description">
|
||||
This attribute defines the separator used for the Group-IDs listed in the
|
||||
Groups defined further down. This is useful if the value of Group-Attribute
|
||||
listed above can contain a comma (for example, when using the memberof attribute)
|
||||
</p>
|
||||
<p class="description">
|
||||
This field defaults to <strong>, (comma)</strong>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="authLDAPGroupFilter">Group-Filter</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="authLDAPGroupFilter" id="authLDAPGroupFilter"
|
||||
placeholder="(&(objectClass=posixGroup)(memberUid=%s))"
|
||||
class="regular-text" value="<?php echo $authLDAPGroupFilter; ?>" />
|
||||
<p class="description">
|
||||
Here you can add the filter for selecting groups for ther
|
||||
currentlly logged in user
|
||||
</p>
|
||||
<p class="description">
|
||||
The Filter should contain the string <code>%s</code> which will be replaced by
|
||||
the login-name of the currently logged in user
|
||||
</p>
|
||||
<p class="description">
|
||||
Alternatively the string <code>%dn%</code> will be replaced by the
|
||||
DN of the currently logged in user. This can be helpfull if
|
||||
group-memberships are defined with DNs rather than UIDs
|
||||
</p>
|
||||
<p class="description">This field defaults to
|
||||
<strong>(&(objectClass=posixGroup)(memberUid=%s))</strong>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<h3 class="title">Role - group mapping</h3>
|
||||
<fieldset class="options">
|
||||
<p class="description">You can set multiple values per role by separating them with a coma</p>
|
||||
<p class="description">The values are empty by default</p>
|
||||
<table class="form-table">
|
||||
<thead>
|
||||
<th scope="row">Assign this WordPress-Role</th>
|
||||
<th style="width:auto;">to members of this/these LDAP-Groups</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($roles->get_names() as $group => $vals) :
|
||||
$aGroup=$authLDAPGroups[$group]; ?>
|
||||
<tr>
|
||||
<th scope="row" style="width:auto; min-width: 200px;">
|
||||
<label for="authLDAPGroups[<?php echo $group; ?>]">
|
||||
<?php echo $vals; ?>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="authLDAPGroups[<?php echo $group; ?>]" id="authLDAPGroups[<?php echo $group; ?>]"
|
||||
value="<?php echo $aGroup; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
<fieldset class="buttons">
|
||||
<p class="submit">
|
||||
<input type="submit" name="ldapOptionsSave" class="button button-primary" value="Save Changes" />
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
elem = document.getElementById('authLDAPGroupEnable');
|
||||
if(! elem.checked) {
|
||||
document.getElementById('authldaprolemapping').setAttribute('style', 'display:none;');
|
||||
}
|
||||
|
||||
elem.addEventListener('change', function(e){
|
||||
if(! e.target.checked) {
|
||||
document.getElementById('authldaprolemapping').setAttribute('style', 'display:none;');
|
||||
} else {
|
||||
document.getElementById('authldaprolemapping').removeAttribute('style');
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
@ -0,0 +1,577 @@
|
||||
<?php
|
||||
|
||||
// Event schedules failed
|
||||
if ( !wp_next_scheduled ( 'cau_set_schedule_mail' ) ) {
|
||||
echo '<div id="message" class="error"><p><b>'.__( 'Companion Auto Update was not able to set the event for sending you emails, please re-activate the plugin in order to set the event', 'companion-auto-update' ).'.</b></p></div>';
|
||||
}
|
||||
|
||||
// Database requires an update
|
||||
if ( cau_incorrectDatabaseVersion() ) {
|
||||
echo '<div id="message" class="error"><p><b>'.__( 'Companion Auto Update Database Update', 'companion-auto-update' ).' –</b>
|
||||
'.__( 'We need you to update to the latest database version', 'companion-auto-update' ).'. <a href="'.cau_url( 'status' ).'&run=db_update" class="button button-alt" style="background: #FFF;">'.__( 'Run updater now', 'companion-auto-update' ).'</a></p></div>';
|
||||
}
|
||||
|
||||
// Update log DB is empty
|
||||
if ( cau_updateLogDBisEmpty() ) {
|
||||
echo '<div id="message" class="error"><p><b>'.__( 'Companion Auto Update Database Update', 'companion-auto-update' ).' –</b>
|
||||
'.__( 'We need to add some information to your database', 'companion-auto-update' ).'. <a href="'.cau_url( 'status' ).'&run=db_info_update" class="button button-alt" style="background: #FFF;">'.__( 'Run updater now', 'companion-auto-update' ).'</a></p></div>';
|
||||
}
|
||||
|
||||
// Save settings
|
||||
if( isset( $_POST['submit'] ) ) {
|
||||
|
||||
check_admin_referer( 'cau_save_settings' );
|
||||
|
||||
global $wpdb;
|
||||
$table_name = $wpdb->prefix . "auto_updates";
|
||||
|
||||
// Auto updater
|
||||
$plugins = isset( $_POST['plugins'] ) ? sanitize_text_field( $_POST['plugins'] ) : '';
|
||||
$themes = isset( $_POST['themes'] ) ? sanitize_text_field( $_POST['themes'] ) : '';
|
||||
$minor = isset( $_POST['minor'] ) ? sanitize_text_field( $_POST['minor'] ) : '';
|
||||
$major = isset( $_POST['major'] ) ? sanitize_text_field( $_POST['major'] ) : '';
|
||||
$translations = isset( $_POST['translations'] ) ? sanitize_text_field( $_POST['translations'] ) : '';
|
||||
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'plugins'", $plugins ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'themes'", $themes ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'minor'", $minor ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'major'", $major ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'translations'", $translations ) );
|
||||
|
||||
// Emails
|
||||
$send = isset( $_POST['cau_send'] ) ? sanitize_text_field( $_POST['cau_send'] ) : '';
|
||||
$sendupdate = isset( $_POST['cau_send_update'] ) ? sanitize_text_field( $_POST['cau_send_update'] ) : '';
|
||||
$sendoutdated = isset( $_POST['cau_send_outdated'] ) ? sanitize_text_field( $_POST['cau_send_outdated'] ) : '';
|
||||
$wpemails = isset( $_POST['wpemails'] ) ? sanitize_text_field( $_POST['wpemails'] ) : '';
|
||||
$email = isset( $_POST['cau_email'] ) ? sanitize_text_field( $_POST['cau_email'] ) : '';
|
||||
$html_or_text = isset( $_POST['html_or_text'] ) ? sanitize_text_field( $_POST['html_or_text'] ) : 'html';
|
||||
$dbupdateemails = isset( $_POST['dbupdateemails'] ) ? sanitize_text_field( $_POST['dbupdateemails'] ) : '';
|
||||
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'email'", $email ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'send'", $send ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'sendupdate'", $sendupdate ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'sendoutdated'", $sendoutdated ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'wpemails'", $wpemails ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'html_or_text'", $html_or_text ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'dbupdateemails'", $dbupdateemails ) );
|
||||
|
||||
// Advanced
|
||||
$allow_editor = isset( $_POST['allow_editor'] ) ? sanitize_text_field( $_POST['allow_editor'] ) : '';
|
||||
$allow_author = isset( $_POST['allow_author'] ) ? sanitize_text_field( $_POST['allow_author'] ) : '';
|
||||
$advanced_info_emails = isset( $_POST['advanced_info_emails'] ) ? sanitize_text_field( $_POST['advanced_info_emails'] ) : '';
|
||||
$plugin_links_emails = isset( $_POST['plugin_links_emails'] ) ? sanitize_text_field( $_POST['plugin_links_emails'] ) : '';
|
||||
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'allow_editor'", $allow_editor ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'allow_author'", $allow_author ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'advanced_info_emails'", $advanced_info_emails ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'plugin_links_emails'", $plugin_links_emails ) );
|
||||
|
||||
// Delay
|
||||
$update_delay = isset( $_POST['update_delay'] ) ? sanitize_text_field( $_POST['update_delay'] ) : '';
|
||||
$update_delay_days = isset( $_POST['update_delay_days'] ) ? sanitize_text_field( $_POST['update_delay_days'] ) : '';
|
||||
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'update_delay'", $update_delay ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'update_delay_days'", $update_delay_days ) );
|
||||
|
||||
// Intervals
|
||||
|
||||
// Set variables
|
||||
$plugin_sc = sanitize_text_field( $_POST['plugin_schedule'] );
|
||||
$theme_sc = sanitize_text_field( $_POST['theme_schedule'] );
|
||||
$core_sc = sanitize_text_field( $_POST['core_schedule'] );
|
||||
$schedule_mail = sanitize_text_field( $_POST['update_notifications'] );
|
||||
$outdated_notifier = sanitize_text_field( $_POST['outdated_notifier'] );
|
||||
|
||||
// First clear schedules
|
||||
wp_clear_scheduled_hook( 'wp_update_plugins' );
|
||||
wp_clear_scheduled_hook( 'wp_update_themes' );
|
||||
wp_clear_scheduled_hook( 'wp_version_check' );
|
||||
wp_clear_scheduled_hook( 'cau_set_schedule_mail' );
|
||||
wp_clear_scheduled_hook( 'cau_custom_hooks_plugins' );
|
||||
wp_clear_scheduled_hook( 'cau_custom_hooks_themes' );
|
||||
wp_clear_scheduled_hook( 'cau_log_updater' );
|
||||
wp_clear_scheduled_hook( 'cau_outdated_notifier' );
|
||||
|
||||
// Then set the new times
|
||||
|
||||
// Plugins
|
||||
if( $plugin_sc == 'daily' ) {
|
||||
|
||||
$date = date( 'Y-m-d' );
|
||||
$hours = sanitize_text_field( $_POST['plugin_schedule-sethour'] );
|
||||
$minutes = sanitize_text_field( $_POST['plugin_schedule-setminutes'] );
|
||||
$seconds = date( 's' );
|
||||
$fullDate = $date.' '.$hours.':'.$minutes.':'.$seconds;
|
||||
$pluginSetTime = strtotime( $fullDate );
|
||||
|
||||
wp_schedule_event( $pluginSetTime, $plugin_sc, 'wp_update_plugins' );
|
||||
wp_schedule_event( $pluginSetTime, $plugin_sc, 'cau_custom_hooks_plugins' );
|
||||
wp_schedule_event( ( $pluginSetTime - 1800 ), $plugin_sc, 'cau_log_updater' );
|
||||
|
||||
} else {
|
||||
wp_schedule_event( time(), $plugin_sc, 'wp_update_plugins' );
|
||||
wp_schedule_event( time(), $plugin_sc, 'cau_custom_hooks_plugins' );
|
||||
wp_schedule_event( ( time() - 1800 ), $plugin_sc, 'cau_log_updater' );
|
||||
}
|
||||
|
||||
// Themes
|
||||
if( $theme_sc == 'daily' ) {
|
||||
|
||||
$dateT = date( 'Y-m-d' );
|
||||
$hoursT = sanitize_text_field( $_POST['theme_schedule-sethour'] );
|
||||
$minutesT = sanitize_text_field( $_POST['theme_schedule-setminutes'] );
|
||||
$secondsT = date( 's' );
|
||||
$fullDateT = $dateT.' '.$hoursT.':'.$minutesT.':'.$secondsT;
|
||||
$themeSetTime = strtotime( $fullDateT );
|
||||
|
||||
wp_schedule_event( $themeSetTime, $theme_sc, 'wp_update_themes' );
|
||||
wp_schedule_event( $themeSetTime, $theme_sc, 'cau_custom_hooks_themes' );
|
||||
|
||||
} else {
|
||||
wp_schedule_event( time(), $theme_sc, 'wp_update_themes' );
|
||||
wp_schedule_event( time(), $theme_sc, 'cau_custom_hooks_themes' );
|
||||
}
|
||||
|
||||
// Core
|
||||
if( $core_sc == 'daily' ) {
|
||||
|
||||
$dateC = date( 'Y-m-d' );
|
||||
$hoursC = sanitize_text_field( $_POST['core_schedule-sethour'] );
|
||||
$minutesC = sanitize_text_field( $_POST['core_schedule-setminutes'] );
|
||||
$secondsC = date( 's' );
|
||||
$fullDateC = $dateC.' '.$hoursC.':'.$minutesC.':'.$secondsC;
|
||||
$coreSetTime = strtotime( $fullDateC );
|
||||
|
||||
wp_schedule_event( $coreSetTime, $core_sc, 'wp_version_check' );
|
||||
|
||||
} else {
|
||||
wp_schedule_event( time(), $core_sc, 'wp_version_check' );
|
||||
}
|
||||
|
||||
// Update notifications
|
||||
if( $schedule_mail == 'daily' ) {
|
||||
|
||||
$dateT = date( 'Y-m-d' );
|
||||
$hoursT = sanitize_text_field( $_POST['update_notifications-sethour'] );
|
||||
$minutesT = sanitize_text_field( $_POST['update_notifications-setminutes'] );
|
||||
$secondsT = date( 's' );
|
||||
$fullDateT = $dateT.' '.$hoursT.':'.$minutesT.':'.$secondsT;
|
||||
$emailSetTime = strtotime( $fullDateT );
|
||||
|
||||
wp_schedule_event( $emailSetTime, $schedule_mail, 'cau_set_schedule_mail' );
|
||||
|
||||
} else {
|
||||
wp_schedule_event( time(), $schedule_mail, 'cau_set_schedule_mail' );
|
||||
}
|
||||
|
||||
// Outdated notifications
|
||||
if( $outdated_notifier == 'daily' ) {
|
||||
|
||||
$dateT = date( 'Y-m-d' );
|
||||
$hoursT = sanitize_text_field( $_POST['outdated_notifier-sethour'] );
|
||||
$minutesT = sanitize_text_field( $_POST['outdated_notifier-setminutes'] );
|
||||
$secondsT = date( 's' );
|
||||
$fullDateT = $dateT.' '.$hoursT.':'.$minutesT.':'.$secondsT;
|
||||
$emailSetTime = strtotime( $fullDateT );
|
||||
|
||||
wp_schedule_event( $emailSetTime, $outdated_notifier, 'cau_outdated_notifier' );
|
||||
|
||||
} else {
|
||||
wp_schedule_event( time(), $outdated_notifier, 'cau_outdated_notifier' );
|
||||
}
|
||||
|
||||
|
||||
echo '<div id="message" class="updated"><p><b>'.__( 'Settings saved.' ).'</b></p></div>';
|
||||
|
||||
}
|
||||
|
||||
// Welcome screen for first time viewers
|
||||
if( isset( $_GET['welcome'] ) ) {
|
||||
echo '<div class="welcome-to-cau welcome-bg" style="margin-bottom: 0px;">
|
||||
<div class="welcome-image">
|
||||
</div><div class="welcome-content">
|
||||
|
||||
<h3>'.__( 'Welcome to Companion Auto Update', 'companion-auto-update' ).'</h3>
|
||||
<br />
|
||||
<p><strong>'.__( 'You\'re set and ready to go', 'companion-auto-update' ).'</strong></p>
|
||||
<p>'.__( 'The plugin is all set and ready to go with the recommended settings, but if you\'d like you can change them below.' ).'</p>
|
||||
<br />
|
||||
<p><strong>'.__( 'Get Started' ).': </strong> <a href="'.cau_url( 'pluginlist' ).'">'.__( 'Update filter', 'companion-auto-update' ).'</a> |
|
||||
<strong>'.__( 'More Actions' ).': </strong> <a href="http://codeermeneer.nl/cau_poll/" target="_blank">'.__('Give feedback', 'companion-auto-update').'</a> - <a href="https://translate.wordpress.org/projects/wp-plugins/companion-auto-update/" target="_blank">'.__( 'Help us translate', 'companion-auto-update' ).'</a></p>
|
||||
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
$cs_hooks_p = wp_get_schedule( 'cau_custom_hooks_plugins' );
|
||||
$cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
|
||||
|
||||
?>
|
||||
|
||||
<div class="cau-dashboard cau-column-wide">
|
||||
|
||||
<form method="POST">
|
||||
|
||||
<div class="welcome-to-cau update-bg cau-dashboard-box">
|
||||
|
||||
<h2 class="title"><?php _e('Auto Updater', 'companion-auto-update');?></h2>
|
||||
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<td>
|
||||
<fieldset>
|
||||
|
||||
<?php
|
||||
|
||||
$plugins_on = ( cau_get_db_value( 'plugins' ) == 'on' ) ? "CHECKED" : "";
|
||||
$themes_on = ( cau_get_db_value( 'themes' ) == 'on' ) ? "CHECKED" : "";
|
||||
$minor_on = ( cau_get_db_value( 'minor' ) == 'on' ) ? "CHECKED" : "";
|
||||
$major_on = ( cau_get_db_value( 'major' ) == 'on' ) ? "CHECKED" : "";
|
||||
$translations_on = ( cau_get_db_value( 'translations' ) == 'on' ) ? "CHECKED" : "";
|
||||
|
||||
echo "<p><input id='plugins' name='plugins' type='checkbox' {$plugins_on}/><label for='plugins'>".__( 'Auto update plugins?', 'companion-auto-update' )."</label></p>";
|
||||
echo "<p><input id='themes' name='themes' type='checkbox' {$themes_on}/><label for='themes'>".__( 'Auto update themes?', 'companion-auto-update' )."</label></p>";
|
||||
echo "<p><input id='minor' name='minor' type='checkbox' {$minor_on}/><label for='minor'>".__( 'Auto update minor core updates?', 'companion-auto-update' )." <code class='majorMinorExplain'>6.0.0 > 6.0.1</code></label></p>";
|
||||
echo "<p><input id='major' name='major' type='checkbox' {$major_on}/><label for='major'>".__( 'Auto update major core updates?', 'companion-auto-update' )." <code class='majorMinorExplain'>6.0.0 > 6.1.0</code></label></p>";
|
||||
echo "<p><input id='translations' name='translations' type='checkbox' {$translations_on}/><label for='translations'>".__( 'Auto update translation files?', 'companion-auto-update' )."</label></p>";
|
||||
|
||||
?>
|
||||
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="welcome-to-cau email-bg cau-dashboard-box">
|
||||
|
||||
<h2 class="title"><?php _e( 'Email Notifications', 'companion-auto-update' );?></h2>
|
||||
|
||||
<?php
|
||||
|
||||
$db_email = cau_get_db_value( 'email' );
|
||||
$toemail = ( $db_email == '' ) ? get_option( 'admin_email' ) : $db_email;
|
||||
|
||||
$hot = cau_get_db_value( 'html_or_text' );
|
||||
|
||||
?>
|
||||
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Update notifications', 'companion-auto-update' );?></th>
|
||||
<td>
|
||||
<p>
|
||||
<input id="cau_send_update" name="cau_send_update" type="checkbox" <?php if( cau_get_db_value( 'sendupdate' ) == 'on' ) { echo 'checked'; } ?> />
|
||||
<label for="cau_send_update"><?php _e( 'Send me emails when something has been updated.', 'companion-auto-update' );?></label>
|
||||
</p>
|
||||
<p>
|
||||
<input id="cau_send" name="cau_send" type="checkbox" <?php if( cau_get_db_value( 'send' ) == 'on' ) { echo 'checked'; } ?> />
|
||||
<label for="cau_send"><?php _e( 'Send me emails when an update is available.', 'companion-auto-update' );?></label>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Check for outdated software', 'companion-auto-update' );?></th>
|
||||
<td>
|
||||
<p>
|
||||
<input id="cau_send_outdated" name="cau_send_outdated" type="checkbox" <?php if( cau_get_db_value( 'sendoutdated' ) == 'on' ) { echo 'checked'; } ?> />
|
||||
<label for="cau_send_outdated"><?php _e( 'Be notified of plugins that have not been tested with the 3 latest major versions of WordPress.', 'companion-auto-update' );?></label>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Email Address', 'companion-auto-update' );?></th>
|
||||
<td>
|
||||
<p>
|
||||
<label for="cau_email"><?php _e( 'To', 'companion-auto-update' ); ?>:</label>
|
||||
<input type="text" name="cau_email" id="cau_email" class="regular-text" placeholder="<?php echo get_option( 'admin_email' ); ?>" value="<?php echo esc_html( $toemail ); ?>" />
|
||||
</p>
|
||||
|
||||
<p class="description"><?php _e('Seperate email addresses using commas.', 'companion-auto-update');?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Use HTML in emails?', 'companion-auto-update' );?></th>
|
||||
<td>
|
||||
<p>
|
||||
<select id='html_or_text' name='html_or_text'>
|
||||
<option value='html' <?php if( $hot == 'html' ) { echo "SELECTED"; } ?>><?php _e( 'Use HTML', 'companion-auto-update' ); ?></option>
|
||||
<option value='text' <?php if( $hot == 'text' ) { echo "SELECTED"; } ?>><?php _e( 'Use plain text', 'companion-auto-update' ); ?></option>
|
||||
</select>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Show more info in emails', 'companion-auto-update' );?></th>
|
||||
<td>
|
||||
<p>
|
||||
<label for="advanced_info_emails"><input name="advanced_info_emails" type="checkbox" id="advanced_info_emails" <?php if( cau_get_db_value( 'advanced_info_emails' ) == 'on' ) { echo "CHECKED"; } ?>> <?php _e( 'Show the time of the update', 'companion-auto-update' ); ?></label>
|
||||
</p>
|
||||
<p>
|
||||
<label for="plugin_links_emails"><input name="plugin_links_emails" type="checkbox" id="plugin_links_emails" <?php if( cau_get_db_value( 'plugin_links_emails' ) == 'on' ) { echo "CHECKED"; } ?>> <?php _e( 'Show links to WordPress.org pages', 'companion-auto-update' ); ?></label>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php _e( 'WordPress notifications', 'companion-auto-update' );?>
|
||||
<span class='cau_tooltip'><span class="dashicons dashicons-editor-help"></span>
|
||||
<span class='cau_tooltip_text'>
|
||||
<?php _e( 'Core notifications are handled by WordPress and not by this plugin. You can only disable them, changing your email address in the settings above will not affect these notifications.', 'companion-auto-update' );?>
|
||||
</span>
|
||||
</span>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<input id="wpemails" name="wpemails" type="checkbox" <?php if( cau_get_db_value( 'wpemails' ) == 'on' ) { echo 'checked'; } ?> />
|
||||
<label for="wpemails"><?php _e( 'By default WordPress sends an email when a core update has occurred. Uncheck this box to disable these emails.', 'companion-auto-update' ); ?></label>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Database update required', 'companion-auto-update' );?></th>
|
||||
<td>
|
||||
<p>
|
||||
<input id="dbupdateemails" name="dbupdateemails" type="checkbox" <?php if( cau_get_db_value( 'dbupdateemails' ) == 'on' ) { echo 'checked'; } ?> />
|
||||
<label for="dbupdateemails"><?php _e( 'Sometimes we\'ll need your help updating our database version to the latest version, check this box to allow us to send you an email about this.', 'companion-auto-update' ); ?></label>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="welcome-to-cau interval-bg cau-dashboard-box" style="overflow: hidden;">
|
||||
|
||||
<h2 class="title"><?php _e( 'Intervals', 'companion-auto-update' );?></h2>
|
||||
|
||||
<?php
|
||||
|
||||
function cau_show_interval_selection( $identiefier, $schedule ) {
|
||||
|
||||
// Get the info
|
||||
$setValue = wp_get_schedule( $schedule );
|
||||
$setTime = wp_next_scheduled( $schedule );
|
||||
$setHour = date( 'H' , $setTime );
|
||||
$setMinutes = date( 'i' , $setTime );
|
||||
|
||||
// Show interval selection
|
||||
echo "<p>";
|
||||
echo "<select name='$identiefier' id='$identiefier' class='schedule_interval wide interval_scheduler' data-timeblock='$identiefier'>";
|
||||
foreach ( cau_wp_get_schedules() as $key => $value ) {
|
||||
echo "<option "; if( $setValue == $key ) { echo "selected "; } echo "value='".$key."'>".$value."</option>";
|
||||
}
|
||||
echo "</select>";
|
||||
echo "</p>";
|
||||
|
||||
// Set the time when daily is selected
|
||||
echo "<div class='timeblock-$identiefier' style='display: none;'>";
|
||||
|
||||
echo "<div class='cau_schedule_input'>
|
||||
<input type='number' min='0' max='23' name='".$identiefier."-sethour' value='$setHour' maxlength='2' >
|
||||
</div><div class='cau_schedule_input_div'>
|
||||
:
|
||||
</div><div class='cau_schedule_input'>
|
||||
<input type='number' min='0' max='59' name='".$identiefier."-setminutes' value='$setMinutes' maxlength='2' >
|
||||
</div><div class='cau_shedule_notation'>
|
||||
<span class='cau_tooltip'><span class='dashicons dashicons-editor-help'></span>
|
||||
<span class='cau_tooltip_text'>".__( 'At what time should the updater run? Only works when set to <u>daily</u>.', 'companion-auto-update' )." - ".__( 'Time notation: 24H', 'companion-auto-update' )."</span>
|
||||
</span>
|
||||
</div>";
|
||||
|
||||
echo "</div>";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="welcome-column">
|
||||
|
||||
<h4><?php _e( 'Plugin update interval', 'companion-auto-update' );?></h4>
|
||||
<?php cau_show_interval_selection( 'plugin_schedule', 'wp_update_plugins' ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="welcome-column">
|
||||
|
||||
<h4><?php _e( 'Theme update interval', 'companion-auto-update' );?></h4>
|
||||
<?php cau_show_interval_selection( 'theme_schedule', 'wp_update_themes' ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="welcome-column">
|
||||
|
||||
<h4><?php _e( 'Core update interval', 'companion-auto-update' );?></h4>
|
||||
<?php cau_show_interval_selection( 'core_schedule', 'wp_version_check' ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<p></p>
|
||||
|
||||
<div class="welcome-column">
|
||||
|
||||
<h4><?php _e( 'Update notifications', 'companion-auto-update' );?></h4>
|
||||
<?php cau_show_interval_selection( 'update_notifications', 'cau_set_schedule_mail' ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="welcome-column">
|
||||
|
||||
<h4><?php _e( 'Outdated software', 'companion-auto-update' );?></h4>
|
||||
<?php cau_show_interval_selection( 'outdated_notifier', 'cau_outdated_notifier' ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="welcome-to-cau advanced-bg cau-dashboard-box">
|
||||
|
||||
<h2 class="title"><?php _e( 'Advanced settings', 'companion-auto-update' ); ?></h2>
|
||||
|
||||
<?php
|
||||
|
||||
// Access
|
||||
$accessallowed = cau_allowed_user_rights_array();
|
||||
$has_editor = in_array( 'editor', $accessallowed ) ? true : false;
|
||||
$has_author = in_array( 'author', $accessallowed ) ? true : false;
|
||||
|
||||
// Update delays
|
||||
$has_updatedelay = ( cau_get_db_value( 'update_delay' ) == 'on' ) ? true : false;
|
||||
|
||||
?>
|
||||
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label><?php _e( 'Allow access to:', 'companion-auto-update' ); ?></label></th>
|
||||
<td>
|
||||
<p><label for="allow_administrator"><input name="allow_administrator" type="checkbox" id="allow_administrator" disabled="" checked=""><?php _e( 'Administrator', 'companion-auto-update' ); ?></label></p>
|
||||
<p><label for="allow_editor"><input name="allow_editor" type="checkbox" id="allow_editor" <?php if( $has_editor ) { echo "CHECKED"; } ?>><?php _e( 'Editor', 'companion-auto-update' ); ?></label></p>
|
||||
<p><label for="allow_author"><input name="allow_author" type="checkbox" id="allow_author" <?php if( $has_author ) { echo "CHECKED"; } ?>><?php _e( 'Author', 'companion-auto-update' ); ?></label></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label><?php _e( 'Delay updates', 'companion-auto-update' ); ?></label></th>
|
||||
<td>
|
||||
<p><label for="update_delay"><input name="update_delay" type="checkbox" id="update_delay" <?php echo $has_updatedelay ? "CHECKED" : ""; ?> ><?php _e( 'Delay updates', 'companion-auto-update' ); ?></label></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id='update_delay_days_block' <?php echo !$has_updatedelay ? "class='disabled_option'" : ""; ?>>
|
||||
<th scope="row"><label><?php _e( 'Number of days', 'companion-auto-update' ); ?></label></th>
|
||||
<td>
|
||||
<input type="number" min="0" max="31" name="update_delay_days" id="update_delay_days" class="regular-text" value="<?php echo cau_get_db_value( 'update_delay_days' ); ?>" />
|
||||
<p><?php _e( 'For how many days should updates be put on hold?', 'companion-auto-update' ); ?></p>
|
||||
<p><small><strong>Please note:</strong> Delaying updates does not work with WordPress updates yet.</small></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<?php wp_nonce_field( 'cau_save_settings' ); ?>
|
||||
|
||||
<div class="cau_save_button">
|
||||
<?php submit_button(); ?>
|
||||
</div>
|
||||
<div class="cau_save_button__space"></div>
|
||||
|
||||
<script>jQuery( '.cau-dashboard input, .cau-dashboard select, .cau-dashboard textarea' ).on( 'change', function() { jQuery('.cau_save_button').addClass( 'fixed_button' ); } );</script>
|
||||
|
||||
</form>
|
||||
|
||||
</div><div class="cau-column-small">
|
||||
|
||||
<div class="welcome-to-cau help-bg cau-dashboard-box">
|
||||
<div class="welcome-column welcome-column.welcome-column-half">
|
||||
<h3 class="support-sidebar-title"><?php _e( 'Help' ); ?></h3>
|
||||
<ul class="support-sidebar-list">
|
||||
<li><a href="https://codeermeneer.nl/stuffs/faq-auto-updater/" target="_blank"><?php _e( 'Frequently Asked Questions', 'companion-auto-update' ); ?></a></li>
|
||||
<li><a href="https://wordpress.org/support/plugin/companion-auto-update" target="_blank"><?php _e( 'Support Forums' ); ?></a></li>
|
||||
</ul>
|
||||
|
||||
<h3 class="support-sidebar-title"><?php _e( 'Want to contribute?', 'companion-auto-update' ); ?></h3>
|
||||
<ul class="support-sidebar-list">
|
||||
<li><a href="http://codeermeneer.nl/cau_poll/" target="_blank"><?php _e( 'Give feedback', 'companion-auto-update' ); ?></a></li>
|
||||
<li><a href="https://codeermeneer.nl/blog/companion-auto-update-and-its-future/" target="_blank"><?php _e( 'Feature To-Do List', 'companion-auto-update' ); ?></a></li>
|
||||
<li><a href="https://translate.wordpress.org/projects/wp-plugins/companion-auto-update/" target="_blank"><?php _e( 'Help us translate', 'companion-auto-update' ); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="welcome-column welcome-column.welcome-column-half">
|
||||
<h3 class="support-sidebar-title"><?php _e( 'Developer?', 'companion-auto-update' ); ?></h3>
|
||||
<ul class="support-sidebar-list">
|
||||
<li><a href="https://codeermeneer.nl/documentation/auto-update/" target="_blank"><?php _e( 'Documentation' ); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="welcome-to-cau support-bg cau-dashboard-box">
|
||||
<div class="welcome-column welcome-column">
|
||||
<h3><?php _e('Support', 'companion-auto-update');?></h3>
|
||||
<p><?php _e('Feel free to reach out to us if you have any questions or feedback.', 'companion-auto-update'); ?></p>
|
||||
<p><a href="https://codeermeneer.nl/contact/" target="_blank" class="button button-primary"><?php _e( 'Contact us', 'companion-auto-update' ); ?></a></p>
|
||||
<p><a href="https://codeermeneer.nl/plugins/" target="_blank" class="button button-alt"><?php _e('Check out our other plugins', 'companion-auto-update');?></a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="welcome-to-cau love-bg cau-show-love cau-dashboard-box">
|
||||
<h3><?php _e( 'Like our plugin?', 'companion-auto-update' ); ?></h3>
|
||||
<p><?php _e('Companion Auto Update is free to use. It has required a great deal of time and effort to develop and you can help support this development by making a small donation.<br />You get useful software and we get to carry on making it better.', 'companion-auto-update'); ?></p>
|
||||
<a href="https://wordpress.org/support/plugin/companion-auto-update/reviews/#new-post" target="_blank" class="button button-alt button-hero">
|
||||
<?php _e('Rate us (5 stars?)', 'companion-auto-update'); ?>
|
||||
</a>
|
||||
<a href="<?php echo cau_donateUrl(); ?>" target="_blank" class="button button-primary button-hero">
|
||||
<?php _e('Donate to help development', 'companion-auto-update'); ?>
|
||||
</a>
|
||||
<p style="font-size: 12px; color: #BDBDBD;"><?php _e( 'Donations via PayPal. Amount can be changed.', 'companion-auto-update'); ?></p>
|
||||
</div>
|
||||
|
||||
<div class="welcome-to-cau cau-dashboard-box">
|
||||
<h3><span style='background: #EBE3F7; color: #BCADD3; padding: 1px 5px; border-radius: 3px; font-size: .8em'>Plugin Promotion</span></h3>
|
||||
<h3>Keep your site fast with our Revision Manager</h3>
|
||||
<p>Post Revisions are great, but will also slow down your site. Take back control over revisions with Companion Revision Manager!</p>
|
||||
<a href="https://codeermeneer.nl/portfolio/plugin/companion-revision-manager/" target="_blank" class="button button-alt">Read more</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.disabled_option {
|
||||
opacity: .5;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
jQuery( '#update_delay' ).change( function() {
|
||||
jQuery( '#update_delay_days_block' ).toggleClass( 'disabled_option' );
|
||||
});
|
||||
|
||||
jQuery( '.interval_scheduler' ).change( function() {
|
||||
|
||||
var selected = jQuery(this).val(); // Selected value
|
||||
var timeblock = jQuery(this).data( 'timeblock' ); // Corresponding time block
|
||||
|
||||
if( selected == 'daily' ) {
|
||||
jQuery( '.timeblock-'+timeblock ).show();
|
||||
} else {
|
||||
jQuery( '.timeblock-'+timeblock ).hide();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
jQuery( '.interval_scheduler' ).each( function() {
|
||||
|
||||
var selected = jQuery(this).val(); // Selected value
|
||||
var timeblock = jQuery(this).data( 'timeblock' ); // Corresponding time block
|
||||
|
||||
if( selected == 'daily' ) {
|
||||
jQuery( '.timeblock-'+timeblock ).show();
|
||||
} else {
|
||||
jQuery( '.timeblock-'+timeblock ).hide();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
if( isset( $_GET['filter'] ) ) {
|
||||
$filter = $_GET['filter'];
|
||||
} else {
|
||||
$filter = 'all';
|
||||
}
|
||||
?>
|
||||
|
||||
<ul class="subsubsub">
|
||||
<li><a <?php if( $filter == 'all' ) { echo "class='current'"; } ?> href='<?php echo cau_url( 'log&filter=all' ); ?>'><?php _e( 'View full changelog', 'companion-auto-update' ); ?></a></li> |
|
||||
<li><a <?php if( $filter == 'plugins' ) { echo "class='current'"; } ?> href='<?php echo cau_url( 'log&filter=plugins' ); ?>'><?php _e( 'Plugins', 'companion-auto-update' ); ?></a></li> |
|
||||
<li><a <?php if( $filter == 'themes' ) { echo "class='current'"; } ?> href='<?php echo cau_url( 'log&filter=themes' ); ?>'><?php _e( 'Themes', 'companion-auto-update' ); ?></a></li> |
|
||||
<li><a <?php if( $filter == 'translations' ) { echo "class='current'"; } ?> href='<?php echo cau_url( 'log&filter=translations' ); ?>'><?php _e( 'Translations', 'companion-auto-update' ); ?></a></li>
|
||||
</ul>
|
||||
|
||||
<div class='cau_spacing'></div>
|
||||
|
||||
<?php
|
||||
cau_fetch_log( 'all', 'table' );
|
@ -0,0 +1,185 @@
|
||||
<?php
|
||||
|
||||
// Get selected filter type
|
||||
if( isset( $_GET['filter'] ) ) {
|
||||
$filter = sanitize_key( $_GET['filter'] );
|
||||
} else {
|
||||
$filter = 'plugins';
|
||||
}
|
||||
|
||||
// Select correct database row
|
||||
switch ( $filter ) {
|
||||
case 'themes':
|
||||
$db_table = 'notUpdateListTh';
|
||||
$filter_name = __( 'Themes', 'companion-auto-update' );
|
||||
$filterFunction = wp_get_themes();
|
||||
break;
|
||||
case 'plugins':
|
||||
$db_table = 'notUpdateList';
|
||||
$filter_name = __( 'Plugins', 'companion-auto-update' );
|
||||
$filterFunction = get_plugins();
|
||||
break;
|
||||
default:
|
||||
$db_table = 'notUpdateList';
|
||||
$filter_name = __( 'Plugins', 'companion-auto-update' );
|
||||
$filterFunction = get_plugins();
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<ul class="subsubsub">
|
||||
<li><a <?php if( $filter == 'plugins' ) { echo "class='current'"; } ?> href='<?php echo cau_url( 'pluginlist&filter=plugins' ); ?>'><?php _e( 'Plugins', 'companion-auto-update' ); ?></a></li> |
|
||||
<li><a <?php if( $filter == 'themes' ) { echo "class='current'"; } ?> href='<?php echo cau_url( 'pluginlist&filter=themes' ); ?>'><?php _e( 'Themes', 'companion-auto-update' ); ?></a></li>
|
||||
</ul>
|
||||
|
||||
<div style='clear: both;'></div>
|
||||
|
||||
<?php if( $filter == 'themes' ) { ?>
|
||||
<div id="message" class="cau">
|
||||
We've had to (temporarily) disable the theme filter because it was causing issues on some installations. We'll try to get it working again in a future update.
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<p><?php echo sprintf( esc_html__( 'Prevent certain %s from updating automatically. %s that you select here will be skipped by Companion Auto Update and will require manual updating.', 'companion-auto-update' ), strtolower( $filter_name ), $filter_name ); ?></p>
|
||||
|
||||
<?php
|
||||
|
||||
global $wpdb;
|
||||
$table_name = $wpdb->prefix."auto_updates";
|
||||
|
||||
// Save list
|
||||
if( isset( $_POST['submit'] ) ) {
|
||||
|
||||
check_admin_referer( 'cau_save_pluginlist' );
|
||||
|
||||
$noUpdateList = '';
|
||||
$i = 0;
|
||||
$noUpdateCount = 0;
|
||||
|
||||
if( isset( $_POST['post'] ) ) {
|
||||
$noUpdateCount = count( $_POST['post'] );
|
||||
}
|
||||
|
||||
if( $noUpdateCount > 0 ) {
|
||||
foreach ( $_POST['post'] as $key ) {
|
||||
$noUpdateList .= sanitize_text_field( $key );
|
||||
$i++;
|
||||
if( $i != $noUpdateCount ) $noUpdateList .= ', ';
|
||||
}
|
||||
}
|
||||
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = '%s' WHERE name = '%s'", $noUpdateList, $db_table ) );
|
||||
echo '<div id="message" class="updated"><p><b>'.__( 'Succes', 'companion-auto-update' ).' –</b> '.sprintf( esc_html__( '%1$s %2$s have been added to the no-update-list', 'companion-auto-update' ), $noUpdateCount, strtolower( $filter_name ) ).'.</p></div>';
|
||||
}
|
||||
|
||||
|
||||
// Reset list
|
||||
if( isset( $_POST['reset'] ) ) {
|
||||
|
||||
check_admin_referer( 'cau_save_pluginlist' );
|
||||
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = '%s' WHERE name = %s", "", $db_table ) );
|
||||
echo '<div id="message" class="updated"><p><b>'.__( 'Succes', 'companion-auto-update' ).' –</b> '.sprintf( esc_html__( 'The no-update-list has been reset, all %s will be auto-updated from now on', 'companion-auto-update' ), strtolower( $filter_name ) ).'.</p></div>';
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<form method="POST">
|
||||
|
||||
<div class='pluginListButtons'>
|
||||
<?php submit_button(); ?>
|
||||
<input type='submit' name='reset' id='reset' class='button button-alt' value='<?php _e( "Reset list", "companion-auto-update" ); ?>'>
|
||||
</div>
|
||||
|
||||
<table class="wp-list-table widefat autoupdate striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<th class="head-plugin"><strong><?php _e( 'Name', 'companion-auto-update' ); ?></strong></th>
|
||||
<th class="head-status"><strong><?php _e( 'Status', 'companion-auto-update' ); ?></strong></th>
|
||||
<th class="head-description"><strong><?php _e( 'Description' ); ?></strong></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id="the-list">
|
||||
|
||||
<?php
|
||||
|
||||
foreach ( $filterFunction as $key => $value ) {
|
||||
|
||||
$slug = $key;
|
||||
$explosion = explode( '/', $slug );
|
||||
$actualSlug = array_shift( $explosion );
|
||||
$slug_hash = md5( $slug[0] );
|
||||
|
||||
if( $filter == 'themes' ) {
|
||||
|
||||
$theme = wp_get_theme( $actualSlug );
|
||||
$name = $theme->get( 'Name' );
|
||||
$description = $theme->get( 'Description' );
|
||||
|
||||
} else {
|
||||
|
||||
foreach ( $value as $k => $v ) {
|
||||
|
||||
if( $k == "Name" ) $name = $v;
|
||||
if( $k == "Description" ) $description = $v;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if( in_array( $actualSlug, donotupdatelist( $filter ) ) ) {
|
||||
|
||||
$class = 'inactive';
|
||||
$checked = 'CHECKED';
|
||||
$statusicon = 'no';
|
||||
$statusName = 'disabled';
|
||||
|
||||
} else {
|
||||
|
||||
$class = 'active';
|
||||
$checked = '';
|
||||
$statusicon = 'yes';
|
||||
$statusName = 'enabled';
|
||||
}
|
||||
|
||||
echo '<tr id="post-'.$slug_hash.'" class="'.$class.'">
|
||||
|
||||
<th class="check-column">
|
||||
<label class="screen-reader-text" for="cb-select-'.$slug_hash.'">Select '. $name .'</label>
|
||||
<input id="cb-select-'.$slug_hash.'" type="checkbox" name="post[]" value="'.$actualSlug.'" '.$checked.' ><label></label>
|
||||
<div class="locked-indicator"></div>
|
||||
</th>
|
||||
|
||||
<td class="column-name">
|
||||
<p style="margin-bottom: 0px;"><strong>'. $name .'</strong></p>
|
||||
<small class="description" style="opacity: 0.5; margin-bottom: 3px;">'.$actualSlug.'</small>
|
||||
</td>
|
||||
|
||||
<td class="cau_hide_on_mobile column-status">
|
||||
<p><span class="nowrap">'.__( 'Auto Updater', 'companion-auto-update' ).': <span class="cau_'.$statusName.'"><span class="dashicons dashicons-'.$statusicon.'"></span></span></span></p>
|
||||
</td>
|
||||
|
||||
<td class="cau_hide_on_mobile column-description">
|
||||
<p>'.$description.'</p>
|
||||
</td>
|
||||
|
||||
</tr>';
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php wp_nonce_field( 'cau_save_pluginlist' ); ?>
|
||||
|
||||
<div class='pluginListButtons'>
|
||||
<?php submit_button(); ?>
|
||||
<input type='submit' name='reset' id='reset' class='button button-alt' value='<?php _e( "Reset list", "companion-auto-update" ); ?>'>
|
||||
</div>
|
||||
|
||||
</form>
|
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// Currently working on this
|
@ -0,0 +1,435 @@
|
||||
<?php
|
||||
|
||||
// Define globals
|
||||
global $wpdb;
|
||||
|
||||
// Define variables
|
||||
$dateFormat = get_option( 'date_format' );
|
||||
$dateFormat .= ' '.get_option( 'time_format' );
|
||||
$table_name = $wpdb->prefix . "auto_updates";
|
||||
$schedules = wp_get_schedules();
|
||||
$interval_names = cau_wp_get_schedules();
|
||||
|
||||
// Update the database
|
||||
if( isset( $_GET['run'] ) && $_GET['run'] == 'db_update' ) {
|
||||
cau_manual_update();
|
||||
echo '<div id="message" class="updated"><p><b>'.__( 'Database update completed' ).'</b></p></div>';
|
||||
}
|
||||
|
||||
if( isset( $_GET['run'] ) && $_GET['run'] == 'db_info_update' ) {
|
||||
cau_savePluginInformation();
|
||||
echo '<div id="message" class="updated"><p><b>'.__( 'Database information update completed' ).'</b></p></div>';
|
||||
}
|
||||
|
||||
if( isset( $_GET['ignore_report'] ) ) {
|
||||
|
||||
$report_to_ignore = sanitize_text_field( $_GET['ignore_report'] );
|
||||
$allowedValues = array( 'seo', 'cron' );
|
||||
|
||||
if( !in_array( $report_to_ignore, $allowedValues ) ) {
|
||||
|
||||
wp_die( 'Trying to cheat eh?' );
|
||||
|
||||
} else {
|
||||
|
||||
$table_name = $wpdb->prefix . "auto_updates";
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE {$table_name} SET onoroff = %s WHERE name = 'ignore_$report_to_ignore'", 'yes' ) );
|
||||
$__ignored = __( 'This report will now be ignored', 'companion-auto-update' );
|
||||
echo "<div id='message' class='updated'><p><b>$__ignored</b></p></div>";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<div class="cau_status_page">
|
||||
|
||||
<?php
|
||||
|
||||
$events = array(
|
||||
0 => array(
|
||||
'name' => __( 'Events', 'companion-auto-update' ),
|
||||
'fields' => array(
|
||||
'plugins' => __( 'Plugins', 'companion-auto-update' ),
|
||||
'themes' => __( 'Themes', 'companion-auto-update' ),
|
||||
'minor' => __( 'Core (Minor)', 'companion-auto-update' ),
|
||||
'major' => __( 'Core (Major)', 'companion-auto-update' ),
|
||||
'send' => __( 'Update available', 'companion-auto-update' ),
|
||||
'sendupdate' => __( 'Successful update', 'companion-auto-update' ),
|
||||
'wpemails' => __( 'Core notifications', 'companion-auto-update' ),
|
||||
'update_delay' => __( 'Log updater', 'companion-auto-update' ),
|
||||
),
|
||||
'values' => array(
|
||||
'plugins' => 'wp_update_plugins',
|
||||
'themes' => 'wp_update_themes',
|
||||
'minor' => 'wp_version_check',
|
||||
'major' => 'wp_version_check',
|
||||
'send' => 'cau_set_schedule_mail',
|
||||
'sendupdate' => 'cau_set_schedule_mail',
|
||||
'wpemails' => 'cau_set_schedule_mail',
|
||||
'update_delay' => 'cau_log_updater',
|
||||
),
|
||||
'explain' => array(
|
||||
'plugins' => __('Auto update plugins?', 'companion-auto-update'),
|
||||
'themes' => __('Auto update themes?', 'companion-auto-update'),
|
||||
'minor' => __('Auto update minor core updates?', 'companion-auto-update'),
|
||||
'major' => __('Auto update major core updates?', 'companion-auto-update'),
|
||||
'send' => __( 'Will notify you of available updates.', 'companion-auto-update' ),
|
||||
'sendupdate' => __( 'Will notify you after successful updates.', 'companion-auto-update' ),
|
||||
'wpemails' => __( 'The default WordPress notifications.', 'companion-auto-update' ),
|
||||
'update_delay' => __( 'Will keep track of the update log and make sure updates are delayed when needed.', 'companion-auto-update' ),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
$__sta = __( 'Status', 'companion-auto-update' );
|
||||
$__int = __( 'Interval', 'companion-auto-update' );
|
||||
$__nxt = __( 'Next', 'companion-auto-update' );
|
||||
|
||||
foreach( $events as $event => $info ) {
|
||||
|
||||
echo "<table class='cau_status_list widefat striped'>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='cau_status_name' colspan='2'><strong>{$info['name']}</strong></th>
|
||||
<th class='cau_status_active_state'><strong>{$__sta}</strong></th>
|
||||
<th class='cau_status_interval'><strong>{$__int}</strong></th>
|
||||
<th class='cau_status_next'><strong>{$__nxt}</strong></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id='the-list'>";
|
||||
|
||||
foreach ( $info['fields'] as $key => $value ) {
|
||||
|
||||
$is_on = ( cau_get_db_value( $key ) == 'on' && wp_get_schedule( $info['values'][$key] ) ) ? true : false;
|
||||
$__status = $is_on ? 'enabled' : 'warning';
|
||||
$__icon = $is_on ? 'yes-alt' : 'marker';
|
||||
$__text = $is_on ? __( 'Enabled', 'companion-auto-update' ) : __( 'Disabled', 'companion-auto-update' );
|
||||
$__interval = $is_on ? $interval_names[wp_get_schedule( $info['values'][$key] )] : '‐';
|
||||
$__next = $is_on ? date_i18n( $dateFormat, wp_next_scheduled( $info['values'][$key] ) ) : '‐';
|
||||
$__exp = !empty( $info['explain'][$key] ) ? '<br /><small>'.$info['explain'][$key].'</small>' : '';
|
||||
$__nxt = __( 'Next', 'companion-auto-update' );
|
||||
|
||||
echo "<tr>
|
||||
<td class='cau_status_icon'><span class='dashicons dashicons-$__icon cau_$__status'></span></td>
|
||||
<td class='cau_status_name'><strong>$value</strong>$__exp</td>
|
||||
<td class='cau_status_active_state'><span class='cau_$__status'>$__text</span></td>
|
||||
<td class='cau_status_interval'>$__interval</td>
|
||||
<td class='cau_status_next'><span class='cau_mobile_prefix'>$__nxt: </span>$__next</td>
|
||||
</tr>";
|
||||
|
||||
}
|
||||
|
||||
echo "</tbody>
|
||||
|
||||
</table>";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<table class="cau_status_list widefat striped cau_status_warnings">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="cau_plugin_issue_name" colspan="5"><strong><?php _e( 'Status' ); ?></strong></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id="the-list">
|
||||
|
||||
<!-- checkAutomaticUpdaterDisabled -->
|
||||
<tr>
|
||||
<td class='cau_status_icon'><span class="dashicons dashicons-update"></span></td>
|
||||
<td><?php _e( 'Auto updates', 'companion-auto-update' ); ?></td>
|
||||
<?php if ( checkAutomaticUpdaterDisabled() ) { ?>
|
||||
<td class="cau_status_active_state"><span class='cau_disabled'><span class="dashicons dashicons-no"></span> <?php _e( 'All automatic updates are disabled', 'companion-auto-update' ); ?></span></td>
|
||||
<td>
|
||||
<form method="POST">
|
||||
<?php wp_nonce_field( 'cau_fixit' ); ?>
|
||||
<button type="submit" name="fixit" class="button button-primary"><?php _e( 'Fix it', 'companion-auto-update' ); ?></button>
|
||||
<a href="https://codeermeneer.nl/documentation/known-issues-fixes/#updates_disabled" target="_blank" class="button"><?php _e( 'How to fix this', 'companion-auto-update' ); ?></a>
|
||||
</form>
|
||||
</td>
|
||||
<?php } else { ?>
|
||||
<td class="cau_status_active_state"><span class='cau_enabled'><span class="dashicons dashicons-yes-alt"></span> <?php _e( 'No issues detected', 'companion-auto-update' ); ?></span></td>
|
||||
<td></td>
|
||||
<?php } ?>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<!-- Connection with WP.org -->
|
||||
<tr>
|
||||
<td class='cau_status_icon'><span class="dashicons dashicons-wordpress"></span></td>
|
||||
<td><?php _e( 'Connection with WordPress.org', 'companion-auto-update' ); ?></td>
|
||||
<?php if( wp_http_supports( array( 'ssl' ) ) == '1' ) {
|
||||
$__text = __( 'No issues detected', 'companion-auto-update' );
|
||||
echo "<td colspan='3' class='cau_status_active_state'><span class='cau_enabled'><span class='dashicons dashicons-yes-alt'></span> $__text</span></td>";
|
||||
} else {
|
||||
$__text = __( 'Disabled', 'companion-auto-update' );
|
||||
echo "<td colspan='3' class='cau_status_active_state'><span class='cau_disabled'><span class='dashicons dashicons-no'></span> $__text</span></td>";
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
|
||||
<!-- ignore_seo check -->
|
||||
<tr <?php if( cau_get_db_value( 'ignore_seo' ) == 'yes' ) { echo "class='report_hidden'"; } ?> >
|
||||
<td class='cau_status_icon'><span class="dashicons dashicons-search"></span></td>
|
||||
<td><?php _e( 'Search Engine Visibility', 'companion-auto-update' ); ?></td>
|
||||
<?php if( get_option( 'blog_public' ) == 0 ) { ?>
|
||||
<td colspan="2" class="cau_status_active_state">
|
||||
<span class='cau_warning'><span class="dashicons dashicons-warning"></span></span>
|
||||
<?php _e( 'You’ve chosen to discourage Search Engines from indexing your site. Auto-updating works best on sites with more traffic, consider enabling indexing for your site.', 'companion-auto-update' ); ?>
|
||||
</td>
|
||||
<td>
|
||||
<a href="<?php echo admin_url( 'options-reading.php' ); ?>" class="button"><?php _e( 'Fix it', 'companion-auto-update' ); ?></a>
|
||||
<a href="<?php echo cau_url( 'status' ); ?>&ignore_report=seo" class="button button-alt"><?php _e( 'Ignore this report', 'companion-auto-update' ); ?></a>
|
||||
</td>
|
||||
<?php } else { ?>
|
||||
<td colspan="3" class="cau_status_active_state"><span class='cau_enabled'><span class="dashicons dashicons-yes-alt"></span> <?php _e( 'No issues detected', 'companion-auto-update' ); ?></span></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
|
||||
<!-- ignore_cron check -->
|
||||
<tr <?php if( cau_get_db_value( 'ignore_cron' ) == 'yes' ) { echo "class='report_hidden'"; } ?> >
|
||||
<td class='cau_status_icon'><span class="dashicons dashicons-admin-generic"></span></td>
|
||||
<td><?php _e( 'Cronjobs', 'companion-auto-update' ); ?></td>
|
||||
<?php if( checkCronjobsDisabled() ) { ?>
|
||||
<td class="cau_status_active_state"><span class='cau_warning'><span class="dashicons dashicons-warning"></span> <?php _e( 'Disabled', 'companion-auto-update' ); ?></span></td>
|
||||
<td><code>DISABLE_WP_CRON true</code></td>
|
||||
<td>
|
||||
<a href="https://codeermeneer.nl/contact/" class="button"><?php _e( 'Contact for support', 'companion-auto-update' ); ?></a>
|
||||
<a href="<?php echo cau_url( 'status' ); ?>&ignore_report=cron" class="button button-alt"><?php _e( 'Ignore this report', 'companion-auto-update' ); ?></a>
|
||||
</td>
|
||||
<?php } else { ?>
|
||||
<td colspan="3" class="cau_status_active_state"><span class='cau_enabled'><span class="dashicons dashicons-yes-alt"></span> <?php _e( 'No issues detected', 'companion-auto-update' ); ?></span></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
|
||||
<!-- wp_version_check -->
|
||||
<tr>
|
||||
<td class='cau_status_icon'><span class="dashicons dashicons-wordpress-alt"></span></td>
|
||||
<td>wp_version_check</td>
|
||||
<?php if ( !has_filter( 'wp_version_check', 'wp_version_check' ) ) { ?>
|
||||
<td colspan="2" class="cau_status_active_state"><span class='cau_disabled'><span class="dashicons dashicons-no"></span> <?php _e( 'A plugin has prevented updates by disabling wp_version_check', 'companion-auto-update' ); ?></span></td>
|
||||
<td><a href="https://codeermeneer.nl/contact/" class="button"><?php _e( 'Contact for support', 'companion-auto-update' ); ?></a></td>
|
||||
<?php } else { ?>
|
||||
<td colspan="3" class="cau_status_active_state"><span class='cau_enabled'><span class="dashicons dashicons-yes-alt"></span> <?php _e( 'No issues detected' , 'companion-auto-update' ); ?></span></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
|
||||
<!-- VCD -->
|
||||
<tr>
|
||||
<td class='cau_status_icon'><span class="dashicons dashicons-open-folder"></span></td>
|
||||
<td>VCS</td>
|
||||
<td colspan="3" class="cau_status_active_state"><span class='cau_<?php echo cau_test_is_vcs_checkout( ABSPATH )['status']; ?>'><span class="dashicons dashicons-<?php echo cau_test_is_vcs_checkout( ABSPATH )['icon']; ?>"></span> <?php echo cau_test_is_vcs_checkout( ABSPATH )['description']; ?></span></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
<table class="autoupdate cau_status_list widefat striped cau_status_warnings">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="5"><strong><?php _e( 'Systeminfo', 'companion-auto-update' ); ?></strong></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id="the-list">
|
||||
|
||||
<tr>
|
||||
<td class='cau_status_icon'><span class="dashicons dashicons-wordpress"></span></td>
|
||||
<td>WordPress</td>
|
||||
<td><?php echo get_bloginfo( 'version' ); ?></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr <?php if( version_compare( PHP_VERSION, '5.1.0', '<' ) ) { echo "class='inactive'"; } ?>>
|
||||
<td class='cau_status_icon'><span class="dashicons dashicons-media-code"></span></td>
|
||||
<td>PHP</td>
|
||||
<td><?php echo phpversion(); ?> <code>(Required: 5.1.0 or up)</code></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr <?php if( cau_incorrectDatabaseVersion() ) { echo "class='inactive'"; } ?>>
|
||||
<td class='cau_status_icon'><span class="dashicons dashicons-database"></span></td>
|
||||
<td>Database</td>
|
||||
<td><?php echo get_option( "cau_db_version" ); ?> <code>(Latest: <?php echo cau_db_version(); ?>)</code></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='cau_status_icon'><span class="dashicons dashicons-calendar"></span></td>
|
||||
<td class="cau_status_name"><?php _e( 'Timezone' ); ?></td>
|
||||
<td class="cau_status_active_state"><?php echo cau_get_proper_timezone(); ?> (GMT <?php echo get_option('gmt_offset'); ?>) - <?php echo date_default_timezone_get(); ?></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
<?php
|
||||
|
||||
// If has incomptable plugins
|
||||
if( cau_incompatiblePlugins() ) { ?>
|
||||
|
||||
<table class="cau_status_list no_column_width widefat striped cau_status_warnings">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="cau_plugin_issue_name" colspan="4"><strong><?php _e( 'Possible plugin issues', 'companion-auto-update' ); ?></strong></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id="the-list">
|
||||
<?php
|
||||
|
||||
foreach ( cau_incompatiblePluginlist() as $key => $value ) {
|
||||
if( is_plugin_active( $key ) ) {
|
||||
echo '<tr>
|
||||
<td class="cau_plugin_issue_name"><strong>'.$key.'</strong></td>
|
||||
<td colspan="2" class="cau_plugin_issue_explain">'.$value.'</td>
|
||||
<td class="cau_plugin_issue_fixit"><a href="https://codeermeneer.nl/documentation/known-issues-fixes/#plugins" target="_blank" class="button">'.__( 'How to fix this', 'companion-auto-update' ).'</a></td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<!-- Advanced info -->
|
||||
<table class="autoupdate cau_status_list widefat striped cau_status_warnings">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th><strong><?php _e( 'Advanced info', 'companion-auto-update' ); ?></strong> ‐ <?php _e( 'For when you need our help fixing an issue.', 'companion-auto-update' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id="the-list">
|
||||
<tr>
|
||||
<td>
|
||||
<div class='button button-primary toggle_advanced_button'><?php _e( 'Toggle', 'companion-auto-update' ); ?></div>
|
||||
<div class='toggle_advanced_content' style='display: none;'>
|
||||
<?php
|
||||
$cau_configs = $wpdb->get_results( "SELECT * FROM $table_name" );
|
||||
array_push( $cau_configs, "WordPress: ".get_bloginfo( 'version' ) );
|
||||
array_push( $cau_configs, "PHP: ".phpversion() );
|
||||
array_push( $cau_configs, "DB: ".get_option( "cau_db_version" ).' / '.cau_db_version() );
|
||||
echo "<textarea style='width: 100%; height: 750px;'>";
|
||||
print_r( $cau_configs );
|
||||
echo "</textarea>";
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
<script>jQuery( '.toggle_advanced_button' ).click( function() { jQuery( '.toggle_advanced_content' ).toggle(); });</script>
|
||||
|
||||
<!-- Delay updates -->
|
||||
<table class="autoupdate cau_status_list widefat striped cau_status_warnings">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th><strong><?php _e( 'Delay updates', 'companion-auto-update' ); ?></strong> ‐ <?php echo ( cau_get_db_value( 'update_delay' ) == 'on' ) ? __( 'Enabled', 'companion-auto-update' ).' ('.sprintf( esc_html__( '%s days', 'companion-auto-update' ).')', cau_get_db_value( 'update_delay_days' ) ) : __( 'Disabled', 'companion-auto-update' ); ?></th>
|
||||
<th><?php _e( 'Till', 'companion-auto-update' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id="the-list">
|
||||
<?php
|
||||
|
||||
$updateLog = "{$wpdb->prefix}update_log";
|
||||
$put_on_hold = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$updateLog} WHERE put_on_hold <> '%s'", '0' ) );
|
||||
|
||||
foreach ( $put_on_hold as $plugin ) {
|
||||
|
||||
$__name = $plugin->slug;
|
||||
$__poh = $plugin->put_on_hold;
|
||||
$__udd = ( cau_get_db_value( 'update_delay_days' ) != '' ) ? cau_get_db_value( 'update_delay_days' ) : '2';
|
||||
$__date = date_i18n( $dateFormat, strtotime( "+".$__udd." days", $__poh ) );
|
||||
|
||||
echo "<tr>
|
||||
<td>{$__name}</td>
|
||||
<td>{$__date}</td>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
echo empty( $put_on_hold ) ? "<tr><td>".__( 'No plugins have been put on hold.', 'companion-auto-update' )."</td></tr>" : "";
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Remove the line
|
||||
if( isset( $_POST['fixit'] ) ) {
|
||||
check_admin_referer( 'cau_fixit' );
|
||||
cau_removeErrorLine();
|
||||
}
|
||||
|
||||
// Get wp-config location
|
||||
function cau_configFile() {
|
||||
|
||||
// Config file
|
||||
if ( file_exists( ABSPATH . 'wp-config.php') ) {
|
||||
$conFile = ABSPATH . 'wp-config.php';
|
||||
} else {
|
||||
$conFile = dirname(ABSPATH) . '/wp-config.php';
|
||||
}
|
||||
|
||||
return $conFile;
|
||||
|
||||
}
|
||||
|
||||
// Change the AUTOMATIC_UPDATER_DISABLED line
|
||||
function cau_removeErrorLine() {
|
||||
|
||||
// Config file
|
||||
$conFile = cau_configFile();
|
||||
|
||||
// Lines to check and replace
|
||||
$revLine = "define('AUTOMATIC_UPDATER_DISABLED', false);"; // We could just remove the line, but replacing it will be safer
|
||||
$posibleLines = array( "define( 'AUTOMATIC_UPDATER_DISABLED', true );", "define( 'AUTOMATIC_UPDATER_DISABLED', minor );" ); // The two base options
|
||||
foreach ( $posibleLines as $value ) array_push( $posibleLines, strtolower( $value ) ); // Support lowercase variants
|
||||
foreach ( $posibleLines as $value ) array_push( $posibleLines, str_replace( ' ', '', $value ) ); // For variants without spaces
|
||||
|
||||
$melding = __( "We couldn't fix the error for you. Please contact us for further support", 'companion-auto-update' ).'.';
|
||||
$meldingS = 'error';
|
||||
|
||||
// Check for each string if it exists
|
||||
foreach ( $posibleLines as $key => $string ) {
|
||||
|
||||
if( strpos( file_get_contents( $conFile ), $string ) !== false) {
|
||||
$contents = file_get_contents( $conFile );
|
||||
$contents = str_replace( $string, $revLine, $contents );
|
||||
file_put_contents( $conFile, $contents );
|
||||
$melding = __( "We've fixed the error for you", 'companion-auto-update' ).' :)';
|
||||
$meldingS = 'updated';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo "<div id='message' class='$meldingS'><p><strong>$melding</strong></p></div>";
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
height="417pt"
|
||||
viewBox="0 -46 417.81333 417"
|
||||
width="417pt"
|
||||
version="1.1"
|
||||
id="svg4"
|
||||
sodipodi:docname="check.svg"
|
||||
inkscape:version="0.92.0 r15299">
|
||||
<metadata
|
||||
id="metadata10">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs8" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-height="1017"
|
||||
id="namedview6"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.42446043"
|
||||
inkscape:cx="278"
|
||||
inkscape:cy="278"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4" />
|
||||
<path
|
||||
d="m 185.111,248.00297 c -2.2287,2.2418 -5.26943,3.49257 -8.42804,3.49257 -3.15861,0 -6.19935,-1.25077 -8.42805,-3.49257 l -67.30869,-67.31961 c -6.985172,-6.98517 -6.985172,-18.31207 0,-25.28413 l 8.42805,-8.43023 c 6.98735,-6.98518 18.30114,-6.98518 25.28632,0 l 42.02237,42.02454 113.55053,-113.552722 c 6.98736,-6.985172 18.31207,-6.985172 25.28633,0 l 8.42805,8.43023 c 6.98516,6.985175 6.98516,18.309882 0,25.284142 z m 0,0"
|
||||
id="path2"
|
||||
style="fill:#9178b7;fill-opacity:1;stroke-width:0.55881381"
|
||||
inkscape:connector-curvature="0" />
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 505 505"
|
||||
style="enable-background:new 0 0 505 505;"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="email.svg"
|
||||
inkscape:version="0.92.0 r15299"><metadata
|
||||
id="metadata43"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs41" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
id="namedview39"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.6608998"
|
||||
inkscape:cx="-110.05455"
|
||||
inkscape:cy="410.34145"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1"
|
||||
borderlayer="true" /><path
|
||||
style="fill:#ded1f2;fill-opacity:1;stroke-width:1.194754"
|
||||
d="m 54.471192,356.14658 c 0,-166.66819 135.007198,-301.675388 301.675388,-301.675388 166.5487,0 301.67538,135.007198 301.67538,301.675388 0,166.66817 -135.12668,301.67538 -301.67538,301.67538 -166.66819,0 -301.675388,-135.00721 -301.675388,-301.67538 z"
|
||||
id="path2"
|
||||
inkscape:connector-curvature="0" /><g
|
||||
id="g8"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g10"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g12"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g14"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g16"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g18"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g20"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g22"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g24"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g26"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g28"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g30"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g32"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g34"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g36"
|
||||
transform="scale(1.3026177)" /><path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 281.76716,529.19554 c 27.99462,9.77382 58.38437,-1.99616 72.99376,-26.55557 L 241.14037,462.9714 c -3.82831,28.32342 12.63218,56.45033 40.62679,66.22414 z m 0,0"
|
||||
id="path4"
|
||||
style="fill:#9178b7;fill-opacity:1;stroke-width:1.53536594" /><path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 454.97461,381.50764 c -0.0736,-0.0257 -0.11887,-0.0415 -0.18687,-0.0653 -59.67543,-20.8346 -91.29336,-86.33378 -70.45084,-146.03188 5.72511,-16.39813 14.92428,-30.59236 26.36198,-42.26448 -3.29602,-1.51283 -6.65995,-2.92233 -10.15928,-4.14406 -59.766,-20.86622 -125.15573,10.65649 -146.03184,70.45084 l -15.05215,43.11307 c -10.68122,30.59363 -34.17187,54.79029 -64.63445,66.47768 -10.17733,3.96817 -17.38414,13.4202 -18.20325,24.79116 -0.9164,13.28721 8.329,25.17993 20.89938,29.56865 l 251.64586,87.85762 c 13.1706,4.59829 28.58431,0.40642 35.75467,-11.56127 5.54241,-9.2518 5.48702,-20.48337 0.002,-29.68445 -15.90548,-26.7325 -19.22019,-58.96007 -9.94599,-88.50764 z m 0,0"
|
||||
id="path6"
|
||||
style="fill:#9178b7;fill-opacity:1;stroke-width:1.53536594" /><path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 569.88056,300.18973 c -14.90587,42.69409 -61.59697,65.2195 -104.29102,50.31364 -42.69409,-14.90587 -65.21947,-61.59696 -50.3136,-104.29106 14.90586,-42.69403 61.59693,-65.21944 104.29101,-50.31357 42.69406,14.90586 65.21947,61.59694 50.31361,104.29099 z m 0,0"
|
||||
id="path8"
|
||||
style="fill:#9178b7;fill-opacity:1;stroke-width:1.53536594" /><rect
|
||||
style="opacity:0.5;fill:#ffffff;fill-opacity:0.78431373;fill-rule:evenodd;stroke:none;stroke-width:5.62767839;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"
|
||||
id="rect4504"
|
||||
width="768.56519"
|
||||
height="678.05548"
|
||||
x="-61.99469"
|
||||
y="-11.059112" /></svg>
|
After Width: | Height: | Size: 4.8 KiB |
@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
height="512pt"
|
||||
viewBox="0 0 512 512"
|
||||
width="512pt"
|
||||
version="1.1"
|
||||
id="svg6"
|
||||
sodipodi:docname="help.svg"
|
||||
inkscape:version="0.92.0 r15299">
|
||||
<metadata
|
||||
id="metadata12">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs10" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-height="1017"
|
||||
id="namedview8"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.69140625"
|
||||
inkscape:cx="132.67442"
|
||||
inkscape:cy="151.29307"
|
||||
inkscape:window-x="1912"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg6" />
|
||||
<path
|
||||
d="m 494.10169,605.28813 h -320 c -53.02344,0 -95.999997,-42.97656 -95.999997,-96 v -320 c 0,-53.02344 42.976557,-95.999997 95.999997,-95.999997 h 320 c 53.02344,0 96,42.976557 96,95.999997 v 320 c 0,53.02344 -42.97656,96 -96,96 z m 0,0"
|
||||
id="path2"
|
||||
style="fill:#ded1f2;fill-opacity:1"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
d="m 334.10169,221.28813 c -70.57422,0 -128,57.42578 -128,128 0,70.57422 57.42578,128 128,128 70.57422,0 128,-57.42578 128,-128 0,-70.57422 -57.42578,-128 -128,-128 z m 56,138.67188 h -45.32812 v 45.32812 c 0,5.88672 -4.78516,10.67188 -10.67188,10.67188 -5.88672,0 -10.67187,-4.78516 -10.67187,-10.67188 v -45.32812 h -45.32813 c -5.88672,0 -10.67187,-4.78516 -10.67187,-10.67188 0,-5.88672 4.78515,-10.67187 10.67187,-10.67187 h 45.32813 v -45.32813 c 0,-5.88672 4.78515,-10.67187 10.67187,-10.67187 5.88672,0 10.67188,4.78515 10.67188,10.67187 v 45.32813 h 45.32812 c 5.88672,0 10.67188,4.78515 10.67188,10.67187 0,5.88672 -4.78516,10.67188 -10.67188,10.67188 z m 0,0"
|
||||
id="path4"
|
||||
style="fill:#9178b7;fill-opacity:1"
|
||||
inkscape:connector-curvature="0" />
|
||||
<rect
|
||||
style="opacity:0.5;fill:#ffffff;fill-opacity:0.78431373;fill-rule:evenodd;stroke:none;stroke-width:4.51278925;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"
|
||||
id="rect4504"
|
||||
width="614.39001"
|
||||
height="545.42297"
|
||||
x="38.296513"
|
||||
y="74.407166" />
|
||||
</svg>
|
After Width: | Height: | Size: 3.1 KiB |
@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 512 512"
|
||||
style="enable-background:new 0 0 512 512;"
|
||||
xml:space="preserve"
|
||||
width="512"
|
||||
height="512"
|
||||
sodipodi:docname="interval.svg"
|
||||
inkscape:version="0.92.0 r15299"><metadata
|
||||
id="metadata39"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs37" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-height="1017"
|
||||
id="namedview35"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.46093749"
|
||||
inkscape:cx="369.01074"
|
||||
inkscape:cy="360.3966"
|
||||
inkscape:window-x="1912"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="g32" /><g
|
||||
id="g32"><circle
|
||||
cx="388.33899"
|
||||
cy="373.15256"
|
||||
r="326.50848"
|
||||
id="circle2"
|
||||
style="fill:#9178b7;fill-opacity:1;stroke-width:1.27542377" /><path
|
||||
d="m 388.33899,124.4449 c -137.13356,0 -248.70763,111.57407 -248.70763,248.70763 0,137.13356 111.57407,249.98305 248.70763,249.98305 137.13356,0 248.70763,-112.84949 248.70763,-249.98305 0,-137.13356 -111.57407,-248.70763 -248.70763,-248.70763 z"
|
||||
id="path6"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#eceff1;fill-opacity:1;stroke-width:1.27542377" /><path
|
||||
d="m 388.33899,200.97033 c -10.57454,0 -19.13136,8.55682 -19.13136,19.13135 v 191.31356 c 0,10.57454 8.55682,19.13136 19.13136,19.13136 10.57454,0 19.13135,-8.55682 19.13135,-19.13136 V 220.10168 c 0,-10.57453 -8.55681,-19.13135 -19.13135,-19.13135 z"
|
||||
id="path10"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#90a4ae;fill-opacity:1;stroke-width:1.27542377" /><path
|
||||
d="M 503.12712,354.02118 H 388.33899 350.07628 c -10.57454,0 -19.13136,8.55681 -19.13136,19.13135 0,10.57454 8.55682,19.13136 19.13136,19.13136 h 38.26271 114.78813 c 10.57454,0 19.13136,-8.55682 19.13136,-19.13136 0,-10.57454 -8.55682,-19.13135 -19.13136,-19.13135 z"
|
||||
id="path14"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#90a4ae;fill-opacity:1;stroke-width:1.27542377" /><rect
|
||||
style="opacity:0.5;fill:#ffffff;fill-opacity:0.78431373;fill-rule:evenodd;stroke:none;stroke-width:5.62767839;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"
|
||||
id="rect4504"
|
||||
width="768.56519"
|
||||
height="678.05548"
|
||||
x="-17.638517"
|
||||
y="36.294277" /></g></svg>
|
After Width: | Height: | Size: 3.5 KiB |
@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
id="Capa_1"
|
||||
enable-background="new 0 0 512 512"
|
||||
height="512"
|
||||
viewBox="0 0 512 512"
|
||||
width="512"
|
||||
version="1.1"
|
||||
sodipodi:docname="love.svg"
|
||||
inkscape:version="0.92.0 r15299">
|
||||
<metadata
|
||||
id="metadata97">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs95" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-height="1017"
|
||||
id="namedview93"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.4609375"
|
||||
inkscape:cx="-161.41471"
|
||||
inkscape:cy="87.761635"
|
||||
inkscape:window-x="1912"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="g88" />
|
||||
<g
|
||||
id="g90">
|
||||
<g
|
||||
id="g88"
|
||||
transform="matrix(1.941682,0,0,1.941682,-258.91443,105.22034)">
|
||||
<g
|
||||
id="g52"
|
||||
style="fill:#eceff1;fill-opacity:1">
|
||||
<path
|
||||
d="m 182.795,15.986 v 165.382 c 0,8.829 7.157,15.986 15.986,15.986 h 20.359 c 2.854,0 5.364,1.885 6.16,4.626 l 11.126,38.317 c 1.404,4.836 7.578,6.242 10.938,2.491 l 38.788,-43.3 c 1.217,-1.358 2.954,-2.134 4.778,-2.134 h 192.658 c 8.829,0 15.986,-7.157 15.986,-15.986 V 15.986 C 499.573,7.157 492.416,0 483.587,0 H 198.781 c -8.829,0 -15.986,7.157 -15.986,15.986 z"
|
||||
id="path50"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#eceff1;fill-opacity:1" />
|
||||
</g>
|
||||
<g
|
||||
id="g64"
|
||||
style="fill:#9178b7;fill-opacity:1">
|
||||
<path
|
||||
d="m 256.62,39.06 6.423,13.015 c 0.54,1.095 1.585,1.854 2.794,2.03 l 14.363,2.087 c 3.043,0.442 4.259,4.182 2.056,6.329 l -10.393,10.131 c -0.875,0.852 -1.274,2.081 -1.067,3.284 l 2.453,14.305 c 0.52,3.031 -2.662,5.343 -5.384,3.911 l -12.847,-6.754 c -1.081,-0.568 -2.372,-0.568 -3.453,0 l -12.847,6.754 c -2.722,1.431 -5.904,-0.88 -5.384,-3.911 l 2.453,-14.305 c 0.206,-1.204 -0.193,-2.432 -1.067,-3.284 L 224.327,62.521 c -2.202,-2.147 -0.987,-5.887 2.056,-6.329 l 14.363,-2.087 c 1.209,-0.176 2.253,-0.935 2.794,-2.03 l 6.423,-13.015 c 1.364,-2.758 5.296,-2.758 6.657,0 z"
|
||||
id="path58"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#9178b7;fill-opacity:1" />
|
||||
<path
|
||||
d="m 344.511,39.06 6.423,13.015 c 0.54,1.095 1.585,1.854 2.794,2.03 l 14.363,2.087 c 3.043,0.442 4.259,4.182 2.056,6.329 l -10.393,10.131 c -0.875,0.852 -1.274,2.081 -1.067,3.284 l 2.453,14.305 c 0.52,3.031 -2.662,5.343 -5.384,3.911 l -12.847,-6.754 c -1.081,-0.568 -2.372,-0.568 -3.453,0 l -12.847,6.754 c -2.722,1.431 -5.904,-0.88 -5.384,-3.911 l 2.453,-14.305 c 0.206,-1.204 -0.193,-2.432 -1.067,-3.284 L 312.22,62.521 c -2.202,-2.147 -0.987,-5.887 2.056,-6.329 l 14.363,-2.087 c 1.209,-0.176 2.253,-0.935 2.794,-2.03 l 6.423,-13.015 c 1.362,-2.758 5.294,-2.758 6.655,0 z"
|
||||
id="path60"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#9178b7;fill-opacity:1" />
|
||||
<path
|
||||
d="m 432.402,39.06 6.423,13.015 c 0.54,1.095 1.585,1.854 2.794,2.03 l 14.363,2.087 c 3.043,0.442 4.259,4.182 2.056,6.329 l -10.393,10.131 c -0.874,0.852 -1.274,2.081 -1.067,3.284 l 2.453,14.305 c 0.52,3.031 -2.662,5.343 -5.384,3.911 L 430.8,87.398 c -1.081,-0.568 -2.372,-0.568 -3.453,0 L 414.5,94.152 c -2.722,1.431 -5.904,-0.88 -5.384,-3.911 l 2.453,-14.305 c 0.206,-1.204 -0.193,-2.432 -1.067,-3.284 L 400.109,62.521 c -2.202,-2.147 -0.987,-5.887 2.056,-6.329 l 14.363,-2.087 c 1.209,-0.176 2.253,-0.935 2.794,-2.03 l 6.423,-13.015 c 1.363,-2.758 5.296,-2.758 6.657,0 z"
|
||||
id="path62"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#9178b7;fill-opacity:1" />
|
||||
</g>
|
||||
<g
|
||||
id="g76" />
|
||||
<g
|
||||
id="g86">
|
||||
<g
|
||||
id="g80"
|
||||
style="fill:#90a4ae;fill-opacity:1">
|
||||
<path
|
||||
d="M 459.163,137.933 H 220.989 c -4.142,0 -7.5,-3.358 -7.5,-7.5 0,-4.142 3.358,-7.5 7.5,-7.5 h 238.174 c 4.142,0 7.5,3.358 7.5,7.5 0,4.142 -3.358,7.5 -7.5,7.5 z"
|
||||
id="path78"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#90a4ae;fill-opacity:1" />
|
||||
</g>
|
||||
<g
|
||||
id="g84"
|
||||
style="fill:#90a4ae;fill-opacity:1;stroke:none;stroke-opacity:1">
|
||||
<path
|
||||
d="M 340.076,167.863 H 220.989 c -4.142,0 -7.5,-3.358 -7.5,-7.5 0,-4.142 3.358,-7.5 7.5,-7.5 h 119.087 c 4.142,0 7.5,3.358 7.5,7.5 0,4.142 -3.358,7.5 -7.5,7.5 z"
|
||||
id="path82"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#90a4ae;fill-opacity:1;stroke:none;stroke-opacity:1" />
|
||||
</g>
|
||||
</g>
|
||||
<rect
|
||||
style="opacity:0.5;fill:#ffffff;fill-opacity:0.78431373;fill-rule:evenodd;stroke:none;stroke-width:2.89835215;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"
|
||||
id="rect4504"
|
||||
width="395.82443"
|
||||
height="349.21036"
|
||||
x="139.90385"
|
||||
y="-53.375328" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 6.0 KiB |
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 505 505"
|
||||
style="enable-background:new 0 0 505 505;"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="settings.svg"
|
||||
inkscape:version="0.92.0 r15299"><metadata
|
||||
id="metadata43"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs41" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
id="namedview39"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.3304499"
|
||||
inkscape:cx="-433.02666"
|
||||
inkscape:cy="120.52743"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1" /><path
|
||||
style="fill:#ded1f2;fill-opacity:1;stroke-width:1.194754"
|
||||
d="m 54.471192,356.14658 c 0,-166.66819 135.007198,-301.675388 301.675388,-301.675388 166.5487,0 301.67538,135.007198 301.67538,301.675388 0,166.66817 -135.12668,301.67538 -301.67538,301.67538 -166.66819,0 -301.675388,-135.00721 -301.675388,-301.67538 z"
|
||||
id="path2"
|
||||
inkscape:connector-curvature="0" /><g
|
||||
id="g8"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g10"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g12"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g14"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g16"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g18"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g20"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g22"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g24"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g26"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g28"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g30"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g32"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g34"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g36"
|
||||
transform="scale(1.3026177)" /><g
|
||||
transform="translate(107.14129,82.560247)"
|
||||
id="g8-7"
|
||||
style="fill:#90a4ae;fill-opacity:1" /><g
|
||||
transform="translate(107.14129,82.560247)"
|
||||
id="g48" /><g
|
||||
transform="translate(107.14129,82.560247)"
|
||||
id="g50" /><g
|
||||
transform="translate(107.14129,82.560247)"
|
||||
id="g52" /><g
|
||||
transform="translate(107.14129,82.560247)"
|
||||
id="g54" /><g
|
||||
transform="translate(107.14129,82.560247)"
|
||||
id="g56" /><g
|
||||
transform="translate(107.14129,82.560247)"
|
||||
id="g58" /><g
|
||||
transform="translate(107.14129,82.560247)"
|
||||
id="g60" /><g
|
||||
transform="translate(107.14129,82.560247)"
|
||||
id="g62" /><g
|
||||
transform="translate(107.14129,82.560247)"
|
||||
id="g64" /><g
|
||||
transform="translate(107.14129,82.560247)"
|
||||
id="g66" /><g
|
||||
transform="translate(107.14129,82.560247)"
|
||||
id="g68" /><g
|
||||
transform="translate(107.14129,82.560247)"
|
||||
id="g70" /><g
|
||||
transform="translate(107.14129,82.560247)"
|
||||
id="g72" /><g
|
||||
transform="translate(107.14129,82.560247)"
|
||||
id="g74" /><g
|
||||
transform="translate(107.14129,82.560247)"
|
||||
id="g76" /><path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 407.30702,633.58604 h -30.82827 c -24.93373,0 -45.22015,-20.28545 -45.22015,-45.21919 v -10.42958 c -10.60035,-3.38666 -20.89946,-7.66173 -30.79371,-12.78202 l -7.39118,7.39117 c -17.90135,17.92343 -46.57672,17.39768 -63.95808,-0.007 L 207.3268,550.75171 c -17.41207,-17.39287 -17.91288,-46.05864 0.006,-63.95809 l 7.38543,-7.38542 c -5.12029,-9.89424 -9.3944,-20.19143 -12.78202,-30.79371 h -10.42863 c -24.93276,0 -45.21918,-20.28546 -45.21918,-45.21918 v -30.82908 c 0,-24.93372 20.28642,-45.21919 45.22014,-45.21919 h 10.42862 c 3.38764,-10.60132 7.66174,-20.89946 12.78203,-30.79371 l -7.39118,-7.39022 c -17.90807,-17.88889 -17.41399,-46.55754 0.006,-63.95809 l 21.79075,-21.78979 c 17.42166,-17.44565 46.0903,-17.88122 63.95713,0.006 l 7.38447,7.38446 c 9.89423,-5.11933 20.19335,-9.3944 30.7937,-12.78202 v -10.42863 c 0,-24.93373 20.28546,-45.21918 45.22014,-45.21918 h 30.82827 c 24.93373,0 45.21919,20.28545 45.21919,45.21918 v 10.42958 c 10.60035,3.38667 20.89946,7.66174 30.7937,12.78203 l 7.39119,-7.39118 c 17.90135,-17.92343 46.57672,-17.39768 63.95809,0.007 l 21.78882,21.78787 c 17.41207,17.39289 17.91287,46.05866 -0.009,63.9581 l -7.38543,7.38542 c 5.12029,9.89425 9.3944,20.19143 12.78202,30.79371 h 10.42864 c 24.93372,0 45.22013,20.28546 45.22013,45.21919 v 30.8292 c 0,24.93373 -20.28641,45.21919 -45.22013,45.21919 h -10.42864 c -3.38762,10.60132 -7.66173,20.89946 -12.78202,30.7937 l 7.39119,7.39119 c 17.90806,17.88888 17.41397,46.55754 -0.009,63.95809 l -21.79074,21.78978 c -17.42166,17.44565 -46.09031,17.88122 -63.95713,-0.006 l -7.38447,-7.38447 c -9.89424,5.11933 -20.19335,9.3944 -30.7937,12.78202 v 10.42959 c 0,24.93181 -20.28546,45.21726 -45.22014,45.21726 z M 305.27626,534.93141 c 13.74525,8.12896 28.53914,14.27005 43.97005,18.2525 6.35504,1.63961 10.79512,7.37104 10.79512,13.93426 v 21.24868 c 0,9.06341 7.37486,16.43733 16.43827,16.43733 h 30.82828 c 9.0634,0 16.43827,-7.37392 16.43827,-16.43733 v -21.24868 c 0,-6.56322 4.44008,-12.29465 10.79512,-13.93426 15.43091,-3.98245 30.2248,-10.12354 43.97005,-18.2525 5.65564,-3.34445 12.8559,-2.43494 17.50224,2.21141 l 15.05101,15.05196 c 6.48934,6.49702 16.91029,6.34639 23.24039,0.007 l 21.80417,-21.80321 c 6.31474,-6.30707 6.5258,-16.72994 0.009,-23.24136 L 541.06052,492.0995 c -4.6454,-4.64538 -5.5549,-11.8466 -2.21141,-17.50128 8.12895,-13.7443 14.26908,-28.53818 18.25154,-43.97005 1.64057,-6.35504 7.37199,-10.79416 13.93425,-10.79416 h 21.24774 c 9.06341,0 16.43827,-7.37391 16.43827,-16.43732 v -30.82921 c 0,-9.06341 -7.37486,-16.43731 -16.43827,-16.43731 H 571.0349 c -6.56322,0 -12.29368,-4.44009 -13.93425,-10.79416 -3.98246,-15.43188 -10.12355,-30.22576 -18.25154,-43.97005 -3.34349,-5.65468 -2.43399,-12.8559 2.21141,-17.50129 l 15.05195,-15.05195 c 6.50661,-6.49895 6.3368,-16.91798 0.009,-23.24136 l -21.80131,-21.80239 c -6.31955,-6.32818 -16.74241,-6.51334 -23.24136,-0.006 l -15.05675,15.05771 c -4.64539,4.64634 -11.84853,5.55586 -17.50224,2.21141 -13.74526,-8.12897 -28.53914,-14.27005 -43.97006,-18.25251 -6.35502,-1.6396 -10.79512,-7.37103 -10.79512,-13.93426 v -21.2506 c 0,-9.06341 -7.37486,-16.43733 -16.43827,-16.43733 h -30.82827 c -9.06341,0 -16.43828,7.37392 -16.43828,16.43733 v 21.24868 c 0,6.56323 -4.44008,12.29467 -10.79512,13.93427 -15.43091,3.98245 -30.22479,10.12354 -43.97004,18.2525 -5.6566,3.34348 -12.85686,2.43398 -17.50225,-2.21141 L 272.73141,223.7668 c -6.48936,-6.49702 -16.91126,-6.34639 -23.2404,-0.007 l -21.80418,21.80322 c -6.31473,6.30707 -6.5258,16.72898 -0.006,23.24136 l 15.05771,15.05771 c 4.64538,4.64539 5.55489,11.84661 2.2114,17.50128 -8.12896,13.7443 -14.26909,28.53818 -18.25154,43.97005 -1.64056,6.35503 -7.372,10.79415 -13.93426,10.79415 h -21.24868 c -9.06341,9.7e-4 -16.43829,7.37488 -16.43829,16.43829 v 30.82921 c 0,9.06341 7.37488,16.43731 16.43829,16.43731 h 21.24772 c 6.56322,0 12.2937,4.44008 13.93426,10.79416 3.98245,15.43188 10.12354,30.22576 18.25154,43.97005 3.34349,5.65468 2.43398,12.8559 -2.2114,17.50129 l -15.05196,15.05195 c -6.50662,6.49895 -6.33681,16.91798 -0.006,23.24136 l 21.80225,21.80225 c 6.31954,6.32818 16.74241,6.51335 23.24136,0.006 l 15.05674,-15.05771 c 3.42313,-3.42215 10.54472,-6.32625 17.50321,-2.21044 z"
|
||||
id="path2-7"
|
||||
style="fill:#9178b7;fill-opacity:1;stroke-width:0.95939529" /><path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 391.89337,494.85747 c -58.9328,0 -106.87666,-47.94482 -106.87666,-106.87664 0,-58.93182 47.94386,-106.87664 106.87666,-106.87664 58.93278,0 106.87664,47.94482 106.87664,106.87664 0,58.93182 -47.94386,106.87664 -106.87664,106.87664 z m 0,-184.97142 c -43.06248,0 -78.0948,35.03329 -78.0948,78.09478 0,43.0615 35.03328,78.09478 78.0948,78.09478 43.0615,0 78.09478,-35.03328 78.09478,-78.09478 0,-43.06149 -35.03232,-78.09478 -78.09478,-78.09478 z"
|
||||
id="path4-6"
|
||||
style="fill:#9178b7;fill-opacity:1;stroke-width:0.95939529" /><rect
|
||||
style="opacity:0.5;fill:#ffffff;fill-opacity:0.78431373;fill-rule:evenodd;stroke:none;stroke-width:5.62767839;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"
|
||||
id="rect4504"
|
||||
width="768.56519"
|
||||
height="678.05548"
|
||||
x="-25.146145"
|
||||
y="32.319691" /></svg>
|
After Width: | Height: | Size: 9.3 KiB |
@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Capa_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 512 512"
|
||||
style="enable-background:new 0 0 512 512;"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="support.svg"
|
||||
inkscape:version="0.92.0 r15299"><metadata
|
||||
id="metadata75"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs73" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-height="1017"
|
||||
id="namedview71"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.92187498"
|
||||
inkscape:cx="127.5288"
|
||||
inkscape:cy="162.24021"
|
||||
inkscape:window-x="1912"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="g22" /><path
|
||||
style="fill:#9178b7;fill-opacity:1;stroke:none"
|
||||
d="m 374.18666,111.86429 c -136.624,0 -247.29601,110.672 -247.29601,247.296 0,136.624 110.67201,247.296 247.29601,247.296 136.624,0 247.296,-110.672 247.296,-247.296 0,-136.624 -110.672,-247.296 -247.296,-247.296 z m 0,368.576 c -66.928,0 -121.12,-54.336 -121.12,-121.264 0,-66.928 54.192,-121.12 121.12,-121.12 66.928,0 121.264,54.192 121.264,121.12 0.016,66.912 -54.336,121.264 -121.264,121.264 z"
|
||||
id="path10"
|
||||
inkscape:connector-curvature="0" /><g
|
||||
id="g22"
|
||||
transform="translate(81.305295,78.237171)"
|
||||
style="stroke:none"><path
|
||||
style="fill:#eceff1;fill-opacity:1;stroke:#eceff1;stroke-opacity:1"
|
||||
d="m 195.61736,53.531119 53.776,114.448001 c 13.504,-5.2 28.128,-8.16 43.488,-8.16 15.344,0 29.968,2.96 43.488,8.16 l 53.776,-114.448001 c -29.856,-12.784 -62.72,-19.904 -97.264,-19.904 -34.544,0 -67.408,7.12 -97.264,19.904 z"
|
||||
id="path14"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
style="fill:#eceff1;fill-opacity:1;stroke:#eceff1;stroke-opacity:1"
|
||||
d="m 171.76136,280.92312 c 0,-15.36 2.976,-29.984 8.176,-43.488 l -114.448003,-53.776 c -12.784,29.856 -19.904,62.72 -19.904,97.264 0,34.544 7.12,67.408 19.904,97.264 l 114.432003,-53.776 c -5.184,-13.52 -8.16,-28.144 -8.16,-43.488 z"
|
||||
id="path16"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
style="fill:#eceff1;fill-opacity:1;stroke:#eceff1;stroke-opacity:1"
|
||||
d="m 390.14536,508.31512 -53.728,-114.32 c -13.536,5.216 -28.176,8.208 -43.536,8.208 -15.376,0 -30.016,-2.992 -43.552,-8.208 l -53.728,114.336 c 29.856,12.784 62.72,19.904 97.264,19.904 34.56,-0.016 67.424,-7.136 97.28,-19.92 z"
|
||||
id="path18"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
style="fill:#eceff1;fill-opacity:1;stroke:#eceff1;stroke-opacity:1"
|
||||
d="m 414.16136,280.92312 c 0,15.36 -2.976,30 -8.208,43.536 l 114.32,53.728 c 12.784,-29.856 19.904,-62.72 19.904,-97.264 0,-34.544 -7.12,-67.408 -19.904,-97.264 l -114.336,53.728 c 5.232,13.52 8.224,28.176 8.224,43.536 z"
|
||||
id="path20"
|
||||
inkscape:connector-curvature="0" /><rect
|
||||
style="opacity:0.5;fill:#ffffff;fill-opacity:0.78431373;fill-rule:evenodd;stroke:none;stroke-width:5.62767839;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"
|
||||
id="rect4504"
|
||||
width="768.56519"
|
||||
height="678.05548"
|
||||
x="-178.1302"
|
||||
y="-39.773388" /></g><g
|
||||
id="g40"
|
||||
transform="translate(81.305295,78.237171)" /><g
|
||||
id="g42"
|
||||
transform="translate(81.305295,78.237171)" /><g
|
||||
id="g44"
|
||||
transform="translate(81.305295,78.237171)" /><g
|
||||
id="g46"
|
||||
transform="translate(81.305295,78.237171)" /><g
|
||||
id="g48"
|
||||
transform="translate(81.305295,78.237171)" /><g
|
||||
id="g50"
|
||||
transform="translate(81.305295,78.237171)" /><g
|
||||
id="g52"
|
||||
transform="translate(81.305295,78.237171)" /><g
|
||||
id="g54"
|
||||
transform="translate(81.305295,78.237171)" /><g
|
||||
id="g56"
|
||||
transform="translate(81.305295,78.237171)" /><g
|
||||
id="g58"
|
||||
transform="translate(81.305295,78.237171)" /><g
|
||||
id="g60"
|
||||
transform="translate(81.305295,78.237171)" /><g
|
||||
id="g62"
|
||||
transform="translate(81.305295,78.237171)" /><g
|
||||
id="g64"
|
||||
transform="translate(81.305295,78.237171)" /><g
|
||||
id="g66"
|
||||
transform="translate(81.305295,78.237171)" /><g
|
||||
id="g68"
|
||||
transform="translate(81.305295,78.237171)" /></svg>
|
After Width: | Height: | Size: 5.2 KiB |
@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 505 505"
|
||||
style="enable-background:new 0 0 505 505;"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="update.svg"
|
||||
inkscape:version="0.92.0 r15299"><metadata
|
||||
id="metadata43"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs41" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-height="1017"
|
||||
id="namedview39"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.6608998"
|
||||
inkscape:cx="-41.965565"
|
||||
inkscape:cy="289.29436"
|
||||
inkscape:window-x="1912"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1" /><path
|
||||
style="fill:#ded1f2;fill-opacity:1;stroke-width:1.194754"
|
||||
d="m 54.471192,356.14658 c 0,-166.66819 135.007198,-301.675388 301.675388,-301.675388 166.5487,0 301.67538,135.007198 301.67538,301.675388 0,166.66817 -135.12668,301.67538 -301.67538,301.67538 -166.66819,0 -301.675388,-135.00721 -301.675388,-301.67538 z"
|
||||
id="path2"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
style="fill:#9178b7;fill-opacity:1;stroke-width:1.194754"
|
||||
d="m 287.44822,389.59968 h 18.51868 c 14.33706,0 22.46138,-16.36813 13.85915,-27.83776 l -72.64104,-95.81927 c -6.92957,-9.19961 -20.78872,-9.19961 -27.71829,0 l -72.64105,95.81927 c -8.7217,11.46963 -0.4779,27.83776 13.85915,27.83776 h 16.72655 c 26.04564,120.07278 140.50308,170.25245 226.16694,142.7731 7.52694,-2.3895 6.09324,-13.50072 -1.91161,-14.09809 -78.97324,-5.73482 -122.58176,-74.55265 -114.21848,-128.67501 z"
|
||||
id="path4"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
style="fill:#9178b7;fill-opacity:1;stroke-width:1.194754"
|
||||
d="m 424.84493,322.69346 h -18.51869 c -14.33705,0 -22.46137,16.36813 -13.85914,27.83777 l 72.64104,95.93875 c 6.92957,9.19961 20.78871,9.19961 27.71829,0 l 72.64104,-95.93875 c 8.7217,-11.46964 0.4779,-27.83777 -13.85914,-27.83777 H 534.88177 C 508.71666,202.62069 394.25922,152.44102 308.59536,179.92036 c -7.52695,2.38951 -6.09324,13.50072 1.91161,14.0981 79.09271,5.73482 122.70123,74.55265 114.33796,128.675 z"
|
||||
id="path6"
|
||||
inkscape:connector-curvature="0" /><g
|
||||
id="g8"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g10"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g12"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g14"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g16"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g18"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g20"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g22"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g24"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g26"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g28"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g30"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g32"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g34"
|
||||
transform="scale(1.3026177)" /><g
|
||||
id="g36"
|
||||
transform="scale(1.3026177)" /><rect
|
||||
style="opacity:0.5;fill:#ffffff;fill-opacity:0.78431373;fill-rule:evenodd;stroke:none;stroke-width:5.62767839;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"
|
||||
id="rect4504"
|
||||
width="768.56519"
|
||||
height="678.05548"
|
||||
x="-71.073227"
|
||||
y="-6.5198488" /></svg>
|
After Width: | Height: | Size: 4.4 KiB |
@ -0,0 +1,181 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Capa_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 512.001 512.001"
|
||||
style="enable-background:new 0 0 512.001 512.001;"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="welcome.svg"
|
||||
inkscape:version="0.92.0 r15299"><metadata
|
||||
id="metadata99"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs97" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
id="namedview95"
|
||||
showgrid="false"
|
||||
inkscape:zoom="1.3037256"
|
||||
inkscape:cx="154.95189"
|
||||
inkscape:cy="223.3697"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Capa_1" /><circle
|
||||
style="fill:#ded1f2;fill-opacity:1;stroke-width:0.8621738"
|
||||
cx="256.00003"
|
||||
cy="252.93185"
|
||||
r="220.71649"
|
||||
id="circle2" /><g
|
||||
id="g20"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)"><path
|
||||
style="fill:#34abe0"
|
||||
d="m 469.869,206.196 c -3.882,0 -7.029,-3.147 -7.029,-7.029 v -11.259 c 0,-3.882 3.147,-7.029 7.029,-7.029 3.882,0 7.029,3.147 7.029,7.029 v 11.259 c -0.001,3.883 -3.148,7.029 -7.029,7.029 z"
|
||||
id="path4"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
style="fill:#34abe0"
|
||||
d="m 469.869,263.776 c -3.882,0 -7.029,-3.147 -7.029,-7.029 V 245.49 c 0,-3.882 3.147,-7.029 7.029,-7.029 3.882,0 7.029,3.147 7.029,7.029 v 11.258 c -0.001,3.881 -3.148,7.028 -7.029,7.028 z"
|
||||
id="path6"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
style="fill:#34abe0"
|
||||
d="m 504.288,229.358 h -11.259 c -3.882,0 -7.029,-3.147 -7.029,-7.029 0,-3.882 3.147,-7.029 7.029,-7.029 h 11.259 c 3.882,0 7.029,3.147 7.029,7.029 0,3.881 -3.148,7.029 -7.029,7.029 z"
|
||||
id="path8"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
style="fill:#34abe0"
|
||||
d="M 446.707,229.358 H 435.45 c -3.882,0 -7.029,-3.147 -7.029,-7.029 0,-3.882 3.147,-7.029 7.029,-7.029 h 11.258 c 3.882,0 7.029,3.147 7.029,7.029 -0.002,3.881 -3.148,7.029 -7.03,7.029 z"
|
||||
id="path10"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
style="fill:#34abe0"
|
||||
d="m 391.867,22.724 c -3.882,0 -7.029,-3.147 -7.029,-7.029 V 7.029 c 0,-3.882 3.147,-7.029 7.029,-7.029 3.882,0 7.029,3.147 7.029,7.029 v 8.666 c 0,3.883 -3.147,7.029 -7.029,7.029 z"
|
||||
id="path12"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
style="fill:#34abe0"
|
||||
d="m 391.867,67.048 c -3.882,0 -7.029,-3.147 -7.029,-7.029 v -8.666 c 0,-3.882 3.147,-7.029 7.029,-7.029 3.882,0 7.029,3.147 7.029,7.029 v 8.666 c 0,3.882 -3.147,7.029 -7.029,7.029 z"
|
||||
id="path14"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
style="fill:#34abe0"
|
||||
d="m 418.362,40.553 h -8.666 c -3.882,0 -7.029,-3.147 -7.029,-7.029 0,-3.882 3.147,-7.029 7.029,-7.029 h 8.666 c 3.882,0 7.029,3.147 7.029,7.029 0,3.882 -3.147,7.029 -7.029,7.029 z"
|
||||
id="path16"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
style="fill:#34abe0"
|
||||
d="m 374.038,40.553 h -8.666 c -3.882,0 -7.029,-3.147 -7.029,-7.029 0,-3.882 3.147,-7.029 7.029,-7.029 h 8.666 c 3.882,0 7.029,3.147 7.029,7.029 0,3.882 -3.147,7.029 -7.029,7.029 z"
|
||||
id="path18"
|
||||
inkscape:connector-curvature="0" /></g><path
|
||||
style="fill:#9178b7;fill-opacity:1;stroke-width:0.8621738"
|
||||
d="m 298.98111,139.77931 c -1.09841,0 -2.21061,-0.29831 -3.21073,-0.92511 -2.83569,-1.77694 -3.69529,-5.51619 -1.9192,-8.35187 8.88986,-14.19398 16.29077,-28.09049 21.99663,-41.303308 1.32689,-3.071925 4.89112,-4.486752 7.96563,-3.160729 3.07192,1.326886 4.48762,4.893699 3.15987,7.965625 -5.94815,13.774092 -13.63787,28.218092 -22.85278,42.931942 -1.14842,1.83643 -3.12107,2.84345 -5.13942,2.84345 z"
|
||||
id="path22"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
style="fill:#34abe0;stroke-width:0.8621738"
|
||||
d="m 221.49065,234.60809 c -1.61572,0 -3.22798,-0.64233 -4.42037,-1.91403 -2.28993,-2.44081 -2.1675,-6.27489 0.27331,-8.56569 0.27849,-0.26124 28.13963,-26.53427 55.9456,-63.72931 2.00368,-2.6805 5.80157,-3.2297 8.48293,-1.22514 2.68049,2.00368 3.22884,5.80156 1.22514,8.48291 -28.47845,38.09258 -56.19562,64.21816 -57.36214,65.3114 -1.17083,1.09583 -2.65895,1.63986 -4.14447,1.63986 z"
|
||||
id="path24"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
style="fill:#f9f9f9;stroke-width:0.8621738"
|
||||
d="m 275.09631,243.34881 c -1.64503,0 -3.28488,-0.6656 -4.47986,-1.97782 -2.25372,-2.47358 -2.07784,-6.30594 0.3966,-8.5614 28.21033,-25.71433 84.0654,-71.36126 141.18269,-88.17193 3.20988,-0.94408 6.57925,0.89148 7.52419,4.10223 0.94495,3.21073 -0.89149,6.57924 -4.10222,7.52419 -54.78597,16.12438 -108.99946,60.49098 -136.43987,85.50264 -1.16308,1.05961 -2.62446,1.58209 -4.08153,1.58209 z"
|
||||
id="path26"
|
||||
inkscape:connector-curvature="0" /><g
|
||||
id="g32"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)"><path
|
||||
style="fill:#9178b7;fill-opacity:1"
|
||||
d="m 290.023,308.794 c -2.069,0 -4.119,-0.909 -5.507,-2.655 -2.416,-3.039 -1.91,-7.461 1.128,-9.875 2.334,-1.855 58.024,-45.266 133.17,-30.816 3.812,0.732 6.308,4.417 5.575,8.229 -0.732,3.813 -4.415,6.314 -8.229,5.575 -68.879,-13.246 -121.248,27.602 -121.769,28.017 -1.292,1.025 -2.835,1.525 -4.368,1.525 z"
|
||||
id="path28"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
style="fill:#9178b7;fill-opacity:1"
|
||||
d="m 194.779,177.404 c -1.061,0 -2.137,-0.24 -3.148,-0.749 -3.469,-1.742 -4.869,-5.966 -3.126,-9.435 11.361,-22.624 23.205,-58.429 15.111,-100.516 -0.734,-3.812 1.763,-7.496 5.575,-8.229 3.811,-0.734 7.496,1.763 8.229,5.575 8.84,45.966 -4.013,84.906 -16.353,109.479 -1.234,2.456 -3.713,3.875 -6.288,3.875 z"
|
||||
id="path30"
|
||||
inkscape:connector-curvature="0" /></g><path
|
||||
style="fill:#f9f9f9;stroke-width:0.8621738"
|
||||
d="m 282.19114,351.70423 -99.61988,49.64742 -57.9993,28.91818 C 95.167528,408.4413 71.374975,379.46881 55.771353,345.91991 l 9.59427,-19.25148 45.683997,-91.6646 18.10738,-36.33287 z"
|
||||
id="path34"
|
||||
inkscape:connector-curvature="0" /><g
|
||||
id="g42"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)"><path
|
||||
style="fill:#9178b7;fill-opacity:1"
|
||||
d="M 76.667,438.689 C 54.839,417.258 36.825,391.94 23.764,363.864 v -0.01 l 11.139,-22.329 z"
|
||||
id="path38"
|
||||
inkscape:connector-curvature="0" /><polygon
|
||||
style="fill:#9178b7;fill-opacity:1"
|
||||
points="170.839,428.138 152.074,384.51 87.885,235.211 108.888,193.068 237.301,321.481 286.379,370.559 "
|
||||
id="polygon40" /></g><path
|
||||
style="fill:#f9f9f9;stroke-width:0.8621738"
|
||||
d="M 268.15494,353.91226 126.94639,212.70371 c -6.84393,-6.84395 -6.84393,-17.93926 0,-24.78319 v 0 c 6.84394,-6.84394 17.93925,-6.84394 24.78318,0 l 141.2077,141.20769 c 6.84394,6.84393 6.84394,17.93925 0,24.78318 v 0 c -6.84308,6.84394 -17.93925,6.84394 -24.78233,8.7e-4 z"
|
||||
id="path46"
|
||||
inkscape:connector-curvature="0" /><circle
|
||||
style="fill:#f9f9f9;stroke-width:0.8621738"
|
||||
cx="176.15497"
|
||||
cy="142.5831"
|
||||
r="6.0602198"
|
||||
id="circle50" /><circle
|
||||
style="fill:#9178b7;fill-opacity:1;stroke-width:0.8621738"
|
||||
cx="257.1355"
|
||||
cy="119.44839"
|
||||
r="6.0602198"
|
||||
id="circle52" /><circle
|
||||
style="fill:#34abe0;stroke-width:0.8621738"
|
||||
cx="356.29495"
|
||||
cy="137.62819"
|
||||
r="6.0602198"
|
||||
id="circle54" /><g
|
||||
id="g60"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)"><circle
|
||||
style="fill:#f9f9f9"
|
||||
cx="372.328"
|
||||
cy="323.53201"
|
||||
r="7.0289998"
|
||||
id="circle56" /><path
|
||||
style="fill:#f9f9f9"
|
||||
d="m 254.9,10.029 8.735,7.769 c 0.739,0.657 1.753,0.909 2.714,0.673 L 277.7,15.68 c 2.418,-0.595 4.468,1.841 3.469,4.122 l -4.69,10.708 c -0.397,0.906 -0.322,1.949 0.199,2.789 l 6.163,9.934 c 1.312,2.116 -0.371,4.818 -2.848,4.574 L 268.36,46.656 c -0.984,-0.097 -1.953,0.296 -2.59,1.051 l -7.543,8.931 c -1.607,1.902 -4.697,1.136 -5.23,-1.296 l -2.5,-11.42 c -0.211,-0.965 -0.885,-1.766 -1.8,-2.139 l -10.824,-4.415 c -2.305,-0.94 -2.532,-4.116 -0.383,-5.374 l 10.088,-5.907 c 0.854,-0.499 1.406,-1.387 1.479,-2.373 l 0.854,-11.659 c 0.178,-2.483 3.128,-3.681 4.989,-2.026 z"
|
||||
id="path58"
|
||||
inkscape:connector-curvature="0" /></g><path
|
||||
style="fill:#9178b7;fill-opacity:1;stroke-width:0.8621738"
|
||||
d="m 454.29051,92.257154 5.2722,11.110836 c 0.44574,0.93977 1.32516,1.60019 2.35201,1.76486 l 12.14113,1.95542 c 2.58566,0.41643 3.57199,3.61768 1.66831,5.41703 l -8.93729,8.44672 c -0.75613,0.71474 -1.11134,1.75453 -0.95184,2.7831 l 1.89161,12.15148 c 0.40263,2.58824 -2.3365,4.51434 -4.63592,3.25987 l -10.79527,-5.89036 c -0.91391,-0.49834 -2.01232,-0.51559 -2.94088,-0.0448 l -10.97202,5.55411 c -2.33649,1.18291 -5.01613,-0.82682 -4.53331,-3.40213 l 2.26579,-12.08682 c 0.19226,-1.02253 -0.13278,-2.07352 -0.86562,-2.81069 l -8.67261,-8.71916 c -1.84677,-1.85712 -0.76303,-5.02561 1.83384,-5.36272 l 12.19545,-1.58036 c 1.03117,-0.13364 1.93127,-0.76648 2.40633,-1.69159 l 5.61276,-10.941845 c 1.19323,-2.331318 4.54279,-2.278727 5.66533,0.08708 z"
|
||||
id="path62"
|
||||
inkscape:connector-curvature="0" /><g
|
||||
id="g64"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)" /><g
|
||||
id="g66"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)" /><g
|
||||
id="g68"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)" /><g
|
||||
id="g70"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)" /><g
|
||||
id="g72"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)" /><g
|
||||
id="g74"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)" /><g
|
||||
id="g76"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)" /><g
|
||||
id="g78"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)" /><g
|
||||
id="g80"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)" /><g
|
||||
id="g82"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)" /><g
|
||||
id="g84"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)" /><g
|
||||
id="g86"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)" /><g
|
||||
id="g88"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)" /><g
|
||||
id="g90"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)" /><g
|
||||
id="g92"
|
||||
transform="matrix(0.86217384,0,0,0.86217384,35.283516,32.215367)" /></svg>
|
After Width: | Height: | Size: 12 KiB |
@ -0,0 +1,582 @@
|
||||
/* Default Stylings */
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.cau_spacing {
|
||||
height: 25px;
|
||||
}
|
||||
.cau_support_buttons {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* Welcome screen */
|
||||
.welcome-to-cau {
|
||||
background: #FFF;
|
||||
border: 1px solid #CCD0D4;
|
||||
margin: 25px 0;
|
||||
padding: 30px;
|
||||
background-size: 140px;
|
||||
background-position: left bottom;
|
||||
background-repeat: no-repeat;
|
||||
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
||||
}
|
||||
.welcome-to-cau .welcome-image {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-image: url('images/welcome.svg');
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.welcome-to-cau .welcome-content {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: calc(100% - 100px);
|
||||
padding-left: 25px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.welcome-to-cau .welcome-content strong {
|
||||
color: #000;
|
||||
}
|
||||
.welcome-to-cau .welcome-content p {
|
||||
margin: 2px 0;
|
||||
}
|
||||
.welcome-to-cau.help-bg {
|
||||
background-image: url('images/help.svg');
|
||||
}
|
||||
.welcome-to-cau.support-bg {
|
||||
background-image: url('images/support.svg');
|
||||
}
|
||||
.welcome-to-cau.love-bg {
|
||||
background-image: url('images/love.svg');
|
||||
}
|
||||
.welcome-to-cau.update-bg {
|
||||
background-image: url('images/update.svg');
|
||||
}
|
||||
.welcome-to-cau.email-bg {
|
||||
background-image: url('images/email.svg');
|
||||
}
|
||||
.welcome-to-cau.interval-bg {
|
||||
background-image: url('images/interval.svg');
|
||||
}
|
||||
.welcome-to-cau.advanced-bg {
|
||||
background-image: url('images/settings.svg');
|
||||
}
|
||||
.welcome-to-cau h2 {
|
||||
margin: 0;
|
||||
margin-bottom: 25px;
|
||||
font-size: 21px;
|
||||
font-weight: 400;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.welcome-to-cau h2.title {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.welcome-to-cau h3 {
|
||||
font-size: 16px;
|
||||
margin-top: 0;
|
||||
}
|
||||
.welcome-to-cau a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.welcome-to-cau .welcome-column {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.welcome-to-cau.cau-show-love .welcome-column {
|
||||
vertical-align: middle;
|
||||
}
|
||||
.welcome-to-cau .welcome-column.welcome-column-first {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
.first-column {
|
||||
padding-left: 140px;
|
||||
}
|
||||
.welcome-to-cau .welcome-column.welcome-column-half {
|
||||
width: 50%;
|
||||
}
|
||||
.welcome-to-cau .welcome-column.welcome-column-third {
|
||||
width: 33%;
|
||||
}
|
||||
.welcome-to-cau .welcome-column.welcome-column-quarter {
|
||||
width: 25%;
|
||||
}
|
||||
.welcome-to-cau a.minimal-button {
|
||||
display: inline-block;
|
||||
padding: 5px;
|
||||
}
|
||||
select.schedule_interval {
|
||||
max-width: 90%;
|
||||
width: 225px;
|
||||
}
|
||||
.cau_save_button.fixed_button {
|
||||
background: #FFF;
|
||||
box-sizing: border-box;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
margin-left: -25px;
|
||||
z-index: 1001;
|
||||
padding: 5px;
|
||||
box-shadow: 0 -8px 16px 0 rgb(85 93 102 / 30%);
|
||||
}
|
||||
.cau_save_button.fixed_button p.submit {
|
||||
display: block;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.cau_save_button.fixed_button p.submit input {
|
||||
width: 100%;
|
||||
max-width: 250px;
|
||||
height: 100%;
|
||||
padding: 5px;
|
||||
}
|
||||
.cau_save_button__space {
|
||||
height: 75px;
|
||||
}
|
||||
|
||||
/* Overwrite core UI */
|
||||
/*.cau_content input[type="checkbox"]:checked::before {
|
||||
content: "";
|
||||
background: url( 'images/check.svg' );
|
||||
background-size: contain;
|
||||
background-position: center center;
|
||||
}*/
|
||||
.cau_content a {
|
||||
color: #9178B7;
|
||||
}
|
||||
.cau_content a.nav-tab {
|
||||
color: #23282D;
|
||||
}
|
||||
.cau_content .button-primary {
|
||||
background-color: #9178B7!important;
|
||||
border-color: #9178B7!important;
|
||||
}
|
||||
.cau_content .button-alt {
|
||||
color: #9178B7!important;
|
||||
border-color: #9178B7!important;
|
||||
}
|
||||
.cau_content .button-hero {
|
||||
font-weight: 500;
|
||||
padding: 2px 15px!important;
|
||||
}
|
||||
#message.cau {
|
||||
background: #FFF;
|
||||
border: 1px solid #CCD0D4;
|
||||
border-left-width: 4px;
|
||||
border-left-color: #9178B7;
|
||||
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
||||
margin: 25px 0px 5px 0;
|
||||
padding: 15px;
|
||||
}
|
||||
#message.cau a, #message.cau strong {
|
||||
color: #9178B7;
|
||||
}
|
||||
|
||||
/* Dashboard */
|
||||
.cau-column-wide {
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
width: calc(100% - 450px);
|
||||
padding-right: 25px;
|
||||
}
|
||||
.cau-column-small {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
width: 450px;
|
||||
}
|
||||
.cau-dashboard-box {
|
||||
background-position: right bottom;
|
||||
}
|
||||
.cau-column-wide .cau-dashboard-box {
|
||||
padding-right: 125px;
|
||||
}
|
||||
.cau-dashboard-box a {
|
||||
margin-left: 0px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.cau-dashboard-box .welcome-column {
|
||||
padding-right: 25px;
|
||||
}
|
||||
.support-sidebar-list {
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
.cau_content .nav-tab {
|
||||
position: relative;
|
||||
}
|
||||
.cau_content .nav-tab .cau_melding {
|
||||
display: inline-block;
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
border-radius: 10px;
|
||||
margin-left: 5px;
|
||||
position: relative;
|
||||
bottom: -1px;
|
||||
}
|
||||
.cau_content .nav-tab .cau_melding.level-okay {
|
||||
background: #7AD03A;
|
||||
}
|
||||
.cau_content .nav-tab .cau_melding.level-low {
|
||||
background: #FFBA00;
|
||||
}
|
||||
.cau_content .nav-tab .cau_melding.level-high {
|
||||
background: #FF0000;
|
||||
}
|
||||
|
||||
/* Table Styling */
|
||||
.cau_content .widefat td {
|
||||
vertical-align: middle!important;
|
||||
}
|
||||
table.autoupdate th.head-plugin {
|
||||
min-width: 250px;
|
||||
}
|
||||
table.autoupdate th.head-status {
|
||||
min-width: 150px;
|
||||
}
|
||||
table.autoupdate th.check-column {
|
||||
position: relative;
|
||||
min-width: 55px;
|
||||
}
|
||||
table.autoupdate tr.inactive {
|
||||
background: #FEF7F1;
|
||||
}
|
||||
table.autoupdate tr.active .check-column {
|
||||
border-left: 3px solid transparent;
|
||||
}
|
||||
table.autoupdate tr.inactive .check-column {
|
||||
border-left: 3px solid #D54E21;
|
||||
}
|
||||
table.autoupdate tr.inactive td.column-status p {
|
||||
color: #BF3D3C;
|
||||
}
|
||||
table.autoupdate tr.active td.column-status p {
|
||||
color: #000;
|
||||
}
|
||||
table.autoupdate tr td.column-description p {
|
||||
overflow: hidden;
|
||||
max-height: 18px;
|
||||
}
|
||||
|
||||
/* Update Log */
|
||||
table.autoupdatelog {
|
||||
margin-top: 25px;
|
||||
}
|
||||
table.autoupdatelog strong {
|
||||
color: #000;
|
||||
}
|
||||
table.autoupdatelog .dashicons {
|
||||
color: #00A0D2;
|
||||
}
|
||||
|
||||
/* Status */
|
||||
table.cau_status_list {
|
||||
margin-top: 25px;
|
||||
}
|
||||
table.cau_status_list:not(.no_column_width) th, table.cau_status_list:not(.no_column_width) td {
|
||||
width: 25%;
|
||||
}
|
||||
.cau_enabled {
|
||||
color: #7AD03A;
|
||||
}
|
||||
.cau_disabled {
|
||||
color: #FF0000;
|
||||
}
|
||||
.cau_warning {
|
||||
color: #FFBA00;
|
||||
}
|
||||
.cau_mobile_prefix {
|
||||
display: none;
|
||||
}
|
||||
table.cau_status_list .cau_status_icon {
|
||||
width: 50px!important;
|
||||
}
|
||||
table.cau_status_list .cau_status_icon .dashicons, table.cau_status_list .cau_status_icon .dashicons-before:before {
|
||||
height: 25px;
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
/* Rollback list */
|
||||
table.rollbacklist {
|
||||
max-width: 650px;
|
||||
}
|
||||
table.rollbacklist td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
table.rollbacklist td a.versionselectbutton {
|
||||
display: inline-block;
|
||||
width: 100px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Plugin list */
|
||||
.pluginListButtons {
|
||||
display: block;
|
||||
padding: 15px 0;
|
||||
}
|
||||
.pluginListButtons p.submit {
|
||||
display: inline-block;
|
||||
margin: 0!important;
|
||||
padding: 0!important;
|
||||
}
|
||||
.cau_content #the-list input[type="checkbox"]:not(:checked), .cau_content #the-list input[type="checkbox"]:checked {
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 100;
|
||||
display: block;
|
||||
opacity: 0;
|
||||
}
|
||||
.cau_content #the-list input[type="checkbox"]:not(:checked) + label, .cau_content #the-list input[type="checkbox"]:checked + label {
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
left: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.cau_content #the-list input[type="checkbox"]:not(:checked) + label:before, .cau_content #the-list input[type="checkbox"]:checked + label:before, .cau_content #the-list input[type="checkbox"]:not(:checked) + label:after, .cau_content #the-list input[type="checkbox"]:checked + label:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
}
|
||||
.cau_content #the-list input[type="checkbox"]:not(:checked) + label:before, .cau_content #the-list input[type="checkbox"]:checked + label:before {
|
||||
left: 0;
|
||||
top: -3px;
|
||||
width: 30px;
|
||||
height: 16px;
|
||||
background: transparent;
|
||||
border: 2px solid #9178B7;
|
||||
border-radius: 15px;
|
||||
transition: background-color .2s;
|
||||
}
|
||||
.cau_content #the-list input[type="checkbox"]:not(:checked) + label:after, .cau_content #the-list input[type="checkbox"]:checked + label:after {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
transition: all .2s;
|
||||
border-radius: 500px;
|
||||
background: transparent;
|
||||
border: 2px solid #9178B7;
|
||||
top: 1px;
|
||||
left: 5px;
|
||||
}
|
||||
.cau_content #the-list input[type="checkbox"]:not(:checked) + label:before {
|
||||
background: #9178B7;
|
||||
border: 2px solid #9178B7;
|
||||
}
|
||||
.cau_content #the-list input[type="checkbox"]:not(:checked) + label:after {
|
||||
background: #9178B7;
|
||||
border-color: #FFF;
|
||||
left: 18px;
|
||||
}
|
||||
|
||||
/* Scheduling */
|
||||
.cau_schedule_input {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 50px;
|
||||
padding-top: 5px;
|
||||
}
|
||||
.cau_schedule_input input {
|
||||
max-width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
.cau_schedule_input_div {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
padding: 0 6px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.cau_shedule_notation {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 125px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
.cau_shedule_notation .dashicons {
|
||||
position: relative;
|
||||
bottom: -5px;
|
||||
}
|
||||
|
||||
/* Tooltip */
|
||||
.cau_tooltip {
|
||||
position: relative;
|
||||
}
|
||||
.cau_tooltip .cau_tooltip_text {
|
||||
visibility: hidden;
|
||||
background-color: rgba(0,0,0,0.7);
|
||||
color: #FFF;
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
padding: 15px;
|
||||
border-radius: 6px;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
width: 240px;
|
||||
bottom: 100%;
|
||||
left: 50%;
|
||||
margin-left: -60px;
|
||||
margin-bottom: 10px;
|
||||
opacity: 0;
|
||||
transition: .3s;
|
||||
font-weight: normal;
|
||||
}
|
||||
.cau_tooltip:hover .cau_tooltip_text {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
}
|
||||
.cau_tooltip .cau_tooltip_text::after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 50%;
|
||||
margin-left: -75px;
|
||||
border-width: 5px;
|
||||
border-style: solid;
|
||||
border-color: rgba(0,0,0,0.7) transparent transparent transparent;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media screen and (max-width: 1400px) {
|
||||
|
||||
.cau-column-wide {
|
||||
width: calc(100% - 350px);
|
||||
}
|
||||
.cau-column-small {
|
||||
width: 350px;
|
||||
}
|
||||
.welcome-to-cau .welcome-column.welcome-column-quarter {
|
||||
width: 50%;
|
||||
padding-bottom: 35px;
|
||||
}
|
||||
.cau-column-small .welcome-to-cau {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
}
|
||||
@media screen and (max-width: 1150px) {
|
||||
|
||||
.cau-column-wide, .cau-column-small {
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
}
|
||||
@media screen and (max-width: 1000px) {
|
||||
|
||||
/* Basics */
|
||||
.cau_hide_on_mobile, table.autoupdate thead {
|
||||
display: none!important;
|
||||
}
|
||||
.form-table td fieldset p {
|
||||
display: block;
|
||||
padding: 5px 0;
|
||||
}
|
||||
.form-table td fieldset input[type="checkbox"] {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 25px;
|
||||
}
|
||||
.form-table td fieldset label {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: calc(100% - 40px);
|
||||
box-sizing: border-box;
|
||||
padding-left: 5px;
|
||||
}
|
||||
.cau_content .nav-tab-wrapper {
|
||||
position: relative;
|
||||
top: -20px;
|
||||
border-bottom: 1px solid #CCC!important;
|
||||
padding-bottom: 15px!important;
|
||||
margin-bottom: 0px!important;
|
||||
}
|
||||
.cau_content .nav-tab {
|
||||
font-size: 12px;
|
||||
margin: 5px 5px 0 0!important;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Scheduling */
|
||||
.cau_schedule_input {
|
||||
width: 75px;
|
||||
}
|
||||
|
||||
/* Custom buttons */
|
||||
.cau-button {
|
||||
display: block;
|
||||
text-align: center;
|
||||
margin: 5px 0;
|
||||
}
|
||||
.cau-button .dashicons {
|
||||
float: left;
|
||||
}
|
||||
|
||||
/* Dashboard */
|
||||
.welcome-to-cau {
|
||||
background-position: right bottom;
|
||||
}
|
||||
.welcome-to-cau.love-bg {
|
||||
background-image: none;
|
||||
}
|
||||
.welcome-to-cau .welcome-column {
|
||||
min-width: 100%;
|
||||
}
|
||||
.welcome-to-cau .welcome-column.welcome-column-first {
|
||||
padding-left: 0px;
|
||||
}
|
||||
.cau-column-wide .cau-dashboard-box {
|
||||
padding-right: 30px;
|
||||
padding-bottom: 125px
|
||||
}
|
||||
.majorMinorExplain {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Status */
|
||||
table.cau_status_list .cau_status_name {
|
||||
display: inline-block;
|
||||
width: 50%;
|
||||
box-sizing: border-box;
|
||||
font-weight: 500;
|
||||
}
|
||||
table.cau_status_list .cau_status_interval {
|
||||
display: none;
|
||||
}
|
||||
table.cau_status_list th.cau_status_next {
|
||||
display: none;
|
||||
}
|
||||
table.cau_status_list td.cau_status_next {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
table.cau_status_list .cau_status_active_state {
|
||||
display: inline-block;
|
||||
width: 50%;
|
||||
box-sizing: border-box;
|
||||
text-align: right;
|
||||
}
|
||||
.cau_mobile_prefix {
|
||||
display: inline-block;
|
||||
padding-right: 5px;
|
||||
}
|
||||
table.cau_status_list.cau_status_warnings td {
|
||||
display: block;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
table.cau_status_list.cau_status_warnings th.cau_plugin_issue_explain, table.cau_status_list.cau_status_warnings th.cau_plugin_issue_fixit {
|
||||
display: none;
|
||||
}
|
||||
table.cau_status_list.cau_status_warnings td.cau_plugin_issue_name {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
#wpadminbar #wp-admin-bar-cau-has-issues .ab-icon:before {
|
||||
/*content: "\f463";*/
|
||||
content: "\f332";
|
||||
top: 3px;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-cau-has-issues .cau-level-low {
|
||||
/*color: #FFBA00;*/
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-cau-has-issues .cau-level-high {
|
||||
color: #FF0000;
|
||||
}
|
@ -0,0 +1,526 @@
|
||||
<?php
|
||||
|
||||
// Check if emails should be send or not
|
||||
function cau_check_updates_mail() {
|
||||
|
||||
// Notify of pending updates
|
||||
if( cau_get_db_value( 'send' ) == 'on' ) {
|
||||
cau_list_theme_updates(); // Check for theme updates
|
||||
cau_list_plugin_updates(); // Check for plugin updates
|
||||
}
|
||||
|
||||
// Notify of completed updates
|
||||
if( cau_get_db_value( 'sendupdate' ) == 'on' && cau_get_db_value( 'plugins' ) == 'on' ) {
|
||||
cau_plugin_updated(); // Check for updated plugins
|
||||
}
|
||||
|
||||
// Notify of required db update
|
||||
if( cau_get_db_value( 'dbupdateemails' ) == 'on' ) {
|
||||
cau_notify_outofdate_db();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Notify of out of date software
|
||||
function cau_outdated_notifier_mail() {
|
||||
if( cau_get_db_value( 'sendoutdated' ) == 'on' ) {
|
||||
cau_list_outdated_software(); // Check for oudated plugins
|
||||
}
|
||||
}
|
||||
|
||||
// Ge the emailadresses it should be send to
|
||||
function cau_set_email() {
|
||||
|
||||
$emailArray = array();
|
||||
|
||||
if( cau_get_db_value( 'email' ) == '' ) {
|
||||
array_push( $emailArray, get_option('admin_email') );
|
||||
} else {
|
||||
$emailAdresses = cau_get_db_value( 'email' );
|
||||
$list = explode( ", ", $emailAdresses );
|
||||
foreach ( $list as $key ) {
|
||||
array_push( $emailArray, $list );
|
||||
}
|
||||
}
|
||||
|
||||
return $emailArray;
|
||||
|
||||
}
|
||||
|
||||
// Mail format
|
||||
function cau_is_html() {
|
||||
if ( !function_exists( 'cau_get_db_value' ) ) require_once( plugin_dir_path( __FILE__ ) . 'cau_function.php' );
|
||||
return ( cau_get_db_value( 'html_or_text' ) == 'html' ) ? true : false;
|
||||
}
|
||||
|
||||
// Set the content for the emails about pending updates
|
||||
function cau_outdated_message( $single, $plural, $list ) {
|
||||
|
||||
// WP version
|
||||
$wpversion = get_bloginfo( 'version' );
|
||||
|
||||
// Base text
|
||||
$text = sprintf( esc_html__( "You have %s on your WordPress site at %s that have not been tested with the latest 3 major releases of WordPress.", "companion-auto-update" ), $plural, get_site_url() );
|
||||
$text .= "\n";
|
||||
$text .= "\n";
|
||||
|
||||
// The list
|
||||
if( !empty( $list ) ) {
|
||||
|
||||
$text .= sprintf( esc_html__( "The following %s have not been tested with WordPress %s:", "companion-auto-update" ), $plural, $wpversion );
|
||||
$text .= "\n";
|
||||
$text .= "\n";
|
||||
|
||||
foreach ( $list as $plugin => $version ) {
|
||||
if( $version == '' ) $version = __( "Unknown", "companion-auto-update" );
|
||||
$text .= "- ".sprintf( esc_html__( "%s tested up to: %s", "companion-auto-update" ), $plugin, $version )."\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
// Set the content for the emails about pending updates
|
||||
function cau_pending_message( $single, $plural, $list ) {
|
||||
|
||||
// What markup to use
|
||||
if( cau_is_html() ) $break = '<br />';
|
||||
else $break = "\n";
|
||||
|
||||
// Base text
|
||||
$text = sprintf( esc_html__( 'You have pending %1$s updates on your WordPress site at %2$s.', 'companion-auto-update' ), $single, get_site_url() );
|
||||
$text .= $break;
|
||||
|
||||
if( !empty( $list ) ) {
|
||||
|
||||
$text .= $break;
|
||||
$text .= sprintf( esc_html__( 'The following %1$s have new versions available.', 'companion-auto-update' ), $plural );
|
||||
$text .= $break;
|
||||
|
||||
if( cau_is_html() ) $text .= "<ol>";
|
||||
foreach ( $list as $key => $value ) {
|
||||
if( cau_is_html() ) {
|
||||
$text .= "<li>$value</li>";
|
||||
} else {
|
||||
$text .= "-$value\n";
|
||||
}
|
||||
}
|
||||
if( cau_is_html() ) $text .= "</ol>";
|
||||
|
||||
$text .= $break;
|
||||
}
|
||||
|
||||
$text .= __( 'Leaving your site outdated is a security risk so please consider manually updating them.', 'companion-auto-update' );
|
||||
$text .= $break;
|
||||
|
||||
// End
|
||||
$text .= sprintf( esc_html__( 'Head over to %1$s and check the ones you want to update.', 'companion-auto-update' ), get_admin_url().'update-core.php' );
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
// Set the content for the emails about recent updates
|
||||
function cau_updated_message( $type, $updatedList ) {
|
||||
|
||||
// What markup to use
|
||||
if( cau_is_html() ) $break = '<br />';
|
||||
else $break = "\n";
|
||||
|
||||
// The message
|
||||
$text = sprintf( esc_html__(
|
||||
'One or more %1$s on your WordPress site at %2$s have been updated by Companion Auto Update. No further action is needed on your part.
|
||||
For more info on what is new visit your dashboard and check the changelog.', 'companion-auto-update'
|
||||
), $type, get_site_url() );
|
||||
|
||||
$text .= $break;
|
||||
$text .= $break;
|
||||
$text .= sprintf( esc_html__(
|
||||
'The following %1$s have been updated:', 'companion-auto-update'
|
||||
), $type );
|
||||
|
||||
$text .= $break;
|
||||
$text .= $updatedList;
|
||||
|
||||
$text .= $break;
|
||||
$text .= __( "(You'll also receive this email if you manually updated a plugin or theme)", "companion-auto-update" );
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
// Checks if plugins are out of date
|
||||
function cau_list_outdated_software() {
|
||||
|
||||
// Check if cau_get_db_value() function exists.
|
||||
if ( !function_exists( 'cau_get_db_value' ) ) require_once( plugin_dir_path( __FILE__ ) . 'cau_function.php' );
|
||||
|
||||
// Set up mail
|
||||
$subject = '['.get_bloginfo( 'name' ).'] ' . __( 'You have outdated plugins on your site.', 'companion-auto-update' );
|
||||
$type = __( 'plugin', 'companion-auto-update' );
|
||||
$type_plural = __( 'plugins', 'companion-auto-update' );
|
||||
$message = cau_outdated_message( $type, $type_plural, cau_list_outdated() );
|
||||
|
||||
// Send to all addresses
|
||||
foreach ( cau_set_email() as $key => $value ) {
|
||||
foreach ( $value as $k => $v ) {
|
||||
wp_mail( $v, $subject, $message );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Checks if theme updates are available
|
||||
function cau_list_theme_updates() {
|
||||
|
||||
global $wpdb;
|
||||
$table_name = $wpdb->prefix . "auto_updates";
|
||||
|
||||
$configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'themes'");
|
||||
foreach ( $configs as $config ) {
|
||||
|
||||
if( $config->onoroff != 'on' ) {
|
||||
|
||||
// Check for required files
|
||||
if ( !function_exists( 'get_theme_updates' ) ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/update.php';
|
||||
}
|
||||
|
||||
// Begin
|
||||
$themes = get_theme_updates();
|
||||
$list = array();
|
||||
|
||||
if ( !empty( $themes ) ) {
|
||||
|
||||
foreach ( $themes as $stylesheet => $theme ) {
|
||||
array_push( $list, $theme->get( 'Name' ) );
|
||||
}
|
||||
|
||||
$subject = '[' . get_bloginfo( 'name' ) . '] ' . __( 'Theme update available.', 'companion-auto-update' );
|
||||
$type = __('theme', 'companion-auto-update');
|
||||
$type_plural = __('themes', 'companion-auto-update');
|
||||
$message = cau_pending_message( $type, $type_plural, $list );
|
||||
|
||||
foreach ( cau_set_email() as $key => $value) {
|
||||
foreach ($value as $k => $v) {
|
||||
wp_mail( $v, $subject, $message );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Checks if plugin updates are available
|
||||
function cau_list_plugin_updates() {
|
||||
|
||||
global $wpdb;
|
||||
$table_name = $wpdb->prefix . "auto_updates";
|
||||
|
||||
$configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'plugins'");
|
||||
foreach ( $configs as $config ) {
|
||||
|
||||
if( $config->onoroff != 'on' ) {
|
||||
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
|
||||
|
||||
// Make sure get_plugin_updates() and get_plugins() are defined
|
||||
if ( !function_exists( 'get_plugin_updates' ) OR !function_exists( 'get_plugins' ) ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/update.php';
|
||||
}
|
||||
|
||||
// Begin
|
||||
$plugins = get_plugin_updates();
|
||||
|
||||
if ( !empty( $plugins ) ) {
|
||||
|
||||
$list = array();
|
||||
foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
|
||||
$plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true );
|
||||
$name = $plugin_data->Name;
|
||||
array_push( $list, $name );
|
||||
}
|
||||
|
||||
$subject = '[' . get_bloginfo( 'name' ) . '] ' . __( 'Plugin update available.', 'companion-auto-update' );
|
||||
$type = __( 'plugin', 'companion-auto-update' );
|
||||
$type_plural = __( 'plugins', 'companion-auto-update' );
|
||||
$message = cau_pending_message( $type, $type_plural, $list );
|
||||
|
||||
foreach ( cau_set_email() as $key => $value) {
|
||||
foreach ($value as $k => $v) {
|
||||
wp_mail( $v, $subject, $message );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Alerts when plugin has been updated
|
||||
function cau_plugin_updated() {
|
||||
|
||||
// Check if cau_get_db_value() function exists.
|
||||
if ( !function_exists( 'cau_get_db_value' ) ) require_once( plugin_dir_path( __FILE__ ) . 'cau_function.php' );
|
||||
|
||||
// Set the correct timezone for emails
|
||||
date_default_timezone_set( cau_get_proper_timezone() );
|
||||
|
||||
// Create arrays
|
||||
$pluginNames = array();
|
||||
$pluginDates = array();
|
||||
$pluginVersion = array();
|
||||
$pluginSlug = array();
|
||||
$pluginTimes = array();
|
||||
$themeNames = array();
|
||||
$themeDates = array();
|
||||
$themeTimes = array();
|
||||
|
||||
// Where to look for plugins
|
||||
$plugdir = plugin_dir_path( __DIR__ );
|
||||
if ( !function_exists( 'get_plugins' ) ) require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Check if get_plugins() function exists.
|
||||
$allPlugins = get_plugins();
|
||||
|
||||
// Where to look for themes
|
||||
$themedir = get_theme_root();
|
||||
$allThemes = wp_get_themes();
|
||||
|
||||
// Mail schedule
|
||||
$schedule_mail = wp_get_schedule( 'cau_set_schedule_mail' );
|
||||
|
||||
// Loop trough all plugins
|
||||
foreach ( $allPlugins as $key => $value ) {
|
||||
|
||||
// Get plugin data
|
||||
$fullPath = $plugdir.'/'.$key;
|
||||
$getFile = $path_parts = pathinfo( $fullPath );
|
||||
$pluginData = get_plugin_data( $fullPath );
|
||||
|
||||
// Get the slug
|
||||
$explosion = explode( '/', $key );
|
||||
$actualSlug = array_shift( $explosion );
|
||||
|
||||
// Get last update date
|
||||
$fileDate = date ( 'YmdHi', filemtime( $fullPath ) );
|
||||
|
||||
switch ( $schedule_mail ) {
|
||||
case 'hourly':
|
||||
$lastday = date( 'YmdHi', strtotime( '-1 hour', time() ) );
|
||||
break;
|
||||
case 'twicedaily':
|
||||
$lastday = date( 'YmdHi', strtotime( '-12 hours', time() ) );
|
||||
break;
|
||||
default:
|
||||
$lastday = date( 'YmdHi', strtotime( '-1 day', time() ) );
|
||||
break;
|
||||
}
|
||||
|
||||
$dateFormat = get_option( 'date_format' );
|
||||
$timestamp = date_i18n( $dateFormat, filemtime( $fullPath ) );
|
||||
$timestamp .= ' - '.date( 'H:i', filemtime( $fullPath ) );
|
||||
|
||||
if( $fileDate >= $lastday ) {
|
||||
|
||||
// Get plugin name
|
||||
foreach ( $pluginData as $dataKey => $dataValue ) {
|
||||
if( $dataKey == 'Name') {
|
||||
array_push( $pluginNames , $dataValue );
|
||||
}
|
||||
if( $dataKey == 'Version') {
|
||||
array_push( $pluginVersion , $dataValue );
|
||||
}
|
||||
}
|
||||
|
||||
array_push( $pluginDates, $fileDate );
|
||||
array_push( $pluginSlug, $actualSlug );
|
||||
array_push( $pluginTimes, $timestamp );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Loop trough all themes
|
||||
foreach ( $allThemes as $key => $value ) {
|
||||
|
||||
// Get theme data
|
||||
$fullPath = $themedir.'/'.$key;
|
||||
$getFile = $path_parts = pathinfo( $fullPath );
|
||||
|
||||
// Get last update date
|
||||
$dateFormat = get_option( 'date_format' );
|
||||
$fileDate = date ( 'YmdHi', filemtime( $fullPath ) );
|
||||
|
||||
if( $schedule_mail == 'hourly' ) {
|
||||
$lastday = date( 'YmdHi', strtotime( '-1 hour', time() ) );
|
||||
} elseif( $schedule_mail == 'twicedaily' ) {
|
||||
$lastday = date( 'YmdHi', strtotime( '-12 hours', time() ) );
|
||||
} elseif( $schedule_mail == 'daily' ) {
|
||||
$lastday = date( 'YmdHi', strtotime( '-1 day', time() ) );
|
||||
}
|
||||
|
||||
$dateFormat = get_option( 'date_format' );
|
||||
$timestamp = date_i18n( $dateFormat, filemtime( $fullPath ) );
|
||||
$timestamp .= ' - '.date( 'H:i', filemtime( $fullPath ) );
|
||||
|
||||
if( $fileDate >= $lastday ) {
|
||||
array_push( $themeNames, $path_parts['filename'] );
|
||||
array_push( $themeDates, $fileDate );
|
||||
array_push( $themeTimes, $timestamp );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$totalNumP = 0;
|
||||
$totalNumT = 0;
|
||||
$updatedListP = '';
|
||||
$updatedListT = '';
|
||||
|
||||
if( cau_get_db_value( 'html_or_text' ) == 'html' ) {
|
||||
$updatedListP .= '<ol>';
|
||||
$updatedListT .= '<ol>';
|
||||
}
|
||||
|
||||
foreach ( $pluginDates as $key => $value ) {
|
||||
|
||||
// Set up some var
|
||||
$plugin_name = $pluginNames[$key];
|
||||
$plugin_slug = $pluginSlug[$key];
|
||||
$to_version = __( "to version", "companion-auto-update" ).' '.$pluginVersion[$key];
|
||||
$more_info_arr = array( __( "Time of update", "companion-auto-update" ) => $pluginTimes[$key] );
|
||||
|
||||
// Plugin links
|
||||
if( cau_get_db_value( 'plugin_links_emails' ) == 'on' ) {
|
||||
$more_info_arr[__( "Plugin details", "companion-auto-update" )] = "<a href='https://wordpress.org/plugins/{$plugin_slug}/'>".__( "Visit", "companion-auto-update" )."</a>";
|
||||
$more_info_arr[__( "Release notes", "companion-auto-update" )] = "<a href='https://wordpress.org/plugins/{$plugin_slug}/#developers'>".__( "Visit", "companion-auto-update" )."</a>";
|
||||
$more_info_arr[__( "Support", "companion-auto-update" )] = "<a href='https://wordpress.org/support/plugin/{$plugin_slug}/'>".__( "Visit", "companion-auto-update" )."</a>";
|
||||
}
|
||||
|
||||
// Email format
|
||||
$use_html = ( cau_get_db_value( 'html_or_text' ) == 'html' ) ? true : false;
|
||||
|
||||
// Email content
|
||||
$updatedListP .= $use_html ? "<li>" : "-"; // Start row
|
||||
|
||||
$updatedListP .= $use_html ? "<strong>{$plugin_name}</strong> " : "{$plugin_name} "; // Show plugin name
|
||||
$updatedListP .= $to_version; // To version
|
||||
|
||||
// Get advanced info
|
||||
if( cau_get_db_value( 'advanced_info_emails' ) == 'on' ) {
|
||||
foreach( $more_info_arr as $label => $value ) {
|
||||
$updatedListP .= $use_html ? "<br />{$label}: {$value}" : "\n{$label}: {$value}";
|
||||
}
|
||||
}
|
||||
|
||||
$updatedListP .= $use_html ? "</li>" : "\n"; // End row
|
||||
|
||||
$totalNumP++;
|
||||
}
|
||||
|
||||
foreach ( $themeNames as $key => $value ) {
|
||||
|
||||
if( cau_get_db_value( 'html_or_text' ) == 'html' ) {
|
||||
|
||||
$more_info = '';
|
||||
if( cau_get_db_value( 'advanced_info_emails' ) == 'on' ) $more_info = "<br /><span style='opacity: 0.5;'>".__( "Time of update", "companion-auto-update" ).": ".$themeTimes[$key]."</span>";
|
||||
$updatedListT .= "<li><strong>".$themeNames[$key]."</strong>".$more_info."</li>";
|
||||
|
||||
} else {
|
||||
$updatedListT .= "- ".$themeNames[$key]."\n";
|
||||
}
|
||||
|
||||
$totalNumT++;
|
||||
}
|
||||
|
||||
if( cau_get_db_value( 'html_or_text' ) == 'html' ) {
|
||||
$updatedListP .= '</ol>';
|
||||
$updatedListT .= '</ol>';
|
||||
}
|
||||
|
||||
// Set the email content type
|
||||
if( cau_get_db_value( 'html_or_text' ) == 'html' ) {
|
||||
function cau_mail_content_type() {
|
||||
return 'text/html';
|
||||
}
|
||||
add_filter( 'wp_mail_content_type', 'cau_mail_content_type' );
|
||||
}
|
||||
|
||||
// If plugins have been updated, send email
|
||||
if( $totalNumP > 0 ) {
|
||||
|
||||
// E-mail content
|
||||
$subject = '[' . get_bloginfo( 'name' ) . '] ' . __('One or more plugins have been updated.', 'companion-auto-update');
|
||||
$type = __('plugins', 'companion-auto-update');
|
||||
$message = cau_updated_message( $type, $updatedListP );
|
||||
|
||||
// Send to all addresses
|
||||
foreach ( cau_set_email() as $key => $value) {
|
||||
foreach ($value as $k => $v) {
|
||||
wp_mail( $v, $subject, $message );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// If themes have been updated, send email
|
||||
if( $totalNumT > 0 ) {
|
||||
|
||||
// E-mail content
|
||||
$subject = '[' . get_bloginfo( 'name' ) . '] ' . __('One or more themes have been updated.', 'companion-auto-update');
|
||||
$type = __('themes', 'companion-auto-update');
|
||||
$message = cau_updated_message( $type, $updatedListT );
|
||||
|
||||
// Send to all addresses
|
||||
foreach ( cau_set_email() as $key => $value) {
|
||||
foreach ($value as $k => $v) {
|
||||
wp_mail( $v, $subject, $message );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if( cau_get_db_value( 'html_or_text' ) == 'html' ) remove_filter( 'wp_mail_content_type', 'cau_mail_content_type' );
|
||||
|
||||
// Prevent duplicate emails by setting the event again
|
||||
if( $totalNumT > 0 OR $totalNumP > 0 ) {
|
||||
if( $schedule_mail == 'hourly' ) {
|
||||
wp_clear_scheduled_hook('cau_set_schedule_mail');
|
||||
wp_schedule_event( strtotime( '+1 hour', time() ) , 'hourly', 'cau_set_schedule_mail' );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cau_notify_outofdate_db() {
|
||||
|
||||
// Check if cau_get_db_value() function exists.
|
||||
if ( !function_exists( 'cau_get_db_value' ) ) require_once( plugin_dir_path( __FILE__ ) . 'cau_function.php' );
|
||||
|
||||
// Database requires an update
|
||||
if ( cau_incorrectDatabaseVersion() ) {
|
||||
|
||||
// Set up mail
|
||||
$subject = '[' . get_bloginfo( 'name' ) . '] ' . __( 'We need your help with something', 'companion-auto-update' );
|
||||
$message = __( 'Hi there! We need your help updating the database of Companion Auto Update to the latest version. No rush, old features will continue to work but some new features might not work until you update the database.', 'companion-auto-update' );
|
||||
|
||||
// Send to all addresses
|
||||
foreach ( cau_set_email() as $key => $value ) {
|
||||
foreach ( $value as $k => $v ) {
|
||||
wp_mail( $v, $subject, $message );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,420 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Plugin Name: Companion Auto Update
|
||||
* Plugin URI: http://codeermeneer.nl/portfolio/companion-auto-update/
|
||||
* Description: This plugin auto updates all plugins, all themes and the wordpress core.
|
||||
* Version: 3.9.1
|
||||
* Author: Papin Schipper
|
||||
* Author URI: http://codeermeneer.nl/
|
||||
* Contributors: papin
|
||||
* License: GPLv2 or later
|
||||
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
* Text Domain: companion-auto-update
|
||||
* Domain Path: /languages/
|
||||
*/
|
||||
|
||||
// Disable direct access
|
||||
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
||||
|
||||
// Load translations
|
||||
function cau_init() {
|
||||
load_plugin_textdomain( 'companion-auto-update', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); // Load language files (for backwards compat mostly)
|
||||
add_filter( 'plugins_auto_update_enabled', '__return_false' ); // Turn off default WP5.5 plugin update features to avoid confusion
|
||||
add_filter( 'themes_auto_update_enabled', '__return_false' ); // Turn off default WP5.5 theme update features to avoid confusion
|
||||
}
|
||||
add_action( 'init', 'cau_init' );
|
||||
|
||||
// Set up the database and required schedules
|
||||
function cau_install( $network_wide ) {
|
||||
|
||||
if ( is_multisite() && $network_wide ) {
|
||||
global $wpdb;
|
||||
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
|
||||
foreach ( $blog_ids as $blog_id ) {
|
||||
switch_to_blog( $blog_id );
|
||||
cau_database_creation();
|
||||
restore_current_blog();
|
||||
}
|
||||
} else {
|
||||
cau_database_creation();
|
||||
}
|
||||
|
||||
if (! wp_next_scheduled ( 'cau_set_schedule_mail' )) wp_schedule_event( time(), 'daily', 'cau_set_schedule_mail'); // Set schedule for basic notifcations
|
||||
if (! wp_next_scheduled ( 'cau_custom_hooks_plugins' )) wp_schedule_event( time(), 'daily', 'cau_custom_hooks_plugins'); // Run custom hooks on plugin updates
|
||||
if (! wp_next_scheduled ( 'cau_custom_hooks_themes' )) wp_schedule_event( time(), 'daily', 'cau_custom_hooks_themes'); // Run custom hooks on theme updates
|
||||
if (! wp_next_scheduled ( 'cau_log_updater' )) wp_schedule_event( ( time() - 1800 ), 'daily', 'cau_log_updater'); // Keep the log up to date
|
||||
if (! wp_next_scheduled ( 'cau_outdated_notifier' )) wp_schedule_event( time(), 'daily', 'cau_outdated_notifier'); // Set schedule for basic notifcations
|
||||
}
|
||||
|
||||
add_action( 'cau_set_schedule_mail', 'cau_check_updates_mail' );
|
||||
add_action( 'cau_outdated_notifier', 'cau_outdated_notifier_mail' );
|
||||
add_action( 'wp_update_plugins', 'cau_run_custom_hooks_p' );
|
||||
add_action( 'wp_update_themes', 'cau_run_custom_hooks_t' );
|
||||
add_action( 'wp_version_check', 'cau_run_custom_hooks_c' );
|
||||
|
||||
// Hourly event to keep the log up to date
|
||||
function cau_keep_log_uptodate() {
|
||||
cau_savePluginInformation(); // Check for new plugins and themes
|
||||
cau_check_delayed(); // Check for plugin delays
|
||||
}
|
||||
add_action( 'cau_log_updater', 'cau_keep_log_uptodate' );
|
||||
|
||||
// Redirect to welcome screen on activation of plugin
|
||||
function cau_pluginActivateWelcome() {
|
||||
add_option( 'cau_redirectToWelcomeScreen', true );
|
||||
}
|
||||
register_activation_hook(__FILE__, 'cau_pluginActivateWelcome');
|
||||
|
||||
// Redirect to welcome screen on activation of plugin
|
||||
function cau_pluginRedirectWelcomeScreen() {
|
||||
if ( get_option( 'cau_redirectToWelcomeScreen', false ) ) {
|
||||
delete_option( 'cau_redirectToWelcomeScreen' );
|
||||
if( !isset( $_GET['activate-multi'] ) ) {
|
||||
wp_redirect( admin_url( cau_menloc().'?page=cau-settings&welcome=1' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action( 'admin_init', 'cau_pluginRedirectWelcomeScreen' );
|
||||
|
||||
// Donate url
|
||||
function cau_donateUrl() {
|
||||
return 'https://www.paypal.me/dakel/10/';
|
||||
}
|
||||
|
||||
// Database version
|
||||
function cau_db_version() {
|
||||
return '3.8.3';
|
||||
}
|
||||
|
||||
function cau_database_creation() {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
// Plugin db info
|
||||
$cau_db_version = cau_db_version();
|
||||
$autoupdates = $wpdb->prefix."auto_updates";
|
||||
$updateLog = $wpdb->prefix."update_log";
|
||||
|
||||
// WordPress db info
|
||||
$charset_collate = $wpdb->get_charset_collate();
|
||||
|
||||
// DB table creation queries
|
||||
$sql = "CREATE TABLE $autoupdates ( id INT(9) NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, onoroff TEXT NOT NULL, UNIQUE KEY id (id) ) $charset_collate;";
|
||||
$sql2 = "CREATE TABLE $updateLog ( id INT(9) NOT NULL AUTO_INCREMENT, slug VARCHAR(255) NOT NULL, oldVersion VARCHAR(10) NOT NULL, newVersion VARCHAR(10) NOT NULL, method VARCHAR(10) NOT NULL, put_on_hold VARCHAR(100) DEFAULT '0', UNIQUE KEY id (id) ) $charset_collate;";
|
||||
|
||||
// Create DB tables
|
||||
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
||||
dbDelta( $sql );
|
||||
dbDelta( $sql2 );
|
||||
|
||||
// Database version
|
||||
add_option( "cau_db_version", "$cau_db_version" );
|
||||
|
||||
// Insert data
|
||||
cau_install_data();
|
||||
}
|
||||
|
||||
// Check if database table exists before creating
|
||||
function cau_check_if_exists( $whattocheck, $id = 'name', $db_table = 'auto_updates' ) {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$table_name = $wpdb->prefix.$db_table;
|
||||
$rows = $wpdb->get_col( "SELECT COUNT(*) as num_rows FROM {$table_name} WHERE {$id} = '{$whattocheck}'" );
|
||||
$check = $rows[0];
|
||||
|
||||
return ( $check > 0 ) ? true : false;
|
||||
|
||||
}
|
||||
|
||||
// Insert date into database
|
||||
function cau_install_data() {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$table_name = $wpdb->prefix . "auto_updates";
|
||||
$toemail = get_option('admin_email');
|
||||
|
||||
// Update configs
|
||||
if( !cau_check_if_exists( 'plugins' ) ) $wpdb->insert( $table_name, array( 'name' => 'plugins', 'onoroff' => 'on' ) );
|
||||
if( !cau_check_if_exists( 'themes' ) ) $wpdb->insert( $table_name, array( 'name' => 'themes', 'onoroff' => 'on' ) );
|
||||
if( !cau_check_if_exists( 'minor' ) ) $wpdb->insert( $table_name, array( 'name' => 'minor', 'onoroff' => 'on' ) );
|
||||
if( !cau_check_if_exists( 'major' ) ) $wpdb->insert( $table_name, array( 'name' => 'major', 'onoroff' => '' ) );
|
||||
|
||||
// Email configs
|
||||
if( !cau_check_if_exists( 'email' ) ) $wpdb->insert( $table_name, array( 'name' => 'email', 'onoroff' => '' ) );
|
||||
if( !cau_check_if_exists( 'send' ) ) $wpdb->insert( $table_name, array( 'name' => 'send', 'onoroff' => '' ) );
|
||||
if( !cau_check_if_exists( 'sendupdate' ) ) $wpdb->insert( $table_name, array( 'name' => 'sendupdate', 'onoroff' => '' ) );
|
||||
if( !cau_check_if_exists( 'sendoutdated' ) ) $wpdb->insert( $table_name, array( 'name' => 'sendoutdated', 'onoroff' => '' ) );
|
||||
|
||||
// Advanced
|
||||
if( !cau_check_if_exists( 'notUpdateList' ) ) $wpdb->insert( $table_name, array( 'name' => 'notUpdateList', 'onoroff' => '' ) );
|
||||
if( !cau_check_if_exists( 'translations' ) ) $wpdb->insert( $table_name, array( 'name' => 'translations', 'onoroff' => 'on' ) );
|
||||
if( !cau_check_if_exists( 'wpemails' ) ) $wpdb->insert( $table_name, array( 'name' => 'wpemails', 'onoroff' => 'on' ) );
|
||||
if( !cau_check_if_exists( 'notUpdateListTh' ) ) $wpdb->insert( $table_name, array( 'name' => 'notUpdateListTh', 'onoroff' => '' ) );
|
||||
|
||||
// Stuff
|
||||
if( !cau_check_if_exists( 'html_or_text' ) ) $wpdb->insert( $table_name, array( 'name' => 'html_or_text', 'onoroff' => 'html' ) );
|
||||
if( !cau_check_if_exists( 'dbupdateemails' ) ) $wpdb->insert( $table_name, array( 'name' => 'dbupdateemails', 'onoroff' => '' ) );
|
||||
|
||||
// Advanced
|
||||
if( !cau_check_if_exists( 'allow_administrator' ) ) $wpdb->insert( $table_name, array( 'name' => 'allow_administrator', 'onoroff' => 'on' ) );
|
||||
if( !cau_check_if_exists( 'allow_editor' ) ) $wpdb->insert( $table_name, array( 'name' => 'allow_editor', 'onoroff' => '' ) );
|
||||
if( !cau_check_if_exists( 'allow_author' ) ) $wpdb->insert( $table_name, array( 'name' => 'allow_author', 'onoroff' => '' ) );
|
||||
if( !cau_check_if_exists( 'ignore_seo' ) ) $wpdb->insert( $table_name, array( 'name' => 'ignore_seo', 'onoroff' => '' ) );
|
||||
if( !cau_check_if_exists( 'ignore_cron' ) ) $wpdb->insert( $table_name, array( 'name' => 'ignore_cron', 'onoroff' => '' ) );
|
||||
if( !cau_check_if_exists( 'advanced_info_emails' ) ) $wpdb->insert( $table_name, array( 'name' => 'advanced_info_emails', 'onoroff' => '' ) );
|
||||
if( !cau_check_if_exists( 'update_delay' ) ) $wpdb->insert( $table_name, array( 'name' => 'update_delay', 'onoroff' => '' ) );
|
||||
if( !cau_check_if_exists( 'update_delay_days' ) ) $wpdb->insert( $table_name, array( 'name' => 'update_delay_days', 'onoroff' => '' ) );
|
||||
if( !cau_check_if_exists( 'plugin_links_emails' ) ) $wpdb->insert( $table_name, array( 'name' => 'plugin_links_emails', 'onoroff' => '' ) );
|
||||
|
||||
}
|
||||
register_activation_hook( __FILE__, 'cau_install' );
|
||||
|
||||
// Clear everything on deactivation
|
||||
function cau_remove() {
|
||||
|
||||
// Delete tables
|
||||
global $wpdb;
|
||||
$autoupdates = $wpdb->prefix."auto_updates";
|
||||
$updateLog = $wpdb->prefix."update_log";
|
||||
$wpdb->query( "DROP TABLE IF EXISTS $autoupdates" );
|
||||
$wpdb->query( "DROP TABLE IF EXISTS $updateLog" );
|
||||
|
||||
// Clear schedules
|
||||
wp_clear_scheduled_hook( 'cau_set_schedule_mail' );
|
||||
wp_clear_scheduled_hook( 'cau_custom_hooks_plugins' );
|
||||
wp_clear_scheduled_hook( 'cau_custom_hooks_themes' );
|
||||
wp_clear_scheduled_hook( 'cau_log_updater' );
|
||||
|
||||
// Restore WordPress 5.5 default update functionality
|
||||
add_filter( 'plugins_auto_update_enabled', '__return_true' );
|
||||
add_filter( 'themes_auto_update_enabled', '__return_true' );
|
||||
add_filter( 'auto_plugin_update_send_email', '__return_true' );
|
||||
add_filter( 'auto_theme_update_send_email', '__return_true' );
|
||||
|
||||
}
|
||||
register_deactivation_hook( __FILE__, 'cau_remove' );
|
||||
|
||||
// Update
|
||||
function cau_update_db_check() {
|
||||
|
||||
$cau_db_version = cau_db_version();
|
||||
|
||||
if ( get_site_option( 'cau_db_version' ) != $cau_db_version ) {
|
||||
|
||||
cau_database_creation();
|
||||
|
||||
// In 3.7.2 we've added $wpdb->get_charset_collate
|
||||
if( get_site_option( 'cau_db_version' ) < '3.7.2' ) {
|
||||
|
||||
global $wpdb;
|
||||
$autoupdates = $wpdb->prefix."auto_updates";
|
||||
$updateLog = $wpdb->prefix."update_log";
|
||||
$db_charset = constant( 'DB_CHARSET' );
|
||||
$wpdb->query( "ALTER TABLE $autoupdates CONVERT TO CHARACTER SET $db_charset" );
|
||||
$wpdb->query( "ALTER TABLE $updateLog CONVERT TO CHARACTER SET $db_charset" );
|
||||
}
|
||||
update_option( "cau_db_version", $cau_db_version );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
add_action( 'upgrader_process_complete', 'cau_update_db_check' );
|
||||
|
||||
// Manual update
|
||||
function cau_manual_update() {
|
||||
cau_update_db_check();
|
||||
}
|
||||
|
||||
// Load custom functions
|
||||
require_once( plugin_dir_path( __FILE__ ) . 'cau_functions.php' );
|
||||
|
||||
// Add plugin to menu
|
||||
function register_cau_menu_page() {
|
||||
if( cau_allowed_user_rights() ) add_submenu_page( cau_menloc() , __( 'Auto Updater', 'companion-auto-update' ), __( 'Auto Updater', 'companion-auto-update' ), 'manage_options', 'cau-settings', 'cau_frontend' );
|
||||
}
|
||||
add_action( 'admin_menu', 'register_cau_menu_page' );
|
||||
|
||||
// Settings page
|
||||
function cau_frontend() {
|
||||
|
||||
echo "<div class='wrap cau_content_wrap cau_content'>
|
||||
<h1 class='wp-heading-inline'>".__( 'Companion Auto Update', 'companion-auto-update' )."</h1>
|
||||
<hr class='wp-header-end'>";
|
||||
|
||||
// Make sure the correct timezone is used
|
||||
date_default_timezone_set( cau_get_proper_timezone() );
|
||||
|
||||
// Allow only access to these pages
|
||||
$allowedPages = array(
|
||||
'dashboard' => __( 'Dashboard' ),
|
||||
'pluginlist' => __( 'Update filter', 'companion-auto-update' ),
|
||||
'log' => __( 'Update log', 'companion-auto-update' ),
|
||||
'status' => __( 'Status', 'companion-auto-update' ),
|
||||
);
|
||||
|
||||
// Show subtabs
|
||||
echo "<h2 class='nav-tab-wrapper wp-clearfix'>";
|
||||
|
||||
foreach ( $allowedPages as $page => $title ) {
|
||||
echo "<a href='".cau_url( $page )."' id='tab-".$page."' class='nav-tab "._active_tab( $page )."'>".$title;
|
||||
if( $page == 'status' ) echo cau_pluginHasIssues() ? "<span class='cau_melding level-".cau_pluginIssueLevels()."'></span>" : "<span class='cau_melding level-okay'></span>"; // Show status icon
|
||||
echo "</a>";
|
||||
}
|
||||
|
||||
echo "</h2>";
|
||||
|
||||
// Show page content
|
||||
if( !isset( $_GET['tab'] ) ) {
|
||||
$requestedPage = 'dashboard';
|
||||
echo "<script>jQuery('#tab-dashboard').addClass('nav-tab-active');</script>"; // Set active tab class
|
||||
} else {
|
||||
$requestedPage = sanitize_key( $_GET['tab'] );
|
||||
}
|
||||
|
||||
if( array_key_exists( $requestedPage, $allowedPages ) ) {
|
||||
require_once( plugin_dir_path( __FILE__ ) . 'admin/'.$requestedPage.'.php' );
|
||||
} else {
|
||||
wp_die( 'You\'re not allowed to view <strong>'.$requestedPage.'</strong>.' );
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
// Add a widget to the dashboard.
|
||||
function cau_add_widget() {
|
||||
if ( cau_allowed_user_rights() ) wp_add_dashboard_widget( 'cau-update-log', __('Update log', 'companion-auto-update'), 'cau_widget' );
|
||||
}
|
||||
add_action( 'wp_dashboard_setup', 'cau_add_widget' );
|
||||
|
||||
// Widget content
|
||||
function cau_widget() {
|
||||
echo '<style>table.autoupdatewidget { border: 0px solid transparent; border-bottom: 1px solid #EEEEEE; margin: 0 -12px; width: calc(100% + 24px); } table.autoupdatewidget tr td { border-top: 1px solid #EEEEEE; padding: 9px 12px 5px 12px; background: #FAFAFA; } .cau_divide { display: inline-block; color: #E7E0DF; padding: 0 2px; } </style>';
|
||||
echo '<p>'.__('Below are the last 7 updates ran on this site. Includes plugins and themes, both automatically updated and manually updated.', 'companion-auto-update').'</p>';
|
||||
cau_fetch_log( '7' );
|
||||
echo '<p><a href="'.cau_url( 'log' ).'">'.__( 'View full changelog', 'companion-auto-update' ).'</a> <span class="cau_divide">|</span> <a href="'.cau_url( 'dashboard' ).'">'.__( 'Settings' ).'</a></p>';
|
||||
}
|
||||
|
||||
// Load admin styles
|
||||
function load_cau_global_styles( $hook ) {
|
||||
wp_enqueue_style( 'cau_admin_styles', plugins_url( 'backend/style.css' , __FILE__ ) ); // Plugin scripts
|
||||
wp_enqueue_style( 'cau_warning_styles', plugins_url( 'backend/warningbar.css' , __FILE__ ) ); // Check for issues
|
||||
}
|
||||
add_action( 'admin_enqueue_scripts', 'load_cau_global_styles', 99 );
|
||||
|
||||
// Load admin styles
|
||||
function load_cau_page_styles( $hook ) {
|
||||
|
||||
// Only load on plugins' pages
|
||||
if( $hook != 'tools_page_cau-settings' && $hook != 'index_page_cau-settings' ) return;
|
||||
|
||||
// WordPress scripts we need
|
||||
wp_enqueue_style( 'thickbox' );
|
||||
wp_enqueue_script( 'thickbox' );
|
||||
wp_enqueue_script( 'plugin-install' );
|
||||
}
|
||||
add_action( 'admin_enqueue_scripts', 'load_cau_page_styles', 100 );
|
||||
|
||||
// Send e-mails
|
||||
require_once( plugin_dir_path( __FILE__ ) . 'cau_emails.php' );
|
||||
|
||||
// Add settings link on plugin page
|
||||
function cau_settings_link( $links ) {
|
||||
|
||||
$settings_link = '<a href="'.cau_url( 'dashboard' ).'">'.__( 'Settings' ).'</a>';
|
||||
$settings_link2 = '<a href="https://translate.wordpress.org/projects/wp-plugins/companion-auto-update">'.__( 'Help us translate', 'companion-auto-update' ).'</a>';
|
||||
$settings_link3 = '<a href="'.cau_donateUrl().'">'.__( 'Donate to help development', 'companion-auto-update' ).'</a>';
|
||||
|
||||
array_unshift( $links, $settings_link2 );
|
||||
array_unshift( $links, $settings_link3 );
|
||||
if( cau_allowed_user_rights() ) array_unshift( $links, $settings_link );
|
||||
|
||||
return $links;
|
||||
|
||||
}
|
||||
$plugin = plugin_basename(__FILE__);
|
||||
add_filter( "plugin_action_links_$plugin", "cau_settings_link" );
|
||||
|
||||
// Auto Update Class
|
||||
class CAU_auto_update {
|
||||
|
||||
// Enable Update filters
|
||||
public function __construct() {
|
||||
add_action( 'plugins_loaded', array( &$this, 'CAU_auto_update_filters' ), 1 );
|
||||
}
|
||||
|
||||
public function CAU_auto_update_filters() {
|
||||
|
||||
global $wpdb;
|
||||
$table_name = $wpdb->prefix . "auto_updates";
|
||||
|
||||
// Disable WP emails
|
||||
add_filter( 'auto_plugin_update_send_email', '__return_false' ); // Plugin updates
|
||||
add_filter( 'auto_theme_update_send_email', '__return_false' ); // Theme updates
|
||||
|
||||
// Enable for major updates
|
||||
$configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'major'");
|
||||
foreach ( $configs as $config ) {
|
||||
if( $config->onoroff == 'on' ) add_filter( 'allow_major_auto_core_updates', '__return_true', 1 ); // Turn on
|
||||
else add_filter( 'allow_major_auto_core_updates', '__return_false', 1 ); // Turn off
|
||||
}
|
||||
|
||||
// Enable for minor updates
|
||||
$configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'minor'");
|
||||
foreach ( $configs as $config ) {
|
||||
if( $config->onoroff == 'on' ) add_filter( 'allow_minor_auto_core_updates', '__return_true', 1 ); // Turn on
|
||||
else add_filter( 'allow_minor_auto_core_updates', '__return_false', 1 ); // Turn off
|
||||
}
|
||||
|
||||
// Enable for plugins
|
||||
$configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'plugins'");
|
||||
foreach ( $configs as $config ) {
|
||||
if( $config->onoroff == 'on' ) add_filter( 'auto_update_plugin', 'cau_dontUpdatePlugins', 10, 2 ); // Turn on
|
||||
else add_filter( 'auto_update_plugin', '__return_false', 1 ); // Turn off
|
||||
}
|
||||
|
||||
// Enable for themes
|
||||
$configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'themes'");
|
||||
foreach ( $configs as $config ) {
|
||||
if( $config->onoroff == 'on' ) add_filter( 'auto_update_theme', '__return_true' ); // Turn on
|
||||
else add_filter( 'auto_update_theme', '__return_false', 1 ); // Turn off
|
||||
}
|
||||
|
||||
// Enable for translation files
|
||||
$configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'translations'");
|
||||
foreach ( $configs as $config ) {
|
||||
if( $config->onoroff == 'on' ) add_filter( 'auto_update_translation', '__return_true', 1 ); // Turn on
|
||||
else add_filter( 'auto_update_translation', '__return_false', 1 ); // Turn off
|
||||
}
|
||||
|
||||
// WP Email Config
|
||||
$configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'wpemails'");
|
||||
foreach ( $configs as $config ) {
|
||||
if( $config->onoroff == 'on' ) add_filter( 'auto_core_update_send_email', '__return_true', 1 ); // Turn on
|
||||
else add_filter( 'auto_core_update_send_email', '__return_false', 1 ); // Turn off
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
new CAU_auto_update();
|
||||
|
||||
// Check for issues
|
||||
function cau_checkForIssues( $admin_bar ) {
|
||||
if( cau_pluginHasIssues() && is_admin() && cau_pluginIssueLevels() == 'high' ) {
|
||||
$admin_bar->add_menu( array(
|
||||
'id' => 'cau-has-issues',
|
||||
'title' => '<span class="ab-icon"></span><span class="cau-level-'.cau_pluginIssueLevels().'">'.cau_pluginIssueCount().'</span>',
|
||||
'href' => cau_url( 'status' ),
|
||||
'meta' => array(
|
||||
'target' => '_self',
|
||||
'title' => __( 'Companion Auto Update ran into a critical error. View the status log for more info.', 'companion-auto-update' ),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
add_action( 'admin_bar_menu', 'cau_checkForIssues', 150 );
|
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
# Silence is golden.
|
@ -0,0 +1,62 @@
|
||||
# Copyright (C) 2016 Companion Auto Update
|
||||
# This file is distributed under the same license as the Companion Auto Update package.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Companion Auto Update 1.0\n"
|
||||
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/companion-auto-"
|
||||
"update\n"
|
||||
"POT-Creation-Date: 2016-05-24 08:16:37+00:00\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
||||
#: companion_portfolio.php:96
|
||||
msgid "Auto Updater"
|
||||
msgstr ""
|
||||
|
||||
#: companion_portfolio.php:122
|
||||
msgid "Auto update plugins?"
|
||||
msgstr ""
|
||||
|
||||
#: companion_portfolio.php:122
|
||||
msgid "Auto update themes?"
|
||||
msgstr ""
|
||||
|
||||
#: companion_portfolio.php:122
|
||||
msgid "Auto update minor core updates?"
|
||||
msgstr ""
|
||||
|
||||
#: companion_portfolio.php:122
|
||||
msgid "Auto update major core updates?"
|
||||
msgstr ""
|
||||
|
||||
#: companion_portfolio.php:125
|
||||
msgid "Settings saved"
|
||||
msgstr ""
|
||||
|
||||
#: companion_portfolio.php:125
|
||||
msgid "Settings"
|
||||
msgstr ""
|
||||
|
||||
#. Plugin Name of the plugin/theme
|
||||
msgid "Companion Auto Update"
|
||||
msgstr ""
|
||||
|
||||
#. #-#-#-#-# plugin.pot (Companion Auto Update 1.0) #-#-#-#-#
|
||||
#. Plugin URI of the plugin/theme
|
||||
#. #-#-#-#-# plugin.pot (Companion Auto Update 1.0) #-#-#-#-#
|
||||
#. Author URI of the plugin/theme
|
||||
msgid "https://qreative-web.com"
|
||||
msgstr ""
|
||||
|
||||
#. Description of the plugin/theme
|
||||
msgid ""
|
||||
"This plugin auto updates all plugins, all themes and the wordpress core."
|
||||
msgstr ""
|
||||
|
||||
#. Author of the plugin/theme
|
||||
msgid "Qreative-Web"
|
||||
msgstr ""
|
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* Nothing to see here
|
||||
*/
|
@ -0,0 +1,202 @@
|
||||
=== Companion Auto Update ===
|
||||
Contributors: Papin, qweb
|
||||
Donate link: https://www.paypal.me/dakel/10/
|
||||
Tags: auto, automatic, background, update, updates, updating, automatic updates, automatic background updates, easy update, wordpress update, theme update, plugin update, up-to-date, security, update latest version, update core, update wp, update wp core, major updates, minor updates, update to new version, update core, update plugin, update plugins, update plugins automatically, update theme, plugin, theme, advance, control, mail, notifations, enable
|
||||
Requires at least: 5.3.0
|
||||
Tested up to: 6.4
|
||||
Requires PHP: 5.1
|
||||
Stable tag: 3.9.1
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Manage all updates on your WordPress site. Stay in the know with several optional e-mail notifications and logs. For free.
|
||||
|
||||
== Description ==
|
||||
|
||||
Companion Auto Update is a powerful and completely free plugin that allows you to manage all the updates on your WordPress site. Our aim is to give you the best control over these updates and stay in the know at all times.
|
||||
|
||||
We understand that you might not always be able to check if your WordPress site has any updates that need to be installed. Especially when you maintain multiple websites keeping them up-to-date can be a lot of work. This plugin can help you with that. We'll keep your site up-to-date and keep you posted about what's happening and notify you when we need your help with something.
|
||||
|
||||
If you have a feature suggestion or idea you’d like to see in the plugin, we’d love to hear about it! [Suggest a Feature](https://codeermeneer.nl/contact/)
|
||||
|
||||
= Main features =
|
||||
1. Auto-updating for plugins, themes, core and translation files
|
||||
1. Set at what time you wish to update
|
||||
1. Filter plugins and themes to not be updated
|
||||
1. E-mail notifications about old software, pending updates and completed updates
|
||||
1. An update log with all updates
|
||||
1. Option to delay automatic updates with an x number of days
|
||||
|
||||
= Full control over everything =
|
||||
Full control, that's what this plugin is all about. With this plugin you can enable (or disable) automatic updating for plugins, themes, WordPress core updates (both minor and major can be changed separately) and for translation files. Don't want to run the updater for all plugins? Don't worry, just disable auto updating for the plugins you'd like to skip and we can even notify you when there's an update for these plugins so you can go and update them yourself.
|
||||
|
||||
= Scheduling =
|
||||
By default we'll check for updates twice a day but you can change this to several different options if you'd like. When choosing to update on a daily basis you can even select at what time you'd like it to run. Besides the updaters you can also schedule te notifications, want to update every hour but only recieve notifications once a day? No problem!
|
||||
Sometimes developers will push an update that will cause errors on your site, they'll often fix it within a day but if the updater has run in the mean time it can cause all kinds of issues. Now you can choose to delay updates with an x number of days to prevent this from happening.
|
||||
|
||||
= Know what's happening =
|
||||
We want you to know what's happening on your website. This plugin offers settings for various email notifications. We can send you an email when an update is available, when a plugin has been updated or when wordpress has been updated.
|
||||
But if you don't want to recieve emails about this you can still log in and view the changelog to see what happened.
|
||||
|
||||
== Installation ==
|
||||
|
||||
How to install Companion Auto Update
|
||||
|
||||
= Manual install =
|
||||
1. Download Companion Auto Update.
|
||||
1. Upload the 'Companion Auto Update' directory to your '/wp-content/plugins/' directory.
|
||||
1. Activate Companion Auto Update from your Plugins page.
|
||||
|
||||
= Via WordPress =
|
||||
1. Search for 'Companion Auto Update'.
|
||||
1. Click install.
|
||||
1. Activate.
|
||||
|
||||
= Settings =
|
||||
Settings can be found trough Tools > Auto Updater
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= Check our website for the FAQ =
|
||||
|
||||
[https://codeermeneer.nl/documentation/auto-update/faq-auto-updater/](https://codeermeneer.nl/documentation/auto-update/faq-auto-updater/)
|
||||
|
||||
= What features can I expect to see in the future? =
|
||||
|
||||
Your feedback is what made this plugin what is and what it’ll become so keep the feedback coming! To see what features you've suggested and what we're working on [read our blogpost here](https://codeermeneer.nl/blog/companion-auto-update-and-its-future/)
|
||||
|
||||
= What's the difference between WordPress 5.5 and this plugin? =
|
||||
|
||||
WordPress 5.5 was released recently and it packs tons of new features. One of those features is auto-updates for plugins and themes. Something Companion Auto Update does too.
|
||||
So obviously, some of you wondered what the difference would be between the default WordPress method and the one offered by Companion Auto Update and I figured I’d quickly write a blog about it, explaining the differences.
|
||||
|
||||
[You can read this blogpost here](https://codeermeneer.nl/blog/wordpress-5-5-versus-companion-auto-update/)
|
||||
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. Full control over what to update and when to recieve notifications
|
||||
2. Disable auto-updating for certain plugins and/or themes
|
||||
3. Advanced scheduling options for updating and notifcations
|
||||
4. Keep track of updates with the update log
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 3.9.1 (March 8, 2024) =
|
||||
* Fixed: Undefined variable $totalNum
|
||||
|
||||
= 3.9.0 (February 2, 2024) =
|
||||
* Fixed: Fatal error during Cron
|
||||
* Fixed: PHP deprecated error for PHP 8 and up
|
||||
|
||||
= 3.8.9 (January 9, 2024) =
|
||||
* Fixed error: Call to undefined function is_plugin_active()
|
||||
|
||||
= 3.8.8 (December 19, 2023) =
|
||||
* Fixed a few minor bugs
|
||||
* Made some performance improvements
|
||||
* We now require at least WordPress 5.3
|
||||
|
||||
= 3.8.7.1 (September 28, 2022) =
|
||||
* Tweak: Extended function_exists check with get_plugins() for the fatal error when trying to send update emails
|
||||
|
||||
= 3.8.7 (September 12, 2022) =
|
||||
* Fix: Fatal error when trying to send update emails
|
||||
|
||||
= 3.8.6 (August 11, 2022) =
|
||||
* Tweak: Code optimization for better performance
|
||||
|
||||
= 3.8.5 (March 17, 2022) =
|
||||
* New: Added more checks on the status page and added an explanation to some of them.
|
||||
* New: Added an list of delayed updates on the status page to help with troubleshooting.
|
||||
* Tweak: Made some improvements to the update delay feature.
|
||||
* Tweak: Added a notice to explain that update delay does not work with WordPress update currently.
|
||||
* Tweak: Improved code on the status page to be more reliable.
|
||||
|
||||
= 3.8.4 (February 2, 2022) =
|
||||
* Tweak: Fixed a few styling errors with WP5.9
|
||||
|
||||
= 3.8.3 (December 9, 2021) =
|
||||
* New: Plugin update e-mails now have an option to link to a few important pages
|
||||
* Fix: Error: Undefined index: dbupdateemails
|
||||
* Fix: Error: A non-numeric value encountered
|
||||
|
||||
= 3.8.2 (July 1, 2021) =
|
||||
* Fix: Error: Call to undefined function get_plugin_updates()
|
||||
|
||||
= 3.8.1 (June 4, 2021) =
|
||||
* New: Be notified when we need your help updating to a new database version [Feature Request](https://wordpress.org/support/topic/feature-request-839/)
|
||||
* Tweak: Made some under the hood performance improvements
|
||||
|
||||
= 3.8.0 (January 14, 2021) =
|
||||
* New: Better handling of plugins with an unknown WP version
|
||||
* New: More intervals for notifications
|
||||
* Fix: Call to undefined function errors
|
||||
|
||||
= 3.7.1.1 (November 2, 2020) =
|
||||
* Fix: Type in wp_next_scheduled
|
||||
|
||||
= 3.7.1 (October 30, 2020) =
|
||||
* Fix: PHP Warning: strtotime() expects parameter 2 to be integer, string given
|
||||
|
||||
= 3.7 (September 8, 2020) =
|
||||
* New: Delay updates with an x number of days
|
||||
* New: Be notified of plugins that have not been tested with the latest 3 major releases of WordPress.
|
||||
* New: Choose to see more info in the emails (like the time at which the update happened)
|
||||
* Fix: "Contact for support" button will work again
|
||||
* Fix: Fixed a few PHP errors
|
||||
* Tweak: Made improvements to the "Fix it" button for the "All automatic updates are disabled" error.
|
||||
* Tweak: You can now choose to ignore the "Search Engine Visibility" and "Cronjobs" warnings
|
||||
* Tweak: Reports on the Site Health page will only show a summary and point to the status page for more information and possible fixes
|
||||
* Tweak: Removed cronjob check and Search Engine Visibility check from site health
|
||||
* Tweak: E-mails are now fully translatable
|
||||
* Tweak: Renamed Core notifications to WordPress notifications
|
||||
* Tweak: WordPress plugin and theme update notifications are now disabled
|
||||
|
||||
Also: Check out what features we're working on at [our blogpost](https://codeermeneer.nl/blog/companion-auto-update-and-its-future/)
|
||||
|
||||
= 3.6 (August 12, 2020) =
|
||||
* New: Added an "after core update" hook [More info](https://codeermeneer.nl/documentation/codex-auto-updater/)
|
||||
* New: Select which userroles can access settings. (Defaults to only administrators)
|
||||
* Tweak: Added Theme and Core update method the log
|
||||
* Tweak: Few WordPress 5.5 improvements
|
||||
|
||||
= 3.5.5 (August 5, 2020) =
|
||||
* Fix: Added better multisite support
|
||||
* Tweak: We've added a bunch more checks to the status page and you can now see more passed checks.
|
||||
* Support for WordPress 5.5
|
||||
|
||||
= 3.5.4.1 (June 20, 2020) =
|
||||
* Fix: Sometimes the hour settings for intervals wouldn't show up
|
||||
|
||||
= 3.5.4 (June 19, 2020) =
|
||||
* New: See translations in the update log
|
||||
* New: We've added a few checks to WordPress' Site Health page
|
||||
* Fix: Error with Companion Auto Update Database Update
|
||||
* Fix: Schedule interval duplicates
|
||||
|
||||
= 3.5.3 (June 5, 2020) =
|
||||
* New: We're working on a better update log. You should see the Update method (Manual/Automatic) in the log now. (Only works for Plugins right now)
|
||||
Please report any issues with this feature over at our sticky post: [Problems with the Update method in the new update log?](https://wordpress.org/support/topic/problems-with-the-update-method-in-the-new-update-log/)
|
||||
* Fix: Not able to see checks in boxes (reverted back to before it all went wrong)
|
||||
* Fix: Error date_default_timezone_set(): Timezone ID +00:00 is invalid
|
||||
* Tweak: The status tab will no longer show turned-off settings as an error
|
||||
* Tweak: Made some improvements to the "Update pending" emails, you can now see a list of all pending updates and go directly to the update page.
|
||||
|
||||
= 3.5.2 (April 1, 2020) =
|
||||
* Fix: Not able to see checks in boxes
|
||||
|
||||
= 3.5.1 (March 25, 2020) =
|
||||
* Tweak: You seem to like the new dashboard, we've fixed a few issues regarding the responsiveness of the design. We've also tweaked the icons to be a bit more transparant.
|
||||
* Tweak: We've added the release notes link to Plain text emails
|
||||
* Tweak: Fixed a few typos
|
||||
* Tweak: Various minor security improvements
|
||||
|
||||
= 3.5.0 (March 5, 2020) =
|
||||
* New: In version 3.4.6 we've changed to HTML emails rather than plain text, in this version you can opt to change it back to plain text emails
|
||||
* Fix: We've 'fixed an issue where on occasion nothing would update
|
||||
* Tweak: Made some improvements to the "Fix it" button for the AUTOMATIC_UPDATER_DISABLED error
|
||||
* Tweak: We've changed the dashboard, moved both the settings page and de support page to the dashboard. Please let us know if you like this change or not.
|
||||
* Bug: We've had to (temporarily) disable the theme filter because it was causing issues on some installations. We'll try to get it working again in a future update.
|
||||
|
||||
[View full changelog](https://codeermeneer.nl/stuffs/auto-updater-changelog/)
|
@ -0,0 +1,134 @@
|
||||
<?php
|
||||
/**
|
||||
* This file creates a class to build our CSS.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'GeneratePress_Backgrounds_CSS' ) ) {
|
||||
/**
|
||||
* Generate our background CSS.
|
||||
*/
|
||||
class GeneratePress_Backgrounds_CSS {
|
||||
|
||||
/**
|
||||
* The css selector that you're currently adding rules to
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $_selector = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
|
||||
|
||||
/**
|
||||
* Stores the final css output with all of its rules for the current selector.
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $_selector_output = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
|
||||
|
||||
/**
|
||||
* Stores all of the rules that will be added to the selector
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $_css = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
|
||||
|
||||
/**
|
||||
* The string that holds all of the css to output
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $_output = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
|
||||
|
||||
/**
|
||||
* Sets a selector to the object and changes the current selector to a new one
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
*
|
||||
* @param string $selector - the css identifier of the html that you wish to target.
|
||||
* @return $this
|
||||
*/
|
||||
public function set_selector( $selector = '' ) {
|
||||
// Render the css in the output string everytime the selector changes.
|
||||
if ( '' !== $this->_selector ) {
|
||||
$this->add_selector_rules_to_output();
|
||||
}
|
||||
|
||||
$this->_selector = $selector;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a css property with value to the css output
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
*
|
||||
* @param string $property - the css property.
|
||||
* @param string $value - the value to be placed with the property.
|
||||
* @param string $url Whether we need to generate URL in the string.
|
||||
* @return $this
|
||||
*/
|
||||
public function add_property( $property, $value, $url = '' ) {
|
||||
// If we don't have a value or our value is the same as our og default, bail.
|
||||
if ( empty( $value ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set up our background image URL param if needed.
|
||||
$url_start = ( '' !== $url ) ? "url('" : ""; // phpcs:ignore -- need double quotes.
|
||||
$url_end = ( '' !== $url ) ? "')" : ""; // phpcs:ignore -- need double quotes.
|
||||
|
||||
$this->_css .= $property . ':' . $url_start . $value . $url_end . ';';
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the current selector rules to the output variable
|
||||
*
|
||||
* @access private
|
||||
* @since 1.0
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
private function add_selector_rules_to_output() {
|
||||
if ( ! empty( $this->_css ) ) {
|
||||
$this->_selector_output = $this->_selector;
|
||||
$selector_output = sprintf( '%1$s{%2$s}', $this->_selector_output, $this->_css );
|
||||
|
||||
$this->_output .= $selector_output;
|
||||
|
||||
// Reset the css.
|
||||
$this->_css = '';
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the minified css in the $_output variable
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function css_output() {
|
||||
// Add current selector's rules to output.
|
||||
$this->add_selector_rules_to_output();
|
||||
|
||||
// Output minified css.
|
||||
return $this->_output;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,420 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles Secondary Nav background images.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_backgrounds_secondary_nav_customizer' ) ) {
|
||||
add_action( 'customize_register', 'generate_backgrounds_secondary_nav_customizer', 1000 );
|
||||
/**
|
||||
* Adds our Secondary Nav background image options
|
||||
*
|
||||
* These options are in their own function so we can hook it in late to
|
||||
* make sure Secondary Nav is activated.
|
||||
*
|
||||
* 1000 priority is there to make sure Secondary Nav is registered (999)
|
||||
* as we check to see if the layout control exists.
|
||||
*
|
||||
* Secondary Nav now uses 100 as a priority.
|
||||
*
|
||||
* @param object $wp_customize Our Customizer object.
|
||||
*/
|
||||
function generate_backgrounds_secondary_nav_customizer( $wp_customize ) {
|
||||
if ( ! function_exists( 'generate_secondary_nav_get_defaults' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! $wp_customize->get_section( 'secondary_nav_section' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$defaults = generate_secondary_nav_get_defaults();
|
||||
|
||||
if ( method_exists( $wp_customize, 'register_control_type' ) ) {
|
||||
$wp_customize->register_control_type( 'GeneratePress_Section_Shortcut_Control' );
|
||||
}
|
||||
|
||||
require_once GP_LIBRARY_DIRECTORY . 'customizer-helpers.php';
|
||||
|
||||
$wp_customize->add_section(
|
||||
'secondary_bg_images_section',
|
||||
array(
|
||||
'title' => __( 'Secondary Navigation', 'gp-premium' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'description' => '',
|
||||
'panel' => 'generate_backgrounds_panel',
|
||||
'priority' => 21,
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Section_Shortcut_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_navigation_background_image_shortcuts',
|
||||
array(
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'element' => __( 'Secondary Navigation', 'gp-premium' ),
|
||||
'shortcuts' => array(
|
||||
'layout' => 'secondary_nav_section',
|
||||
'colors' => 'secondary_navigation_color_section',
|
||||
'typography' => 'secondary_font_section',
|
||||
),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
'priority' => 1,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[nav_image]',
|
||||
array(
|
||||
'default' => $defaults['nav_image'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Image_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_backgrounds-nav-image',
|
||||
array(
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'settings' => 'generate_secondary_nav_settings[nav_image]',
|
||||
'priority' => 750,
|
||||
'label' => __( 'Navigation', 'gp-premium' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[nav_repeat]',
|
||||
array(
|
||||
'default' => $defaults['nav_repeat'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_choices',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'generate_secondary_nav_settings[nav_repeat]',
|
||||
array(
|
||||
'type' => 'select',
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'choices' => array(
|
||||
'' => __( 'Repeat', 'gp-premium' ),
|
||||
'repeat-x' => __( 'Repeat x', 'gp-premium' ),
|
||||
'repeat-y' => __( 'Repeat y', 'gp-premium' ),
|
||||
'no-repeat' => __( 'No Repeat', 'gp-premium' ),
|
||||
),
|
||||
'settings' => 'generate_secondary_nav_settings[nav_repeat]',
|
||||
'priority' => 800,
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[nav_item_image]',
|
||||
array(
|
||||
'default' => $defaults['nav_item_image'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Image_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_backgrounds-nav-item-image',
|
||||
array(
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'settings' => 'generate_secondary_nav_settings[nav_item_image]',
|
||||
'priority' => 950,
|
||||
'label' => __( 'Navigation Item', 'gp-premium' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[nav_item_repeat]',
|
||||
array(
|
||||
'default' => $defaults['nav_item_repeat'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_choices',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'generate_secondary_nav_settings[nav_item_repeat]',
|
||||
array(
|
||||
'type' => 'select',
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'choices' => array(
|
||||
'' => __( 'Repeat', 'gp-premium' ),
|
||||
'repeat-x' => __( 'Repeat x', 'gp-premium' ),
|
||||
'repeat-y' => __( 'Repeat y', 'gp-premium' ),
|
||||
'no-repeat' => __( 'No Repeat', 'gp-premium' ),
|
||||
),
|
||||
'settings' => 'generate_secondary_nav_settings[nav_item_repeat]',
|
||||
'priority' => 1000,
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[nav_item_hover_image]',
|
||||
array(
|
||||
'default' => $defaults['nav_item_hover_image'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Image_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_backgrounds-nav-item-hover-image',
|
||||
array(
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'settings' => 'generate_secondary_nav_settings[nav_item_hover_image]',
|
||||
'priority' => 1150,
|
||||
'label' => __( 'Navigation Item Hover', 'gp-premium' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[nav_item_hover_repeat]',
|
||||
array(
|
||||
'default' => $defaults['nav_item_hover_repeat'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_choices',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'generate_secondary_nav_settings[nav_item_hover_repeat]',
|
||||
array(
|
||||
'type' => 'select',
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'choices' => array(
|
||||
'' => __( 'Repeat', 'gp-premium' ),
|
||||
'repeat-x' => __( 'Repeat x', 'gp-premium' ),
|
||||
'repeat-y' => __( 'Repeat y', 'gp-premium' ),
|
||||
'no-repeat' => __( 'No Repeat', 'gp-premium' ),
|
||||
),
|
||||
'settings' => 'generate_secondary_nav_settings[nav_item_hover_repeat]',
|
||||
'priority' => 1200,
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[nav_item_current_image]',
|
||||
array(
|
||||
'default' => $defaults['nav_item_current_image'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Image_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_backgrounds-nav-item-current-image',
|
||||
array(
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'settings' => 'generate_secondary_nav_settings[nav_item_current_image]',
|
||||
'priority' => 1350,
|
||||
'label' => __( 'Navigation Item Current', 'gp-premium' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[nav_item_current_repeat]',
|
||||
array(
|
||||
'default' => $defaults['nav_item_current_repeat'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_choices',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'generate_secondary_nav_settings[nav_item_current_repeat]',
|
||||
array(
|
||||
'type' => 'select',
|
||||
'section' => 'secondary_bg_images_section',
|
||||
'choices' => array(
|
||||
'' => __( 'Repeat', 'gp-premium' ),
|
||||
'repeat-x' => __( 'Repeat x', 'gp-premium' ),
|
||||
'repeat-y' => __( 'Repeat y', 'gp-premium' ),
|
||||
'no-repeat' => __( 'No Repeat', 'gp-premium' ),
|
||||
),
|
||||
'settings' => 'generate_secondary_nav_settings[nav_item_current_repeat]',
|
||||
'priority' => 1400,
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_section(
|
||||
'secondary_subnav_bg_images_section',
|
||||
array(
|
||||
'title' => __( 'Secondary Sub-Navigation', 'gp-premium' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'description' => '',
|
||||
'panel' => 'generate_backgrounds_panel',
|
||||
'priority' => 22,
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[sub_nav_item_image]',
|
||||
array(
|
||||
'default' => $defaults['sub_nav_item_image'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Image_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_backgrounds-sub-nav-item-image',
|
||||
array(
|
||||
'section' => 'secondary_subnav_bg_images_section',
|
||||
'settings' => 'generate_secondary_nav_settings[sub_nav_item_image]',
|
||||
'priority' => 1700,
|
||||
'label' => __( 'Sub-Navigation Item', 'gp-premium' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[sub_nav_item_repeat]',
|
||||
array(
|
||||
'default' => $defaults['sub_nav_item_repeat'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_choices',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'generate_secondary_nav_settings[sub_nav_item_repeat]',
|
||||
array(
|
||||
'type' => 'select',
|
||||
'section' => 'secondary_subnav_bg_images_section',
|
||||
'choices' => array(
|
||||
'' => __( 'Repeat', 'gp-premium' ),
|
||||
'repeat-x' => __( 'Repeat x', 'gp-premium' ),
|
||||
'repeat-y' => __( 'Repeat y', 'gp-premium' ),
|
||||
'no-repeat' => __( 'No Repeat', 'gp-premium' ),
|
||||
),
|
||||
'settings' => 'generate_secondary_nav_settings[sub_nav_item_repeat]',
|
||||
'priority' => 1800,
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[sub_nav_item_hover_image]',
|
||||
array(
|
||||
'default' => $defaults['sub_nav_item_hover_image'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Image_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_backgrounds-sub-nav-item-hover-image',
|
||||
array(
|
||||
'section' => 'secondary_subnav_bg_images_section',
|
||||
'settings' => 'generate_secondary_nav_settings[sub_nav_item_hover_image]',
|
||||
'priority' => 2000,
|
||||
'label' => __( 'Sub-Navigation Item Hover', 'gp-premium' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[sub_nav_item_hover_repeat]',
|
||||
array(
|
||||
'default' => $defaults['sub_nav_item_hover_repeat'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_choices',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'generate_secondary_nav_settings[sub_nav_item_hover_repeat]',
|
||||
array(
|
||||
'type' => 'select',
|
||||
'section' => 'secondary_subnav_bg_images_section',
|
||||
'choices' => array(
|
||||
'' => __( 'Repeat', 'gp-premium' ),
|
||||
'repeat-x' => __( 'Repeat x', 'gp-premium' ),
|
||||
'repeat-y' => __( 'Repeat y', 'gp-premium' ),
|
||||
'no-repeat' => __( 'No Repeat', 'gp-premium' ),
|
||||
),
|
||||
'settings' => 'generate_secondary_nav_settings[sub_nav_item_hover_repeat]',
|
||||
'priority' => 2100,
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[sub_nav_item_current_image]',
|
||||
array(
|
||||
'default' => $defaults['sub_nav_item_current_image'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Image_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_backgrounds-sub-nav-item-current-image',
|
||||
array(
|
||||
'section' => 'secondary_subnav_bg_images_section',
|
||||
'settings' => 'generate_secondary_nav_settings[sub_nav_item_current_image]',
|
||||
'priority' => 2300,
|
||||
'label' => __( 'Sub-Navigation Item Current', 'gp-premium' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[sub_nav_item_current_repeat]',
|
||||
array(
|
||||
'default' => $defaults['sub_nav_item_current_repeat'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_choices',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'generate_secondary_nav_settings[sub_nav_item_current_repeat]',
|
||||
array(
|
||||
'type' => 'select',
|
||||
'section' => 'secondary_subnav_bg_images_section',
|
||||
'choices' => array(
|
||||
'' => __( 'Repeat', 'gp-premium' ),
|
||||
'repeat-x' => __( 'Repeat x', 'gp-premium' ),
|
||||
'repeat-y' => __( 'Repeat y', 'gp-premium' ),
|
||||
'no-repeat' => __( 'No Repeat', 'gp-premium' ),
|
||||
),
|
||||
'settings' => 'generate_secondary_nav_settings[sub_nav_item_current_repeat]',
|
||||
'priority' => 2400,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Backgrounds module.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
// Define the version. This used to be a standalone plugin, so we need to keep this constant.
|
||||
if ( ! defined( 'GENERATE_BACKGROUNDS_VERSION' ) ) {
|
||||
define( 'GENERATE_BACKGROUNDS_VERSION', GP_PREMIUM_VERSION );
|
||||
}
|
||||
|
||||
require plugin_dir_path( __FILE__ ) . 'functions/functions.php';
|
@ -0,0 +1,169 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles column-related functionality.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_get_columns' ) ) {
|
||||
/**
|
||||
* Initiate columns.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_blog_get_columns() {
|
||||
$generate_blog_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
// If columns are enabled, set to true.
|
||||
$columns = ( $generate_blog_settings['column_layout'] ) ? true : false;
|
||||
|
||||
// If we're not dealing with posts, set it to false.
|
||||
// Check for is_home() to prevent bug in Yoast that throws off the post type check.
|
||||
$columns = ( 'post' === get_post_type() || is_search() || is_home() ) ? $columns : false;
|
||||
|
||||
// If masonry is enabled via filter, enable columns.
|
||||
// phpcs:ignore -- Non-strict comparison allowed.
|
||||
$columns = ( 'true' == apply_filters( 'generate_blog_masonry', 'false' ) ) ? true : $columns;
|
||||
|
||||
// If we're on a singular post or page, disable.
|
||||
$columns = ( is_singular() ) ? false : $columns;
|
||||
|
||||
// Turn off columns if we're on a WooCommerce search page.
|
||||
if ( function_exists( 'is_woocommerce' ) ) {
|
||||
$columns = ( is_woocommerce() && is_search() ) ? false : $columns;
|
||||
}
|
||||
|
||||
// Bail if there's no search results.
|
||||
if ( is_search() ) {
|
||||
global $wp_query;
|
||||
|
||||
// phpcs:ignore -- non-strict comparison allowed.
|
||||
if ( 0 == $wp_query->post_count ) {
|
||||
$columns = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Return the result.
|
||||
return apply_filters( 'generate_blog_columns', $columns );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_get_masonry' ) ) {
|
||||
/**
|
||||
* Check if masonry is enabled.
|
||||
* This function is a mess with strings as bools etc.. Will re-write in a big upate to get lots of testing.
|
||||
*/
|
||||
function generate_blog_get_masonry() {
|
||||
$generate_blog_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
// If masonry is enabled via option or filter, enable it.
|
||||
// phpcs:ignore -- non-strict comparison allowed.
|
||||
if ( $generate_blog_settings['masonry'] || 'true' == apply_filters( 'generate_blog_masonry', 'false' ) ) {
|
||||
$masonry = 'true';
|
||||
} else {
|
||||
$masonry = 'false';
|
||||
}
|
||||
|
||||
// Allow masonry to be turned off using a boolean.
|
||||
if ( false === apply_filters( 'generate_blog_masonry', 'false' ) ) {
|
||||
$masonry = 'false';
|
||||
}
|
||||
|
||||
return $masonry;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_add_columns_container' ) ) {
|
||||
add_action( 'generate_before_main_content', 'generate_blog_add_columns_container' );
|
||||
/**
|
||||
* Add columns container
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
function generate_blog_add_columns_container() {
|
||||
if ( ! generate_blog_get_columns() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$columns = generate_blog_get_column_count();
|
||||
|
||||
printf(
|
||||
'<div class="generate-columns-container %1$s">%2$s',
|
||||
'false' !== generate_blog_get_masonry() ? 'masonry-container are-images-unloaded' : '',
|
||||
'false' !== generate_blog_get_masonry() ? '<div class="grid-sizer grid-' . esc_attr( $columns ) . ' tablet-grid-50 mobile-grid-100"></div>' : '' // phpcs:ignore -- no escaping needed.
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_add_ending_columns_container' ) ) {
|
||||
add_action( 'generate_after_main_content', 'generate_blog_add_ending_columns_container' );
|
||||
/**
|
||||
* Add closing columns container
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
function generate_blog_add_ending_columns_container() {
|
||||
if ( ! generate_blog_get_columns() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo '</div><!-- .generate-columns-contaier -->';
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_columns_css' ) ) {
|
||||
/**
|
||||
* Add inline CSS
|
||||
*/
|
||||
function generate_blog_columns_css() {
|
||||
$generate_blog_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
generate_spacing_get_defaults()
|
||||
);
|
||||
}
|
||||
|
||||
$separator = ( function_exists( 'generate_spacing_get_defaults' ) ) ? absint( $spacing_settings['separator'] ) : 20;
|
||||
|
||||
$return = '';
|
||||
if ( generate_blog_get_columns() ) {
|
||||
$return .= '.generate-columns {margin-bottom: ' . $separator . 'px;padding-left: ' . $separator . 'px;}';
|
||||
$return .= '.generate-columns-container {margin-left: -' . $separator . 'px;}';
|
||||
$return .= '.page-header {margin-bottom: ' . $separator . 'px;margin-left: ' . $separator . 'px}';
|
||||
$return .= '.generate-columns-container > .paging-navigation {margin-left: ' . $separator . 'px;}';
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_get_column_count' ) ) {
|
||||
/**
|
||||
* Get our column grid class
|
||||
*/
|
||||
function generate_blog_get_column_count() {
|
||||
$generate_blog_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
$count = $generate_blog_settings['columns'];
|
||||
|
||||
return apply_filters( 'generate_blog_get_column_count', $count );
|
||||
}
|
||||
}
|
@ -0,0 +1,149 @@
|
||||
.masonry-enabled .page-header {
|
||||
position: relative !important;
|
||||
}
|
||||
|
||||
.separate-containers .site-main > .generate-columns-container {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.masonry-container.are-images-unloaded,
|
||||
.load-more.are-images-unloaded,
|
||||
.masonry-enabled #nav-below {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* columns */
|
||||
.generate-columns-container:not(.masonry-container) {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.generate-columns .inside-article {
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.generate-columns-activated.post-image-aligned-left .generate-columns-container article:not(.featured-column) .post-image,
|
||||
.generate-columns-activated.post-image-aligned-right .generate-columns-container article:not(.featured-column) .post-image {
|
||||
float: none;
|
||||
text-align: center;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.generate-columns-container .paging-navigation,
|
||||
.generate-columns-container .page-header {
|
||||
flex: 1 1 100%;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.generate-columns-container .paging-navigation {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.load-more:not(.has-svg-icon) .button.loading:before {
|
||||
content: "\e900";
|
||||
display: inline-block;
|
||||
font-family: "GP Premium";
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
line-height: 1;
|
||||
animation: spin 2s infinite linear;
|
||||
margin-right: 7px;
|
||||
}
|
||||
|
||||
.load-more .button:not(.loading) .gp-icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.load-more .gp-icon svg {
|
||||
animation: spin 2s infinite linear;
|
||||
margin-right: 7px;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.generate-columns {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.generate-columns.grid-20,
|
||||
.grid-sizer.grid-20 {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.generate-columns.grid-25,
|
||||
.grid-sizer.grid-25 {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.generate-columns.grid-33,
|
||||
.grid-sizer.grid-33 {
|
||||
width: 33.3333%;
|
||||
}
|
||||
|
||||
.generate-columns.grid-50,
|
||||
.grid-sizer.grid-50 {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.generate-columns.grid-60,
|
||||
.grid-sizer.grid-60 {
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
.generate-columns.grid-66,
|
||||
.grid-sizer.grid-66 {
|
||||
width: 66.66667%;
|
||||
}
|
||||
|
||||
.generate-columns.grid-100,
|
||||
.grid-sizer.grid-100 {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) and (max-width: 1024px) {
|
||||
.generate-columns.tablet-grid-50,
|
||||
.grid-sizer.tablet-grid-50 {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.generate-columns-activated .generate-columns-container {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
.generate-columns-container > *,
|
||||
.generate-columns-container .generate-columns {
|
||||
padding-left: 0;
|
||||
}
|
||||
.generate-columns-container .page-header {
|
||||
margin-left: 0;
|
||||
}
|
||||
.generate-columns.mobile-grid-100,
|
||||
.grid-sizer.mobile-grid-100 {
|
||||
width: 100%;
|
||||
}
|
||||
.generate-columns-container > .paging-navigation {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.load-more {
|
||||
display: block;
|
||||
text-align: center;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
1
wp-content/upgrade-temp-backup/plugins/gp-premium/blog/functions/css/columns.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.masonry-enabled .page-header{position:relative!important}.separate-containers .site-main>.generate-columns-container{margin-bottom:0}.load-more.are-images-unloaded,.masonry-container.are-images-unloaded,.masonry-enabled #nav-below{opacity:0}.generate-columns-container:not(.masonry-container){display:flex;flex-wrap:wrap;align-items:stretch}.generate-columns .inside-article{height:100%;box-sizing:border-box}.generate-columns-activated.post-image-aligned-left .generate-columns-container article:not(.featured-column) .post-image,.generate-columns-activated.post-image-aligned-right .generate-columns-container article:not(.featured-column) .post-image{float:none;text-align:center;margin-left:0;margin-right:0}.generate-columns-container .page-header,.generate-columns-container .paging-navigation{flex:1 1 100%;clear:both}.generate-columns-container .paging-navigation{margin-bottom:0}.load-more:not(.has-svg-icon) .button.loading:before{content:"\e900";display:inline-block;font-family:"GP Premium";font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;animation:spin 2s infinite linear;margin-right:7px}.load-more .button:not(.loading) .gp-icon{display:none}.load-more .gp-icon svg{animation:spin 2s infinite linear;margin-right:7px}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.generate-columns{box-sizing:border-box}.generate-columns.grid-20,.grid-sizer.grid-20{width:20%}.generate-columns.grid-25,.grid-sizer.grid-25{width:25%}.generate-columns.grid-33,.grid-sizer.grid-33{width:33.3333%}.generate-columns.grid-50,.grid-sizer.grid-50{width:50%}.generate-columns.grid-60,.grid-sizer.grid-60{width:60%}.generate-columns.grid-66,.grid-sizer.grid-66{width:66.66667%}.generate-columns.grid-100,.grid-sizer.grid-100{width:100%}@media (min-width:768px) and (max-width:1024px){.generate-columns.tablet-grid-50,.grid-sizer.tablet-grid-50{width:50%}}@media (max-width:767px){.generate-columns-activated .generate-columns-container{margin-left:0;margin-right:0}.generate-columns-container .generate-columns,.generate-columns-container>*{padding-left:0}.generate-columns-container .page-header{margin-left:0}.generate-columns.mobile-grid-100,.grid-sizer.mobile-grid-100{width:100%}.generate-columns-container>.paging-navigation{margin-left:0}}@media (max-width:768px){.load-more{display:block;text-align:center;margin-bottom:0}}
|
@ -0,0 +1,104 @@
|
||||
.post-image-above-header .inside-article .post-image,
|
||||
.post-image-above-header .inside-article .featured-image {
|
||||
margin-top: 0;
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
.post-image-aligned-left .inside-article .post-image,
|
||||
.post-image-aligned-left .inside-article .featured-image {
|
||||
margin-top: 0;
|
||||
margin-right: 2em;
|
||||
float: left;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.post-image-aligned-center .post-image,
|
||||
.post-image-aligned-center .featured-image {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.post-image-aligned-right .inside-article .post-image,
|
||||
.post-image-aligned-right .inside-article .featured-image {
|
||||
margin-top: 0;
|
||||
margin-left: 2em;
|
||||
float: right;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.post-image-below-header.post-image-aligned-right .inside-article .post-image,
|
||||
.post-image-below-header.post-image-aligned-right .inside-article .featured-image,
|
||||
.post-image-below-header.post-image-aligned-center .inside-article .featured-image,
|
||||
.post-image-below-header.post-image-aligned-left .inside-article .post-image,
|
||||
.post-image-below-header.post-image-aligned-left .inside-article .featured-image {
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
.post-image-aligned-left > .featured-image,
|
||||
.post-image-aligned-right > .featured-image {
|
||||
float: none;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.post-image-aligned-left .featured-image {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.post-image-aligned-right .featured-image {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.post-image-aligned-left .inside-article:before,
|
||||
.post-image-aligned-left .inside-article:after,
|
||||
.post-image-aligned-right .inside-article:before,
|
||||
.post-image-aligned-right .inside-article:after {
|
||||
content: "";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.post-image-aligned-left .inside-article:after,
|
||||
.post-image-aligned-right .inside-article:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.one-container.post-image-above-header .page-header + .no-featured-image-padding .inside-article .post-image,
|
||||
.one-container.post-image-above-header .no-featured-image-padding.generate-columns .inside-article .post-image {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.one-container.right-sidebar.post-image-aligned-center .no-featured-image-padding .post-image,
|
||||
.one-container.right-sidebar.post-image-aligned-center .no-featured-image-padding .featured-image,
|
||||
.one-container.both-right.post-image-aligned-center .no-featured-image-padding .post-image,
|
||||
.one-container.both-right.post-image-aligned-center .no-featured-image-padding .featured-image {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.one-container.left-sidebar.post-image-aligned-center .no-featured-image-padding .post-image,
|
||||
.one-container.left-sidebar.post-image-aligned-center .no-featured-image-padding .featured-image,
|
||||
.one-container.both-left.post-image-aligned-center .no-featured-image-padding .post-image,
|
||||
.one-container.both-left.post-image-aligned-center .no-featured-image-padding .featured-image {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.one-container.both-sidebars.post-image-aligned-center .no-featured-image-padding .post-image,
|
||||
.one-container.both-sidebars.post-image-aligned-center .no-featured-image-padding .featured-image {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.one-container.post-image-aligned-center .no-featured-image-padding.generate-columns .post-image,
|
||||
.one-container.post-image-aligned-center .no-featured-image-padding.generate-columns .featured-image {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
body:not(.post-image-aligned-center) .inside-article .post-image,
|
||||
body:not(.post-image-aligned-center) .featured-image,
|
||||
body:not(.post-image-aligned-center) .inside-article .featured-image {
|
||||
margin-right: 0;
|
||||
margin-left: 0;
|
||||
float: none;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
1
wp-content/upgrade-temp-backup/plugins/gp-premium/blog/functions/css/featured-images.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.post-image-above-header .inside-article .featured-image,.post-image-above-header .inside-article .post-image{margin-top:0;margin-bottom:2em}.post-image-aligned-left .inside-article .featured-image,.post-image-aligned-left .inside-article .post-image{margin-top:0;margin-right:2em;float:left;text-align:left}.post-image-aligned-center .featured-image,.post-image-aligned-center .post-image{text-align:center}.post-image-aligned-right .inside-article .featured-image,.post-image-aligned-right .inside-article .post-image{margin-top:0;margin-left:2em;float:right;text-align:right}.post-image-below-header.post-image-aligned-center .inside-article .featured-image,.post-image-below-header.post-image-aligned-left .inside-article .featured-image,.post-image-below-header.post-image-aligned-left .inside-article .post-image,.post-image-below-header.post-image-aligned-right .inside-article .featured-image,.post-image-below-header.post-image-aligned-right .inside-article .post-image{margin-top:2em}.post-image-aligned-left>.featured-image,.post-image-aligned-right>.featured-image{float:none;margin-left:auto;margin-right:auto}.post-image-aligned-left .featured-image{text-align:left}.post-image-aligned-right .featured-image{text-align:right}.post-image-aligned-left .inside-article:after,.post-image-aligned-left .inside-article:before,.post-image-aligned-right .inside-article:after,.post-image-aligned-right .inside-article:before{content:"";display:table}.post-image-aligned-left .inside-article:after,.post-image-aligned-right .inside-article:after{clear:both}.one-container.post-image-above-header .no-featured-image-padding.generate-columns .inside-article .post-image,.one-container.post-image-above-header .page-header+.no-featured-image-padding .inside-article .post-image{margin-top:0}.one-container.both-right.post-image-aligned-center .no-featured-image-padding .featured-image,.one-container.both-right.post-image-aligned-center .no-featured-image-padding .post-image,.one-container.right-sidebar.post-image-aligned-center .no-featured-image-padding .featured-image,.one-container.right-sidebar.post-image-aligned-center .no-featured-image-padding .post-image{margin-right:0}.one-container.both-left.post-image-aligned-center .no-featured-image-padding .featured-image,.one-container.both-left.post-image-aligned-center .no-featured-image-padding .post-image,.one-container.left-sidebar.post-image-aligned-center .no-featured-image-padding .featured-image,.one-container.left-sidebar.post-image-aligned-center .no-featured-image-padding .post-image{margin-left:0}.one-container.both-sidebars.post-image-aligned-center .no-featured-image-padding .featured-image,.one-container.both-sidebars.post-image-aligned-center .no-featured-image-padding .post-image{margin-left:0;margin-right:0}.one-container.post-image-aligned-center .no-featured-image-padding.generate-columns .featured-image,.one-container.post-image-aligned-center .no-featured-image-padding.generate-columns .post-image{margin-left:0;margin-right:0}@media (max-width:768px){body:not(.post-image-aligned-center) .featured-image,body:not(.post-image-aligned-center) .inside-article .featured-image,body:not(.post-image-aligned-center) .inside-article .post-image{margin-right:0;margin-left:0;float:none;text-align:center}}
|
@ -0,0 +1,254 @@
|
||||
.post-image-above-header .inside-article .post-image,
|
||||
.post-image-above-header .inside-article .featured-image {
|
||||
margin-top: 0;
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
.post-image-aligned-left .inside-article .post-image,
|
||||
.post-image-aligned-left .inside-article .featured-image {
|
||||
margin-top: 0;
|
||||
margin-right: 2em;
|
||||
float: left;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.post-image-aligned-center .post-image,
|
||||
.post-image-aligned-center .featured-image {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.post-image-aligned-right .inside-article .post-image,
|
||||
.post-image-aligned-right .inside-article .featured-image {
|
||||
margin-top: 0;
|
||||
margin-left: 2em;
|
||||
float: right;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.post-image-below-header.post-image-aligned-right .inside-article .post-image,
|
||||
.post-image-below-header.post-image-aligned-right .inside-article .featured-image,
|
||||
.post-image-below-header.post-image-aligned-center .inside-article .featured-image,
|
||||
.post-image-below-header.post-image-aligned-left .inside-article .post-image,
|
||||
.post-image-below-header.post-image-aligned-left .inside-article .featured-image {
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
.post-image-aligned-left > .featured-image,
|
||||
.post-image-aligned-right > .featured-image {
|
||||
float: none;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.post-image-aligned-left .featured-image {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.post-image-aligned-right .featured-image {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.post-image-aligned-left .inside-article:before,
|
||||
.post-image-aligned-left .inside-article:after,
|
||||
.post-image-aligned-right .inside-article:before,
|
||||
.post-image-aligned-right .inside-article:after {
|
||||
content: "";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.post-image-aligned-left .inside-article:after,
|
||||
.post-image-aligned-right .inside-article:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.one-container.post-image-above-header .page-header + .no-featured-image-padding .inside-article .post-image,
|
||||
.one-container.post-image-above-header .no-featured-image-padding.generate-columns .inside-article .post-image {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.one-container.right-sidebar.post-image-aligned-center .no-featured-image-padding .post-image,
|
||||
.one-container.right-sidebar.post-image-aligned-center .no-featured-image-padding .featured-image,
|
||||
.one-container.both-right.post-image-aligned-center .no-featured-image-padding .post-image,
|
||||
.one-container.both-right.post-image-aligned-center .no-featured-image-padding .featured-image {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.one-container.left-sidebar.post-image-aligned-center .no-featured-image-padding .post-image,
|
||||
.one-container.left-sidebar.post-image-aligned-center .no-featured-image-padding .featured-image,
|
||||
.one-container.both-left.post-image-aligned-center .no-featured-image-padding .post-image,
|
||||
.one-container.both-left.post-image-aligned-center .no-featured-image-padding .featured-image {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.one-container.both-sidebars.post-image-aligned-center .no-featured-image-padding .post-image,
|
||||
.one-container.both-sidebars.post-image-aligned-center .no-featured-image-padding .featured-image {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.one-container.post-image-aligned-center .no-featured-image-padding.generate-columns .post-image,
|
||||
.one-container.post-image-aligned-center .no-featured-image-padding.generate-columns .featured-image {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
body:not(.post-image-aligned-center) .inside-article .post-image,
|
||||
body:not(.post-image-aligned-center) .featured-image,
|
||||
body:not(.post-image-aligned-center) .inside-article .featured-image {
|
||||
margin-right: 0;
|
||||
margin-left: 0;
|
||||
float: none;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.masonry-enabled .page-header {
|
||||
position: relative !important;
|
||||
}
|
||||
|
||||
.separate-containers .site-main > .generate-columns-container {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.masonry-container.are-images-unloaded,
|
||||
.load-more.are-images-unloaded,
|
||||
.masonry-enabled #nav-below {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* columns */
|
||||
.generate-columns-container:not(.masonry-container) {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.generate-columns .inside-article {
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.generate-columns-activated.post-image-aligned-left .generate-columns-container article:not(.featured-column) .post-image,
|
||||
.generate-columns-activated.post-image-aligned-right .generate-columns-container article:not(.featured-column) .post-image {
|
||||
float: none;
|
||||
text-align: center;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.generate-columns-container .paging-navigation,
|
||||
.generate-columns-container .page-header {
|
||||
flex: 1 1 100%;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.generate-columns-container .paging-navigation {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.load-more:not(.has-svg-icon) .button.loading:before {
|
||||
content: "\e900";
|
||||
display: inline-block;
|
||||
font-family: "GP Premium";
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
line-height: 1;
|
||||
animation: spin 2s infinite linear;
|
||||
margin-right: 7px;
|
||||
}
|
||||
|
||||
.load-more .button:not(.loading) .gp-icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.load-more .gp-icon svg {
|
||||
animation: spin 2s infinite linear;
|
||||
margin-right: 7px;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.generate-columns {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.generate-columns.grid-20,
|
||||
.grid-sizer.grid-20 {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.generate-columns.grid-25,
|
||||
.grid-sizer.grid-25 {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.generate-columns.grid-33,
|
||||
.grid-sizer.grid-33 {
|
||||
width: 33.3333%;
|
||||
}
|
||||
|
||||
.generate-columns.grid-50,
|
||||
.grid-sizer.grid-50 {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.generate-columns.grid-60,
|
||||
.grid-sizer.grid-60 {
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
.generate-columns.grid-66,
|
||||
.grid-sizer.grid-66 {
|
||||
width: 66.66667%;
|
||||
}
|
||||
|
||||
.generate-columns.grid-100,
|
||||
.grid-sizer.grid-100 {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) and (max-width: 1024px) {
|
||||
.generate-columns.tablet-grid-50,
|
||||
.grid-sizer.tablet-grid-50 {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.generate-columns-activated .generate-columns-container {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
.generate-columns-container > *,
|
||||
.generate-columns-container .generate-columns {
|
||||
padding-left: 0;
|
||||
}
|
||||
.generate-columns-container .page-header {
|
||||
margin-left: 0;
|
||||
}
|
||||
.generate-columns.mobile-grid-100,
|
||||
.grid-sizer.mobile-grid-100 {
|
||||
width: 100%;
|
||||
}
|
||||
.generate-columns-container > .paging-navigation {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.load-more {
|
||||
display: block;
|
||||
text-align: center;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
1
wp-content/upgrade-temp-backup/plugins/gp-premium/blog/functions/css/style.min.css
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
defined( 'WPINC' ) or die;
|
||||
|
||||
if ( ! function_exists( 'generate_blog_get_defaults' ) ) {
|
||||
/**
|
||||
* Set our defaults
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_blog_get_defaults() {
|
||||
$generate_blog_defaults = array(
|
||||
'excerpt_length' => '55',
|
||||
'read_more' => __( 'Read more', 'gp-premium' ),
|
||||
'read_more_button' => false,
|
||||
'masonry' => false,
|
||||
'masonry_load_more' => __( '+ More', 'gp-premium' ),
|
||||
'masonry_loading' => __( 'Loading...', 'gp-premium' ),
|
||||
'infinite_scroll' => false,
|
||||
'infinite_scroll_button' => false,
|
||||
'post_image' => true,
|
||||
'post_image_position' => '',
|
||||
'post_image_alignment' => 'post-image-aligned-center',
|
||||
'post_image_size' => 'full',
|
||||
'post_image_width' => '',
|
||||
'post_image_height' => '',
|
||||
'post_image_padding' => true,
|
||||
'single_post_image' => true,
|
||||
'single_post_image_position' => 'inside-content',
|
||||
'single_post_image_alignment' => 'center',
|
||||
'single_post_image_size' => 'full',
|
||||
'single_post_image_width' => '',
|
||||
'single_post_image_height' => '',
|
||||
'single_post_image_padding' => true,
|
||||
'page_post_image' => true,
|
||||
'page_post_image_position' => 'above-content',
|
||||
'page_post_image_alignment' => 'center',
|
||||
'page_post_image_size' => 'full',
|
||||
'page_post_image_width' => '',
|
||||
'page_post_image_height' => '',
|
||||
'page_post_image_padding' => true,
|
||||
'date' => true,
|
||||
'author' => true,
|
||||
'categories' => true,
|
||||
'tags' => true,
|
||||
'comments' => true,
|
||||
'single_date' => true,
|
||||
'single_author' => true,
|
||||
'single_categories' => true,
|
||||
'single_tags' => true,
|
||||
'single_post_navigation' => true,
|
||||
'column_layout' => false,
|
||||
'columns' => '50',
|
||||
'featured_column' => false,
|
||||
);
|
||||
|
||||
return apply_filters( 'generate_blog_option_defaults', $generate_blog_defaults );
|
||||
}
|
||||
}
|
@ -0,0 +1,754 @@
|
||||
<?php
|
||||
defined( 'WPINC' ) or die;
|
||||
|
||||
// Pull in our defaults and functions
|
||||
require plugin_dir_path( __FILE__ ) . 'defaults.php';
|
||||
require plugin_dir_path( __FILE__ ) . 'images.php';
|
||||
require plugin_dir_path( __FILE__ ) . 'columns.php';
|
||||
require plugin_dir_path( __FILE__ ) . 'customizer.php';
|
||||
require plugin_dir_path( __FILE__ ) . 'migrate.php';
|
||||
|
||||
if ( ! function_exists( 'generate_blog_scripts' ) ) {
|
||||
add_action( 'wp_enqueue_scripts', 'generate_blog_scripts', 50 );
|
||||
/**
|
||||
* Enqueue scripts and styles
|
||||
*/
|
||||
function generate_blog_scripts() {
|
||||
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
||||
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
wp_add_inline_style( 'generate-style', generate_blog_css() );
|
||||
wp_add_inline_style( 'generate-style', generate_blog_columns_css() );
|
||||
|
||||
$deps = array();
|
||||
|
||||
if ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) {
|
||||
$deps[] = 'masonry';
|
||||
$deps[] = 'imagesloaded';
|
||||
}
|
||||
|
||||
if ( $settings[ 'infinite_scroll' ] && ! is_singular() && ! is_404() && ! is_post_type_archive( 'product' ) ) {
|
||||
$deps[] = 'infinite-scroll';
|
||||
wp_enqueue_script( 'infinite-scroll', plugin_dir_url( __FILE__ ) . 'js/infinite-scroll.pkgd.min.js', array(), '3.0.6', true );
|
||||
|
||||
$font_icons = true;
|
||||
|
||||
if ( function_exists( 'generate_get_option' ) ) {
|
||||
if ( 'font' !== generate_get_option( 'icons' ) ) {
|
||||
$font_icons = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $settings['infinite_scroll_button'] && $font_icons ) {
|
||||
wp_enqueue_style( 'gp-premium-icons' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) || ( $settings[ 'infinite_scroll' ] && ! is_singular() && ! is_404() && ! is_post_type_archive( 'product' ) ) ) {
|
||||
wp_enqueue_script( 'generate-blog', plugin_dir_url( __FILE__ ) . "js/scripts{$suffix}.js", $deps, GENERATE_BLOG_VERSION, true );
|
||||
|
||||
wp_localize_script(
|
||||
'generate-blog',
|
||||
'generateBlog',
|
||||
array(
|
||||
'more' => $settings['masonry_load_more'],
|
||||
'loading' => $settings['masonry_loading'],
|
||||
'icon' => function_exists( 'generate_get_svg_icon' ) ? generate_get_svg_icon( 'spinner' ) : '',
|
||||
'masonryInit' => apply_filters(
|
||||
'generate_blog_masonry_init',
|
||||
array(
|
||||
'columnWidth' => '.grid-sizer',
|
||||
'itemSelector' => '.masonry-post',
|
||||
'stamp' => '.page-header',
|
||||
'percentPosition' => true,
|
||||
'stagger' => 30,
|
||||
'visibleStyle' => array(
|
||||
'transform' => 'translateY(0)',
|
||||
'opacity' => 1,
|
||||
),
|
||||
'hiddenStyle' => array(
|
||||
'transform' => 'translateY(5px)',
|
||||
'opacity' => 0,
|
||||
),
|
||||
)
|
||||
),
|
||||
'infiniteScrollInit' => apply_filters(
|
||||
'generate_blog_infinite_scroll_init',
|
||||
array(
|
||||
'path' => '.infinite-scroll-path a',
|
||||
'append' => '#main .infinite-scroll-item',
|
||||
'history' => false,
|
||||
'loadOnScroll' => $settings['infinite_scroll_button'] ? false : true,
|
||||
'button' => $settings['infinite_scroll_button'] ? '.load-more a' : null,
|
||||
'scrollThreshold' => $settings['infinite_scroll_button'] ? false : 600,
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$needs_columns_css = false;
|
||||
$needs_featured_image_css = false;
|
||||
|
||||
if ( generate_blog_get_columns() || $settings['infinite_scroll'] ) {
|
||||
$needs_columns_css = true;
|
||||
}
|
||||
|
||||
if ( ! is_singular() ) {
|
||||
if ( $settings['post_image'] ) {
|
||||
$needs_featured_image_css = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_page() && has_post_thumbnail() ) {
|
||||
if ( $settings['page_post_image'] ) {
|
||||
$needs_featured_image_css = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_single() && has_post_thumbnail() ) {
|
||||
if ( $settings['single_post_image'] ) {
|
||||
$needs_featured_image_css = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $needs_columns_css && $needs_featured_image_css ) {
|
||||
wp_enqueue_style( 'generate-blog', plugin_dir_url( __FILE__ ) . "css/style{$suffix}.css", array(), GENERATE_BLOG_VERSION );
|
||||
} elseif ( $needs_columns_css ) {
|
||||
wp_enqueue_style( 'generate-blog-columns', plugin_dir_url( __FILE__ ) . "css/columns{$suffix}.css", array(), GENERATE_BLOG_VERSION );
|
||||
} elseif ( $needs_featured_image_css ) {
|
||||
wp_enqueue_style( 'generate-blog-images', plugin_dir_url( __FILE__ ) . "css/featured-images{$suffix}.css", array(), GENERATE_BLOG_VERSION );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_post_classes' ) ) {
|
||||
add_filter( 'post_class', 'generate_blog_post_classes' );
|
||||
/**
|
||||
* Adds custom classes to the content container
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_blog_post_classes( $classes ) {
|
||||
// Don't add these classes to the GB Query Loop block items.
|
||||
if ( in_array( 'gb-query-loop-item', $classes ) ) {
|
||||
return $classes;
|
||||
}
|
||||
|
||||
global $wp_query;
|
||||
$paged = get_query_var( 'paged' );
|
||||
$paged = $paged ? $paged : 1;
|
||||
|
||||
// Get our options
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( $settings['infinite_scroll'] ) {
|
||||
$classes[] = 'infinite-scroll-item';
|
||||
}
|
||||
|
||||
// Set our masonry class
|
||||
if ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) {
|
||||
$classes[] = 'masonry-post';
|
||||
}
|
||||
|
||||
// Set our column classes
|
||||
if ( generate_blog_get_columns() && ! is_singular() ) {
|
||||
$classes[] = 'generate-columns';
|
||||
$classes[] = 'tablet-grid-50';
|
||||
$classes[] = 'mobile-grid-100';
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
// Set our featured column class
|
||||
if ( $wp_query->current_post == 0 && $paged == 1 && $settings['featured_column'] ) {
|
||||
if ( 50 == generate_blog_get_column_count() ) {
|
||||
$classes[] = 'grid-100';
|
||||
}
|
||||
|
||||
if ( 33 == generate_blog_get_column_count() ) {
|
||||
$classes[] = 'grid-66';
|
||||
}
|
||||
|
||||
if ( 25 == generate_blog_get_column_count() ) {
|
||||
$classes[] = 'grid-50';
|
||||
}
|
||||
|
||||
if ( 20 == generate_blog_get_column_count() ) {
|
||||
$classes[] = 'grid-60';
|
||||
}
|
||||
$classes[] = 'featured-column';
|
||||
} else {
|
||||
$classes[] = 'grid-' . generate_blog_get_column_count();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $settings['post_image_padding'] && ! is_singular() ) {
|
||||
$classes[] = 'no-featured-image-padding';
|
||||
}
|
||||
|
||||
$location = generate_blog_get_singular_template();
|
||||
|
||||
if ( ! $settings[$location . '_post_image_padding'] && is_singular() ) {
|
||||
$classes[] = 'no-featured-image-padding';
|
||||
}
|
||||
|
||||
$atts = generate_get_blog_image_attributes();
|
||||
|
||||
if ( ! is_singular() && has_post_thumbnail() && ! empty( $atts ) ) {
|
||||
$values = array(
|
||||
$atts['width'],
|
||||
$atts['height'],
|
||||
$atts['crop'],
|
||||
);
|
||||
|
||||
$image_src = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID(), 'full' ), $values );
|
||||
|
||||
if ( $image_src && ( ! $image_src[3] || ! apply_filters( 'generate_use_featured_image_size_match', true ) ) ) {
|
||||
$classes[] = 'resize-featured-image';
|
||||
}
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_body_classes' ) ) {
|
||||
add_filter( 'body_class', 'generate_blog_body_classes' );
|
||||
/**
|
||||
* Adds custom classes to the body
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_blog_body_classes( $classes ) {
|
||||
// Get theme options
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( is_singular() ) {
|
||||
$location = generate_blog_get_singular_template();
|
||||
|
||||
if ( 'below-title' == $settings[$location . '_post_image_position'] ) {
|
||||
$classes[] = 'post-image-below-header';
|
||||
}
|
||||
|
||||
if ( 'inside-content' == $settings[$location . '_post_image_position'] ) {
|
||||
$classes[] = 'post-image-above-header';
|
||||
}
|
||||
|
||||
$classes[] = ( ! empty( $settings[$location . '_post_image_alignment'] ) ) ? 'post-image-aligned-' . $settings[$location . '_post_image_alignment'] : 'post-image-aligned-center';
|
||||
} else {
|
||||
$classes[] = ( '' == $settings['post_image_position'] ) ? 'post-image-below-header' : 'post-image-above-header';
|
||||
$classes[] = ( ! empty( $settings['post_image_alignment'] ) ) ? $settings['post_image_alignment'] : 'post-image-aligned-center';
|
||||
}
|
||||
|
||||
if ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) {
|
||||
$classes[] = 'masonry-enabled';
|
||||
}
|
||||
|
||||
if ( generate_blog_get_columns() && ! is_singular() ) {
|
||||
$classes[] = 'generate-columns-activated';
|
||||
}
|
||||
|
||||
if ( $settings[ 'infinite_scroll' ] && ! is_singular() ) {
|
||||
$classes[] = 'infinite-scroll';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_excerpt_length' ) ) {
|
||||
add_filter( 'excerpt_length', 'generate_excerpt_length', 15 );
|
||||
/**
|
||||
* Set our excerpt length
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_excerpt_length( $length ) {
|
||||
$generate_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
return absint( apply_filters( 'generate_excerpt_length', $generate_settings['excerpt_length'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_css' ) ) {
|
||||
/**
|
||||
* Build our inline CSS
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_blog_css() {
|
||||
global $post;
|
||||
$return = '';
|
||||
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( ! defined( 'GENERATE_VERSION' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( version_compare( GENERATE_VERSION, '3.0.0-alpha.1', '<' ) ) {
|
||||
// Get disable headline meta.
|
||||
$disable_headline = ( isset( $post ) ) ? get_post_meta( $post->ID, '_generate-disable-headline', true ) : '';
|
||||
|
||||
if ( ! $settings['categories'] && ! $settings['comments'] && ! $settings['tags'] && ! is_singular() ) {
|
||||
$return .= '.blog footer.entry-meta, .archive footer.entry-meta {display:none;}';
|
||||
}
|
||||
|
||||
if ( ! $settings['single_date'] && ! $settings['single_author'] && $disable_headline && is_singular() ) {
|
||||
$return .= '.single .entry-header{display:none;}.single .entry-content {margin-top:0;}';
|
||||
}
|
||||
|
||||
if ( ! $settings['date'] && ! $settings['author'] && ! is_singular() ) {
|
||||
$return .= '.entry-header .entry-meta {display:none;}';
|
||||
}
|
||||
|
||||
if ( ! $settings['single_date'] && ! $settings['single_author'] && is_singular() ) {
|
||||
$return .= '.entry-header .entry-meta {display:none;}';
|
||||
}
|
||||
|
||||
if ( ! $settings['single_post_navigation'] && is_singular() ) {
|
||||
$return .= '.post-navigation {display:none;}';
|
||||
}
|
||||
|
||||
if ( ! $settings['single_categories'] && ! $settings['single_post_navigation'] && ! $settings['single_tags'] && is_singular() ) {
|
||||
$return .= '.single footer.entry-meta {display:none;}';
|
||||
}
|
||||
}
|
||||
|
||||
$separator = 20;
|
||||
$content_padding_top = 40;
|
||||
$content_padding_right = 40;
|
||||
$content_padding_left = 40;
|
||||
$mobile_content_padding_top = 30;
|
||||
$mobile_content_padding_right = 30;
|
||||
$mobile_content_padding_left = 30;
|
||||
|
||||
if ( function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
generate_spacing_get_defaults()
|
||||
);
|
||||
|
||||
$separator = absint( $spacing_settings['separator'] );
|
||||
$content_padding_top = absint( $spacing_settings['content_top'] );
|
||||
$content_padding_right = absint( $spacing_settings['content_right'] );
|
||||
$content_padding_left = absint( $spacing_settings['content_left'] );
|
||||
$mobile_content_padding_top = absint( $spacing_settings['mobile_content_top'] );
|
||||
$mobile_content_padding_right = absint( $spacing_settings['mobile_content_right'] );
|
||||
$mobile_content_padding_left = absint( $spacing_settings['mobile_content_left'] );
|
||||
}
|
||||
|
||||
if ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) {
|
||||
$return .= '.page-header {margin-bottom: ' . $separator . 'px;margin-left: ' . $separator . 'px}';
|
||||
}
|
||||
|
||||
if ( $settings[ 'infinite_scroll' ] && ! is_singular() ) {
|
||||
$return .= '#nav-below {display:none;}';
|
||||
}
|
||||
|
||||
if ( ! $settings['post_image_padding'] && 'post-image-aligned-center' == $settings['post_image_alignment'] && ! is_singular() ) {
|
||||
$return .= '.no-featured-image-padding .post-image {margin-left:-' . $content_padding_left . 'px;margin-right:-' . $content_padding_right . 'px;}';
|
||||
$return .= '.post-image-above-header .no-featured-image-padding .inside-article .post-image {margin-top:-' . $content_padding_top . 'px;}';
|
||||
}
|
||||
|
||||
$location = generate_blog_get_singular_template();
|
||||
|
||||
if ( ! $settings[$location . '_post_image_padding'] && 'center' == $settings[$location . '_post_image_alignment'] && is_singular() ) {
|
||||
$return .= '.no-featured-image-padding .featured-image {margin-left:-' . $content_padding_left . 'px;margin-right:-' . $content_padding_right . 'px;}';
|
||||
$return .= '.post-image-above-header .no-featured-image-padding .inside-article .featured-image {margin-top:-' . $content_padding_top . 'px;}';
|
||||
}
|
||||
|
||||
if ( ! $settings['page_post_image_padding'] || ! $settings['single_post_image_padding'] || ! $settings['post_image_padding'] ) {
|
||||
$return .= '@media ' . generate_premium_get_media_query( 'mobile' ) . '{';
|
||||
if ( ! $settings['post_image_padding'] && 'post-image-aligned-center' == $settings['post_image_alignment'] && ! is_singular() ) {
|
||||
$return .= '.no-featured-image-padding .post-image {margin-left:-' . $mobile_content_padding_left . 'px;margin-right:-' . $mobile_content_padding_right . 'px;}';
|
||||
$return .= '.post-image-above-header .no-featured-image-padding .inside-article .post-image {margin-top:-' . $mobile_content_padding_top . 'px;}';
|
||||
}
|
||||
|
||||
if ( ! $settings[$location . '_post_image_padding'] && 'center' == $settings[$location . '_post_image_alignment'] && is_singular() ) {
|
||||
$return .= '.no-featured-image-padding .featured-image {margin-left:-' . $mobile_content_padding_left . 'px;margin-right:-' . $mobile_content_padding_right . 'px;}';
|
||||
$return .= '.post-image-above-header .no-featured-image-padding .inside-article .featured-image {margin-top:-' . $mobile_content_padding_top . 'px;}';
|
||||
}
|
||||
$return .= '}';
|
||||
}
|
||||
|
||||
$atts = generate_get_blog_image_attributes();
|
||||
|
||||
if ( ! empty( $atts ) ) {
|
||||
$image_width = $atts['width'] && 9999 !== $atts['width'] ? 'width: ' . $atts['width'] . 'px;' : '';
|
||||
$image_height = $atts['height'] && 9999 !== $atts['height'] ? 'height: ' . $atts['height'] . 'px;' : '';
|
||||
$image_crop = $atts['crop'] ? '-o-object-fit: cover;object-fit: cover;' : '';
|
||||
|
||||
if ( ! $image_width && $image_height ) {
|
||||
$image_crop = '-o-object-fit: cover;object-fit: cover;';
|
||||
}
|
||||
|
||||
if ( ! is_singular() ) {
|
||||
$return .= '.resize-featured-image .post-image img {' . $image_width . $image_height . $image_crop . '}';
|
||||
}
|
||||
|
||||
if ( is_single() || is_page() ) {
|
||||
$values = array(
|
||||
$atts['width'],
|
||||
$atts['height'],
|
||||
$atts['crop'],
|
||||
);
|
||||
|
||||
$image_src = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID(), 'full' ), $values );
|
||||
|
||||
if ( $image_src && ( ! $image_src[3] || ! apply_filters( 'generate_use_featured_image_size_match', true ) ) ) {
|
||||
$return .= '.featured-image img {' . $image_width . $image_height . $image_crop . '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'generate_excerpt_more_text', 'generate_blog_set_read_more_text' );
|
||||
/**
|
||||
* Set the read more text with our Customizer setting.
|
||||
*
|
||||
* @param string $text The read more text.
|
||||
*/
|
||||
function generate_blog_set_read_more_text( $text ) {
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( $settings['read_more'] ) {
|
||||
return wp_kses_post( $settings['read_more'] );
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_excerpt_more' ) ) {
|
||||
add_filter( 'excerpt_more', 'generate_blog_excerpt_more', 15 );
|
||||
/**
|
||||
* Prints the read more HTML
|
||||
*/
|
||||
function generate_blog_excerpt_more( $more ) {
|
||||
$generate_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( '' == $generate_settings['read_more'] ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// We don't need to overwrite the entire element just to change its text.
|
||||
// If we can filter the text, stop here.
|
||||
if ( function_exists( 'generate_get_read_more_text' ) ) {
|
||||
return $more;
|
||||
}
|
||||
|
||||
return apply_filters(
|
||||
'generate_excerpt_more_output',
|
||||
sprintf(
|
||||
' ... <a title="%1$s" class="read-more" href="%2$s" aria-label="%4$s">%3$s</a>',
|
||||
the_title_attribute( 'echo=0' ),
|
||||
esc_url( get_permalink( get_the_ID() ) ),
|
||||
wp_kses_post( $generate_settings['read_more'] ),
|
||||
sprintf(
|
||||
/* translators: Aria-label describing the read more button */
|
||||
_x( 'More on %s', 'more on post title', 'gp-premium' ),
|
||||
the_title_attribute( 'echo=0' )
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_content_more' ) ) {
|
||||
add_filter( 'the_content_more_link', 'generate_blog_content_more', 15 );
|
||||
/**
|
||||
* Prints the read more HTML
|
||||
*/
|
||||
function generate_blog_content_more( $more ) {
|
||||
$generate_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( '' == $generate_settings['read_more'] ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// We don't need to overwrite the entire element just to change its text.
|
||||
// If we can filter the text, stop here.
|
||||
if ( function_exists( 'generate_get_read_more_text' ) ) {
|
||||
return $more;
|
||||
}
|
||||
|
||||
return apply_filters(
|
||||
'generate_content_more_link_output',
|
||||
sprintf(
|
||||
'<p class="read-more-container"><a title="%1$s" class="read-more content-read-more" href="%2$s" aria-label="%4$s">%3$s</a></p>',
|
||||
the_title_attribute( 'echo=0' ),
|
||||
esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump', '#more-' . get_the_ID() ) ),
|
||||
wp_kses_post( $generate_settings['read_more'] ),
|
||||
sprintf(
|
||||
/* translators: Aria-label describing the read more button */
|
||||
_x( 'More on %s', 'more on post title', 'gp-premium' ),
|
||||
the_title_attribute( 'echo=0' )
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the setting and returns false if $thing is disabled
|
||||
*
|
||||
* @since 1.4
|
||||
*
|
||||
* @param String $data The original data, passed through if not disabled
|
||||
* @param String $thing The name of the thing to check
|
||||
* @return String|False The original data, or false (if disabled)
|
||||
*/
|
||||
function generate_disable_post_thing( $data, $thing ) {
|
||||
$generate_blog_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( ! $generate_blog_settings[$thing] ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_disable_post_date' ) ) {
|
||||
add_filter( 'generate_post_date', 'generate_disable_post_date' );
|
||||
/**
|
||||
* Remove the post date if set
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_disable_post_date( $date ) {
|
||||
if ( is_singular() ) {
|
||||
return generate_disable_post_thing( $date, 'single_date' );
|
||||
} else {
|
||||
return generate_disable_post_thing( $date, 'date' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_disable_post_author' ) ) {
|
||||
add_filter( 'generate_post_author', 'generate_disable_post_author' );
|
||||
/**
|
||||
* Set the author if set
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_disable_post_author( $author ) {
|
||||
if ( is_singular() ) {
|
||||
return generate_disable_post_thing( $author, 'single_author' );
|
||||
} else {
|
||||
return generate_disable_post_thing( $author, 'author' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_disable_post_categories' ) ) {
|
||||
add_filter( 'generate_show_categories', 'generate_disable_post_categories' );
|
||||
/**
|
||||
* Remove the categories if set
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_disable_post_categories( $categories ) {
|
||||
if ( is_singular() ) {
|
||||
return generate_disable_post_thing( $categories, 'single_categories' );
|
||||
} else {
|
||||
return generate_disable_post_thing( $categories, 'categories' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_disable_post_tags' ) ) {
|
||||
add_filter( 'generate_show_tags', 'generate_disable_post_tags' );
|
||||
/**
|
||||
* Remove the tags if set
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_disable_post_tags( $tags ) {
|
||||
if ( is_singular() ) {
|
||||
return generate_disable_post_thing( $tags, 'single_tags' );
|
||||
} else {
|
||||
return generate_disable_post_thing( $tags, 'tags' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_disable_post_comments_link' ) ) {
|
||||
add_filter( 'generate_show_comments', 'generate_disable_post_comments_link' );
|
||||
/**
|
||||
* Remove the link to comments if set
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_disable_post_comments_link( $comments_link ) {
|
||||
return generate_disable_post_thing( $comments_link, 'comments' );
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'generate_show_post_navigation', 'generate_disable_post_navigation' );
|
||||
/**
|
||||
* Remove the single post navigation
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
function generate_disable_post_navigation( $navigation ) {
|
||||
if ( is_singular() ) {
|
||||
return generate_disable_post_thing( $navigation, 'single_post_navigation' );
|
||||
} else {
|
||||
return $navigation;
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'generate_excerpt_more_output', 'generate_blog_read_more_button' );
|
||||
add_filter( 'generate_content_more_link_output', 'generate_blog_read_more_button' );
|
||||
/**
|
||||
* Add the button class to our read more link if set.
|
||||
*
|
||||
* @since 1.5
|
||||
*
|
||||
* @param string $output Our existing read more link.
|
||||
*/
|
||||
function generate_blog_read_more_button( $output ) {
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( ! $settings['read_more_button'] ) {
|
||||
return $output;
|
||||
}
|
||||
|
||||
$aria_label = function_exists( 'generate_get_read_more_aria_label' )
|
||||
? generate_get_read_more_aria_label()
|
||||
: sprintf(
|
||||
/* translators: Aria-label describing the read more button */
|
||||
_x( 'More on %s', 'more on post title', 'gp-premium' ),
|
||||
the_title_attribute( 'echo=0' )
|
||||
);
|
||||
|
||||
return sprintf(
|
||||
'%5$s<p class="read-more-container"><a title="%1$s" class="read-more button" href="%2$s" aria-label="%4$s">%3$s</a></p>',
|
||||
the_title_attribute( 'echo=0' ),
|
||||
esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump', '#more-' . get_the_ID() ) ),
|
||||
wp_kses_post( $settings['read_more'] ),
|
||||
$aria_label,
|
||||
'generate_excerpt_more_output' === current_filter() ? ' ... ' : ''
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_load_more' ) ) {
|
||||
add_action( 'generate_after_main_content', 'generate_blog_load_more', 20 );
|
||||
/**
|
||||
* Build our load more button
|
||||
*/
|
||||
function generate_blog_load_more() {
|
||||
// Get theme options
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( ( ! $settings[ 'infinite_scroll_button' ] || ! $settings[ 'infinite_scroll' ] ) || is_singular() || is_404() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $wp_query;
|
||||
|
||||
if ( $wp_query->max_num_pages < 2 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_post_type_archive( 'product' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_tax( 'product_cat' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$icon = '';
|
||||
|
||||
if ( function_exists( 'generate_get_svg_icon' ) ) {
|
||||
$icon = generate_get_svg_icon( 'spinner' );
|
||||
}
|
||||
|
||||
printf(
|
||||
'<div class="masonry-load-more load-more %1$s %2$s">
|
||||
<a class="button" href="#">%3$s%4$s</a>
|
||||
</div>',
|
||||
$icon ? 'has-svg-icon' : '',
|
||||
( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) ? 'are-images-unloaded' : '',
|
||||
$icon,
|
||||
wp_kses_post( $settings['masonry_load_more'] )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see whether we're getting page or single post options.
|
||||
*
|
||||
* @since 1.5
|
||||
*
|
||||
* @return string Name of our singular template
|
||||
*/
|
||||
function generate_blog_get_singular_template() {
|
||||
$template = 'single';
|
||||
|
||||
if ( is_page() ) {
|
||||
$template = 'page';
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
add_action( 'generate_after_footer', 'generate_blog_do_infinite_scroll_path', 500 );
|
||||
/**
|
||||
* Add a next page of posts link for infinite scroll.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function generate_blog_do_infinite_scroll_path() {
|
||||
if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( $settings['infinite_scroll'] && ! is_singular() && ! is_404() ) {
|
||||
printf(
|
||||
'<div class="infinite-scroll-path" aria-hidden="true" style="display: none;">%s</div>',
|
||||
get_next_posts_link()
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,369 @@
|
||||
<?php
|
||||
/**
|
||||
* Functions specific to featured images.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
/**
|
||||
* Collects all available image sizes which we use in the Customizer.
|
||||
*
|
||||
* @since 1.10.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function generate_blog_get_image_sizes() {
|
||||
$sizes = get_intermediate_image_sizes();
|
||||
|
||||
$new_sizes = array(
|
||||
'full' => 'full',
|
||||
);
|
||||
|
||||
foreach ( $sizes as $key => $name ) {
|
||||
$new_sizes[ $name ] = $name;
|
||||
}
|
||||
|
||||
return $new_sizes;
|
||||
}
|
||||
|
||||
add_filter( 'generate_page_header_default_size', 'generate_blog_set_featured_image_size' );
|
||||
/**
|
||||
* Set our featured image sizes.
|
||||
*
|
||||
* @since 1.10.0
|
||||
*
|
||||
* @param string $size The existing size.
|
||||
* @return string The new size.
|
||||
*/
|
||||
function generate_blog_set_featured_image_size( $size ) {
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( ! is_singular() ) {
|
||||
$size = $settings['post_image_size'];
|
||||
}
|
||||
|
||||
if ( is_single() ) {
|
||||
$size = $settings['single_post_image_size'];
|
||||
}
|
||||
|
||||
if ( is_page() ) {
|
||||
$size = $settings['page_post_image_size'];
|
||||
}
|
||||
|
||||
$atts = generate_get_blog_image_attributes();
|
||||
|
||||
if ( ! empty( $atts ) ) {
|
||||
$values = array(
|
||||
$atts['width'],
|
||||
$atts['height'],
|
||||
$atts['crop'],
|
||||
);
|
||||
|
||||
$image_src = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID(), 'full' ), $values );
|
||||
|
||||
if ( $image_src && $image_src[3] && apply_filters( 'generate_use_featured_image_size_match', true ) ) {
|
||||
return $values;
|
||||
} else {
|
||||
return $size;
|
||||
}
|
||||
}
|
||||
|
||||
return $size;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_get_blog_image_attributes' ) ) {
|
||||
/**
|
||||
* Build our image attributes
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_get_blog_image_attributes() {
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( is_singular() ) {
|
||||
if ( is_singular( 'page' ) ) {
|
||||
$single = 'page_';
|
||||
} else {
|
||||
$single = 'single_';
|
||||
}
|
||||
} else {
|
||||
$single = '';
|
||||
}
|
||||
|
||||
$ignore_crop = array( '', '0', '9999' );
|
||||
|
||||
$atts = array(
|
||||
'width' => ( in_array( $settings[ "{$single}post_image_width" ], $ignore_crop ) ) ? 9999 : absint( $settings[ "{$single}post_image_width" ] ),
|
||||
'height' => ( in_array( $settings[ "{$single}post_image_height" ], $ignore_crop ) ) ? 9999 : absint( $settings[ "{$single}post_image_height" ] ),
|
||||
'crop' => ( in_array( $settings[ "{$single}post_image_width" ], $ignore_crop ) || in_array( $settings[ "{$single}post_image_height" ], $ignore_crop ) ) ? false : true,
|
||||
);
|
||||
|
||||
// If there's no height or width, empty the array.
|
||||
if ( 9999 == $atts['width'] && 9999 == $atts['height'] ) { // phpcs:ignore
|
||||
$atts = array();
|
||||
}
|
||||
|
||||
return apply_filters( 'generate_blog_image_attributes', $atts );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_setup' ) ) {
|
||||
add_action( 'wp', 'generate_blog_setup', 50 );
|
||||
/**
|
||||
* Setup our blog functions and actions
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_blog_setup() {
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
// Move our featured images to above the title.
|
||||
if ( 'post-image-above-header' === $settings['post_image_position'] ) {
|
||||
remove_action( 'generate_after_entry_header', 'generate_post_image' );
|
||||
add_action( 'generate_before_content', 'generate_post_image' );
|
||||
|
||||
// If we're using the Page Header add-on, move those as well.
|
||||
if ( function_exists( 'generate_page_header_post_image' ) ) {
|
||||
remove_action( 'generate_after_entry_header', 'generate_page_header_post_image' );
|
||||
add_action( 'generate_before_content', 'generate_page_header_post_image' );
|
||||
}
|
||||
}
|
||||
|
||||
$page_header_content = false;
|
||||
if ( function_exists( 'generate_page_header_get_options' ) ) {
|
||||
$options = generate_page_header_get_options();
|
||||
|
||||
if ( $options && '' !== $options['content'] ) {
|
||||
$page_header_content = true;
|
||||
}
|
||||
|
||||
// If our Page Header has no content, remove it.
|
||||
// This will allow the Blog add-on to add an image for us.
|
||||
if ( ! $page_header_content && is_singular() ) {
|
||||
remove_action( 'generate_before_content', 'generate_page_header' );
|
||||
remove_action( 'generate_after_entry_header', 'generate_page_header' );
|
||||
remove_action( 'generate_after_header', 'generate_page_header' );
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the core theme featured image.
|
||||
// I would like to filter instead one day.
|
||||
remove_action( 'generate_after_header', 'generate_featured_page_header' );
|
||||
remove_action( 'generate_before_content', 'generate_featured_page_header_inside_single' );
|
||||
|
||||
$location = generate_blog_get_singular_template();
|
||||
|
||||
if ( $settings[ $location . '_post_image' ] && is_singular() && ! $page_header_content ) {
|
||||
if ( 'below-title' === $settings[ $location . '_post_image_position' ] ) {
|
||||
add_action( 'generate_after_entry_header', 'generate_blog_single_featured_image' );
|
||||
}
|
||||
|
||||
if ( 'inside-content' === $settings[ $location . '_post_image_position' ] ) {
|
||||
add_action( 'generate_before_content', 'generate_blog_single_featured_image' );
|
||||
}
|
||||
|
||||
if ( 'above-content' === $settings[ $location . '_post_image_position' ] ) {
|
||||
add_action( 'generate_after_header', 'generate_blog_single_featured_image' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'generate_featured_image_output', 'generate_blog_featured_image' );
|
||||
/**
|
||||
* Remove featured image if set or using WooCommerce.
|
||||
*
|
||||
* @since 1.5
|
||||
* @param string $output The existing output.
|
||||
* @return string The image HTML
|
||||
*/
|
||||
function generate_blog_featured_image( $output ) {
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) || ! $settings['post_image'] ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build our featured images for single posts and pages.
|
||||
*
|
||||
* This function is way more complicated than it could be so it can
|
||||
* ensure compatibility with the Page Header add-on.
|
||||
*
|
||||
* @since 1.5
|
||||
*
|
||||
* @return string The image HTML
|
||||
*/
|
||||
function generate_blog_single_featured_image() {
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
$image_id = get_post_thumbnail_id( get_the_ID(), 'full' );
|
||||
|
||||
if ( function_exists( 'generate_page_header_get_image' ) && generate_page_header_get_image( 'ID' ) ) {
|
||||
if ( intval( $image_id ) !== generate_page_header_get_image( 'ID' ) ) {
|
||||
$image_id = generate_page_header_get_image( 'ID' );
|
||||
}
|
||||
}
|
||||
|
||||
$location = generate_blog_get_singular_template();
|
||||
|
||||
if ( ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) || ! $settings[ $location . '_post_image' ] || ! $image_id ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$attrs = array(
|
||||
'itemprop' => 'image',
|
||||
);
|
||||
|
||||
if ( function_exists( 'generate_get_schema_type' ) ) {
|
||||
if ( 'microdata' !== generate_get_schema_type() ) {
|
||||
$attrs = array();
|
||||
}
|
||||
}
|
||||
|
||||
$attrs['loading'] = false;
|
||||
$attrs = apply_filters( 'generate_single_featured_image_attrs', $attrs );
|
||||
|
||||
$image_html = apply_filters(
|
||||
'post_thumbnail_html', // phpcs:ignore -- Core filter.
|
||||
wp_get_attachment_image(
|
||||
$image_id,
|
||||
apply_filters( 'generate_page_header_default_size', 'full' ),
|
||||
'',
|
||||
$attrs
|
||||
),
|
||||
get_the_ID(),
|
||||
$image_id,
|
||||
apply_filters( 'generate_page_header_default_size', 'full' ),
|
||||
''
|
||||
);
|
||||
|
||||
$location = generate_blog_get_singular_template();
|
||||
|
||||
$classes = array(
|
||||
is_page() ? 'page-header-image' : null,
|
||||
is_singular() && ! is_page() ? 'page-header-image-single' : null,
|
||||
'above-content' === $settings[ $location . '_post_image_position' ] ? 'grid-container grid-parent' : null,
|
||||
);
|
||||
|
||||
$image_html = apply_filters( 'generate_single_featured_image_html', $image_html );
|
||||
|
||||
// phpcs:ignore -- No need to escape here.
|
||||
echo apply_filters(
|
||||
'generate_single_featured_image_output',
|
||||
sprintf(
|
||||
'<div class="featured-image %2$s">
|
||||
%1$s
|
||||
</div>',
|
||||
$image_html,
|
||||
implode( ' ', $classes )
|
||||
),
|
||||
$image_html
|
||||
);
|
||||
}
|
||||
|
||||
add_filter( 'generate_blog_image_attributes', 'generate_blog_page_header_image_atts' );
|
||||
/**
|
||||
* Filter our image attributes in case we're using differents atts in our Page Header
|
||||
*
|
||||
* @since 1.5
|
||||
*
|
||||
* @param array $atts Our existing image attributes.
|
||||
* @return array Image attributes
|
||||
*/
|
||||
function generate_blog_page_header_image_atts( $atts ) {
|
||||
if ( ! function_exists( 'generate_page_header_get_options' ) ) {
|
||||
return $atts;
|
||||
}
|
||||
|
||||
if ( ! is_singular() ) {
|
||||
return $atts;
|
||||
}
|
||||
|
||||
$options = generate_page_header_get_options();
|
||||
|
||||
if ( $options && 'enable' === $options['image_resize'] ) {
|
||||
$ignore_crop = array( '', '0', '9999' );
|
||||
|
||||
$atts = array(
|
||||
'width' => ( in_array( $options['image_width'], $ignore_crop ) ) ? 9999 : absint( $options['image_width'] ),
|
||||
'height' => ( in_array( $options['image_height'], $ignore_crop ) ) ? 9999 : absint( $options['image_height'] ),
|
||||
'crop' => ( in_array( $options['image_width'], $ignore_crop ) || in_array( $options['image_height'], $ignore_crop ) ) ? false : true,
|
||||
);
|
||||
}
|
||||
|
||||
return $atts;
|
||||
}
|
||||
|
||||
add_filter( 'generate_single_featured_image_html', 'generate_blog_page_header_link' );
|
||||
/**
|
||||
* Add our Page Header link to our featured image if set.
|
||||
*
|
||||
* @since 1.5
|
||||
*
|
||||
* @param string $image_html Our existing image HTML.
|
||||
* @return string Our new image HTML.
|
||||
*/
|
||||
function generate_blog_page_header_link( $image_html ) {
|
||||
if ( ! function_exists( 'generate_page_header_get_options' ) ) {
|
||||
return $image_html;
|
||||
}
|
||||
|
||||
$options = generate_page_header_get_options();
|
||||
|
||||
if ( ! empty( $options['image_link'] ) ) {
|
||||
return '<a href="' . esc_url( $options['image_link'] ) . '"' . apply_filters( 'generate_page_header_link_target', '' ) . '>' . $image_html . '</a>';
|
||||
} else {
|
||||
return $image_html;
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'body_class', 'generate_blog_remove_featured_image_class', 20 );
|
||||
/**
|
||||
* Remove the featured image classes if they're disabled.
|
||||
*
|
||||
* @since 2.1.0
|
||||
* @param array $classes The body classes.
|
||||
*/
|
||||
function generate_blog_remove_featured_image_class( $classes ) {
|
||||
if ( is_singular() ) {
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( is_single() ) {
|
||||
$disable_single_featured_image = ! $settings['single_post_image'];
|
||||
$classes = generate_premium_remove_featured_image_class( $classes, $disable_single_featured_image );
|
||||
}
|
||||
|
||||
if ( is_page() && ! $settings['page_post_image'] ) {
|
||||
$disable_page_featured_image = ! $settings['page_post_image'];
|
||||
$classes = generate_premium_remove_featured_image_class( $classes, $disable_page_featured_image );
|
||||
}
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
98
wp-content/upgrade-temp-backup/plugins/gp-premium/blog/functions/js/controls.js
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
jQuery( function( $ ) {
|
||||
// Featured image controls
|
||||
var featuredImageArchiveControls = [
|
||||
'generate_blog_settings-post_image',
|
||||
'generate_blog_settings-post_image_padding',
|
||||
'generate_blog_settings-post_image_position',
|
||||
'generate_blog_settings-post_image_alignment',
|
||||
'generate_blog_settings-post_image_size',
|
||||
'generate_blog_settings-post_image_width',
|
||||
'generate_blog_settings-post_image_height',
|
||||
'generate_regenerate_images_notice',
|
||||
];
|
||||
|
||||
$.each( featuredImageArchiveControls, function( index, value ) {
|
||||
$( '#customize-control-' + value ).attr( 'data-control-section', 'featured-image-archives' );
|
||||
} );
|
||||
|
||||
var featuredImageSingleControls = [
|
||||
'generate_blog_settings-single_post_image',
|
||||
'generate_blog_settings-single_post_image_padding',
|
||||
'generate_blog_settings-single_post_image_position',
|
||||
'generate_blog_settings-single_post_image_alignment',
|
||||
'generate_blog_settings-single_post_image_size',
|
||||
'generate_blog_settings-single_post_image_width',
|
||||
'generate_blog_settings-single_post_image_height',
|
||||
'generate_regenerate_single_post_images_notice',
|
||||
];
|
||||
|
||||
$.each( featuredImageSingleControls, function( index, value ) {
|
||||
$( '#customize-control-' + value ).attr( 'data-control-section', 'featured-image-single' ).css( {
|
||||
visibility: 'hidden',
|
||||
height: '0',
|
||||
width: '0',
|
||||
margin: '0',
|
||||
overflow: 'hidden',
|
||||
} );
|
||||
} );
|
||||
|
||||
var featuredImagePageControls = [
|
||||
'generate_blog_settings-page_post_image',
|
||||
'generate_blog_settings-page_post_image_padding',
|
||||
'generate_blog_settings-page_post_image_position',
|
||||
'generate_blog_settings-page_post_image_alignment',
|
||||
'generate_blog_settings-page_post_image_size',
|
||||
'generate_blog_settings-page_post_image_width',
|
||||
'generate_blog_settings-page_post_image_height',
|
||||
'generate_regenerate_page_images_notice',
|
||||
];
|
||||
|
||||
$.each( featuredImagePageControls, function( index, value ) {
|
||||
$( '#customize-control-' + value ).attr( 'data-control-section', 'featured-image-page' ).css( {
|
||||
visibility: 'hidden',
|
||||
height: '0',
|
||||
width: '0',
|
||||
margin: '0',
|
||||
overflow: 'hidden',
|
||||
} );
|
||||
} );
|
||||
|
||||
// Post meta controls
|
||||
var postMetaArchiveControls = [
|
||||
'generate_settings-post_content',
|
||||
'generate_blog_settings-excerpt_length',
|
||||
'generate_blog_settings-read_more',
|
||||
'generate_blog_settings-read_more_button',
|
||||
'generate_blog_settings-date',
|
||||
'generate_blog_settings-author',
|
||||
'generate_blog_settings-categories',
|
||||
'generate_blog_settings-tags',
|
||||
'generate_blog_settings-comments',
|
||||
'generate_blog_settings-infinite_scroll',
|
||||
'generate_blog_settings-infinite_scroll_button',
|
||||
'blog_masonry_load_more_control',
|
||||
'blog_masonry_loading_control',
|
||||
];
|
||||
|
||||
$.each( postMetaArchiveControls, function( index, value ) {
|
||||
$( '#customize-control-' + value ).attr( 'data-control-section', 'post-meta-archives' );
|
||||
} );
|
||||
|
||||
var postMetaSingleControls = [
|
||||
'generate_blog_settings-single_date',
|
||||
'generate_blog_settings-single_author',
|
||||
'generate_blog_settings-single_categories',
|
||||
'generate_blog_settings-single_tags',
|
||||
'generate_blog_settings-single_post_navigation',
|
||||
];
|
||||
|
||||
$.each( postMetaSingleControls, function( index, value ) {
|
||||
$( '#customize-control-' + value ).attr( 'data-control-section', 'post-meta-single' ).css( {
|
||||
visibility: 'hidden',
|
||||
height: '0',
|
||||
width: '0',
|
||||
margin: '0',
|
||||
overflow: 'hidden',
|
||||
} );
|
||||
} );
|
||||
} );
|
@ -0,0 +1,76 @@
|
||||
/**
|
||||
* Theme Customizer enhancements for a better user experience.
|
||||
*
|
||||
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
|
||||
*/
|
||||
|
||||
( function( $ ) {
|
||||
// Container width
|
||||
wp.customize( 'generate_settings[container_width]', function( value ) {
|
||||
value.bind( function() {
|
||||
if ( $( '.masonry-container' )[ 0 ] ) {
|
||||
jQuery( '.masonry-container' ).imagesLoaded( function() {
|
||||
$container = jQuery( '.masonry-container' );
|
||||
if ( jQuery( $container ).length ) {
|
||||
$container.masonry( {
|
||||
columnWidth: '.grid-sizer',
|
||||
itemSelector: '.masonry-post',
|
||||
stamp: '.page-header',
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
$( 'body' ).on( 'generate_spacing_updated', function() {
|
||||
if ( $( '.masonry-container' )[ 0 ] ) {
|
||||
jQuery( '.masonry-container' ).imagesLoaded( function() {
|
||||
$container = jQuery( '.masonry-container' );
|
||||
if ( jQuery( $container ).length ) {
|
||||
$container.masonry( {
|
||||
columnWidth: '.grid-sizer',
|
||||
itemSelector: '.masonry-post',
|
||||
stamp: '.page-header',
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
/**
|
||||
* The first infinite scroll load in the Customizer misses article classes if they've been
|
||||
* added or removed in the previous refresh.
|
||||
*
|
||||
* This is totally hacky, but I'm just happy I finally got it working!
|
||||
*/
|
||||
var $container = $( '.infinite-scroll-item' ).first().parent();
|
||||
$container.on( 'load.infiniteScroll', function( event, response ) {
|
||||
var $posts = $( response ).find( 'article' );
|
||||
if ( wp.customize.value( 'generate_blog_settings[column_layout]' )() ) {
|
||||
$posts.addClass( 'generate-columns' );
|
||||
$posts.addClass( 'grid-parent' );
|
||||
$posts.addClass( 'grid-' + wp.customize.value( 'generate_blog_settings[columns]' )() );
|
||||
$posts.addClass( 'tablet-grid-50' );
|
||||
$posts.addClass( 'mobile-grid-100' );
|
||||
} else {
|
||||
$posts.removeClass( 'generate-columns' );
|
||||
$posts.removeClass( 'grid-parent' );
|
||||
$posts.removeClass( 'grid-' + wp.customize.value( 'generate_blog_settings[columns]' )() );
|
||||
$posts.removeClass( 'tablet-grid-50' );
|
||||
$posts.removeClass( 'mobile-grid-100' );
|
||||
}
|
||||
|
||||
if ( wp.customize.value( 'generate_blog_settings[masonry]' )() ) {
|
||||
$posts.addClass( 'masonry-post' );
|
||||
} else {
|
||||
$posts.removeClass( 'masonry-post' );
|
||||
}
|
||||
|
||||
if ( ! wp.customize.value( 'generate_blog_settings[post_image_padding]' )() ) {
|
||||
$posts.addClass( 'no-featured-image-padding' );
|
||||
} else {
|
||||
$posts.removeClass( 'no-featured-image-padding' );
|
||||
}
|
||||
} );
|
||||
}( jQuery ) );
|
12
wp-content/upgrade-temp-backup/plugins/gp-premium/blog/functions/js/infinite-scroll.pkgd.min.js
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
document.addEventListener( 'DOMContentLoaded', function() {
|
||||
var msnryContainer = document.querySelector( '.masonry-container' );
|
||||
|
||||
if ( msnryContainer ) {
|
||||
// eslint-disable-next-line no-undef -- Masonry is a dependency.
|
||||
var msnry = new Masonry( msnryContainer, generateBlog.masonryInit ),
|
||||
navBelow = document.querySelector( '#nav-below' ),
|
||||
loadMore = document.querySelector( '.load-more' );
|
||||
|
||||
// eslint-disable-next-line no-undef -- imagesLoaded is a dependency.
|
||||
imagesLoaded( msnryContainer, function() {
|
||||
msnry.layout();
|
||||
msnryContainer.classList.remove( 'are-images-unloaded' );
|
||||
|
||||
if ( loadMore ) {
|
||||
loadMore.classList.remove( 'are-images-unloaded' );
|
||||
}
|
||||
|
||||
if ( navBelow ) {
|
||||
navBelow.style.opacity = 1;
|
||||
}
|
||||
} );
|
||||
|
||||
if ( navBelow ) {
|
||||
msnryContainer.parentNode.insertBefore( navBelow, msnryContainer.nextSibling );
|
||||
}
|
||||
|
||||
window.addEventListener( 'orientationchange', function() {
|
||||
msnry.layout();
|
||||
} );
|
||||
}
|
||||
|
||||
var hasInfiniteScroll = document.querySelector( '.infinite-scroll' ),
|
||||
nextLink = document.querySelector( '.infinite-scroll-path a' );
|
||||
|
||||
if ( hasInfiniteScroll && nextLink ) {
|
||||
var infiniteItems = document.querySelectorAll( '.infinite-scroll-item' ),
|
||||
container = infiniteItems[ 0 ].parentNode,
|
||||
button = document.querySelector( '.load-more a' ),
|
||||
svgIcon = '';
|
||||
|
||||
if ( generateBlog.icon ) {
|
||||
svgIcon = generateBlog.icon;
|
||||
}
|
||||
|
||||
var infiniteScrollInit = generateBlog.infiniteScrollInit;
|
||||
|
||||
infiniteScrollInit.outlayer = msnry;
|
||||
|
||||
// eslint-disable-next-line no-undef -- InfiniteScroll is a dependency.
|
||||
var infiniteScroll = new InfiniteScroll( container, infiniteScrollInit );
|
||||
|
||||
if ( button ) {
|
||||
button.addEventListener( 'click', function( e ) {
|
||||
document.activeElement.blur();
|
||||
e.target.innerHTML = svgIcon + generateBlog.loading;
|
||||
e.target.classList.add( 'loading' );
|
||||
} );
|
||||
}
|
||||
|
||||
infiniteScroll.on( 'append', function( response, path, items ) {
|
||||
if ( button && ! document.querySelector( '.generate-columns-container' ) ) {
|
||||
container.appendChild( button.parentNode );
|
||||
}
|
||||
|
||||
items.forEach( function( element ) {
|
||||
var images = element.querySelectorAll( 'img' );
|
||||
|
||||
if ( images ) {
|
||||
images.forEach( function( image ) {
|
||||
var imgOuterHTML = image.outerHTML;
|
||||
image.outerHTML = imgOuterHTML;
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
if ( msnryContainer && msnry ) {
|
||||
// eslint-disable-next-line no-undef -- ImagesLoaded is a dependency.
|
||||
imagesLoaded( msnryContainer, function() {
|
||||
msnry.layout();
|
||||
} );
|
||||
}
|
||||
|
||||
if ( button ) {
|
||||
button.innerHTML = svgIcon + generateBlog.more;
|
||||
button.classList.remove( 'loading' );
|
||||
}
|
||||
|
||||
document.body.dispatchEvent( new Event( 'post-load' ) );
|
||||
} );
|
||||
|
||||
infiniteScroll.on( 'last', function() {
|
||||
var loadMoreElement = document.querySelector( '.load-more' );
|
||||
|
||||
if ( loadMoreElement ) {
|
||||
loadMoreElement.style.display = 'none';
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
1
wp-content/upgrade-temp-backup/plugins/gp-premium/blog/functions/js/scripts.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
document.addEventListener("DOMContentLoaded",function(){var t,e,n,r,a,i,l=document.querySelector(".masonry-container"),o=(l&&(t=new Masonry(l,generateBlog.masonryInit),e=document.querySelector("#nav-below"),n=document.querySelector(".load-more"),imagesLoaded(l,function(){t.layout(),l.classList.remove("are-images-unloaded"),n&&n.classList.remove("are-images-unloaded"),e&&(e.style.opacity=1)}),e&&l.parentNode.insertBefore(e,l.nextSibling),window.addEventListener("orientationchange",function(){t.layout()})),document.querySelector(".infinite-scroll")),c=document.querySelector(".infinite-scroll-path a");o&&c&&(r=document.querySelectorAll(".infinite-scroll-item")[0].parentNode,a=document.querySelector(".load-more a"),i="",generateBlog.icon&&(i=generateBlog.icon),(o=generateBlog.infiniteScrollInit).outlayer=t,c=new InfiniteScroll(r,o),a&&a.addEventListener("click",function(e){document.activeElement.blur(),e.target.innerHTML=i+generateBlog.loading,e.target.classList.add("loading")}),c.on("append",function(e,n,o){a&&!document.querySelector(".generate-columns-container")&&r.appendChild(a.parentNode),o.forEach(function(e){e=e.querySelectorAll("img");e&&e.forEach(function(e){var n=e.outerHTML;e.outerHTML=n})}),l&&t&&imagesLoaded(l,function(){t.layout()}),a&&(a.innerHTML=i+generateBlog.more,a.classList.remove("loading")),document.body.dispatchEvent(new Event("post-load"))}),c.on("last",function(){var e=document.querySelector(".load-more");e&&(e.style.display="none")}))});
|
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
defined( 'WPINC' ) or die;
|
||||
|
||||
add_action( 'admin_init', 'generate_blog_update_visibility_settings' );
|
||||
/**
|
||||
* Migrates our old Blog settings so we can use checkboxes instead.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
function generate_blog_update_visibility_settings() {
|
||||
// Get our migration settings
|
||||
$settings = get_option( 'generate_migration_settings', array() );
|
||||
|
||||
// If we've already ran this function, bail
|
||||
if ( isset( $settings[ 'blog_visibility_updated' ] ) && 'true' == $settings[ 'blog_visibility_updated' ] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// A lot of the defaults changed, so lets put the old defaults here
|
||||
$defaults = array(
|
||||
'masonry' => 'false',
|
||||
'masonry_width' => 'width2',
|
||||
'masonry_most_recent_width' => 'width4',
|
||||
'post_image' => 'true',
|
||||
'date' => 'true',
|
||||
'author' => 'true',
|
||||
'categories' => 'true',
|
||||
'tags' => 'true',
|
||||
'comments' => 'true',
|
||||
);
|
||||
|
||||
// Get our spacing settings
|
||||
$blog_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
$defaults
|
||||
);
|
||||
|
||||
$new_settings = array();
|
||||
|
||||
// These options use to be a select input with false + true values
|
||||
// This will make the false values empty so the options can be checkboxes
|
||||
$keys = array( 'date', 'author', 'categories', 'tags', 'comments', 'masonry', 'post_image' );
|
||||
foreach ( $keys as $key ) {
|
||||
if ( is_string( $blog_settings[ $key ] ) ) {
|
||||
if ( 'false' == $blog_settings[ $key ] ) {
|
||||
$new_settings[ $key ] = false;
|
||||
} elseif ( 'true' == $blog_settings[ $key ] ) {
|
||||
$new_settings[ $key ] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the single post meta options to whatever the blog options are
|
||||
$new_settings[ 'single_date' ] = isset( $new_settings[ 'date' ] ) ? $new_settings[ 'date' ] : true;
|
||||
$new_settings[ 'single_author' ] = isset( $new_settings[ 'author' ] ) ? $new_settings[ 'author' ] : true;
|
||||
$new_settings[ 'single_categories' ] = isset( $new_settings[ 'categories' ] ) ? $new_settings[ 'categories' ] : true;
|
||||
$new_settings[ 'single_tags' ] = isset( $new_settings[ 'tags' ] ) ? $new_settings[ 'tags' ] : true;
|
||||
|
||||
if ( isset( $new_settings[ 'masonry' ] ) && $new_settings[ 'masonry' ] ) {
|
||||
$new_settings[ 'column_layout' ] = true;
|
||||
$new_settings[ 'infinite_scroll' ] = true;
|
||||
$new_settings[ 'infinite_scroll_button' ] = true;
|
||||
|
||||
if ( 'width2' == $blog_settings['masonry_width'] ) {
|
||||
$new_settings[ 'columns' ] = '33';
|
||||
}
|
||||
|
||||
if ( 'width4' == $blog_settings['masonry_width'] ) {
|
||||
$new_settings[ 'columns' ] = '50';
|
||||
}
|
||||
|
||||
if ( 'width6' == $blog_settings['masonry_width'] ) {
|
||||
$new_settings[ 'columns' ] = '100';
|
||||
}
|
||||
|
||||
if ( 'width2' == $blog_settings[ 'masonry_width' ] ) {
|
||||
if ( 'width2' !== $blog_settings[ 'masonry_most_recent_width' ] ) {
|
||||
$new_settings[ 'featured_column' ] = true;
|
||||
} else {
|
||||
$new_settings[ 'featured_column' ] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'width4' == $blog_settings[ 'masonry_width' ] ) {
|
||||
if ( 'width6' == $blog_settings[ 'masonry_most_recent_width' ] ) {
|
||||
$new_settings[ 'featured_column' ] = true;
|
||||
} else {
|
||||
$new_settings[ 'featured_column' ] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'width6' == $blog_settings[ 'masonry_width' ] ) {
|
||||
$new_settings[ 'featured_column' ] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( function_exists( 'generate_page_header_get_defaults' ) ) {
|
||||
$page_header_settings = wp_parse_args(
|
||||
get_option( 'generate_page_header_settings', array() ),
|
||||
generate_page_header_get_defaults()
|
||||
);
|
||||
|
||||
if ( 'hide' == $page_header_settings[ 'post_header_position' ] ) {
|
||||
$new_settings[ 'single_post_image' ] = false;
|
||||
} else {
|
||||
$new_settings[ 'single_post_image_position' ] = $page_header_settings[ 'post_header_position' ];
|
||||
}
|
||||
|
||||
$new_settings[ 'page_post_image_position' ] = $page_header_settings[ 'page_header_position' ];
|
||||
}
|
||||
|
||||
unset( $blog_settings['masonry_width'] );
|
||||
unset( $blog_settings['masonry_most_recent_width'] );
|
||||
|
||||
$update_settings = wp_parse_args( $new_settings, $blog_settings );
|
||||
update_option( 'generate_blog_settings', $update_settings );
|
||||
|
||||
// Update our migration option so we don't need to run this again
|
||||
$updated[ 'blog_visibility_updated' ] = 'true';
|
||||
$migration_settings = wp_parse_args( $updated, $settings );
|
||||
update_option( 'generate_migration_settings', $migration_settings );
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Blog module.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
// Define the version. This used to be a standalone plugin, so we need to keep this constant.
|
||||
if ( ! defined( 'GENERATE_BLOG_VERSION' ) ) {
|
||||
define( 'GENERATE_BLOG_VERSION', GP_PREMIUM_VERSION );
|
||||
}
|
||||
|
||||
// Include functions identical between standalone addon and GP Premium.
|
||||
require plugin_dir_path( __FILE__ ) . 'functions/generate-blog.php';
|
@ -0,0 +1,620 @@
|
||||
/**
|
||||
* Theme Customizer enhancements for a better user experience.
|
||||
*
|
||||
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
|
||||
*/
|
||||
function generate_colors_live_update( id, selector, property, default_value, get_value, settings ) {
|
||||
default_value = typeof default_value !== 'undefined' ? default_value : 'initial';
|
||||
get_value = typeof get_value !== 'undefined' ? get_value : '';
|
||||
settings = typeof settings !== 'undefined' ? settings : 'generate_settings';
|
||||
wp.customize( settings + '[' + id + ']', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
|
||||
// Stop the header link color from applying to the site title.
|
||||
if ( 'header_link_color' === id || 'header_link_color' === id ) {
|
||||
jQuery( '.site-header a' ).addClass( 'header-link' );
|
||||
jQuery( '.site-header .main-title a' ).removeClass( 'header-link' );
|
||||
}
|
||||
|
||||
if ( 'content_link_color' === id || 'content_link_color_hover' === id || 'entry_meta_link_color' === id || 'blog_post_title_color' === id ) {
|
||||
var content_link = jQuery( '.inside-article a' );
|
||||
var meta = jQuery( '.entry-meta a' );
|
||||
var title = jQuery( '.entry-title a' );
|
||||
|
||||
content_link.attr( 'data-content-link-color', true );
|
||||
|
||||
if ( '' !== wp.customize.value('generate_settings[entry_meta_link_color]')() ) {
|
||||
meta.attr( 'data-content-link-color', '' );
|
||||
} else {
|
||||
meta.attr( 'data-content-link-color', true );
|
||||
}
|
||||
|
||||
if ( '' !== wp.customize.value('generate_settings[blog_post_title_color]')() ) {
|
||||
title.attr( 'data-content-link-color', '' );
|
||||
} else {
|
||||
title.attr( 'data-content-link-color', true );
|
||||
}
|
||||
}
|
||||
|
||||
default_value = ( '' !== get_value ) ? wp.customize.value('generate_settings[' + get_value + ']')() : default_value;
|
||||
newval = ( '' !== newval ) ? newval : default_value;
|
||||
var unique_id = ( 'generate_secondary_nav_settings' == settings ) ? 'secondary_' : '';
|
||||
if ( jQuery( 'style#' + unique_id + id ).length ) {
|
||||
jQuery( 'style#' + unique_id + id ).html( selector + '{' + property + ':' + newval + ';}' );
|
||||
} else {
|
||||
jQuery( 'head' ).append( '<style id="' + unique_id + id + '">' + selector + '{' + property + ':' + newval + '}</style>' );
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#' + id ).not( ':last' ).remove();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Header background color
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'top_bar_background_color', '.top-bar', 'background-color', 'transparent' );
|
||||
|
||||
/**
|
||||
* Header text color
|
||||
* Empty: text_color
|
||||
*/
|
||||
generate_colors_live_update( 'top_bar_text_color', '.top-bar', 'color', '', 'text_color' );
|
||||
|
||||
/**
|
||||
* Header link color
|
||||
* Empty: link_color
|
||||
*/
|
||||
generate_colors_live_update( 'top_bar_link_color', '.top-bar a, .top-bar a:visited', 'color', '', 'link_color' );
|
||||
|
||||
/**
|
||||
* Header link color hover
|
||||
* Empty: link_color_hover
|
||||
*/
|
||||
generate_colors_live_update( 'top_bar_link_color_hover', '.top-bar a:hover', 'color', '', 'link_color_hover' );
|
||||
|
||||
|
||||
/**
|
||||
* Header background color
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'header_background_color', '.site-header', 'background-color', 'transparent' );
|
||||
|
||||
/**
|
||||
* Header text color
|
||||
* Empty: text_color
|
||||
*/
|
||||
generate_colors_live_update( 'header_text_color', '.site-header', 'color', '', 'text_color' );
|
||||
|
||||
/**
|
||||
* Header link color
|
||||
* Empty: link_color
|
||||
*/
|
||||
generate_colors_live_update( 'header_link_color', '.site-header a.header-link, .site-header a.header-link:visited', 'color', '', 'link_color' );
|
||||
|
||||
/**
|
||||
* Header link color hover
|
||||
* Empty: link_color_hover
|
||||
*/
|
||||
generate_colors_live_update( 'header_link_hover_color', '.site-header a.header-link:hover', 'color', '', 'link_color_hover' );
|
||||
|
||||
/**
|
||||
* Site title color
|
||||
* Empty: link_color
|
||||
*/
|
||||
generate_colors_live_update( 'site_title_color', '.main-title a,.main-title a:hover,.main-title a:visited,.header-wrap .navigation-stick .main-title a, .header-wrap .navigation-stick .main-title a:hover, .header-wrap .navigation-stick .main-title a:visited', 'color', '', 'link_color' );
|
||||
|
||||
/**
|
||||
* Site tagline color
|
||||
* Empty: text_color
|
||||
*/
|
||||
generate_colors_live_update( 'site_tagline_color', '.site-description', 'color', '', 'text_color' );
|
||||
|
||||
/**
|
||||
* Main navigation background
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'navigation_background_color', '.main-navigation', 'background-color', 'transparent' );
|
||||
|
||||
/**
|
||||
* Primary navigation text color
|
||||
* Empty: link_color
|
||||
*/
|
||||
generate_colors_live_update( 'navigation_text_color',
|
||||
'.main-navigation .main-nav ul li a,\
|
||||
.menu-toggle,button.menu-toggle:hover,\
|
||||
button.menu-toggle:focus,\
|
||||
.main-navigation .mobile-bar-items a,\
|
||||
.main-navigation .mobile-bar-items a:hover,\
|
||||
.main-navigation .mobile-bar-items a:focus,\
|
||||
.main-navigation .menu-bar-items',
|
||||
'color', '', 'link_color'
|
||||
);
|
||||
|
||||
/**
|
||||
* Primary navigation text color hover
|
||||
* Empty: link_color_hover
|
||||
*/
|
||||
generate_colors_live_update( 'navigation_text_hover_color',
|
||||
'.navigation-search input[type="search"],\
|
||||
.navigation-search input[type="search"]:active,\
|
||||
.navigation-search input[type="search"]:focus,\
|
||||
.main-navigation .main-nav ul li:hover > a,\
|
||||
.main-navigation .main-nav ul li:focus > a,\
|
||||
.main-navigation .main-nav ul li.sfHover > a,\
|
||||
.main-navigation .menu-bar-item:hover a',
|
||||
'color', '', 'link_color_hover'
|
||||
);
|
||||
|
||||
/**
|
||||
* Primary navigation menu item hover
|
||||
* Empty: link_color_hover
|
||||
*/
|
||||
generate_colors_live_update( 'navigation_background_hover_color',
|
||||
'.navigation-search input[type="search"],\
|
||||
.navigation-search input[type="search"]:focus,\
|
||||
.main-navigation .main-nav ul li:hover > a,\
|
||||
.main-navigation .main-nav ul li:focus > a,\
|
||||
.main-navigation .main-nav ul li.sfHover > a,\
|
||||
.main-navigation .menu-bar-item:hover a',
|
||||
'background-color', 'transparent'
|
||||
);
|
||||
|
||||
/**
|
||||
* Primary sub-navigation color
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'subnavigation_background_color', '.main-navigation ul ul', 'background-color', 'transparent' );
|
||||
|
||||
/**
|
||||
* Primary sub-navigation text color
|
||||
* Empty: link_color
|
||||
*/
|
||||
generate_colors_live_update( 'subnavigation_text_color', '.main-navigation .main-nav ul ul li a', 'color', 'link_color' );
|
||||
|
||||
/**
|
||||
* Primary sub-navigation hover
|
||||
*/
|
||||
var subnavigation_hover = '.main-navigation .main-nav ul ul li:hover > a, \
|
||||
.main-navigation .main-nav ul ul li:focus > a, \
|
||||
.main-navigation .main-nav ul ul li.sfHover > a';
|
||||
|
||||
/**
|
||||
* Primary sub-navigation text hover
|
||||
* Empty: link_color_hover
|
||||
*/
|
||||
generate_colors_live_update( 'subnavigation_text_hover_color', subnavigation_hover, 'color', '', 'link_color_hover' );
|
||||
|
||||
/**
|
||||
* Primary sub-navigation background hover
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'subnavigation_background_hover_color', subnavigation_hover, 'background-color', 'transparent' );
|
||||
|
||||
/**
|
||||
* Navigation current selectors
|
||||
*/
|
||||
var navigation_current = '.main-navigation .main-nav ul li[class*="current-menu-"] > a, \
|
||||
.main-navigation .main-nav ul li[class*="current-menu-"]:hover > a, \
|
||||
.main-navigation .main-nav ul li[class*="current-menu-"].sfHover > a';
|
||||
|
||||
/**
|
||||
* Primary navigation current text
|
||||
* Empty: link_color
|
||||
*/
|
||||
generate_colors_live_update( 'navigation_text_current_color', navigation_current, 'color', '', 'link_color' );
|
||||
|
||||
/**
|
||||
* Primary navigation current text
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'navigation_background_current_color', navigation_current, 'background-color', 'transparent' );
|
||||
|
||||
/**
|
||||
* Primary sub-navigation current selectors
|
||||
*/
|
||||
var subnavigation_current = '.main-navigation .main-nav ul ul li[class*="current-menu-"] > a,\
|
||||
.main-navigation .main-nav ul ul li[class*="current-menu-"]:hover > a, \
|
||||
.main-navigation .main-nav ul ul li[class*="current-menu-"].sfHover > a';
|
||||
|
||||
/**
|
||||
* Primary sub-navigation current text
|
||||
* Empty: link_color
|
||||
*/
|
||||
generate_colors_live_update( 'subnavigation_text_current_color', subnavigation_current, 'color', '', 'link_color' );
|
||||
|
||||
/**
|
||||
* Primary navigation current item background
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'subnavigation_background_current_color', subnavigation_current, 'background-color', 'transparent' );
|
||||
|
||||
/**
|
||||
* Secondary navigation background
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'navigation_background_color', '.secondary-navigation', 'background-color', 'transparent', '', 'generate_secondary_nav_settings' );
|
||||
|
||||
/**
|
||||
* Secondary navigation text color
|
||||
* Empty: link_color
|
||||
*/
|
||||
generate_colors_live_update( 'navigation_text_color',
|
||||
'.secondary-navigation .main-nav ul li a,\
|
||||
.secondary-navigation .menu-toggle,\
|
||||
button.secondary-menu-toggle:hover,\
|
||||
button.secondary-menu-toggle:focus, \
|
||||
.secondary-navigation .top-bar, \
|
||||
.secondary-navigation .top-bar a,\
|
||||
.secondary-menu-bar-items,\
|
||||
.secondary-menu-bar-items .menu-bar-item > a',
|
||||
'color', '', 'link_color', 'generate_secondary_nav_settings'
|
||||
);
|
||||
|
||||
/**
|
||||
* Navigation search
|
||||
*/
|
||||
wp.customize( 'generate_settings[navigation_search_background_color]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( jQuery( 'style#navigation_search_background_color' ).length ) {
|
||||
jQuery( 'style#navigation_search_background_color' ).html( '.navigation-search input[type="search"],.navigation-search input[type="search"]:active, .navigation-search input[type="search"]:focus, .main-navigation .main-nav ul li.search-item.active > a, .main-navigation .menu-bar-items .search-item.active > a{background-color:' + newval + ';}' );
|
||||
} else {
|
||||
jQuery( 'head' ).append( '<style id="navigation_search_background_color">.navigation-search input[type="search"],.navigation-search input[type="search"]:active, .navigation-search input[type="search"]:focus, .main-navigation .main-nav ul li.search-item.active > a, .main-navigation .menu-bar-items .search-item.active > a{background-color:' + newval + ';}</style>' );
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#navigation_search_background_color' ).not( ':last' ).remove();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
if ( jQuery( 'style#navigation_search_background_opacity' ).length ) {
|
||||
if ( newval ) {
|
||||
jQuery( 'style#navigation_search_background_opacity' ).html( '.navigation-search input{opacity: 1;}' );
|
||||
} else {
|
||||
jQuery( 'style#navigation_search_background_opacity' ).html( '.navigation-search input{opacity: 0.9;}' );
|
||||
}
|
||||
} else {
|
||||
if ( newval ) {
|
||||
jQuery( 'head' ).append( '<style id="navigation_search_background_opacity">.navigation-search input{opacity: 1;}</style>' );
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#navigation_search_background_opacity' ).not( ':last' ).remove();
|
||||
}, 1000);
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
generate_colors_live_update( 'navigation_search_text_color', '.navigation-search input[type="search"],.navigation-search input[type="search"]:active, .navigation-search input[type="search"]:focus, .main-navigation .main-nav ul li.search-item.active > a, .main-navigation .menu-bar-items .search-item.active > a', 'color', '' );
|
||||
|
||||
/**
|
||||
* Secondary navigation text color hover
|
||||
* Empty: link_color_hover
|
||||
*/
|
||||
generate_colors_live_update( 'navigation_text_hover_color',
|
||||
'.secondary-navigation .main-nav ul li:hover > a, \
|
||||
.secondary-navigation .main-nav ul li:focus > a, \
|
||||
.secondary-navigation .main-nav ul li.sfHover > a,\
|
||||
.secondary-menu-bar-items .menu-bar-item:hover > a',
|
||||
'color', '', 'link_color_hover', 'generate_secondary_nav_settings'
|
||||
);
|
||||
|
||||
/**
|
||||
* Secondary navigation menu item hover
|
||||
* Empty: link_color_hover
|
||||
*/
|
||||
generate_colors_live_update( 'navigation_background_hover_color',
|
||||
'.secondary-navigation .main-nav ul li:hover > a, \
|
||||
.secondary-navigation .main-nav ul li:focus > a, \
|
||||
.secondary-navigation .main-nav ul li.sfHover > a, \
|
||||
.secondary-menu-bar-items .menu-bar-item:hover > a',
|
||||
'background-color', 'transparent', '', 'generate_secondary_nav_settings'
|
||||
);
|
||||
|
||||
/**
|
||||
* Secondary navigation top bar link hover
|
||||
*/
|
||||
wp.customize( 'generate_secondary_nav_settings[navigation_background_hover_color]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( jQuery( 'style#secondary_nav_top_bar_hover' ).length ) {
|
||||
jQuery( 'style#secondary_nav_top_bar_hover' ).html( '.secondary-navigation .top-bar a:hover,.secondary-navigation .top-bar a:focus{color:' + newval + ';}' );
|
||||
} else {
|
||||
jQuery( 'head' ).append( '<style id="secondary_nav_top_bar_hover">.secondary-navigation .top-bar a:hover,.secondary-navigation .top-bar a:focus{color:' + newval + ';}</style>' );
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#secondary_nav_top_bar_hover' ).not( ':last' ).remove();
|
||||
}, 1000);
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
generate_colors_live_update( 'navigation_top_bar_hover_color',
|
||||
'.secondary-navigation .top-bar a:hover, \
|
||||
.secondary-navigation .top-bar a:focus',
|
||||
'color', 'transparent', '', 'generate_secondary_nav_settings'
|
||||
);
|
||||
|
||||
/**
|
||||
* Secondary sub-navigation color
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'subnavigation_background_color', '.secondary-navigation ul ul', 'background-color', 'transparent', '', 'generate_secondary_nav_settings' );
|
||||
|
||||
/**
|
||||
* Secondary sub-navigation text color
|
||||
* Empty: link_color
|
||||
*/
|
||||
generate_colors_live_update( 'subnavigation_text_color', '.secondary-navigation .main-nav ul ul li a', 'color', '', 'link_color', 'generate_secondary_nav_settings' );
|
||||
|
||||
/**
|
||||
* Secondary sub-navigation hover
|
||||
*/
|
||||
var secondary_subnavigation_hover = '.secondary-navigation .main-nav ul ul li > a:hover, \
|
||||
.secondary-navigation .main-nav ul ul li:focus > a, \
|
||||
.secondary-navigation .main-nav ul ul li.sfHover > a';
|
||||
|
||||
/**
|
||||
* Secondary sub-navigation text hover
|
||||
* Empty: link_color_hover
|
||||
*/
|
||||
generate_colors_live_update( 'subnavigation_text_hover_color', secondary_subnavigation_hover, 'color', '', 'link_color_hover', 'generate_secondary_nav_settings' );
|
||||
|
||||
/**
|
||||
* Secondary sub-navigation background hover
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'subnavigation_background_hover_color', secondary_subnavigation_hover, 'background-color', 'transparent', '', 'generate_secondary_nav_settings' );
|
||||
|
||||
/**
|
||||
* Secondary navigation current selectors
|
||||
*/
|
||||
var secondary_navigation_current = '.secondary-navigation .main-nav ul li[class*="current-menu-"] > a, \
|
||||
.secondary-navigation .main-nav ul li[class*="current-menu-"]:hover > a, \
|
||||
.secondary-navigation .main-nav ul li[class*="current-menu-"].sfHover > a';
|
||||
|
||||
/**
|
||||
* Secondary navigation current text
|
||||
* Empty: link_color
|
||||
*/
|
||||
generate_colors_live_update( 'navigation_text_current_color', secondary_navigation_current, 'color', '', 'link_color', 'generate_secondary_nav_settings' );
|
||||
|
||||
/**
|
||||
* Secondary navigation current text
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'navigation_background_current_color', secondary_navigation_current, 'background-color', 'transparent', '', 'generate_secondary_nav_settings' );
|
||||
|
||||
/**
|
||||
* Secondary sub-navigation current selectors
|
||||
*/
|
||||
var secondary_subnavigation_current = '.secondary-navigation .main-nav ul ul li[class*="current-menu-"] > a,\
|
||||
.secondary-navigation .main-nav ul ul li[class*="current-menu-"]:hover > a, \
|
||||
.secondary-navigation .main-nav ul ul li[class*="current-menu-"].sfHover > a';
|
||||
|
||||
/**
|
||||
* Secondary sub-navigation current text
|
||||
* Empty: link_color
|
||||
*/
|
||||
generate_colors_live_update( 'subnavigation_text_current_color', secondary_subnavigation_current, 'color', '', 'link_color', 'generate_secondary_nav_settings' );
|
||||
|
||||
/**
|
||||
* Primary navigation current item background
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'subnavigation_background_current_color', secondary_subnavigation_current, 'background-color', 'transparent', '', 'generate_secondary_nav_settings' );
|
||||
|
||||
/**
|
||||
* Content selectors
|
||||
*/
|
||||
var content = '.separate-containers .inside-article,\
|
||||
.separate-containers .comments-area,\
|
||||
.separate-containers .page-header,\
|
||||
.one-container .container,\
|
||||
.separate-containers .paging-navigation,\
|
||||
.inside-page-header';
|
||||
|
||||
/**
|
||||
* Content background
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'content_background_color', content, 'background-color', 'transparent' );
|
||||
|
||||
/**
|
||||
* Content text color
|
||||
* Empty: text_color
|
||||
*/
|
||||
generate_colors_live_update( 'content_text_color', content, 'color', '', 'text_color' );
|
||||
|
||||
/**
|
||||
* Content links
|
||||
* Empty: link_color
|
||||
*/
|
||||
generate_colors_live_update( 'content_link_color',
|
||||
'.inside-article a:not(.button):not(.wp-block-button__link)[data-content-link-color=true], \
|
||||
.inside-article a:not(.button):not(.wp-block-button__link)[data-content-link-color=true]:visited,\
|
||||
.paging-navigation a,\
|
||||
.paging-navigation a:visited,\
|
||||
.comments-area a,\
|
||||
.comments-area a:visited,\
|
||||
.page-header a,\
|
||||
.page-header a:visited',
|
||||
'color', '', 'link_color'
|
||||
);
|
||||
|
||||
/**
|
||||
* Content links on hover
|
||||
* Empty: link_color_hover
|
||||
*/
|
||||
generate_colors_live_update( 'content_link_hover_color',
|
||||
'.inside-article a:not(.button):not(.wp-block-button__link)[data-content-link-color=true]:hover,\
|
||||
.paging-navigation a:hover,\
|
||||
.comments-area a:hover,\
|
||||
.page-header a:hover',
|
||||
'color', '', 'link_color_hover'
|
||||
);
|
||||
|
||||
generate_colors_live_update( 'content_title_color', '.entry-header h1,.page-header h1', 'color', 'inherit', 'text_color' );
|
||||
generate_colors_live_update( 'blog_post_title_color', '.entry-title a,.entry-title a:visited', 'color', '', 'link_color' );
|
||||
generate_colors_live_update( 'blog_post_title_hover_color', '.entry-title a:hover', 'color', '', 'link_color_hover' );
|
||||
generate_colors_live_update( 'entry_meta_text_color', '.entry-meta', 'color', '', 'text_color' );
|
||||
generate_colors_live_update( 'entry_meta_link_color', '.entry-meta a, .entry-meta a:visited', 'color', '', 'link_color' );
|
||||
generate_colors_live_update( 'entry_meta_link_color_hover', '.entry-meta a:hover', 'color', '', 'link_color_hover' );
|
||||
generate_colors_live_update( 'h1_color', 'h1', 'color', '', 'text_color' );
|
||||
generate_colors_live_update( 'h2_color', 'h2', 'color', '', 'text_color' );
|
||||
generate_colors_live_update( 'h3_color', 'h3', 'color', '', 'text_color' );
|
||||
generate_colors_live_update( 'h4_color', 'h4', 'color', '', 'text_color' );
|
||||
generate_colors_live_update( 'h5_color', 'h5', 'color', '', 'text_color' );
|
||||
generate_colors_live_update( 'sidebar_widget_background_color', '.sidebar .widget', 'background-color', 'transparent' );
|
||||
generate_colors_live_update( 'sidebar_widget_text_color', '.sidebar .widget', 'color', '', 'text_color' );
|
||||
generate_colors_live_update( 'sidebar_widget_link_color', '.sidebar .widget a, .sidebar .widget a:visited', 'color', '', 'link_color' );
|
||||
generate_colors_live_update( 'sidebar_widget_link_hover_color', '.sidebar .widget a:hover', 'color', '', 'link_color_hover' );
|
||||
generate_colors_live_update( 'sidebar_widget_title_color', '.sidebar .widget .widget-title', 'color', '', 'text_color' );
|
||||
generate_colors_live_update( 'footer_widget_background_color', '.footer-widgets', 'background-color', 'transparent' );
|
||||
generate_colors_live_update( 'footer_widget_text_color', '.footer-widgets', 'color', '', 'text_color' );
|
||||
generate_colors_live_update( 'footer_widget_link_color', '.footer-widgets a, .footer-widgets a:visited', 'color', '', 'link_color' );
|
||||
generate_colors_live_update( 'footer_widget_link_hover_color', '.footer-widgets a:hover', 'color', '', 'link_color_hover' );
|
||||
generate_colors_live_update( 'footer_widget_title_color', '.footer-widgets .widget-title', 'color', '', 'text_color' );
|
||||
generate_colors_live_update( 'footer_background_color', '.site-info', 'background-color', 'transparent' );
|
||||
generate_colors_live_update( 'footer_text_color', '.site-info', 'color', '', 'text_color' );
|
||||
generate_colors_live_update( 'footer_link_color', '.site-info a, .site-info a:visited', 'color', '', 'link_color' );
|
||||
generate_colors_live_update( 'footer_link_hover_color', '.site-info a:hover', 'color', '', 'link_color_hover' );
|
||||
|
||||
/**
|
||||
* Form selectors
|
||||
*/
|
||||
var forms = 'input[type="text"], \
|
||||
input[type="email"], \
|
||||
input[type="url"], \
|
||||
input[type="password"], \
|
||||
input[type="search"], \
|
||||
input[type="number"], \
|
||||
input[type="tel"], \
|
||||
textarea, \
|
||||
select';
|
||||
|
||||
/**
|
||||
* Form background
|
||||
* Empty: inherit
|
||||
*/
|
||||
generate_colors_live_update( 'form_background_color', forms, 'background-color', 'inherit' );
|
||||
|
||||
/**
|
||||
* Border color
|
||||
* Empty: inherit
|
||||
*/
|
||||
generate_colors_live_update( 'form_border_color', forms, 'border-color' );
|
||||
|
||||
/**
|
||||
* Form text color
|
||||
* Empty: text_color
|
||||
*/
|
||||
generate_colors_live_update( 'form_text_color', forms, 'color', '', 'text_color' );
|
||||
|
||||
/**
|
||||
* Form background on focus selectors
|
||||
* Empty: inherit
|
||||
*/
|
||||
var forms_focus = 'input[type="text"]:focus, \
|
||||
input[type="email"]:focus, \
|
||||
input[type="url"]:focus, \
|
||||
input[type="password"]:focus, \
|
||||
input[type="search"]:focus,\
|
||||
input[type="number"]:focus,\
|
||||
input[type="tel"]:focus, \
|
||||
textarea:focus, \
|
||||
select:focus';
|
||||
|
||||
/**
|
||||
* Form background color on focus
|
||||
* Empty: initial
|
||||
*/
|
||||
generate_colors_live_update( 'form_background_color_focus', forms_focus, 'background-color' );
|
||||
|
||||
/**
|
||||
* Form text color on focus
|
||||
* Empty: initial
|
||||
*/
|
||||
generate_colors_live_update( 'form_text_color_focus', forms_focus, 'color' );
|
||||
|
||||
/**
|
||||
* Form border color on focus
|
||||
* Empty: initial
|
||||
*/
|
||||
generate_colors_live_update( 'form_border_color_focus', forms_focus, 'border-color' );
|
||||
|
||||
/**
|
||||
* Button selectors
|
||||
*/
|
||||
var button = 'button, \
|
||||
html input[type="button"], \
|
||||
input[type="reset"], \
|
||||
input[type="submit"],\
|
||||
a.button,\
|
||||
a.button:visited,\
|
||||
a.wp-block-button__link:not(.has-background)';
|
||||
|
||||
/**
|
||||
* Button background
|
||||
* Empty: initial
|
||||
*/
|
||||
generate_colors_live_update( 'form_button_background_color', button, 'background-color' );
|
||||
|
||||
/**
|
||||
* Button text
|
||||
* Empty: initial
|
||||
*/
|
||||
generate_colors_live_update( 'form_button_text_color', button, 'color' );
|
||||
|
||||
/**
|
||||
* Button on hover/focus selectors
|
||||
* Empty: initial
|
||||
*/
|
||||
var button_hover = 'button:hover, \
|
||||
html input[type="button"]:hover, \
|
||||
input[type="reset"]:hover, \
|
||||
input[type="submit"]:hover,\
|
||||
a.button:hover,\
|
||||
button:focus, \
|
||||
html input[type="button"]:focus, \
|
||||
input[type="reset"]:focus, \
|
||||
input[type="submit"]:focus,\
|
||||
a.button:focus,\
|
||||
a.wp-block-button__link:not(.has-background):active,\
|
||||
a.wp-block-button__link:not(.has-background):focus,\
|
||||
a.wp-block-button__link:not(.has-background):hover';
|
||||
|
||||
/**
|
||||
* Button color on hover
|
||||
* Empty: initial
|
||||
*/
|
||||
generate_colors_live_update( 'form_button_background_color_hover', button_hover, 'background-color' );
|
||||
|
||||
/**
|
||||
* Button text color on hover
|
||||
* Empty: initial
|
||||
*/
|
||||
generate_colors_live_update( 'form_button_text_color_hover', button_hover, 'color' );
|
||||
|
||||
/**
|
||||
* Back to top background color
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'back_to_top_background_color', 'a.generate-back-to-top', 'background-color', 'transparent' );
|
||||
|
||||
/**
|
||||
* Back to top text color
|
||||
* Empty: text_color
|
||||
*/
|
||||
generate_colors_live_update( 'back_to_top_text_color', 'a.generate-back-to-top', 'color', '', 'text_color' );
|
||||
|
||||
/**
|
||||
* Back to top background color hover
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'back_to_top_background_color_hover', 'a.generate-back-to-top:hover,a.generate-back-to-top:focus', 'background-color', 'transparent' );
|
||||
|
||||
/**
|
||||
* Back to top text color hover
|
||||
* Empty: text_color
|
||||
*/
|
||||
generate_colors_live_update( 'back_to_top_text_color_hover', 'a.generate-back-to-top:hover,a.generate-back-to-top:focus', 'color', '', 'text_color' );
|
@ -0,0 +1,102 @@
|
||||
/**
|
||||
* Main navigation background
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'slideout_background_color', '.main-navigation.slideout-navigation', 'background-color', '' );
|
||||
|
||||
/**
|
||||
* Primary navigation text color
|
||||
* Empty: link_color
|
||||
*/
|
||||
generate_colors_live_update( 'slideout_text_color', '.slideout-navigation.main-navigation .main-nav ul li a, .slideout-navigation a, .slideout-navigation', 'color', '' );
|
||||
|
||||
/**
|
||||
* Primary navigation text color hover
|
||||
* Empty: link_color_hover
|
||||
*/
|
||||
generate_colors_live_update( 'slideout_text_hover_color',
|
||||
'.slideout-navigation.main-navigation .main-nav ul li:hover > a,\
|
||||
.slideout-navigation.main-navigation .main-nav ul li:focus > a,\
|
||||
.slideout-navigation.main-navigation .main-nav ul li.sfHover > a',
|
||||
'color', ''
|
||||
);
|
||||
|
||||
/**
|
||||
* Primary navigation menu item hover
|
||||
* Empty: link_color_hover
|
||||
*/
|
||||
generate_colors_live_update( 'slideout_background_hover_color',
|
||||
'.slideout-navigation.main-navigation .main-nav ul li:hover > a,\
|
||||
.slideout-navigation.main-navigation .main-nav ul li:focus > a,\
|
||||
.slideout-navigation.main-navigation .main-nav ul li.sfHover > a',
|
||||
'background-color', 'transparent'
|
||||
);
|
||||
|
||||
/**
|
||||
* Primary sub-navigation color
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'slideout_submenu_background_color', '.slideout-navigation.main-navigation ul ul', 'background-color', '' );
|
||||
|
||||
/**
|
||||
* Primary sub-navigation text color
|
||||
* Empty: link_color
|
||||
*/
|
||||
generate_colors_live_update( 'slideout_submenu_text_color', '.slideout-navigation.main-navigation .main-nav ul ul li a', 'color', '' );
|
||||
|
||||
/**
|
||||
* Primary sub-navigation hover
|
||||
*/
|
||||
var slideout_submenu_hover = '.slideout-navigation.main-navigation .main-nav ul ul li:hover > a,\
|
||||
.slideout-navigation.main-navigation .main-nav ul ul li:focus > a,\
|
||||
.slideout-navigation.main-navigation .main-nav ul ul li.sfHover > a';
|
||||
|
||||
/**
|
||||
* Primary sub-navigation text hover
|
||||
* Empty: link_color_hover
|
||||
*/
|
||||
generate_colors_live_update( 'slideout_submenu_text_hover_color', slideout_submenu_hover, 'color', '' );
|
||||
|
||||
/**
|
||||
* Primary sub-navigation background hover
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'slideout_submenu_background_hover_color', slideout_submenu_hover, 'background-color', '' );
|
||||
|
||||
/**
|
||||
* Navigation current selectors
|
||||
*/
|
||||
var slideout_current = '.slideout-navigation.main-navigation .main-nav ul li[class*="current-menu-"] > a,\
|
||||
.slideout-navigation.main-navigation .main-nav ul li[class*="current-menu-"] > a:hover,\
|
||||
.slideout-navigation.main-navigation .main-nav ul li[class*="current-menu-"].sfHover > a';
|
||||
|
||||
/**
|
||||
* Primary navigation current text
|
||||
* Empty: link_color
|
||||
*/
|
||||
generate_colors_live_update( 'slideout_text_current_color', slideout_current, 'color', '' );
|
||||
|
||||
/**
|
||||
* Primary navigation current text
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'slideout_background_current_color', slideout_current, 'background-color' );
|
||||
|
||||
/**
|
||||
* Primary sub-navigation current selectors
|
||||
*/
|
||||
var slideout_submenu_current = '.slideout-navigation.main-navigation .main-nav ul ul li[class*="current-menu-"] > a,\
|
||||
.slideout-navigation.main-navigation .main-nav ul ul li[class*="current-menu-"] > a:hover,\
|
||||
.slideout-navigation.main-navigation .main-nav ul ul li[class*="current-menu-"].sfHover > a';
|
||||
|
||||
/**
|
||||
* Primary sub-navigation current text
|
||||
* Empty: link_color
|
||||
*/
|
||||
generate_colors_live_update( 'slideout_submenu_text_current_color', slideout_submenu_current, 'color', '' );
|
||||
|
||||
/**
|
||||
* Primary navigation current item background
|
||||
* Empty: transparent
|
||||
*/
|
||||
generate_colors_live_update( 'slideout_submenu_background_current_color', slideout_submenu_current, 'background-color' );
|
@ -0,0 +1,161 @@
|
||||
/**
|
||||
* WooCommerce link color
|
||||
*/
|
||||
generate_colors_live_update( 'wc_product_title_color', '.woocommerce ul.products li.product .woocommerce-LoopProduct-link', 'color', '', 'link_color' );
|
||||
generate_colors_live_update( 'wc_product_title_color_hover', '.woocommerce ul.products li.product .woocommerce-LoopProduct-link:hover', 'color', '', 'link_color_hover' );
|
||||
|
||||
/**
|
||||
* WooCommerce primary button
|
||||
*/
|
||||
var wc_button = '.woocommerce #respond input#submit, .woocommerce a.button, .woocommerce button.button, .woocommerce input.button, button, \
|
||||
html input[type="button"], \
|
||||
input[type="reset"], \
|
||||
input[type="submit"],\
|
||||
.button,\
|
||||
.button:visited';
|
||||
generate_colors_live_update( 'form_button_background_color', wc_button, 'background-color' );
|
||||
generate_colors_live_update( 'form_button_text_color', wc_button, 'color' );
|
||||
|
||||
/**
|
||||
* WooCommerce primary button hover
|
||||
*/
|
||||
var wc_button_hover = '.woocommerce #respond input#submit:hover, .woocommerce a.button:hover, .woocommerce button.button:hover, .woocommerce input.button:hover,button:hover, \
|
||||
html input[type="button"]:hover, \
|
||||
input[type="reset"]:hover, \
|
||||
input[type="submit"]:hover,\
|
||||
.button:hover,\
|
||||
button:focus, \
|
||||
html input[type="button"]:focus, \
|
||||
input[type="reset"]:focus, \
|
||||
input[type="submit"]:focus,\
|
||||
.button:focus';
|
||||
generate_colors_live_update( 'form_button_background_color_hover', wc_button_hover, 'background-color' );
|
||||
generate_colors_live_update( 'form_button_text_color_hover', wc_button_hover, 'color' );
|
||||
|
||||
/**
|
||||
* WooCommerce alt button
|
||||
*/
|
||||
var wc_alt_button = '.woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt';
|
||||
generate_colors_live_update( 'wc_alt_button_background', wc_alt_button, 'background-color' );
|
||||
generate_colors_live_update( 'wc_alt_button_text', wc_alt_button, 'color' );
|
||||
|
||||
/**
|
||||
* WooCommerce alt button hover
|
||||
*/
|
||||
var wc_alt_button_hover = '.woocommerce #respond input#submit.alt:hover, .woocommerce a.button.alt:hover, .woocommerce button.button.alt:hover, .woocommerce input.button.alt:hover';
|
||||
generate_colors_live_update( 'wc_alt_button_background_hover', wc_alt_button_hover, 'background-color' );
|
||||
generate_colors_live_update( 'wc_alt_button_text_hover', wc_alt_button_hover, 'color' );
|
||||
|
||||
/**
|
||||
* WooCommerce star ratings
|
||||
*/
|
||||
var wc_stars = '.woocommerce .star-rating span:before, .woocommerce .star-rating:before';
|
||||
generate_colors_live_update( 'wc_rating_stars', wc_stars, 'color' );
|
||||
|
||||
/**
|
||||
* WooCommerce sale sticker
|
||||
*/
|
||||
var wc_sale_sticker = '.woocommerce span.onsale';
|
||||
generate_colors_live_update( 'wc_sale_sticker_background', wc_sale_sticker, 'background-color' );
|
||||
generate_colors_live_update( 'wc_sale_sticker_text', wc_sale_sticker, 'color' );
|
||||
|
||||
/**
|
||||
* WooCommerce price
|
||||
*/
|
||||
var wc_price = '.woocommerce ul.products li.product .price, .woocommerce div.product p.price';
|
||||
generate_colors_live_update( 'wc_price_color', wc_price, 'color' );
|
||||
|
||||
/**
|
||||
* WooCommerce product tab text
|
||||
*/
|
||||
var wc_product_tab = '.woocommerce div.product .woocommerce-tabs ul.tabs li a';
|
||||
generate_colors_live_update( 'wc_product_tab', wc_product_tab, 'color' );
|
||||
|
||||
/**
|
||||
* WooCommerce product tab text highlight/active
|
||||
*/
|
||||
var wc_product_tab_active = '.woocommerce div.product .woocommerce-tabs ul.tabs li a:hover, .woocommerce div.product .woocommerce-tabs ul.tabs li.active a';
|
||||
generate_colors_live_update( 'wc_product_tab_highlight', wc_product_tab_active, 'color' );
|
||||
|
||||
/**
|
||||
* WooCommerce success message
|
||||
*/
|
||||
var wc_success_message = '.woocommerce-message';
|
||||
generate_colors_live_update( 'wc_success_message_background', wc_success_message, 'background-color' );
|
||||
generate_colors_live_update( 'wc_success_message_text', wc_success_message + ', div.woocommerce-message a.button, div.woocommerce-message a.button:focus, div.woocommerce-message a.button:hover, div.woocommerce-message a, div.woocommerce-message a:focus, div.woocommerce-message a:hover', 'color' );
|
||||
|
||||
/**
|
||||
* WooCommerce info message
|
||||
*/
|
||||
var wc_info_message = '.woocommerce-info';
|
||||
generate_colors_live_update( 'wc_info_message_background', wc_info_message, 'background-color' );
|
||||
generate_colors_live_update( 'wc_info_message_text', wc_info_message + ', div.woocommerce-info a.button, div.woocommerce-info a.button:focus, div.woocommerce-info a.button:hover, div.woocommerce-info a, div.woocommerce-info a:focus, div.woocommerce-info a:hover', 'color' );
|
||||
|
||||
/**
|
||||
* WooCommerce error message
|
||||
*/
|
||||
var wc_error_message = '.woocommerce-error';
|
||||
generate_colors_live_update( 'wc_error_message_background', wc_error_message, 'background-color' );
|
||||
generate_colors_live_update( 'wc_error_message_text', wc_error_message + ', div.woocommerce-error a.button, div.woocommerce-error a.button:focus, div.woocommerce-error a.button:hover, div.woocommerce-error a, div.woocommerce-error a:focus, div.woocommerce-error a:hover', 'color' );
|
||||
|
||||
/**
|
||||
* Menu Mini Cart
|
||||
*/
|
||||
generate_colors_live_update( 'wc_mini_cart_background_color', '#wc-mini-cart', 'background-color' );
|
||||
generate_colors_live_update( 'wc_mini_cart_text_color', '#wc-mini-cart,#wc-mini-cart a:not(.button), #wc-mini-cart a.remove', 'color' );
|
||||
|
||||
generate_colors_live_update( 'wc_mini_cart_button_background', '#wc-mini-cart .button.checkout', 'background-color' );
|
||||
generate_colors_live_update( 'wc_mini_cart_button_text', '#wc-mini-cart .button.checkout', 'color' );
|
||||
|
||||
generate_colors_live_update( 'wc_mini_cart_button_background_hover', '#wc-mini-cart .button.checkout:hover, #wc-mini-cart .button.checkout:focus, #wc-mini-cart .button.checkout:active', 'background-color' );
|
||||
generate_colors_live_update( 'wc_mini_cart_button_text_hover', '#wc-mini-cart .button.checkout:hover, #wc-mini-cart .button.checkout:focus, #wc-mini-cart .button.checkout:active', 'color' );
|
||||
|
||||
/**
|
||||
* Sticky panel cart button
|
||||
*/
|
||||
generate_colors_live_update( 'wc_panel_cart_background_color', '.add-to-cart-panel', 'background-color' );
|
||||
generate_colors_live_update( 'wc_panel_cart_text_color', '.add-to-cart-panel, .add-to-cart-panel a:not(.button)', 'color' );
|
||||
|
||||
generate_colors_live_update( 'wc_panel_cart_button_background', '#wc-sticky-cart-panel .button', 'background-color' );
|
||||
generate_colors_live_update( 'wc_panel_cart_button_text', '#wc-sticky-cart-panel .button', 'color' );
|
||||
|
||||
generate_colors_live_update( 'wc_panel_cart_button_background_hover', '#wc-sticky-cart-panel .button:hover, #wc-sticky-cart-panel .button:focus, #wc-sticky-cart-panel .button:active', 'background-color' );
|
||||
generate_colors_live_update( 'wc_panel_cart_button_text_hover', '#wc-sticky-cart-panel .button:hover, #wc-sticky-cart-panel .button:focus, #wc-sticky-cart-panel .button:active', 'color' );
|
||||
|
||||
/**
|
||||
* Price slider bar
|
||||
*/
|
||||
generate_colors_live_update( 'wc_price_slider_background_color', '.woocommerce .widget_price_filter .price_slider_wrapper .ui-widget-content', 'background-color' );
|
||||
generate_colors_live_update( 'wc_price_slider_bar_color', '.woocommerce .widget_price_filter .ui-slider .ui-slider-range, .woocommerce .widget_price_filter .ui-slider .ui-slider-handle', 'background-color' );
|
||||
|
||||
// Archive product description text
|
||||
wp.customize( 'generate_settings[text_color]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( ! wp.customize.value('generate_settings[content_text_color]')() ) {
|
||||
if ( jQuery( 'style#wc_desc_color' ).length ) {
|
||||
jQuery( 'style#wc_desc_color' ).html( '.woocommerce-product-details__short-description{color:' + newval + ';}' );
|
||||
} else {
|
||||
jQuery( 'head' ).append( '<style id="wc_desc_color">.woocommerce-product-details__short-description{color:' + newval + ';}</style>' );
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#wc_desc_color' ).not( ':last' ).remove();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
wp.customize( 'generate_settings[content_text_color]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( '' == newval ) {
|
||||
newval = wp.customize.value('generate_settings[text_color]')();
|
||||
}
|
||||
if ( jQuery( 'style#wc_desc_color' ).length ) {
|
||||
jQuery( 'style#wc_desc_color' ).html( '.woocommerce-product-details__short-description{color:' + newval + ';}' );
|
||||
} else {
|
||||
jQuery( 'head' ).append( '<style id="wc_desc_color">.woocommerce-product-details__short-description{color:' + newval + ';}</style>' );
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#wc_desc_color' ).not( ':last' ).remove();
|
||||
}, 1000);
|
||||
}
|
||||
} );
|
||||
} );
|
@ -0,0 +1,403 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the Customizer options for the Secondary Nav module.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_colors_secondary_nav_customizer' ) ) {
|
||||
add_action( 'customize_register', 'generate_colors_secondary_nav_customizer', 1000 );
|
||||
/**
|
||||
* Adds our Secondary Nav color options
|
||||
*
|
||||
* These options are in their own function so we can hook it in late to
|
||||
* make sure Secondary Nav is activated.
|
||||
*
|
||||
* 1000 priority is there to make sure Secondary Nav is registered (999)
|
||||
* as we check to see if the layout control exists.
|
||||
*
|
||||
* Secondary Nav now uses 100 as a priority.
|
||||
*
|
||||
* @param object $wp_customize The Customizer object.
|
||||
*/
|
||||
function generate_colors_secondary_nav_customizer( $wp_customize ) {
|
||||
// Bail if Secondary Nav isn't activated.
|
||||
if ( ! $wp_customize->get_section( 'secondary_nav_section' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Bail if we don't have our color defaults.
|
||||
if ( ! function_exists( 'generate_secondary_nav_get_defaults' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add our controls.
|
||||
require_once GP_LIBRARY_DIRECTORY . 'customizer-helpers.php';
|
||||
|
||||
// Get our defaults.
|
||||
$defaults = generate_secondary_nav_get_defaults();
|
||||
|
||||
// Add control types so controls can be built using JS.
|
||||
if ( method_exists( $wp_customize, 'register_control_type' ) ) {
|
||||
$wp_customize->register_control_type( 'GeneratePress_Alpha_Color_Customize_Control' );
|
||||
$wp_customize->register_control_type( 'GeneratePress_Title_Customize_Control' );
|
||||
$wp_customize->register_control_type( 'GeneratePress_Section_Shortcut_Control' );
|
||||
}
|
||||
|
||||
// Get our palettes.
|
||||
$palettes = generate_get_default_color_palettes();
|
||||
|
||||
// Add Secondary Navigation section.
|
||||
$wp_customize->add_section(
|
||||
'secondary_navigation_color_section',
|
||||
array(
|
||||
'title' => __( 'Secondary Navigation', 'gp-premium' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'priority' => 71,
|
||||
'panel' => 'generate_colors_panel',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Section_Shortcut_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_navigation_color_shortcuts',
|
||||
array(
|
||||
'section' => 'secondary_navigation_color_section',
|
||||
'element' => __( 'Secondary Navigation', 'gp-premium' ),
|
||||
'shortcuts' => array(
|
||||
'layout' => 'secondary_nav_section',
|
||||
'typography' => 'secondary_font_section',
|
||||
'backgrounds' => 'secondary_bg_images_section',
|
||||
),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
'priority' => 1,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Title_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_navigation_items',
|
||||
array(
|
||||
'section' => 'secondary_navigation_color_section',
|
||||
'type' => 'generatepress-customizer-title',
|
||||
'title' => __( 'Parent Items', 'gp-premium' ),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Background.
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[navigation_background_color]',
|
||||
array(
|
||||
'default' => $defaults['navigation_background_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'secondary_navigation_background_color',
|
||||
array(
|
||||
'label' => __( 'Background', 'gp-premium' ),
|
||||
'section' => 'secondary_navigation_color_section',
|
||||
'settings' => 'generate_secondary_nav_settings[navigation_background_color]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Text.
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[navigation_text_color]',
|
||||
array(
|
||||
'default' => $defaults['navigation_text_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'secondary_navigation_text_color',
|
||||
array(
|
||||
'label' => __( 'Text', 'gp-premium' ),
|
||||
'section' => 'secondary_navigation_color_section',
|
||||
'settings' => 'generate_secondary_nav_settings[navigation_text_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Background hover.
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[navigation_background_hover_color]',
|
||||
array(
|
||||
'default' => $defaults['navigation_background_hover_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'secondary_navigation_background_hover_color',
|
||||
array(
|
||||
'label' => __( 'Background Hover', 'gp-premium' ),
|
||||
'section' => 'secondary_navigation_color_section',
|
||||
'settings' => 'generate_secondary_nav_settings[navigation_background_hover_color]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Text hover.
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[navigation_text_hover_color]',
|
||||
array(
|
||||
'default' => $defaults['navigation_text_hover_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'secondary_navigation_text_hover_color',
|
||||
array(
|
||||
'label' => __( 'Text Hover', 'gp-premium' ),
|
||||
'section' => 'secondary_navigation_color_section',
|
||||
'settings' => 'generate_secondary_nav_settings[navigation_text_hover_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Background current.
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[navigation_background_current_color]',
|
||||
array(
|
||||
'default' => $defaults['navigation_background_current_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'secondary_navigation_background_current_color',
|
||||
array(
|
||||
'label' => __( 'Background Current', 'gp-premium' ),
|
||||
'section' => 'secondary_navigation_color_section',
|
||||
'settings' => 'generate_secondary_nav_settings[navigation_background_current_color]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Text current.
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[navigation_text_current_color]',
|
||||
array(
|
||||
'default' => $defaults['navigation_text_current_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'secondary_navigation_text_current_color',
|
||||
array(
|
||||
'label' => __( 'Text Current', 'gp-premium' ),
|
||||
'section' => 'secondary_navigation_color_section',
|
||||
'settings' => 'generate_secondary_nav_settings[navigation_text_current_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Title_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_navigation_sub_menu_items',
|
||||
array(
|
||||
'section' => 'secondary_navigation_color_section',
|
||||
'type' => 'generatepress-customizer-title',
|
||||
'title' => __( 'Sub-Menu Items', 'gp-premium' ),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Background.
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[subnavigation_background_color]',
|
||||
array(
|
||||
'default' => $defaults['subnavigation_background_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'secondary_subnavigation_background_color',
|
||||
array(
|
||||
'label' => __( 'Background', 'gp-premium' ),
|
||||
'section' => 'secondary_navigation_color_section',
|
||||
'settings' => 'generate_secondary_nav_settings[subnavigation_background_color]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Text.
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[subnavigation_text_color]',
|
||||
array(
|
||||
'default' => $defaults['subnavigation_text_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'secondary_subnavigation_text_color',
|
||||
array(
|
||||
'label' => __( 'Text', 'gp-premium' ),
|
||||
'section' => 'secondary_navigation_color_section',
|
||||
'settings' => 'generate_secondary_nav_settings[subnavigation_text_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Background hover.
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[subnavigation_background_hover_color]',
|
||||
array(
|
||||
'default' => $defaults['subnavigation_background_hover_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'secondary_subnavigation_background_hover_color',
|
||||
array(
|
||||
'label' => __( 'Background Hover', 'gp-premium' ),
|
||||
'section' => 'secondary_navigation_color_section',
|
||||
'settings' => 'generate_secondary_nav_settings[subnavigation_background_hover_color]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Text hover.
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[subnavigation_text_hover_color]',
|
||||
array(
|
||||
'default' => $defaults['subnavigation_text_hover_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'secondary_subnavigation_text_hover_color',
|
||||
array(
|
||||
'label' => __( 'Text Hover', 'gp-premium' ),
|
||||
'section' => 'secondary_navigation_color_section',
|
||||
'settings' => 'generate_secondary_nav_settings[subnavigation_text_hover_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Background current.
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[subnavigation_background_current_color]',
|
||||
array(
|
||||
'default' => $defaults['subnavigation_background_current_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'secondary_subnavigation_background_current_color',
|
||||
array(
|
||||
'label' => __( 'Background Current', 'gp-premium' ),
|
||||
'section' => 'secondary_navigation_color_section',
|
||||
'settings' => 'generate_secondary_nav_settings[subnavigation_background_current_color]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Text current.
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[subnavigation_text_current_color]',
|
||||
array(
|
||||
'default' => $defaults['subnavigation_text_current_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'secondary_subnavigation_text_current_color',
|
||||
array(
|
||||
'label' => __( 'Text Current', 'gp-premium' ),
|
||||
'section' => 'secondary_navigation_color_section',
|
||||
'settings' => 'generate_secondary_nav_settings[subnavigation_text_current_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,400 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the Customizer options for the Off-Canvas Panel.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
add_action( 'customize_preview_init', 'generate_menu_plus_live_preview_scripts', 20 );
|
||||
/**
|
||||
* Add live preview JS to the Customizer.
|
||||
*/
|
||||
function generate_menu_plus_live_preview_scripts() {
|
||||
wp_enqueue_script( 'generate-menu-plus-colors-customizer' );
|
||||
}
|
||||
|
||||
add_action( 'customize_register', 'generate_slideout_navigation_color_controls', 150 );
|
||||
/**
|
||||
* Adds our Slideout Nav color options
|
||||
*
|
||||
* @since 1.6
|
||||
* @param object $wp_customize The Customizer object.
|
||||
*/
|
||||
function generate_slideout_navigation_color_controls( $wp_customize ) {
|
||||
// Bail if Secondary Nav isn't activated.
|
||||
if ( ! $wp_customize->get_section( 'menu_plus_slideout_menu' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Bail if we don't have our color defaults.
|
||||
if ( ! function_exists( 'generate_get_color_defaults' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add our controls.
|
||||
require_once GP_LIBRARY_DIRECTORY . 'customizer-helpers.php';
|
||||
|
||||
// Get our defaults.
|
||||
$defaults = generate_get_color_defaults();
|
||||
|
||||
// Add control types so controls can be built using JS.
|
||||
if ( method_exists( $wp_customize, 'register_control_type' ) ) {
|
||||
$wp_customize->register_control_type( 'GeneratePress_Alpha_Color_Customize_Control' );
|
||||
$wp_customize->register_control_type( 'GeneratePress_Section_Shortcut_Control' );
|
||||
}
|
||||
|
||||
// Get our palettes.
|
||||
$palettes = generate_get_default_color_palettes();
|
||||
|
||||
// Add Secondary Navigation section.
|
||||
$wp_customize->add_section(
|
||||
'slideout_color_section',
|
||||
array(
|
||||
'title' => __( 'Off Canvas Panel', 'gp-premium' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'priority' => 73,
|
||||
'panel' => 'generate_colors_panel',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Section_Shortcut_Control(
|
||||
$wp_customize,
|
||||
'generate_off_canvas_color_shortcuts',
|
||||
array(
|
||||
'section' => 'slideout_color_section',
|
||||
'element' => __( 'Off Canvas Panel', 'gp-premium' ),
|
||||
'shortcuts' => array(
|
||||
'layout' => 'menu_plus_slideout_menu',
|
||||
'typography' => 'generate_slideout_typography',
|
||||
),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
'priority' => 1,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Title_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_slideout_navigation_items',
|
||||
array(
|
||||
'section' => 'slideout_color_section',
|
||||
'type' => 'generatepress-customizer-title',
|
||||
'title' => __( 'Parent Menu Items', 'gp-premium' ),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Background.
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[slideout_background_color]',
|
||||
array(
|
||||
'default' => $defaults['slideout_background_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[slideout_background_color]',
|
||||
array(
|
||||
'label' => __( 'Background', 'gp-premium' ),
|
||||
'section' => 'slideout_color_section',
|
||||
'settings' => 'generate_settings[slideout_background_color]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Text.
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[slideout_text_color]',
|
||||
array(
|
||||
'default' => $defaults['slideout_text_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[slideout_text_color]',
|
||||
array(
|
||||
'label' => __( 'Text', 'gp-premium' ),
|
||||
'section' => 'slideout_color_section',
|
||||
'settings' => 'generate_settings[slideout_text_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Background hover.
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[slideout_background_hover_color]',
|
||||
array(
|
||||
'default' => $defaults['slideout_background_hover_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[slideout_background_hover_color]',
|
||||
array(
|
||||
'label' => __( 'Background Hover', 'gp-premium' ),
|
||||
'section' => 'slideout_color_section',
|
||||
'settings' => 'generate_settings[slideout_background_hover_color]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Text hover.
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[slideout_text_hover_color]',
|
||||
array(
|
||||
'default' => $defaults['slideout_text_hover_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[slideout_text_hover_color]',
|
||||
array(
|
||||
'label' => __( 'Text Hover', 'gp-premium' ),
|
||||
'section' => 'slideout_color_section',
|
||||
'settings' => 'generate_settings[slideout_text_hover_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Background current.
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[slideout_background_current_color]',
|
||||
array(
|
||||
'default' => $defaults['slideout_background_current_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[slideout_background_current_color]',
|
||||
array(
|
||||
'label' => __( 'Background Current', 'gp-premium' ),
|
||||
'section' => 'slideout_color_section',
|
||||
'settings' => 'generate_settings[slideout_background_current_color]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Text current.
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[slideout_text_current_color]',
|
||||
array(
|
||||
'default' => $defaults['slideout_text_current_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[slideout_text_current_color]',
|
||||
array(
|
||||
'label' => __( 'Text Current', 'gp-premium' ),
|
||||
'section' => 'slideout_color_section',
|
||||
'settings' => 'generate_settings[slideout_text_current_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Title_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_slideout_navigation_sub_menu_items',
|
||||
array(
|
||||
'section' => 'slideout_color_section',
|
||||
'type' => 'generatepress-customizer-title',
|
||||
'title' => __( 'Sub-Menu Items', 'gp-premium' ),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Background.
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[slideout_submenu_background_color]',
|
||||
array(
|
||||
'default' => $defaults['slideout_submenu_background_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[slideout_submenu_background_color]',
|
||||
array(
|
||||
'label' => __( 'Background', 'gp-premium' ),
|
||||
'section' => 'slideout_color_section',
|
||||
'settings' => 'generate_settings[slideout_submenu_background_color]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Text.
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[slideout_submenu_text_color]',
|
||||
array(
|
||||
'default' => $defaults['slideout_submenu_text_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[slideout_submenu_text_color]',
|
||||
array(
|
||||
'label' => __( 'Text', 'gp-premium' ),
|
||||
'section' => 'slideout_color_section',
|
||||
'settings' => 'generate_settings[slideout_submenu_text_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Background hover.
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[slideout_submenu_background_hover_color]',
|
||||
array(
|
||||
'default' => $defaults['slideout_submenu_background_hover_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[slideout_submenu_background_hover_color]',
|
||||
array(
|
||||
'label' => __( 'Background Hover', 'gp-premium' ),
|
||||
'section' => 'slideout_color_section',
|
||||
'settings' => 'generate_settings[slideout_submenu_background_hover_color]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Text hover.
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[slideout_submenu_text_hover_color]',
|
||||
array(
|
||||
'default' => $defaults['slideout_submenu_text_hover_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[slideout_submenu_text_hover_color]',
|
||||
array(
|
||||
'label' => __( 'Text Hover', 'gp-premium' ),
|
||||
'section' => 'slideout_color_section',
|
||||
'settings' => 'generate_settings[slideout_submenu_text_hover_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Background current.
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[slideout_submenu_background_current_color]',
|
||||
array(
|
||||
'default' => $defaults['slideout_submenu_background_current_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[slideout_submenu_background_current_color]',
|
||||
array(
|
||||
'label' => __( 'Background Current', 'gp-premium' ),
|
||||
'section' => 'slideout_color_section',
|
||||
'settings' => 'generate_settings[slideout_submenu_background_current_color]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Text current.
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[slideout_submenu_text_current_color]',
|
||||
array(
|
||||
'default' => $defaults['slideout_submenu_text_current_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[slideout_submenu_text_current_color]',
|
||||
array(
|
||||
'label' => __( 'Text Current', 'gp-premium' ),
|
||||
'section' => 'slideout_color_section',
|
||||
'settings' => 'generate_settings[slideout_submenu_text_current_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
@ -0,0 +1,911 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the Customizer options for the WooCommerce module.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_colors_wc_customizer' ) ) {
|
||||
add_action( 'customize_register', 'generate_colors_wc_customizer', 100 );
|
||||
/**
|
||||
* Adds our WooCommerce color options
|
||||
*
|
||||
* @param object $wp_customize The Customizer object.
|
||||
*/
|
||||
function generate_colors_wc_customizer( $wp_customize ) {
|
||||
// Bail if WooCommerce isn't activated.
|
||||
if ( ! $wp_customize->get_section( 'generate_woocommerce_colors' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_get_color_defaults' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add our controls.
|
||||
require_once GP_LIBRARY_DIRECTORY . 'customizer-helpers.php';
|
||||
|
||||
// Get our defaults.
|
||||
$defaults = generate_get_color_defaults();
|
||||
|
||||
// Add control types so controls can be built using JS.
|
||||
if ( method_exists( $wp_customize, 'register_control_type' ) ) {
|
||||
$wp_customize->register_control_type( 'GeneratePress_Alpha_Color_Customize_Control' );
|
||||
$wp_customize->register_control_type( 'GeneratePress_Title_Customize_Control' );
|
||||
$wp_customize->register_control_type( 'GeneratePress_Information_Customize_Control' );
|
||||
$wp_customize->register_control_type( 'GeneratePress_Section_Shortcut_Control' );
|
||||
}
|
||||
|
||||
// Get our palettes.
|
||||
$palettes = generate_get_default_color_palettes();
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Section_Shortcut_Control(
|
||||
$wp_customize,
|
||||
'generate_woocommerce_color_shortcuts',
|
||||
array(
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'element' => __( 'WooCommerce', 'gp-premium' ),
|
||||
'shortcuts' => array(
|
||||
'layout' => 'generate_woocommerce_layout',
|
||||
'typography' => 'generate_woocommerce_typography',
|
||||
),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
'priority' => 0,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Title_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_woocommerce_button_title',
|
||||
array(
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'type' => 'generatepress-customizer-title',
|
||||
'title' => __( 'Buttons', 'gp-premium' ),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Information_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_woocommerce_primary_button_message',
|
||||
array(
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'label' => __( 'Primary Button Colors', 'gp-premium' ),
|
||||
'description' => __( 'Primary button colors can be set <a href="#">here</a>.', 'gp-premium' ),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_alt_button_background]',
|
||||
array(
|
||||
'default' => $defaults['wc_alt_button_background'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_alt_button_background]',
|
||||
array(
|
||||
'label' => __( 'Alt Button Background', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_alt_button_background]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_alt_button_background_hover]',
|
||||
array(
|
||||
'default' => $defaults['wc_alt_button_background_hover'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_alt_button_background_hover]',
|
||||
array(
|
||||
'label' => __( 'Alt Button Background Hover', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_alt_button_background_hover]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_alt_button_text]',
|
||||
array(
|
||||
'default' => $defaults['wc_alt_button_text'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_alt_button_text]',
|
||||
array(
|
||||
'label' => __( 'Alt Button Text', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_alt_button_text]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_alt_button_text_hover]',
|
||||
array(
|
||||
'default' => $defaults['wc_alt_button_text_hover'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_alt_button_text_hover]',
|
||||
array(
|
||||
'label' => __( 'Alt Button Text Hover', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_alt_button_text_hover]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Title_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_woocommerce_product_title',
|
||||
array(
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'type' => 'generatepress-customizer-title',
|
||||
'title' => __( 'Products', 'gp-premium' ),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_product_title_color]',
|
||||
array(
|
||||
'default' => $defaults['wc_product_title_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_product_title_color]',
|
||||
array(
|
||||
'label' => __( 'Product Title', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_product_title_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_product_title_color_hover]',
|
||||
array(
|
||||
'default' => $defaults['wc_product_title_color_hover'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_product_title_color_hover]',
|
||||
array(
|
||||
'label' => __( 'Product Title Hover', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_product_title_color_hover]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_rating_stars]',
|
||||
array(
|
||||
'default' => $defaults['wc_rating_stars'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => '',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_rating_stars]',
|
||||
array(
|
||||
'label' => __( 'Star Ratings', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_rating_stars]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_sale_sticker_background]',
|
||||
array(
|
||||
'default' => $defaults['wc_sale_sticker_background'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_sale_sticker_background]',
|
||||
array(
|
||||
'label' => __( 'Sale Sticker Background', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_sale_sticker_background]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_sale_sticker_text]',
|
||||
array(
|
||||
'default' => $defaults['wc_sale_sticker_text'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_sale_sticker_text]',
|
||||
array(
|
||||
'label' => __( 'Sale Sticker Text', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_sale_sticker_text]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_price_color]',
|
||||
array(
|
||||
'default' => $defaults['wc_price_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_price_color]',
|
||||
array(
|
||||
'label' => __( 'Price', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_price_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Title_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_woocommerce_panel_cart_title',
|
||||
array(
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'type' => 'generatepress-customizer-title',
|
||||
'title' => __( 'Sticky Panel Cart', 'gp-premium' ),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_panel_cart_background_color]',
|
||||
array(
|
||||
'default' => $defaults['wc_panel_cart_background_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_panel_cart_background_color]',
|
||||
array(
|
||||
'label' => __( 'Background Color', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_panel_cart_background_color]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_panel_cart_text_color]',
|
||||
array(
|
||||
'default' => $defaults['wc_panel_cart_text_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_panel_cart_text_color]',
|
||||
array(
|
||||
'label' => __( 'Text Color', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_panel_cart_text_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_panel_cart_button_background]',
|
||||
array(
|
||||
'default' => $defaults['wc_panel_cart_button_background'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_panel_cart_button_background]',
|
||||
array(
|
||||
'label' => __( 'Button Background', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_panel_cart_button_background]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_panel_cart_button_background_hover]',
|
||||
array(
|
||||
'default' => $defaults['wc_panel_cart_button_background_hover'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_panel_cart_button_background_hover]',
|
||||
array(
|
||||
'label' => __( 'Button Background Hover', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_panel_cart_button_background_hover]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_panel_cart_button_text]',
|
||||
array(
|
||||
'default' => $defaults['wc_panel_cart_button_text'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_panel_cart_button_text]',
|
||||
array(
|
||||
'label' => __( 'Button Text', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_panel_cart_button_text]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_panel_cart_button_text_hover]',
|
||||
array(
|
||||
'default' => $defaults['wc_panel_cart_button_text_hover'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_panel_cart_button_text_hover]',
|
||||
array(
|
||||
'label' => __( 'Button Text Hover', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_panel_cart_button_text_hover]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Title_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_woocommerce_mini_cart_title',
|
||||
array(
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'type' => 'generatepress-customizer-title',
|
||||
'title' => __( 'Menu Mini Cart', 'gp-premium' ),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_mini_cart_background_color]',
|
||||
array(
|
||||
'default' => $defaults['wc_mini_cart_background_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_mini_cart_background_color]',
|
||||
array(
|
||||
'label' => __( 'Cart Background Color', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_mini_cart_background_color]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_mini_cart_text_color]',
|
||||
array(
|
||||
'default' => $defaults['wc_mini_cart_text_color'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_mini_cart_text_color]',
|
||||
array(
|
||||
'label' => __( 'Cart Text Color', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_mini_cart_text_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_mini_cart_button_background]',
|
||||
array(
|
||||
'default' => $defaults['wc_mini_cart_button_background'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_mini_cart_button_background]',
|
||||
array(
|
||||
'label' => __( 'Button Background', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_mini_cart_button_background]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_mini_cart_button_background_hover]',
|
||||
array(
|
||||
'default' => $defaults['wc_mini_cart_button_background_hover'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_mini_cart_button_background_hover]',
|
||||
array(
|
||||
'label' => __( 'Button Background Hover', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_mini_cart_button_background_hover]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_mini_cart_button_text]',
|
||||
array(
|
||||
'default' => $defaults['wc_mini_cart_button_text'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_mini_cart_button_text]',
|
||||
array(
|
||||
'label' => __( 'Button Text', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_mini_cart_button_text]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_mini_cart_button_text_hover]',
|
||||
array(
|
||||
'default' => $defaults['wc_mini_cart_button_text_hover'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_mini_cart_button_text_hover]',
|
||||
array(
|
||||
'label' => __( 'Button Text Hover', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_mini_cart_button_text_hover]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Title_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_woocommerce_price_slider_title',
|
||||
array(
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'type' => 'generatepress-customizer-title',
|
||||
'title' => __( 'Price Slider Widget', 'gp-premium' ),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_price_slider_background_color]',
|
||||
array(
|
||||
'default' => $defaults['wc_price_slider_background_color'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_price_slider_background_color]',
|
||||
array(
|
||||
'label' => __( 'Slider Background Color', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_price_slider_background_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_price_slider_bar_color]',
|
||||
array(
|
||||
'default' => $defaults['wc_price_slider_bar_color'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_price_slider_bar_color]',
|
||||
array(
|
||||
'label' => __( 'Slider Bar Color', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_price_slider_bar_color]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Title_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_woocommerce_product_tabs_title',
|
||||
array(
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'type' => 'generatepress-customizer-title',
|
||||
'title' => __( 'Product Tabs', 'gp-premium' ),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_product_tab]',
|
||||
array(
|
||||
'default' => $defaults['wc_product_tab'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_product_tab]',
|
||||
array(
|
||||
'label' => __( 'Product Tab Text', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_product_tab]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_product_tab_highlight]',
|
||||
array(
|
||||
'default' => $defaults['wc_product_tab_highlight'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_product_tab_highlight]',
|
||||
array(
|
||||
'label' => __( 'Product Tab Active', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_product_tab_highlight]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Title_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_woocommerce_messages_title',
|
||||
array(
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'type' => 'generatepress-customizer-title',
|
||||
'title' => __( 'Messages', 'gp-premium' ),
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_success_message_background]',
|
||||
array(
|
||||
'default' => $defaults['wc_success_message_background'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_success_message_background]',
|
||||
array(
|
||||
'label' => __( 'Success Message Background', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_success_message_background]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_success_message_text]',
|
||||
array(
|
||||
'default' => $defaults['wc_success_message_text'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_success_message_text]',
|
||||
array(
|
||||
'label' => __( 'Success Message Text', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_success_message_text]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_info_message_background]',
|
||||
array(
|
||||
'default' => $defaults['wc_info_message_background'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_info_message_background]',
|
||||
array(
|
||||
'label' => __( 'Info Message Background', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_info_message_background]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_info_message_text]',
|
||||
array(
|
||||
'default' => $defaults['wc_info_message_text'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_info_message_text]',
|
||||
array(
|
||||
'label' => __( 'Info Message Text', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_info_message_text]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_error_message_background]',
|
||||
array(
|
||||
'default' => $defaults['wc_error_message_background'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_rgba',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Alpha_Color_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_error_message_background]',
|
||||
array(
|
||||
'label' => __( 'Error Message Background', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_error_message_background]',
|
||||
'palette' => $palettes,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[wc_error_message_text]',
|
||||
array(
|
||||
'default' => $defaults['wc_error_message_text'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'generate_premium_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[wc_error_message_text]',
|
||||
array(
|
||||
'label' => __( 'Error Message Text', 'gp-premium' ),
|
||||
'section' => 'generate_woocommerce_colors',
|
||||
'settings' => 'generate_settings[wc_error_message_text]',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* The Colors module.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
// Define the version. This used to be a standalone plugin, so we need to keep this constant.
|
||||
if ( ! defined( 'GENERATE_COLORS_VERSION' ) ) {
|
||||
define( 'GENERATE_COLORS_VERSION', GP_PREMIUM_VERSION );
|
||||
}
|
||||
|
||||
// Include functions identical between standalone addon and GP Premium.
|
||||
require plugin_dir_path( __FILE__ ) . 'functions/functions.php';
|
@ -0,0 +1,223 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the Copyright functionality.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_copyright_customize_register' ) ) {
|
||||
add_action( 'customize_register', 'generate_copyright_customize_register' );
|
||||
/**
|
||||
* Add our copyright options to the Customizer.
|
||||
*
|
||||
* @param object $wp_customize The Customizer object.
|
||||
*/
|
||||
function generate_copyright_customize_register( $wp_customize ) {
|
||||
// Get our custom control.
|
||||
require_once GP_LIBRARY_DIRECTORY . 'customizer-helpers.php';
|
||||
|
||||
// Register our custom control.
|
||||
if ( method_exists( $wp_customize, 'register_control_type' ) ) {
|
||||
$wp_customize->register_control_type( 'GeneratePress_Copyright_Customize_Control' );
|
||||
}
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_copyright',
|
||||
array(
|
||||
'default' => '',
|
||||
'type' => 'theme_mod',
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Copyright_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_copyright',
|
||||
array(
|
||||
'label' => __( 'Copyright', 'gp-premium' ),
|
||||
'section' => 'generate_layout_footer',
|
||||
'settings' => 'generate_copyright',
|
||||
'priority' => 500,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Initiate selective refresh.
|
||||
if ( isset( $wp_customize->selective_refresh ) ) {
|
||||
$wp_customize->selective_refresh->add_partial(
|
||||
'generate_copyright',
|
||||
array(
|
||||
'selector' => '.copyright-bar',
|
||||
'settings' => array( 'generate_copyright' ),
|
||||
'render_callback' => 'generate_copyright_selective_refresh',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_copyright_selective_refresh' ) ) {
|
||||
/**
|
||||
* Return our copyright on selective refresh
|
||||
*/
|
||||
function generate_copyright_selective_refresh() {
|
||||
$options = array(
|
||||
'%current_year%',
|
||||
'%copy%',
|
||||
);
|
||||
|
||||
$replace = array(
|
||||
date( 'Y' ), // phpcs:ignore -- prefer date().
|
||||
'©',
|
||||
);
|
||||
|
||||
$new_copyright = get_theme_mod( 'generate_copyright' );
|
||||
$new_copyright = str_replace( $options, $replace, get_theme_mod( 'generate_copyright' ) );
|
||||
|
||||
return do_shortcode( $new_copyright );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_copyright_remove_default' ) ) {
|
||||
add_action( 'wp', 'generate_copyright_remove_default' );
|
||||
/**
|
||||
* Remove the default copyright.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated GP 1.3.42
|
||||
*/
|
||||
function generate_copyright_remove_default() {
|
||||
// As of 1.3.42, we no longer need to do this.
|
||||
// We use a nice little filter instead.
|
||||
if ( ! function_exists( 'generate_add_login_attribution' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( get_theme_mod( 'generate_copyright' ) && '' !== get_theme_mod( 'generate_copyright' ) ) {
|
||||
remove_action( 'generate_credits', 'generate_add_footer_info' );
|
||||
remove_action( 'generate_copyright_line', 'generate_add_login_attribution' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_copyright_add_custom' ) ) {
|
||||
add_action( 'generate_credits', 'generate_copyright_add_custom' );
|
||||
/**
|
||||
* Add the custom copyright.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated GP 1.3.42
|
||||
*/
|
||||
function generate_copyright_add_custom() {
|
||||
// As of 1.3.42, we no longer need to do this.
|
||||
// We use a nice little filter instead.
|
||||
if ( ! function_exists( 'generate_add_login_attribution' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$options = array(
|
||||
'%current_year%',
|
||||
'%copy%',
|
||||
);
|
||||
|
||||
$replace = array(
|
||||
date( 'Y' ), // phpcs:ignore -- prefer date().
|
||||
'©',
|
||||
);
|
||||
|
||||
$new_copyright = get_theme_mod( 'generate_copyright' );
|
||||
$new_copyright = str_replace( $options, $replace, get_theme_mod( 'generate_copyright' ) );
|
||||
|
||||
if ( get_theme_mod( 'generate_copyright' ) && '' !== get_theme_mod( 'generate_copyright' ) ) {
|
||||
echo do_shortcode( $new_copyright );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_apply_custom_copyright' ) ) {
|
||||
add_filter( 'generate_copyright', 'generate_apply_custom_copyright' );
|
||||
/**
|
||||
* Add the custom copyright
|
||||
*
|
||||
* @since 1.2.92
|
||||
* @param string $copyright The copyright value.
|
||||
*/
|
||||
function generate_apply_custom_copyright( $copyright ) {
|
||||
// This will only work if GP >= 1.3.42 and the below function doesn't exist.
|
||||
if ( function_exists( 'generate_add_login_attribution' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$options = array(
|
||||
'%current_year%',
|
||||
'%copy%',
|
||||
);
|
||||
|
||||
$replace = array(
|
||||
date( 'Y' ), // phpcs:ignore -- prefer date().
|
||||
'©',
|
||||
);
|
||||
|
||||
$new_copyright = get_theme_mod( 'generate_copyright' );
|
||||
$new_copyright = str_replace( $options, $replace, get_theme_mod( 'generate_copyright' ) );
|
||||
|
||||
if ( get_theme_mod( 'generate_copyright' ) && '' !== get_theme_mod( 'generate_copyright' ) ) {
|
||||
return do_shortcode( $new_copyright );
|
||||
}
|
||||
|
||||
return $copyright;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_copyright_customizer_live_preview' ) ) {
|
||||
add_action( 'customize_preview_init', 'generate_copyright_customizer_live_preview' );
|
||||
/**
|
||||
* Add our live preview
|
||||
*/
|
||||
function generate_copyright_customizer_live_preview() {
|
||||
wp_enqueue_script(
|
||||
'generate-copyright-customizer',
|
||||
plugin_dir_url( __FILE__ ) . 'js/customizer.js',
|
||||
array( 'jquery', 'customize-preview' ),
|
||||
GENERATE_COPYRIGHT_VERSION,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_update_copyright' ) ) {
|
||||
add_action( 'admin_init', 'generate_update_copyright' );
|
||||
/**
|
||||
* Our copyright use to have it's own setting
|
||||
* If we have the old setting, move it into our theme_mod
|
||||
*/
|
||||
function generate_update_copyright() {
|
||||
// If we already have a custom logo, bail.
|
||||
if ( get_theme_mod( 'generate_copyright' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the old logo value.
|
||||
$old_value = get_option( 'gen_custom_copyright' );
|
||||
|
||||
// If there's no old value, bail.
|
||||
if ( empty( $old_value ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Now let's update the new logo setting with our ID.
|
||||
set_theme_mod( 'generate_copyright', $old_value );
|
||||
|
||||
// Got our custom logo? Time to delete the old value.
|
||||
if ( get_theme_mod( 'generate_copyright' ) ) {
|
||||
delete_option( 'gen_custom_copyright' );
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Theme Customizer enhancements for a better user experience.
|
||||
*
|
||||
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
|
||||
*/
|
||||
|
||||
( function( $ ) {
|
||||
// Update the site title in real time...
|
||||
wp.customize( 'generate_copyright', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( $( '.copyright-bar' ).length ) {
|
||||
$( '.copyright-bar' ).html( newval );
|
||||
} else {
|
||||
$( '.inside-site-info' ).html( newval );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
}( jQuery ) );
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* The Copyright module.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
// Define the version.
|
||||
if ( ! defined( 'GENERATE_COPYRIGHT_VERSION' ) ) {
|
||||
define( 'GENERATE_COPYRIGHT_VERSION', GP_PREMIUM_VERSION );
|
||||
}
|
||||
|
||||
// Include functions identical between standalone addon and GP Premium.
|
||||
require plugin_dir_path( __FILE__ ) . 'functions/functions.php';
|
@ -0,0 +1,426 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the Disable Elements functionality.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
define( 'GENERATE_DE_LAYOUT_META_BOX', true );
|
||||
|
||||
if ( ! function_exists( 'generate_disable_elements' ) ) {
|
||||
/**
|
||||
* Remove the default disable_elements.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_disable_elements() {
|
||||
// Don't run the function unless we're on a page it applies to.
|
||||
if ( ! is_singular() ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
global $post;
|
||||
|
||||
// Prevent PHP notices.
|
||||
if ( isset( $post ) ) {
|
||||
$disable_header = get_post_meta( $post->ID, '_generate-disable-header', true );
|
||||
$disable_nav = get_post_meta( $post->ID, '_generate-disable-nav', true );
|
||||
$disable_secondary_nav = get_post_meta( $post->ID, '_generate-disable-secondary-nav', true );
|
||||
$disable_post_image = get_post_meta( $post->ID, '_generate-disable-post-image', true );
|
||||
$disable_headline = get_post_meta( $post->ID, '_generate-disable-headline', true );
|
||||
$disable_footer = get_post_meta( $post->ID, '_generate-disable-footer', true );
|
||||
}
|
||||
|
||||
$return = '';
|
||||
|
||||
if ( ! empty( $disable_header ) && false !== $disable_header ) {
|
||||
$return = '.site-header {display:none}';
|
||||
}
|
||||
|
||||
if ( ! empty( $disable_nav ) && false !== $disable_nav ) {
|
||||
$return .= '#site-navigation,.navigation-clone, #mobile-header {display:none !important}';
|
||||
}
|
||||
|
||||
if ( ! empty( $disable_secondary_nav ) && false !== $disable_secondary_nav ) {
|
||||
$return .= '#secondary-navigation {display:none}';
|
||||
}
|
||||
|
||||
if ( ! empty( $disable_post_image ) && false !== $disable_post_image ) {
|
||||
$return .= '.generate-page-header, .page-header-image, .page-header-image-single {display:none}';
|
||||
}
|
||||
|
||||
$need_css_removal = true;
|
||||
|
||||
if ( defined( 'GENERATE_VERSION' ) && version_compare( GENERATE_VERSION, '3.0.0-alpha.1', '>=' ) ) {
|
||||
$need_css_removal = false;
|
||||
}
|
||||
|
||||
if ( $need_css_removal && ! empty( $disable_headline ) && false !== $disable_headline && ! is_single() ) {
|
||||
$return .= '.entry-header {display:none} .page-content, .entry-content, .entry-summary {margin-top:0}';
|
||||
}
|
||||
|
||||
if ( ! empty( $disable_footer ) && false !== $disable_footer ) {
|
||||
$return .= '.site-footer {display:none}';
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_de_scripts' ) ) {
|
||||
add_action( 'wp_enqueue_scripts', 'generate_de_scripts', 50 );
|
||||
/**
|
||||
* Enqueue scripts and styles
|
||||
*/
|
||||
function generate_de_scripts() {
|
||||
wp_add_inline_style( 'generate-style', generate_disable_elements() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_add_de_meta_box' ) ) {
|
||||
add_action( 'add_meta_boxes', 'generate_add_de_meta_box', 50 );
|
||||
/**
|
||||
* Generate the layout metabox.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_add_de_meta_box() {
|
||||
// Set user role - make filterable.
|
||||
$allowed = apply_filters( 'generate_metabox_capability', 'edit_theme_options' );
|
||||
|
||||
// If not an administrator, don't show the metabox.
|
||||
if ( ! current_user_can( $allowed ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( defined( 'GENERATE_LAYOUT_META_BOX' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$args = array( 'public' => true );
|
||||
$post_types = get_post_types( $args );
|
||||
foreach ( $post_types as $type ) {
|
||||
if ( 'attachment' !== $type ) {
|
||||
add_meta_box(
|
||||
'generate_de_meta_box',
|
||||
__( 'Disable Elements', 'gp-premium' ),
|
||||
'generate_show_de_meta_box',
|
||||
$type,
|
||||
'side',
|
||||
'default'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_show_de_meta_box' ) ) {
|
||||
/**
|
||||
* Outputs the content of the metabox.
|
||||
*
|
||||
* @param object $post The post object.
|
||||
*/
|
||||
function generate_show_de_meta_box( $post ) {
|
||||
wp_nonce_field( basename( __FILE__ ), 'generate_de_nonce' );
|
||||
$stored_meta = get_post_meta( $post->ID );
|
||||
$stored_meta['_generate-disable-header'][0] = ( isset( $stored_meta['_generate-disable-header'][0] ) ) ? $stored_meta['_generate-disable-header'][0] : '';
|
||||
$stored_meta['_generate-disable-nav'][0] = ( isset( $stored_meta['_generate-disable-nav'][0] ) ) ? $stored_meta['_generate-disable-nav'][0] : '';
|
||||
$stored_meta['_generate-disable-secondary-nav'][0] = ( isset( $stored_meta['_generate-disable-secondary-nav'][0] ) ) ? $stored_meta['_generate-disable-secondary-nav'][0] : '';
|
||||
$stored_meta['_generate-disable-post-image'][0] = ( isset( $stored_meta['_generate-disable-post-image'][0] ) ) ? $stored_meta['_generate-disable-post-image'][0] : '';
|
||||
$stored_meta['_generate-disable-headline'][0] = ( isset( $stored_meta['_generate-disable-headline'][0] ) ) ? $stored_meta['_generate-disable-headline'][0] : '';
|
||||
$stored_meta['_generate-disable-footer'][0] = ( isset( $stored_meta['_generate-disable-footer'][0] ) ) ? $stored_meta['_generate-disable-footer'][0] : '';
|
||||
$stored_meta['_generate-disable-top-bar'][0] = ( isset( $stored_meta['_generate-disable-top-bar'][0] ) ) ? $stored_meta['_generate-disable-top-bar'][0] : '';
|
||||
?>
|
||||
|
||||
<p>
|
||||
<div class="generate_disable_elements">
|
||||
<?php if ( function_exists( 'generate_top_bar' ) ) : ?>
|
||||
<label for="meta-generate-disable-top-bar" style="display:block;margin-bottom:3px;" title="<?php _e( 'Top Bar', 'gp-premium' ); ?>">
|
||||
<input type="checkbox" name="_generate-disable-top-bar" id="meta-generate-disable-top-bar" value="true" <?php checked( $stored_meta['_generate-disable-top-bar'][0], 'true' ); ?>>
|
||||
<?php _e( 'Top Bar', 'gp-premium' ); ?>
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
|
||||
<label for="meta-generate-disable-header" style="display:block;margin-bottom:3px;" title="<?php _e( 'Header', 'gp-premium' ); ?>">
|
||||
<input type="checkbox" name="_generate-disable-header" id="meta-generate-disable-header" value="true" <?php checked( $stored_meta['_generate-disable-header'][0], 'true' ); ?>>
|
||||
<?php _e( 'Header', 'gp-premium' ); ?>
|
||||
</label>
|
||||
|
||||
<label for="meta-generate-disable-nav" style="display:block;margin-bottom:3px;" title="<?php _e( 'Primary Navigation', 'gp-premium' ); ?>">
|
||||
<input type="checkbox" name="_generate-disable-nav" id="meta-generate-disable-nav" value="true" <?php checked( $stored_meta['_generate-disable-nav'][0], 'true' ); ?>>
|
||||
<?php _e( 'Primary Navigation', 'gp-premium' ); ?>
|
||||
</label>
|
||||
|
||||
<?php if ( function_exists( 'generate_secondary_nav_setup' ) ) : ?>
|
||||
<label for="meta-generate-disable-secondary-nav" style="display:block;margin-bottom:3px;" title="<?php _e( 'Secondary Navigation', 'gp-premium' ); ?>">
|
||||
<input type="checkbox" name="_generate-disable-secondary-nav" id="meta-generate-disable-secondary-nav" value="true" <?php checked( $stored_meta['_generate-disable-secondary-nav'][0], 'true' ); ?>>
|
||||
<?php _e( 'Secondary Navigation', 'gp-premium' ); ?>
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
|
||||
<label for="meta-generate-disable-post-image" style="display:block;margin-bottom:3px;" title="<?php _e( 'Featured Image', 'gp-premium' ); ?>">
|
||||
<input type="checkbox" name="_generate-disable-post-image" id="meta-generate-disable-post-image" value="true" <?php checked( $stored_meta['_generate-disable-post-image'][0], 'true' ); ?>>
|
||||
<?php _e( 'Featured Image', 'gp-premium' ); ?>
|
||||
</label>
|
||||
|
||||
<label for="meta-generate-disable-headline" style="display:block;margin-bottom:3px;" title="<?php _e( 'Content Title', 'gp-premium' ); ?>">
|
||||
<input type="checkbox" name="_generate-disable-headline" id="meta-generate-disable-headline" value="true" <?php checked( $stored_meta['_generate-disable-headline'][0], 'true' ); ?>>
|
||||
<?php _e( 'Content Title', 'gp-premium' ); ?>
|
||||
</label>
|
||||
|
||||
<label for="meta-generate-disable-footer" style="display:block;margin-bottom:3px;" title="<?php _e( 'Footer', 'gp-premium' ); ?>">
|
||||
<input type="checkbox" name="_generate-disable-footer" id="meta-generate-disable-footer" value="true" <?php checked( $stored_meta['_generate-disable-footer'][0], 'true' ); ?>>
|
||||
<?php _e( 'Footer', 'gp-premium' ); ?>
|
||||
</label>
|
||||
</div>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_save_de_meta' ) ) {
|
||||
add_action( 'save_post', 'generate_save_de_meta' );
|
||||
/**
|
||||
* Save our options.
|
||||
*
|
||||
* @param int $post_id The post ID.
|
||||
*/
|
||||
function generate_save_de_meta( $post_id ) {
|
||||
|
||||
if ( defined( 'GENERATE_LAYOUT_META_BOX' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Checks save status.
|
||||
$is_autosave = wp_is_post_autosave( $post_id );
|
||||
$is_revision = wp_is_post_revision( $post_id );
|
||||
$is_valid_nonce = ( isset( $_POST['generate_de_nonce'] ) && wp_verify_nonce( $_POST['generate_de_nonce'], basename( __FILE__ ) ) ) ? true : false;
|
||||
|
||||
// Exits script depending on save status.
|
||||
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check that the logged in user has permission to edit this post.
|
||||
if ( ! current_user_can( 'edit_post', $post_id ) ) {
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
$options = array(
|
||||
'_generate-disable-top-bar',
|
||||
'_generate-disable-header',
|
||||
'_generate-disable-nav',
|
||||
'_generate-disable-secondary-nav',
|
||||
'_generate-disable-headline',
|
||||
'_generate-disable-footer',
|
||||
'_generate-disable-post-image',
|
||||
);
|
||||
|
||||
foreach ( $options as $key ) {
|
||||
$value = isset( $_POST[ $key ] )
|
||||
? sanitize_text_field( wp_unslash( $_POST[ $key ] ) )
|
||||
: '';
|
||||
|
||||
if ( $value ) {
|
||||
update_post_meta( $post_id, $key, $value );
|
||||
} else {
|
||||
delete_post_meta( $post_id, $key );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_disable_elements_setup' ) ) {
|
||||
add_action( 'wp', 'generate_disable_elements_setup', 50 );
|
||||
/**
|
||||
* Disable the things.
|
||||
*/
|
||||
function generate_disable_elements_setup() {
|
||||
// Don't run the function unless we're on a page it applies to.
|
||||
if ( ! is_singular() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the current post.
|
||||
global $post;
|
||||
|
||||
// Grab our values.
|
||||
if ( isset( $post ) ) {
|
||||
$disable_top_bar = get_post_meta( $post->ID, '_generate-disable-top-bar', true );
|
||||
$disable_header = get_post_meta( $post->ID, '_generate-disable-header', true );
|
||||
$disable_mobile_header = get_post_meta( $post->ID, '_generate-disable-mobile-header', true );
|
||||
$disable_nav = get_post_meta( $post->ID, '_generate-disable-nav', true );
|
||||
$disable_headline = get_post_meta( $post->ID, '_generate-disable-headline', true );
|
||||
$disable_footer = get_post_meta( $post->ID, '_generate-disable-footer', true );
|
||||
}
|
||||
|
||||
// Remove the top bar.
|
||||
if ( ! empty( $disable_top_bar ) && false !== $disable_top_bar && function_exists( 'generate_top_bar' ) ) {
|
||||
remove_action( 'generate_before_header', 'generate_top_bar', 5 );
|
||||
remove_action( 'generate_inside_secondary_navigation', 'generate_secondary_nav_top_bar_widget', 5 );
|
||||
}
|
||||
|
||||
// Remove the header.
|
||||
if ( ! empty( $disable_header ) && false !== $disable_header && function_exists( 'generate_construct_header' ) ) {
|
||||
remove_action( 'generate_header', 'generate_construct_header' );
|
||||
}
|
||||
|
||||
// Remove the mobile header.
|
||||
if ( ! empty( $disable_mobile_header ) && false !== $disable_mobile_header && function_exists( 'generate_menu_plus_mobile_header' ) ) {
|
||||
remove_action( 'generate_after_header', 'generate_menu_plus_mobile_header', 5 );
|
||||
}
|
||||
|
||||
// Remove the navigation.
|
||||
if ( ! empty( $disable_nav ) && false !== $disable_nav && function_exists( 'generate_get_navigation_location' ) ) {
|
||||
add_filter( 'generate_navigation_location', '__return_false', 20 );
|
||||
add_filter( 'generate_disable_mobile_header_menu', '__return_true' );
|
||||
}
|
||||
|
||||
// Remove the title.
|
||||
if ( ! empty( $disable_headline ) && false !== $disable_headline && function_exists( 'generate_show_title' ) ) {
|
||||
add_filter( 'generate_show_title', '__return_false' );
|
||||
}
|
||||
|
||||
// Remove the footer.
|
||||
if ( ! empty( $disable_footer ) && false !== $disable_footer ) {
|
||||
if ( function_exists( 'generate_construct_footer_widgets' ) ) {
|
||||
remove_action( 'generate_footer', 'generate_construct_footer_widgets', 5 );
|
||||
}
|
||||
|
||||
if ( function_exists( 'generate_construct_footer' ) ) {
|
||||
remove_action( 'generate_footer', 'generate_construct_footer' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'generate_layout_disable_elements_section', 'generate_premium_disable_elements_options' );
|
||||
/**
|
||||
* Add the meta box options to the Layout meta box in the new GP
|
||||
*
|
||||
* @since 1.4
|
||||
* @param array $stored_meta Existing meta data.
|
||||
*/
|
||||
function generate_premium_disable_elements_options( $stored_meta ) {
|
||||
$stored_meta['_generate-disable-header'][0] = ( isset( $stored_meta['_generate-disable-header'][0] ) ) ? $stored_meta['_generate-disable-header'][0] : '';
|
||||
$stored_meta['_generate-disable-mobile-header'][0] = ( isset( $stored_meta['_generate-disable-mobile-header'][0] ) ) ? $stored_meta['_generate-disable-mobile-header'][0] : '';
|
||||
$stored_meta['_generate-disable-nav'][0] = ( isset( $stored_meta['_generate-disable-nav'][0] ) ) ? $stored_meta['_generate-disable-nav'][0] : '';
|
||||
$stored_meta['_generate-disable-secondary-nav'][0] = ( isset( $stored_meta['_generate-disable-secondary-nav'][0] ) ) ? $stored_meta['_generate-disable-secondary-nav'][0] : '';
|
||||
$stored_meta['_generate-disable-post-image'][0] = ( isset( $stored_meta['_generate-disable-post-image'][0] ) ) ? $stored_meta['_generate-disable-post-image'][0] : '';
|
||||
$stored_meta['_generate-disable-headline'][0] = ( isset( $stored_meta['_generate-disable-headline'][0] ) ) ? $stored_meta['_generate-disable-headline'][0] : '';
|
||||
$stored_meta['_generate-disable-footer'][0] = ( isset( $stored_meta['_generate-disable-footer'][0] ) ) ? $stored_meta['_generate-disable-footer'][0] : '';
|
||||
$stored_meta['_generate-disable-top-bar'][0] = ( isset( $stored_meta['_generate-disable-top-bar'][0] ) ) ? $stored_meta['_generate-disable-top-bar'][0] : '';
|
||||
?>
|
||||
<div class="generate_disable_elements">
|
||||
<?php if ( function_exists( 'generate_top_bar' ) ) : ?>
|
||||
<label for="meta-generate-disable-top-bar" style="display:block;margin-bottom:3px;" title="<?php _e( 'Top Bar', 'gp-premium' ); ?>">
|
||||
<input type="checkbox" name="_generate-disable-top-bar" id="meta-generate-disable-top-bar" value="true" <?php checked( $stored_meta['_generate-disable-top-bar'][0], 'true' ); ?>>
|
||||
<?php _e( 'Top Bar', 'gp-premium' ); ?>
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
|
||||
<label for="meta-generate-disable-header" style="display:block;margin-bottom:3px;" title="<?php _e( 'Header', 'gp-premium' ); ?>">
|
||||
<input type="checkbox" name="_generate-disable-header" id="meta-generate-disable-header" value="true" <?php checked( $stored_meta['_generate-disable-header'][0], 'true' ); ?>>
|
||||
<?php _e( 'Header', 'gp-premium' ); ?>
|
||||
</label>
|
||||
|
||||
<?php
|
||||
if ( function_exists( 'generate_menu_plus_get_defaults' ) ) :
|
||||
$menu_plus_settings = wp_parse_args(
|
||||
get_option( 'generate_menu_plus_settings', array() ),
|
||||
generate_menu_plus_get_defaults()
|
||||
);
|
||||
|
||||
if ( 'enable' === $menu_plus_settings['mobile_header'] ) :
|
||||
?>
|
||||
<label for="meta-generate-disable-mobile-header" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( 'Mobile Header', 'gp-premium' ); ?>">
|
||||
<input type="checkbox" name="_generate-disable-mobile-header" id="meta-generate-disable-mobile-header" value="true" <?php checked( $stored_meta['_generate-disable-mobile-header'][0], 'true' ); ?>>
|
||||
<?php esc_html_e( 'Mobile Header', 'gp-premium' ); ?>
|
||||
</label>
|
||||
<?php
|
||||
endif;
|
||||
endif;
|
||||
?>
|
||||
|
||||
<label for="meta-generate-disable-nav" style="display:block;margin-bottom:3px;" title="<?php _e( 'Primary Navigation', 'gp-premium' ); ?>">
|
||||
<input type="checkbox" name="_generate-disable-nav" id="meta-generate-disable-nav" value="true" <?php checked( $stored_meta['_generate-disable-nav'][0], 'true' ); ?>>
|
||||
<?php _e( 'Primary Navigation', 'gp-premium' ); ?>
|
||||
</label>
|
||||
|
||||
<?php if ( function_exists( 'generate_secondary_nav_setup' ) ) : ?>
|
||||
<label for="meta-generate-disable-secondary-nav" style="display:block;margin-bottom:3px;" title="<?php _e( 'Secondary Navigation', 'gp-premium' ); ?>">
|
||||
<input type="checkbox" name="_generate-disable-secondary-nav" id="meta-generate-disable-secondary-nav" value="true" <?php checked( $stored_meta['_generate-disable-secondary-nav'][0], 'true' ); ?>>
|
||||
<?php _e( 'Secondary Navigation', 'gp-premium' ); ?>
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
|
||||
<label for="meta-generate-disable-post-image" style="display:block;margin-bottom:3px;" title="<?php _e( 'Featured Image', 'gp-premium' ); ?>">
|
||||
<input type="checkbox" name="_generate-disable-post-image" id="meta-generate-disable-post-image" value="true" <?php checked( $stored_meta['_generate-disable-post-image'][0], 'true' ); ?>>
|
||||
<?php _e( 'Featured Image', 'gp-premium' ); ?>
|
||||
</label>
|
||||
|
||||
<label for="meta-generate-disable-headline" style="display:block;margin-bottom:3px;" title="<?php _e( 'Content Title', 'gp-premium' ); ?>">
|
||||
<input type="checkbox" name="_generate-disable-headline" id="meta-generate-disable-headline" value="true" <?php checked( $stored_meta['_generate-disable-headline'][0], 'true' ); ?>>
|
||||
<?php _e( 'Content Title', 'gp-premium' ); ?>
|
||||
</label>
|
||||
|
||||
<label for="meta-generate-disable-footer" style="display:block;margin-bottom:3px;" title="<?php _e( 'Footer', 'gp-premium' ); ?>">
|
||||
<input type="checkbox" name="_generate-disable-footer" id="meta-generate-disable-footer" value="true" <?php checked( $stored_meta['_generate-disable-footer'][0], 'true' ); ?>>
|
||||
<?php _e( 'Footer', 'gp-premium' ); ?>
|
||||
</label>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
add_action( 'generate_layout_meta_box_save', 'generate_premium_save_disable_elements_meta' );
|
||||
/**
|
||||
* Save the Disable Elements meta box values
|
||||
*
|
||||
* @since 1.4
|
||||
* @param int $post_id The post ID.
|
||||
*/
|
||||
function generate_premium_save_disable_elements_meta( $post_id ) {
|
||||
$options = array(
|
||||
'_generate-disable-top-bar',
|
||||
'_generate-disable-header',
|
||||
'_generate-disable-mobile-header',
|
||||
'_generate-disable-nav',
|
||||
'_generate-disable-secondary-nav',
|
||||
'_generate-disable-headline',
|
||||
'_generate-disable-footer',
|
||||
'_generate-disable-post-image',
|
||||
);
|
||||
|
||||
foreach ( $options as $key ) {
|
||||
$value = isset( $_POST[ $key ] ) // phpcs:ignore -- Nonce exists within `generate_layout_meta_box_save` hook.
|
||||
? sanitize_text_field( wp_unslash( $_POST[ $key ] ) ) // phpcs:ignore -- Nonce exists within `generate_layout_meta_box_save` hook.
|
||||
: '';
|
||||
|
||||
if ( $value ) {
|
||||
update_post_meta( $post_id, $key, $value );
|
||||
} else {
|
||||
delete_post_meta( $post_id, $key );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'body_class', 'generate_disable_elements_body_classes', 20 );
|
||||
/**
|
||||
* Remove body classes if certain elements are disabled.
|
||||
*
|
||||
* @since 2.1.0
|
||||
* @param array $classes Our body classes.
|
||||
*/
|
||||
function generate_disable_elements_body_classes( $classes ) {
|
||||
if ( is_singular() ) {
|
||||
$disable_featured_image = get_post_meta( get_the_ID(), '_generate-disable-post-image', true );
|
||||
$classes = generate_premium_remove_featured_image_class( $classes, $disable_featured_image );
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* The Disable Elements module.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
// Define the version.
|
||||
if ( ! defined( 'GENERATE_DE_VERSION' ) ) {
|
||||
define( 'GENERATE_DE_VERSION', GP_PREMIUM_VERSION );
|
||||
}
|
||||
|
||||
// Include functions identical between standalone addon and GP Premium.
|
||||
require plugin_dir_path( __FILE__ ) . 'functions/functions.php';
|