custom-tags.php
2 weeks ago
email-template-editor.php
2 years ago
email-template-settings.php
5 months ago
emails-template.php
4 years ago
header.php
3 years ago
import-template.php
5 years ago
list-templates.php
2 weeks ago
templates.php
2 weeks ago
list-templates.php
128 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Base: wpdmpro |
| 4 | * Developer: shahjada |
| 5 | * Team: W3 Eden |
| 6 | * Date: 22/5/20 08:21 |
| 7 | */ |
| 8 | |
| 9 | |
| 10 | if(!defined("ABSPATH")) die(); |
| 11 | |
| 12 | if(!isset($_GET['_type']) || $_GET['_type'] !== 'email'){ ?> |
| 13 | |
| 14 | <blockquote class="alert alert-info" style="margin-bottom: 10px"> |
| 15 | <?php echo __( "Pre-designed templates can't be deleted or edited from this section. But you can clone any of them and edit as your own. If you seriously want to edit any pre-designed template you have to edit those directly edting php files at /download-manager/templates/ dir" , "download-manager" ); ?> |
| 16 | </blockquote> |
| 17 | |
| 18 | <?php } ?> |
| 19 | <div class="panel panel-default"> |
| 20 | <table cellspacing="0" class="table table-hover"> |
| 21 | <thead> |
| 22 | <tr> |
| 23 | <th style="min-width: 400px"><?php echo __( "Template Name" , "download-manager" ); ?></th> |
| 24 | <?php if(wpdm_query_var('_type') === 'email'){ ?> |
| 25 | <th style="width: 150px"><?php echo __( "Mail Receiver" , "download-manager" ); ?></th> |
| 26 | <?php } ?> |
| 27 | <th style="width: 250px;"><?php echo __( "Template ID" , "download-manager" ); ?></th> |
| 28 | <?php if(!isset($_GET['_type']) || $_GET['_type'] != 'email'){ ?> |
| 29 | <th style="width: 150px"><?php echo __( "Status" , "download-manager" ); ?></th> |
| 30 | <?php } else { ?> |
| 31 | <th style="width: 150px"><?php echo __( "Email Status" , "download-manager" ); ?></th> |
| 32 | <?php } ?> |
| 33 | <th style="width: 160px;text-align: right"><?php echo __( "Actions" , "download-manager" ); ?></th> |
| 34 | </tr> |
| 35 | </thead> |
| 36 | |
| 37 | |
| 38 | <tbody> |
| 39 | |
| 40 | <?php |
| 41 | $ttype = isset($_GET['_type'])?wpdm_query_var('_type'):'link'; |
| 42 | if($ttype != 'email'){ |
| 43 | //$ctpls = WPDM\Admin\Menu\Templates::dropdown(array('data_type' => 'ARRAY', 'type' => $ttype)); |
| 44 | $ctpls = WPDM()->packageTemplate->getTemplates($ttype); |
| 45 | |
| 46 | $tplstatus = maybe_unserialize(get_option("_fm_{$ttype}_template_status")); |
| 47 | $ctemplates = []; |
| 48 | foreach($ctpls as $ctpl => $template){ |
| 49 | $name = ""; |
| 50 | $path = ""; |
| 51 | |
| 52 | if(!is_array($template)){ |
| 53 | $tmpdata = file_get_contents($template); |
| 54 | $path = $template; |
| 55 | $regx = "/WPDM.*Template[\s]*:([^\-\->]+)/"; |
| 56 | if (preg_match($regx, $tmpdata, $matches)) { |
| 57 | $name = $matches[1]; |
| 58 | } else continue; |
| 59 | } else { |
| 60 | $name = $template['name']; |
| 61 | $ctemplates[] = $ctpl; |
| 62 | } |
| 63 | |
| 64 | $tplid = str_replace(".php","",$ctpl); |
| 65 | $status = isset($tplstatus[$tplid])?(int)$tplstatus[$tplid]:1; |
| 66 | ?> |
| 67 | |
| 68 | <tr valign="top" class="author-self status-inherit" id="template-<?php echo $ttype; ?>-<?php echo $ctpl; ?>"> |
| 69 | <td class="column-icon media-icon" style="text-align: left;"> |
| 70 | <a href="#" class="pull-right ttip" title="<?= __('Show file path', WPDM_TEXT_DOMAIN) ?>" onclick="jQuery('#lnk-<?= $tplid ?>').slideToggle();return false;"><i class="fa fa-globe"></i></a> |
| 71 | <nobr><?php echo $name; ?></nobr><br/> |
| 72 | <code style="display: none;" id="lnk-<?= $tplid ?>"><?php echo str_replace(ABSPATH, '', $path); ?></code> |
| 73 | </td> |
| 74 | <td> |
| 75 | <input class="form-control input-sm input-tplid" type="text" readonly="readonly" onclick="this.select()" value="<?php echo $tplid; ?>" /> |
| 76 | </td> |
| 77 | <td> |
| 78 | <div class="btn-group" data-toggle="buttons"> |
| 79 | <label class="btn btn-<?php echo $status === 1?'success active':'secondary'; ?> btn-sm btn-status <?php echo str_replace(".php","",$ctpl); ?>" data-value="1" data-id="<?php echo str_replace(".php","",$ctpl); ?>"><input type="radio" <?php checked($status,1); ?> name="<?php echo $ctpl; ?>-status" value="1"/><i class="fa fa-check"></i></label> |
| 80 | <label class="btn btn-<?php echo $status === 0?'danger active':'secondary'; ?> btn-sm btn-status <?php echo str_replace(".php","",$ctpl); ?>" data-value="0" data-id="<?php echo str_replace(".php","",$ctpl); ?>"><input type="radio" name="<?php echo $ctpl; ?>-status" <?php checked($status,0); ?> value="0"/><i class="fa fa-times"></i></label> |
| 81 | </div> |
| 82 | </td> |
| 83 | <td style="text-align: right"> |
| 84 | <a href="#" data-href="admin-ajax.php?action=template_preview&_type=<?php echo $ttype; ?>&template=<?php echo $ctpl; ?>&_tplnonce=<?php echo wp_create_nonce(WPDM_PUB_NONCE) ?>" rel="<?php echo $ctpl; ?>" class="template_preview btn btn-sm btn-success"><i class="fa fa-desktop"></i> Preview</a> |
| 85 | |
| 86 | </td> |
| 87 | |
| 88 | |
| 89 | </tr> |
| 90 | <?php |
| 91 | }} else { |
| 92 | $status_all = WPDM()->email->getStatus(); |
| 93 | $templates = \WPDM\__\Email::templates(); |
| 94 | foreach($templates as $ctpl => $template){ |
| 95 | $status = isset($status_all[$ctpl]) ? (int) $status_all[$ctpl] : 1; |
| 96 | ?> |
| 97 | <tr valign="top" class="author-self status-inherit" id="post-8"> |
| 98 | <td class="column-icon media-icon" style="text-align: left;"> |
| 99 | <?php echo esc_attr($template['label']); ?> |
| 100 | |
| 101 | </td> |
| 102 | |
| 103 | <td style="width: 150px"><?php echo ucfirst($template['for']); ?></td> |
| 104 | |
| 105 | <td> |
| 106 | <?php echo $ctpl; ?> |
| 107 | </td> |
| 108 | <td> |
| 109 | <div class="btn-group" data-toggle="buttons"> |
| 110 | <label class="btn btn-<?php echo $status === 1?'success active':'light'; ?> btn-sm btn-status <?php echo $ctpl; ?>" data-value="1" data-id="<?php echo $ctpl; ?>"><input type="radio" <?php checked($status,1); ?> name="<?php echo $ctpl; ?>-status" value="1"/><i class="fa fa-check"></i></label> |
| 111 | <label class="btn btn-<?php echo $status === 0?'danger active':'light'; ?> btn-sm btn-status <?php echo $ctpl; ?>" data-value="0" data-id="<?php echo $ctpl; ?>"><input type="radio" name="<?php echo $ctpl; ?>-status" <?php checked($status,0); ?> value="0"/><i class="fa fa-times"></i></label> |
| 112 | </div> |
| 113 | </td> |
| 114 | <td style="text-align: right"> |
| 115 | |
| 116 | <a href="edit.php?post_type=wpdmpro&page=templates&_type=email&task=EditEmailTemplate&id=<?php echo $ctpl; ?>" class="btn btn-sm btn-primary"><i class="fas fa-pencil-alt"></i> <?php echo __( "Edit" , "download-manager" ); ?></a> |
| 117 | |
| 118 | </td> |
| 119 | |
| 120 | |
| 121 | </tr> |
| 122 | <?php |
| 123 | }} |
| 124 | ?> |
| 125 | </tbody> |
| 126 | </table> |
| 127 | </div> |
| 128 |