Пример #1
0
 /**
  * Widget
  *
  * @ Updated 1.2.5
  */
 function widget($args, $options)
 {
     $bot = new PhotoTileForTumblrBot();
     extract($args);
     // Set Important Widget Options
     $bot->set_private('wid', $args['widget_id']);
     $bot->set_private('options', $options);
     $bot->do_alpine_method('update_global_options');
     $bot->do_alpine_method('enqueue_style_and_script');
     // Do the photo search
     $bot->do_alpine_method('photo_retrieval');
     echo $before_widget . $before_title . $options['widget_title'] . $after_title;
     echo $bot->get_active_result('hidden');
     if ($bot->check_active_result('success')) {
         if (isset($options['style_option']) && 'vertical' == $options['style_option']) {
             $bot->do_alpine_method('display_vertical');
         } elseif (isset($options['style_option']) && 'cascade' == $options['style_option']) {
             $bot->do_alpine_method('display_cascade');
         } else {
             $bot->do_alpine_method('display_hidden');
         }
         echo $bot->get_private('output');
     } elseif ($bot->check_active_option('general_hide_message')) {
         echo '<!-- Sorry:<br>' . $bot->get_active_result('message') . '-->';
     } else {
         echo 'Sorry:<br>' . $bot->get_active_result('message');
     }
     echo $after_widget;
 }
Пример #2
0
/**
 * Alpine PhotoTile for Tumblr: Shortcode
 *
 * @ Since 1.1.1
 * @ Updated 1.2.5
 */
function APTFTbyTAP_shortcode_function($atts)
{
    $bot = new PhotoTileForTumblrBot();
    $optiondetails = $bot->option_defaults();
    $options = array();
    foreach ($optiondetails as $opt => $details) {
        $options[$opt] = $details['default'];
        if (isset($details['short']) && isset($atts[$details['short']])) {
            $options[$opt] = $atts[$details['short']];
        }
    }
    $id = rand(100, 1000);
    $bot->set_private('wid', 'id' . $id);
    $bot->set_private('options', $options);
    $bot->do_alpine_method('update_global_options');
    $bot->do_alpine_method('enqueue_style_and_script');
    // Do the photo search
    $bot->do_alpine_method('photo_retrieval');
    $return = '<div id="' . $bot->get_private('id') . '-by-shortcode-' . $id . '" class="AlpinePhotoTiles_inpost_container">';
    $return .= $bot->get_active_result('hidden');
    if ($bot->check_active_result('success')) {
        if ('vertical' == $options['style_option']) {
            $bot->do_alpine_method('display_vertical');
        } elseif ('cascade' == $options['style_option']) {
            $bot->do_alpine_method('display_cascade');
        } else {
            $bot->do_alpine_method('display_hidden');
        }
        $return .= $bot->get_private('output');
    } elseif ($bot->check_active_option('general_hide_message')) {
        $return .= '<!-- Sorry:<br>' . $bot->get_active_result('message') . '-->';
    } else {
        $return .= 'Sorry:<br>' . $bot->get_active_result('message');
    }
    $return .= '</div>';
    return $return;
}