</div> <!-- attach --> <?php if (!$manage_attachments) { ?> <form id="filetplselect" class="insert"> <h2><?php _e('Select Template', 'wp-filebase'); ?> </h2> <label><input type="radio" name="filetpl" value="" checked="checked" /><i><?php _e('Default Template', 'wp-filebase'); ?> </i></label><br /> <?php $tpls = WPFB_Core::GetFileTpls(); if (!empty($tpls)) { foreach ($tpls as $tpl_tag => $tpl_src) { echo '<label><input type="radio" name="filetpl" value="' . esc_attr($tpl_tag) . '" />' . esc_html($tpl_tag) . '</label><br />'; } } ?> <i><a href="<?php echo admin_url('admin.php?page=wpfilebase_tpls#file'); ?> " target="_parent"><?php _e('Add Template', 'wp-filebase'); ?> </a></i> </form> <div id="fileselect" class="container">
static function ParseTpls() { wpfb_loadclass('TplLib'); // parse default WPFB_Core::UpdateOption('template_file_parsed', WPFB_TplLib::Parse(WPFB_Core::$settings->template_file)); WPFB_Core::UpdateOption('template_cat_parsed', WPFB_TplLib::Parse(WPFB_Core::$settings->template_cat)); // parse custom update_option(WPFB_OPT_NAME . '_ptpls_file', WPFB_TplLib::Parse(WPFB_Core::GetFileTpls())); update_option(WPFB_OPT_NAME . '_ptpls_cat', WPFB_TplLib::Parse(WPFB_Core::GetCatTpls())); }
static function AddTpls($old_ver = null) { $def_tpls_file = array('filebrowser' => '%file_small_icon% <a href="%file_url%" title="Download %file_display_name%">%file_display_name%</a> (%file_size%)', 'download-button' => '<div style="text-align:center; width:250px; margin: auto; font-size:smaller;"><a href="%file_url%" class="wpfb-dlbtn"><div></div></a> %file_display_name% (%file_size%, %file_hits% downloads) </div>', 'image_320' => '[caption id="file_%file_id%" align="alignnone" width="320" caption="<!-- IF %file_description% -->%file_description%<!-- ELSE -->%file_display_name%<!-- ENDIF -->"]<img class="size-full" title="%file_display_name%" src="%file_url%" alt="%file_display_name%" width="320" />[/caption]' . "\n\n", 'thumbnail' => '<div class="wpfilebase-fileicon"><a href="%file_url%" title="Download %file_display_name%"><img align="middle" src="%file_icon_url%" /></a></div>' . "\n", 'simple' => '<p><img src="%file_icon_url%" style="height:20px;vertical-align:middle;" /> <a href="%file_url%" title="Download %file_display_name%">%file_display_name%</a> (%file_size%)</p>', '3-col-row' => '<tr><td><a href="%file_url%">%file_display_name%</a></td><td>%file_size%</td><td>%file_hits%</td></tr>', 'mp3' => '<div class="wpfilebase-attachment"> <div class="wpfilebase-fileicon"><a href="%file_url%" title="Download %file_display_name%"><img align="middle" src="%file_icon_url%" alt="%file_display_name%" height="80"/></a></div> <div class="wpfilebase-rightcol"> <div class="wpfilebase-filetitle"> <a href="%file_url%" title="Download %file_display_name%">%file_info/tags/id3v2/title%</a><br /> %file_info/tags/id3v2/artist%<br /> %file_info/tags/id3v2/album%<br /> <!-- IF %file_post_id% AND %post_id% != %file_post_id% --><a href="%file_post_url%" class="wpfilebase-postlink">%\'View post\'%</a><!-- ENDIF --> </div> </div> <div class="wpfilebase-fileinfo"> %file_info/playtime_string%<br /> %file_info/bitrate%<br /> %file_size%<br /> %file_hits% %\'Downloads\'%<br /> </div> <div style="clear: both;"></div> </div>', 'html5_video' => "<video width='%file_info/video/resolution_x%' height='%file_info/video/resolution_y%' controls>\n <source src='%file_url%' type='%file_type%'>\nYour browser does not support the video tag. <a href='%file_url%'>Open Video directly</a>.\n</video>", 'data-table' => '<tr><td><a href="%file_url%">%file_display_name%</a></td><td>%file_size%</td><td>%file_hits%</td></tr>'); $def_tpls_cat = array('filebrowser' => '%cat_small_icon% <a href="%cat_url%" onclick="return false;">%cat_name%</a>', '3-col-row' => '<tr><td colspan="3" style="text-align:center;font-size:120%;">%cat_name%</td></tr>', 'data-table' => '<!-- EMPTY: categories should not be listed in DataTables -->'); add_option(WPFB_OPT_NAME . '_tpls_file', $def_tpls_file, null, 'no'); add_option(WPFB_OPT_NAME . '_tpls_cat', $def_tpls_cat, null, 'no'); add_option(WPFB_OPT_NAME . '_ptpls_file', array(), null, 'no'); add_option(WPFB_OPT_NAME . '_ptpls_cat', array(), null, 'no'); $def_tpls_list = array('default' => array('header' => '', 'footer' => '', 'file_tpl_tag' => 'default', 'cat_tpl_tag' => 'default'), 'table' => array('header' => '%search_form% <table> <thead> <tr><th scope="col"><a href="%sortlink:file_name%">Name</a></th><th scope="col"><a href="%sortlink:file_size%">Size</a></th><th scope="col"><a href="%sortlink:file_hits%">Hits</a></th></tr> </thead> <tfoot> <tr><th scope="col"><a href="%sortlink:file_name%">Name</a></th><th scope="col"><a href="%sortlink:file_size%">Size</a></th><th scope="col"><a href="%sortlink:file_hits%">Hits</a></th></tr> </tfoot> <tbody>', 'footer' => '</tbody> </table> <div class="tablenav-pages">%page_nav%</div>', 'file_tpl_tag' => '3-col-row', 'cat_tpl_tag' => '3-col-row'), 'mp3-list' => array('header' => '', 'footer' => '', 'file_tpl_tag' => 'mp3', 'cat_tpl_tag' => 'default'), 'data-table' => array('header' => '%print_script:jquery-dataTables% %print_style:jquery-dataTables% <table id="wpfb-data-table-%uid%"> <thead> <tr><th scope="col">Name</th><th scope="col">Size</th><th scope="col">Hits</th></tr> </thead> <tbody>', 'footer' => '</tbody> </table> <script type="text/javascript" charset="utf-8"> jQuery(document).ready(function() { jQuery(\'#wpfb-data-table-%uid%\').DataTable(); } ); </script>', 'file_tpl_tag' => 'data-table', 'cat_tpl_tag' => 'data-table')); add_option(WPFB_OPT_NAME . '_list_tpls', $def_tpls_list, null, 'no'); // delete old (<0.2.0) tpl options and copy to new $old_tpls = get_option(WPFB_OPT_NAME . '_tpls'); delete_option(WPFB_OPT_NAME . '_tpls'); delete_option(WPFB_OPT_NAME . '_tpls_parsed'); if (!empty($old_tpls)) { $file_tpls = array_merge(WPFB_Core::GetFileTpls(), $old_tpls); WPFB_Core::SetFileTpls($file_tpls); } // add protected tpls $tpls_file = get_option(WPFB_OPT_NAME . '_tpls_file'); $tpls_cat = get_option(WPFB_OPT_NAME . '_tpls_cat'); $tpls_list = get_option(WPFB_OPT_NAME . '_list_tpls'); wpfb_loadclass('AdminGuiTpls'); $default_templates = WPFB_AdminGuiTpls::$protected_tags; // add new data table template if (!empty($old_ver)) { if (version_compare($old_ver, '0.2.9.22') < 0) { $default_templates[] = 'data-table'; $default_templates[] = 'download-button'; } } foreach ($default_templates as $pt) { if (empty($tpls_file[$pt]) && !empty($def_tpls_file[$pt])) { $tpls_file[$pt] = $def_tpls_file[$pt]; } if (empty($tpls_cat[$pt]) && !empty($def_tpls_cat[$pt])) { $tpls_cat[$pt] = $def_tpls_cat[$pt]; } if (empty($tpls_list[$pt]) && !empty($def_tpls_list[$pt])) { $tpls_list[$pt] = $def_tpls_list[$pt]; } } update_option(WPFB_OPT_NAME . '_tpls_file', $tpls_file); update_option(WPFB_OPT_NAME . '_tpls_cat', $tpls_cat); update_option(WPFB_OPT_NAME . '_list_tpls', $tpls_list); WPFB_Admin::ParseTpls(); }
static function AddTpls($old_ver = null) { $def_tpls_file = array('filebrowser' => '%file_small_icon% <a href="%file_url%" title="Download %file_display_name%">%file_display_name%</a> (%file_size%)', 'download-button' => '<div style="text-align:center; width:250px; margin: auto; font-size:smaller;"><a href="%file_url%" class="wpfb-dlbtn"><div></div></a> %file_display_name% (%file_size%, %file_hits% downloads) </div>', 'image_320' => '[caption id="file_%file_id%" align="alignnone" width="320" caption="<!-- IF %file_description% -->%file_description%<!-- ELSE -->%file_display_name%<!-- ENDIF -->"]<img class="size-full" title="%file_display_name%" src="%file_url%" alt="%file_display_name%" width="320" />[/caption]' . "\n\n", 'thumbnail' => '<div class="wpfilebase-fileicon"><a href="%file_url%" title="Download %file_display_name%"><img align="middle" src="%file_icon_url%" /></a></div>' . "\n", 'simple' => '<p><img src="%file_icon_url%" style="height:20px;vertical-align:middle;" /> <a href="%file_url%" title="Download %file_display_name%">%file_display_name%</a> (%file_size%)</p>', '3-col-row' => '<tr><td><a href="%file_url%">%file_display_name%</a></td><td>%file_size%</td><td>%file_hits%</td></tr>', 'mp3' => '<div class="wpfilebase-attachment"> <div class="wpfilebase-fileicon"><a href="%file_url%" title="Download %file_display_name%"><img align="middle" src="%file_icon_url%" alt="%file_display_name%" height="80"/></a></div> <div class="wpfilebase-rightcol"> <div class="wpfilebase-filetitle"> <a href="%file_url%" title="Download %file_display_name%">%file_info/tags/id3v2/title%</a><br /> %file_info/tags/id3v2/artist%<br /> %file_info/tags/id3v2/album%<br /> <!-- IF %file_post_id% AND %post_id% != %file_post_id% --><a href="%file_post_url%" class="wpfilebase-postlink">%\'View post\'%</a><!-- ENDIF --> </div> </div> <div class="wpfilebase-fileinfo"> %file_info/playtime_string%<br /> %file_info/bitrate%<br /> %file_size%<br /> %file_hits% %\'Downloads\'%<br /> </div> <div style="clear: both;"></div> </div>', 'flv-player' => "<!-- the player only works when permalinks are enabled!!! -->\r\n <object width='%file_info/video/resolution_x%' height='%file_info/video/resolution_y%' id='flvPlayer%uid%'>\r\n <param name='allowFullScreen' value='true'>\r\n <param name='allowScriptAccess' value='always'> \r\n <param name='movie' value='%wpfb_url%extras/flvplayer/OSplayer.swf?movie=%file_url_encoded%&btncolor=0x333333&accentcolor=0x31b8e9&txtcolor=0xdddddd&volume=30&autoload=on&autoplay=off&vTitle=%file_display_name%&showTitle=yes'>\r\n <embed src='%wpfb_url%extras/flvplayer/OSplayer.swf?movie=%file_url_encoded%&btncolor=0x333333&accentcolor=0x31b8e9&txtcolor=0xdddddd&volume=30&autoload=on&autoplay=off&vTitle=%file_display_name%&showTitle=yes' width='%file_info/video/resolution_x%' height='%file_info/video/resolution_y%' allowFullScreen='true' type='application/x-shockwave-flash' allowScriptAccess='always'>\r\n </object>", 'data-table' => '<tr><td><a href="%file_url%">%file_display_name%</a></td><td>%file_size%</td><td>%file_hits%</td></tr>'); $def_tpls_cat = array('filebrowser' => '%cat_small_icon% <a href="%cat_url%" onclick="return false;">%cat_name%</a>', '3-col-row' => '<tr><td colspan="3" style="text-align:center;font-size:120%;">%cat_name%</td></tr>', 'data-table' => '<!-- EMPTY: categories should not be listed in DataTables -->'); add_option(WPFB_OPT_NAME . '_tpls_file', $def_tpls_file, null, 'no'); add_option(WPFB_OPT_NAME . '_tpls_cat', $def_tpls_cat, null, 'no'); add_option(WPFB_OPT_NAME . '_ptpls_file', array(), null, 'no'); add_option(WPFB_OPT_NAME . '_ptpls_cat', array(), null, 'no'); $def_tpls_list = array('default' => array('header' => '', 'footer' => '', 'file_tpl_tag' => 'default', 'cat_tpl_tag' => 'default'), 'table' => array('header' => '%search_form% <table> <thead> <tr><th scope="col"><a href="%sortlink:file_name%">Name</a></th><th scope="col"><a href="%sortlink:file_size%">Size</a></th><th scope="col"><a href="%sortlink:file_hits%">Hits</a></th></tr> </thead> <tfoot> <tr><th scope="col"><a href="%sortlink:file_name%">Name</a></th><th scope="col"><a href="%sortlink:file_size%">Size</a></th><th scope="col"><a href="%sortlink:file_hits%">Hits</a></th></tr> </tfoot> <tbody>', 'footer' => '</tbody> </table> <div class="tablenav-pages">%page_nav%</div>', 'file_tpl_tag' => '3-col-row', 'cat_tpl_tag' => '3-col-row'), 'mp3-list' => array('header' => '', 'footer' => '', 'file_tpl_tag' => 'mp3', 'cat_tpl_tag' => 'default'), 'data-table' => array('header' => '%print_script:jquery-dataTables% %print_style:jquery-dataTables% <table id="wpfb-data-table-%uid%"> <thead> <tr><th scope="col">Name</th><th scope="col">Size</th><th scope="col">Hits</th></tr> </thead> <tbody>', 'footer' => '</tbody> </table> <script type="text/javascript" charset="utf-8"> jQuery(document).ready(function() { jQuery(\'#wpfb-data-table-%uid%\').dataTable(); } ); </script>', 'file_tpl_tag' => 'data-table', 'cat_tpl_tag' => 'data-table')); add_option(WPFB_OPT_NAME . '_list_tpls', $def_tpls_list, null, 'no'); // delete old (<0.2.0) tpl options and copy to new $old_tpls = get_option(WPFB_OPT_NAME . '_tpls'); delete_option(WPFB_OPT_NAME . '_tpls'); delete_option(WPFB_OPT_NAME . '_tpls_parsed'); if (!empty($old_tpls)) { $file_tpls = array_merge(WPFB_Core::GetFileTpls(), $old_tpls); WPFB_Core::SetFileTpls($file_tpls); } // add protected tpls $tpls_file = get_option(WPFB_OPT_NAME . '_tpls_file'); $tpls_cat = get_option(WPFB_OPT_NAME . '_tpls_cat'); $tpls_list = get_option(WPFB_OPT_NAME . '_list_tpls'); wpfb_loadclass('AdminGuiTpls'); $default_templates = WPFB_AdminGuiTpls::$protected_tags; // add new data table template if (!empty($old_ver)) { if (version_compare($old_ver, '0.2.9.22') < 0) { $default_templates[] = 'data-table'; $default_templates[] = 'download-button'; } } foreach ($default_templates as $pt) { if (empty($tpls_file[$pt]) && !empty($def_tpls_file[$pt])) { $tpls_file[$pt] = $def_tpls_file[$pt]; } if (empty($tpls_cat[$pt]) && !empty($def_tpls_cat[$pt])) { $tpls_cat[$pt] = $def_tpls_cat[$pt]; } if (empty($tpls_list[$pt]) && !empty($def_tpls_list[$pt])) { $tpls_list[$pt] = $def_tpls_list[$pt]; } } update_option(WPFB_OPT_NAME . '_tpls_file', $tpls_file); update_option(WPFB_OPT_NAME . '_tpls_cat', $tpls_cat); update_option(WPFB_OPT_NAME . '_list_tpls', $tpls_list); WPFB_Admin::ParseTpls(); }