function ml_push_notification_manual_send_div()
{
    ?>
    
    <div class="ml_send_notification_box">
        <div id="error-message" class="error" style="display: none;"></div>
        <table class="form-table">
            <tbody>
                <tr>
                    <th scope='row'>
                        <label for="ml_push_notification_msg">Message</label>
                    </th>
                    <td>
                        <input id="ml_push_notification_msg" placeholder="Your message" name="ml_push_notification_msg" type="text" style="width: 100%" class='regular-text'/>
                        <p id="ml_notification_chars" class="description">107 character(s) left.</p>
                    </td>
                </tr>
                <tr>
                    <th scope='row'>
                        <label for='ml_push_notification_data_id'>Attach</label>
                    </th>
                    <td>
                        <select id="ml_push_notification_data_id">
                            <option value=''>Select attachment...</option>
                            <?php 
    $posts = get_posts(array('posts_per_page' => 10, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'post'));
    ?>
                            <?php 
    $pages = get_pages(array('sort_order' => 'ASC', 'sort_column' => 'post_title', 'post_type' => 'page', 'post_status' => 'publish'));
    ?>
                            <optgroup label="Posts">
                            <?php 
    foreach ($posts as $post) {
        ?>

                            <option value="post_id-<?php 
        echo $post->ID;
        ?>
">
                            <?php 
        if (strlen($post->post_title) > 40) {
            ?>

                            <?php 
            echo substr($post->post_title, 0, 40);
            ?>

                            ..
                            <?php 
        } else {
            ?>

                            <?php 
            echo $post->post_title;
            ?>

                            <?php 
        }
        ?>
                            </option><?php 
    }
    ?>
                            </optgroup><optgroup label="Pages">
                            <?php 
    foreach ($pages as $page) {
        ?>

                            <option value="post_id-<?php 
        echo $page->ID;
        ?>
">
                            <?php 
        if (strlen($page->post_title) > 40) {
            ?>

                            <?php 
            echo substr($page->post_title, 0, 40);
            ?>

                            ..
                            <?php 
        } else {
            ?>

                            <?php 
            echo $page->post_title;
            ?>

                            <?php 
        }
        ?>
                            </option><?php 
    }
    ?>
                            </optgroup>
                            <optgroup label="Custom">
                                <option value="custom">Post/Page ID</option>
                            </optgroup>
                        </select>
                        <p class="description">You can attach a post or a page to your notification (optional).</p>
                    </td>
                </tr>
                <tr id="ml_push_notification_post_id_row" style="display: none;">
                    <th scope='row'>
                        <label for="ml_push_notification_post_id">Custom Post/Page ID</label>
                    </th>
                    <td>
                        <input id="ml_push_notification_post_id" placeholder="Custom ID" name="ml_push_notification_post_id" type="text" class='regular-text'/>
                    </td>
                </tr>
                <tr>
                    <th scope='row'>
                        <label>Send to Platform</label>
                    </th>
                    <td>
                        <p>
                            <?php 
    $registeredDevicesCount = ml_registered_devices_count();
    $total_count = 0;
    $android_count = 0;
    $ios_count = 0;
    if ($registeredDevicesCount['android'] !== null) {
        $total_count += $registeredDevicesCount['android'];
        $android_count = $registeredDevicesCount['android'];
    }
    if ($registeredDevicesCount['ios'] !== null) {
        $total_count += $registeredDevicesCount['ios'];
        $ios_count = $registeredDevicesCount['ios'];
    }
    ?>
                            <label>
                                <input id="ml_push_notification_os_all" type="radio" name='ml_push_notification_os' value="all" checked/> All (<?php 
    echo $total_count;
    ?>
 total devices)
                            </label><br/>
                            <label>
                                <input id="ml_push_notification_android" type="radio" name='ml_push_notification_os' value="android" /> Android only (<?php 
    echo $android_count;
    ?>
 devices)
                            </label><br/>
                            <label>
                                <input id="ml_push_notification_ios" type="radio" name='ml_push_notification_os' value="ios" /> iOS only (<?php 
    echo $ios_count;
    ?>
 devices)
                            </label>
                        </p>

                    </td>
                </tr>
            </tbody>
        </table>

        <p class="submit">
            <input type="submit" class='button button-primary button-large' id="ml_push_notification_manual_send_submit" value="<?php 
    _e('Send');
    ?>
" />
        </p>
    </div><!--.ml_send_notification_box-->
	<?php 
}
Exemple #2
0
if (strlen(get_option('ml_pb_app_id')) > 10 && strlen(get_option('ml_pb_secret_key'))) {
    wp_register_script('google_chart', 'https://www.google.com/jsapi');
    wp_enqueue_script('google_chart');
    ?>
<link rel='stylesheet' href="<?php 
    echo MOBILOUD_PLUGIN_URL . '/notifications.css';
    ?>
" type='text/css' media='all' />
<div class="wrap">
    <div class="ml_header">
        <h1 style="float: left;">Mobiloud Push Notifications</h1>
        <a id="intercom" style="float: right;" class="ml-contact-button button button-primary" href="mailto:h89uu5zu@incoming.intercom.io">Contact Us</a>       
        <div style="clear:both;"></div>
        
        <?php 
    $registeredDevicesCount = ml_registered_devices_count();
    ?>
        <div style="float:right;"> 
            <h3 style="float:right;"><u>Registered Devices</u><br/>
            Android: <?php 
    echo $registeredDevicesCount['android'] !== null ? $registeredDevicesCount['android'] == 0 ? 'No Devices Registered' : $registeredDevicesCount['android'] : 'Unknown';
    ?>
<br/>
            iOS: <?php 
    echo $registeredDevicesCount['ios'] !== null ? $registeredDevicesCount['ios'] == 0 ? 'No Devices Registered' : $registeredDevicesCount['ios'] : 'Unknown';
    ?>
            </h3>
        </div>
        <div style="clear:both;"></div>
    </div>
    <p>&nbsp;</p>