Changeset 3333:11107ba2fc59 for inc
- Timestamp:
- 09/01/16 12:21:43 (9 years ago)
- Branch:
- default
- Location:
- inc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/lib.moduleslist.php
r3327 r3333 466 466 'sshot' => '', 467 467 'score' => 0, 468 'type' => null 468 'type' => null, 469 'require' => array(), 470 'settings' => array() 469 471 ), 470 472 # Module's values … … 744 746 if (!empty($more)) { 745 747 echo 746 '<li>'.implode(' - ', 748 '<li>'.implode(' - ',$more).'</li>'; 747 749 } 748 750 … … 753 755 $config = !empty($module['root']) && file_exists(path::real($module['root'].'/_config.php')); 754 756 755 if ($config || !empty($module['section']) || !empty($module['tags']) ) {757 if ($config || !empty($module['section']) || !empty($module['tags']) || !empty($module['settings'])) { 756 758 echo 757 759 '<div><ul class="mod-more">'; 758 760 759 if ($config) {760 echo761 '<li><a class="module-config" href="'.$this->getURL('module='.$id.'&conf=1').'">'.__('Configure plugin').'</a></li>';761 $settings = $this->getSettingsUrls($this->core,$id); 762 if (!empty($settings)) { 763 echo '<li>'.implode(' - ',$settings).'</li>'; 762 764 } 763 765 … … 806 808 807 809 return $this; 810 } 811 812 /** 813 * Get settings URLs if any 814 * 815 * @param object $core 816 * @param string $id module ID 817 * @param boolean $check check permission 818 * @param boolean $self include self URL (→ plugin index.php URL) 819 * @return Array of settings URLs 820 */ 821 public static function getSettingsUrls($core,$id,$check=false,$self=true) 822 { 823 $st = array(); 824 825 $config = !empty($core->plugins->moduleRoot($id)) && 826 file_exists(path::real($core->plugins->moduleRoot($id).'/_config.php')); 827 $settings = $core->plugins->moduleInfo($id,'settings'); 828 if ($config || !empty($settings)) { 829 if ($config) { 830 $st[] = '<a class="module-config" href="'. 831 $core->adminurl->get('admin.plugins',array('module' => $id,'conf' => '1')). 832 '">'.__('Configure plugin').'</a>'; 833 } 834 if (is_array($settings)) { 835 foreach ($settings as $sk => $sv) { 836 switch ($sk) { 837 case 'blog': 838 if ((!$check) || 839 ($check && $core->auth->check('admin',$core->blog->id))) { 840 $st[] = '<a class="module-config" href="'. 841 $core->adminurl->get('admin.blog.pref').$sv. 842 '">'.__('Plugin settings (in blog parameters)').'</a>'; 843 } 844 break; 845 case 'pref': 846 if ((!$check) || 847 ($check && $core->auth->check('usage,contentadmin',$core->blog->id))) { 848 $st[] = '<a class="module-config" href="'. 849 $core->adminurl->get('admin.user.preferences').$sv. 850 '">'.__('Plugin settings (in user preferences)').'</a>'; 851 } 852 break; 853 case 'self': 854 if ($self) { 855 if ((!$check) || 856 ($check && $core->auth->check($core->plugins->moduleInfo($id,'permissions'),$core->blog->id))) { 857 $st[] = '<a class="module-config" href="'. 858 $core->adminurl->get('admin.plugin.'.$id).$sv. 859 '">'.__('Plugin settings').'</a>'; 860 } 861 } 862 break; 863 } 864 } 865 } 866 } 867 868 return $st; 808 869 } 809 870 -
inc/core/class.dc.modules.php
r3135 r3333 283 283 (currently available keys : permissions, priority, type) 284 284 */ 285 public function registerModule($name,$desc,$author,$version, 285 public function registerModule($name,$desc,$author,$version,$properties = array()) 286 286 { 287 287 if ($this->disabled_mode) { … … 320 320 'type' => null, 321 321 'enabled' => true, 322 'requires' => array() 322 'requires' => array(), 323 'settings' => array() 323 324 ), $properties 324 325 );
Note: See TracChangeset
for help on using the changeset viewer.