/**
 * Get name of active template
 * 
 * @author Fawaz Tahir <*****@*****.**>
 * @return string
 */
function get_active_template_name()
{
    $active = get_active_template();
    return get_template_name($active);
}
Beispiel #2
0
/**
 * Initialize Tiny MCE and create an textarea
 * 
 * @param STR $name		Name of the textarea.
 * @param STR $id		Id of the textarea.
 * @param STR $content	The content to edit.
 * @param INT $width	The width of the editor, not overwritten by wysiwyg-admin.
 * @param INT $height	The height of the editor, not overwritten by wysiwyg-admin.
 * @param BOOL $prompt	Direct output to the client via echo (true) or returnd as HTML-textarea (false)?
 * @return MIXED		Could be a BOOL or STR (textarea-tags).
 *
 */
function show_wysiwyg_editor($name, $id, $content, $width = "100%", $height = "250px", $prompt = true)
{
    global $id_list;
    global $database;
    global $parser;
    // twig parser
    global $loader;
    // twig file manager
    if (!is_object($parser)) {
        require_once LEPTON_PATH . "/modules/lib_twig/library.php";
    }
    // prependpath to make sure twig is looking in this module template folder first
    $loader->prependPath(dirname(__FILE__) . "/templates/");
    /**	*****
     *	1. tinyMCE main script part
     *
     */
    /**
     *	make sure that the script-part is only load/generated ones
     *
     */
    if (!defined("tiny_mce_loaded")) {
        define("tiny_mce_loaded", true);
        /**
         *	Find out how many wysiwyg sections we've got and whoat section id's we
         *	need to collect
         */
        if (!isset($id_list)) {
            $id_list = array('short', 'long');
        }
        if (!in_array($name, $id_list)) {
            $id_list = array($name);
        }
        if (is_array($id_list) and count($id_list) > 0) {
            // get all sections we want ... in page...
            foreach ($id_list as &$ref) {
                $ref = "#" . $ref;
            }
            $elements = implode(',', $id_list);
        } else {
            /**
             *	Try to get all wysiwyg sections... on the page...
             *	Keep in Mind that there could be also a wysiwyg inside an admin-tool!
             */
            $elements = "";
            if (isset($page_id)) {
                $qs = $database->query("SELECT section_id FROM " . TABLE_PREFIX . "sections WHERE page_id = '{$page_id}' AND module = 'wysiwyg' ORDER BY position ASC");
                if ($qs->numRows() > 0) {
                    while ($sw = $qs->fetchRow(MYSQL_ASSOC)) {
                        $elements .= 'textarea#content' . $sw['section_id'] . ',';
                    }
                    $elements = substr($elements, 0, -1);
                }
            }
        }
        $tiny_mce_url = LEPTON_URL . "/modules/tiny_mce_4/tiny_mce";
        $temp_css_path = "editor.css";
        $template_name = get_template_name($temp_css_path);
        /**
         *	work out default CSS file to be used for TINY_MCE textareas
         *	if editor.css file exists in default template folder or template folder of current page
         */
        $css_file = $template_name == "none" ? $tiny_mce_url . '/skins/lightgray/content.min.css' : LEPTON_URL . '/templates/' . $template_name . $temp_css_path;
        /**
         * See: http://www.tinymce.com/wiki.php/Configuration:content_css
         *
         */
        $temp_css_file = "/modules/tiny_mce_4/tiny_mce/skins/skin.custom.css";
        if (file_exists(LEPTON_PATH . $temp_css_file)) {
            $css_file = "['" . $css_file . "','" . LEPTON_URL . $temp_css_file . "']";
        }
        /**
         *	Try to include language file
         *	If the file is not found (local) we use an empty string,
         *	TinyMCE will use english as the defaut language in this case.
         */
        $lang = strtolower(LANGUAGE);
        $language = file_exists(dirname(__FILE__) . "/tiny_mce/langs/" . $lang . ".js") ? $lang : "";
        /**
         *	Try to get wysiwyg-admin informations for this editor.
         *
         */
        $toolbar = "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage";
        $skin = "lightgray";
        $strip = TABLE_PREFIX;
        $all_tables = $database->list_tables($strip);
        if (in_array("mod_wysiwyg_admin", $all_tables)) {
            $temp_data = $database->query("SELECT `skin`, `menu`,`width`,`height` from `" . TABLE_PREFIX . "mod_wysiwyg_admin` where `editor` ='tiny_mce_4'");
            if ($temp_data && $temp_data->numRows() > 0) {
                $data = $temp_data->fetchRow(MYSQL_ASSOC);
                $width = $data['width'];
                $height = $data['height'];
                $skin = $data['skin'];
                require_once dirname(__FILE__) . "/class.editorinfo.php";
                $oTinyMCE_info = new editorinfo_TINY_MCE_4();
                $toolbar = $oTinyMCE_info->toolbars[$data['menu']];
            }
        }
        $data = array('tiny_mce_url' => $tiny_mce_url, 'elements' => $elements, 'language' => $language, 'width' => $width, 'height' => $height, 'css_file' => $css_file, 'toolbar' => $toolbar, 'skin' => $skin, 'LEPTON_URL' => LEPTON_URL, 'LEPTON_GUID' => LEPTON_GUID);
        echo $parser->render("tiny_mce.lte", $data);
    }
    /**	*****
     *	2. textarea part
     *
     */
    //	values for the textarea
    $data = array('id' => $id, 'name' => $name, 'content' => htmlspecialchars_decode($content), 'width' => $width, 'height' => $height);
    $result = $parser->render('textarea.lte', $data);
    if ($prompt) {
        echo $result;
        return true;
    }
    return $result;
}
    $email_name["en"] = htmlspecialchars($_POST["email_name_en"]);
}
if (isset($_POST["email_body_ro"])) {
    $email_body["ro"] = htmlspecialchars($_POST["email_body_ro"]);
}
if (isset($_POST["email_body_en"])) {
    $email_body["en"] = htmlspecialchars($_POST["email_body_en"]);
}
$email_name = mysql_real_escape_string(json_encode($email_name));
$email_body = mysql_real_escape_string(json_encode($email_body));
/*
 * delete email template
 */
