Exemplo n.º 1
0
function xlii_smt_display($content)
{
    // Render top
    $buttons = xlii_smt_get_buttons('default');
    $append = array('top' => '', 'bottom' => '');
    foreach ($append as $section => &$html) {
        $html = xlii_smt_getsection($section, 'left', $buttons) . xlii_smt_getsection($section, 'right', $buttons);
        if ($html) {
            $html = '<div class = "xlii-smt-location">' . $html . ' <br class = "_clear"/></div>';
        }
    }
    return $append['top'] . $content . $append['bottom'];
}
Exemplo n.º 2
0
/** SET BUTTONS -----------------------------------------------------------------------------------------------------------------------------------------------
 * Set the buttons for a particulair section.
 * 
 * @param   string $section The section to store the buttons for.
 * @param   array $buttons The buttons and there values to add to the section.
 */
function xlii_smt_set_buttons($section, array $buttons)
{
    $data = xlii_smt_get_buttons();
    if (count($buttons)) {
        $data[$section] = $buttons;
    } else {
        if (isset($data[$section])) {
            unset($data[$section]);
        } else {
            return;
        }
    }
    update_option('xlii_smt_buttons', $data);
}
Exemplo n.º 3
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 
}