/** * Return HTML markup for the networks. * @since 1.0.0 * @return string HTML markup. */ function subscribe_and_connect_get_networks() { global $subscribe_and_connect; $settings = $subscribe_and_connect->get_settings(); $networks = Subscribe_And_Connect_Utils::get_networks_in_order($settings['connect']['networks'], $settings['connect']['networks_order']); $list = ''; if (0 < count($networks)) { foreach ($networks as $k => $v) { if (!isset($v['url']) || '' == $v['url']) { continue; } $class = $k; $list .= '<li class="' . esc_attr($class) . '"><a href="' . esc_url($v['url']) . '"><span>' . "\n"; $list .= '</span></a></li>' . "\n"; } } $html = ''; if ('' != $list) { $theme = 'icons'; $list = apply_filters('subscribe_and_connect_networks_list', $list, $settings, $theme, $networks); // Parse and apply the icon theme, if applicable. if ($subscribe_and_connect->context->is_valid_theme($settings['display']['theme'])) { $theme = $subscribe_and_connect->context->get_sanitized_theme_key($settings['display']['theme']); } $html .= '<ul class="icons ' . esc_attr('icon-theme-' . $theme) . '">' . "\n"; $html .= $list; $html .= '</ul><!--/.icons-->' . "\n"; } return $html; }
/** * Get data for a specified theme. * @access public * @since 1.0.0 * @param array $args Arguments for the current theme. * @return string The slug of the theme, or 'default'. */ public function get_theme_data($key) { $theme = array('name' => 'icons', 'stylesheet' => ''); $available_themes = Subscribe_And_Connect_Utils::get_icon_themes(); if (in_array($key, array_keys($available_themes))) { $theme = $available_themes[esc_attr($key)]; } return $theme; }
/** * Display a list of supported post types below the "automated integration" setting. * @access public * @since 1.0.0 * @return string $html Rendered HTML markup. */ public function display_supported_post_types() { $supported = Subscribe_And_Connect_Utils::get_supported_post_types(); $html = ''; if (0 < count($supported)) { $post_type_names = array(); $last_one = ''; if (1 < count($supported)) { $last_item_obj = array_pop($supported); $last_one = __('and', 'subscribe-and-connect') . ' <code>' . $last_item_obj->labels->name . '</code>'; } foreach ($supported as $k => $v) { $post_type_names[] = '<code>' . $v->labels->name . '</code>'; } $post_types = join($post_type_names) . $last_one; $html .= sprintf(__('If the automated integration is used, Subscribe & Connect will display on posts of the %1$s types.', 'subscribe-and-connect'), $post_types) . '<br /><br />'; } $html .= wpautop('<small>' . sprintf(__('To integrate a specific post type with Subscribe & Connect, add %1$s to your %2$s in your theme, or to your custom plugin.', 'subscribe-and-connect'), '<code><small>add_post_type_support( \'your-post-type\', \'subscribe-and-connect\' );</small></code>', '<code><small>functions.php</small></code>') . '</small>'); return $html; }
/** * form_field_network function. * * @access public * @since 1.0.0 * @param array $args * @return void */ public function form_field_network($args) { $options = $this->get_settings(); $networks = Subscribe_And_Connect_Utils::get_supported_networks(); $html = ''; $order = ''; if (isset($options['networks_order'])) { $order = $options['networks_order']; } $networks = Subscribe_And_Connect_Utils::get_networks_in_order($networks, $order); if (0 < count($networks)) { $html .= '<table class="form-table widefat subscribe-and-connect-network-fields"><thead><tr><th class="title">' . __('Social Network', 'woothemes-wc') . '</th><th class="title">' . __('Your URL', 'woothemes-wc') . '</th></tr></thead><tbody>' . "\n"; foreach ($networks as $k => $v) { $html .= $this->_single_network_field($k, $v, $args, $options); } $html .= '</tbody></table>' . "\n"; } // Used to store the placeholder image temporarily, for use with JavaScript. $html .= '<img src="' . esc_url(Subscribe_And_Connect_Utils::get_placeholder_image()) . '" class="subscribe-and-connect-placeholder-image" style="display: none;" width="0" height="0" />' . "\n"; echo $html; if (isset($args['data']['description'])) { echo '<p class="description">' . wp_kses_post($args['data']['description']) . '</p>' . "\n"; } }
/** * The importer screen markup. * @access public * @since 1.0.0 * @return void */ public function importer_screen() { global $subscribe_and_connect; $key_transforms = Subscribe_And_Connect_Utils::get_wf_to_sc_key_transforms(); $settings = $subscribe_and_connect->get_settings(); // Prepare an array of keys to check for. $keys = array(); // Apply the key transforms detected. if (0 < count($key_transforms)) { $keys = array_merge($keys, array_values($key_transforms)); } // Add any networks to be checked. if (isset($settings['connect']['networks']) && 0 < count($settings['connect']['networks'])) { $prefix = 'woo_connect_'; if (isset($settings['connect']['networks']) && 0 < count($settings['connect']['networks'])) { foreach ($settings['connect']['networks'] as $k => $v) { if (!in_array($prefix . $k, $keys)) { if ('google_plus' == $k) { $k = 'googleplus'; } // A small caveat to match how the option looks in the WooFramework. $keys[] = $prefix . $k; } } } } $keys = Subscribe_And_Connect_Utils::filter_existing_keys($keys); ?> <div class="wrap"> <?php screen_icon(); ?> <h2><?php _e('Subscribe & Connect WooFramework Importer', 'subscribe-and-connect'); ?> </h2> <form action="" method="post"> <?php wp_nonce_field('subscribe-and-connect-importer', 'subscribe-and-connect-importer'); do_action('subscribe_and_connect_wf_importer_before'); if (0 >= count($keys)) { _e('No existing Subscribe & Connect data, from your WooThemes theme, was found. You\'re good to go!', 'subscribe-and-connect'); } else { $key_labels = Subscribe_And_Connect_Utils::get_wf_key_labels(); ?> <table class="wp-list-table widefat fixed" style="max-width: 500px;"> <tbody> <?php $counter = 0; foreach ($keys as $k => $v) { $counter++; $class = 'alternate'; if (0 == $counter % 2) { $class = ''; } $label = $k; if (isset($key_labels[$k]) && '' != $key_labels[$k]) { $label = $key_labels[$k]; } ?> <tr valign="top" class="<?php echo esc_attr($class); ?> "> <th scope="row" class="check-column"><input type="checkbox" value="<?php echo esc_attr($k); ?> " name="sc_fields_to_import[]" /></td> <td><?php echo esc_html($label) . '<br /><code><small>(' . esc_attr($k) . ')</small></code>'; ?> </td> <td><?php echo esc_html($v); ?> </td> </tr> <?php } ?> </tbody> <thead> <tr> <th scope="col" id="cb" class="manage-column column-cb check-column" style=""><label class="screen-reader-text" for="cb-select-all-1">Select All</label><input id="cb-select-all-1" type="checkbox"></th> <th><?php _e('Title', 'subscribe-and-connect'); ?> </th> <th><?php _e('Stored Value', 'subscribe-and-connect'); ?> </th> </tr> </thead> </table> <?php submit_button(__('Import Settings', 'subscribe-and-connect')); } do_action('subscribe_and_connect_wf_importer_after'); ?> </form> </div><!--/.wrap--> <?php }