Skip to content

Commit

Permalink
Merge pull request #56 from utahta/add-shortcode
Browse files Browse the repository at this point in the history
Add shortcode
  • Loading branch information
utahta authored Feb 4, 2018
2 parents c329d92 + 13afb44 commit d028a42
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 7 deletions.
2 changes: 2 additions & 0 deletions modules/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ function wp_social_bookmarking_light_output($services, $link, $title)
*
* @deprecated
*
* Use [wsbl_embed] shortcode instead.
*
* @param string $services
* @param string $link
* @param string $title
Expand Down
Binary file modified po/wp-social-bookmarking-light-ja.mo
Binary file not shown.
8 changes: 4 additions & 4 deletions po/wp-social-bookmarking-light-ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,16 @@ msgid "Position"
msgstr "位置"

#: wp-social-bookmarking-light\trunk/wp-social-bookmarking-light.php:795
msgid "Singular"
msgid "Individual Article"
msgstr "個別記事のみ"

#: wp-social-bookmarking-light\trunk/wp-social-bookmarking-light.php:804
msgid "Page"
msgid "Pages"
msgstr "ページ"

#: wp-social-bookmarking-light\trunk/wp-social-bookmarking-light.php:813
msgid "Services"
msgstr "サービス"
msgid "Enable Services"
msgstr "有効なサービス"

#: wp-social-bookmarking-light\trunk/wp-social-bookmarking-light.php:938
msgid "Save Changes"
Expand Down
2 changes: 2 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ This plugin inserts social share links at the top or bottom of each post.

This plugin inserts social share links at the top or bottom of each post.

This plugin documentation can be found [here](https://github.com/utahta/WP-Social-Bookmarking-Light/wiki).

This is the list of used social sites:

* Hatena
Expand Down
18 changes: 18 additions & 0 deletions src/WpSocialBookmarkingLight/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ public function getBuilder()
return $this->builder;
}

/**
* @return Option
*/
public function getOption()
{
return $this->option;
}

/**
* Initialize wp actions
*/
Expand All @@ -48,6 +56,16 @@ public static function init()
add_action('wp_footer', array($plugin, 'footer'));
add_filter('the_content', array($plugin, 'theContent'));
add_action('admin_menu', array($plugin, 'adminMenu'));

add_shortcode('wsbl_embed', function ($attrs) use ($plugin) {
$options = $plugin->getOption()->getAll();
$v = shortcode_atts(array(
'services' => $options['services'],
'link' => get_permalink(),
'title' => get_the_title(),
), $attrs);
return $plugin->getBuilder()->content($v['services'], $v['link'], $v['title']);
});
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</td>
</tr>
<tr>
<th scope="row">{{ 'Singular' | __ }}:</th>
<th scope="row">{{ 'Individual Article' | __ }}:</th>
<td>
<select name='single_page'>
<option value='true' {{ option.single_page == true ? 'selected' : '' }}>Yes</option>
Expand All @@ -61,7 +61,7 @@
</td>
</tr>
<tr>
<th scope="row">{{ 'Page' | __ }}:</th>
<th scope="row">{{ 'Pages' | __ }}:</th>
<td>
<select name='is_page'>
<option value='true' {{ option.is_page == true ? 'selected' : '' }}>Yes</option>
Expand All @@ -70,7 +70,7 @@
</td>
</tr>
<tr>
<th scope="row">{{ 'Services' | __ }}: <br/> <span style="font-size:10px">(drag-and-drop)</span></th>
<th scope="row">{{ 'Enable Services' | __ }}: <br/> <span style="font-size:10px">(drag-and-drop)</span></th>
<td>
<input type="text" id='services_id' name='services' value="{{ option.services }}"size=120 style="font-size:12px;" onclick="this.select(0, this.value.length)" readonly/>
<br />
Expand Down

0 comments on commit d028a42

Please sign in to comment.