Пример #1
0
 static function campanhaPreviewFlyer()
 {
     $class = filter_input(INPUT_GET, 'type', FILTER_SANITIZE_STRING);
     if (class_exists($class)) {
         $graphicMaterial = GraphicMaterialFactory::build($class);
         $graphicMaterial->preview();
     }
 }
<?php

require_once WPMU_PLUGIN_DIR . '/includes/graphic_material/GraphicMaterialFactory.php';
$smallFlyer = GraphicMaterialFactory::build('SmallFlyer');
if (isset($_POST['save'])) {
    check_admin_referer('graphic_material');
    try {
        $smallFlyer->save();
        $smallFlyer->export();
    } catch (Exception $e) {
        echo "<div class='error'><p>{$e->getMessage()}</p></div>";
    }
}
?>

<div id="graphic-material-smallflyer">
    <h1>Santinho e colinha</h1>
    <div id="graphic_material_content">
        <h3>1. Envie uma foto:</h3>
        <?php 
$smallFlyer->candidatePhoto->printHtml();
?>
        
            <form id="graphic_material_form" method="post">
            <?php 
wp_nonce_field('graphic_material');
?>
            <input type='hidden' name='action' value='campanhaPreviewFlyer'>
            <input type='hidden' name='type' value='smallflyer'>
            <div id="graphic_material_wizard">
                <h3>2. Escolha uma forma:</h3>
<?php

require_once WPMU_PLUGIN_DIR . '/includes/graphic_material/GraphicMaterialFactory.php';
$header = GraphicMaterialFactory::build('Header');
if (isset($_POST['save']) || isset($_POST['use-header'])) {
    check_admin_referer('graphic_material');
    try {
        $header->save();
        if (isset($_POST['use-header'])) {
            $header->setAsWordPressHeader();
        }
    } catch (Exception $e) {
        echo "<div class='error'><p>{$e->getMessage()}</p></div>";
    }
}
?>

<div id="graphic-material-header">
    <h1>Criar cabeçalho</h1>
    <div id="graphic_material_content" style="width: 60%; float: left;">
        <h3>1. Envie uma foto:</h3>
        <a href="#graphic_material_preview">Pré-visualização</a>
        <?php 
$header->candidatePhoto->printHtml();
?>

        <form id="graphic_material_form" method="post">
            <?php 
wp_nonce_field('graphic_material');
?>
            <input type='hidden' name='action' value='campanhaPreviewFlyer'>