Example #1
0
 /**
  * Widget
  *
  * The output of the widget to the site
  *
  * @see WP_Widget::widget()
  *
  * @param array $args
  * @param array $instance
  *
  * @see See Class Docs for filtering the output,settings,and args
  *
  * @see Notice error removed with help from WebEndev
  * @see nofollow error was remove with help from Heiko Manfrass
  *
  */
 function widget($args, $instance)
 {
     do_action('simple_links_widget_pre_render', $args, $instance);
     extract($args);
     //Filter for Changing the widget args
     $args = apply_filters('simple_links_widget_args', $args);
     $args = apply_filters('simple_links_widget_args_' . $widget_id, $args);
     $instance['id'] = $args['id'];
     //Call this filter to change the Widgets Settings Pre Compile
     $instance = apply_filters('simple_links_widget_settings', $instance, $args);
     $instance = apply_filters('simple_links_widget_settings_' . $widget_id, $instance);
     //--------------- Starts the Output --------------------------------------
     $output = $before_widget;
     //Add the title
     if (!empty($instance['title'])) {
         $instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $args);
         $output .= $before_title . $instance['title'] . $after_title;
     }
     $links = new SimpleLinksFactory($instance, 'widget');
     $output .= $links->output();
     //Close the Widget
     $output .= $after_widget;
     //The output can be filtered here
     $output = apply_filters('simple_links_widget_output_' . $widget_id, $output, $links->links, $instance, $args);
     echo apply_filters('simple_links_widget_output', $output, $links->links, $instance, $args);
 }
Example #2
0
 /**
  * Creates the shortcode output
  *
  * @return the created list based on attributes
  * @uses  [simple-links $atts]
  *
  * @param string $atts the attributes specified in shortcode
  *
  * @since 1.7.14
  *
  * @param        $atts = 'title'              => false,
  *                     'category'           => false,
  *                     'orderby'           => 'menu_order',
  *                     'count'             => '-1',
  *                     'show_image'        => false,
  *                     'show_image_only'   => false,
  *                     'image_size'        => 'thumbnail',
  *                     'order'             => 'ASC',
  *                     'fields'            => false,
  *                     'description'       => false,
  *                     'separator'         =>  '-',
  *                     'id'                =>  false,
  *                     'remove_line_break' =>  false
  *
  * @filters
  *       the shortcode atts
  *      * add_filter( 'simple_links_shortcode_atts', $atts );
  *       the shortcode output
  *      * add_filter( 'simple_links_shortcode_output', $output, $links, $atts )
  *       the links object directly
  *      *  apply_filters('simple_links_shortcode_links_object', $links, $atts);
  *       the links meta data per link
  *      * apply_filters('simple_links_shortcode_link_meta', $meta, $link, $atts );
  *
  *
  * @uses  the function filtering this output can accept 3 args.   <br>
  *                $output = The Output Generated by the Function
  *                $links  = The complete links to direct munipulation
  *                $atts   = The shortcode Attributes sent to this
  * @uses  All filters may be used by id by calling them with the id appened like so  'simple_links_shortcode_output_%id%' there must be an 'id' specified in the shortcode for this to work
  * @uses  Using the filters without the id will filter all the shortcodes
  *
  */
 function shortcode($atts)
 {
     //shortcode atts filter -
     $atts = apply_filters('simple_links_shortcode_atts', $atts);
     if (isset($atts['id'])) {
         $atts = apply_filters('simple_links_shortcode_atts_' . $atts['id'], $atts);
     }
     $links = new SimpleLinksFactory($atts, 'shortcode');
     $filter_params = array($links->output(), $links->links, $links->args, $links->query_args);
     $output = apply_filters_ref_array('simple_links_shortcode_output', $filter_params);
     if (isset($atts['id'])) {
         $filter_params[0] = $output;
         $output = apply_filters_ref_array('simple_links_shortcode_output_' . $atts['id'], $filter_params);
     }
     return $output;
 }