Changeset 3034
- Timestamp:
- 05/14/11 23:43:45 (12 years ago)
- Location:
- plugins/contribute
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/contribute/_define.php
r2940 r3034 28 28 /* Description*/ "Allow visitors to write an entry for your blog", 29 29 /* Author */ "Moe (http://gniark.net/)", 30 /* Version */ '1.0-alpha3 1',30 /* Version */ '1.0-alpha32', 31 31 /* Permissions */ 'admin' 32 32 ); -
plugins/contribute/default-templates/contribute.html
r2725 r3034 286 286 287 287 <tpl:ContributeIf tags="1"> 288 <p>289 <label for="post_tags">{{tpl:lang Tags}} ({{tpl:lang separate tags by a comma}}) ({{tpl:lang optional}}) :</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 295 288 <tpl:Tags type="tag"> 296 289 <tpl:LoopPosition start="1" length="1"> … … 308 301 </tpl:LoopPosition> 309 302 </tpl:Tags> 303 304 <p> 305 <label for="post_tags">{{tpl:lang Tags}} ({{tpl:lang separate tags by a comma}}) ({{tpl:lang optional}}) :</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> 310 310 </tpl:ContributeIf> 311 311 -
plugins/contribute/inc/lib.contribute.document.php
r2940 r3034 69 69 $_ctx->contribute->selected_tags = array(); 70 70 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; 86 73 87 74 # My Meta … … 103 90 $mymeta_sections = array(); 104 91 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); 136 108 } 137 109 else -
plugins/contribute/inc/lib.contribute.php
r2940 r3034 87 87 if (!is_array($mymeta_values)) {$mymeta_values = array();} 88 88 89 if (version_compare(DC_VERSION,'2.2-alpha1','>='))89 foreach ($mymeta->getAll() as $meta) 90 90 { 91 foreach ($mymeta->getAll() as $meta) 91 # section 92 if ($meta instanceof myMetaSection) 92 93 { 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') 95 108 { 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 { 98 118 $array[] = array( 99 119 'id' => $meta->id, 100 'type' => 'section',120 'type' => $meta->getMetaTypeId(), 101 121 'prompt' => $meta->prompt, 122 'default' => $meta->default, 123 'values' => $values, 102 124 'active' => $active 103 125 ); 104 126 } 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 else114 {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' => $active127 );128 }129 }130 127 } 131 128 } 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 153 130 return(staticRecord::newFromArray($array)); 154 131 } -
plugins/contribute/index.php
r2940 r3034 45 45 46 46 $settings->put('contribute_help', 47 base64_encode($_POST['contribute_help']),' String','Help');47 base64_encode($_POST['contribute_help']),'string','Help'); 48 48 $settings->put('contribute_default_post', 49 49 $_POST['contribute_default_post'],'integer','Default post'); … … 346 346 __('My Meta')); 347 347 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')); 357 349 ?> 358 350 </label> … … 360 352 361 353 <?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')) 365 355 { 366 356 $mymeta = new myMeta($core);
Note: See TracChangeset
for help on using the changeset viewer.