function after_form() { 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=<?php echo $this->filename; ?> " class="form-table"> <?php wp_nonce_field('wicketpixie-settings'); ?> <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="save-custom-code" value="true" /> <input type="hidden" name="file" value="homesidebar" /> </p> </form> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=<?php echo $this->filename; ?> " class="form-table"> <?php wp_nonce_field('wicketpixie-settings'); ?> <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="clear-custom-code" value="true" /> <input type="hidden" name="file" value="homesidebar" /> </p> </form> <?php }
function after_form() { ?> <h3>Global Announcement</h3> <?php require_once TEMPLATEPATH . '/app/customcode.php'; if (function_exists('fetchcustomcode')) { $glob = fetchcustomcode('global_announcement.php', true); if ($glob == fetchcustomcode('idontexist.no')) { $glob = ""; } } else { $glob = ""; } ?> <p>The text you enter here will appear on the home page and all your posts as a global announcement. HTML is allowed.</p> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=<?php echo $this->filename; ?> " class="form-table"> <?php wp_nonce_field('wicketpixie-settings'); ?> <p><textarea name="code" id="code" style="border: 1px solid #999999;" cols="80" rows="15" /><?php echo $glob; ?> </textarea></p> <p class="submit"> <input name="save" type="submit" value="Save Global Announcement" /> <input type="hidden" name="action" value="save-custom-code" /> <input type="hidden" name="file" value="global_announcement" /> </p> </form> <?php }
comments_popup_link('No Comments', '1 Comment', '% Comments'); ?> </p> <?php } ?> <div style="padding-bottom:15px"></div> <h3>Popular Tags</h3> <span style="line-height:1.3em;"> <?php wp_tag_cloud('orderby=count&order=DESC&unit=px&smallest=10&largest=16&format=flat'); ?> </span> <div style="padding-bottom:15px"></div> <!-- Custom Sidebar Code --> <?php require_once TEMPLATEPATH . '/app/customcode.php'; fetchcustomcode('homesidebar.php'); ?> <!-- /Custom Sidebar Code --> <div style="padding-bottom:15px"></div> </div> </div> <!-- /recent-posts --> </div> <!-- sidebar --> <?php get_footer();
<?php if (have_posts()) { ?> <?php while (have_posts()) { the_post(); ?> <!-- post --> <div class="post" style="border-bottom:0;"> <?php require_once TEMPLATEPATH . '/app/customcode.php'; $glob = fetchcustomcode('global_announcement.php', true); if ($glob != "" && $glob != fetchcustomcode('idontexist.no')) { ?> <div class="highlight"> <?php echo $glob; ?> </div> <?php } ?> <h1><a href="<?php the_permalink(); ?> " rel="bookmark" title="Permanent Link to <?php the_title_attribute();
function wicketpixie_admin_index() { global $settings; ?> <div class="wrap"> <div id="admin-options"> <h2>WicketPixie Setup</h2> <p>We will need a few things from you to enable some of WicketPixie's features.</p> <h3>IDs and URLs</h3> <p id="flickrid_tip">You can obtain your Flickr ID by using <a href="http://idgettr.com">idGettr</a>.</p> <p id="ustreamchannel_tip">Your Ustream Channel is the name of the Ustream channel you'd like to stream from. For example, the channel 'Chris Pirillo Live' (url of which is http://ustream.tv/channel/chris-pirillo-live) would be entered as 'chris-pirillo-live'. (Like you'd see it in the Ustream URL.)</p> <form method="post" style="padding:20px 0 40px;" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=wicketpixie-admin.php"> <?php wp_nonce_field('wicketpixie-settings'); ?> <table class="form-table"> <?php foreach ($settings as $value) { ?> <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) { $optdata = wp_get_option($value['id']); } else { $optdata = $value['std']; } ?> <input name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " type="<?php echo $value['type']; ?> " value="<?php echo $optdata; ?> " <?php if ($optdata === '1') { echo "checked='checked'"; } ?> /> </td> </tr> <?php } ?> </table> <p class="submit"> <input name="save_settings" type="submit" value="Save changes" /> <input type="hidden" name="action" value="save_settings" /> </p> </form> <h3>Global Announcement</h3> <?php require_once TEMPLATEPATH . '/app/customcode.php'; if (function_exists(fetchcustomcode)) { $glob = fetchcustomcode('global_announcement.php', true); if ($glob == fetchcustomcode('idontexist.no')) { $glob = ""; } } else { $glob = ""; } ?> <p>The text you enter here will appear on the home page and all your posts as a global announcement. HTML is allowed.</p> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=wicketpixie-admin.php&ccode=true" class="form-table"> <p><textarea name="code" id="code" style="border: 1px solid #999999;" cols="80" rows="15" /><?php echo $glob; ?> </textarea></p> <p class="submit"> <input name="save" type="submit" value="Save Global Announcement" /> <input type="hidden" name="action" value="ccode" /> <input type="hidden" name="file" value="global_announcement" /> </p> </form> </div> <?php include_once 'app/advert.php'; }
/** * 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 <head> and </head> tags of your site.</p> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=customcode.php&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&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 </bodygt; tag of your site.</p> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=customcode.php&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&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&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&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&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&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 }
/** * 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&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&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&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 }
/** * This is called in single.php and displays after-posts code. **/ function wp_after_posts_code() { return fetchcustomcode("afterposts.php"); }