Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Renamed from "Links Widget Improved" - Improve description - Consistent function naming. - Update the translation template and add a Finnish translation. - Use echo instead of print.
- Loading branch information
Showing
5 changed files
with
132 additions
and
96 deletions.
There are no files selected for viewing
Binary file added
BIN
+737 Bytes
plugins/links-inline-descriptions/languages/links-inline-descriptions-fi.mo
Binary file not shown.
37 changes: 37 additions & 0 deletions
37
plugins/links-inline-descriptions/languages/links-inline-descriptions-fi.po
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# SOME DESCRIPTIVE TITLE. | ||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER | ||
# This file is distributed under the same license as the PACKAGE package. | ||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: \n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2016-10-13 20:23+0300\n" | ||
"PO-Revision-Date: 2016-10-13 20:24+0300\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"X-Generator: Poedit 1.8.7.1\n" | ||
"Last-Translator: Pasi Lallinaho <pasi@shimmerproject.org>\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"Language: fi\n" | ||
|
||
#: links-inline-descriptions.php:37 | ||
msgctxt "widget name" | ||
msgid "Links (Inline Descriptions)" | ||
msgstr "Linkit (ja selitteet)" | ||
|
||
#: links-inline-descriptions.php:39 | ||
msgid "Links with inline descriptions." | ||
msgstr "Linkit selitteiden kanssa." | ||
|
||
#: links-inline-descriptions.php:74 | ||
msgid "Link category:" | ||
msgstr "Linkkien kategoria:" | ||
|
||
#: links-inline-descriptions.php:76 | ||
msgctxt "widget option" | ||
msgid "-- All link categories --" | ||
msgstr "-- Kaikki linkkikategoriat --" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
plugins/links-inline-descriptions/links-inline-descriptions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
/* | ||
* Plugin Name: Links (Inline Descriptions) | ||
* Description: A links widget with inline descriptions. | ||
* Author: Pasi Lallinaho | ||
* Version: 1.0.1 | ||
* Author URI: http://open.knome.fi/ | ||
* Plugin URI: http://wordpress.knome.fi/ | ||
* | ||
* License: GNU General Public License v2 or later | ||
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | ||
* | ||
*/ | ||
|
||
/* | ||
* Load text domain for translations | ||
* | ||
*/ | ||
|
||
add_action( 'plugins_loaded', 'links_inline_descriptions_init' ); | ||
|
||
function links_inline_descriptions_init( ) { | ||
load_plugin_textdomain( 'links-inline-descriptions', false, dirname( plugin_basename( FILE ) ) . '/languages/' ); | ||
} | ||
|
||
/* | ||
* Register the widget | ||
* | ||
*/ | ||
|
||
add_action( 'widgets_init', function( ) { register_widget( 'links_inline_descriptions_Widget' ); } ); | ||
|
||
class links_inline_descriptions_Widget extends WP_Widget { | ||
public function __construct( ) { | ||
parent::__construct( | ||
'links-inline-descriptions', | ||
_x( 'Links (Inline Descriptions)', 'widget name', 'links-inline-descriptions' ), | ||
array( | ||
'description' => __( 'Links with inline descriptions.', 'links-inline-descriptions' ), | ||
) | ||
} | ||
|
||
public function widget( $args, $instance ) { | ||
extract( $args ); | ||
$links = get_bookmarks( array( 'category' => $instance['category'] ) ); | ||
|
||
if( is_array( $links ) ) { | ||
echo '<div class="links-improved">'; | ||
echo $before_widget; | ||
$cat_info = get_term( $instance['category'], 'link_category' ); | ||
echo $before_title . $cat_info->name . $after_title; | ||
echo '<ul>'; | ||
foreach( $links as $link ) { | ||
echo '<li><a href="' . $link->link_url . '">'; | ||
echo '<span class="name">' . $link->link_name . '</span><span class="description">' . $link->link_description . '</span>'; | ||
echo '</a></li>'; | ||
} | ||
echo '</ul>'; | ||
echo $after_widget; | ||
echo '</div>'; | ||
} | ||
} | ||
|
||
public function update( $new_instance, $old_instance ) { | ||
$instance = $old_instance; | ||
$instance['category'] = $new_instance['category']; | ||
return $instance; | ||
} | ||
|
||
public function form( $instance ) { | ||
$link_cats = get_terms( 'link_category' ); | ||
?> | ||
<p> | ||
<label for="<?php echo $this->get_field_id( 'category' ); ?>"><?php _e( 'Link category:', 'links-inline-descriptions' ); ?></label> | ||
<select class="widefat" id="<?php echo $this->get_field_id( 'category' ); ?>" name="<?php echo $this->get_field_name( 'category' ); ?>"> | ||
<option value=""><?php _ex( '-- All link categories --', 'widget option', 'links-inline-descriptions' ); ?></option> | ||
<?php | ||
foreach( $link_cats as $link_cat ) { | ||
echo '<option value="' . $link_cat->term_id . '" ' . selected( $instance['category'], $link_cat->term_id, false ) . '>' . $link_cat->name . '</option>'; | ||
} | ||
?> | ||
</select> | ||
</p> | ||
<?php | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.