当前位置: 首页>>代码示例>>PHP>>正文


PHP Service::getApis方法代码示例

本文整理汇总了PHP中Service::getApis方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::getApis方法的具体用法?PHP Service::getApis怎么用?PHP Service::getApis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Service的用法示例。


在下文中一共展示了Service::getApis方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: embedShortcode

 /**
  * Registers the shortcode for WP usage
  * 
  * 
  * @return <type>
  */
 public static function embedShortcode($atts)
 {
     //make sure we have params we need
     $html = '';
     if (isset($atts['podcast']) && !empty($atts['podcast'])) {
         if (strpos($atts['podcast'], 'libsyn-podcast-') !== false) {
             //regular my-podcast
             $atts['show_id'] = str_replace('libsyn-podcast-', '', $atts['podcast']);
             unset($atts['podcast']);
             $html .= self::getDataForLibsynPodcast($atts);
         } elseif ($atts['podcast'] === 'my-podcast') {
             //my-podcast with no show_id
             $plugin = new Service();
             $api = $plugin->getApis();
             $show_id = $api->getShowId();
             if (is_numeric($show_id)) {
                 $atts['show_id'] = $show_id;
                 unset($atts['podcast']);
             }
             $html .= self::getDataForLibsynPodcast($atts);
         } else {
             //handle podcast url
             if (isset($atts['podcast']) && !empty($atts['podcast'])) {
                 $atts['feed_url'] = $atts['podcast'];
                 unset($atts['podcast']);
             }
             $html .= self::getDataForPodcast($atts);
         }
         return $html;
     }
 }
开发者ID:jzornow,项目名称:changingdenver,代码行数:37,代码来源:Playlist.php

