Example #1
0
/** IS ENABLED ------------------------------------------------------------------------------------------------------------------------------------------------
 * Returns wether the plugin is enabled on this page.
 * 
 * @filter  xlii_smt_is_enabled
 * @return  bool
 */
function xlii_smt_is_enabled()
{
    foreach (xlii_smt_get_enabled() as $key => $enabled) {
        $method = 'is_' . $key;
        if ($enabled && function_exists($method) && $method()) {
            return true;
        }
    }
    return apply_filters('xlii_smt_is_enabled', false);
}
Example #2
0
function xlii_smt_adminpage_main()
{
    if (isset($_POST['save'])) {
        xlii_smt_adminprocess_main();
    }
    $template = xlii_smt_supported_buttons();
    $enabled = xlii_smt_get_enabled();
    $buttons = xlii_smt_get_buttons('default');
    ?>
    <form action="<?php 
    echo esc_attr($_SERVER['REQUEST_URI']);
    ?>
" method="post">
        <div class="wrap">
    	    <?php 
    screen_icon();
    ?>
    	    <h2><?php 
    _e('Social Media Tracker');
    ?>
</h2>
    	    <?php 
    _xlii_smt_notify();
    _xlii_smt_navigation();
    ?>
            <div id = "xlii-admin" class = "main">
                <div class = "wrapper">
                    <ul class = "left">
                        <li class = "location">
                            <div class = "xlii-smt-location top"> 
                                <?php 
    _xlii_smt_rendersection('top', 'left', $buttons);
    _xlii_smt_rendersection('top', 'right', $buttons);
    ?>
                                <br class = "_clear" />
                            </div>
                            <img src = "<?php 
    echo XLII_SMT_BASE . 'media/blogpost.png';
    ?>
" alt = "blogpost" title = "blogpost" />
                            <div class = "xlii-smt-location bottom">
                                <?php 
    _xlii_smt_rendersection('bottom', 'left', $buttons);
    _xlii_smt_rendersection('bottom', 'right', $buttons);
    ?>
                                <br class = "_clear" />
                            </div>
                        </li>
                        <li class = "options">
                            <strong>Button options</strong>
                            <ul class = "right">
                                <li class = "meta"></li>
                                <li class = "remove"><?php 
    _e('Remove');
    ?>
</li>
                            </ul>
                            <div class = "container"></div>
                        </li>
                        <div id = "recyclebin"><?php 
    _e('Drag the button here to remove it');
    ?>
</div>
                    </ul>
                    <ul class = "right">
                        <li class = "buttons">
                            <strong>Buttons</strong>
                            <div class = "description"><?php 
    _e('Drag buttons to the dary gray areas in blog post or append them to other buttons within the area.');
    _e(' Dragging activation is temporarily limited to the name, we\'re working on this.');
    ?>
</div>
                            <ul>
                                <?php 
    $source = XLII_GUIFactory::setSource(XLII_GUIFactory::SOURCE_NONE);
    foreach ($template as &$button) {
        _xlii_smt_renderbutton($button, true);
    }
    XLII_GUIFactory::setSource($source);
    ?>
                            </ul>
                        </li>
                        <li class = "displayoptions">
                            <strong><?php 
    _e('Display options');
    ?>
</strong>
                            <div class = "description"><?php 
    _e('Indicates on wich pages and archives the plugin should be loaded and append the buttons.');
    ?>
</div>
                            <ul>
                                <?php 
    $sections = array('home' => 'Front page of the blog', 'single' => 'Individual blog posts', 'page' => 'Individual WordPress "Pages"', 'category' => 'Category archives', 'tag' => 'Tag listings', 'date' => 'Date-based archives', 'author' => 'Author archives', 'search' => 'Search results');
    foreach ($sections as $type => $label) {
        echo '<li>' . XLII_GUIFactory::checkbox(array('label' => __($label), 'name' => 'enabled[' . $type . ']', 'id' => 'xlii_smt_enabled_' . $type, 'value' => isset($enabled[$type]))) . '</li>';
    }
    ?>
			                </ul>
                        </li>
                        <li><?php 
    echo XLII_GUIFactory::submit(array('name' => 'save', 'label' => __('Save state')));
    ?>
</li>
                    </ul>
                    <br class = "_clear" />
                </div>
            </div>
        </div>
    </form>
    <?php 
}