first commit

This commit is contained in:
2023-09-01 00:37:57 -07:00
commit 9caab8ce68
602 changed files with 33485 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2019 Peter Putzer.
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
/**
* Template for bbPress allow_anonymous checkbox.
*
* Required template variables:
*
* @var string $nonce The nonce itself.
* @var string $action The nonce action.
* @var string $field_name The name of the checkbox `<input>` element.
* @var string $value The checkbox value.
*/
?>
<div class="avatar-privacy-allow-anonymous">
<?php \wp_nonce_field( $action, $nonce ); ?>
<label>
<input
id="<?php echo \esc_attr( $field_name ); ?>"
name="<?php echo \esc_attr( $field_name ); ?>"
class="checkbox"
type="checkbox"
value="true"
<?php \checked( $value ); ?>
/>
<?php \esc_html_e( 'Allow logged-out comments with my profile picture.', 'avatar-privacy' ); ?>
</label>
<span class="description indicator-hint" style="width:100%;margin-left:0;">
<?php \esc_html_e( 'Check this box if you want to be able to use your profile picture while logged-out.', 'avatar-privacy' ); ?>
</span>
</div>
<?php

View File

@@ -0,0 +1,59 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2018-2020 Peter Putzer.
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
use Avatar_Privacy\Components\User_Profile;
use Avatar_Privacy\Tools\Template as T;
/**
* Template for bbPress use_gravatar checkbox.
*
* Required template variables:
*
* @var T $template The templating helper.
* @var string $nonce The nonce itself.
* @var string $action The nonce action.
* @var string $field_name The name of the checkbox `<input>` element.
* @var string $value The checkbox value.
*/
?>
<div class="avatar-privacy-use-gravatar">
<?php \wp_nonce_field( $action, $nonce ); ?>
<label>
<input
id="<?php echo \esc_attr( $field_name ); ?>"
name="<?php echo \esc_attr( $field_name ); ?>"
class="checkbox"
type="checkbox"
value="true"
<?php \checked( $value ); ?>
/>
<?php echo \wp_kses( $template->get_use_gravatar_label( 'user' ), T::ALLOWED_HTML_LABEL ); ?>
</label>
<span class="description indicator-hint" style="width:100%;margin-left:0;">
<?php \esc_html_e( 'An uploaded profile picture takes precedence over your gravatar.', 'avatar-privacy' ); ?>
</span>
</div>
<?php

View File

@@ -0,0 +1,65 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2018-2021 Peter Putzer.
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
use Avatar_Privacy\Tools\Template as T;
/**
* Required template variables:
*
* @var int $user_id The ID of the edited user.
* @var T $template The templating helper.
* @var string $nonce The nonce itself.
* @var string $action The nonce action.
* @var string $upload_field The name of the uploader `<input>` element.
* @var string $erase_field The name of the erase checkbox `<input>` element.
* @var bool $uploads_disabled Whether the uploads system has been disabled completely..
* @var bool $can_upload Whether the currently active user can upload files.
* @var bool $has_local_avatar Whether a local avatar has been uploaded.
* @var int $size The width/height of the avatar preview image (in pixels).
* @var bool $show_description Whether the field description should be shown.
*/
?>
<div class="avatar-pricacy-profile-picture-upload">
<?php echo \get_avatar( $user_id ); ?>
<?php if ( $can_upload ) : ?>
<?php \wp_nonce_field( $action, $nonce ); ?>
<input type="file" id="<?php echo \esc_attr( $upload_field ); ?>" name="<?php echo \esc_attr( $upload_field ); ?>" accept="image/*" />
<?php if ( $has_local_avatar ) : ?>
<label>
<input type="checkbox" class="checkbox" id="<?php echo \esc_attr( $erase_field ); ?>" name="<?php echo \esc_attr( $erase_field ); ?>" value="true" />
<?php \esc_html_e( 'Delete local avatar picture.', 'avatar-privacy' ); ?>
</label>
<?php endif; ?>
<?php endif; ?>
<?php if ( ! $uploads_disabled && $show_description ) : ?>
<span class="description indicator-hint" style="width:100%;margin-left:0;">
<?php echo \wp_kses( $template->get_uploader_description( $can_upload, $has_local_avatar ), T::ALLOWED_HTML_LABEL ); ?>
</span>
<?php endif; ?>
</div>
<?php

View File

