Released under the terms of the GNU General Public License. You should have received a copy of the GNU General Public License, along with this software. In the main directory, see: /licensing/ If not, see: . */ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"])) exit ("Do not access this file directly."); /**/ if (!class_exists ("c_ws_widget__ad_squares_class")) { class c_ws_widget__ad_squares_class /* < Register this widget class. */ extends WP_Widget /* See: /wp-includes/widgets.php for further details. */ { public function c_ws_widget__ad_squares_class () /* Builds the classname, id_base, description, etc. */ { $widget_ops = array ("classname" => "ad-squares", "description" => $GLOBALS["WS_WIDGET__"]["ad_squares"]["c"]["description"]); $control_ops = array ("width" => $GLOBALS["WS_WIDGET__"]["ad_squares"]["c"]["control_w"], "id_base" => "ws_widget__ad_squares"); /**/ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;'); do_action ("ws_widget__ad_squares_class_before_widget_construction", get_defined_vars (), $this); unset ($__refs, $__v); /* Unset defined __refs, __v. */ /**/ $this->WP_Widget ($control_ops["id_base"], $GLOBALS["WS_WIDGET__"]["ad_squares"]["c"]["name"], $widget_ops, $control_ops); /**/ do_action ("ws_widget__ad_squares_class_after_widget_construction", get_defined_vars (), $this); /**/ return; /* Return for uniformity. */ } /* Widget display function. This is where the widget actually does something. */ public function widget ($args = FALSE, $instance = FALSE) { $options = ws_widget__ad_squares_configure_options_and_their_defaults (false, (array)$instance); /**/ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;'); do_action ("ws_widget__ad_squares_class_before_widget_display", get_defined_vars (), $this); unset ($__refs, $__v); /* Unset defined __refs, __v. */ /**/ echo $args["before_widget"]; /* Ok, here we go into this widget. /**/ if (strlen ($options["title"])) /* If there is. */ echo $args["before_title"] . apply_filters ("widget_title", $options["title"]) . $args["after_title"]; /**/ $options["code_1"] = preg_split ("/\<\!--rotate--\>/", $options["code_1"]); $options["code_2"] = preg_split ("/\<\!--rotate--\>/", $options["code_2"]); $options["code_3"] = preg_split ("/\<\!--rotate--\>/", $options["code_3"]); $options["code_4"] = preg_split ("/\<\!--rotate--\>/", $options["code_4"]); $options["code_5"] = preg_split ("/\<\!--rotate--\>/", $options["code_5"]); $options["code_6"] = preg_split ("/\<\!--rotate--\>/", $options["code_6"]); $options["code_7"] = preg_split ("/\<\!--rotate--\>/", $options["code_7"]); $options["code_8"] = preg_split ("/\<\!--rotate--\>/", $options["code_8"]); /**/ shuffle ($options["code_1"]) . shuffle ($options["code_2"]) . shuffle ($options["code_3"]) . shuffle ($options["code_4"]); shuffle ($options["code_5"]) . shuffle ($options["code_6"]) . shuffle ($options["code_7"]) . shuffle ($options["code_8"]); /**/ $codes = array (); /* Initialize the array of codes so we can push. */ /**/ if ($options["squares"] >= 2) /* Push codes 1 and 2 onto array. */ array_push ($codes, $options["code_1"][0], $options["code_2"][0]); /**/ if ($options["squares"] >= 4) /* Push codes 3 and 4 onto array. */ array_push ($codes, $options["code_3"][0], $options["code_4"][0]); /**/ if ($options["squares"] >= 6) /* Push codes 5 and 6 onto array. */ array_push ($codes, $options["code_5"][0], $options["code_6"][0]); /**/ if ($options["squares"] >= 8) /* Push codes 7 and 8 onto array. */ array_push ($codes, $options["code_7"][0], $options["code_8"][0]); /**/ if ($options["shuffle"]) /* Shuffle? ( problems w/ cache engines. ) */ shuffle ($codes); /* This way they show up differently each time. /**/ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;'); do_action ("ws_widget__ad_squares_class_during_widget_display_before", get_defined_vars (), $this); unset ($__refs, $__v); /* Unset defined __refs, __v. */ /**/ echo '
' . "\n"; echo '' . "\n"; echo '' . "\n"; /**/ if ($options["squares"] >= 2) echo '' . "\n" . /* If they have chosen to show 2 or more ad squares here. */ '' . "\n" ./**/ '' . "\n" ./**/ '' . "\n"; /**/ if ($options["squares"] >= 4) echo '' . "\n" . /* If they have chosen to show 4 or more ad squares here. */ '' . "\n" ./**/ '' . "\n" ./**/ '' . "\n"; /**/ if ($options["squares"] >= 6) echo '' . "\n" . /* If they have chosen to show 6 or more ad squares here. */ '' . "\n" ./**/ '' . "\n" ./**/ '' . "\n"; /**/ if ($options["squares"] >= 8) echo '' . "\n" . /* If they have chosen to show 8 or more ad squares here. */ '' . "\n" ./**/ '' . "\n" ./**/ '' . "\n"; /**/ echo '' . "\n"; echo '
', ( (c_ws_widget__ad_squares_utils_conds::is_multisite_farm ()) ? do_shortcode (trim ($codes[0])) : do_shortcode (c_ws_widget__ad_squares_utilities::evl (trim ($codes[0])))), '', ( (c_ws_widget__ad_squares_utils_conds::is_multisite_farm ()) ? do_shortcode (trim ($codes[1])) : do_shortcode (c_ws_widget__ad_squares_utilities::evl (trim ($codes[1])))), '
', ( (c_ws_widget__ad_squares_utils_conds::is_multisite_farm ()) ? do_shortcode (trim ($codes[2])) : do_shortcode (c_ws_widget__ad_squares_utilities::evl (trim ($codes[2])))), '', ( (c_ws_widget__ad_squares_utils_conds::is_multisite_farm ()) ? do_shortcode (trim ($codes[3])) : do_shortcode (c_ws_widget__ad_squares_utilities::evl (trim ($codes[3])))), '
', ( (c_ws_widget__ad_squares_utils_conds::is_multisite_farm ()) ? do_shortcode (trim ($codes[4])) : do_shortcode (c_ws_widget__ad_squares_utilities::evl (trim ($codes[4])))), '', ( (c_ws_widget__ad_squares_utils_conds::is_multisite_farm ()) ? do_shortcode (trim ($codes[5])) : do_shortcode (c_ws_widget__ad_squares_utilities::evl (trim ($codes[5])))), '
', ( (c_ws_widget__ad_squares_utils_conds::is_multisite_farm ()) ? do_shortcode (trim ($codes[6])) : do_shortcode (c_ws_widget__ad_squares_utilities::evl (trim ($codes[6])))), '', ( (c_ws_widget__ad_squares_utils_conds::is_multisite_farm ()) ? do_shortcode (trim ($codes[7])) : do_shortcode (c_ws_widget__ad_squares_utilities::evl (trim ($codes[7])))), '
' . "\n"; echo '
' . "\n"; /**/ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;'); do_action ("ws_widget__ad_squares_class_during_widget_display_after", get_defined_vars (), $this); unset ($__refs, $__v); /* Unset defined __refs, __v. */ /**/ echo $args["after_widget"]; /**/ do_action ("ws_widget__ad_squares_class_after_widget_display", get_defined_vars (), $this); /**/ return; /* Return for uniformity. */ } /* Widget form control function. This is where options are made configurable. */ public function form ($instance = FALSE) { $options = ws_widget__ad_squares_configure_options_and_their_defaults (false, (array)$instance); /**/ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;'); do_action ("ws_widget__ad_squares_class_before_widget_form", get_defined_vars (), $this); unset ($__refs, $__v); /* Unset defined __refs, __v. */ /* Ok, here is where we need to handle the widget control form. This allows a user to further customize the widget. */ echo '
' . "\n"; echo '

' . "\n"; /**/ echo '' . "\n"; echo '' . "\n"; /**/ echo '' . "\n"; echo '

' . "\n"; /**/ echo 'Paste Code Into These Squares:
' . "\n"; echo '' . "\n"; echo 'Feel free to paste any type of ad code into the squares. AdSense®, XHTML' . ( (c_ws_widget__ad_squares_utils_conds::is_multisite_farm ()) ? '' : ', PHP') . ', IFrame, JavaScript, whatever. The recommended size is 125x125, but it does not have to be that exact size. Just be sure to stick with the same size in each square so things remain symmetrical.' . "\n"; echo '
' . "\n"; /* Try to provide labels for each form element. */ /**/ echo '' . "\n"; echo '' . "\n"; /**/ echo '= 2) ? '' : 'none') . ';">' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; /**/ echo '= 4) ? '' : 'none') . ';">' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; /**/ echo '= 6) ? '' : 'none') . ';">' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; /**/ echo '= 8) ? '' : 'none') . ';">' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; /**/ echo '' . "\n"; echo '
'; echo '' . "\n"; echo ''; echo '' . "\n"; echo '
' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '
' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '
' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '

' . "\n"; /**/ echo '' . "\n"; echo '
' . "\n"; /**/ echo '' . "\n"; echo 'OR: If you would like to rotate a few different ad codes ( inside a particular square ), just insert this special tag: ' . esc_html ("") . ' between every ad code. In other words, one or all of your squares can contain multiple ad codes separated by this rotation tag.' . "\n"; echo '' . "\n"; /**/ do_action ("ws_widget__ad_squares_class_after_widget_form", get_defined_vars (), $this); /**/ echo '
' . "\n"; /**/ return; /* Return for uniformity. */ } /* Widget update function. This is where an updated instance is configured/stored. */ public function update ($instance = FALSE, $old = FALSE) { eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;'); do_action ("ws_widget__ad_squares_class_before_widget_update", get_defined_vars (), $this); unset ($__refs, $__v); /* Unset defined __refs, __v. */ /**/ $instance = (array)c_ws_widget__ad_squares_utils_strings::trim_deep (stripslashes_deep ($instance)); return ws_widget__ad_squares_configure_options_and_their_defaults (false, $instance); } } } ?>