Exemplo n.º 1
0
 function request_check()
 {
     parent::request_check();
     if (isset($_POST['action']) && $_POST['action'] == 'save-custom-code') {
         if (isset($_POST['file']) && $_POST['file'] == 'global_announcement') {
             require_once TEMPLATEPATH . '/app/customcode.php';
             writeto($_POST['code'], "global_announcement.php");
         }
     }
 }
Exemplo n.º 2
0
 function request_check()
 {
     parent::request_check();
     require_once TEMPLATEPATH . '/app/customcode.php';
     if (isset($_POST['save-custom-code'])) {
         writeto($_POST['code'], 'homesidebar.php');
     } elseif (isset($_POST['clear-custom-code'])) {
         unlink(CUSTOMPATH . '/homesidebar.php');
     }
 }
function wicketpixie_toplevel_admin()
{
    global $settings;
    if ($_POST['action'] == 'save_settings') {
        save($_POST, $settings);
    }
    if ('ccode' == $_REQUEST['action']) {
        if ('global_announcement' == $_POST['file']) {
            require_once TEMPLATEPATH . '/app/customcode.php';
            writeto($_POST['code'], "global_announcement.php");
        }
    }
    add_menu_page('WicketPixie Admin', 'WicketPixie', 'edit_themes', 'wicketpixie-admin.php', 'wicketpixie_admin_index', get_template_directory_uri() . '/images/wicketsmall.png');
}
Exemplo n.º 4
0
    /**
     * The admin page where the user enters the custom header code.
     */
    function customcode_admin()
    {
        if ($_GET['page'] == basename(__FILE__)) {
            if (isset($_POST['action']) && $_POST['action'] == 'add') {
                if (isset($_POST['file'])) {
                    switch ($_POST['file']) {
                        case 'header':
                            writeto($_POST['code'], "header.php");
                            break;
                        case 'footer':
                            writeto($_POST['code'], "footer.php");
                            break;
                        case 'afterhomepost':
                            writeto($_POST['code'], "afterhomepost.php");
                            break;
                        case 'afterposts':
                            writeto($_POST['code'], "afterposts.php");
                            break;
                        default:
                            break;
                    }
                }
            } elseif (isset($_POST['action']) && $_POST['action'] == 'clear') {
                if (isset($_POST['file'])) {
                    switch ($_POST['file']) {
                        case 'header':
                            unlink(CUSTOMPATH . '/header.php');
                            break;
                        case 'footer':
                            unlink(CUSTOMPATH . '/footer.php');
                            break;
                        case 'afterhomepost':
                            unlink(CUSTOMPATH . '/afterhomepost.php');
                            break;
                        case 'afterposts':
                            unlink(CUSTOMPATH . '/afterposts.php');
                            break;
                        default:
                            break;
                    }
                }
            }
        }
        ?>
        <?php 
        if (isset($_REQUEST['add'])) {
            ?>
        <div id="message" class="updated fade"><p><strong><?php 
            echo __('Custom Code saved.');
            ?>
</strong></p></div>
        <?php 
        } elseif (isset($_REQUEST['clear'])) {
            ?>
        <div id="message" class="updated fade"><p><strong><?php 
            echo __('Custom Code cleared.');
            ?>
</strong></p></div>
        <?php 
        }
        ?>
            <div class="wrap">
            
                <div id="admin-options">
                    <h2><?php 
        _e('Custom Code');
        ?>
</h2>
                    <p>Allows you to enter special code (HTML, PHP, JavaScript) which will be included in the site template.</p>
                    <h3>Custom Header</h3>
                    <p>Enter HTML markup, PHP code, or JavaScript that you would like to appear between the &lt;head&gt; and &lt;/head&gt; tags of your site.</p>
                    <form method="post" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?page=customcode.php&amp;add=true" class="form-table">
                    <?php 
        wp_nonce_field('wicketpixie-settings');
        ?>
                        <h4>Edit Custom Header file</h4>
                        <p><textarea name="code" id="code" style="border: 1px solid #999999;" cols="80" rows="25" /><?php 
        echo fetchcustomcode("header.php", true);
        ?>
</textarea></p>
                        <p class="submit">
                            <input name="save" type="submit" value="Save Custom Header" /> 
                            <input type="hidden" name="action" value="add" />
                            <input type="hidden" name="file" value="header" />
                        </p>
                    </form>
                    <form method="post" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?page=customcode.php&amp;clear=true" class="form-table">
                    <?php 
        wp_nonce_field('wicketpixie-settings');
        ?>
                        <h4>Clear custom header</h4>
                        <p>WARNING: This will delete all custom code you have entered for your header, if you want to continue, click 'Clear Custom Header'</p>
                        <p class="submit">
                            <input name="clear" type="submit" value="Clear Custom Header" />
                            <input type="hidden" name="action" value="clear" />
                            <input type="hidden" name="file" value="header" />
                        </p>
                    </form>
                    <h3>Custom Footer</h3>
                    <p>Enter HTML markup, PHP code, or JavaScript that you would like to appear just before the &lt;/bodygt; tag of your site.</p>
                    <form method="post" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?page=customcode.php&amp;add=true" class="form-table">
                    <?php 
        wp_nonce_field('wicketpixie-settings');
        ?>
                        <h4>Edit Custom Footer file</h4>
                        <p><textarea name="code" id="code" style="border: 1px solid #999999;" cols="80" rows="25" /><?php 
        echo fetchcustomcode("footer.php", true);
        ?>
</textarea></p>
                        <p class="submit">
                            <input name="save" type="submit" value="Save Custom Footer" /> 
                            <input type="hidden" name="action" value="add" />
                            <input type="hidden" name="file" value="footer" />
                        </p>
                    </form>
                    <form method="post" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?page=customcode.php&amp;clear=true" class="form-table">
                    <?php 
        wp_nonce_field('wicketpixie-settings');
        ?>
                        <h4>Clear custom footer</h4>
                        <p>WARNING: This will delete all custom code you have entered for your footer, if you want to continue, click 'Clear Custom Footer'</p>
                        <p class="submit">
                            <input name="clear" type="submit" value="Clear Custom Footer" />
                            <input type="hidden" name="action" value="clear" />
                            <input type="hidden" name="file" value="footer" />
                        </p>
                    </form>
                    <h3>After-Home-Post</h3>
                    <p>Enter HTML markup, PHP code, or JavaScript that you would like to appear between the post content and post meta-data on your homepage.</p>
                    <form method="post" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?page=customcode.php&amp;add=true" class="form-table">
                    <?php 
        wp_nonce_field('wicketpixie-settings');
        ?>
                        <h4>Edit After-Home-Post code</h4>
                        <p><textarea name="code" id="code" style="border: 1px solid #999999;" cols="80" rows="25" /><?php 
        echo fetchcustomcode("afterhomepost.php", true);
        ?>
</textarea></p>
                        <p class="submit">
                            <input name="save" type="submit" value="Save After-Home-Post code" /> 
                            <input type="hidden" name="action" value="add" />
                            <input type="hidden" name="file" value="afterhomepost" />
                        </p>
                    </form>
                    <form method="post" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?page=customcode.php&amp;clear=true" class="form-table">
                    <?php 
        wp_nonce_field('wicketpixie-settings');
        ?>
                        <h4>Clear After-Home-Post code</h4>
                        <p>WARNING: This will delete all custom code you have entered to appear after posts on the homepage, if you want to continue, click 'Clear After-Home-Post code'</p>
                        <p class="submit">
                            <input name="clear" type="submit" value="Clear After-Home-Post code" />
                            <input type="hidden" name="action" value="clear" />
                            <input type="hidden" name="file" value="afterhomepost" />
                        </p>
                    </form>
                    <h3>After-Posts</h3>
                    <p>Enter HTML markup, PHP code, or JavaScript that you would like to appear between the post content and post meta-data on individual posts.</p>
                    <form method="post" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?page=customcode.php&amp;add=true" class="form-table">
                    <?php 
        wp_nonce_field('wicketpixie-settings');
        ?>
                        <h4>Edit After-Posts code</h4>
                        <p><textarea name="code" id="code" style="border: 1px solid #999999;" cols="80" rows="25" /><?php 
        echo fetchcustomcode("afterposts.php", true);
        ?>
</textarea></p>
                        <p class="submit">
                            <input name="save" type="submit" value="Save After-Posts code" /> 
                            <input type="hidden" name="action" value="add" />
                            <input type="hidden" name="file" value="afterposts" />
                        </p>
                    </form>
                    <form method="post" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?page=customcode.php&amp;clear=true" class="form-table">
                    <?php 
        wp_nonce_field('wicketpixie-settings');
        ?>
                        <h4>Clear After-Posts code</h4>
                        <p>WARNING: This will delete all custom code you have entered to appear after individual posts, if you want to continue, click 'Clear After-Posts code'</p>
                        <p class="submit">
                            <input name="clear" type="submit" value="Clear After-Posts code" />
                            <input type="hidden" name="action" value="clear" />
                            <input type="hidden" name="file" value="afterposts" />
                        </p>
                    </form>
                </div>
                <?php 
        include_once 'advert.php';
        ?>
    <?php 
    }
