Dotclear

Changeset 655 for plugins/typo


Ignore:
Timestamp:
01/05/09 20:04:55 (15 years ago)
Author:
franck
Message:

Hyphenation feature removed
Draft code for action on selected entries in admin

Location:
plugins/typo
Files:
2 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • plugins/typo/CHANGELOG

    r648 r655  
    11Typo plugin 1.4 for Dotclear 2 
    22=========================================== 
    3 * Hyphenation is not more stored in database (entries and comments) 
    4 * Admin action on entries limited to typo transformation 
    5 * Hyphenation disabled (unable to develop something good enough) 
     3* Admin action on entries - draft 
     4* Hyphenation feature removed from this plugin 
    65 
    76Typo plugin 1.3 for Dotclear 2 
  • plugins/typo/_admin.php

    r648 r655  
    1212 
    1313require_once dirname(__FILE__).'/inc/smartypants.php'; 
    14 require_once dirname(__FILE__).'/inc/hyphenation.php'; 
    1514 
    1615/* Add behavior callback, will be used for all types of posts (standard, page, galery item, ...) */ 
  • plugins/typo/_define.php

    r648 r655  
    1313$this->registerModule( 
    1414     /* Name */                    "Typo", 
    15      /* Description*/         "Brings smart typographic punctuation and soft hyphenation HTML entities for your entries", 
     15     /* Description*/         "Brings smart typographic replacements for your entries", 
    1616     /* Author */             "Franck Paul", 
    1717     /* Version */            '1.4', 
  • plugins/typo/_public.php

    r648 r655  
    1212 
    1313require_once dirname(__FILE__).'/inc/smartypants.php'; 
    14 require_once dirname(__FILE__).'/inc/hyphenation.php'; 
    1514 
    1615/* Add behavior callback for typo replacement in comments */ 
     
    1817$core->addBehavior('publicBeforeCommentPreview',array('dcTypo','previewTypoComments')); 
    1918 
    20 /* Add behavior callback for hyphenation in entries and comments */ 
    21 //$core->addBehavior('coreBlogGetPosts',array('dcTypo','prepareTypoEntries')); 
    22 //$core->addBehavior('coreBlogGetComments',array('dcTypo','prepareTypoComments')); 
    23  
    24 /* Add behavior callback for hyphenation in entries and comments */ 
    25 //$core->addBehavior('publicEntryBeforeContent',array('dcTypo','hyphenateEntry')); 
    26 //$core->addBehavior('publicCommentBeforeContent',array('dcTypo','hyphenateComment')); 
    27  
    2819class dcTypo 
    2920{ 
    30      public static function hyphenateEntry(&$core,&$_ctx) 
    31      { 
    32           if ($core->blog->settings->typo_active && $core->blog->settings->typo_hyphenation) 
    33           { 
    34                if ($_ctx->posts->exists('post_lang') && ($_ctx->posts->exists('post_excerpt_xhtml') || $_ctx->posts->exists('post_content_xhtml'))) { 
    35                     $language = $_ctx->posts->post_lang; 
    36                     $hyphenate = preset_hyphenation($language, $path_to_patterns, $dictionary, 
    37                          $leftmin, $rightmin, $charmin); 
    38                     if ($hyphenate) { 
    39                          if ($_ctx->posts->exists('post_excerpt_xhtml')) { 
    40                               $_ctx->posts->post_excerpt_xhtml = hyphenation($_ctx->posts->post_excerpt_xhtml, $language, $path_to_patterns, $dictionary, 
    41                                    $leftmin, $rightmin, $charmin); 
    42                          } 
    43                          if ($_ctx->posts->exists('post_content_xhtml')) { 
    44                               $_ctx->posts->post_content_xhtml = hyphenation($_ctx->posts->post_content_xhtml, $language, $path_to_patterns, $dictionary, 
    45                                    $leftmin, $rightmin, $charmin); 
    46                          } 
    47                     } 
    48                } 
    49           } 
    50      } 
    51  
    52      public static function hyphenateComment(&$core,&$_ctx) 
    53      { 
    54           if ($core->blog->settings->typo_active && $core->blog->settings->typo_hyphenation_comments) 
    55           { 
    56                if ($_ctx->posts->exists('post_lang') && $_ctx->comments->exists('comment_content')) { 
    57                     $language = $_ctx->posts->post_lang; 
    58                     $hyphenate = preset_hyphenation($language, $path_to_patterns, $dictionary, $leftmin, $rightmin, $charmin); 
    59                     if ($hyphenate) { 
    60                          $_ctx->comments->comment_content = hyphenation($_ctx->comments->comment_content, $language, $path_to_patterns, $dictionary, 
    61                               $leftmin, $rightmin, $charmin); 
    62                     } 
    63                } 
    64           } 
    65      } 
    66  
    67      public static function prepareTypoEntries(&$rs) 
    68      { 
    69           global $core; 
    70            
    71           if ($core->blog->settings->typo_active && $core->blog->settings->typo_hyphenation) 
    72           { 
    73                $rs = $rs->toStatic(); 
    74                if ($rs->exists('post_lang') && ($rs->exists('post_excerpt_xhtml') || $rs->exists('post_content_xhtml'))) { 
    75                     while ($rs->fetch()) { 
    76                          $language = $rs->post_lang; 
    77                          $hyphenate = preset_hyphenation($language, $path_to_patterns, $dictionary, 
    78                               $leftmin, $rightmin, $charmin); 
    79                          if ($hyphenate) { 
    80                               if ($rs->exists('post_excerpt_xhtml')) { 
    81                                    $rs->post_excerpt_xhtml = hyphenation($rs->post_excerpt_xhtml, $language, $path_to_patterns, $dictionary, 
    82                                         $leftmin, $rightmin, $charmin); 
    83                               } 
    84                               if ($rs->exists('post_content_xhtml')) { 
    85                                    $rs->post_content_xhtml = hyphenation($rs->post_content_xhtml, $language, $path_to_patterns, $dictionary, 
    86                                         $leftmin, $rightmin, $charmin); 
    87                               } 
    88                          } 
    89                     } 
    90                } 
    91           } 
    92      } 
    93  
    94      public static function prepareTypoComments(&$rs) 
    95      { 
    96           global $core; 
    97           global $_ctx; 
    98            
    99           if ($core->blog->settings->typo_active && $core->blog->settings->typo_hyphenation_comments) 
    100           { 
    101                $rs = $rs->toStatic(); 
    102                if ($_ctx->posts->exists('post_lang') && $rs->exists('comment_content')) { 
    103                     while ($rs->fetch()) { 
    104                          $language = $_ctx->posts->post_lang; 
    105                          $hyphenate = preset_hyphenation($language, $path_to_patterns, $dictionary, $leftmin, $rightmin, $charmin); 
    106                          if ($hyphenate) { 
    107                               $rs->comment_content = hyphenation($rs->comment_content, $language, $path_to_patterns, $dictionary, 
    108                                    $leftmin, $rightmin, $charmin); 
    109                          } 
    110                     } 
    111                } 
    112           } 
    113      } 
    114  
    11521     public static function updateTypoComments(&$blog,&$cur) 
    11622     { 
  • plugins/typo/index.php

    r648 r655  
    3131          $core->blog->settings->put('typo_entries',true,'boolean'); 
    3232          $core->blog->settings->put('typo_comments',false,'boolean'); 
    33           $core->blog->settings->put('typo_hyphenation',false,'boolean'); 
    34           $core->blog->settings->put('typo_hyphenation_comments',false,'boolean'); 
    3533          $core->blog->triggerBlog(); 
    3634          http::redirect(http::getSelfURI()); 
     
    5957$typo_entries = (boolean)$core->blog->settings->typo_entries; 
    6058$typo_comments = (boolean)$core->blog->settings->typo_comments; 
    61 $typo_hyphenation = (boolean)$core->blog->settings->typo_hyphenation; 
    62 $typo_hyphenation_comments = (boolean)$core->blog->settings->typo_hyphenation_comments; 
    6359 
    6460// Saving new configuration 
     
    7167          $typo_entries = (empty($_POST['entries']))?false:true; 
    7268          $typo_comments = (empty($_POST['comments']))?false:true; 
    73           $typo_hyphenation = (empty($_POST['hyphenation']))?false:true; 
    74           $typo_hyphenation_comments = (empty($_POST['hyphenation_comments']))?false:true; 
    7569          $core->blog->settings->put('typo_active',$typo_active,'boolean'); 
    7670          $core->blog->settings->put('typo_entries',$typo_entries,'boolean'); 
    7771          $core->blog->settings->put('typo_comments',$typo_comments,'boolean'); 
    78           $core->blog->settings->put('typo_hyphenation',$typo_hyphenation,'boolean'); 
    79           $core->blog->settings->put('typo_hyphenation_comments',$typo_hyphenation_comments,'boolean'); 
    8072          $core->blog->triggerBlog(); 
    8173          $msg = __('Configuration successfully updated.'); 
     
    119111          </p> 
    120112          <p class="form-note"><?php echo __('Activating this option enforces typographic replacements in blog comments (excluding trackbacks)'); ?></p> 
    121           <p class="field"> 
    122                <?php echo form::checkbox('hyphenation', 1, $typo_hyphenation); ?> 
    123                <label class="classic" for="hyphenation"><?php echo __('Enable hyphenation for entries'); ?></label> 
    124           </p> 
    125           <p class="form-note"><?php echo __('Activating this option enforces soft hyphenation insertion in blog entries'); ?></p> 
    126           <p class="field"> 
    127                <?php echo form::checkbox('hyphenation_comments', 1, $typo_hyphenation_comments); ?> 
    128                <label class="classic" for="hyphenation_comments"><?php echo __('Enable hyphenation for comments'); ?></label> 
    129           </p> 
    130           <p class="form-note"><?php echo __('Activating this option enforces soft hyphenation insertion in blog comments (excluding trackbacks)'); ?></p> 
    131113     </fieldset> 
    132114 
  • plugins/typo/locales/fr/main.po

    r648 r655  
    77"Project-Id-Version: Dotclear 2 typo extension\n" 
    88"Report-Msgid-Bugs-To: \n" 
    9 "POT-Creation-Date: 2008-12-25 17:16+0100\n" 
    10 "PO-Revision-Date: 2008-12-25 17:17+0100\n" 
     9"POT-Creation-Date: 2009-01-05 19:57+0100\n" 
     10"PO-Revision-Date: 2009-01-05 19:58+0100\n" 
    1111"Last-Translator: Franck Paul <carnet.franck.paul@gmail.com>\n" 
    1212"Language-Team: Franck Paul <franck.paul@free.fr>\n" 
     
    3030msgstr "Appliquer les remplacements typographiques pour les billets sélectionnés" 
    3131 
    32 msgid "Apply soft hyphenation insertion for selected entries" 
    33 msgstr "Appliquer l'insertion de marques de césure optionnelles pour les billets sélectionnés" 
     32msgid "Warning! These replacements will not be undoable." 
     33msgstr "Attention ces remplacements sont irreversibles." 
    3434 
    3535msgid "Configuration successfully updated." 
     
    5757msgstr "Activer cette option permet le remplacement des éléments typographiques pour les commentaires (rétroliens exclus)" 
    5858 
    59 msgid "Enable hyphenation for entries" 
    60 msgstr "Activer l'insertion des marques de césure optionnelles" 
    61  
    62 msgid "Activating this option enforces soft hyphenation insertion in blog entries" 
    63 msgstr "Activer cette option permet l'insertion de marques de césure optionnelles dans le contenu des billets de ce blog" 
    64  
    65 msgid "Enable hyphenation for comments" 
    66 msgstr "Activer l'insertion des marques de césure optionnelles pour les commentaires également" 
    67  
    68 msgid "Activating this option enforces soft hyphenation insertion in blog comments (excluding trackbacks)" 
    69 msgstr "Activer cette option permet l'insertion de marques de césure optionnelles pour les commentaires (rétroliens exclus)" 
    70  
    7159msgid "Save configuration" 
    7260msgstr "Enregistrer la configuration" 
    7361 
     62#~ msgid "Apply soft hyphenation insertion for selected entries" 
     63#~ msgstr "Appliquer l'insertion de marques de césure optionnelles pour les billets sélectionnés" 
     64#~ msgid "Enable hyphenation for entries" 
     65#~ msgstr "Activer l'insertion des marques de césure optionnelles" 
     66#~ msgid "Activating this option enforces soft hyphenation insertion in blog entries" 
     67#~ msgstr "Activer cette option permet l'insertion de marques de césure optionnelles dans le contenu des billets de ce blog" 
     68#~ msgid "Enable hyphenation for comments" 
     69#~ msgstr "Activer l'insertion des marques de césure optionnelles pour les commentaires également" 
     70#~ msgid "Activating this option enforces soft hyphenation insertion in blog comments (excluding trackbacks)" 
     71#~ msgstr "Activer cette option permet l'insertion de marques de césure optionnelles pour les commentaires (rétroliens exclus)" 
    7472#~ msgid "Activating this plugin enforces typographic replacements in blog entries" 
    7573#~ msgstr "Activer cette extension permet le remplacement des éléments typographiques dans le contenu des billets de ce blog" 
Note: See TracChangeset for help on using the changeset viewer.

Sites map