@@ -0,0 +1,43 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2018-2019 Peter Putzer.
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
use Avatar_Privacy\Tools\HTML\User_Form;
/**
* Required template variables:
*
* @var User_Form $form The form helper.
* @var int $user_id The ID of the user whose profile we are editing.
*/
?>
<h2 class="entry-title"><?php \esc_html_e( 'Profile Picture', 'avatar-privacy' ); ?></h2>
<fieldset class="bbp-form">
<legend><?php \esc_html_e( 'Profile Picture', 'avatar-privacy' ); ?></legend>
<?php $form->avatar_uploader( $user_id ); ?>
<?php $form->use_gravatar_checkbox( $user_id ); ?>
<?php $form->allow_anonymous_checkbox( $user_id ); ?>
</fieldset>
<?php

View File

@@ -0,0 +1,51 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2019-2021 Peter Putzer.
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
use Avatar_Privacy\Tools\HTML\User_Form;
/**
* Required template variables:
*
* @var \WP_User $user The user object whose avatar should be displayed.
* @var int $size The width/height of the avatar preview image (in pixels).
* @var string $class_name The additional classname defined in the Block Editor.
* @var string $align An additional alignment class.
*/
// Combine classes.
$classes = \trim( "{$class_name} {$align}" );
// Provide a proper alt text, as this is a content image.
$alt = \sprintf(
/* translators: The display name of the user */
\__( 'Avatar of %s', 'avatar-privacy' ),
$user->display_name
);
?>
<figure class="<?php echo \esc_attr( $classes ); ?>">
<?php echo \get_avatar( $user, $size, '', $alt ); ?>
</figure>
<?php

View File

@@ -0,0 +1,59 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2019-2023 Peter Putzer.
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
use Avatar_Privacy\Tools\HTML\User_Form;
/**
* Required template variables:
*
* @var User_Form $form The form helper.
* @var int $user_id The ID of the user whose profile we are editing.
* @var array $attributes {
* The block attributes.
*
* @type string $className The CSS class for the block.
* @type int $avatar_size The width/height of the avatar preview image (in pixels).
* @type bool $show_descriptions True if the long description should be displayed.
* @type bool $preview True if this is only a preview for the block editor.
* }
*
* @phpstan-var array{ className: string, avatar_size: int, show_descriptions: bool, preview: bool } $attributes
*/
?>
<form class="<?php echo \esc_attr( \trim( "avatar-privacy-frontend avatar-privacy-block {$attributes['className']}" ) ); ?>" method="post" enctype="multipart/form-data">
<?php if ( ! empty( $attributes['preview'] ) ) : ?>
<fieldset disabled="disabled">
<legend class="screen-reader-text"><?php \esc_html_e( 'Avatar Privacy Form Preview', 'avatar-privacy' ); ?></legend>
<?php endif; ?>
<?php $form->avatar_uploader( $user_id, $attributes ); ?>
<?php $form->use_gravatar_checkbox( $user_id, $attributes ); ?>
<?php $form->allow_anonymous_checkbox( $user_id, $attributes ); ?>
<input type="submit" value="<?php \esc_attr_e( 'Save', 'avatar-privacy' ); ?>" />
<?php if ( ! empty( $attributes['preview'] ) ) : ?>
</fieldset>
<?php endif; ?>
</form>
<?php

View File

@@ -0,0 +1,29 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2018-2021 Peter Putzer.
* Copyright 2012-2013 Johannes Freudendahl.
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
use Avatar_Privacy\Components\Comments;
use Avatar_Privacy\Tools\Template as T;

View File

@@ -0,0 +1,55 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2019 Peter Putzer.
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
/**
* Frontend profile form `allow_anonymous` checkbox.
*
* Required template variables:
*
* @var string $nonce The nonce itself.
* @var string $action The nonce action.
* @var string $field_name The name of the checkbox `<input>` element.
* @var string $value The checkbox value.
* @var string $show_description True if the long description should be displayed.
*/
?>
<div class="avatar-privacy-allow-anonymous">
<?php \wp_nonce_field( $action, $nonce ); ?>
<input
id="<?php echo \esc_attr( $field_name ); ?>"
name="<?php echo \esc_attr( $field_name ); ?>"
type="checkbox"
value="true"
<?php \checked( $value ); ?>
/>
<label for="<?php echo \esc_attr( $field_name ); ?>"><?php \esc_html_e( 'Allow logged-out comments with my profile picture.', 'avatar-privacy' ); ?></label><br />
<?php if ( ! empty( $show_description ) ) : ?>
<p class="description">
<?php \esc_html_e( 'Check this box if you want to be able to use your profile picture while logged-out.', 'avatar-privacy' ); ?>
</p>
<?php endif; ?>
</div>
<?php