if ($action == "delete") {
    $mesaj = array();
    $template_name = get_template_name($email_id, $lang);
    $query = "DELETE FROM emails WHERE email_id = '" . $email_id . "'";
    $result = mysql_query($query, $dbconnect);
    confirm_query($result);
    if (mysql_affected_rows() == 1) {
        $mesaj[] = "Template {$template_name} has been deleted.";
    }
    $query = "DELETE from  rel_studies_email WHERE email_id = '" . $email_id . "'";
    $result = mysql_query($query, $dbconnect);
    confirm_query($result);
    if (mysql_affected_rows() == 1) {
        $mesaj[] = "Relations to this email template were removed.";
    }
    $_SESSION["mesaj"] = $mesaj;
    redirect("manage_emails.php");
}
      <p><?php 
    __("The following email template is used");
    ?>
:</p>
      <ul>
         <?php 
    $rel_template = get_rel_template_id_for_study($study_id);
    if ($rel_template != null) {
        ?>
         <li>
            <a href="view_email.php?email_id=<?php 
        echo $rel_template;
        ?>
"><?php 
        echo get_template_name($rel_template, $lang);
        ?>
</a>
         </li>
         <?php 
    }
    ?>

      </ul>


      <p><a href="edit_study.php?study_id=<?php 
    echo $study_id;
    ?>
"><?php 
    __("Edit study");
		// will break <head>, so include it after <body> if you need that snippet

		// Set up site configuration
		window.config = window.config || {};

		// The base URL for the WordPress theme
		window.config.baseUrl = "<?php 
echo get_bloginfo('url');
?>
";

		// Empty default Gravity Forms spinner function
		var gformInitSpinner = function() {};
	</script>

	<?php 
// Make sure you go through this file and remove what you aren't using
include get_stylesheet_directory_uri() . '/functions/site/theme-meta.php';
?>

	<?php 
wp_head();
?>
</head>
<body <?php 
body_class();
?>
  id="<?php 
echo get_template_name();
?>
">