Показать сообщение отдельно

  #1015  
Старый 13.06.2010, 14:15
Аватар для BlackSun
BlackSun
Members of Antichat - Level 5
Регистрация: 01.04.2007
Сообщений: 1,268
Провел на форуме:
10046345

Репутация: 4589


По умолчанию

Разрезание VB плагинов на отдельные файлы (только шаблоны и хуки).

PHP код:
<?php
    
require_once('vb/includes/class_xml.php');
    
$templates_dir '/';
    
$plugins_dir '/';

    
/* 
    $templates_dir = '/tpl/';
    $plugins_dir = '/hooks/';
    */
    
    
$xmlobj = new vB_XML_Parser(file_get_contents($_GET['file']));
    if (
$xmlobj->error_no == 1) {
        die(
'Error. XML_Parser::__create');
    }
    
    if(!
$arr $xmlobj->parse()) {
        echo 
$xmlobj->error_string(), '<br />'$xmlobj->error_line();
        die();
    }
    
    
$dir dirname($_GET['file']);
    
file_put_contents($dir'/info.txt'"{$arr['productid']} ({$arr['version']})\r\n".
                    
"{$arr['title']}\r\n".
                    
"{$arr['description']}\r\n");

    
file_put_contents($dir'/installcode.php'$arr['codes']['code']['installcode']);
    foreach (
$arr['templates']['template'] as $template) {
        
file_put_contents($dir$templates_dir$template['name']. '.tpl.php'$template['value']);
    }

    foreach (
$arr['plugins']['plugin'] as $id => $plugin) {
        
file_put_contents($dir$plugins_dir$id'_'$plugin['hookname']. '.hook.php'$plugin['phpcode']);
    }
?>
 
Ответить с цитированием