Plugin Directory

Changeset 407610


Ignore:
Timestamp:
07/09/2011 09:36:17 PM (15 years ago)
Author:
Name.ly
Message:

Added a new option of skipping double references.

Location:
links2tabs/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • links2tabs/trunk/links2tabs.php

    r406991 r407610  
    77Plugin URI: http://links2tabs.com/plugins/wordpress/
    88Description: In addition to link bundling services <a href="http://brief.ly/" target="_blank" ><em>Brief.ly</em></a>, <a href="http://links2.me/" target="_blank" ><em>Links2.Me</em></a>, <a href="http://many.at/" target="_blank" ><em>Many.at</em></a>, Links2Tabs plugin automatically generates the list of references at the bottom of each post and/or page and bundles them into handy links that open everything with one click. If you also want your visitors to open all recent items from your RSS feed with one click, consider installing Feed2Tabs plugin.
    9 Version: 0.0.4
     9Version: 0.0.5
    1010Author: Name.ly
    1111Author URI: http://name.ly/
     
    8989  "show_on_pages" => "yes",
    9090  //"show_on_home" => "yes",
     91  "skip_double_links" => "yes",
    9192  "include_links_with_images" => "yes",
    9293  "include_internal_links" => "yes",
     
    205206  $bundles = array ();
    206207  $bundlecaptions = array ();
     208  $foundlinks = array ();
    207209  $number_of_bundles = 1;
    208210  $current_link_in_current_bundle = 1;
     
    338340            } // end of if ( $clean_caption )
    339341          } // end of if ( false !== $hrefend )
     342
     343          // we have found a URL and its Caption
     344
     345          // check for double links, if requested
     346          if ( "yes" == $links2tabs_options [ "skip_double_links" ] ) {
     347            $link_key = array_search ( $url, $foundlinks );
     348            if ( false === $link_key ) {
     349              // a new unique reference found, remember it and proceed further
     350              $foundlinks [] = $url;
     351            } else {
     352              if ( "yes" == $links2tabs_options [ "add_reference_tags" ] ) {
     353                $rawlinks [ $key ] .= ' [' . ( "yes" == $links2tabs_options [ "link_reference_tags" ] ? '<a href="#links2tabs">' . ( $link_key + 1 ) . '</a>' : ( $link_key + 1 ) ) . ']';
     354              } // end of if ( "yes" == $links2tabs_options [ "add_reference_tags" ] )
     355              continue;
     356            } // end of if ( false === $link_key )
     357          } else {
     358            $foundlinks [] = $url;
     359          } // end of if ( "yes" == $links2tabs_options [ "skip_double_links" ] )
     360
    340361          // limit the tab caption length
    341362          if ( LINKS2TABS_MAX_TAB_TITLE ) {
  • links2tabs/trunk/links2tabs_settings_page.php

    r406764 r407610  
    111111    switch ( $sid ) {
    112112
     113      // Parsing & Finish
     114
    113115      case "show_on_posts":
    114116        echo '<tr>' . NEW_LINE;
     
    164166      break; // end of case "show_on_home"
    165167
     168      case "skip_double_links":
     169        echo '<tr>' . NEW_LINE;
     170        echo '  <th scope="row">' . NEW_LINE;
     171        echo '    <label for="' . links2tabs_input_id_by_sid ( $sid ) . '"><strong>' . __ ( 'Skip double references:', 'links2tabs' ) . '</strong></label>' . NEW_LINE;
     172        echo '    <br /><br /><i>' . __ ( 'N.B., if several double references with the same URLs are found, the title of the first one will be used in the bundle.', 'links2tabs' ) . '</i>' . NEW_LINE;
     173        echo '  </th>' . NEW_LINE;
     174        echo '  <td>' . NEW_LINE;
     175        echo '<select name="' . links2tabs_input_id_by_sid ( $sid ) . '" id="' . links2tabs_input_id_by_sid ( $sid ) . '" >' . NEW_LINE;
     176        echo '  <option ' . ( 'yes' == $value ? 'selected ' : '' ) . 'value="yes">' . __ (  'Yes', 'links2tabs' ) . '</option>' . NEW_LINE;
     177        echo '  <option ' . ( 'yes' != $value ? 'selected ' : '' ) . 'value="no">' . __ (  'No', 'links2tabs' ) . '</option>' . NEW_LINE;
     178        echo '</select><br />' . NEW_LINE;
     179        echo '  </td>' . NEW_LINE;
     180        echo '</tr>' . NEW_LINE;
     181      break; // end of case "skip_double_links"
     182
    166183      case "include_links_with_images":
    167184        echo '<tr>' . NEW_LINE;
     
    213230        echo '  <th scope="row">' . NEW_LINE;
    214231        echo '    <label for="' . links2tabs_input_id_by_sid ( $sid ) . '"><strong>' . __ ( 'Link reference tags to the bundle:', 'links2tabs' ) . '</strong></label>' . NEW_LINE;
    215         echo '    <br /><br /><i>' . __ ( 'If "Add reference tags" above is <code>yes</code>, should the plugin link each added tag to the result in the page/post bottom?', 'links2tabs' ) . '</i>' . NEW_LINE;
     232        echo '    <br /><br /><i>' . __ ( 'If "Add reference tags" above is <code>Yes</code>, should the plugin link each added tag to the result in the page/post bottom?', 'links2tabs' ) . '</i>' . NEW_LINE;
    216233        echo '  </th>' . NEW_LINE;
    217234        echo '  <td>' . NEW_LINE;
     
    223240        echo '</tr>' . NEW_LINE;
    224241      break; // end of case "link_reference_tags"
    225 
    226       case "open_in_tabs":
    227         echo '<tr>' . NEW_LINE;
    228         echo '  <th scope="row">' . NEW_LINE;
    229         echo '    ' . __ ( '', 'links2tabs' ) . NEW_LINE;
    230         echo '  </th>' . NEW_LINE;
    231         echo '  <td>' . NEW_LINE;
    232         echo '    <strong>' . __ ( 'Bundled Tabs', 'links2tabs' ) . '</strong>' . NEW_LINE;
    233         echo '  </td>' . NEW_LINE;
    234         echo '</tr>' . NEW_LINE;
    235         echo '<tr>' . NEW_LINE;
    236         echo '  <th scope="row">' . NEW_LINE;
    237         echo '    <label for="' . links2tabs_input_id_by_sid ( $sid ) . '"><strong>' . __ ( 'Open references in tabs:', 'links2tabs' ) . '</strong></label>' . NEW_LINE;
    238         echo '    <br /><br /><i>' . __ ( 'Enables or disables automatic link opening in separate tabs. Please mind, that if ToC is set to <code>off</code> below, tabs will be enabled anyway.', 'links2tabs' ) . '</i>' . NEW_LINE;
    239         echo '  </th>' . NEW_LINE;
    240         echo '  <td>' . NEW_LINE;
    241         echo '<select name="' . links2tabs_input_id_by_sid ( $sid ) . '" id="' . links2tabs_input_id_by_sid ( $sid ) . '" >' . NEW_LINE;
    242         echo '  <option ' . ( 'yes' == $value ? 'selected ' : '' ) . 'value="yes">' . __ (  'Yes', 'links2tabs' ) . '</option>' . NEW_LINE;
    243         echo '  <option ' . ( 'yes' != $value ? 'selected ' : '' ) . 'value="no">' . __ (  'No', 'links2tabs' ) . '</option>' . NEW_LINE;
    244         echo '</select><br />' . NEW_LINE;
    245         echo '  </td>' . NEW_LINE;
    246         echo '</tr>' . NEW_LINE;
    247       break; // end of case "open_in_tabs"
    248242
    249243      case "links_per_bundle":
     
    279273      break; // end of case "min_number_of_links"
    280274
     275      case "one_bundle_caption":
     276        echo '<tr>' . NEW_LINE;
     277        echo '  <th scope="row">' . NEW_LINE;
     278        echo '    <label for="' . links2tabs_input_id_by_sid ( $sid ) . '"><strong>' . __ ( 'Text before one bundle:', 'links2tabs' ) . '</strong></label>' . NEW_LINE;
     279        echo '    <br /><br /><i>' . __ ( 'Text to appear before the link in case there is only one reference bundle.', 'links2tabs' ) . '</i>' . NEW_LINE;
     280        echo '  </th>' . NEW_LINE;
     281        echo '  <td>' . NEW_LINE;
     282        echo '<input name="' . links2tabs_input_id_by_sid ( $sid ) . '" id="' . links2tabs_input_id_by_sid ( $sid ) . '" value="' . esc_attr ( $value ) . '" size="80" />' . NEW_LINE;
     283        echo '  </td>' . NEW_LINE;
     284        echo '</tr>' . NEW_LINE;
     285      break; // end of case "one_bundle_caption"
     286
     287      case "many_bundles_caption":
     288        echo '<tr>' . NEW_LINE;
     289        echo '  <th scope="row">' . NEW_LINE;
     290        echo '    <label for="' . links2tabs_input_id_by_sid ( $sid ) . '"><strong>' . __ ( 'Text before many bundles:', 'links2tabs' ) . '</strong></label>' . NEW_LINE;
     291        echo '    <br /><br /><i>' . __ ( 'Text to appear before the links in case there are several bundles.', 'links2tabs' ) . '</i>' . NEW_LINE;
     292        echo '  </th>' . NEW_LINE;
     293        echo '  <td>' . NEW_LINE;
     294        echo '<input name="' . links2tabs_input_id_by_sid ( $sid ) . '" id="' . links2tabs_input_id_by_sid ( $sid ) . '" value="' . esc_attr ( $value ) . '" size="80" />' . NEW_LINE;
     295        echo '  </td>' . NEW_LINE;
     296        echo '</tr>' . NEW_LINE;
     297      break; // end of case "many_bundles_caption"
     298
     299      case "target":
     300        echo '<tr>' . NEW_LINE;
     301        echo '  <th scope="row">' . NEW_LINE;
     302        echo '    <label for="' . links2tabs_input_id_by_sid ( $sid ) . '"><strong>' . __ ( 'Link target:', 'links2tabs' ) . '</strong></label>' . NEW_LINE;
     303        echo '    <br /><br /><i>' . __ ( 'Where to open the bundled references?', 'links2tabs' ) . '</i>' . NEW_LINE;
     304        echo '  </th>' . NEW_LINE;
     305        echo '  <td>' . NEW_LINE;
     306        echo '<select name="' . links2tabs_input_id_by_sid ( $sid ) . '" id="' . links2tabs_input_id_by_sid ( $sid ) . '" >' . NEW_LINE;
     307        echo '  <option ' . ( '_blank' == $value ? 'selected ' : '' ) . 'value="_blank">' . __ (  'New Window', 'links2tabs' ) . '</option>' . NEW_LINE;
     308        echo '  <option ' . ( '_blank' != $value ? 'selected ' : '' ) . 'value="_same">' . __ (  'Same Window', 'links2tabs' ) . '</option>' . NEW_LINE;
     309        echo '</select><br />' . NEW_LINE;
     310        echo '  </td>' . NEW_LINE;
     311        echo '</tr>' . NEW_LINE;
     312      break; // end of case "target"
     313
    281314      case "visibility":
    282315        echo '<tr>' . NEW_LINE;
     
    296329      break; // end of case "visibility"
    297330
    298       case "target":
    299         echo '<tr>' . NEW_LINE;
    300         echo '  <th scope="row">' . NEW_LINE;
    301         echo '    <label for="' . links2tabs_input_id_by_sid ( $sid ) . '"><strong>' . __ ( 'Link target:', 'links2tabs' ) . '</strong></label>' . NEW_LINE;
    302         echo '    <br /><br /><i>' . __ ( 'Where to open the bundled references?', 'links2tabs' ) . '</i>' . NEW_LINE;
    303         echo '  </th>' . NEW_LINE;
    304         echo '  <td>' . NEW_LINE;
    305         echo '<select name="' . links2tabs_input_id_by_sid ( $sid ) . '" id="' . links2tabs_input_id_by_sid ( $sid ) . '" >' . NEW_LINE;
    306         echo '  <option ' . ( '_blank' == $value ? 'selected ' : '' ) . 'value="_blank">' . __ (  'New Window', 'links2tabs' ) . '</option>' . NEW_LINE;
    307         echo '  <option ' . ( '_blank' != $value ? 'selected ' : '' ) . 'value="_same">' . __ (  'Same Window', 'links2tabs' ) . '</option>' . NEW_LINE;
    308         echo '</select><br />' . NEW_LINE;
    309         echo '  </td>' . NEW_LINE;
    310         echo '</tr>' . NEW_LINE;
    311       break; // end of case "target"
    312 
    313       case "one_bundle_caption":
    314         echo '<tr>' . NEW_LINE;
    315         echo '  <th scope="row">' . NEW_LINE;
    316         echo '    <label for="' . links2tabs_input_id_by_sid ( $sid ) . '"><strong>' . __ ( 'Text before one bundle:', 'links2tabs' ) . '</strong></label>' . NEW_LINE;
    317         echo '    <br /><br /><i>' . __ ( 'Text to appear before the link in case there is only one reference bundle.', 'links2tabs' ) . '</i>' . NEW_LINE;
    318         echo '  </th>' . NEW_LINE;
    319         echo '  <td>' . NEW_LINE;
    320         echo '<input name="' . links2tabs_input_id_by_sid ( $sid ) . '" id="' . links2tabs_input_id_by_sid ( $sid ) . '" value="' . esc_attr ( $value ) . '" size="80" />' . NEW_LINE;
    321         echo '  </td>' . NEW_LINE;
    322         echo '</tr>' . NEW_LINE;
    323       break; // end of case "one_bundle_caption"
    324 
    325       case "many_bundles_caption":
    326         echo '<tr>' . NEW_LINE;
    327         echo '  <th scope="row">' . NEW_LINE;
    328         echo '    <label for="' . links2tabs_input_id_by_sid ( $sid ) . '"><strong>' . __ ( 'Text before many bundles:', 'links2tabs' ) . '</strong></label>' . NEW_LINE;
    329         echo '    <br /><br /><i>' . __ ( 'Text to appear before the links in case there are several bundles.', 'links2tabs' ) . '</i>' . NEW_LINE;
    330         echo '  </th>' . NEW_LINE;
    331         echo '  <td>' . NEW_LINE;
    332         echo '<input name="' . links2tabs_input_id_by_sid ( $sid ) . '" id="' . links2tabs_input_id_by_sid ( $sid ) . '" value="' . esc_attr ( $value ) . '" size="80" />' . NEW_LINE;
    333         echo '  </td>' . NEW_LINE;
    334         echo '</tr>' . NEW_LINE;
    335       break; // end of case "many_bundles_caption"
     331      // Name.ly/Frames appearance
     332
     333      case "open_in_tabs":
     334        echo '<tr>' . NEW_LINE;
     335        echo '  <th scope="row">' . NEW_LINE;
     336        echo '    ' . __ ( '', 'links2tabs' ) . NEW_LINE;
     337        echo '  </th>' . NEW_LINE;
     338        echo '  <td>' . NEW_LINE;
     339        echo '    <strong>' . __ ( 'Bundled Tabs', 'links2tabs' ) . '</strong>' . NEW_LINE;
     340        echo '  </td>' . NEW_LINE;
     341        echo '</tr>' . NEW_LINE;
     342        echo '<tr>' . NEW_LINE;
     343        echo '  <th scope="row">' . NEW_LINE;
     344        echo '    <label for="' . links2tabs_input_id_by_sid ( $sid ) . '"><strong>' . __ ( 'Open references in tabs:', 'links2tabs' ) . '</strong></label>' . NEW_LINE;
     345        echo '    <br /><br /><i>' . __ ( 'Enables or disables automatic link opening in separate tabs. Please mind, that if ToC is set to <code>off</code> below, tabs will be enabled anyway.', 'links2tabs' ) . '</i>' . NEW_LINE;
     346        echo '  </th>' . NEW_LINE;
     347        echo '  <td>' . NEW_LINE;
     348        echo '<select name="' . links2tabs_input_id_by_sid ( $sid ) . '" id="' . links2tabs_input_id_by_sid ( $sid ) . '" >' . NEW_LINE;
     349        echo '  <option ' . ( 'yes' == $value ? 'selected ' : '' ) . 'value="yes">' . __ (  'Yes', 'links2tabs' ) . '</option>' . NEW_LINE;
     350        echo '  <option ' . ( 'yes' != $value ? 'selected ' : '' ) . 'value="no">' . __ (  'No', 'links2tabs' ) . '</option>' . NEW_LINE;
     351        echo '</select><br />' . NEW_LINE;
     352        echo '  </td>' . NEW_LINE;
     353        echo '</tr>' . NEW_LINE;
     354      break; // end of case "open_in_tabs"
    336355
    337356      case "default_reference_caption":
     
    394413        echo '</tr>' . NEW_LINE;
    395414      break; // end of case "toc"
     415
     416      // Advanced settings
    396417
    397418      case "custom_api_base":
     
    446467        echo '<input name="' . links2tabs_input_id_by_sid ( $sid ) . '" id="' . links2tabs_input_id_by_sid ( $sid ) . '" value="' . esc_attr ( implode ( " ", $value ) ) . '" size="80" /><br />' . NEW_LINE;
    447468        echo '<small>' . __ ( 'E.g., adding <code>.zip</code> will exclude all ZIP archives, <code>Domain.com</code> - all links referring to domain.com.', 'links2tabs' ) . '</small><br />' . NEW_LINE;
    448         echo '<small>' . __ ( 'N.B. These checks are case irrelevant.', 'links2tabs' ) . '</small><br />' . NEW_LINE;
     469        echo '<small>' . __ ( 'N.B. These checks are case-insensitive.', 'links2tabs' ) . '</small><br />' . NEW_LINE;
    449470        echo '<small>' . __ ( 'N.B. It is also possible to white list certain URLs, meaning no other domain names will be allowed.<br />This should be done via Custom API bases described above.', 'links2tabs' ) . '</small><br />' . NEW_LINE;
    450471        echo '  </td>' . NEW_LINE;
  • links2tabs/trunk/readme.txt

    r406991 r407610  
    55Requires at least: 2.8
    66Tested up to: 3.2
    7 Stable tag: 0.0.4
     7Stable tag: 0.0.5
    88License: GPLv2 or later
    99
     
    2828* Show on posts
    2929* Show on pages
     30* Skip double references (If several double references with the same URLs are found, the title of the first one will be used in the bundle.)
    3031* Include links with images (When set to No, references with images will be skipped)
    3132* Include internal links (Choose whether or not to bundle internal links, i.e., those referring to this site's domain).     
     
    107108== Changelog ==
    108109
    109 = 0.0.1 =
     110= 0.0.5 =
    110111
    111 * Initial version.
    112 * Created and tested.
     112* Added a new option of skipping double references.
     113
     114= 0.0.4 =
     115
     116* By default, the plugin will now exclude mail and phone references.
     117* Added a demo page to readme.txt.
     118
     119= 0.0.3 =
     120
     121* Added a new option of the plugin filter priority.
     122* Changed the default value of the bundle size from 12 to 10 to make it more intuitive.
     123* Changed the default value of the threshold links from 2 to 3 to make it more practical.
     124* Added a new option allowing to black list some URLs by keyword.
    113125
    114126= 0.0.2 =
     
    116128* Support for WP prior to version 3.0.0 (before function get_site_url was introduced).
    117129
    118 = 0.0.3 =
     130= 0.0.1 =
    119131
    120 * Added new option of the plugin filter priority.
    121 * Changed the default value of the bundle size from 12 to 10 to make it more intuitive.
    122 * Changed the default value of the threshold links from 2 to 3 to make it more practical.
    123 * Added new option allowing to black list some URLs by keyword.
    124 
    125 = 0.0.4 =
    126 
    127 * By default, the plugin will now exclude mail and phone references.
    128 * Added a demo page to readme.txt.
     132* Initial version.
     133* Created and tested.
    129134
    130135
Note: See TracChangeset for help on using the changeset viewer.