Ignore:
Timestamp:
Apr 9, 2010, 12:26:04 AM (14 years ago)
Author:
patdenice
Message:

2.1 ready!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/PWG_Stuffs/include/class.inc.php

    r3609 r5727  
    9595        $block['U_EDIT'] = PHPWG_ROOT_PATH.'admin.php?page=plugin&section='.STUFFS_DIR.'%2Fadmin%2Fadd_module.php&type='.$module['type'].'&edit='.$module['id'];
    9696      }
    97       $block['TEMPLATE'] = realpath($this->get_template($module['type'].'.tpl'));
     97      $block['TEMPLATE'] = 'stuffs_'.$module['type'].'.tpl';
    9898        $this->set_tpl_block($block, $module);
    9999    }
     
    169169        }
    170170
    171   /* Return template for user template/theme*/
    172   function get_template($file)
    173   {
    174     global $user, $template;
    175 
    176     $dir = STUFFS_PATH . 'template/';
    177     $theme_file = $dir.$user['template'].'/'.$user['theme'].'/'.$file;
    178     $template_file = $dir.$user['template'].'/'.$file;
    179 
    180     if (file_exists($theme_file))
    181     {
    182       return $theme_file;
    183     }
    184     elseif (file_exists($template_file))
    185     {
    186       return $template_file;
    187     }
    188     else
    189     {
    190       return $dir.$file;
    191     }
     171  static function prefilter_index_css($source, &$smarty)
     172  {
     173    $css = array(
     174      '<link rel="stylesheet" type="text/css" href="{$ROOT_URL}plugins/PWG_Stuffs/theme/stuffs_index.css">'
     175    );
     176
     177    foreach ($smarty->get_template_vars('themes') as $theme)
     178    {
     179      if (file_exists(PHPWG_THEMES_DIR.$theme['id'].'/stuffs_index.css'))
     180      {
     181        array_push($css, '<link rel="stylesheet" type="text/css" href="{$ROOT_URL}themes/'.$theme['id'].'/stuffs_index.css">');
     182      }
     183    }
     184
     185    $source = str_replace("\n</head>", "\n".implode( "\n", $css )."\n</head>", $source);
     186
     187    return $source;
     188  }
     189
     190  static function prefilter_picture_css($source, &$smarty)
     191  {
     192    $css = array(
     193      '<link rel="stylesheet" type="text/css" href="{$ROOT_URL}plugins/PWG_Stuffs/theme/stuffs_picture.css">'
     194    );
     195
     196    foreach ($smarty->get_template_vars('themes') as $theme)
     197    {
     198      if (file_exists(PHPWG_THEMES_DIR.$theme['id'].'/stuffs_picture.css'))
     199      {
     200        array_push($css, '<link rel="stylesheet" type="text/css" href="{$ROOT_URL}themes/'.$theme['id'].'/stuffs_picture.css">');
     201      }
     202    }
     203
     204    if (!empty($css))
     205    {
     206      $source = str_replace("\n</head>", "\n".implode( "\n", $css )."\n</head>", $source);
     207    }
     208
     209    return $source;
    192210  }
    193211}
Note: See TracChangeset for help on using the changeset viewer.