public function get_html() { $params = $this->params; if ($params['username'] === false || !is_int($params['count'] + 0)) { return; // bail out if we haven't got the required parameters } $html = "\n<div id='tweets' class='" . $params['style'] . "'>\n"; $html .= extra_markup($params); // v6.65 if ($params['heading']) { $html .= "<div class='hwrap'>\n<h2>" . $params['heading'] . "</h2>\n</div>\n"; // including its link if there is one } $html .= "<div class='tweet_wrapper' id='twitter_fetcher'></div>\n"; // v6.53 added #twitter_fetcher $html .= Wf_Widget::get_endlink($params); // v5.7 $html .= "</div>\n\n"; global $widget_params; $widget_params['username'] = $params['username']; $widget_params['count'] = $params['count']; $widget_params['method'] = $params['method']; $widget_params['outlaw_key'] = $params['outlaw_key']; //v6.79 - so don't have to hardwire for Carplus! if (!function_exists('pass_tweet_params')) { function pass_tweet_params($widget_params) { global $widget_params; //wp_enqueue_script('twitter_script'); wp_enqueue_script('twitter_' . $widget_params['method']); // v6.78 approved or outlaw wp_enqueue_script('init_tweets_js'); wp_localize_script('init_tweets_js', 'twitter_params', $widget_params); // Necessary that the array declaration and the wp_localize_script stay before wp_head() // wp_localize_script() MUST be called after the script it's being attached to has been enqueued. } } add_action('wp_enqueue_scripts', 'pass_tweet_params'); return $html; }
function get_region_html($region) { if (class_exists('Wf_Widget')) { return Wf_Widget::get_region_html($region); } else { return "Wingfinger Widgets plugin not loaded."; } }
function wf_widget_box_contents() { // v6.66 function empty_or_cancelled($current_or_inherited) { return empty($current_or_inherited) || $current_or_inherited[0]['widget_type'] == 'cancel'; } global $post; // v6.47 $regions = get_regions_list($post); // v6.47 $wf_widgets = Wf_Widget::list_wf_widgets($regions); // v6.47 $html_start = "\n\n\n\t\t<div id='widget_box'>\n\n\t\t<div id='hidden_fields'>\n\n\t\t<textarea cols='30' rows='2' name='list_of_deletes' id='list_of_deletes'></textarea>\n\n\t\t<textarea cols='30' rows='2' name='list_of_updates' id='list_of_updates'></textarea>\n\n\t\t<div id='cfields_to_update'>\n</div>\n\n\t\t</div>\n\n\t\t<div id='admin_region_list'>\n\n\n\t\t<ul class='category-tabs'>\n"; $html = "</ul>\n\n"; // start by finishing off $html_start and then assemble later foreach ($regions as $region_num => $region) { // v6.47 $html_start .= "<li><a href='#region" . $region_num . "'>Region " . $region . "</a></li>\n"; $html .= "<div id='region" . $region_num . "' class='region region_" . $region . "'>\n"; // id used by tabs $html .= "<h4 class='" . $region . "'>Region " . $region . "</h4>\n"; $current = $wf_widgets[$region]['current']; // v6.66 $inherited = $wf_widgets[$region]['inherited']; // v6.66 $inherit_vis = empty_or_cancelled($current) ? "" : " style='display: none;' "; // v6.66 //d('$current ('.$region.')',$current); //d('$inherited ('.$region.')',$inherited ); //d('$inherit_vis',$inherit_vis); // makes sense to include this in .inherited as it gets displayed under similar conditions if (empty_or_cancelled($current) && empty_or_cancelled($inherited)) { // v6.66 $html .= "\n\n\t\t\t\t\t<div class='inherited' " . $inherit_vis . ">\n\n\t\t\t\t\t<p class='strapline'>There are no widgets for this region.</p>\n\t\t\t\t\t</div>\n"; } else { if (!empty_or_cancelled($inherited)) { // v6.66 // Even if there are 'current' widgets, we still need to create this (hidden) list so that js can display it if // the last current widget is removed. $html .= "\n\n\t\t\t\t\t<div class='inherited' " . $inherit_vis . ">\n\n\t\t\t\t\t<p class='strapline'>Widgets inherited from " . $inherited[0]['aboveness'] . " page(s) above:</p>\n\n\t\t\t\t\t<table cellspacing='0' class='widget_table inherited'>\n\n\t\t\t\t\t<tbody>\n"; foreach ($inherited as $c => $r_widget) { $params = trim_parse($r_widget['qstring']); // v6.4 Was Wf_Widget::trim_parse $comment = isset($params['comment']) ? $params['comment'] : " "; $html .= "\n\n\t\t\t\t\t\t<tr class='" . $r_widget['widget_type'] . "'>\n\n\t\t\t\t\t\t<td class='order'>" . ($c + 1) . "</td>\n\n\t\t\t\t\t\t<td class='widget_type'>" . Wf_Widget::$current_specs[$r_widget['widget_type']]['display_name'] . "</td>\n\n\t\t\t\t\t\t<td class='widget_instance_name'>" . $comment . "</td>\n\n\t\t\t\t\t\t<td class='edit'> </td>\n\n\t\t\t\t\t\t<td class='delete'> </td>\n\n\t\t\t\t\t\t</tr>\n"; } $html .= "</tbody>\n</table>\n"; //v6.60 //v6.60 $html .= "<div class='break_inherit'>\n"; $html .= "<label for='" . $region . "_break_inherit'>Cancel inheritance?</label>\n"; $html .= "<input id='" . $region . "_break_inherit' type='checkbox' value='' name='" . $region . "_break_inherit'>"; //v6.60 $html .= "</div>\n"; $html .= "</div>\n"; // finish off div#inherited } // if(!empty_or_cancelled($inherited)) if (!empty_or_cancelled($current)) { // v6.66 $html .= "\n\n\t\t\t\t\t<div class='current'>\n\n\t\t\t\t\t<p class='strapline'>Widgets on this page: (Drag to reorder)</p>\n\n\t\t\t\t\t<table cellspacing='0' class='widget_table current'>\n\n\t\t\t\t\t<tbody class='widget_sort'>\n"; foreach ($current as $c => $r_widget) { $params = trim_parse($r_widget['qstring']); // v6.4 Was Wf_Widget::trim_parse $comment = isset($params['comment']) ? $params['comment'] : " "; $html .= "\n\n\t\t\t\t\t\t<tr class='" . $r_widget['widget_type'] . "'>\n\n\t\t\t\t\t\t<td class='order'>" . ($c + 1) . "</td>\n\n\t\t\t\t\t\t<td class='widget_type'>" . Wf_Widget::$current_specs[$r_widget['widget_type']]['display_name'] . "</td>\n\n\t\t\t\t\t\t<td class='widget_instance_name'>" . $comment . "</td>\n\n\t\t\t\t\t\t<td class='edit'><i class='icon-large icon-edit' title='Edit this widget'></i></td>\n\n\t\t\t\t\t\t<td class='delete'><i class='icon-large icon-remove-sign' title='Delete this widget'></i></td>\n\n\t\t\t\t\t\t</tr>\n"; } $html .= "</tbody>\n</table>\n</div>\n"; // finish off div#current } // if(!empty_or_cancelled($current)) } $html .= "</div>\n\n"; // .region } $html .= "<input id='update2' class='button button-primary button-large' type='button' value='Update'>"; // copy of blue update button $html .= "</div>\n"; $html .= get_widget_dialog(); // the (initially hidden) skeleton of the dialog box, complete with available items $html .= "<br/ class='clearboth'>\n"; $html .= "</div>\n\n"; echo $html_start . $html; }
function setup_region_html() { if (!is_404() && !is_search() && !is_archive()) { // v6.3 v6.12 v6.38 Wf_Widget::wf_widgets(); } }