View File

@@ -0,0 +1,59 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2019-2021 Peter Putzer.
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
use Avatar_Privacy\Tools\Template as T;
/**
* Frontend profile form `use_gravatar` checkbox.
*
* Required template variables:
*
* @var T $template The templating helper.
* @var string $nonce The nonce itself.
* @var string $action The nonce action.
* @var string $field_name The name of the checkbox `<input>` element.
* @var string $value The checkbox value.
* @var string $show_description True if the long description should be displayed.
*/
?>
<div class="avatar-privacy-use-gravatar">
<?php \wp_nonce_field( $action, $nonce ); ?>
<input
id="<?php echo \esc_attr( $field_name ); ?>"
name="<?php echo \esc_attr( $field_name ); ?>"
type="checkbox"
value="true"
<?php \checked( $value ); ?>
/>
<label for="<?php echo \esc_attr( $field_name ); ?>"><?php echo \wp_kses( $template->get_use_gravatar_label( 'user' ), T::ALLOWED_HTML_LABEL ); ?></label><br />
<?php if ( ! empty( $show_description ) ) : ?>
<p class="description">
<?php \esc_html_e( "Uncheck this box if you don't want to display the gravatar for your e-mail address (or don't have an account on Gravatar.com).", 'avatar-privacy' ); ?>
<?php \esc_html_e( 'This setting will only take effect if you have not uploaded a local profile picture.', 'avatar-privacy' ); ?>
</p>
<?php endif; ?>
</div>
<?php

View File

@@ -0,0 +1,65 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2019-2021 Peter Putzer.
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
use Avatar_Privacy\Tools\Template as T;
/**
* Required template variables:
*
* @var int $user_id The ID of the edited user.
* @var T $template The templating helper.
* @var string $nonce The nonce itself.
* @var string $action The nonce action.
* @var string $upload_field The name of the uploader `<input>` element.
* @var string $erase_field The name of the erase checkbox `<input>` element.
* @var bool $uploads_disabled Whether the uploads system has been disabled completely..
* @var bool $can_upload Whether the currently active user can upload files.
* @var bool $has_local_avatar Whether a local avatar has been uploaded.
* @var int $size The width/height of the avatar preview image (in pixels).
* @var bool $show_description Whether the field description should be shown.
*/
?>
<div class="avatar-privacy-user-avatar-upload">
<?php echo \get_avatar( $user_id, $size ); ?>
<?php if ( $can_upload ) : ?>
<p class="avatar-privacy-upload-fields">
<?php \wp_nonce_field( $action, $nonce ); ?>
<input type="file" id="<?php echo \esc_attr( $upload_field ); ?>" name="<?php echo \esc_attr( $upload_field ); ?>" accept="image/*" />
<?php if ( $has_local_avatar ) : ?>
<input type="checkbox" id="<?php echo \esc_attr( $erase_field ); ?>" name="<?php echo \esc_attr( $erase_field ); ?>" value="true" />
<label for="<?php echo \esc_attr( $erase_field ); ?>"><?php \esc_html_e( 'Delete local avatar picture.', 'avatar-privacy' ); ?></label><br />
<?php endif; ?>
</p>
<?php endif; ?>
<?php if ( ! $uploads_disabled && $show_description ) : ?>
<p class="description">
<?php echo \wp_kses( $template->get_uploader_description( $can_upload, $has_local_avatar ), T::ALLOWED_HTML_LABEL ); ?>
</p>
<?php endif; ?>
</div>
<?php

View File

@@ -0,0 +1,69 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2023 Peter Putzer.
*
* 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 incorporates work covered by the following copyright and
* permission notice:
*
* Copyright (c) 2013, 2014, 2016 Benjamin Laugueux <benjamin@yzalis.com>
* Copyright (c) 2015 Grummfy <grummfy@gmail.com>
* Copyright (c) 2016, 2017 Lucas Michot
* Copyright (c) 2019 Arjen van der Meijden
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
/**
* Retro SVG image.
*
* Required template variables:
*
* @var int $rows The number of rows.
* @var int $columns The number of columns.
* @var string $path The path to draw.
* @var string $color The robot body color as CSS color string (e.g. `#ff9800`).
* @var string $bg_color The background color as a CSS color string (e.g. `#80d8ff`).
*/
?>
<svg viewBox="0 0 <?php echo \esc_attr( "{$columns} {$rows}" ); ?>" width="320" height="320" xmlns="http://www.w3.org/2000/svg">
<rect width="<?php echo \esc_attr( "$columns" ); ?>" height="<?php echo \esc_attr( "$rows" ); ?>" fill="<?php echo \esc_attr( $bg_color ); ?>" stroke-width="0"/>
<path fill="<?php echo \esc_attr( $color ); ?>" stroke-width="0" d="<?php echo \esc_attr( $path ); ?>"/>
</svg>
<?php

