Пример #1
0
function importThemeForm(){
	if($_FILES){
		WP_Filesystem();
		move_uploaded_file($_FILES["template"]["tmp_name"], THEME_CACHE_DIR."/" . $_FILES["template"]["name"]);
		$nfile = THEME_CACHE_DIR."/" . $_FILES["template"]["name"];
		$folder = THEME_CACHE_DIR.'/'.str_replace('.zip', '', $_FILES["template"]["name"]);
		$unzipit = unzip_file($nfile, $folder);
		$files = WonderWorksHelper::getUTX($folder);
		if($files){
			foreach($files as $file){
				importTemplate($folder.DS.$file,$folder);
			}
		}	
	} else { 
?>
<h2><?php _e('Import a Template','ultimatum');?></h2>
<p></p>
<form action="" method="post"  enctype="multipart/form-data">
		<table class="widefat ult-tables">
			<tbody>
				<tr>
					<th><?php _e('File','ultimatum');?> :</th>
					<td><input type="file" name="template" /></td>
				</tr>
 				<tr class="alternate">
 					<th colspan="2"><?php _e('Options','ultimatum');?></th></tr>
 				<tr>
					<th><?php _e('Template Name','ultimatum');?> :</th>
					<td><input type="text" name="template_name" /><br />
					<?php _e('If you wish to have the imported template with a different name than its original type the name you desire','ultimatum');?></td>
				</tr>
				<tr>
					<th><?php _e('Import Assignments','ultimatum');?> :</th>
					<td>
						<select name="assigners">
						<option value="donot"><?php _e('Do not import layout assignments','ultimatum');?></option>
						<option value="assign"><?php _e('Import layout assignments','ultimatum');?></option>
						</select>
					<br />
					<?php _e('The imported template may have assignmets to post types categories etc. If you want those assignments to be imported set this option so.','ultimatum');?></td>
				</tr>
			</tbody>
		</table>
		<p><input type="submit" value="<?php _e('Import','ultimatum');?>" class="button button-primary"/></p>
</form>

<?php
	}
}
Пример #2
0
    $templatedst = current($store->call('system.get.template.php', $args, $store->get($cpath)));
    if (!$store->exists($cpath)) {
        // cannot install config on non-existing path
        print "{$cpath} doesn't exists, skipping\n";
    }
    if (!ar_error::isError($templatesrc)) {
        if (ar_error::isError($templatedst)) {
            // error means no template found
            // save template
            $args['template'] = $templatesrc;
            ar::get($cpath)->call('system.save.layout.phtml', $args);
        } else {
            print "Already a configfile defined on {$cpath}, please merge the following in your configfile " . $args['function'] . "\n";
            print $templatesrc . "\n";
        }
    } else {
        print "Error src template not found on {$cpath} \n";
    }
}
$args = array('type' => 'pdir', 'function' => 'config.ini', 'language' => 'any', 'default' => false);
$cpath = '/';
importTemplate($cpath, $args);
$args = array('type' => 'pobject', 'function' => 'typetree.ini', 'language' => 'any', 'default' => true);
$cpath = '/';
importTemplate($cpath, $args);
$args = array('type' => 'pproject', 'function' => 'config.ini', 'language' => 'any', 'default' => false);
$cpath = '/projects/';
importTemplate($cpath, $args);
?>
</pre>
Пример #3
0
                //add extension and save in default template directory
                $res = saveTemplate($template_body, $template_file);
                print json_format($res);
                break;
            case 'delete':
                $template_file = $dir . $template_file;
                if (file_exists($template_file)) {
                    unlink($template_file);
                } else {
                    throw new Exception("Template file does not exist");
                }
                header("Content-type: text/javascript");
                print json_format(array("ok" => $mode));
                break;
            case 'import':
                importTemplate();
                break;
            case 'serve':
                // TODO: convert template file to global concept IDs and serve up to caller
                smartyLocalIDsToConceptIDs($template_file);
                break;
        }
    } catch (Exception $e) {
        header("Content-type: text/javascript");
        print json_format(array("error" => $e->getMessage()));
    }
}
exit;
/**
 * Returns the list of available tempaltes as json array
 */
Пример #4
0
/**
 *
 * This file is a core Ultimatum file and should not be edited.
 *
 * @package  Ultimatum
 * @author   Wonder Foundry http://www.wonderfoundry.com
 * @link     http://ultimatumtheme.com
 * @version  2.8
 */

$check = getAllTemplates();
if(!$check) {
    $option = THEME_SLUG . '_layouts_installed';
    if (!get_option($option)) {
        require_once(ULTIMATUM_ADMIN_FUNCTIONS . '/template_import.php');
        $folder = THEME_DIR . DS . 'ultinstall';
        if (is_dir($folder)) {
            $files = WonderWorksHelper::getUTX($folder);
            if ($files) {
                foreach ($files as $file) {
                    importTemplate($folder . DS . $file, $folder, false, true);
                }
            }
            if (file_exists($folder . '/' . THEME_SLUG . '.fonts')) {
                $raw_content = file_get_contents($folder . '/' . THEME_SLUG . '.fonts');
                add_option(THEME_SLUG . '_fonts', $raw_content, false);
            }
            add_option($option, 'DONE', false);
        }
    }
}