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
    /**
     * The admin page where the user selects the services that
     * should be notified whenever a blog post is published.
     */
    function notifyMenu()
    {
        $notify = new NotifyAdmin();
        $wp_notify = get_option('wicketpixie_notifications_enable');
        ?>
		<?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 != 'true') {
            ?>
                    <p><strong>WicketPixie Notifications are currently disabled, please go to the WicketPixie Options page to enable them.</strong><br /></p>
                    <?php 
        }
        ?>
                    <p>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. Need more help? <a href="#explain" title="Click for more info" id="explaintext">It's only a click away</a>.</p>
					<div id="explain">
                        <h3>For those that need help, here's some guidelines:</h3>
                            <ol>
                                <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>
                            </ol>
					</div>
                    <p>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.</p>
                    <p><strong>Please note:</strong> <em>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.</em></p>
                    
                    <form method="post" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?page=<?php 
        echo $this->filename;
        ?>
" class="form-table">
                    <?php 
        wp_nonce_field('wicketpixie-settings');
        ?>
					    <h2>Toggle WicketPixie Notifications</h2>
					    <?php 
        if (get_option('wicketpixie_notifications_enable')) {
            if (get_option('wicketpixie_notifications_enable') == "true") {
                $val = "off";
            } else {
                $val = "on";
            }
        } else {
            $val = "on";
        }
        ?>
					    <p class="submit">
					    <input type="submit" name="toggle" value="Turn <?php 
        echo $val;
        ?>
 WicketPixie Notifications" />
					    <input type="hidden" name="action" value="toggle" />
					    </p>
					</form>
					
					<?php 
        if ($notify->check() == true && $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 
        }
        ?>
				    <?php 
        if ($notify->check() == true) {
            ?>
						<form method="post" action="<?php 
            echo $_SERVER['PHP_SELF'];
            ?>
?page=notify.php&amp;add=true" class="form-table">
						<?php 
            wp_nonce_field('wicketpixie-settings');
            ?>
							<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>
					<?php 
        } else {
            ?>
					    <form method="post" action="<?php 
            echo $_SERVER['PHP_SELF'];
            ?>
?page=<?php 
            echo $this->filename;
            ?>
&amp;install=true">
					        <h2>Install Notifications table</h2>
                            <p>Before you can add a service, you must install the table.</p>
                            <p class="submit">
                                <input name="save" type="submit" value="Install Notifications table"/>
                                <input type="hidden" name="action" value="install"/>
                            </p>
                        </form>
					<?php 
        }
        ?>
				</div>
                <?php 
        include_once 'advert.php';
    }