View File

@@ -0,0 +1,50 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2019 Peter Putzer.
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
use Avatar_Privacy\Tools\Images\SVG;
/**
* RoboHash SVG image.
*
* Required template variables:
*
* @var string $color The robot body color as CSS color string (e.g. `#ff9800`).
* @var string $bg_color The background color as a CSS color string (e.g. `#80d8ff`).
* @var string $body The SVG elements making up the robot's body.
* @var string $face The SVG elements making up the robot's face.
* @var string $eyes The SVG elemenets making up the robot's eyes.
* @var string $mouth The SVG elemenets making up the robot's mouth.
* @var string $accessory The SVG elemenets making up the robot's accessory.
*/
?>
<svg viewBox="0 0 320 320" width="320" height="320" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/2000/xlink">
<g style="color:<?php echo \esc_attr( $color ); ?>">
<rect fill="<?php echo \esc_attr( $bg_color ); ?>" x="0" y="0" width="320" height="320"></rect>
<?php echo \wp_kses( $body . $face . $eyes . $mouth . $accessory, SVG::ALLOWED_ELEMENTS ); ?>
</g>
</svg>
<?php

View File

@@ -0,0 +1,49 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2019-2023 Peter Putzer.
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
use Avatar_Privacy\Tools\HTML\User_Form;
/**
* Required template variables:
*
* @var User_Form $form The form helper.
* @var int $user_id The ID of the user whose profile we are editing.
* @var array $atts {
* The shortcode attributes.
*
* @type int $avatar_size The width/height of the avatar preview image (in pixels).
* }
*
* @phpstan-var array{ avatar_size: int } $atts
*/
?>
<form class="avatar-privacy-frontend avatar-privacy-shortcode" method="post" enctype="multipart/form-data">
<?php $form->avatar_uploader( $user_id, $atts ); ?>
<?php $form->use_gravatar_checkbox( $user_id, $atts ); ?>
<?php $form->allow_anonymous_checkbox( $user_id, $atts ); ?>
<input type="submit" value="<?php \esc_attr_e( 'Save', 'avatar-privacy' ); ?>" />
</form>
<?php

View File

@@ -0,0 +1,54 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2019 Peter Putzer.
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
/**
* Frontend profile form `allow_anonymous` checkbox.
*
* Required template variables:
*
* @var string $nonce The nonce itself.
* @var string $action The nonce action.
* @var string $field_name The name of the checkbox `<input>` element.
* @var string $value The checkbox value.
* @var string $show_description True if the long description should be displayed.
*/
?>
<?php \wp_nonce_field( $action, $nonce ); ?>
<input
id="<?php echo \esc_attr( $field_name ); ?>"
name="<?php echo \esc_attr( $field_name ); ?>"
class="tml-checkbox"
type="checkbox"
value="true"
<?php \checked( $value ); ?>
/>
<label class="tml-label" for="<?php echo \esc_attr( $field_name ); ?>"><?php \esc_html_e( 'Allow logged-out comments with my profile picture.', 'avatar-privacy' ); ?></label><br />
<?php if ( ! empty( $show_description ) ) : ?>
<p class="tml-description">
<?php \esc_html_e( 'Check this box if you want to be able to use your profile picture while logged-out.', 'avatar-privacy' ); ?>
</p>
<?php endif; ?>
<?php

View File