Exemplo n.º 5
0
    /**
     * The admin page for our home editor.
     **/
    function homeMenu()
    {
        global $homeoptions;
        require_once TEMPLATEPATH . '/app/customcode.php';
        if (isset($_POST['ccode'])) {
            writeto($_POST['code'], 'homesidebar.php');
        } elseif (isset($_POST['clearcc'])) {
            unlink(CUSTOMPATH . '/homesidebar.php');
        }
        if (isset($_REQUEST['saved'])) {
            echo '<div id="message" class="updated fade"><p><strong>' . __('Options saved.') . '</strong></p></div>';
        }
        ?>
    <div class="wrap">
	
	    <div id="admin-options">
	
		    <h2>Home Editor</h2>
            
		    <form method="post" style="padding:20px 0 10px;" enctype="multipart/form-data" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?page=homeeditor.php&amp;saved=true">
			    <table class="form-table">

			    <?php 
        foreach ($homeoptions as $value) {
            if ($value['type'] == "textarea") {
                if ($value['id'] == "home_video" || $value['id'] == "home_custom") {
                    if (wp_get_option($value['id']) != false && wp_get_option($value['id']) != '') {
                        $content = stripslashes(wp_get_option($value['id']));
                    } else {
                        $content = $value['std'];
                    }
                } else {
                    if (wp_get_option($value['id']) != false && wp_get_option($value['id']) != '') {
                        $content = wp_get_option($value['id']);
                    } else {
                        $value['std'];
                    }
                }
                ?>
			    <tr valign="top"> 
			        <th scope="row" style="font-size:12px; text-align:left; padding-right:10px;"><acronym title="<?php 
                echo $value['description'];
                ?>
"><?php 
                echo $value['name'];
                ?>
</acronym></th>
			        <td style="padding-bottom:10px;">
			            <textarea name="<?php 
                echo $value['id'];
                ?>
" id="<?php 
                echo $value['id'];
                ?>
" value="<?php 
                stripslashes($content);
                ?>
"><?php 
                echo stripslashes($content);
                ?>
</textarea>
			        </td>
			    </tr>

			    <?php 
            } elseif ($value['type'] == "select") {
                ?>

			        <tr valign="top"> 
			            <th scope="row" style="font-size:12px; text-align:left; padding-right:10px;"><acronym title="<?php 
                echo $value['description'];
                ?>
"><?php 
                echo $value['name'];
                ?>
</acronym></th>
			            <td style="padding-bottom:10px;">
			                <select name="<?php 
                echo $value['id'];
                ?>
" id="<?php 
                echo $value['id'];
                ?>
">
			                    <?php 
                foreach ($value['options'] as $option) {
                    ?>
			                    <option<?php 
                    if ($option == wp_get_option($value['id'])) {
                        echo ' selected="selected"';
                    } elseif ($option == $value['std'] && !wp_get_option($value['id'])) {
                        echo ' selected="selected"';
                    }
                    ?>
							    ><?php 
                    echo $option;
                    ?>
</option>
			                    <?php 
                }
                ?>
			                </select>
			            </td>
			        </tr>

			    <?php 
            } elseif ($value['type'] == 'checkbox') {
                ?>
				    <tr valign="top">
				        <th scope="row" style="font-size:12px; text-align:left; padding-right:10px;"><acronym title="<?php 
                echo $value['description'];
                ?>
"><?php 
                echo $value['name'];
                ?>
</acronym></th>
			            <td style="padding-right:10px;">
					        <?php 
                if (wp_get_option($value['id']) != false) {
                    $checked = wp_get_option($value['id']);
                } else {
                    $checked = $value['std'];
                }
                ?>
					        <input name="<?php 
                echo $value['id'];
                ?>
" id="<?php 
                echo $value['id'];
                ?>
" type="<?php 
                echo $value['type'];
                ?>
" value="<?php 
                echo $value['id'];
                ?>
" <?php 
                if ($checked === '1') {
                    echo "checked='checked'";
                }
                ?>
 />
					</tr>
			    <?php 
            } elseif ($value['type'] == 'textbox') {
                ?>
				    <tr valign="top"> 
			        <th scope="row" style="font-size:12px; text-align:left; padding-right:10px;"><acronym title="<?php 
                echo $value['description'];
                ?>
"><?php 
                echo $value['name'];
                ?>
</acronym></th>
			        <td style="padding-bottom:10px;">
			            <input type="<?php 
                echo $value['type'];
                ?>
" name="<?php 
                echo $value['id'];
                ?>
" id="<?php 
                echo $value['id'];
                ?>
" value="<?php 
                if (wp_get_option($value['id']) != false && wp_get_option($value['id']) != '') {
                    echo wp_get_option($value['id']);
                } else {
                    echo $value['std'];
                }
                ?>
"><?php 
                wp_get_option($value['id']) != false && wp_get_option($value['id']) != '' ? wp_get_option($value['id']) : $value['std'];
                ?>
</input>
			        </td>
			    </tr>
			    <?php 
            }
        }
        ?>

			    </table>

			    <p class="submit">
				    <input name="save" type="submit" value="Save changes" class="button" />    
				    <input type="hidden" name="action" value="save" />
			    </p>

		    </form>
		    <?php 
        require_once TEMPLATEPATH . '/app/customcode.php';
        ?>
		    <h3>Custom Sidebar Code</h3>
                <p>Enter HTML markup, PHP code, or JavaScript that you would like to appear between the after the Recent Posts section of the homepage sidebar.</p>
                <form method="post" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?page=homeeditor.php&amp;ccode=true" class="form-table">
                    <h4>Edit Custom Sidebar code</h4>
                    <p><textarea name="code" id="code" style="border: 1px solid #999999;" cols="80" rows="25" /><?php 
        echo fetchcustomcode("homesidebar.php", true);
        ?>
</textarea></p>
                    <p class="submit">
                        <input name="save" type="submit" value="Save Custom Sidebar code" /> 
                        <input type="hidden" name="ccode" value="true" />
                        <input type="hidden" name="file" value="homesidebar" />
                    </p>
                </form>
                <form method="post" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?page=homeeditor.php&amp;clearcc=true" class="form-table">
                    <h4>Clear Custom Sidebar code</h4>
                    <p>WARNING: This will delete all custom code you have entered to appear after the Recent Posts section of the homepage sidebar, if you want to continue, click 'Clear Custom Sidebar code'</p>
                    <p class="submit">
                        <input name="clear" type="submit" value="Clear Custom Sidebar code" />
                        <input type="hidden" name="clearcc" value="true" />
                        <input type="hidden" name="file" value="homesidebar" />
                    </p>
                </form>
	    </div>
	    <?php 
        include_once 'advert.php';
        ?>
    <?php 
    }