示例2: form

    /**
     * Outputs the options form on admin
     *
     * @param array $instance The widget options
     */
    public function form($instance)
    {
        $plugin = new Service();
        $api = $plugin->getApis();
        $my_podcast_text = isset($api) && $api !== false ? "libsyn-podcast-" . $api->getShowId() : "my-podcast";
        $podcast_url = !empty($instance['podcast_url']) ? $instance['podcast_url'] : __('', 'text_domain');
        $playlist_type = !empty($instance['playlist_type']) ? $instance['playlist_type'] : __('', 'text_domain');
        $playlist_feed_type = !empty($instance['playlist_feed_type']) ? $instance['playlist_feed_type'] : __('', 'text_domain');
        $playlist_video_width = !empty($instance['playlist_video_width']) ? $instance['playlist_video_width'] : 240;
        $playlist_video_height = !empty($instance['playlist_video_height']) ? $instance['playlist_video_height'] : 180;
        //get the playlist id
        $typeStr = $this->get_field_id('playlist_type');
        $typeArr = explode('-', $typeStr);
        $id = intval($typeArr[2]);
        ?>
			<p>
				<span style="font-weight:bold;">Playlist Type:</span><br>
				<input type="radio" name="<?php 
        echo $this->get_field_name('playlist_type');
        ?>
" value="audio" id="<?php 
        echo $this->get_field_id('playlist_type');
        ?>
_audio" onclick="hideDimensionsDiv<?php 
        echo $id;
        ?>
()" <?php 
        echo esc_attr($playlist_type) === 'audio' ? 'checked="checked"' : '';
        if (empty($playlist_type)) {
            echo 'checked="checked"';
        }
        ?>
 /><label for="<?php 
        _e('playlist_type', 'playlist-widget');
        ?>
">Audio</label>
				<input type="radio" name="<?php 
        echo $this->get_field_name('playlist_type');
        ?>
" value="video" id="<?php 
        echo $this->get_field_id('playlist_type');
        ?>
_video" onclick="showDimensionsDiv<?php 
        echo $id;
        ?>
()" <?php 
        echo esc_attr($playlist_type) === 'video' ? 'checked="checked"' : '';
        ?>
 /><label for="<?php 
        _e('playlist_type', 'playlist-widget');
        ?>
">Video</label>
				<div style="padding:5px;display:none;" id="<?php 
        echo $this->get_field_id('playlist_type');
        ?>
_playlist-dimensions-div">
					<label for="<?php 
        _e('playlist_video_width', 'playlist-widget');
        ?>
">Width</label>
					<input name="<?php 
        echo $this->get_field_name('playlist_video_width');
        ?>
" id="playlist_video_width-<?php 
        _e($id);
        ?>
" type="text" value="<?php 
        _e($playlist_video_width);
        ?>
">
					<br>
					<label for="<?php 
        _e('playlist_video_height', 'playlist-widget');
        ?>
">Height</label>
					<input name="<?php 
        echo $this->get_field_name('playlist_video_height');
        ?>
" id="playlist_video_height-<?php 
        _e($id);
        ?>
" type="text" value="<?php 
        _e($playlist_video_height);
        ?>
">
				</div>
				<br><span style="font-weight:bold;">Playlist Source:</span><br>
				<input type="radio" name="<?php 
        echo $this->get_field_name('playlist_feed_type');
        ?>
" value="<?php 
        echo $my_podcast_text;
        ?>
" id="my-podcast-<?php 
        _e($id);
//.........这里部分代码省略.........
开发者ID:jzornow,项目名称:changingdenver,代码行数:101,代码来源:PlaylistWidget.php

示例3: loadFormData

 /**
  * Handle ajax page for loading post page form data
  * 
  * 
  * @return <type>
  */
 public static function loadFormData()
 {
     if (intval(get_query_var('load_libsyn_media')) == 1 && current_user_can('upload_files') && current_user_can('edit_posts')) {
         global $wpdb;
         $error = false;
         $plugin = new Service();
         $api = $plugin->getApis();
         $wpdb->delete($wpdb->prefix . 'posts', array('post_mime_type' => 'libsyn/ftp-unreleased'));
         $wpdb->delete($wpdb->prefix . 'posts', array('post_mime_type' => 'audio/ftp-unreleased'));
         $wpdb->delete($wpdb->prefix . 'posts', array('post_mime_type' => 'video/ftp-unreleased'));
         $wpdb->get_results($wpdb->prepare("DELETE FROM " . $wpdb->prefix . "postmeta WHERE meta_value LIKE %s", "/libsyn/ftp-unreleased%"));
         if ($api instanceof Api && !$api->isRefreshExpired()) {
             $refreshApi = $api->refreshToken();
             if ($refreshApi) {
                 //successfully refreshed
                 /* Remove and add FTP/Unreleased Media */
                 $ftp_unreleased = $plugin->getFtpUnreleased($api)->{'ftp-unreleased'};
                 if (!empty($ftp_unreleased)) {
                     foreach ($ftp_unreleased as $media) {
                         // We need to make sure we are working with only audio/video files...
                         if (strpos($media->mime_type, 'audio') !== false || strpos($media->mime_type, 'video') !== false) {
                             //for new versions of wordpress - handle media info in metadata
                             if (strpos($media->mime_type, 'video') !== false) {
                             } elseif (strpos($media->mime_type, 'audio') !== false) {
                             } else {
                                 //neither audio or video
                             }
                             $file_name = explode('.', $media->file_name);
                             $mime_type = explode('/', $media->mime_type);
                             $data = array('post_author' => get_current_user_id(), 'post_date' => date("Y-m-d H:i:s"), 'post_date_gmt' => date("Y-m-d H:i:s"), 'post_content' => 'Libsyn FTP/Unreleased Media: ' . $media->file_name, 'post_title' => $file_name[0], 'post_excerpt' => '', 'post_status' => 'inherit', 'comment_status' => 'open', 'ping_status' => 'closed', 'post_password' => '', 'post_name' => 'libsyn-ftp-' . $media->content_id, 'to_ping' => '', 'pinged' => '', 'post_modified' => date("Y-m-d H:i:s"), 'post_modified_gmt' => date("Y-m-d H:i:s"), 'post_content_filtered' => '', 'post_parent' => 0, 'guid' => $media->file_name, 'menu_order' => 0, 'post_type' => 'attachment', 'post_mime_type' => 'libsyn/ftp-unreleased', 'comment_count' => 0);
                             //$wpdb->insert($wpdb->prefix . 'posts', $data);
                             $post_id = wp_insert_post($data, false);
                             //add post meta
                             add_post_meta($post_id, '_wp_attached_file', '/libsyn/ftp-unreleased/' . $media->file_name);
                         }
                     }
                 }
                 /* Get categories and send output on success */
                 $categories = $plugin->getCategories($api)->{'categories'};
                 if (!is_array($categories)) {
                     $categories = array($categories);
                 }
                 $json = array();
                 foreach ($categories as $category) {
                     if (isset($category->item_category_name)) {
                         $json[] = $category->item_category_name;
                     }
                 }
                 //if(empty($json)) $error = true;
             } else {
                 $error = true;
             }
         } else {
             $error = true;
         }
         //set output
         header('Content-Type: application/json');
         if (!$error) {
             echo json_encode($json);
         } else {
             echo json_encode(array());
         }
         exit;
     }
 }
开发者ID:jzornow,项目名称:changingdenver,代码行数:71,代码来源:Post.php


注:本文中的Service::getApis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。