@@ -0,0 +1,58 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2019-2021 Peter Putzer.
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
use Avatar_Privacy\Tools\Template as T;
/**
* Frontend profile form `use_gravatar` checkbox.
*
* Required template variables:
*
* @var T $template The templating helper.
* @var string $nonce The nonce itself.
* @var string $action The nonce action.
* @var string $field_name The name of the checkbox `<input>` element.
* @var string $value The checkbox value.
* @var string $show_description True if the long description should be displayed.
*/
?>
<?php \wp_nonce_field( $action, $nonce ); ?>
<input
id="<?php echo \esc_attr( $field_name ); ?>"
name="<?php echo \esc_attr( $field_name ); ?>"
class="tml-checkbox"
type="checkbox"
value="true"
<?php \checked( $value ); ?>
/>
<label class="tml-label" for="<?php echo \esc_attr( $field_name ); ?>"><?php echo \wp_kses( $template->get_use_gravatar_label( 'user' ), T::ALLOWED_HTML_LABEL ); ?></label><br />
<?php if ( ! empty( $show_description ) ) : ?>
<p class="tml-description">
<?php \esc_html_e( "Uncheck this box if you don't want to display the gravatar for your e-mail address (or don't have an account on Gravatar.com).", 'avatar-privacy' ); ?>
<?php \esc_html_e( 'This setting will only take effect if you have not uploaded a local profile picture.', 'avatar-privacy' ); ?>
</p>
<?php endif; ?>
<?php

View File

@@ -0,0 +1,63 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2019-2021 Peter Putzer.
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
use Avatar_Privacy\Tools\Template as T;
/**
* Required template variables:
*
* @var int $user_id The ID of the edited user.
* @var T $template The templating helper.
* @var string $nonce The nonce itself.
* @var string $action The nonce action.
* @var string $upload_field The name of the uploader `<input>` element.
* @var string $erase_field The name of the erase checkbox `<input>` element.
* @var bool $uploads_disabled Whether the uploads system has been disabled completely..
* @var bool $can_upload Whether the currently active user can upload files.
* @var bool $has_local_avatar Whether a local avatar has been uploaded.
* @var int $size The width/height of the avatar preview image (in pixels).
* @var bool $show_description Whether the field description should be shown.
*/
?>
<?php echo \get_avatar( $user_id, $size ); ?>
<?php if ( $can_upload ) : ?>
<p class="avatar-privacy-upload-fields">
<?php \wp_nonce_field( $action, $nonce ); ?>
<input type="file" id="<?php echo \esc_attr( $upload_field ); ?>" name="<?php echo \esc_attr( $upload_field ); ?>" accept="image/*" class="tml-field" />
<?php if ( $has_local_avatar ) : ?>
<input type="checkbox" id="<?php echo \esc_attr( $erase_field ); ?>" name="<?php echo \esc_attr( $erase_field ); ?>" class="tml-checkbox" value="true" />
<label class="tml-label" for="<?php echo \esc_attr( $erase_field ); ?>"><?php \esc_html_e( 'Delete local avatar picture.', 'avatar-privacy' ); ?></label><br />
<?php endif; ?>
</p>
<?php endif; ?>
<?php if ( ! $uploads_disabled && $show_description ) : ?>
<p class="tml-description">
<?php echo \wp_kses( $template->get_uploader_description( $can_upload, $has_local_avatar ), T::ALLOWED_HTML_LABEL ); ?>
</p>
<?php endif; ?>
<?php

View File

@@ -0,0 +1,53 @@
<?php
/**
* This file is part of Avatar Privacy.
*
* Copyright 2018-2021 Peter Putzer.
* Copyright 2012-2013 Johannes Freudendahl.
*
* 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.
*
* ***
*
* @package mundschenk-at/avatar-privacy
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
use Avatar_Privacy\Components\Comments;
use Avatar_Privacy\Tools\Template as T;
/**
* Required template variables:
*
* @var T $template The templating helper.
* @var bool $is_checked Whether the checkbox should be pre-checked.
*/
?>
<div class="comment-form-use-gravatar wpdiscuz-item wpd-field-group wpd-field-checkbox wpd-field-single wpd-has-desc">
<div class="wpd-field-group-title">
<div class="wpd-item">
<input id="<?php echo \esc_attr( Comments::CHECKBOX_FIELD_NAME ); ?>" name="<?php echo \esc_attr( Comments::CHECKBOX_FIELD_NAME ); ?>" class="wpd-field" type="checkbox" value="true" <?php \checked( $is_checked, true ); ?> />
<label
class="wpd-field-label wpd-cursor-pointer"
for="<?php echo \esc_attr( Comments::CHECKBOX_FIELD_NAME ); ?>"
><?php echo \wp_kses( $template->get_use_gravatar_label( 'comment' ), T::ALLOWED_HTML_LABEL ); ?></label>
</div>
</div>
<div class="wpd-field-desc">
<i class="far fa-question-circle" aria-hidden="true"></i><span><?php \esc_attr_e( 'If checked, an MD5 hash of your email address will be shared with Gravatar.com. However, that hash will not be made public.', 'avatar-privacy' ); ?></span>
</div>
</div>
<?php