Ejemplo n.º 1
0
    /**
     * The admin menu for our faves system
     */
    public function notifyMenu()
    {
        $notify = new NotifyAdmin();
        $wp_notify = get_option('wp_notify');
        if ($_GET['page'] == basename(__FILE__)) {
            if ('add' == $_REQUEST['action']) {
                $notify->add($_REQUEST);
            } elseif ('delete' == $_REQUEST['action']) {
                $notify->burninate($_REQUEST['id']);
            }
        }
        ?>
		<?php 
        if (isset($_REQUEST['add'])) {
            ?>
		<div id="message" class="updated fade"><p><strong><?php 
            echo __('Service added.');
            ?>
</strong></p></div>
		<?php 
        }
        ?>
			<div class="wrap">
			
				<div id="admin-options">
					<h2><?php 
        _e('Notification Settings');
        ?>
</h2>
                    <?php 
        if ($wp_notify != 1) {
            ?>
                    <b>WicketPixie Notifications are currently disabled, please go to the WicketPixie Options page to enable them.</b><br />
                    <?php 
        }
        ?>
                    What are WicketPixie Notifications? They send out messages to different services like Twitter and Ping.fm to let your followers know of any new blog posts.<br />
                    If you choose to use Ping.fm, unless the other services are not setup in your Ping.fm account please do not add your details for them, as the notification will be sent out twice.<br />
                    <i><b>Please note:</b> When entering service details, you may only need to enter a username and password, you may only need to enter an API/App key, or you may enter both. It all depends on which service you select.</i><br />
					<?php 
        if ($notify->check() != 'false' && $notify->count() != '') {
            ?>
					<table class="form-table" style="margin-bottom:30px;">
						<tr>
							<th>Service</th>
							<th style="text-align:center;">Username</th>
							<th style="text-align:center;" colspan="1">Actions</th>
						</tr>
					<?php 
            foreach ($notify->collect() as $service) {
                ?>
		
						<tr>
							<td><?php 
                echo $service->service;
                ?>
</td>
						   	<td style="text-align:center;"><?php 
                echo $service->username;
                ?>
</td>
							<td style="text-align:center;">
							<form method="post" action="<?php 
                echo $_SERVER['PHP_SELF'];
                ?>
?page=notify.php&amp;delete=true&amp;id=<?php 
                echo $service->id;
                ?>
">
								<input type="submit" name="action" value="Delete" />
								<input type="hidden" name="action" value="delete" />
							</form>
							</td>
						</tr>
					<?php 
            }
            ?>
					</table>
					<?php 
        } else {
            ?>
						<p>You haven't added any services, add them here.</p>
					<?php 
        }
        ?>
                        <p>For those that need help, here's some guidelines:
                            <ul>
                                <li>Use of the Ping.fm service only requires you to enter your App key, which you can obtain <a href="http://ping.fm/key">here</a>.</li>
                                <li>Use of the Twitter service only requires you to enter your Twitter username and password, no API/App key required.</li>
                                <li>WicketPixie is completely open-source, so if you don't believe this doesn't steal your information, check the source code ;)</li>
                            </ul>
                        </p>
						<form method="post" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?page=notify.php&amp;add=true" class="form-table">
							<h2>Add a Service</h2>
							<p><select name="service" id="title">
                            <option value="ping.fm">Ping.fm</option>
                            <option value="twitter">Twitter</option>
                            </select></p>
                            <p><input type="text" name="username" id="url" onfocus="if(this.value=='Username')value=''" onblur="if(this.value=='')value='Username';" value="Username" /></p>
                            <p><input type="text" name="password" id="url" onfocus="if(this.value=='Password')value=''" onblur="if(this.value=='')value='Password';" value="Password" /></p>
                            <p><input type="text" name="apikey" id="url" onfocus="if(this.value=='API/App Key')value=''" onblur="if(this.value=='')value='API/App Key';" value="API/App Key" /></p>
                            <p class="submit">
                                <input name="save" type="submit" value="Add Service" /> 
                                <input type="hidden" name="action" value="add" />
							</p>
						</form>
				</div>
<?php 
    }
Ejemplo n.º 2
0
 function request_check()
 {
     $notify = new NotifyAdmin();
     if (isset($_GET['page']) && isset($_POST['action']) && $_GET['page'] == basename(__FILE__)) {
         if ('add' == $_POST['action']) {
             $notify->add($_REQUEST);
         } elseif ('delete' == $_POST['action']) {
             $notify->burninate($_REQUEST['id']);
         } elseif ('toggle' == $_POST['action']) {
             $notify->toggle();
         } elseif ('install' == $_POST['action']) {
             $notify->install();
         }
     }
     unset($notify);
 }