Changeset 11586


Ignore:
Timestamp:
07/01/11 12:16:30 (9 years ago)
Author:
plg
Message:

feature 2372 added: shortcut to edit CSS file from the themes page. If plugin
LocalFiles Editor is active, a link "CSS" is displayed under each active theme
and goes directly to the CSS edition page.

Location:
trunk/plugins/LocalFilesEditor
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/LocalFilesEditor/include/css.inc.php

    r11362 r11586  
    1010{ 
    1111  $edited_file = $_POST['edited_file']; 
     12} 
     13elseif (isset($_GET['theme']) and in_array($_GET['theme'], array_keys(get_pwg_themes()))) 
     14{ 
     15  $edited_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$_GET['theme'].'-rules.css'; 
    1216} 
    1317else 
  • trunk/plugins/LocalFilesEditor/main.inc.php

    r10351 r11586  
    4747} 
    4848 
     49function localfiles_css_link() 
     50{ 
     51  global $template; 
     52   
     53  $template->set_prefilter('themes', 'localfiles_css_link_prefilter'); 
     54} 
     55 
     56function localfiles_css_link_prefilter($content, &$smarty) 
     57{ 
     58  $search = '#{if isset\(\$theme.admin_uri\)}.*?{/if}#s'; 
     59  $replacement = ' 
     60{if isset($theme.admin_uri)} 
     61      <br><a href="{$theme.admin_uri}" title="{\'Configuration\'|@translate}">{\'Configuration\'|@translate}</a> 
     62      | <a href="admin.php?page=plugin-LocalFilesEditor-css&amp;theme={$theme.id}">CSS</a> 
     63{else} 
     64      <br><a href="admin.php?page=plugin-LocalFilesEditor-css&amp;theme={$theme.id}">CSS</a> 
     65{/if} 
     66'; 
     67 
     68  return preg_replace($search, $replacement, $content); 
     69} 
     70 
    4971add_event_handler('get_admin_plugin_menu_links', 'localfiles_admin_menu'); 
    50  
     72add_event_handler('loc_begin_admin', 'localfiles_css_link'); 
    5173?> 
Note: See TracChangeset for help on using the changeset viewer.