<?php /** * @author 42functions | Ferdy Perdaan * @version 1.0 */ include_once 'buttons/Default.php'; // Load all buttons xlii_smt_supported_buttons(); // Register front page CSS // Should normaly convert to: http://domain.example/wp-content/plugins/xlii-social-media-tracker define('XLII_SMT_BASE', WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__)) . '/'); function xlii_smt_load_resources() { wp_register_style('xlii_smt_front', XLII_SMT_BASE . 'resource/xlii_front.css', array()); wp_register_script('xlii_smt_front', XLII_SMT_BASE . 'resource/xlii_front.js', array('jquery'), 1.0, true); wp_register_script('xlii_smt_tracking', XLII_SMT_BASE . 'resource/xlii_tracking.js', array('jquery'), 1.0, true); // Register button dependencies wp_register_script('xlii_smt_google', 'http://apis.google.com/js/plusone.js', array(), 1.0, true); wp_register_script('xlii_smt_twitter', 'http://platform.twitter.com/widgets.js', array(), 1.0, true); wp_register_script('xlii_smt_facebook', 'http://connect.facebook.net/en_US/all.js#xfbml=1', array(), 1.0, true); } add_action('init', 'xlii_smt_load_resources'); // ------------------------------------------------------------------------------------------------------------------------------------------------------------ // CUSTOM METHODS // ------------------------------------------------------------------------------------------------------------------------------------------------------------ /** GA OPTIONS ------------------------------------------------------------------------------------------------------------------------------------------------ * Fetch the plugin ga options. * * @return array */
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 }