initial commit master
authordanix <danix@danix.xyz>
Wed, 4 Jul 2018 16:03:21 +0000 (18:03 +0200)
committerdanix <danix@danix.xyz>
Wed, 4 Jul 2018 16:03:21 +0000 (18:03 +0200)
danixland-user-panel.php [new file with mode: 0644]
danixland-user-panel.pot [new file with mode: 0644]
include/options-register.php [new file with mode: 0644]
include/plugin-options.php [new file with mode: 0644]
languages/dnxup-az_AZ.mo [new file with mode: 0644]
languages/dnxup-it_IT.mo [new file with mode: 0644]
languages/it_IT.po [new file with mode: 0644]
readme.txt [new file with mode: 0644]

diff --git a/danixland-user-panel.php b/danixland-user-panel.php
new file mode 100644 (file)
index 0000000..aded94a
--- /dev/null
@@ -0,0 +1,378 @@
+<?php\r
+/*\r
+Plugin Name: danixland User Panel\r
+Plugin URI: http://danixland.net/blog/2010/603-danixland-user-panel-plugin/\r
+Description: A modified version of the meta widget which gives more info about the user.\r
+Version: 1.4.2\r
+Author: Danilo 'danix' Macri\r
+Author URI: http://danixland.net\r
+Text Domain: dnxup\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+*/\r
+\r
+/**************************************************************************************\r
+Since Version 1.1.1 this plugin uses some code and inspiration from the sidebar-login\r
+plugin by Mike Jolley < http://blue-anvil.com > < http://mikejolley.com >\r
+big kudos to him!!!\r
+**************************************************************************************/\r
+\r
+/**\r
+ * Add plugin i18n domain: dnxup\r
+ * @since 1.1.1\r
+ */\r
+load_plugin_textdomain('dnxup', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');\r
+\r
+/**\r
+ * Include settings options for our plugin\r
+ * @since 1.1.1\r
+ */\r
+function dnxup_settings() {\r
+       add_options_page('danixland User Panel Settings', __('User Panel Options', 'dnxup'), 'manage_options', 'dnxup_options', 'dnxup_settings_display');\r
+}\r
+add_action('admin_menu', 'dnxup_settings' );\r
+\r
+/**\r
+ * The function that outputs our admin page\r
+ * @since 1.1.1\r
+ */\r
+function dnxup_settings_display() {\r
+?>\r
+       <div class="wrap">\r
+               <h2><?php _e('danixland User Panel Settings', 'dnxup') ?></h2>\r
+               <form method="post" action="options.php">\r
+                       <?php\r
+                               settings_fields('dnxup_options');\r
+                               do_settings_sections('dnxup_settings_sections');\r
+                       ?>\r
+                       <p class="submit">\r
+                               <input name="dnxup_options[submit]" type="submit" class="button-primary" value="<?php esc_attr_e('Save Changes', 'dnxup') ?>" />\r
+                               <input name="dnxup_options[reset]" type="submit" class="button-secondary" value="<?php esc_attr_e('Reset Defaults', 'dnxup'); ?>" />\r
+                       </p>\r
+               </form>\r
+       </div>\r
+<?php\r
+}\r
+\r
+/**\r
+ * Settings API options initilization and validation\r
+ * @since 1.1.1\r
+ */\r
+function dnxup_register_options() {\r
+       require( dirname( __FILE__ ) . '/include/options-register.php' );\r
+}\r
+add_action('admin_init', 'dnxup_register_options');\r
+\r
+/**\r
+ * DataBase initilization and update procedure\r
+ * @since 1.1.2\r
+ */\r
+\r
+// helper function that returns DB defaults\r
+function dnxup_db_defaults() {\r
+       $defaults = array(\r
+               'show_gravatar' => true,\r
+               'logged_out_heading' => 'Howdy Guest',\r
+               'logged_in_heading' => 'Howdy %username%',\r
+               'logged_in_links' => "<a href=\"" . admin_url() . "\">" . __('Dashboard','dnxup') . "</a>\n<a href=\"" . admin_url('profile.php') . "\">" . __('Profile','dnxup') . "</a>",\r
+               // database version\r
+               'dnxup_DB_VERSION' => '1'\r
+       );\r
+       return $defaults;\r
+}\r
+\r
+// helper function that starts up the DB\r
+function dnxup_db_init() {\r
+       global $dnxup_options;\r
+       $dnxup_options = get_option('dnxup_options');\r
+       if( false === $dnxup_options ) {\r
+               $dnxup_options = dnxup_db_defaults();\r
+       }\r
+       update_option('dnxup_options', $dnxup_options);\r
+}\r
+\r
+// helper function that performs a DB version update when needed\r
+function dnxup_db_update($db_version) {\r
+       global $dnxup_options;\r
+       $db_defaults = dnxup_db_defaults();\r
+       $merge = wp_parse_args( $dnxup_options, $db_defaults );\r
+       // update DB version\r
+       $merge['dnxup_DB_VERSION'] = $db_version;\r
+       update_option('dnxup_options', $merge);\r
+}\r
+\r
+// helper function that performs a DB check and then an init/update action\r
+function dnxup_db_check() {\r
+       global $dnxup_options;\r
+       if(false === $dnxup_options) {\r
+               dnxup_db_init();\r
+       }\r
+       $old_db_version = $dnxup_options['dnxup_DB_VERSION'];\r
+       $new_db_version = DNXUP_CURRENT_DB_VERSION;\r
+       if(empty($old_db_version)) {\r
+               dnxup_db_init();\r
+       }\r
+       if( intval($old_db_version) < intval($new_db_version) ) {\r
+               dnxup_db_update( $new_db_version );\r
+       }\r
+}\r
+function dnxup_set_db_version() {\r
+       // Define plugin database version. This should only change when new settings are added.\r
+       if ( ! defined( 'DNXUP_CURRENT_DB_VERSION' ) ) {\r
+               define( 'DNXUP_CURRENT_DB_VERSION', 2 );\r
+       }\r
+}\r
+/**\r
+ * Add function on plugin activation that'll set our DB version and perform a check for update\r
+ * @since 1.1.3\r
+ */\r
+register_activation_hook( __FILE__, 'dnxup_set_db_version' );\r
+register_activation_hook( __FILE__, 'dnxup_db_check' );\r
+\r
+\r
+/**\r
+ * function that returns the actual url for redirection after logout\r
+ * as seen on sidebar-login by Mike Jolley with small modifications\r
+ * @since 1.1.3\r
+ */\r
+function dnxup_current_url($url = '') {\r
+\r
+       global $wpdb, $post, $cat, $tag, $author, $year, $monthnum, $day, $wp_query;\r
+       $pageURL = "";\r
+\r
+       if ( is_home() && $wp_query->is_posts_page==1)\r
+       {\r
+               $pageURL = get_permalink(get_option('page_for_posts'));\r
+       }\r
+       elseif (is_home() || is_front_page())\r
+       {\r
+               $pageURL = get_bloginfo('url');\r
+       }\r
+       elseif (is_post_type_archive())\r
+       {\r
+               $pageURL = get_post_type_archive_link( get_query_var('post_type') );\r
+       }\r
+       elseif (is_single() || is_page())\r
+       {\r
+               $pageURL = get_permalink($wp_query->post->ID);\r
+       }\r
+       elseif (is_category())\r
+       {\r
+               $pageURL = get_category_link($cat);\r
+       }\r
+       elseif (is_tag())\r
+       {\r
+               $tag_id = $wpdb->get_var("SELECT ".$wpdb->terms.".term_id FROM $wpdb->term_taxonomy\r
+                       LEFT JOIN $wpdb->terms\r
+                       ON (".$wpdb->term_taxonomy.".term_id = ".$wpdb->terms.".term_id)\r
+                       WHERE ".$wpdb->terms.".slug = '$tag'\r
+                       AND ".$wpdb->term_taxonomy.".taxonomy = 'post_tag' LIMIT 1");\r
+               $pageURL = get_tag_link($tag_id);\r
+       }\r
+       elseif (is_author())\r
+       {\r
+               $pageURL = get_author_posts_url($author);\r
+       }\r
+       elseif (is_date())\r
+       {\r
+\r
+               if ($day)\r
+               {\r
+                       $pageURL = get_day_link( $year,  $monthnum,  $day);\r
+               }\r
+               elseif ($monthnum)\r
+               {\r
+                       $pageURL = get_month_link( $year,  $monthnum,  $day);\r
+               }\r
+               elseif ($year)\r
+               {\r
+                       $pageURL = get_year_link( $year,  $monthnum,  $day);\r
+               }\r
+\r
+       }\r
+       elseif (is_search())\r
+       {\r
+               $pageURL = get_bloginfo('wpurl');\r
+               if ("/" != substr($pageURL, -1)) $pageURL = $pageURL . "/";\r
+               $pageURL .= '?s='.stripslashes(strip_tags($_REQUEST['s'])).'';\r
+       }\r
+\r
+       if (!$pageURL || $pageURL=="" || !is_string($pageURL)) {\r
+               $pageURL = "";\r
+               $pageURL = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';\r
+\r
+               if ($_SERVER["SERVER_PORT"] != "80") {\r
+                       $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];\r
+               } else {\r
+                       $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];\r
+               }\r
+\r
+               //————–added by mick\r
+               if (!strstr(get_bloginfo('url'),'www.')) $pageURL = str_replace('www.','', $pageURL );\r
+               //——————–\r
+       }\r
+       if ($pageURL && !is_search()) if ("/" != substr($pageURL, -1)) $pageURL = $pageURL . "/";\r
+\r
+\r
+       return $pageURL;\r
+}\r
+\r
+/**\r
+ * Add function to widgets_init that'll load our widget.\r
+ * @since 0.1\r
+ */\r
+add_action( 'widgets_init', 'danixland_user_panel' );\r
+\r
+/**\r
+ * Register our widget.\r
+ * 'User_Panel' is the widget class used below.\r
+ *\r
+ * @since 0.1\r
+ */\r
+function danixland_user_panel() {\r
+       register_widget( 'User_Panel' );\r
+}\r
+\r
+/**\r
+ * User_Panel class.\r
+ * This class handles everything that needs to be handled with the widget:\r
+ * the settings, form, display, and update.  Nice!\r
+ *\r
+ * @since 0.1\r
+ */\r
+class User_Panel extends WP_Widget {\r
+\r
+       /**\r
+        * Widget setup.\r
+        */\r
+       function __construct() {\r
+               parent::__construct(\r
+                       'dnx-user-panel', // id_base\r
+                       __('danixland User Panel', 'dnxup' ), // Name\r
+                       array( 'description' => __('An improved version of the meta widget', 'dnxup') )\r
+               );\r
+       }\r
+\r
+       /**\r
+        * How to display the widget on the public side of the site.\r
+        */\r
+       public function widget( $args, $instance ) {\r
+               extract( $args );\r
+               global $user_ID, $current_user;\r
+               $dnxup_options = get_option('dnxup_options');\r
+               extract( $dnxup_options );\r
+\r
+               // Let's use our title\r
+               if($user_ID != '') { // if user is logged in let's greet him good\r
+                       $current_user = wp_get_current_user();\r
+                       if( '' != $logged_in_heading ) {\r
+                               $title = apply_filters('widget_title', str_replace('%username%',ucwords($current_user->display_name),$logged_in_heading));\r
+                       } else {\r
+                               $title = false;\r
+                       }\r
+               } else { // user is not logged in, let's treat him as a guest\r
+                       if( '' != $logged_out_heading ) {\r
+                               $title = apply_filters('widget_title', str_replace('%username%',ucwords($current_user->display_name),$logged_out_heading));\r
+                       } else {\r
+                               $title = false;\r
+                       }\r
+               }\r
+\r
+\r
+               /* Before widget (defined by themes). */\r
+               echo $before_widget;\r
+\r
+               /* Display the widget title if one was input (before and after defined by themes). */\r
+               if ( $title )\r
+                       echo $before_title . $title . $after_title;\r
+\r
+               /**\r
+                * if user is logged in to your site\r
+                * @since 0.8\r
+               */\r
+               if( $user_ID != '' ) {\r
+                       /* If show_gravatar was selected, show the User's Gravatar. */\r
+                       if ( $show_gravatar ) {\r
+                               echo get_avatar($user_ID, 75);\r
+                       }\r
+                       echo '<ul id="dnxup_login_links" class="user_logged_in">';\r
+                       echo '<li id="dashboard"><a href="' . get_bloginfo('url') . '/wp-admin/">' . __('Dashboard', 'dnxup') . '</a></li>';\r
+                       echo '<li id="profile"><a href="' . get_bloginfo('url') . '/wp-admin/profile.php">' . __('Profile and personal options', 'dnxup') . '</a></li>';\r
+\r
+                       /**\r
+                       * custom links functionality\r
+                       * @since 1.1.4\r
+                       */\r
+                       $links = do_shortcode(trim($logged_in_links));\r
+                       $links = explode("\n", $links);\r
+                       if (sizeof($links)>0) {\r
+                               foreach ($links as $l) {\r
+                                       $l = trim($l);\r
+                                       if (!empty($l)) {\r
+                                               $link = explode('|',$l);\r
+                                               if (isset($link[1])) {\r
+                                                       $cap = strtolower(trim($link[1]));\r
+                                                       if ($cap=='true') {\r
+                                                               if (!current_user_can( 'manage_options' )) continue;\r
+                                                       } else {\r
+                                                               if (!current_user_can( $cap )) continue;\r
+                                                       }\r
+                                               }\r
+                                               // Parse %USERNAME%\r
+                                               $link[0] = str_replace('%USERNAME%',$current_user->user_login,$link[0]);\r
+                                               $link[0] = str_replace('%username%',$current_user->user_login,$link[0]);\r
+                                               // Parse %USERID%\r
+                                               $link[0] = str_replace('%USERID%',$current_user->ID,$link[0]);\r
+                                               $link[0] = str_replace('%userid%',$current_user->ID,$link[0]);\r
+                                               echo '<li class="dnxup_custom_link">'.$link[0].'</li>';\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       echo('<li id="logout"><a href="' . wp_logout_url( dnxup_current_url() ) . '">' . __('Exit', 'dnxup') . '</a></li>');\r
+                       echo '</ul>';\r
+               /**\r
+                * else if user is logged out and registration is disabled\r
+                * @since 0.8\r
+               */\r
+               } else {\r
+                       if( ! get_option('users_can_register') ) {\r
+                               echo '<ul id="dnxup_login_links" class="logged_out_noreg">';\r
+                               echo '<li id="login"><a href="' . wp_login_url( dnxup_current_url() ) . '">' . __('Login', 'dnxup') . '</a></li>';\r
+                               echo '<li id="lostpassword"><a href="' . wp_lostpassword_url( dnxup_current_url() ) . '">' . __('Forgot your password?', 'dnxup') . '</a></li>';\r
+                               echo '</ul>';\r
+                       /**\r
+                       * or if user is still logged out but user registration is enabled\r
+                       * @since 0.9\r
+                       */\r
+                       } else {\r
+                               echo '<ul id="dnxup_login_links" class="logged_out_yesreg">';\r
+                               echo '<li id="register"><a href="' . get_option('siteurl') . '/wp-register.php">' . __('Register', 'dnxup') . '</a></li>';\r
+                               echo '<li id="login"><a href="' . wp_login_url( dnxup_current_url() ) . '">' . __('Login', 'dnxup') . '</a></li>';\r
+                               echo '<li id="lostpassword"><a href="' . wp_lostpassword_url( dnxup_current_url() ) . '">' . __('Forgot your password?', 'dnxup') . '</a></li>';\r
+                               echo '</ul>';\r
+                       }\r
+               }\r
+               /* After widget (defined by themes). */\r
+               echo $after_widget;\r
+       }\r
+\r
+       /**\r
+        * Displays just a quick notice with a link to the Settings page\r
+        */\r
+       public function form( $instance ) {\r
+               ?>\r
+\r
+               <!-- No settings here, -->\r
+               <p>\r
+                       <?php echo sprintf( __('Nothing to set here, already had a look at the <a href="%1$s">Settings Page</a>?', 'dnxup'),\r
+                               admin_url('options-general.php?page=dnxup_options')\r
+                               ); ?>\r
+               </p>\r
+       <?php\r
+       }\r
+}\r
+\r
+?>\r
diff --git a/danixland-user-panel.pot b/danixland-user-panel.pot
new file mode 100644 (file)
index 0000000..2c26aa9
--- /dev/null
@@ -0,0 +1,135 @@
+# Copyright (C) 2015 danixland User Panel
+# This file is distributed under the same license as the danixland User Panel package.
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: danixland User Panel\n"
+"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/danixland-user-"
+"panel\n"
+"POT-Creation-Date: 2016-02-08 14:31+0100\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"PO-Revision-Date: 2016-02-08 14:09+0100\n"
+"Language-Team: \n"
+"X-Generator: Poedit 1.8.6\n"
+"Last-Translator: danix <danix@danixland.net>\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-KeywordsList: __;_e;_n;_x;_ex\n"
+"X-Poedit-SearchPath-0: .\n"
+
+#: danixland-user-panel.php:33
+msgid "User Panel Options"
+msgstr ""
+
+#: danixland-user-panel.php:44
+msgid "danixland User Panel Settings"
+msgstr ""
+
+#: danixland-user-panel.php:79 danixland-user-panel.php:301
+#: include/plugin-options.php:89
+msgid "Dashboard"
+msgstr ""
+
+#: danixland-user-panel.php:79 include/plugin-options.php:89
+msgid "Profile"
+msgstr ""
+
+#: danixland-user-panel.php:253
+msgid "danixland User Panel"
+msgstr ""
+
+#: danixland-user-panel.php:254
+msgid "An improved version of the meta widget"
+msgstr ""
+
+#: danixland-user-panel.php:302
+msgid "Profile and personal options"
+msgstr ""
+
+#: danixland-user-panel.php:334
+msgid "Exit"
+msgstr ""
+
+#: danixland-user-panel.php:343 danixland-user-panel.php:353
+msgid "Login"
+msgstr ""
+
+#: danixland-user-panel.php:344 danixland-user-panel.php:354
+msgid "Forgot your password?"
+msgstr ""
+
+#: danixland-user-panel.php:352
+msgid "Register"
+msgstr ""
+
+#: danixland-user-panel.php:370
+#, php-format
+msgid ""
+"Nothing to set here, already had a look at the <a href=\"%1$s\">Settings "
+"Page</a>?"
+msgstr ""
+
+#: include/plugin-options.php:6
+msgid "Gravatar setting"
+msgstr ""
+
+#: include/plugin-options.php:9 include/plugin-options.php:25
+msgid "Logged out Heading"
+msgstr ""
+
+#: include/plugin-options.php:12 include/plugin-options.php:28
+msgid "Logged in Heading"
+msgstr ""
+
+#: include/plugin-options.php:15 include/plugin-options.php:31
+msgid "Logged in Custom Links"
+msgstr ""
+
+#: include/plugin-options.php:22
+msgid "Display Gravatar?"
+msgstr ""
+
+#: include/plugin-options.php:39
+msgid "Select this if you want to display the Gravatar image on the widget"
+msgstr ""
+
+#: include/plugin-options.php:44
+msgid "Heading for widget when user is logged out."
+msgstr ""
+
+#: include/plugin-options.php:49
+msgid "Heading for widget when user is logged in."
+msgstr ""
+
+#: include/plugin-options.php:54
+msgid "Custom Links to display when user is logged in."
+msgstr ""
+
+#: include/plugin-options.php:65
+msgid "Select this to display the Gravatar image for the current user"
+msgstr ""
+
+#: include/plugin-options.php:72
+msgid ""
+"This is the heading your users will see when they're not logged in to your "
+"site"
+msgstr ""
+
+#: include/plugin-options.php:79
+msgid ""
+"This is the heading your users will see when they're logged in. <code>"
+"%username%</code> shows username."
+msgstr ""
+
+#: include/plugin-options.php:88
+msgid ""
+"<strong>One link per line</strong>. Note: Logout link will always show "
+"regardless. Tip: Add <code>|true</code> after a link to only show it to "
+"admin users or alternatively use a <code>|user_capability</code> and the "
+"link will only be shown to users with that capability. See <a href='http://"
+"codex.wordpress.org/Roles_and_Capabilities' target='_blank'>http://codex."
+"wordpress.org/Roles_and_Capabilities</a> for more info on roles and "
+"Capabilities.<br/> You can also type <code>%USERNAME%</code> and <code>"
+"%USERID%</code> which will be replaced by the user info.<br />Example:"
+msgstr ""
diff --git a/include/options-register.php b/include/options-register.php
new file mode 100644 (file)
index 0000000..506a17b
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+
+/**
+ * Register the set of options required for the plugin to work
+ * @since 1.1.1
+ */
+register_setting( 'dnxup_options', 'dnxup_options', 'dnxup_setup_validate' );
+
+// include the file with the actual markup for the options to display
+require( dirname( __FILE__ ) . '/plugin-options.php' );
+
+
+function dnxup_setup_validate($input) {
+
+       $dnxup_options = get_option('dnxup_options');
+       $valid_input = $dnxup_options;
+       
+       $submit = ( ! empty( $input['submit'] ) ? true : false );
+       $reset = ( ! empty( $input['reset'] ) ? true : false );
+
+       if($submit) {
+               $default_options = dnxup_db_defaults();
+               // Show Gravatar
+               $valid_input['show_gravatar'] = ( true == $input['show_gravatar'] ? true : false );
+               // Logged out Heading
+               $valid_input['logged_out_heading'] = ( '' == $input['logged_out_heading'] ? '' : wp_filter_nohtml_kses($input['logged_out_heading']) );
+               // Logged in Heading
+               $valid_input['logged_in_heading'] = ( '' == $input['logged_in_heading'] ? '' : wp_filter_nohtml_kses($input['logged_in_heading']) );
+               // Logged in Links
+               $valid_data = array(
+                       'a' => array(
+                               'href' => array(),
+                               'title' => array(),
+                               'class' => array(),
+                               'id' => array()
+                       )
+               );
+               $valid_input['logged_in_links'] = ('' == $input['logged_in_links'] ? '' : wp_kses($input['logged_in_links'], $valid_data) );
+       } elseif($reset) {
+               $default_options = dnxup_db_defaults();
+               // Show Gravatar
+               $valid_input['show_gravatar'] = $default_options['show_gravatar'];
+               // Logged out Heading
+               $valid_input['logged_out_heading'] = $default_options['logged_out_heading'];
+               // Logged in Heading
+               $valid_input['logged_in_heading'] = $default_options['logged_in_heading'];
+               // Logged in Links
+               $valid_input['logged_in_links'] = $default_options['logged_in_links'];
+       }
+       return $valid_input;
+}
+?>
\ No newline at end of file
diff --git a/include/plugin-options.php b/include/plugin-options.php
new file mode 100644 (file)
index 0000000..2635375
--- /dev/null
@@ -0,0 +1,94 @@
+<?php
+/*****************************************************************************************
+* Settings Sections
+*******************************************************************************************/
+// Add a form section for the Gravatar Display
+add_settings_section('dnxup_settings_gravatar_display', __('Gravatar setting', 'dnxup'), 'dnxup_settings_gravatar_section_text', 'dnxup_settings_sections');
+
+// Add a form section for the Logged out Heading
+add_settings_section('dnxup_settings_log_out_heading_display', __('Logged out Heading', 'dnxup'), 'dnxup_settings_log_out_heading_section_text', 'dnxup_settings_sections');
+
+// Add a form section for the Logged in Heading
+add_settings_section('dnxup_settings_log_in_heading_display', __('Logged in Heading', 'dnxup'), 'dnxup_settings_log_in_heading_section_text', 'dnxup_settings_sections');
+
+// Add a form section for the Logged in Custom Links
+add_settings_section('dnxup_settings_log_in_custom_links_display', __('Logged in Custom Links', 'dnxup'), 'dnxup_settings_log_in_custom_links_section_text', 'dnxup_settings_sections');
+
+
+/*****************************************************************************************
+* Settings Fields
+*******************************************************************************************/
+// Add Gravatar Display field to his section
+add_settings_field('dnxup_setting_gravatar_display', __('Display Gravatar?', 'dnxup'), 'dnxup_setting_gravatar_display', 'dnxup_settings_sections', 'dnxup_settings_gravatar_display');
+
+// Add Logged out Heading field to his section
+add_settings_field('dnxup_setting_log_out_heading_display', __('Logged out Heading', 'dnxup'), 'dnxup_setting_log_out_heading_display', 'dnxup_settings_sections', 'dnxup_settings_log_out_heading_display');
+
+// Add Logged in Heading field to his section
+add_settings_field('dnxup_setting_log_in_heading_display', __('Logged in Heading', 'dnxup'), 'dnxup_setting_log_in_heading_display', 'dnxup_settings_sections', 'dnxup_settings_log_in_heading_display');
+
+// Add Logged in Heading field to his section
+add_settings_field('dnxup_setting_log_in_custom_links_display', __('Logged in Custom Links', 'dnxup'), 'dnxup_setting_log_in_custom_links_display', 'dnxup_settings_sections', 'dnxup_settings_log_in_custom_links_display');
+
+
+/*****************************************************************************************
+* Fields text
+*******************************************************************************************/
+// Gravatar Display Section
+function dnxup_settings_gravatar_section_text() { ?>
+<p><?php _e( 'Select this if you want to display the Gravatar image on the widget', 'dnxup' ); ?></p>
+<?php }
+
+// Logged out Heading Display Section
+function dnxup_settings_log_out_heading_section_text() { ?>
+<p><?php _e( 'Heading for widget when user is logged out.', 'dnxup' ); ?></p>
+<?php }
+
+// Logged in Heading Display Section
+function dnxup_settings_log_in_heading_section_text() { ?>
+<p><?php _e( 'Heading for widget when user is logged in.', 'dnxup' ); ?></p>
+<?php }
+
+// Logged in Custom Links Display Section
+function dnxup_settings_log_in_custom_links_section_text() { ?>
+<p><?php _e( 'Custom Links to display when user is logged in.', 'dnxup' ); ?></p>
+<?php }
+
+
+/*****************************************************************************************
+* Form display functions
+*******************************************************************************************/
+// Display Gravatar??
+function dnxup_setting_gravatar_display() {
+$dnxup_options = get_option( 'dnxup_options' ); ?>
+<input type="checkbox" name="dnxup_options[show_gravatar]" <?php checked( $dnxup_options['show_gravatar'] ); ?> />
+<span class="description"><?php _e('Select this to display the Gravatar image for the current user', 'dnxup'); ?></span>
+<?php }
+
+// Logged out Heading
+function dnxup_setting_log_out_heading_display() {
+$dnxup_options = get_option( 'dnxup_options' ); ?>
+<input type="text" name="dnxup_options[logged_out_heading]" value="<?php echo $dnxup_options['logged_out_heading']; ?>" />
+<span class="description"><?php _e('This is the heading your users will see when they\'re not logged in to your site', 'dnxup'); ?></span>
+<?php }
+
+// Logged in Heading
+function dnxup_setting_log_in_heading_display() {
+$dnxup_options = get_option( 'dnxup_options' ); ?>
+<input type="text" name="dnxup_options[logged_in_heading]" value="<?php echo $dnxup_options['logged_in_heading']; ?>" />
+<span class="description"><?php _e('This is the heading your users will see when they\'re logged in. <code>%username%</code> shows username.', 'dnxup'); ?></span>
+<?php }
+
+// Logged in Custom Links
+function dnxup_setting_log_in_custom_links_display() {
+$dnxup_options = get_option( 'dnxup_options' ); ?>
+<textarea name="dnxup_options[logged_in_links]" rows="10" cols="80" /><?php echo wp_kses_data( $dnxup_options['logged_in_links'] ) ?></textarea>
+<div class="description">
+       <p>
+               <?php _e("<strong>One link per line</strong>. Note: Logout link will always show regardless. Tip: Add <code>|true</code> after a link to only show it to admin users or alternatively use a <code>|user_capability</code> and the link will only be shown to users with that capability. See <a href='http://codex.wordpress.org/Roles_and_Capabilities' target='_blank'>http://codex.wordpress.org/Roles_and_Capabilities</a> for more info on roles and Capabilities.<br/> You can also type <code>%USERNAME%</code> and <code>%USERID%</code> which will be replaced by the user info.<br />Example:",'dnxup');
+               echo '<br /><code>&lt;a href="'.get_bloginfo('wpurl').'/wp-admin/"&gt;'. __('Dashboard', 'dnxup') . '&lt;/a&gt;<br/>&lt;a href="'.get_bloginfo('wpurl').'/wp-admin/profile.php"&gt;'. __('Profile', 'dnxup') .'&lt;/a&gt;</code>'; ?>
+       </p>
+</div>
+<?php }
+
+?>
\ No newline at end of file
diff --git a/languages/dnxup-az_AZ.mo b/languages/dnxup-az_AZ.mo
new file mode 100644 (file)
index 0000000..4da46eb
Binary files /dev/null and b/languages/dnxup-az_AZ.mo differ
diff --git a/languages/dnxup-it_IT.mo b/languages/dnxup-it_IT.mo
new file mode 100644 (file)
index 0000000..77ce927
Binary files /dev/null and b/languages/dnxup-it_IT.mo differ
diff --git a/languages/it_IT.po b/languages/it_IT.po
new file mode 100644 (file)
index 0000000..07eac3b
--- /dev/null
@@ -0,0 +1,150 @@
+# Copyright (C) 2015 danixland User Panel
+# This file is distributed under the same license as the danixland User Panel package.
+msgid ""
+msgstr ""
+"Project-Id-Version: danixland User Panel\n"
+"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/danixland-user-"
+"panel\n"
+"POT-Creation-Date: 2016-02-08 14:31+0100\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"PO-Revision-Date: 2016-02-08 14:41+0100\n"
+"Language-Team: \n"
+"X-Generator: Poedit 1.8.6\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-KeywordsList: __;_e;_n;_x;_ex\n"
+"Last-Translator: danix <danix@danixland.net>\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"Language: it_IT\n"
+"X-Poedit-SearchPath-0: .\n"
+
+#: danixland-user-panel.php:33
+msgid "User Panel Options"
+msgstr "Opzioni di User Panel"
+
+#: danixland-user-panel.php:44
+msgid "danixland User Panel Settings"
+msgstr "Impostazioni di danixland User Panel"
+
+#: danixland-user-panel.php:79 danixland-user-panel.php:301
+#: include/plugin-options.php:89
+msgid "Dashboard"
+msgstr "Bacheca"
+
+#: danixland-user-panel.php:79 include/plugin-options.php:89
+msgid "Profile"
+msgstr "Profilo"
+
+#: danixland-user-panel.php:253
+msgid "danixland User Panel"
+msgstr "danixland User Panel"
+
+#: danixland-user-panel.php:254
+msgid "An improved version of the meta widget"
+msgstr "Una versione migliorata del Meta Widget"
+
+#: danixland-user-panel.php:302
+msgid "Profile and personal options"
+msgstr "Profilo e impostazioni personali"
+
+#: danixland-user-panel.php:334
+msgid "Exit"
+msgstr "Esci"
+
+#: danixland-user-panel.php:343 danixland-user-panel.php:353
+msgid "Login"
+msgstr "Login"
+
+#: danixland-user-panel.php:344 danixland-user-panel.php:354
+msgid "Forgot your password?"
+msgstr "Password dimenticata?"
+
+#: danixland-user-panel.php:352
+msgid "Register"
+msgstr "Registrati"
+
+#: danixland-user-panel.php:370
+#, php-format
+msgid ""
+"Nothing to set here, already had a look at the <a href=\"%1$s\">Settings "
+"Page</a>?"
+msgstr ""
+"Niente di importante quì. Hai già visto la <a href=\"%1$s\">pagina delle "
+"impostazioni</a>?"
+
+#: include/plugin-options.php:6
+msgid "Gravatar setting"
+msgstr "Impostazioni Gravatar"
+
+#: include/plugin-options.php:9 include/plugin-options.php:25
+msgid "Logged out Heading"
+msgstr "Intestazione utenti non registrati"
+
+#: include/plugin-options.php:12 include/plugin-options.php:28
+msgid "Logged in Heading"
+msgstr "Intestazione utenti registrati"
+
+#: include/plugin-options.php:15 include/plugin-options.php:31
+msgid "Logged in Custom Links"
+msgstr "Link personalizzati per utenti registrati"
+
+#: include/plugin-options.php:22
+msgid "Display Gravatar?"
+msgstr "Mostrare il Gravatar?"
+
+#: include/plugin-options.php:39
+msgid "Select this if you want to display the Gravatar image on the widget"
+msgstr "Seleziona se vuoi mostrare l'immagine Gravatar nel widget"
+
+#: include/plugin-options.php:44
+msgid "Heading for widget when user is logged out."
+msgstr "Intestazione del widget per utenti non collegati al sito."
+
+#: include/plugin-options.php:49
+msgid "Heading for widget when user is logged in."
+msgstr "Intestazione del widget per utenti collegati al sito."
+
+#: include/plugin-options.php:54
+msgid "Custom Links to display when user is logged in."
+msgstr "Link personalizzati per utenti collegati al sito."
+
+#: include/plugin-options.php:65
+msgid "Select this to display the Gravatar image for the current user"
+msgstr "Seleziona per mostrare l'immagine Gravatar dell'utente"
+
+#: include/plugin-options.php:72
+msgid ""
+"This is the heading your users will see when they're not logged in to your "
+"site"
+msgstr ""
+"Questa è l'intestazione visualizzata dagli utenti del sito non collegati"
+
+#: include/plugin-options.php:79
+msgid ""
+"This is the heading your users will see when they're logged in. <code>"
+"%username%</code> shows username."
+msgstr ""
+"Questa è l'intestazione visualizzata dagli utenti del sito collegati. "
+"<code>%username%</code> visualizzerà il nome utente."
+
+#: include/plugin-options.php:88
+msgid ""
+"<strong>One link per line</strong>. Note: Logout link will always show "
+"regardless. Tip: Add <code>|true</code> after a link to only show it to "
+"admin users or alternatively use a <code>|user_capability</code> and the "
+"link will only be shown to users with that capability. See <a href='http://"
+"codex.wordpress.org/Roles_and_Capabilities' target='_blank'>http://codex."
+"wordpress.org/Roles_and_Capabilities</a> for more info on roles and "
+"Capabilities.<br/> You can also type <code>%USERNAME%</code> and <code>"
+"%USERID%</code> which will be replaced by the user info.<br />Example:"
+msgstr ""
+"<strong>Un link per riga</strong>. Nota: il link di logout sarà sempre "
+"visibile. Puoi aggiungere <code>|true</code> dopo un link per mostrarlo "
+"solo agli utenti amministratori oppure puoi usare una <code>|"
+"user_capability</code> e il link sarà visibile solo agli utenti con quella "
+"capacità. Leggi <a href='http://codex.wordpress.org/"
+"Roles_and_Capabilities' target='_blank'>http://codex.wordpress.org/"
+"Roles_and_Capabilities</a> per ulteriori informazioni su ruoli e capacità."
+"<br/> Puoi anche usare <code>%USERNAME%</code> e <code>%USERID%</code> che "
+"saranno sostituiti con le relative informazioni sull'utente.<br />Esempio:"
diff --git a/readme.txt b/readme.txt
new file mode 100644 (file)
index 0000000..7cb8823
--- /dev/null
@@ -0,0 +1,165 @@
+=== danixland-user-panel ===
+Contributors: danixland
+Donate link: http://danixland.net
+Tags: user, panel, dashboard, widget, sidebar, gravatar, links, 
+Requires at least: 3.0.1
+Tested up to: 4.4
+Stable tag: 1.4.2
+
+This widget is an enhanced version of the standard meta widget for the sidebar.
+
+== Description ==
+
+danixland-user-panel is a plugin that adds a new widget to be used on the Sidebar (or wherever you like).
+This widget is an enhanced version of the standard meta widget, it shows the current user's Gravatar (can be disabled
+in the control panel), shows a link to your site's Dashboard, to the current user's options and detects if a user is
+logged in or not.
+If a user is not logged in, the widget checks if user registration is enabled and shows different links based on how
+the admin set up registration on the site.
+If registration is enabled, the widget shows a link to the registration page plus the usual "login" and "forgotten password"
+where if registration is disabled, it shows only the standard "login" link.
+
+This plugin allows the admin to display a set of custom links which can be shown based on usernames, user ids or even user roles and capabilities.
+
+_Starting with version 1.2 this plugin uses some code from the sidebar-login by [Mike Jolley](http://mikejolley.com), so a big **thank you** goes to him for releasing this nice piece of software._
+
+
+== Installation ==
+
+Installing danixland-user-panel is straightforward and requires just a few seconds:
+
+If you use the **"Add New Plugin"** pane from your dashboard just install it and activate it, then proceed to the last step and configure it.
+Otherwise follow these steps:
+
+1. Download the latest version of the plugin.
+1. If using the "Install Plugins->Upload" section on the WordPress admin area just upload the zip file, otherwise unpack the zip file and upload
+   the **"danixland-user-panel"** directory inside the "wp-content/plugins" directory of your WordPress installation using your favourite ftp client.
+1. Activate the plugin through the 'Plugins' menu in WordPress.
+1. Add the widget to your sidebar from Appearance->Widgets.
+1. Configure the widget options through the Setting Panel which can be accessed from the sidebar clicking on Settings->User Panel Options.
+
+== Frequently Asked Questions ==
+
+= What can I do to customize even more the appearance of the widget? =
+
+The code generated by the plugin is wrapped in an HTML element with class `dnx-user-panel`, what kind of element is decided by your theme, if unsure ask his creator.
+Contained in that element you'll find an unordered list with id `dnxup_login_links` and a variable class based on what kind of user is surfing the page; these are the classes you can use:
+
+* If the user is logged in to your site: `.user_logged_in`
+* If the user is not logged in to your site and you have registration enabled: `.logged_out_yesreg`
+* Or if the user is not logged in to your site and you don't want new users to register: `.logged_out_noreg`
+
+Also each custom list item has class `dnxup_custom_link`, predefined list items have a specific id, and you can specify ids and classes for your custom links too!!
+These are the predefined ids for every list item:
+
+###### Logged out users, no registration:
+
+* `#login`
+* `#lostpassword`
+
+###### Logged out users, registration enabled:
+
+* `#register`
+* `#login`
+* `#lostpassword`
+
+###### Logged in users:
+
+* `#dashboard`
+* `#profile`
+* `#logout`
+
+= I'm stuck with your plugin and don't seem to be able to customize it/make it work, can you help me? =
+
+Of course, you can ask for help on [the forums](http://wordpress.org/support/) or write a comment on the main article for this plugin on [my site](http://danixland.net/blog/2010/603-danixland-user-panel-plugin/), I'll reply ASAP ;)
+
+= I'd like this plugin to be translated in my language, can you do this for me? =
+
+Starting with version 1.2 the plugin ships with a .POT file that can be used to create a translation of the plugin in your language, so if you're familiar with english you can help by providing a translation and it will be added to future versions of the plugin along with a link to your site on these pages ;)
+
+To provide a translation simply edit the file "danixland-user-panel.pot" and fill every line with the traduction in your language, then save it as *yourlanguagecode.po* (E.G. it_IT.po for Italian), then contact me via the forums or my site and I'll tell you how to send this file to me. I'll add your translation ASAP.
+
+A number of softwares exists to help you with .po files, like [POEdit](http://sourceforge.net/projects/poedit/) or [Lokalize](http://userbase.kde.org/Lokalize "for kde users")
+
+####If you have any other questions feel free to ask
+
+== Screenshots ==
+
+1. The link in the admin area's sidebar. It's accessible only to those users who can [manage-options](http://codex.wordpress.org/Roles_and_Capabilities#manage_options).
+2. The heading of the settings page with the option to enable/disable the visualization of the Gravatar image.
+3. The two heading options, here you can set a message to welcome your users, both when they are logged in or not.
+4. The custom link area with two custom links set. Notice the tips in the description which will help you use it at its best.
+5. The widget on the front page of the site, displayed in the footer of the standard twentyeleven theme with no customization. Here the user is logged in and has two custom links.
+6. The same widget but showing only the "login" and "forgot password" links since the user is not logged in and registration is not allowed.
+7. Here's the widget on the front site, the user has not logged in and registration of new users is allowed.
+
+== Changelog ==
+
+= 1.4.2 =
+* fixed i18n functionality. This plugin is now fully international and is now shipping with a working POT and an italian translation.
+
+= 1.4.1 =
+* wp_currentuserinfo() is deprecated as of latest WordPress 4.5-alpha, so I had to switch to wp_get_current_user() instead.
+
+= 1.4 =
+* Plugin now uses the __construct method which is recommended since WP 4.3
+
+= 1.3 =
+* Fixed errors that rendered the plugin unusable on WP 4.1 beta 1
+
+= 1.2.1 =
+* Added Azerbaijani translation
+
+= 1.2 =
+* Migration to the [Settings API](http://codex.wordpress.org/Settings_API).
+* Added options to set multiple custom links.
+* [i18n](http://codex.wordpress.org/I18n_for_WordPress_Developers) setup and plugin shipping now with standard .pot file to help translators.
+
+= 1.1.0 =
+* Added possibility to add a custom link
+
+= 1.0.2 =
+* Fixed "plugin link" that was pointing to a wrong url
+
+= 1.0.1 =
+* Added "password forgotten" link in no registration mode.
+
+= 1.0 =
+* This is the first version of the plugin.
+
+== Upgrade Notice ==
+
+= 1.4.2 =
+* Fixed translation system, no plugin functionalities modified. Upgrade if you want to enjoy this plugin in your own language.
+
+= 1.4.1 =
+* Small plugin edit that avoids using a function that will be deprecated with WordPress 4.5 (future proofing FTW!!). Upgrade recommended!
+
+= 1.4 =
+* Some plugin fixes to avoid returning errors because of the deprecated WP_Widget method.
+
+= 1.2 =
+* Major plugin changes, adopted the new [WordPress Settings API](http://codex.wordpress.org/Settings_API) which improves overall security, so it is higly recommended to upgrade.
+
+= 1.1.0 =
+* This version adds an useful functionality, so it is recommended to upgrade.
+
+= 1.0.2 =
+Minor fix, this version is the same as the 1.0.1
+
+= 1.0.1 =
+This version adds the "password forgotten" in no registration mode, so it's useful to upgrade.
+
+= 1.0 =
+No upgrade since this is the first version ;)
+
+
+
+== ToDo list ==
+
+List is actually empty, but I'm open to suggestions.
+
+== Translations ==
+
+Azerbaijani translation (for previous version, not working anymore) by: [deqaxwer](http://wordpress.org/support/profile/deqaxwer)
+Italian translation by me :)