WordPress.org

Ready to get started?Download WordPress

Forums

Cross-linker
Cyrillic alphabet support (8 posts)

  1. GrayHunter
    Member
    Posted 2 years ago #

    Hello,

    your plugin is the best but I do really need Cyrillic alphabet support.

    For example:
    1) if I add the keyword "table" (Cyrillic) - the plugin do not understand that "table" (do not cross link) and "Table" are the same words. But I also can not add "Table" - it says that there is already such word and it is "table". So capital letters would be nice feature.
    2) the endings of the words are not taking in attention: if the keyword is "table" - the plugin do not cross link the word "tables", so I have to add two words: "table" and "tables".

    Pls, tell smth to let me know if you try to solve the problem. I hope you will try.

    Eugene.
    P.S.- THX for the plugin anyway, it is GREAT.

    http://wordpress.org/extend/plugins/cross-linker/

  2. GrayHunter
    Member
    Posted 2 years ago #

    Pls, tell smth to let me know if you try to solve the problem. I hope you will try.

  3. janhvizdak
    Member
    Plugin Author

    Posted 2 years ago #

    You should have emailed me, I'm not checking this page too often.

    1) Cyrilic characters - I will look at the issue

    2) Endings - This is expected behaviour, not all people want plural and singular point at same url. Will look at it too.

  4. Eretig
    Member
    Posted 2 years ago #

    Hi!
    Thank you for this plugin!
    But I find two problems with it:

    1. it can't work with wordpress'es permalinks;
    2. it wann't work properly with capital cyrillic.

    Here is my variant to fix it:

    1. add to line
      if( ( (assign_correct_uri($point_to)==$current_uri)&&($link_to_itself!=1) ) || (($link_to_itself!=1)&&($is_the_same_uri==1)))

      one more condition:

      ((basename(get_permalink())==$current_uri)&&($link_to_itself!=1) )
    2. use this function instead of "strtolower":
      function strtolower_utf8($string){
        $convert_to = array(
          "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u",
          "v", "w", "x", "y", "z", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï",
          "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "ø", "ù", "ú", "û", "ü", "ý", "а", "б", "в", "г", "д", "е", "ё", "ж",
          "з", "и", "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ъ", "ы",
          "ь", "э", "ю", "я"
        );
        $convert_from = array(
          "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U",
          "V", "W", "X", "Y", "Z", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï",
          "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "А", "Б", "В", "Г", "Д", "Е", "Ё", "Ж",
          "З", "И", "Й", "К", "Л", "М", "Н", "О", "П", "Р", "С", "Т", "У", "Ф", "Х", "Ц", "Ч", "Ш", "Щ", "Ъ", "Ъ",
          "Ь", "Э", "Ю", "Я"
        );
      return str_replace($convert_from, $convert_to, $string);
        }

    Regards, Nick.

  5. GrayHunter
    Member
    Posted 2 years ago #

    Great! Thx.

    but were (what lines in what file) should I add these all?

  6. Eretig
    Member
    Posted 2 years ago #

    There is just one file: /plugins/cross-linker/crosslink.php

    Number of string with conditions for permalinks: 1713 in plugin version 1.4.4
    After changes it must look like this:

    if( ( (assign_correct_uri($point_to)==$current_uri)&&($link_to_itself!=1) ) || (($link_to_itself!=1)&&($is_the_same_uri==1)) || ((basename(get_permalink())==$current_uri)&&($link_to_itself!=1) ))

    What about function strtolower_utf8() - I add it in the begin of file, after line

    if(function_exists('add_action'))
    	add_action('admin_menu', 'crosslinker_add_pages');

    and replace all words "strtolower" with "strtolower_utf8".
    But be careful and don't change function name to "strtolower_utf8_utf8" :)

  7. Eretig
    Member
    Posted 2 years ago #

    Oops, I was wrong with permalink's fix. This is bad idea, it's remove all crosslinks from page, what contains link to itself.

    Here is right condition for deleting only crosslinks to itself, not all crosslinks:

    ((basename(get_permalink(@substr($point_to,strlen('post:'))))==$current_uri)&&($link_to_itself!=1) )

    Also if you don't want to see cross links to itself in posts when you look at category or archive, you need to add "$post" to the "global" section of function "interlink_w_u()" and add one more condition in our lovely line:

    (($post->ID == @substr($point_to,strlen('post:'))) && ($link_to_itself!=1))

    In the end, with all changes we have this statement:

    if(
       (
          (assign_correct_uri($point_to)==$current_uri) ||
          ($is_the_same_uri==1) ||
          (basename(get_permalink(@substr($point_to,strlen('post:'))))==$current_uri) ||
          ($post->ID == @substr($point_to,strlen('post:')))
       )
       && ($link_to_itself!=1)
    )

    And sorry for my poor english, please.

  8. GrayHunter
    Member
    Posted 2 years ago #

    Eretig, thx a lot.

    janhvizdak, what has changed?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic