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

2.1 ready!

Location:
extensions/PWG_Stuffs/include
Files:
2 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}
  • extensions/PWG_Stuffs/include/stuffs.inc.php

    r4968 r5727  
    1010$stuffs = new stuffs();
    1111
    12 $template->set_filename('stuffs', realpath($stuffs->get_template('blocks.tpl')));
     12$template->set_template_dir(STUFFS_PATH.'theme/template/');
     13$template->set_filename('stuffs', 'stuffs_blocks.tpl');
    1314
    1415if (script_basename() == 'index')
     
    1617  $begin = 'PLUGIN_INDEX_CONTENT_BEFORE';
    1718  $end = 'PLUGIN_INDEX_CONTENT_AFTER';
    18   $css_file = 'index.css';
     19  $template->set_prefilter( 'header', array('stuffs', 'prefilter_index_css') );
    1920}
    2021else
     
    2223  $begin = 'PLUGIN_PICTURE_BEFORE';
    2324  $end = 'PLUGIN_PICTURE_AFTER';
    24   $css_file = 'picture.css';
     25  $template->set_prefilter('header', array('stuffs', 'prefilter_picture_css'));
    2526  pwgs_picture_special_sections();
    2627}
     
    3738}
    3839
    39 $template->block_html_head('', '<link rel="stylesheet" type="text/css" href="'.get_root_url().ltrim($stuffs->get_template($css_file), '/\\.').'">', $smarty, $repeat);
    40 
    4140?>
Note: See TracChangeset for help on using the changeset viewer.