public function test_facebook_enabled() { $this->assertFalse(ppp_facebook_enabled()); $this->enable_facebook(); $this->assertTrue(ppp_facebook_enabled()); }
/** * Add Facebook to the Metabox Content * @param array $content The existing metabox content * @return array With Facebook */ function ppp_fb_register_metabox_content($content) { global $ppp_social_settings; if (!ppp_facebook_enabled()) { return $content; } $content[] = 'fb'; return $content; }
/** * Display the Social tab * @return void */ function ppp_display_social() { do_action('ppp_social_settings_pre_form'); $ppp_share_settings = get_option('ppp_share_settings'); ?> <div class="wrap"> <div id="icon-options-general" class="icon32"></div><h1><?php _e('Post Promoter Pro - Social Settings', 'ppp-txt'); ?> </h1> <form method="post" action="options.php"> <?php wp_nonce_field('ppp-share-settings'); ?> <h3><?php _e('Social Media Accounts', 'ppp-txt'); ?> </h3> <?php require_once PPP_PATH . 'includes/admin/class-accounts-table.php'; $accounts_table = new PPP_Accounts_Table(); $accounts_table->prepare_items(); $accounts_table->display(); ?> <table class="form-table"> <?php $analytics_option = isset($ppp_share_settings['analytics']) ? $ppp_share_settings['analytics'] : 0; ?> <tr valign="top"> <th scope="row" valign="top"> <?php _e('Analytics', 'ppp-txt'); ?> </span> </th> <td id="ppp-analytics-options"> <p> <input id="ppp_no_tracking" name="ppp_share_settings[analytics]" type="radio" value="none" <?php checked('none', $analytics_option, true); ?> /> <label for="ppp_no_tracking"><?php _e('None', 'ppp-txt'); ?> </label> </p> <br /> <p> <input id="ppp_unique_links" name="ppp_share_settings[analytics]" type="radio" value="unique_links" <?php checked('unique_links', $analytics_option, true); ?> /> <label for="ppp_unique_links"><?php _e('Simple Tracking', 'ppp-txt'); ?> </label><br /> <small><?php _e('Appends a query string to shared links for analytics.', 'ppp-txt'); ?> </small> </p> <br /> <p> <input id="ppp_ga_tags" name="ppp_share_settings[analytics]" type="radio" value="google_analytics" <?php checked('google_analytics', $analytics_option, true); ?> /> <label for="ppp_ga_tags"><?php _e('Google Analytics Tags', 'ppp-txt'); ?> </label><br /> <small><?php _e('Results can be seen in the Acquisition Menu under "Campaigns"', 'ppp-txt'); ?> </small> </p> <?php do_action('ppp-settings-analytics-radio'); ?> <p id="ppp-link-example"> <hr /> <small><?php _e('Here is an example of what your link will look like', 'ppp-txt'); ?> : <br /> <?php $post = wp_get_recent_posts(array('numberposts' => 1)); ?> <?php if (count($post) > 0) { ?> <code><?php echo ppp_generate_link($post[0]['ID'], 'sharedate_1_' . $post[0]['ID'], false); ?> </code></small> <?php } else { ?> <em><?php _e('No posts available to generate link from.', 'ppp-txt'); ?> </em> <?php } ?> </p> </td> </tr> <?php $tw_sop = !empty($ppp_share_settings['twitter']['share_on_publish']) ? true : false; $fb_sop = !empty($ppp_share_settings['facebook']['share_on_publish']) ? true : false; $li_sop = !empty($ppp_share_settings['linkedin']['share_on_publish']) ? true : false; ?> <tr valign="top"> <th scope="row" valign="top"> <?php _e('Share on Publish Defaults', 'ppp-txt'); ?> </span><br /> <small><em><?php _e('Enabled sharing on pubish by default', 'ppp-txt'); ?> </em></small> </th> <td id="ppp-share-on-publish-wrapper"> <?php if (ppp_twitter_enabled()) { ?> <p> <input type="checkbox" id="twitter-share-on-publish" value="1" <?php checked(true, $tw_sop, true); ?> name="ppp_share_settings[twitter][share_on_publish]" /> <label for="twitter-share-on-publish"><?php _e('Twitter', 'ppp-txt'); ?> </label> </p> <?php } ?> <?php if (ppp_facebook_enabled()) { ?> <p> <input type="checkbox" id="facebook-share-on-publish" value="1" <?php checked(true, $fb_sop, true); ?> name="ppp_share_settings[facebook][share_on_publish]" /> <label for="facebook-share-on-publish"><?php _e('Facebook', 'ppp-txt'); ?> </label> </p> <?php } ?> <?php if (ppp_linkedin_enabled()) { ?> <p> <input type="checkbox" id="linkedin-share-on-publish" value="1" <?php checked(true, $li_sop, true); ?> name="ppp_share_settings[linkedin][share_on_publish]" /> <label for="linkedin-share-on-publish"><?php _e('LinkedIn', 'ppp-txt'); ?> </label> </p> <?php } ?> </td> </tr> <?php $twitter_cards_enabled = ppp_tw_cards_enabled(); ?> <tr valign="top"> <th scope="row" valign="top"> <?php _e('Twitter Settings', 'ppp-txt'); ?> </span> </th> <td id="ppp-twitter-cards-wrapper"> <p> <input id="ppp-twitter-cards" name="ppp_share_settings[twitter][cards_enabled]" type="checkbox" value="1" <?php checked(true, $twitter_cards_enabled, true); ?> /> <label for="ppp-twitter-cards"><?php _e('Enable Twitter Cards', 'ppp-txt'); ?> </label> </p> </td> </tr> <?php $shortener = isset($ppp_share_settings['shortener']) ? $ppp_share_settings['shortener'] : false; ?> <tr valign="top"> <th scope="row" valign="top"> <?php _e('URL Shortener', 'ppp-txt'); ?> </span> </th> <td id="ppp-shortener-options"> <p> <select name="ppp_share_settings[shortener]"> <option value="-1"><?php _e('Select a Service', 'ppp-txt'); ?> </option> <?php do_action('ppp_url_shorteners', $shortener); ?> </select> </p> <?php if ($shortener) { ?> <?php do_action('ppp_shortener_settings-' . $shortener); ?> <?php } ?> </td> </tr> <?php settings_fields('ppp-share-settings'); ?> <input type="hidden" name="action" value="update" /> <input type="hidden" name="page_options" value="ppp_share_settings,ppp_social_settings" /> </table> <input type="submit" class="button-primary" value="<?php _e('Save Changes', 'ppp-txt'); ?> " /> </form> </div> <?php }