Dotclear

Changeset 3034


Ignore:
Timestamp:
05/14/11 23:43:45 (12 years ago)
Author:
Moe
Message:

Contribute 1.0-alpha32: removed tests for Dotclear < 2.2

Location:
plugins/contribute
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • plugins/contribute/_define.php

    r2940 r3034  
    2828     /* Description*/                "Allow visitors to write an entry for your blog", 
    2929     /* Author */                    "Moe (http://gniark.net/)", 
    30      /* Version */                   '1.0-alpha31', 
     30     /* Version */                   '1.0-alpha32', 
    3131     /* Permissions */               'admin' 
    3232); 
  • plugins/contribute/default-templates/contribute.html

    r2725 r3034  
    286286                
    287287               <tpl:ContributeIf tags="1"> 
    288                     <p> 
    289                          <label for="post_tags">{{tpl:lang Tags}} ({{tpl:lang separate tags by a comma}}) ({{tpl:lang optional}})&nbsp;:</label> 
    290                          <!-- # avoid unnecessary spaces and line breaks --> 
    291                          <input type="text" name="post_tags" id="post_tags" 
    292                               value="<tpl:EntryTags>{{tpl:TagID}}<tpl:LoopPosition start="1" length="-1">, </tpl:LoopPosition></tpl:EntryTags>" /> 
    293                     </p> 
    294                      
    295288              <tpl:Tags type="tag"> 
    296289                   <tpl:LoopPosition start="1" length="1"> 
     
    308301                   </tpl:LoopPosition> 
    309302              </tpl:Tags> 
     303 
     304                    <p> 
     305                         <label for="post_tags">{{tpl:lang Tags}} ({{tpl:lang separate tags by a comma}}) ({{tpl:lang optional}})&nbsp;:</label> 
     306                         <!-- # avoid unnecessary spaces and line breaks --> 
     307                         <input type="text" name="post_tags" id="post_tags" 
     308                              value="<tpl:EntryTags>{{tpl:TagID}}<tpl:LoopPosition start="1" length="-1">, </tpl:LoopPosition></tpl:EntryTags>" /> 
     309                    </p> 
    310310            </tpl:ContributeIf> 
    311311          
  • plugins/contribute/inc/lib.contribute.document.php

    r2940 r3034  
    6969          $_ctx->contribute->selected_tags = array(); 
    7070           
    71           # Compatibility test 
    72           if (version_compare(DC_VERSION,'2.2-alpha1','>=')) 
    73           { 
    74                $meta =& $core->meta; 
    75           } else { 
    76                # Metadata 
    77                if ($core->plugins->moduleExists('metadata')) 
    78                { 
    79                     $meta = new dcMeta($core); 
    80                } 
    81                else 
    82                { 
    83                     $meta = false; 
    84                } 
    85           } 
     71          # Metadata 
     72          $meta =& $core->meta; 
    8673           
    8774          # My Meta 
     
    10390                    $mymeta_sections = array(); 
    10491                     
    105                     if (version_compare(DC_VERSION,'2.2-alpha1','>=')) 
    106                     { 
    107                          foreach ($_ctx->contribute->mymeta->getAll() as $meta_tmp) 
    108                          { 
    109                               # ignore sections 
    110                               if ($meta_tmp instanceof myMetaSection) 
    111                               { 
    112                                    $mymeta[] = $meta_tmp->id; 
    113                                    $mymeta_sections[] = $meta_tmp->id; 
    114                               } 
    115                               elseif (((bool) $meta_tmp->enabled) 
    116                                    && in_array($meta_tmp->id,$mymeta_values)) 
    117                               { 
    118                                    $mymeta[] = $meta_tmp->id; 
    119                               } 
    120                          } 
    121                           
    122                          unset($meta_tmp,$mymeta_values); 
    123                     } 
    124                     else 
    125                     { 
    126                          foreach ($_ctx->contribute->mymeta->getAll() as $k => $v) 
    127                          { 
    128                               if (((bool) $v->enabled) && in_array($k,$mymeta_values)) 
    129                               { 
    130                                    $mymeta[] = $k; 
    131                               } 
    132                          } 
    133                           
    134                          unset($mymeta_values); 
    135                     } 
     92                    foreach ($_ctx->contribute->mymeta->getAll() as $meta_tmp) 
     93                    { 
     94                         # ignore sections 
     95                         if ($meta_tmp instanceof myMetaSection) 
     96                         { 
     97                              $mymeta[] = $meta_tmp->id; 
     98                              $mymeta_sections[] = $meta_tmp->id; 
     99                         } 
     100                         elseif (((bool) $meta_tmp->enabled) 
     101                              && in_array($meta_tmp->id,$mymeta_values)) 
     102                         { 
     103                              $mymeta[] = $meta_tmp->id; 
     104                         } 
     105                    } 
     106                     
     107                    unset($meta_tmp,$mymeta_values); 
    136108               } 
    137109               else 
  • plugins/contribute/inc/lib.contribute.php

    r2940 r3034  
    8787          if (!is_array($mymeta_values)) {$mymeta_values = array();} 
    8888           
    89           if (version_compare(DC_VERSION,'2.2-alpha1','>=')) 
     89          foreach ($mymeta->getAll() as $meta) 
    9090          { 
    91                foreach ($mymeta->getAll() as $meta) 
     91               # section 
     92               if ($meta instanceof myMetaSection) 
    9293               { 
    93                     # section 
    94                     if ($meta instanceof myMetaSection) 
     94                    $active = in_array($meta->id,$mymeta_values); 
     95                     
     96                    $array[] = array( 
     97                         'id' => $meta->id, 
     98                         'type' => 'section', 
     99                         'prompt' => $meta->prompt, 
     100                         'active' => $active 
     101                    ); 
     102               } 
     103               elseif ($meta->enabled) 
     104               { 
     105                    $active = in_array($meta->id,$mymeta_values); 
     106                     
     107                    if ($meta->getMetaTypeId() == 'list') 
    95108                    { 
    96                          $active = in_array($meta->id,$mymeta_values); 
    97                           
     109                         $values = $meta->values; 
     110                    } 
     111                    else 
     112                    { 
     113                         $values = ''; 
     114                    } 
     115                     
     116                    if ($all || $active) 
     117                    { 
    98118                         $array[] = array( 
    99119                              'id' => $meta->id, 
    100                               'type' => 'section', 
     120                              'type' => $meta->getMetaTypeId(), 
    101121                              'prompt' => $meta->prompt, 
     122                              'default' => $meta->default, 
     123                              'values' => $values, 
    102124                              'active' => $active 
    103125                         ); 
    104126                    } 
    105                     elseif ($meta->enabled) 
    106                     { 
    107                          $active = in_array($meta->id,$mymeta_values); 
    108                           
    109                          if ($meta->getMetaTypeId() == 'list') 
    110                          { 
    111                               $values = $meta->values; 
    112                          } 
    113                          else 
    114                          { 
    115                               $values = ''; 
    116                          } 
    117                           
    118                          if ($all || $active) 
    119                          { 
    120                               $array[] = array( 
    121                                    'id' => $meta->id, 
    122                                    'type' => $meta->getMetaTypeId(), 
    123                                    'prompt' => $meta->prompt, 
    124                                    'default' => $meta->default, 
    125                                    'values' => $values, 
    126                                    'active' => $active 
    127                               ); 
    128                          } 
    129                     } 
    130127               } 
    131128          } 
    132           else 
    133           { 
    134                foreach ($mymeta->getAll() as $k => $v) 
    135                { 
    136                     if ($v->enabled) 
    137                     { 
    138                          $active = in_array($k,$mymeta_values); 
    139                          if ($all || $active) 
    140                          { 
    141                               $array[] = array( 
    142                                    'id' => $k, 
    143                                    'type' => $v->type, 
    144                                    'prompt' => $v->prompt, 
    145                                    'values' => $v->values, 
    146                                    'active' => $active 
    147                               ); 
    148                          } 
    149                     } 
    150                } 
    151           } 
    152            
     129 
    153130          return(staticRecord::newFromArray($array)); 
    154131     } 
  • plugins/contribute/index.php

    r2940 r3034  
    4545           
    4646          $settings->put('contribute_help', 
    47                base64_encode($_POST['contribute_help']),'String','Help'); 
     47               base64_encode($_POST['contribute_help']),'string','Help'); 
    4848          $settings->put('contribute_default_post', 
    4949               $_POST['contribute_default_post'],'integer','Default post'); 
     
    346346                         __('My Meta')); 
    347347                         echo(' '); 
    348                          if (version_compare(DC_VERSION,'2.2-alpha1','>=')) 
    349                          { 
    350                               printf(__('It requires the %s plugin.'),__('My Meta')); 
    351                          } 
    352                          else 
    353                          { 
    354                               printf(__('It requires the %s and %s plugins.'), 
    355                               __('Metadata'),__('My Meta')); 
    356                          } 
     348                         printf(__('It requires the %s plugin.'),__('My Meta')); 
    357349                    ?> 
    358350                    </label> 
     
    360352                
    361353               <?php 
    362                     if (((version_compare(DC_VERSION,'2.2-alpha1','>=')) 
    363                          OR ($core->plugins->moduleExists('metadata'))) 
    364                          && $core->plugins->moduleExists('mymeta')) 
     354                    if ($core->plugins->moduleExists('mymeta')) 
    365355                    { 
    366356                         $mymeta = new myMeta($core); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map