Plugin Directory

Changeset 2653204


Ignore:
Timestamp:
01/05/2022 04:12:35 PM (4 years ago)
Author:
nocksoft
Message:

Tagging version 1.0.5

Location:
author-box-by-nocksoft
Files:
12 added
2 deleted
20 edited
1 copied

Legend:

Unmodified
Added
Removed
  • author-box-by-nocksoft/tags/1.0.5/author-box-by-nocksoft.php

    r2464444 r2653204  
    33/*
    44    Plugin Name: Author Box by Nocksoft
    5     Version: 1.0.4
     5    Version: 1.0.5
    66    Author: Rafael Nockmann @ Nocksoft
    77    Author URI: https://nocksoft.de
     
    1515
    1616
    17 /* --- Settings link in plugin overview --- */
    18 add_filter("plugin_action_links_" . plugin_basename(__FILE__), "nstab_pluginsettingslink");
    19 function nstab_pluginsettingslink($links) {
    20     $settingslink = "<a href='options-general.php?page=nstab'>" . __("Settings", "author-box-by-nocksoft") . "</a>";
    21     array_unshift($links, $settingslink);
    22     return $links;
     17if (is_admin()) {
     18
     19    /* --- Settings link in plugin overview --- */
     20    add_filter("plugin_action_links_" . plugin_basename(__FILE__), "nstab_pluginsettingslink");
     21    function nstab_pluginsettingslink($links) {
     22        $settingslink = "<a href='options-general.php?page=nstab'>" . __("Settings", "author-box-by-nocksoft") . "</a>";
     23        array_push($links, $settingslink);
     24        return $links;
     25    }
     26   
     27   
     28    /* --- Load scripts --- */
     29    require_once plugin_dir_path(__FILE__) . "/php/setup.php";
     30    require_once plugin_dir_path(__FILE__) . "/php/settings-global.php";
     31    require_once plugin_dir_path(__FILE__) . "/php/settings-user.php";
     32   
     33    add_action("admin_enqueue_scripts", "nstab_loadcolorpicker");
     34    function nstab_loadcolorpicker() {
     35        wp_enqueue_style("wp-color-picker");
     36        wp_enqueue_script("custom-script-handle", plugin_dir_url(__FILE__) . "js/colorpicker.js", array("wp-color-picker"), false, true);
     37    }
     38   
     39   
     40    /* --- Plugin setup --- */
     41    register_activation_hook(__FILE__, "nstab_activate_plugin");
     42    register_uninstall_hook(__FILE__, "nstab_uninstall_plugin");
     43   
    2344}
    2445
    2546
    2647/* --- Load scripts --- */
    27 require_once plugin_dir_path(__FILE__) . "/php/setup.php";
    2848require_once plugin_dir_path(__FILE__) . "/php/avatars.php";
    2949require_once plugin_dir_path(__FILE__) . "/php/authorbox.php";
    30 require_once plugin_dir_path(__FILE__) . "/php/settings-global.php";
    31 require_once plugin_dir_path(__FILE__) . "/php/settings-user.php";
    32 
    33 
    34 /* --- Plugin setup --- */
    35 register_activation_hook(__FILE__, "nstab_activate_plugin");
    36 register_uninstall_hook(__FILE__, "nstab_uninstall_plugin");
     50require_once plugin_dir_path(__FILE__) . "/php/settings.php";
    3751
    3852
    3953/* --- Load styles --- */
    40 wp_register_style("author-box-by-nocksoft-style", plugin_dir_url(__FILE__) . "assets/style.css");
     54wp_register_style("author-box-by-nocksoft-style", plugin_dir_url(__FILE__) . "css/style.css");
    4155wp_enqueue_style("author-box-by-nocksoft-style");
    4256
    43 if (get_option("nstab_setting_hidewordpressauthorbox") == true) {
    44     wp_register_style("author-box-by-nocksoft-hidewordpressauthorbox", plugin_dir_url(__FILE__) . "assets/hidewordpressauthorbox.css");
     57if ($nstab_setting_hidewordpressauthorbox == true) {
     58    wp_register_style("author-box-by-nocksoft-hidewordpressauthorbox", plugin_dir_url(__FILE__) . "css/hidewordpressauthorbox.css");
    4559    wp_enqueue_style("author-box-by-nocksoft-hidewordpressauthorbox");
    4660}
     
    4862
    4963/* --- Languages --- */
     64add_action("plugins_loaded", "nstab_load_plugin_textdomain");
    5065function nstab_load_plugin_textdomain() {
    5166    load_plugin_textdomain("author-box-by-nocksoft", FALSE, basename(dirname(__FILE__)) . "/languages/");
    5267}
    53 add_action("plugins_loaded", "nstab_load_plugin_textdomain");
    54 
    5568
    5669?>
  • author-box-by-nocksoft/tags/1.0.5/languages/author-box-by-nocksoft-de_DE.po

    r2464444 r2653204  
    33msgstr "F&uuml;gt eine moderne anpassbare Autoren Info Box am Ende deines Beitrages ein und bringt Support f&uuml;r lokale Avatare."
    44
    5 #: author-box-by-nocksoft.php:19
     5#: author-box-by-nocksoft.php:22
    66msgid "Settings"
    77msgstr "Einstellungen"
    88
    9 #: setup.php:8
     9#: authorbox.php:55
     10msgid "View Archive"
     11msgstr "Archiv anzeigen"
     12
     13#: authorbox.php:62
     14msgid "View Archive"
     15msgstr "Archiv anzeigen"
     16
     17#: settings-defaults.php:16
    1018msgid "A Post by"
    1119msgstr "Ein Beitrag von"
    1220
    13 #: settings-global.php:45
    14 msgid "User-specific settings are made in your author profile in WordPress (Users -> Your Profile). General settings can be made here."
    15 msgstr "Benutzerspezifische Einstellungen werden in deinem Benutzerprofil get&auml;tigt (Benutzer -> Dein Profil). Allgemeine Einstellungen k&ouml;nnen hier vorgenommen werden."
    16 
    17 #: settings-global.php:49
     21#: settings-global.php:65
     22msgid "User-specific settings are made in your user profile in WordPress (Users -> Your Profile -> Edit). General settings can be made here."
     23msgstr "Benutzerspezifische Einstellungen werden in deinem Benutzerprofil get&auml;tigt (Benutzer -> Dein Profil -> Bearbeiten). Allgemeine Einstellungen k&ouml;nnen hier vorgenommen werden."
     24
     25#: settings-global.php:68
     26msgid "General"
     27msgstr "Allgemein"
     28
     29#: settings-global.php:69
     30msgid "Layout"
     31msgstr "Aussehen"
     32
     33#: settings-global.php:88
     34msgid "Author Box display options"
     35msgstr "Author Box Anzeigeeinstellungen"
     36
     37#: settings-global.php:91
     38msgid "Display Author Box at the end of each post automatically"
     39msgstr "F&uuml;ge die Author Box am Ende von Beitr&auml;gen automatisch hinzu"
     40
     41#: settings-global.php:94
     42msgid "Display Author Box at the end of each page automatically (not on front page, blog homepage and privacy policy)"
     43msgstr "F&uuml;ge die Author Box am Ende von Seiten automatisch hinzu (nicht auf Startseite, Beitragsseite und Datenschutzerkl&auml;rung)"
     44
     45#: settings-global.php:99
     46msgid "Other options"
     47msgstr "Weitere Einstellungen"
     48
     49#: settings-global.php:102
     50msgid "Hide the author box of default WordPress theme (tested from Twenty Nineteen up to Twenty Twenty-One)"
     51msgstr "Verstecke die Autor-Biografie (Author Box) vom WordPress Standard-Theme (Getestet von Twenty Nineteen bis Twenty Twenty-One)"
     52
     53#: settings-global.php:103
     54msgid "If your theme offers you an option to hide the author box of your theme, you should use your theme's setting for this."
     55msgstr "Wenn dein Theme dir eine Option anbietet, die Autor-Biografie (Author Box) deines Themes auszublenden, solltest du die Einstellung deines Themes dafür verwenden."
     56
     57#: settings-global.php:113
     58msgid "Basic"
     59msgstr "Grundlegend"
     60
     61#: settings-global.php:116
     62msgid "Arial"
     63msgstr "Arial"
     64
     65#: settings-global.php:117
     66msgid "Inherit from website"
     67msgstr "Von Webseite erben"
     68
     69#: settings-global.php:119
     70msgid "Font of Author Box"
     71msgstr "Schriftart der Author Box"
     72
     73#: settings-global.php:120
     74msgid "Inherit from website means that the fonts of the WordPress theme are used."
     75msgstr "Von Webseite erben bedeutet, dass die Schriftart des WordPress Themes verwendet wird."
     76
     77#: settings-global.php:123
     78msgid "Show Shadow of Author Box"
     79msgstr "Stelle einen Schatten um die Author Box dar"
     80
     81#: settings-global.php:129
     82msgid "Border"
     83msgstr "Rahmen"
     84
     85#: settings-global.php:132
    1886msgid "Show Border of Author Box"
    19 msgstr "Stelle den Rand der Author Box dar"
    20 
    21 #: settings-global.php:54
     87msgstr "Stelle den Rahmen der Author Box dar"
     88
     89#: settings-global.php:135
     90msgid "Color of border"
     91msgstr "Farbe des Rahmens"
     92
     93#: settings-global.php:138
     94msgid "Size of border"
     95msgstr "Breite des Rahmens"
     96
     97#: settings-global.php:143
     98msgid "Avatar"
     99msgstr "Avatar"
     100
     101#: settings-global.php:146
    22102msgid "Size of Avatar (Pixel)"
    23103msgstr "Gr&ouml;&szlig;e Avatar (Pixel)"
    24104
    25 #: settings-global.php:59
     105#: settings-global.php:149
    26106msgid "Use a circle avatar instead of a square"
    27107msgstr "Verwende ein rundes statt ein eckiges Profilbild"
    28108
    29 #: settings-global.php:64
     109#: settings-global.php:155
     110msgid "Header"
     111msgstr "Header"
     112
     113#: settings-global.php:157
     114msgid "e.g. A Post by"
     115msgstr "z.B. Ein Beitrag von"
     116
     117#: settings-global.php:158
    30118msgid "Headline"
    31119msgstr "Text der &Uuml;berschrift"
    32120
    33 #: settings-global.php:65
    34 msgid "e.g. A Post by"
    35 msgstr "z.B. Ein Beitrag von"
    36 
    37 #: settings-global.php:69
     121#: settings-global.php:161
    38122msgid "Fontsize of Headline (em)"
    39123msgstr "Schriftgr&ouml;&szlig;e der &Uuml;berschrift (em)"
    40124
    41 #: settings-global.php:74
     125#: settings-global.php:165
    42126msgid "Fontsize of author's Position (em)"
    43 msgstr "Schriftgr&ouml;&szlig;e der Position vom Autor (em)"
    44 
    45 #: settings-global.php:79
     127msgstr "Schriftgr&ouml;&szlig;e der Position des Autors (em)"
     128
     129#: settings-global.php:171
     130msgid "Biography"
     131msgstr "Biografie"
     132
     133#: settings-global.php:174
    46134msgid "Fontsize of Biography (em)"
    47135msgstr "Schriftgr&ouml;&szlig;e der Biografie (em)"
    48136
    49 #: settings-global.php:84
     137#: settings-global.php:179
     138msgid "Footer"
     139msgstr "Footer"
     140
     141#: settings-global.php:182
    50142msgid "Fontsize of Links (em)"
    51143msgstr "Schriftgr&ouml;&szlig;e der Links (em)"
    52144
    53 #: settings-global.php:89
     145#: settings-global.php:185
    54146msgid "Display a link to the author's archive"
    55147msgstr "Zeige einen Link zum Archiv des Autors an"
    56148
    57 #: settings-global.php:94
    58 msgid "Display Author Box at the end of each post automatically"
    59 msgstr "F&uuml;ge die Author Box am Ende von Beitr&auml;gen automatisch hinzu"
    60 
    61 #: settings-global.php:100
    62 msgid "Display Author Box at the end of each page automatically (not on front page, blog homepage and privacy policy)"
    63 msgstr "F&uuml;ge die Author Box am Ende von Seiten automatisch hinzu (nicht auf Startseite, Beitragsseite und Datenschutzerkl&auml;rung)"
    64 
    65 #: settings-global.php:105
    66 msgid "Hide the author box of default WordPress theme (tested from Twenty Nineteen up to Twenty Twenty-One)"
    67 msgstr "Verstecke die Autor-Biografie (Author Box) vom WordPress Standard-Theme (Getestet von Twenty Nineteen bis Twenty Twenty-One)"
    68 
    69 #: settings-global.php:105
     149#: settings-global.php:196
    70150msgid "Save Settings"
    71151msgstr "Einstellungen speichern"
    72152
    73 #: settings-user.php:12
     153#: settings-user.php:11
    74154msgid "Here you can make further settings for your avatar or other personal settings. The WordPress administrator can adjust global settings under Settings -> Author Box."
    75 msgstr "Hier kannst du weitere Einstellungen in Bezug auf deinen Avatar oder weiteren pers&ouml;nlichen Einstellungen vornehmen. Globale Einstellungen kann der WordPress-Administrator unter Einstellungen -> Author Box vornehmen."
    76 
    77 #: settings-user.php:16
     155msgstr "Hier kannst du weitere Einstellungen in Bezug auf deinen Avatar oder weitere pers&ouml;nliche Einstellungen vornehmen. Globale Einstellungen kann der WordPress-Administrator unter Einstellungen -> Author Box vornehmen."
     156
     157#: settings-user.php:15
    78158msgid "Local avatars"
    79159msgstr "Lokale Avatare"
    80160
    81 #: settings-user.php:19
     161#: settings-user.php:18
    82162msgid "Use local avatars instead of Gravatar (Enter the URL to your avatar in the input field below)"
    83163msgstr "Verwende lokale Avatare an Stelle von Gravatar (Trage die URL zu deinem Profilbild in das untere Eingabefeld ein)"
    84164
    85 #: settings-user.php:24
     165#: settings-user.php:23
    86166msgid "Avatar (URL)"
    87167msgstr "Avatar (URL)"
    88168
    89 #: settings-user.php:27
     169#: settings-user.php:26
    90170msgid "Avatar URL (e.g. https://yoursite.com/avatar.jpg)"
    91171msgstr "Avatar URL (z.B. https://deineseite.de/avatar.jpg)"
    92172
    93 #: settings-user.php:28
     173#: settings-user.php:27
    94174msgid "Please enter a valid URL to your avatar, so that it can be displayed in the author box. You will get the best results if your avatar has the same width and height dimensions."
    95175msgstr "Gebe bitte eine g&uuml;ltige URL zu deinem Avatar an, damit dieses in der Author Box angezeigt werden kann. Das beste Ergebnis erh&auml;ltst du, wenn dein Profilbild die gleiche H&ouml;he und Breite aufweist."
    96176
    97 #: settings-user.php:33
     177#: settings-user.php:32
    98178msgid "Your Position"
    99179msgstr "Deine Position"
    100180
    101 #: settings-user.php:36
     181#: settings-user.php:35
    102182msgid "Position (e.g. Founder or Author of YourSite)"
    103183msgstr "Position (z.B. Gr&uuml;nder oder Autor von DeineSeite)"
    104184
    105 #: settings-user.php:37
     185#: settings-user.php:36
    106186msgid "Here you can enter your position. The position is shown below your name in the Author Box."
    107187msgstr "Hier kannst du deine Position angeben. Die Position wird unterhalb deines Namens in der Author Box angezeigt."
    108188
    109 #: settings-user.php:42
     189#: settings-user.php:41
    110190msgid "Homepage / About Me Page"
    111191msgstr "Homepage / &Uuml;ber Mich Seite"
    112192
    113 #: settings-user.php:46
     193#: settings-user.php:45
    114194msgid "Link Text (e.g. Homepage or About Me)"
    115195msgstr "Link Text (z.B. Homepage oder &Uuml;ber mich)"
    116196
    117 #: settings-user.php:47
     197#: settings-user.php:46
    118198msgid "Link URL (e.g. https://yoursite.com)"
    119199msgstr "Link URL (z.B. https://deineseite.de)"
    120200
    121 #: settings-user.php:48
     201#: settings-user.php:47
    122202msgid "This URL will be displayed below your biography in the Author Box."
    123203msgstr "Diese URL wird unterhalb deiner Biografie in der Author Box angezeigt."
    124 
    125 #: authorbox.php:41
    126 msgid "View Archive"
    127 msgstr "Archiv anzeigen"
    128 
    129 #: authorbox.php:48
    130 msgid "View Archive"
    131 msgstr "Archiv anzeigen"
  • author-box-by-nocksoft/tags/1.0.5/php/authorbox.php

    r2464444 r2653204  
    22
    33/* Author Box Shortcode. */
     4add_shortcode("authorbox", "nstab_shortcode_authorbox");
    45function nstab_shortcode_authorbox() {
    56    return nstab_get_authorbox();
    67}
    7 add_shortcode("authorbox", "nstab_shortcode_authorbox");
    88
    99
    10 /* Adds Author Box at end of posts */
     10/* Adds Author Box at end of posts and pages automatically. */
    1111add_filter("the_content", "nstab_add_authorbox");
    1212function nstab_add_authorbox($content) {
    13     if (is_single() && get_option("nstab_setting_displayauthorboxonposts", true) == true) {
     13    global $nstab_setting_displayauthorboxonposts;
     14    global $nstab_setting_displayauthorboxonpages;
     15   
     16    if (is_single() && $nstab_setting_displayauthorboxonposts == true) {
    1417        $content .= nstab_get_authorbox();
    1518    }
    16     else if (is_page() && get_option("nstab_setting_displayauthorboxonpages") == true
     19    else if (is_page() && $nstab_setting_displayauthorboxonpages == true
    1720        && !is_front_page() && !is_home() && !is_privacy_policy()) {
    1821        $content .= nstab_get_authorbox();
     
    2225
    2326
    24 /* --- Drawing of the Author Box --- */
    25 
    26 /* Adds Author Box */
     27/* Get Author Box HTML. */
    2728function nstab_get_authorbox() {
    28     $avatarsize = esc_attr(get_option("nstab_setting_avatarsize"));
     29    global $nstab_setting_font;
     30    global $nstab_setting_showshadow;
     31    global $nstab_setting_showborder;
     32    global $nstab_setting_bordercolor;
     33    global $nstab_setting_bordersize;
     34    global $nstab_setting_avatarsize;
     35    global $nstab_setting_circleavatar;
     36    global $nstab_setting_headline;
     37    global $nstab_setting_fontsizeheadline;
     38    global $nstab_setting_fontsizeposition;
     39    global $nstab_setting_fontsizebio;
     40    global $nstab_setting_fontsizelinks;
     41    global $nstab_setting_displayauthorsarchive;
     42   
     43    $author_id = get_the_author_meta("ID");
     44   
    2945    $circleavatar = "";
    30     if (get_option("nstab_setting_circleavatar") == true) {
     46    if ($nstab_setting_circleavatar == true) {
    3147        $circleavatar = "class='nstab_circle'";
    3248    }
    33    
    34     require plugin_dir_path(__FILE__) . "settings-defaults.php";
    3549
    3650    $authorlinktext = get_the_author_meta("nstab_setting_homepage_linktext");
    3751    $authorlinkurl = get_the_author_meta("nstab_setting_homepage_linkurl");
    3852    if ($authorlinktext != null && $authorlinkurl != null) {
    39         $homepagehref = "<p id='nstab_links' style='font-size: " . $fontsizelinks . "em;'><a href='" . $authorlinkurl . "'>" . $authorlinktext . "</a>";
    40         if (get_option("nstab_setting_displayauthorsarchive") == true) {
    41             $homepagehref .= " | <a href='" . get_author_posts_url(get_the_author_meta("ID")) . "'>" . __("View Archive", "author-box-by-nocksoft") . "</a>";
     53        $homepagehref = "<p id='nstab_links' style='font-size: " . $nstab_setting_fontsizelinks . "em;'><a href='" . $authorlinkurl . "'>" . $authorlinktext . "</a>";
     54        if ($nstab_setting_displayauthorsarchive == true) {
     55            $homepagehref .= " | <a href='" . get_author_posts_url($author_id) . "'>" . __("View Archive", "author-box-by-nocksoft") . "</a>";
    4256        }
    4357        $homepagehref .= "</p>";
     
    4559    else {
    4660        $homepagehref = "";
    47         if (get_option("nstab_setting_displayauthorsarchive") == true) {
    48             $homepagehref .= "<p id='nstab_links' style='font-size: " . $fontsizelinks . "em;'><a href='" . get_author_posts_url(get_the_author_meta("ID")) . "'>" . __("View Archive", "author-box-by-nocksoft") . "</a></p>";
     61        if ($nstab_setting_displayauthorsarchive == true) {
     62            $homepagehref .= "<p id='nstab_links' style='font-size: " . $nstab_setting_fontsizelinks . "em;'><a href='" . get_author_posts_url($author_id) . "'>" . __("View Archive", "author-box-by-nocksoft") . "</a></p>";
    4963        }
    5064    }
    5165
    52     $authorboxcontainer = "<div id='author-box-by-nocksoft'>";
    53     if (get_option("nstab_setting_showborder", true) == true) {
    54         $authorboxcontainer = "<div id='author-box-by-nocksoft' style='padding: 0.75em; border: 1px solid #EEEEEE;'>";
    55     }
     66    $font = $nstab_setting_font == "arial" ? "font-family: Arial;" : null;
     67    $shadow = $nstab_setting_showshadow == true ? "padding: 0.75em; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);" : null;
     68    $border = $nstab_setting_showborder == true ? "padding: 0.75em; border: ".$nstab_setting_bordersize."px solid ".$nstab_setting_bordercolor.";" : null;
     69    $authorboxcontainer = "<div id='author-box-by-nocksoft' style='".$font.$shadow.$border."'>";
     70   
     71    $url = nstab_get_local_avatarurl($author_id);
     72    if (empty($url)) $url = get_avatar_url($author_id);
     73   
    5674    $authorbox = $authorboxcontainer .= "
    5775            <div id='nstab_wrapper'>
    58                 <div id='nstab_authoravatar' " . $circleavatar . " style='background-image: url(\"".nstab_get_avatarurl()."\"); height: ".$avatarsize."px; width: ".$avatarsize."px;'></div>
    59                 <div id='nstab_authorbio' style='height: ".$avatarsize."px;'>
     76                <div id='nstab_authoravatar' " . $circleavatar . " style='background-image: url(\"".$url."\"); height: ".$nstab_setting_avatarsize."px; width: ".$nstab_setting_avatarsize."px;'></div>
     77                <div id='nstab_authorbio' style='height: ".$nstab_setting_avatarsize."px;'>
    6078                <div id='header'>
    61                     <span id='headline' style='font-size: " . $fontsizeheadline . "em;'>" . get_option("nstab_setting_headline") . " " . get_the_author_meta("display_name") . "</span>
    62                     <span id='position' style='font-size: " . $fontsizeposition . "em;'>" . get_the_author_meta("nstab_setting_authorposition") . "</span>
     79                    <span id='headline' style='font-size: " . $nstab_setting_fontsizeheadline . "em;'>" . $nstab_setting_headline . " " . get_the_author_meta("display_name") . "</span>
     80                    <span id='position' style='font-size: " . $nstab_setting_fontsizeposition . "em;'>" . get_the_author_meta("nstab_setting_authorposition") . "</span>
    6381                </div>
    64                     <p id='nstab_description' style='font-size: " . $fontsizebio . "em;'>" . get_the_author_meta("description") . "</p>
     82                    <p id='nstab_description' style='font-size: " . $nstab_setting_fontsizebio . "em;'>" . get_the_author_meta("description") . "</p>
    6583                    " . $homepagehref . "
    6684                </div>
  • author-box-by-nocksoft/tags/1.0.5/php/avatars.php

    r2464444 r2653204  
    11<?php
    22
    3 /* Returns the avatar URL */
    4 function nstab_get_avatarurl() {
    5     if (get_the_author_meta("nstab_setting_localavatar") != "on") return get_avatar_url(get_the_author_meta("ID"));
    6     else return get_the_author_meta("nstab_setting_avatarurl");
     3/* Returns the avatar URL for local avatar, if exists. */
     4function nstab_get_local_avatarurl($user_id) {
     5    if (!get_user_meta($user_id, "nstab_setting_localavatar", true)) return null;
     6   
     7    $url = get_user_meta($user_id, "nstab_setting_avatarurl", true);
     8    return $url;
    79}
    810
    911
     12/**
     13 * Overrides the avatar data.
     14 * https://developer.wordpress.org/reference/functions/get_avatar_data/
     15 * https://developer.wordpress.org/reference/hooks/get_avatar_data/
     16 */
     17add_filter("get_avatar_data", "nstab_get_avatar_data", 10, 2);
     18function nstab_get_avatar_data($args, $id_or_email) {
     19    $url = nstab_get_local_avatarurl(nstab_get_user_id($id_or_email));
     20    if (!empty($url)) $args["url"] = $url;
     21   
     22    return $args;
     23}
    1024
    11 /* Overrides the avatars */
    12 /* https://codex.wordpress.org/Plugin_API/Filter_Reference/get_avatar */
    13 add_filter("get_avatar", "nstab_get_avatar", 1 , 5);
    14 function nstab_get_avatar($avatar, $id_or_email, $size, $default, $alt) {
    15     $user = false;
    1625
    17     if (is_numeric($id_or_email)) {
    18         $id = (int)$id_or_email;
    19         $user = get_user_by("id", $id);
    20     }
    21     elseif (is_object($id_or_email)) {
    22         if (!empty($id_or_email->user_id)) {
    23             $id = (int)$id_or_email->user_id;
    24             $user = get_user_by("id", $id);
    25         }
    26     }
    27     else {
    28         $user = get_user_by("email", $id_or_email);
    29     }
     26function nstab_get_user_id($id_or_email) {
     27    $user_id = null;
     28   
     29    if (is_numeric($id_or_email)) {
     30        $user_id = (int)$id_or_email;
     31    }
     32    else if (is_string($id_or_email) && ($user = get_user_by("email", $id_or_email))) {
     33        $user_id = $user->ID;
     34    }
     35    else if (is_object($id_or_email) && !empty($id_or_email->user_id)) {
     36        $user_id = (int)$id_or_email->user_id;
     37    }
    3038
    31     if ($user && is_object($user)
    32         && get_the_author_meta("nstab_setting_localavatar", $user->ID) == "on") {
    33             $avatar = get_the_author_meta("nstab_setting_avatarurl", $user->ID);
    34             $avatar = "<img alt='{$alt}' src='{$avatar}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
    35     }
    36 
    37     return $avatar;
     39    return $user_id;
    3840}
    3941
  • author-box-by-nocksoft/tags/1.0.5/php/settings-defaults.php

    r2394668 r2653204  
    11<?php
    22
    3 /* --- Default settings and fallbacks. Only needed, when setting was added after initial release. --- */
     3/* Global settings: general */
     4$nstab_setting_default_displayauthorboxonposts = true;
     5$nstab_setting_default_displayauthorboxonpages = false;
     6$nstab_setting_default_hidewordpressauthorbox = false;
    47
    5 /* Headline Size */
    6 if (esc_attr(get_option("nstab_setting_fontsizeheadline")) != false) $fontsizeheadline = esc_attr(get_option("nstab_setting_fontsizeheadline"));
    7 else $fontsizeheadline = "1.1";
    8 
    9 /* Position Size */
    10 if (esc_attr(get_option("nstab_setting_fontsizeposition")) != false) $fontsizeposition = esc_attr(get_option("nstab_setting_fontsizeposition"));
    11 else $fontsizeposition = "0.7";
    12 
    13 /* Bio Size */
    14 if (esc_attr(get_option("nstab_setting_fontsizebio")) != false) $fontsizebio = esc_attr(get_option("nstab_setting_fontsizebio"));
    15 else $fontsizebio = "0.9";
    16 
    17 /* Links Size */
    18 if (esc_attr(get_option("nstab_setting_fontsizelinks")) != false) $fontsizelinks = esc_attr(get_option("nstab_setting_fontsizelinks"));
    19 else $fontsizelinks = "0.8";
     8/* Global settings: layout */
     9$nstab_setting_default_font = "arial";
     10$nstab_setting_default_showshadow = false;
     11$nstab_setting_default_showborder = true;
     12$nstab_setting_default_bordercolor = "#EEEEEE";
     13$nstab_setting_default_bordersize = "1";
     14$nstab_setting_default_avatarsize = "100";
     15$nstab_setting_default_circleavatar = false;
     16$nstab_setting_default_headline = __("A Post by", "author-box-by-nocksoft");
     17$nstab_setting_default_fontsizeheadline = "1.1";
     18$nstab_setting_default_fontsizeposition = "0.7";
     19$nstab_setting_default_fontsizebio = "0.9";
     20$nstab_setting_default_fontsizelinks = "0.8";
     21$nstab_setting_default_displayauthorsarchive = false;
    2022
    2123?>
  • author-box-by-nocksoft/tags/1.0.5/php/settings-global.php

    r2464444 r2653204  
    11<?php
    22
     3add_action("admin_menu", "nstab_settings_page");
    34function nstab_settings_page() {
    45    add_submenu_page(
     
    1112    );
    1213}
    13 add_action("admin_menu", "nstab_settings_page");
    1414
    1515
    1616add_action("admin_init", function() {
    17     register_setting("nstab_settings", "nstab_setting_showborder");
    18     register_setting("nstab_settings", "nstab_setting_avatarsize");
    19     register_setting("nstab_settings", "nstab_setting_circleavatar");
    20     register_setting("nstab_settings", "nstab_setting_headline");
    21     register_setting("nstab_settings", "nstab_setting_fontsizeheadline");
    22     register_setting("nstab_settings", "nstab_setting_fontsizeposition");
    23     register_setting("nstab_settings", "nstab_setting_fontsizebio");
    24     register_setting("nstab_settings", "nstab_setting_fontsizelinks");
    25     register_setting("nstab_settings", "nstab_setting_displayauthorsarchive");
    26     register_setting("nstab_settings", "nstab_setting_displayauthorboxonposts");
    27     register_setting("nstab_settings", "nstab_setting_displayauthorboxonpages");
    28     register_setting("nstab_settings", "nstab_setting_hidewordpressauthorbox");
     17    register_setting("nstab_settings_general", "nstab_setting_displayauthorboxonposts");
     18    register_setting("nstab_settings_general", "nstab_setting_displayauthorboxonpages");
     19    register_setting("nstab_settings_general", "nstab_setting_hidewordpressauthorbox");
     20   
     21    register_setting("nstab_settings_layout", "nstab_setting_font");
     22    register_setting("nstab_settings_layout", "nstab_setting_showshadow");
     23    register_setting("nstab_settings_layout", "nstab_setting_showborder");
     24    register_setting("nstab_settings_layout", "nstab_setting_bordercolor");
     25    register_setting("nstab_settings_layout", "nstab_setting_bordersize");
     26    register_setting("nstab_settings_layout", "nstab_setting_avatarsize");
     27    register_setting("nstab_settings_layout", "nstab_setting_circleavatar");
     28    register_setting("nstab_settings_layout", "nstab_setting_headline");
     29    register_setting("nstab_settings_layout", "nstab_setting_fontsizeheadline");
     30    register_setting("nstab_settings_layout", "nstab_setting_fontsizeposition");
     31    register_setting("nstab_settings_layout", "nstab_setting_fontsizebio");
     32    register_setting("nstab_settings_layout", "nstab_setting_fontsizelinks");
     33    register_setting("nstab_settings_layout", "nstab_setting_displayauthorsarchive");
    2934});
    3035
     
    3439    if (!current_user_can("manage_options")) return;
    3540
    36     require plugin_dir_path(__FILE__) . "settings-defaults.php";
     41    global $nstab_setting_displayauthorboxonposts;
     42    global $nstab_setting_displayauthorboxonpages;
     43    global $nstab_setting_hidewordpressauthorbox;
     44
     45    global $nstab_setting_font;
     46    global $nstab_setting_showshadow;
     47    global $nstab_setting_showborder;
     48    global $nstab_setting_default_bordercolor;
     49    global $nstab_setting_bordercolor;
     50    global $nstab_setting_bordersize;
     51    global $nstab_setting_avatarsize;
     52    global $nstab_setting_circleavatar;
     53    global $nstab_setting_headline;
     54    global $nstab_setting_fontsizeheadline;
     55    global $nstab_setting_fontsizeposition;
     56    global $nstab_setting_fontsizebio;
     57    global $nstab_setting_fontsizelinks;
     58    global $nstab_setting_displayauthorsarchive;
     59   
     60    $tab = isset($_GET["tab"]) ? $_GET["tab"] : null;
    3761    ?>
    3862    <div class="wrap">
    3963        <h1><?= esc_html(get_admin_page_title()); ?></h1>
     64       
     65        <p><?php echo __("User-specific settings are made in your user profile in WordPress (Users -> Your Profile -> Edit). General settings can be made here.", "author-box-by-nocksoft"); ?></p>
     66       
     67        <nav class="nav-tab-wrapper">
     68            <a href="?page=nstab" class="nav-tab<?php if ($tab == "general" || $tab == null) echo " nav-tab-active"; ?>"><?php echo __("General", "author-box-by-nocksoft"); ?></a>
     69            <a href="?page=nstab&tab=layout" class="nav-tab<?php if ($tab == "layout") echo " nav-tab-active"; ?>"><?php echo __("Layout", "author-box-by-nocksoft"); ?></a>
     70        </nav>
     71       
    4072        <form action="options.php" method="post">
    4173            <?php
    42             settings_fields("nstab_settings");
     74            $option_group = null;
     75            if ($tab == "general" || $tab == null) $option_group = "nstab_settings_general";
     76            else if ($tab == "layout") $option_group = "nstab_settings_layout";
     77            else return;
     78            settings_fields($option_group);
    4379            do_settings_sections("nstab");
    4480            ?>
    4581
    46             <p><?php echo __("User-specific settings are made in your author profile in WordPress (Users -> Your Profile). General settings can be made here.", "author-box-by-nocksoft"); ?></p>
    47 
    48             <table class="form-table">
    49             <tr valign="top">
    50                 <th scope="row"><?php echo __("Show Border of Author Box", "author-box-by-nocksoft"); ?></th>
    51                 <td><input type="checkbox" name="nstab_setting_showborder" <?php if (get_option("nstab_setting_showborder", true) == true) echo "checked"; ?> /></td>
    52                 </tr>
    53 
    54                 <tr valign="top">
    55                 <th scope="row"><?php echo __("Size of Avatar (Pixel)", "author-box-by-nocksoft"); ?></th>
    56                 <td><input type="number" name="nstab_setting_avatarsize" min="96" max="200" value="<?php echo esc_attr(get_option("nstab_setting_avatarsize")); ?>" /></td>
    57                 </tr>
    58 
    59                 <tr valign="top">
    60                 <th scope="row"><?php echo __("Use a circle avatar instead of a square", "author-box-by-nocksoft"); ?></th>
    61                 <td><input type="checkbox" name="nstab_setting_circleavatar" <?php if (get_option("nstab_setting_circleavatar") == true) echo "checked"; ?> /></td>
    62                 </tr>
    63 
    64                 <tr valign="top">
    65                 <th scope="row"><?php echo __("Headline", "author-box-by-nocksoft"); ?></th>
    66                 <td><input type="text" name="nstab_setting_headline" placeholder="<?php echo __("e.g. A Post by", "author-box-by-nocksoft"); ?>" value="<?php echo get_option("nstab_setting_headline"); ?>" /></td>
    67                 </tr>
    68 
    69                 <tr valign="top">
    70                 <th scope="row"><?php echo __("Fontsize of Headline (em)", "author-box-by-nocksoft"); ?></th>
    71                 <td><input type="number" name="nstab_setting_fontsizeheadline" min="0.5" max="2" step="0.1" value="<?php echo $fontsizeheadline; ?>" /></td>
    72                 </tr>
    73 
    74                 <tr valign="top">
    75                 <th scope="row"><?php echo __("Fontsize of author's Position (em)", "author-box-by-nocksoft"); ?></th>
    76                 <td><input type="number" name="nstab_setting_fontsizeposition" min="0.4" max="0.9" step="0.1" value="<?php echo $fontsizeposition; ?>" /></td>
    77                 </tr>
    78 
    79                 <tr valign="top">
    80                 <th scope="row"><?php echo __("Fontsize of Biography (em)", "author-box-by-nocksoft"); ?></th>
    81                 <td><input type="number" name="nstab_setting_fontsizebio" min="0.4" max="1.5" step="0.1" value="<?php echo $fontsizebio; ?>" /></td>
    82                 </tr>
    83 
    84                 <tr valign="top">
    85                 <th scope="row"><?php echo __("Fontsize of Links (em)", "author-box-by-nocksoft"); ?></th>
    86                 <td><input type="number" name="nstab_setting_fontsizelinks" min="0.3" max="1" step="0.1" value="<?php echo $fontsizelinks; ?>" /></td>
    87                 </tr>
    88 
    89                 <tr valign="top">
    90                 <th scope="row"><?php echo __("Display a link to the author's archive", "author-box-by-nocksoft"); ?></th>
    91                 <td><input type="checkbox" name="nstab_setting_displayauthorsarchive" <?php if (get_option("nstab_setting_displayauthorsarchive") == true) echo "checked"; ?> /></td>
    92                 </tr>
    93 
    94                 <tr valign="top">
    95                 <th scope="row"><?php echo __("Display Author Box at the end of each post automatically", "author-box-by-nocksoft"); ?></th>
    96                 <td><input type="checkbox" name="nstab_setting_displayauthorboxonposts" <?php if (get_option("nstab_setting_displayauthorboxonposts", true) == true) echo "checked"; ?> /></td>
    97                 </tr>
    98 
    99                 <tr valign="top">
    100                 <th scope="row"><?php echo __("Display Author Box at the end of each page automatically (not on front page, blog homepage and privacy policy)", "author-box-by-nocksoft"); ?></th>
    101                 <td><input type="checkbox" name="nstab_setting_displayauthorboxonpages" <?php if (get_option("nstab_setting_displayauthorboxonpages") == true) echo "checked"; ?> /></td>
    102                 </tr>
    103 
    104                 <tr valign="top">
    105                 <th scope="row"><?php echo __("Hide the author box of default WordPress theme (tested from Twenty Nineteen up to Twenty Twenty-One)", "author-box-by-nocksoft"); ?></th>
    106                 <td><input type="checkbox" name="nstab_setting_hidewordpressauthorbox" <?php if (get_option("nstab_setting_hidewordpressauthorbox") == true) echo "checked"; ?> /></td>
    107                 </tr>
    108             </table>
     82            <div class="tab-content">
     83                <?php
     84                if ($tab == "general" || $tab == null) {
     85                    ?>
     86                    <table class="form-table">
     87                        <tr valign="top">
     88                        <th scope="row"><?php echo __("Author Box display options", "author-box-by-nocksoft"); ?></th>
     89                        <td>
     90                            <input type="checkbox" id="nstab_setting_displayauthorboxonposts" name="nstab_setting_displayauthorboxonposts" <?php if ($nstab_setting_displayauthorboxonposts == true) echo "checked"; ?> />
     91                            <label for="nstab_setting_displayauthorboxonposts"><?php echo __("Display Author Box at the end of each post automatically", "author-box-by-nocksoft"); ?></label>
     92                            <br>
     93                            <input type="checkbox" id="nstab_setting_displayauthorboxonpages" name="nstab_setting_displayauthorboxonpages" <?php if ($nstab_setting_displayauthorboxonpages == true) echo "checked"; ?> />
     94                            <label for="nstab_setting_displayauthorboxonpages"><?php echo __("Display Author Box at the end of each page automatically (not on front page, blog homepage and privacy policy)", "author-box-by-nocksoft"); ?></label>
     95                        </td>
     96                        </tr>
     97
     98                        <tr valign="top">
     99                        <th scope="row"><?php echo __("Other options", "author-box-by-nocksoft"); ?></th>
     100                        <td>
     101                            <input type="checkbox" id="nstab_setting_hidewordpressauthorbox" name="nstab_setting_hidewordpressauthorbox" <?php if ($nstab_setting_hidewordpressauthorbox == true) echo "checked"; ?> />
     102                            <label for="nstab_setting_hidewordpressauthorbox"><?php echo __("Hide the author box of default WordPress theme (tested from Twenty Nineteen up to Twenty Twenty-One)", "author-box-by-nocksoft"); ?></label>
     103                            <p class="description"><?php echo __("If your theme offers you an option to hide the author box of your theme, you should use your theme's setting for this.", "author-box-by-nocksoft"); ?></p>
     104                        </td>
     105                        </tr>
     106                    </table>
     107                    <?php
     108                }
     109                else if ($tab == "layout") {
     110                    ?>
     111                    <table class="form-table">
     112                        <tr valign="top">
     113                        <th scope="row"><?php echo __("Basic", "author-box-by-nocksoft"); ?></th>
     114                        <td>
     115                            <select id="nstab_setting_font" name="nstab_setting_font">
     116                                <option value="arial" <?php if ($nstab_setting_font == "arial") echo "selected"; ?>><?php echo __("Arial", "author-box-by-nocksoft"); ?></option>
     117                                <option value="inherit" <?php if ($nstab_setting_font == "inherit") echo "selected"; ?>><?php echo __("Inherit from website", "author-box-by-nocksoft"); ?></option>
     118                            </select>
     119                            <label for="nstab_setting_font"><?php echo __("Font of Author Box", "author-box-by-nocksoft"); ?></label>
     120                            <p class="description"><?php echo __("Inherit from website means that the fonts of the WordPress theme are used.", "author-box-by-nocksoft"); ?></p>
     121                            <p>
     122                            <input type="checkbox" id="nstab_setting_showshadow" name="nstab_setting_showshadow" <?php if ($nstab_setting_showshadow == true) echo "checked"; ?> />
     123                            <label for="nstab_setting_showshadow"><?php echo __("Show Shadow of Author Box", "author-box-by-nocksoft"); ?></label>
     124                            </p>
     125                        </td>
     126                        </tr>
     127                       
     128                        <tr valign="top">
     129                        <th scope="row"><?php echo __("Border", "author-box-by-nocksoft"); ?></th>
     130                        <td>
     131                            <input type="checkbox" id="nstab_setting_showborder" name="nstab_setting_showborder" <?php if ($nstab_setting_showborder == true) echo "checked"; ?> />
     132                            <label for="nstab_setting_showborder"><?php echo __("Show Border of Author Box", "author-box-by-nocksoft"); ?></label>
     133                            <p>
     134                            <input type="text" id="nstab_setting_bordercolor" name="nstab_setting_bordercolor" class="nstab_colorpicker" value="<?php echo $nstab_setting_bordercolor; ?>" data-default-color="<?php echo $nstab_setting_default_bordercolor; ?>" />
     135                            <label for="nstab_setting_bordercolor"><?php echo __("Color of border", "author-box-by-nocksoft"); ?></label>
     136                            </p>
     137                            <input type="number" id="nstab_setting_bordersize" name="nstab_setting_bordersize" min="1" max="5" step="1" value="<?php echo $nstab_setting_bordersize; ?>" />
     138                            <label for="nstab_setting_bordersize"><?php echo __("Size of border", "author-box-by-nocksoft"); ?></label>
     139                        </td>
     140                        </tr>
     141
     142                        <tr valign="top">
     143                        <th scope="row"><?php echo __("Avatar", "author-box-by-nocksoft"); ?></th>
     144                        <td>
     145                            <input type="number" id="nstab_setting_avatarsize" name="nstab_setting_avatarsize" min="96" max="200" value="<?php echo $nstab_setting_avatarsize; ?>" />
     146                            <label for="nstab_setting_avatarsize"><?php echo __("Size of Avatar (Pixel)", "author-box-by-nocksoft"); ?></label>
     147                            <p>
     148                            <input type="checkbox" id="nstab_setting_circleavatar" name="nstab_setting_circleavatar" <?php if ($nstab_setting_circleavatar == true) echo "checked"; ?> />
     149                            <label for="nstab_setting_circleavatar"><?php echo __("Use a circle avatar instead of a square", "author-box-by-nocksoft"); ?></label>
     150                            </p>
     151                        </td>
     152                        </tr>
     153
     154                        <tr valign="top">
     155                        <th scope="row"><?php echo __("Header", "author-box-by-nocksoft"); ?></th>
     156                        <td>
     157                            <input type="text" id="nstab_setting_headline" name="nstab_setting_headline" placeholder="<?php echo __("e.g. A Post by", "author-box-by-nocksoft"); ?>" value="<?php echo $nstab_setting_headline; ?>" />
     158                            <label for="nstab_setting_headline"><?php echo __("Headline", "author-box-by-nocksoft"); ?></label>
     159                            <p>
     160                            <input type="number" id="nstab_setting_fontsizeheadline" name="nstab_setting_fontsizeheadline" min="0.5" max="2" step="0.1" value="<?php echo $nstab_setting_fontsizeheadline; ?>" />
     161                            <label for="nstab_setting_fontsizeheadline"><?php echo __("Fontsize of Headline (em)", "author-box-by-nocksoft"); ?></label>
     162                            </p>
     163                            <p>
     164                            <input type="number" id="nstab_setting_fontsizeposition" name="nstab_setting_fontsizeposition" min="0.4" max="0.9" step="0.1" value="<?php echo $nstab_setting_fontsizeposition; ?>" />
     165                            <label for="nstab_setting_fontsizeposition"><?php echo __("Fontsize of author's Position (em)", "author-box-by-nocksoft"); ?></label>
     166                            </p>
     167                        </td>
     168                        </tr>
     169
     170                        <tr valign="top">
     171                        <th scope="row"><?php echo __("Biography", "author-box-by-nocksoft"); ?></th>
     172                        <td>
     173                            <input type="number" id="nstab_setting_fontsizebio" name="nstab_setting_fontsizebio" min="0.4" max="1.5" step="0.1" value="<?php echo $nstab_setting_fontsizebio; ?>" />
     174                            <label for="nstab_setting_fontsizebio"><?php echo __("Fontsize of Biography (em)", "author-box-by-nocksoft"); ?></label>
     175                        </td>
     176                        </tr>
     177
     178                        <tr valign="top">
     179                        <th scope="row"><?php echo __("Footer", "author-box-by-nocksoft"); ?></th>
     180                        <td>
     181                            <input type="number" id="nstab_setting_fontsizelinks" name="nstab_setting_fontsizelinks" min="0.3" max="1" step="0.1" value="<?php echo $nstab_setting_fontsizelinks; ?>" />
     182                            <label for="nstab_setting_fontsizelinks"><?php echo __("Fontsize of Links (em)", "author-box-by-nocksoft"); ?></label>
     183                            <p>
     184                            <input type="checkbox" id="nstab_setting_displayauthorsarchive" name="nstab_setting_displayauthorsarchive" <?php if ($nstab_setting_displayauthorsarchive == true) echo "checked"; ?> />
     185                            <label for="nstab_setting_displayauthorsarchive"><?php echo __("Display a link to the author's archive", "author-box-by-nocksoft"); ?></label>
     186                            </p>
     187                        </td>
     188                        </tr>
     189                    </table>
     190                    <?php
     191                }
     192            ?>
     193            </div>
    109194
    110195
  • author-box-by-nocksoft/tags/1.0.5/php/settings-user.php

    r2394668 r2653204  
    55add_action("show_user_profile", "nstab_usersettings");
    66add_action("edit_user_profile", "nstab_usersettings");
    7 
    87function nstab_usersettings($user) {
    98    ?>
     
    5756add_action("personal_options_update", "nstab_save_usersettings");
    5857add_action("edit_user_profile_update", "nstab_save_usersettings");
    59 
    6058function nstab_save_usersettings($user_id) {
    6159    if (!current_user_can("edit_user", $user_id)) {
     
    6361    }
    6462    else {
    65         update_usermeta($user_id, "nstab_setting_localavatar", $_POST["nstab_setting_localavatar"]);
     63        $nstab_setting_localavatar = isset($_POST["nstab_setting_localavatar"]) ? $_POST["nstab_setting_localavatar"] : false;
     64        update_usermeta($user_id, "nstab_setting_localavatar", $nstab_setting_localavatar);
    6665        update_usermeta($user_id, "nstab_setting_avatarurl", trim($_POST["nstab_setting_avatarurl"]));
    6766        update_usermeta($user_id, "nstab_setting_authorposition", trim($_POST["nstab_setting_authorposition"]));
  • author-box-by-nocksoft/tags/1.0.5/php/setup.php

    r2464444 r2653204  
    22
    33function nstab_activate_plugin() {
    4     /* Default settings */
    5     add_option("nstab_setting_showborder", "on");
    6     add_option("nstab_setting_avatarsize", "100");
    7     add_option("nstab_setting_circleavatar", "");
    8     add_option("nstab_setting_headline", __("A Post by", "author-box-by-nocksoft"));
    9     add_option("nstab_setting_fontsizeheadline", "1.1");
    10     add_option("nstab_setting_fontsizeposition", "0.7");
    11     add_option("nstab_setting_fontsizebio", "0.9");
    12     add_option("nstab_setting_fontsizelinks", "0.8");
    13     add_option("nstab_setting_displayauthorsarchive", "");
    14     add_option("nstab_setting_displayauthorboxonposts", "on");
    15     add_option("nstab_setting_displayauthorboxonpages", "");
    16     add_option("nstab_setting_hidewordpressauthorbox", "");
     4    require plugin_dir_path(__FILE__) . "settings-defaults.php";
     5   
     6    add_option("nstab_setting_displayauthorboxonposts", $nstab_setting_default_displayauthorboxonposts);
     7    add_option("nstab_setting_displayauthorboxonpages", $nstab_setting_default_displayauthorboxonpages);
     8    add_option("nstab_setting_hidewordpressauthorbox", $nstab_setting_default_hidewordpressauthorbox);
     9   
     10    add_option("nstab_setting_font", $nstab_setting_default_font);
     11    add_option("nstab_setting_showshadow", $nstab_setting_default_showshadow);
     12    add_option("nstab_setting_showborder", $nstab_setting_default_showborder);
     13    add_option("nstab_setting_bordercolor", $nstab_setting_default_bordercolor);
     14    add_option("nstab_setting_bordersize", $nstab_setting_default_bordersize);
     15    add_option("nstab_setting_avatarsize", $nstab_setting_default_avatarsize);
     16    add_option("nstab_setting_circleavatar", $nstab_setting_default_circleavatar);
     17    add_option("nstab_setting_headline", $nstab_setting_default_headline);
     18    add_option("nstab_setting_fontsizeheadline", $nstab_setting_default_fontsizeheadline);
     19    add_option("nstab_setting_fontsizeposition", $nstab_setting_default_fontsizeposition);
     20    add_option("nstab_setting_fontsizebio", $nstab_setting_default_fontsizebio);
     21    add_option("nstab_setting_fontsizelinks", $nstab_setting_default_fontsizelinks);
     22    add_option("nstab_setting_displayauthorsarchive", $nstab_setting_default_displayauthorsarchive);
    1723}
    1824
     25/* https://developer.wordpress.org/plugins/plugin-basics/uninstall-methods/ */
    1926function nstab_uninstall_plugin() {
    20     /* Clear global settings */
     27    if (!defined("WP_UNINSTALL_PLUGIN")) {
     28        die;
     29    }
     30   
     31    delete_option("nstab_setting_displayauthorboxonposts");
     32    delete_option("nstab_setting_displayauthorboxonpages");
     33    delete_option("nstab_setting_hidewordpressauthorbox");
     34   
     35    delete_option("nstab_setting_font");
     36    delete_option("nstab_setting_showshadow");
    2137    delete_option("nstab_setting_showborder");
     38    delete_option("nstab_setting_bordercolor");
     39    delete_option("nstab_setting_bordersize");
    2240    delete_option("nstab_setting_avatarsize");
    2341    delete_option("nstab_setting_circleavatar");
     
    2846    delete_option("nstab_setting_fontsizelinks");
    2947    delete_option("nstab_setting_displayauthorsarchive");
    30     delete_option("nstab_setting_displayauthorboxonposts");
    31     delete_option("nstab_setting_displayauthorboxonpages");
    32     delete_option("nstab_setting_hidewordpressauthorbox");
    3348
    3449    /* Clear user settings */
  • author-box-by-nocksoft/tags/1.0.5/readme.txt

    r2464444 r2653204  
    33Tags: author box, author bio, author description, local avatars, about author, about me, author profile, author
    44Stable tag: trunk
    5 Requires at least: 4.9
    6 Tested up to: 5.6
     5Requires at least: 5.3
     6Tested up to: 5.9
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1616
    1717== Features ==
    18 * Adds a simple lightweight Author Box at the end of your posts with a short description about the author
     18* Adds a simple lightweight Author Box at the end of your posts and/or pages with a short description about the author
    1919* Adds support for local avatars for authors so that you dont need to use an Gravatar account
    2020* Option for displaying a link to an own "About Me Page" in Author Box for post authors
     
    7373== Changelog ==
    7474
     75= 1.0.5 =
     76* Fixed a bug that may caused local avatars do not work properly in some cases
     77* Fixed a PHP error while saving user specific settings
     78* General settings page separated in tabs
     79* Added option to inherit font from theme
     80* Added option to display shadow of Author Box
     81* Added option to to adjust border size and border color of Author Box
     82
    7583= 1.0.4 =
    7684* Fixed PHP warnings for PHP 8
  • author-box-by-nocksoft/trunk/author-box-by-nocksoft.php

    r2464444 r2653204  
    33/*
    44    Plugin Name: Author Box by Nocksoft
    5     Version: 1.0.4
     5    Version: 1.0.5
    66    Author: Rafael Nockmann @ Nocksoft
    77    Author URI: https://nocksoft.de
     
    1515
    1616
    17 /* --- Settings link in plugin overview --- */
    18 add_filter("plugin_action_links_" . plugin_basename(__FILE__), "nstab_pluginsettingslink");
    19 function nstab_pluginsettingslink($links) {
    20     $settingslink = "<a href='options-general.php?page=nstab'>" . __("Settings", "author-box-by-nocksoft") . "</a>";
    21     array_unshift($links, $settingslink);
    22     return $links;
     17if (is_admin()) {
     18
     19    /* --- Settings link in plugin overview --- */
     20    add_filter("plugin_action_links_" . plugin_basename(__FILE__), "nstab_pluginsettingslink");
     21    function nstab_pluginsettingslink($links) {
     22        $settingslink = "<a href='options-general.php?page=nstab'>" . __("Settings", "author-box-by-nocksoft") . "</a>";
     23        array_push($links, $settingslink);
     24        return $links;
     25    }
     26   
     27   
     28    /* --- Load scripts --- */
     29    require_once plugin_dir_path(__FILE__) . "/php/setup.php";
     30    require_once plugin_dir_path(__FILE__) . "/php/settings-global.php";
     31    require_once plugin_dir_path(__FILE__) . "/php/settings-user.php";
     32   
     33    add_action("admin_enqueue_scripts", "nstab_loadcolorpicker");
     34    function nstab_loadcolorpicker() {
     35        wp_enqueue_style("wp-color-picker");
     36        wp_enqueue_script("custom-script-handle", plugin_dir_url(__FILE__) . "js/colorpicker.js", array("wp-color-picker"), false, true);
     37    }
     38   
     39   
     40    /* --- Plugin setup --- */
     41    register_activation_hook(__FILE__, "nstab_activate_plugin");
     42    register_uninstall_hook(__FILE__, "nstab_uninstall_plugin");
     43   
    2344}
    2445
    2546
    2647/* --- Load scripts --- */
    27 require_once plugin_dir_path(__FILE__) . "/php/setup.php";
    2848require_once plugin_dir_path(__FILE__) . "/php/avatars.php";
    2949require_once plugin_dir_path(__FILE__) . "/php/authorbox.php";
    30 require_once plugin_dir_path(__FILE__) . "/php/settings-global.php";
    31 require_once plugin_dir_path(__FILE__) . "/php/settings-user.php";
    32 
    33 
    34 /* --- Plugin setup --- */
    35 register_activation_hook(__FILE__, "nstab_activate_plugin");
    36 register_uninstall_hook(__FILE__, "nstab_uninstall_plugin");
     50require_once plugin_dir_path(__FILE__) . "/php/settings.php";
    3751
    3852
    3953/* --- Load styles --- */
    40 wp_register_style("author-box-by-nocksoft-style", plugin_dir_url(__FILE__) . "assets/style.css");
     54wp_register_style("author-box-by-nocksoft-style", plugin_dir_url(__FILE__) . "css/style.css");
    4155wp_enqueue_style("author-box-by-nocksoft-style");
    4256
    43 if (get_option("nstab_setting_hidewordpressauthorbox") == true) {
    44     wp_register_style("author-box-by-nocksoft-hidewordpressauthorbox", plugin_dir_url(__FILE__) . "assets/hidewordpressauthorbox.css");
     57if ($nstab_setting_hidewordpressauthorbox == true) {
     58    wp_register_style("author-box-by-nocksoft-hidewordpressauthorbox", plugin_dir_url(__FILE__) . "css/hidewordpressauthorbox.css");
    4559    wp_enqueue_style("author-box-by-nocksoft-hidewordpressauthorbox");
    4660}
     
    4862
    4963/* --- Languages --- */
     64add_action("plugins_loaded", "nstab_load_plugin_textdomain");
    5065function nstab_load_plugin_textdomain() {
    5166    load_plugin_textdomain("author-box-by-nocksoft", FALSE, basename(dirname(__FILE__)) . "/languages/");
    5267}
    53 add_action("plugins_loaded", "nstab_load_plugin_textdomain");
    54 
    5568
    5669?>
  • author-box-by-nocksoft/trunk/languages/author-box-by-nocksoft-de_DE.po

    r2464444 r2653204  
    33msgstr "F&uuml;gt eine moderne anpassbare Autoren Info Box am Ende deines Beitrages ein und bringt Support f&uuml;r lokale Avatare."
    44
    5 #: author-box-by-nocksoft.php:19
     5#: author-box-by-nocksoft.php:22
    66msgid "Settings"
    77msgstr "Einstellungen"
    88
    9 #: setup.php:8
     9#: authorbox.php:55
     10msgid "View Archive"
     11msgstr "Archiv anzeigen"
     12
     13#: authorbox.php:62
     14msgid "View Archive"
     15msgstr "Archiv anzeigen"
     16
     17#: settings-defaults.php:16
    1018msgid "A Post by"
    1119msgstr "Ein Beitrag von"
    1220
    13 #: settings-global.php:45
    14 msgid "User-specific settings are made in your author profile in WordPress (Users -> Your Profile). General settings can be made here."
    15 msgstr "Benutzerspezifische Einstellungen werden in deinem Benutzerprofil get&auml;tigt (Benutzer -> Dein Profil). Allgemeine Einstellungen k&ouml;nnen hier vorgenommen werden."
    16 
    17 #: settings-global.php:49
     21#: settings-global.php:65
     22msgid "User-specific settings are made in your user profile in WordPress (Users -> Your Profile -> Edit). General settings can be made here."
     23msgstr "Benutzerspezifische Einstellungen werden in deinem Benutzerprofil get&auml;tigt (Benutzer -> Dein Profil -> Bearbeiten). Allgemeine Einstellungen k&ouml;nnen hier vorgenommen werden."
     24
     25#: settings-global.php:68
     26msgid "General"
     27msgstr "Allgemein"
     28
     29#: settings-global.php:69
     30msgid "Layout"
     31msgstr "Aussehen"
     32
     33#: settings-global.php:88
     34msgid "Author Box display options"
     35msgstr "Author Box Anzeigeeinstellungen"
     36
     37#: settings-global.php:91
     38msgid "Display Author Box at the end of each post automatically"
     39msgstr "F&uuml;ge die Author Box am Ende von Beitr&auml;gen automatisch hinzu"
     40
     41#: settings-global.php:94
     42msgid "Display Author Box at the end of each page automatically (not on front page, blog homepage and privacy policy)"
     43msgstr "F&uuml;ge die Author Box am Ende von Seiten automatisch hinzu (nicht auf Startseite, Beitragsseite und Datenschutzerkl&auml;rung)"
     44
     45#: settings-global.php:99
     46msgid "Other options"
     47msgstr "Weitere Einstellungen"
     48
     49#: settings-global.php:102
     50msgid "Hide the author box of default WordPress theme (tested from Twenty Nineteen up to Twenty Twenty-One)"
     51msgstr "Verstecke die Autor-Biografie (Author Box) vom WordPress Standard-Theme (Getestet von Twenty Nineteen bis Twenty Twenty-One)"
     52
     53#: settings-global.php:103
     54msgid "If your theme offers you an option to hide the author box of your theme, you should use your theme's setting for this."
     55msgstr "Wenn dein Theme dir eine Option anbietet, die Autor-Biografie (Author Box) deines Themes auszublenden, solltest du die Einstellung deines Themes dafür verwenden."
     56
     57#: settings-global.php:113
     58msgid "Basic"
     59msgstr "Grundlegend"
     60
     61#: settings-global.php:116
     62msgid "Arial"
     63msgstr "Arial"
     64
     65#: settings-global.php:117
     66msgid "Inherit from website"
     67msgstr "Von Webseite erben"
     68
     69#: settings-global.php:119
     70msgid "Font of Author Box"
     71msgstr "Schriftart der Author Box"
     72
     73#: settings-global.php:120
     74msgid "Inherit from website means that the fonts of the WordPress theme are used."
     75msgstr "Von Webseite erben bedeutet, dass die Schriftart des WordPress Themes verwendet wird."
     76
     77#: settings-global.php:123
     78msgid "Show Shadow of Author Box"
     79msgstr "Stelle einen Schatten um die Author Box dar"
     80
     81#: settings-global.php:129
     82msgid "Border"
     83msgstr "Rahmen"
     84
     85#: settings-global.php:132
    1886msgid "Show Border of Author Box"
    19 msgstr "Stelle den Rand der Author Box dar"
    20 
    21 #: settings-global.php:54
     87msgstr "Stelle den Rahmen der Author Box dar"
     88
     89#: settings-global.php:135
     90msgid "Color of border"
     91msgstr "Farbe des Rahmens"
     92
     93#: settings-global.php:138
     94msgid "Size of border"
     95msgstr "Breite des Rahmens"
     96
     97#: settings-global.php:143
     98msgid "Avatar"
     99msgstr "Avatar"
     100
     101#: settings-global.php:146
    22102msgid "Size of Avatar (Pixel)"
    23103msgstr "Gr&ouml;&szlig;e Avatar (Pixel)"
    24104
    25 #: settings-global.php:59
     105#: settings-global.php:149
    26106msgid "Use a circle avatar instead of a square"
    27107msgstr "Verwende ein rundes statt ein eckiges Profilbild"
    28108
    29 #: settings-global.php:64
     109#: settings-global.php:155
     110msgid "Header"
     111msgstr "Header"
     112
     113#: settings-global.php:157
     114msgid "e.g. A Post by"
     115msgstr "z.B. Ein Beitrag von"
     116
     117#: settings-global.php:158
    30118msgid "Headline"
    31119msgstr "Text der &Uuml;berschrift"
    32120
    33 #: settings-global.php:65
    34 msgid "e.g. A Post by"
    35 msgstr "z.B. Ein Beitrag von"
    36 
    37 #: settings-global.php:69
     121#: settings-global.php:161
    38122msgid "Fontsize of Headline (em)"
    39123msgstr "Schriftgr&ouml;&szlig;e der &Uuml;berschrift (em)"
    40124
    41 #: settings-global.php:74
     125#: settings-global.php:165
    42126msgid "Fontsize of author's Position (em)"
    43 msgstr "Schriftgr&ouml;&szlig;e der Position vom Autor (em)"
    44 
    45 #: settings-global.php:79
     127msgstr "Schriftgr&ouml;&szlig;e der Position des Autors (em)"
     128
     129#: settings-global.php:171
     130msgid "Biography"
     131msgstr "Biografie"
     132
     133#: settings-global.php:174
    46134msgid "Fontsize of Biography (em)"
    47135msgstr "Schriftgr&ouml;&szlig;e der Biografie (em)"
    48136
    49 #: settings-global.php:84
     137#: settings-global.php:179
     138msgid "Footer"
     139msgstr "Footer"
     140
     141#: settings-global.php:182
    50142msgid "Fontsize of Links (em)"
    51143msgstr "Schriftgr&ouml;&szlig;e der Links (em)"
    52144
    53 #: settings-global.php:89
     145#: settings-global.php:185
    54146msgid "Display a link to the author's archive"
    55147msgstr "Zeige einen Link zum Archiv des Autors an"
    56148
    57 #: settings-global.php:94
    58 msgid "Display Author Box at the end of each post automatically"
    59 msgstr "F&uuml;ge die Author Box am Ende von Beitr&auml;gen automatisch hinzu"
    60 
    61 #: settings-global.php:100
    62 msgid "Display Author Box at the end of each page automatically (not on front page, blog homepage and privacy policy)"
    63 msgstr "F&uuml;ge die Author Box am Ende von Seiten automatisch hinzu (nicht auf Startseite, Beitragsseite und Datenschutzerkl&auml;rung)"
    64 
    65 #: settings-global.php:105
    66 msgid "Hide the author box of default WordPress theme (tested from Twenty Nineteen up to Twenty Twenty-One)"
    67 msgstr "Verstecke die Autor-Biografie (Author Box) vom WordPress Standard-Theme (Getestet von Twenty Nineteen bis Twenty Twenty-One)"
    68 
    69 #: settings-global.php:105
     149#: settings-global.php:196
    70150msgid "Save Settings"
    71151msgstr "Einstellungen speichern"
    72152
    73 #: settings-user.php:12
     153#: settings-user.php:11
    74154msgid "Here you can make further settings for your avatar or other personal settings. The WordPress administrator can adjust global settings under Settings -> Author Box."
    75 msgstr "Hier kannst du weitere Einstellungen in Bezug auf deinen Avatar oder weiteren pers&ouml;nlichen Einstellungen vornehmen. Globale Einstellungen kann der WordPress-Administrator unter Einstellungen -> Author Box vornehmen."
    76 
    77 #: settings-user.php:16
     155msgstr "Hier kannst du weitere Einstellungen in Bezug auf deinen Avatar oder weitere pers&ouml;nliche Einstellungen vornehmen. Globale Einstellungen kann der WordPress-Administrator unter Einstellungen -> Author Box vornehmen."
     156
     157#: settings-user.php:15
    78158msgid "Local avatars"
    79159msgstr "Lokale Avatare"
    80160
    81 #: settings-user.php:19
     161#: settings-user.php:18
    82162msgid "Use local avatars instead of Gravatar (Enter the URL to your avatar in the input field below)"
    83163msgstr "Verwende lokale Avatare an Stelle von Gravatar (Trage die URL zu deinem Profilbild in das untere Eingabefeld ein)"
    84164
    85 #: settings-user.php:24
     165#: settings-user.php:23
    86166msgid "Avatar (URL)"
    87167msgstr "Avatar (URL)"
    88168
    89 #: settings-user.php:27
     169#: settings-user.php:26
    90170msgid "Avatar URL (e.g. https://yoursite.com/avatar.jpg)"
    91171msgstr "Avatar URL (z.B. https://deineseite.de/avatar.jpg)"
    92172
    93 #: settings-user.php:28
     173#: settings-user.php:27
    94174msgid "Please enter a valid URL to your avatar, so that it can be displayed in the author box. You will get the best results if your avatar has the same width and height dimensions."
    95175msgstr "Gebe bitte eine g&uuml;ltige URL zu deinem Avatar an, damit dieses in der Author Box angezeigt werden kann. Das beste Ergebnis erh&auml;ltst du, wenn dein Profilbild die gleiche H&ouml;he und Breite aufweist."
    96176
    97 #: settings-user.php:33
     177#: settings-user.php:32
    98178msgid "Your Position"
    99179msgstr "Deine Position"
    100180
    101 #: settings-user.php:36
     181#: settings-user.php:35
    102182msgid "Position (e.g. Founder or Author of YourSite)"
    103183msgstr "Position (z.B. Gr&uuml;nder oder Autor von DeineSeite)"
    104184
    105 #: settings-user.php:37
     185#: settings-user.php:36
    106186msgid "Here you can enter your position. The position is shown below your name in the Author Box."
    107187msgstr "Hier kannst du deine Position angeben. Die Position wird unterhalb deines Namens in der Author Box angezeigt."
    108188
    109 #: settings-user.php:42
     189#: settings-user.php:41
    110190msgid "Homepage / About Me Page"
    111191msgstr "Homepage / &Uuml;ber Mich Seite"
    112192
    113 #: settings-user.php:46
     193#: settings-user.php:45
    114194msgid "Link Text (e.g. Homepage or About Me)"
    115195msgstr "Link Text (z.B. Homepage oder &Uuml;ber mich)"
    116196
    117 #: settings-user.php:47
     197#: settings-user.php:46
    118198msgid "Link URL (e.g. https://yoursite.com)"
    119199msgstr "Link URL (z.B. https://deineseite.de)"
    120200
    121 #: settings-user.php:48
     201#: settings-user.php:47
    122202msgid "This URL will be displayed below your biography in the Author Box."
    123203msgstr "Diese URL wird unterhalb deiner Biografie in der Author Box angezeigt."
    124 
    125 #: authorbox.php:41
    126 msgid "View Archive"
    127 msgstr "Archiv anzeigen"
    128 
    129 #: authorbox.php:48
    130 msgid "View Archive"
    131 msgstr "Archiv anzeigen"
  • author-box-by-nocksoft/trunk/php/authorbox.php

    r2464444 r2653204  
    22
    33/* Author Box Shortcode. */
     4add_shortcode("authorbox", "nstab_shortcode_authorbox");
    45function nstab_shortcode_authorbox() {
    56    return nstab_get_authorbox();
    67}
    7 add_shortcode("authorbox", "nstab_shortcode_authorbox");
    88
    99
    10 /* Adds Author Box at end of posts */
     10/* Adds Author Box at end of posts and pages automatically. */
    1111add_filter("the_content", "nstab_add_authorbox");
    1212function nstab_add_authorbox($content) {
    13     if (is_single() && get_option("nstab_setting_displayauthorboxonposts", true) == true) {
     13    global $nstab_setting_displayauthorboxonposts;
     14    global $nstab_setting_displayauthorboxonpages;
     15   
     16    if (is_single() && $nstab_setting_displayauthorboxonposts == true) {
    1417        $content .= nstab_get_authorbox();
    1518    }
    16     else if (is_page() && get_option("nstab_setting_displayauthorboxonpages") == true
     19    else if (is_page() && $nstab_setting_displayauthorboxonpages == true
    1720        && !is_front_page() && !is_home() && !is_privacy_policy()) {
    1821        $content .= nstab_get_authorbox();
     
    2225
    2326
    24 /* --- Drawing of the Author Box --- */
    25 
    26 /* Adds Author Box */
     27/* Get Author Box HTML. */
    2728function nstab_get_authorbox() {
    28     $avatarsize = esc_attr(get_option("nstab_setting_avatarsize"));
     29    global $nstab_setting_font;
     30    global $nstab_setting_showshadow;
     31    global $nstab_setting_showborder;
     32    global $nstab_setting_bordercolor;
     33    global $nstab_setting_bordersize;
     34    global $nstab_setting_avatarsize;
     35    global $nstab_setting_circleavatar;
     36    global $nstab_setting_headline;
     37    global $nstab_setting_fontsizeheadline;
     38    global $nstab_setting_fontsizeposition;
     39    global $nstab_setting_fontsizebio;
     40    global $nstab_setting_fontsizelinks;
     41    global $nstab_setting_displayauthorsarchive;
     42   
     43    $author_id = get_the_author_meta("ID");
     44   
    2945    $circleavatar = "";
    30     if (get_option("nstab_setting_circleavatar") == true) {
     46    if ($nstab_setting_circleavatar == true) {
    3147        $circleavatar = "class='nstab_circle'";
    3248    }
    33    
    34     require plugin_dir_path(__FILE__) . "settings-defaults.php";
    3549
    3650    $authorlinktext = get_the_author_meta("nstab_setting_homepage_linktext");
    3751    $authorlinkurl = get_the_author_meta("nstab_setting_homepage_linkurl");
    3852    if ($authorlinktext != null && $authorlinkurl != null) {
    39         $homepagehref = "<p id='nstab_links' style='font-size: " . $fontsizelinks . "em;'><a href='" . $authorlinkurl . "'>" . $authorlinktext . "</a>";
    40         if (get_option("nstab_setting_displayauthorsarchive") == true) {
    41             $homepagehref .= " | <a href='" . get_author_posts_url(get_the_author_meta("ID")) . "'>" . __("View Archive", "author-box-by-nocksoft") . "</a>";
     53        $homepagehref = "<p id='nstab_links' style='font-size: " . $nstab_setting_fontsizelinks . "em;'><a href='" . $authorlinkurl . "'>" . $authorlinktext . "</a>";
     54        if ($nstab_setting_displayauthorsarchive == true) {
     55            $homepagehref .= " | <a href='" . get_author_posts_url($author_id) . "'>" . __("View Archive", "author-box-by-nocksoft") . "</a>";
    4256        }
    4357        $homepagehref .= "</p>";
     
    4559    else {
    4660        $homepagehref = "";
    47         if (get_option("nstab_setting_displayauthorsarchive") == true) {
    48             $homepagehref .= "<p id='nstab_links' style='font-size: " . $fontsizelinks . "em;'><a href='" . get_author_posts_url(get_the_author_meta("ID")) . "'>" . __("View Archive", "author-box-by-nocksoft") . "</a></p>";
     61        if ($nstab_setting_displayauthorsarchive == true) {
     62            $homepagehref .= "<p id='nstab_links' style='font-size: " . $nstab_setting_fontsizelinks . "em;'><a href='" . get_author_posts_url($author_id) . "'>" . __("View Archive", "author-box-by-nocksoft") . "</a></p>";
    4963        }
    5064    }
    5165
    52     $authorboxcontainer = "<div id='author-box-by-nocksoft'>";
    53     if (get_option("nstab_setting_showborder", true) == true) {
    54         $authorboxcontainer = "<div id='author-box-by-nocksoft' style='padding: 0.75em; border: 1px solid #EEEEEE;'>";
    55     }
     66    $font = $nstab_setting_font == "arial" ? "font-family: Arial;" : null;
     67    $shadow = $nstab_setting_showshadow == true ? "padding: 0.75em; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);" : null;
     68    $border = $nstab_setting_showborder == true ? "padding: 0.75em; border: ".$nstab_setting_bordersize."px solid ".$nstab_setting_bordercolor.";" : null;
     69    $authorboxcontainer = "<div id='author-box-by-nocksoft' style='".$font.$shadow.$border."'>";
     70   
     71    $url = nstab_get_local_avatarurl($author_id);
     72    if (empty($url)) $url = get_avatar_url($author_id);
     73   
    5674    $authorbox = $authorboxcontainer .= "
    5775            <div id='nstab_wrapper'>
    58                 <div id='nstab_authoravatar' " . $circleavatar . " style='background-image: url(\"".nstab_get_avatarurl()."\"); height: ".$avatarsize."px; width: ".$avatarsize."px;'></div>
    59                 <div id='nstab_authorbio' style='height: ".$avatarsize."px;'>
     76                <div id='nstab_authoravatar' " . $circleavatar . " style='background-image: url(\"".$url."\"); height: ".$nstab_setting_avatarsize."px; width: ".$nstab_setting_avatarsize."px;'></div>
     77                <div id='nstab_authorbio' style='height: ".$nstab_setting_avatarsize."px;'>
    6078                <div id='header'>
    61                     <span id='headline' style='font-size: " . $fontsizeheadline . "em;'>" . get_option("nstab_setting_headline") . " " . get_the_author_meta("display_name") . "</span>
    62                     <span id='position' style='font-size: " . $fontsizeposition . "em;'>" . get_the_author_meta("nstab_setting_authorposition") . "</span>
     79                    <span id='headline' style='font-size: " . $nstab_setting_fontsizeheadline . "em;'>" . $nstab_setting_headline . " " . get_the_author_meta("display_name") . "</span>
     80                    <span id='position' style='font-size: " . $nstab_setting_fontsizeposition . "em;'>" . get_the_author_meta("nstab_setting_authorposition") . "</span>
    6381                </div>
    64                     <p id='nstab_description' style='font-size: " . $fontsizebio . "em;'>" . get_the_author_meta("description") . "</p>
     82                    <p id='nstab_description' style='font-size: " . $nstab_setting_fontsizebio . "em;'>" . get_the_author_meta("description") . "</p>
    6583                    " . $homepagehref . "
    6684                </div>
  • author-box-by-nocksoft/trunk/php/avatars.php

    r2464444 r2653204  
    11<?php
    22
    3 /* Returns the avatar URL */
    4 function nstab_get_avatarurl() {
    5     if (get_the_author_meta("nstab_setting_localavatar") != "on") return get_avatar_url(get_the_author_meta("ID"));
    6     else return get_the_author_meta("nstab_setting_avatarurl");
     3/* Returns the avatar URL for local avatar, if exists. */
     4function nstab_get_local_avatarurl($user_id) {
     5    if (!get_user_meta($user_id, "nstab_setting_localavatar", true)) return null;
     6   
     7    $url = get_user_meta($user_id, "nstab_setting_avatarurl", true);
     8    return $url;
    79}
    810
    911
     12/**
     13 * Overrides the avatar data.
     14 * https://developer.wordpress.org/reference/functions/get_avatar_data/
     15 * https://developer.wordpress.org/reference/hooks/get_avatar_data/
     16 */
     17add_filter("get_avatar_data", "nstab_get_avatar_data", 10, 2);
     18function nstab_get_avatar_data($args, $id_or_email) {
     19    $url = nstab_get_local_avatarurl(nstab_get_user_id($id_or_email));
     20    if (!empty($url)) $args["url"] = $url;
     21   
     22    return $args;
     23}
    1024
    11 /* Overrides the avatars */
    12 /* https://codex.wordpress.org/Plugin_API/Filter_Reference/get_avatar */
    13 add_filter("get_avatar", "nstab_get_avatar", 1 , 5);
    14 function nstab_get_avatar($avatar, $id_or_email, $size, $default, $alt) {
    15     $user = false;
    1625
    17     if (is_numeric($id_or_email)) {
    18         $id = (int)$id_or_email;
    19         $user = get_user_by("id", $id);
    20     }
    21     elseif (is_object($id_or_email)) {
    22         if (!empty($id_or_email->user_id)) {
    23             $id = (int)$id_or_email->user_id;
    24             $user = get_user_by("id", $id);
    25         }
    26     }
    27     else {
    28         $user = get_user_by("email", $id_or_email);
    29     }
     26function nstab_get_user_id($id_or_email) {
     27    $user_id = null;
     28   
     29    if (is_numeric($id_or_email)) {
     30        $user_id = (int)$id_or_email;
     31    }
     32    else if (is_string($id_or_email) && ($user = get_user_by("email", $id_or_email))) {
     33        $user_id = $user->ID;
     34    }
     35    else if (is_object($id_or_email) && !empty($id_or_email->user_id)) {
     36        $user_id = (int)$id_or_email->user_id;
     37    }
    3038
    31     if ($user && is_object($user)
    32         && get_the_author_meta("nstab_setting_localavatar", $user->ID) == "on") {
    33             $avatar = get_the_author_meta("nstab_setting_avatarurl", $user->ID);
    34             $avatar = "<img alt='{$alt}' src='{$avatar}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
    35     }
    36 
    37     return $avatar;
     39    return $user_id;
    3840}
    3941
  • author-box-by-nocksoft/trunk/php/settings-defaults.php

    r2394668 r2653204  
    11<?php
    22
    3 /* --- Default settings and fallbacks. Only needed, when setting was added after initial release. --- */
     3/* Global settings: general */
     4$nstab_setting_default_displayauthorboxonposts = true;
     5$nstab_setting_default_displayauthorboxonpages = false;
     6$nstab_setting_default_hidewordpressauthorbox = false;
    47
    5 /* Headline Size */
    6 if (esc_attr(get_option("nstab_setting_fontsizeheadline")) != false) $fontsizeheadline = esc_attr(get_option("nstab_setting_fontsizeheadline"));
    7 else $fontsizeheadline = "1.1";
    8 
    9 /* Position Size */
    10 if (esc_attr(get_option("nstab_setting_fontsizeposition")) != false) $fontsizeposition = esc_attr(get_option("nstab_setting_fontsizeposition"));
    11 else $fontsizeposition = "0.7";
    12 
    13 /* Bio Size */
    14 if (esc_attr(get_option("nstab_setting_fontsizebio")) != false) $fontsizebio = esc_attr(get_option("nstab_setting_fontsizebio"));
    15 else $fontsizebio = "0.9";
    16 
    17 /* Links Size */
    18 if (esc_attr(get_option("nstab_setting_fontsizelinks")) != false) $fontsizelinks = esc_attr(get_option("nstab_setting_fontsizelinks"));
    19 else $fontsizelinks = "0.8";
     8/* Global settings: layout */
     9$nstab_setting_default_font = "arial";
     10$nstab_setting_default_showshadow = false;
     11$nstab_setting_default_showborder = true;
     12$nstab_setting_default_bordercolor = "#EEEEEE";
     13$nstab_setting_default_bordersize = "1";
     14$nstab_setting_default_avatarsize = "100";
     15$nstab_setting_default_circleavatar = false;
     16$nstab_setting_default_headline = __("A Post by", "author-box-by-nocksoft");
     17$nstab_setting_default_fontsizeheadline = "1.1";
     18$nstab_setting_default_fontsizeposition = "0.7";
     19$nstab_setting_default_fontsizebio = "0.9";
     20$nstab_setting_default_fontsizelinks = "0.8";
     21$nstab_setting_default_displayauthorsarchive = false;
    2022
    2123?>
  • author-box-by-nocksoft/trunk/php/settings-global.php

    r2464444 r2653204  
    11<?php
    22
     3add_action("admin_menu", "nstab_settings_page");
    34function nstab_settings_page() {
    45    add_submenu_page(
     
    1112    );
    1213}
    13 add_action("admin_menu", "nstab_settings_page");
    1414
    1515
    1616add_action("admin_init", function() {
    17     register_setting("nstab_settings", "nstab_setting_showborder");
    18     register_setting("nstab_settings", "nstab_setting_avatarsize");
    19     register_setting("nstab_settings", "nstab_setting_circleavatar");
    20     register_setting("nstab_settings", "nstab_setting_headline");
    21     register_setting("nstab_settings", "nstab_setting_fontsizeheadline");
    22     register_setting("nstab_settings", "nstab_setting_fontsizeposition");
    23     register_setting("nstab_settings", "nstab_setting_fontsizebio");
    24     register_setting("nstab_settings", "nstab_setting_fontsizelinks");
    25     register_setting("nstab_settings", "nstab_setting_displayauthorsarchive");
    26     register_setting("nstab_settings", "nstab_setting_displayauthorboxonposts");
    27     register_setting("nstab_settings", "nstab_setting_displayauthorboxonpages");
    28     register_setting("nstab_settings", "nstab_setting_hidewordpressauthorbox");
     17    register_setting("nstab_settings_general", "nstab_setting_displayauthorboxonposts");
     18    register_setting("nstab_settings_general", "nstab_setting_displayauthorboxonpages");
     19    register_setting("nstab_settings_general", "nstab_setting_hidewordpressauthorbox");
     20   
     21    register_setting("nstab_settings_layout", "nstab_setting_font");
     22    register_setting("nstab_settings_layout", "nstab_setting_showshadow");
     23    register_setting("nstab_settings_layout", "nstab_setting_showborder");
     24    register_setting("nstab_settings_layout", "nstab_setting_bordercolor");
     25    register_setting("nstab_settings_layout", "nstab_setting_bordersize");
     26    register_setting("nstab_settings_layout", "nstab_setting_avatarsize");
     27    register_setting("nstab_settings_layout", "nstab_setting_circleavatar");
     28    register_setting("nstab_settings_layout", "nstab_setting_headline");
     29    register_setting("nstab_settings_layout", "nstab_setting_fontsizeheadline");
     30    register_setting("nstab_settings_layout", "nstab_setting_fontsizeposition");
     31    register_setting("nstab_settings_layout", "nstab_setting_fontsizebio");
     32    register_setting("nstab_settings_layout", "nstab_setting_fontsizelinks");
     33    register_setting("nstab_settings_layout", "nstab_setting_displayauthorsarchive");
    2934});
    3035
     
    3439    if (!current_user_can("manage_options")) return;
    3540
    36     require plugin_dir_path(__FILE__) . "settings-defaults.php";
     41    global $nstab_setting_displayauthorboxonposts;
     42    global $nstab_setting_displayauthorboxonpages;
     43    global $nstab_setting_hidewordpressauthorbox;
     44
     45    global $nstab_setting_font;
     46    global $nstab_setting_showshadow;
     47    global $nstab_setting_showborder;
     48    global $nstab_setting_default_bordercolor;
     49    global $nstab_setting_bordercolor;
     50    global $nstab_setting_bordersize;
     51    global $nstab_setting_avatarsize;
     52    global $nstab_setting_circleavatar;
     53    global $nstab_setting_headline;
     54    global $nstab_setting_fontsizeheadline;
     55    global $nstab_setting_fontsizeposition;
     56    global $nstab_setting_fontsizebio;
     57    global $nstab_setting_fontsizelinks;
     58    global $nstab_setting_displayauthorsarchive;
     59   
     60    $tab = isset($_GET["tab"]) ? $_GET["tab"] : null;
    3761    ?>
    3862    <div class="wrap">
    3963        <h1><?= esc_html(get_admin_page_title()); ?></h1>
     64       
     65        <p><?php echo __("User-specific settings are made in your user profile in WordPress (Users -> Your Profile -> Edit). General settings can be made here.", "author-box-by-nocksoft"); ?></p>
     66       
     67        <nav class="nav-tab-wrapper">
     68            <a href="?page=nstab" class="nav-tab<?php if ($tab == "general" || $tab == null) echo " nav-tab-active"; ?>"><?php echo __("General", "author-box-by-nocksoft"); ?></a>
     69            <a href="?page=nstab&tab=layout" class="nav-tab<?php if ($tab == "layout") echo " nav-tab-active"; ?>"><?php echo __("Layout", "author-box-by-nocksoft"); ?></a>
     70        </nav>
     71       
    4072        <form action="options.php" method="post">
    4173            <?php
    42             settings_fields("nstab_settings");
     74            $option_group = null;
     75            if ($tab == "general" || $tab == null) $option_group = "nstab_settings_general";
     76            else if ($tab == "layout") $option_group = "nstab_settings_layout";
     77            else return;
     78            settings_fields($option_group);
    4379            do_settings_sections("nstab");
    4480            ?>
    4581
    46             <p><?php echo __("User-specific settings are made in your author profile in WordPress (Users -> Your Profile). General settings can be made here.", "author-box-by-nocksoft"); ?></p>
    47 
    48             <table class="form-table">
    49             <tr valign="top">
    50                 <th scope="row"><?php echo __("Show Border of Author Box", "author-box-by-nocksoft"); ?></th>
    51                 <td><input type="checkbox" name="nstab_setting_showborder" <?php if (get_option("nstab_setting_showborder", true) == true) echo "checked"; ?> /></td>
    52                 </tr>
    53 
    54                 <tr valign="top">
    55                 <th scope="row"><?php echo __("Size of Avatar (Pixel)", "author-box-by-nocksoft"); ?></th>
    56                 <td><input type="number" name="nstab_setting_avatarsize" min="96" max="200" value="<?php echo esc_attr(get_option("nstab_setting_avatarsize")); ?>" /></td>
    57                 </tr>
    58 
    59                 <tr valign="top">
    60                 <th scope="row"><?php echo __("Use a circle avatar instead of a square", "author-box-by-nocksoft"); ?></th>
    61                 <td><input type="checkbox" name="nstab_setting_circleavatar" <?php if (get_option("nstab_setting_circleavatar") == true) echo "checked"; ?> /></td>
    62                 </tr>
    63 
    64                 <tr valign="top">
    65                 <th scope="row"><?php echo __("Headline", "author-box-by-nocksoft"); ?></th>
    66                 <td><input type="text" name="nstab_setting_headline" placeholder="<?php echo __("e.g. A Post by", "author-box-by-nocksoft"); ?>" value="<?php echo get_option("nstab_setting_headline"); ?>" /></td>
    67                 </tr>
    68 
    69                 <tr valign="top">
    70                 <th scope="row"><?php echo __("Fontsize of Headline (em)", "author-box-by-nocksoft"); ?></th>
    71                 <td><input type="number" name="nstab_setting_fontsizeheadline" min="0.5" max="2" step="0.1" value="<?php echo $fontsizeheadline; ?>" /></td>
    72                 </tr>
    73 
    74                 <tr valign="top">
    75                 <th scope="row"><?php echo __("Fontsize of author's Position (em)", "author-box-by-nocksoft"); ?></th>
    76                 <td><input type="number" name="nstab_setting_fontsizeposition" min="0.4" max="0.9" step="0.1" value="<?php echo $fontsizeposition; ?>" /></td>
    77                 </tr>
    78 
    79                 <tr valign="top">
    80                 <th scope="row"><?php echo __("Fontsize of Biography (em)", "author-box-by-nocksoft"); ?></th>
    81                 <td><input type="number" name="nstab_setting_fontsizebio" min="0.4" max="1.5" step="0.1" value="<?php echo $fontsizebio; ?>" /></td>
    82                 </tr>
    83 
    84                 <tr valign="top">
    85                 <th scope="row"><?php echo __("Fontsize of Links (em)", "author-box-by-nocksoft"); ?></th>
    86                 <td><input type="number" name="nstab_setting_fontsizelinks" min="0.3" max="1" step="0.1" value="<?php echo $fontsizelinks; ?>" /></td>
    87                 </tr>
    88 
    89                 <tr valign="top">
    90                 <th scope="row"><?php echo __("Display a link to the author's archive", "author-box-by-nocksoft"); ?></th>
    91                 <td><input type="checkbox" name="nstab_setting_displayauthorsarchive" <?php if (get_option("nstab_setting_displayauthorsarchive") == true) echo "checked"; ?> /></td>
    92                 </tr>
    93 
    94                 <tr valign="top">
    95                 <th scope="row"><?php echo __("Display Author Box at the end of each post automatically", "author-box-by-nocksoft"); ?></th>
    96                 <td><input type="checkbox" name="nstab_setting_displayauthorboxonposts" <?php if (get_option("nstab_setting_displayauthorboxonposts", true) == true) echo "checked"; ?> /></td>
    97                 </tr>
    98 
    99                 <tr valign="top">
    100                 <th scope="row"><?php echo __("Display Author Box at the end of each page automatically (not on front page, blog homepage and privacy policy)", "author-box-by-nocksoft"); ?></th>
    101                 <td><input type="checkbox" name="nstab_setting_displayauthorboxonpages" <?php if (get_option("nstab_setting_displayauthorboxonpages") == true) echo "checked"; ?> /></td>
    102                 </tr>
    103 
    104                 <tr valign="top">
    105                 <th scope="row"><?php echo __("Hide the author box of default WordPress theme (tested from Twenty Nineteen up to Twenty Twenty-One)", "author-box-by-nocksoft"); ?></th>
    106                 <td><input type="checkbox" name="nstab_setting_hidewordpressauthorbox" <?php if (get_option("nstab_setting_hidewordpressauthorbox") == true) echo "checked"; ?> /></td>
    107                 </tr>
    108             </table>
     82            <div class="tab-content">
     83                <?php
     84                if ($tab == "general" || $tab == null) {
     85                    ?>
     86                    <table class="form-table">
     87                        <tr valign="top">
     88                        <th scope="row"><?php echo __("Author Box display options", "author-box-by-nocksoft"); ?></th>
     89                        <td>
     90                            <input type="checkbox" id="nstab_setting_displayauthorboxonposts" name="nstab_setting_displayauthorboxonposts" <?php if ($nstab_setting_displayauthorboxonposts == true) echo "checked"; ?> />
     91                            <label for="nstab_setting_displayauthorboxonposts"><?php echo __("Display Author Box at the end of each post automatically", "author-box-by-nocksoft"); ?></label>
     92                            <br>
     93                            <input type="checkbox" id="nstab_setting_displayauthorboxonpages" name="nstab_setting_displayauthorboxonpages" <?php if ($nstab_setting_displayauthorboxonpages == true) echo "checked"; ?> />
     94                            <label for="nstab_setting_displayauthorboxonpages"><?php echo __("Display Author Box at the end of each page automatically (not on front page, blog homepage and privacy policy)", "author-box-by-nocksoft"); ?></label>
     95                        </td>
     96                        </tr>
     97
     98                        <tr valign="top">
     99                        <th scope="row"><?php echo __("Other options", "author-box-by-nocksoft"); ?></th>
     100                        <td>
     101                            <input type="checkbox" id="nstab_setting_hidewordpressauthorbox" name="nstab_setting_hidewordpressauthorbox" <?php if ($nstab_setting_hidewordpressauthorbox == true) echo "checked"; ?> />
     102                            <label for="nstab_setting_hidewordpressauthorbox"><?php echo __("Hide the author box of default WordPress theme (tested from Twenty Nineteen up to Twenty Twenty-One)", "author-box-by-nocksoft"); ?></label>
     103                            <p class="description"><?php echo __("If your theme offers you an option to hide the author box of your theme, you should use your theme's setting for this.", "author-box-by-nocksoft"); ?></p>
     104                        </td>
     105                        </tr>
     106                    </table>
     107                    <?php
     108                }
     109                else if ($tab == "layout") {
     110                    ?>
     111                    <table class="form-table">
     112                        <tr valign="top">
     113                        <th scope="row"><?php echo __("Basic", "author-box-by-nocksoft"); ?></th>
     114                        <td>
     115                            <select id="nstab_setting_font" name="nstab_setting_font">
     116                                <option value="arial" <?php if ($nstab_setting_font == "arial") echo "selected"; ?>><?php echo __("Arial", "author-box-by-nocksoft"); ?></option>
     117                                <option value="inherit" <?php if ($nstab_setting_font == "inherit") echo "selected"; ?>><?php echo __("Inherit from website", "author-box-by-nocksoft"); ?></option>
     118                            </select>
     119                            <label for="nstab_setting_font"><?php echo __("Font of Author Box", "author-box-by-nocksoft"); ?></label>
     120                            <p class="description"><?php echo __("Inherit from website means that the fonts of the WordPress theme are used.", "author-box-by-nocksoft"); ?></p>
     121                            <p>
     122                            <input type="checkbox" id="nstab_setting_showshadow" name="nstab_setting_showshadow" <?php if ($nstab_setting_showshadow == true) echo "checked"; ?> />
     123                            <label for="nstab_setting_showshadow"><?php echo __("Show Shadow of Author Box", "author-box-by-nocksoft"); ?></label>
     124                            </p>
     125                        </td>
     126                        </tr>
     127                       
     128                        <tr valign="top">
     129                        <th scope="row"><?php echo __("Border", "author-box-by-nocksoft"); ?></th>
     130                        <td>
     131                            <input type="checkbox" id="nstab_setting_showborder" name="nstab_setting_showborder" <?php if ($nstab_setting_showborder == true) echo "checked"; ?> />
     132                            <label for="nstab_setting_showborder"><?php echo __("Show Border of Author Box", "author-box-by-nocksoft"); ?></label>
     133                            <p>
     134                            <input type="text" id="nstab_setting_bordercolor" name="nstab_setting_bordercolor" class="nstab_colorpicker" value="<?php echo $nstab_setting_bordercolor; ?>" data-default-color="<?php echo $nstab_setting_default_bordercolor; ?>" />
     135                            <label for="nstab_setting_bordercolor"><?php echo __("Color of border", "author-box-by-nocksoft"); ?></label>
     136                            </p>
     137                            <input type="number" id="nstab_setting_bordersize" name="nstab_setting_bordersize" min="1" max="5" step="1" value="<?php echo $nstab_setting_bordersize; ?>" />
     138                            <label for="nstab_setting_bordersize"><?php echo __("Size of border", "author-box-by-nocksoft"); ?></label>
     139                        </td>
     140                        </tr>
     141
     142                        <tr valign="top">
     143                        <th scope="row"><?php echo __("Avatar", "author-box-by-nocksoft"); ?></th>
     144                        <td>
     145                            <input type="number" id="nstab_setting_avatarsize" name="nstab_setting_avatarsize" min="96" max="200" value="<?php echo $nstab_setting_avatarsize; ?>" />
     146                            <label for="nstab_setting_avatarsize"><?php echo __("Size of Avatar (Pixel)", "author-box-by-nocksoft"); ?></label>
     147                            <p>
     148                            <input type="checkbox" id="nstab_setting_circleavatar" name="nstab_setting_circleavatar" <?php if ($nstab_setting_circleavatar == true) echo "checked"; ?> />
     149                            <label for="nstab_setting_circleavatar"><?php echo __("Use a circle avatar instead of a square", "author-box-by-nocksoft"); ?></label>
     150                            </p>
     151                        </td>
     152                        </tr>
     153
     154                        <tr valign="top">
     155                        <th scope="row"><?php echo __("Header", "author-box-by-nocksoft"); ?></th>
     156                        <td>
     157                            <input type="text" id="nstab_setting_headline" name="nstab_setting_headline" placeholder="<?php echo __("e.g. A Post by", "author-box-by-nocksoft"); ?>" value="<?php echo $nstab_setting_headline; ?>" />
     158                            <label for="nstab_setting_headline"><?php echo __("Headline", "author-box-by-nocksoft"); ?></label>
     159                            <p>
     160                            <input type="number" id="nstab_setting_fontsizeheadline" name="nstab_setting_fontsizeheadline" min="0.5" max="2" step="0.1" value="<?php echo $nstab_setting_fontsizeheadline; ?>" />
     161                            <label for="nstab_setting_fontsizeheadline"><?php echo __("Fontsize of Headline (em)", "author-box-by-nocksoft"); ?></label>
     162                            </p>
     163                            <p>
     164                            <input type="number" id="nstab_setting_fontsizeposition" name="nstab_setting_fontsizeposition" min="0.4" max="0.9" step="0.1" value="<?php echo $nstab_setting_fontsizeposition; ?>" />
     165                            <label for="nstab_setting_fontsizeposition"><?php echo __("Fontsize of author's Position (em)", "author-box-by-nocksoft"); ?></label>
     166                            </p>
     167                        </td>
     168                        </tr>
     169
     170                        <tr valign="top">
     171                        <th scope="row"><?php echo __("Biography", "author-box-by-nocksoft"); ?></th>
     172                        <td>
     173                            <input type="number" id="nstab_setting_fontsizebio" name="nstab_setting_fontsizebio" min="0.4" max="1.5" step="0.1" value="<?php echo $nstab_setting_fontsizebio; ?>" />
     174                            <label for="nstab_setting_fontsizebio"><?php echo __("Fontsize of Biography (em)", "author-box-by-nocksoft"); ?></label>
     175                        </td>
     176                        </tr>
     177
     178                        <tr valign="top">
     179                        <th scope="row"><?php echo __("Footer", "author-box-by-nocksoft"); ?></th>
     180                        <td>
     181                            <input type="number" id="nstab_setting_fontsizelinks" name="nstab_setting_fontsizelinks" min="0.3" max="1" step="0.1" value="<?php echo $nstab_setting_fontsizelinks; ?>" />
     182                            <label for="nstab_setting_fontsizelinks"><?php echo __("Fontsize of Links (em)", "author-box-by-nocksoft"); ?></label>
     183                            <p>
     184                            <input type="checkbox" id="nstab_setting_displayauthorsarchive" name="nstab_setting_displayauthorsarchive" <?php if ($nstab_setting_displayauthorsarchive == true) echo "checked"; ?> />
     185                            <label for="nstab_setting_displayauthorsarchive"><?php echo __("Display a link to the author's archive", "author-box-by-nocksoft"); ?></label>
     186                            </p>
     187                        </td>
     188                        </tr>
     189                    </table>
     190                    <?php
     191                }
     192            ?>
     193            </div>
    109194
    110195
  • author-box-by-nocksoft/trunk/php/settings-user.php

    r2394668 r2653204  
    55add_action("show_user_profile", "nstab_usersettings");
    66add_action("edit_user_profile", "nstab_usersettings");
    7 
    87function nstab_usersettings($user) {
    98    ?>
     
    5756add_action("personal_options_update", "nstab_save_usersettings");
    5857add_action("edit_user_profile_update", "nstab_save_usersettings");
    59 
    6058function nstab_save_usersettings($user_id) {
    6159    if (!current_user_can("edit_user", $user_id)) {
     
    6361    }
    6462    else {
    65         update_usermeta($user_id, "nstab_setting_localavatar", $_POST["nstab_setting_localavatar"]);
     63        $nstab_setting_localavatar = isset($_POST["nstab_setting_localavatar"]) ? $_POST["nstab_setting_localavatar"] : false;
     64        update_usermeta($user_id, "nstab_setting_localavatar", $nstab_setting_localavatar);
    6665        update_usermeta($user_id, "nstab_setting_avatarurl", trim($_POST["nstab_setting_avatarurl"]));
    6766        update_usermeta($user_id, "nstab_setting_authorposition", trim($_POST["nstab_setting_authorposition"]));
  • author-box-by-nocksoft/trunk/php/setup.php

    r2464444 r2653204  
    22
    33function nstab_activate_plugin() {
    4     /* Default settings */
    5     add_option("nstab_setting_showborder", "on");
    6     add_option("nstab_setting_avatarsize", "100");
    7     add_option("nstab_setting_circleavatar", "");
    8     add_option("nstab_setting_headline", __("A Post by", "author-box-by-nocksoft"));
    9     add_option("nstab_setting_fontsizeheadline", "1.1");
    10     add_option("nstab_setting_fontsizeposition", "0.7");
    11     add_option("nstab_setting_fontsizebio", "0.9");
    12     add_option("nstab_setting_fontsizelinks", "0.8");
    13     add_option("nstab_setting_displayauthorsarchive", "");
    14     add_option("nstab_setting_displayauthorboxonposts", "on");
    15     add_option("nstab_setting_displayauthorboxonpages", "");
    16     add_option("nstab_setting_hidewordpressauthorbox", "");
     4    require plugin_dir_path(__FILE__) . "settings-defaults.php";
     5   
     6    add_option("nstab_setting_displayauthorboxonposts", $nstab_setting_default_displayauthorboxonposts);
     7    add_option("nstab_setting_displayauthorboxonpages", $nstab_setting_default_displayauthorboxonpages);
     8    add_option("nstab_setting_hidewordpressauthorbox", $nstab_setting_default_hidewordpressauthorbox);
     9   
     10    add_option("nstab_setting_font", $nstab_setting_default_font);
     11    add_option("nstab_setting_showshadow", $nstab_setting_default_showshadow);
     12    add_option("nstab_setting_showborder", $nstab_setting_default_showborder);
     13    add_option("nstab_setting_bordercolor", $nstab_setting_default_bordercolor);
     14    add_option("nstab_setting_bordersize", $nstab_setting_default_bordersize);
     15    add_option("nstab_setting_avatarsize", $nstab_setting_default_avatarsize);
     16    add_option("nstab_setting_circleavatar", $nstab_setting_default_circleavatar);
     17    add_option("nstab_setting_headline", $nstab_setting_default_headline);
     18    add_option("nstab_setting_fontsizeheadline", $nstab_setting_default_fontsizeheadline);
     19    add_option("nstab_setting_fontsizeposition", $nstab_setting_default_fontsizeposition);
     20    add_option("nstab_setting_fontsizebio", $nstab_setting_default_fontsizebio);
     21    add_option("nstab_setting_fontsizelinks", $nstab_setting_default_fontsizelinks);
     22    add_option("nstab_setting_displayauthorsarchive", $nstab_setting_default_displayauthorsarchive);
    1723}
    1824
     25/* https://developer.wordpress.org/plugins/plugin-basics/uninstall-methods/ */
    1926function nstab_uninstall_plugin() {
    20     /* Clear global settings */
     27    if (!defined("WP_UNINSTALL_PLUGIN")) {
     28        die;
     29    }
     30   
     31    delete_option("nstab_setting_displayauthorboxonposts");
     32    delete_option("nstab_setting_displayauthorboxonpages");
     33    delete_option("nstab_setting_hidewordpressauthorbox");
     34   
     35    delete_option("nstab_setting_font");
     36    delete_option("nstab_setting_showshadow");
    2137    delete_option("nstab_setting_showborder");
     38    delete_option("nstab_setting_bordercolor");
     39    delete_option("nstab_setting_bordersize");
    2240    delete_option("nstab_setting_avatarsize");
    2341    delete_option("nstab_setting_circleavatar");
     
    2846    delete_option("nstab_setting_fontsizelinks");
    2947    delete_option("nstab_setting_displayauthorsarchive");
    30     delete_option("nstab_setting_displayauthorboxonposts");
    31     delete_option("nstab_setting_displayauthorboxonpages");
    32     delete_option("nstab_setting_hidewordpressauthorbox");
    3348
    3449    /* Clear user settings */
  • author-box-by-nocksoft/trunk/readme.txt

    r2464444 r2653204  
    33Tags: author box, author bio, author description, local avatars, about author, about me, author profile, author
    44Stable tag: trunk
    5 Requires at least: 4.9
    6 Tested up to: 5.6
     5Requires at least: 5.3
     6Tested up to: 5.9
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1616
    1717== Features ==
    18 * Adds a simple lightweight Author Box at the end of your posts with a short description about the author
     18* Adds a simple lightweight Author Box at the end of your posts and/or pages with a short description about the author
    1919* Adds support for local avatars for authors so that you dont need to use an Gravatar account
    2020* Option for displaying a link to an own "About Me Page" in Author Box for post authors
     
    7373== Changelog ==
    7474
     75= 1.0.5 =
     76* Fixed a bug that may caused local avatars do not work properly in some cases
     77* Fixed a PHP error while saving user specific settings
     78* General settings page separated in tabs
     79* Added option to inherit font from theme
     80* Added option to display shadow of Author Box
     81* Added option to to adjust border size and border color of Author Box
     82
    7583= 1.0.4 =
    7684* Fixed PHP warnings for PHP 8
Note: See TracChangeset for help on using the changeset viewer.