當前位置: 首頁>>代碼示例>>PHP>>正文


PHP media2local函數代碼示例

本文整理匯總了PHP中media2local函數的典型用法代碼示例。如果您正苦於以下問題:PHP media2local函數的具體用法?PHP media2local怎麽用?PHP media2local使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了media2local函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: tpl_form_field_wechat_video

function tpl_form_field_wechat_video($name, $value = '', $options = array())
{
    global $_W;
    $account = uni_accounts();
    $data = array();
    if (!empty($account)) {
        foreach ($account as $li) {
            if ($li['level'] < 3) {
                continue;
            }
            $data['item'][] = $li;
        }
        $data['total'] = count($data['item']);
        unset($account);
    }
    if (empty($options['acid']) && $data['total'] == 1) {
        $options['acid'] = $data['item'][0]['acid'];
    }
    if (empty($data['total'])) {
        $options['error'] = 1;
    }
    if (!empty($value)) {
        $media_data = (array) media2local($value, true);
        $val = $media_data['attachment'];
    }
    if (!is_array($options)) {
        $options = array();
    }
    if (empty($options['tabs'])) {
        $options['tabs'] = array('video' => 'active', 'browser' => '');
    }
    $options = array_elements(array('tabs', 'global', 'dest_dir', 'acid', 'error'), $options);
    $options['direct'] = true;
    $options['multi'] = false;
    $options['type'] = 'video';
    $s = '';
    if (!defined('TPL_INIT_WECHAT_VIDEO')) {
        $s = '
<script type="text/javascript">
	function showWechatVideoDialog(elm, options) {
		require(["util"], function(util){
			var btn = $(elm);
			var ipt = btn.parent().prev();
			var val = ipt.val();
			util.wechat_audio(val, function(url){
				if(url && url.media_id && url.url){
					btn.prev().show();
					ipt.val(url.media_id);
					ipt.attr("media_id",url.media_id);
					ipt.attr("url",url.url);
				}
				if(url && url.media_id){
					ipt.val(url.media_id);
				}
			}, ' . json_encode($options) . ');
		});
	}

</script>';
        echo $s;
        define('TPL_INIT_WECHAT_VIDEO', true);
    }
    $s .= '
	<div class="input-group">
		<input type="text" value="' . $value . '" name="' . $name . '" class="form-control" autocomplete="off" ' . ($options['extras']['text'] ? $options['extras']['text'] : '') . '>
		<span class="input-group-btn">
			<button class="btn btn-default" type="button" onclick="showWechatVideoDialog(this,' . str_replace('"', '\'', json_encode($options)) . ');">選擇媒體文件</button>
		</span>
	</div>
	<div class="input-group audio-player">
	</div>';
    if (!empty($media_data) && $media_data['model'] == 'temp' && time() - $media_data['createtime'] > 259200) {
        $s .= '<span class="help-block"><b class="text-danger">該素材已過期 [有效期為3天],請及時更新素材</b></span>';
    }
    return $s;
}
開發者ID:nsoff,項目名稱:wdlcms,代碼行數:76,代碼來源:tpl.func.php

示例2: coupon_fetch

function coupon_fetch($id, $format = true)
{
    global $_W;
    $id = intval($id);
    $item = pdo_fetch('SELECT * FROM ' . tablename('coupon') . ' WHERE uniacid = :aid AND id = :id', array(':aid' => $_W['uniacid'], ':id' => $id));
    if (empty($item)) {
        return error(-1, '卡券不存在或已刪除');
    }
    if (!$format) {
        return $item;
    } else {
        $item['location-select'] = '';
        $item['location_count'] = 0;
        if (!empty($item['location_id_list'])) {
            $item['location_id_list'] = @iunserializer($item['location_id_list']);
            foreach ($item['location_id_list'] as $lic) {
                $item['location_data'][] = pdo_fetch('SELECT business_name, address, location_id FROM ' . tablename('coupon_location') . ' WHERE uniacid = :aid AND location_id = :lid', array(':aid' => $_W['uniacid'], ':lid' => $lic), 'location_id');
            }
            $item['location_count'] = count($item['location_id_list']);
            if (!empty($item['location_id_list'])) {
                $item['location-select'] = implode('-', $item['location_id_list']);
            }
        }
        $item['date_info'] = iunserializer($item['date_info']);
        $item['logo_url'] = media2local($item['logo_url']);
        $item['discount_f'] = (100 - $item['discount']) / 10;
        if ($item['type'] == 'cash') {
            $item['extra'] = iunserializer($item['extra']);
            $item['least_cost'] = $item['extra']['least_cost'];
            $item['reduce_cost'] = $item['extra']['reduce_cost'];
        }
        if ($item['type'] == 'discount' || $item['type'] == 'cash') {
            $item['modules'] = pdo_fetchall('SELECT a.*, b.title FROM ' . tablename('coupon_modules') . ' AS a LEFT JOIN ' . tablename('modules') . ' AS b ON a.module = b.name WHERE a.cid = :id', array(':id' => $id));
        }
    }
    return $item;
}
開發者ID:eduNeusoft,項目名稱:weixin,代碼行數:37,代碼來源:coupon.mod.php

示例3: media2local

     $image = media2local($da['content']['media_id']);
     $content = '<a href="' . $image . '" target="_blank"><img src="' . $image . '" width="200"></a>';
     $str .= tpl_chats_log($content, $da['createtime'], 1);
 } elseif ($da['msgtype'] == 'voice') {
     $image = media2local($da['content']['media_id']);
     $content = '<a href="' . $image . '" target="_blank"><i class="fa fa-bullhorn"></i> 語音消息</a>';
     $str .= tpl_chats_log($content, $da['createtime'], 1);
 } elseif ($da['msgtype'] == 'music') {
     $music = tomedia($da['content']['hqmusicurl']);
     if (empty($music)) {
         $music = tomedia($da['content']['musicurl']);
     }
     $content = '<a href="' . $music . '" target="_blank"><i class="fa fa-music"></i> 音樂消息</a>';
     $str .= tpl_chats_log($content, $da['createtime'], 1);
 } elseif ($da['msgtype'] == 'video') {
     $video = media2local($da['content']['media_id']);
     $content = '<a href="' . $video . '" target="_blank"><i class="fa fa-video-camera"></i> 視頻消息</a>';
     $str .= tpl_chats_log($content, $da['createtime'], 1);
 } elseif ($da['msgtype'] == 'news') {
     if ($da['content']['module'] == 'news') {
         $url = url('platform/reply/post', array('m' => 'news', 'rid' => $da['content']['rid']));
     } elseif ($da['content']['module'] == 'cover') {
         if (in_array($da['content']['cmodule'], array('mc', 'site', 'card'))) {
             $url = url('platform/cover/' . $da['content']['cmodule']);
         } else {
             $eid = pdo_fetchcolumn('SELECT eid FROM ' . tablename('modules_bindings') . ' WHERE module = :m AND do = :do AND entry = :entry', array(':m' => $da['content']['cmodule'], ':do' => $da['content']['do'], ':entry' => 'cover'));
             $li['url'] = url('platform/cover/', array('eid' => $eid));
         }
     }
     $content = '<a href="' . $url . '" target="_blank"><i class="fa fa-file-image-o"></i> 圖文消息:' . $da['content']['name'] . '</a>';
     $str .= tpl_chats_log($content, $da['createtime'], 1);
開發者ID:nsoff,項目名稱:wdlcms,代碼行數:31,代碼來源:notice.ctrl.php

示例4: pdo_fetchcolumn

    $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('mc_mass_record') . $condition, $pars);
    $list = pdo_fetchall("SELECT * FROM " . tablename('mc_mass_record') . $condition . " ORDER BY `id` DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize, $pars);
    $types = array('text' => '文本消息', 'image' => '圖片消息', 'voice' => '語音消息', 'video' => '視頻消息', 'news' => '圖文消息');
    if (!empty($list)) {
        foreach ($list as &$li) {
            if ($li['msgtype'] == 'news') {
                $rid = intval($li['content']);
                if ($rid > 0) {
                    $li['rid'] = $rid;
                    $li['rule_name'] = pdo_fetchcolumn('SELECT name FROM ' . tablename('rule') . ' WHERE id = :id', array(':id' => $rid));
                } else {
                    $li['content'] = iunserializer($li['content']);
                    $li['content'] = iurldecode($li['content']);
                }
            } elseif (in_array($li['msgtype'], array('image', 'voice', 'video'))) {
                $li['content'] = media2local($li['content']);
            }
        }
    }
    $pager = pagination($total, $pindex, $psize);
    template('mc/send');
}
function iurldecode($str)
{
    if (!is_array($str)) {
        return urldecode($str);
    }
    foreach ($str as $key => $val) {
        $str[$key] = iurldecode($val);
    }
    return $str;
開發者ID:aspnmy,項目名稱:weizan,代碼行數:31,代碼來源:mass.ctrl.php

示例5: elseif

												</div>
											</a>
									  </div>
								  </div>
								</div>
							</div>';
                        }
                    }
                    $i++;
                }
            } elseif ($data['msgtype'] == 'text') {
                $html = '<div class="panel panel-default" style="margin-bottom:0">
							<div class="panel panel-body">' . emotion($data['content']) . '</div>
						</div>';
            } elseif ($data['msgtype'] == 'image') {
                $data['content'] = media2local($data['content']);
                $html = '<div class="panel panel-default" style="margin-bottom:0">
							<div class="panel panel-body"><img src="' . $data['content'] . '" style="width:365px;"></div>
						</div>';
            }
            exit($html);
        }
    }
}
function iurldecode($str)
{
    if (!is_array($str)) {
        return urldecode($str);
    }
    foreach ($str as $key => $val) {
        $str[$key] = iurldecode($val);
開發者ID:eduNeusoft,項目名稱:weixin,代碼行數:31,代碼來源:mass.ctrl.php

示例6: message

    $status = $acc->GetColors();
    if (is_error($status)) {
        message($status['message'], referer(), 'error');
    }
    foreach ($status['colors'] as $val) {
        $colors[$val['name']] = $val;
    }
    $colors = base64_encode(iserializer($colors));
    isetcookie('__color', $colors, 86400 * 7);
}
$colors = iunserializer(base64_decode($_GPC['__color']));
load()->func('tpl');
load()->model('coupon');
load()->classs('coupon');
$setting = pdo_fetch('SELECT * FROM  ' . tablename('coupon_setting') . ' WHERE uniacid = :aid AND acid = :cid', array(':aid' => $_W['uniacid'], ':cid' => $acid));
$setting['logourl_'] = media2local($setting['logourl']);
$types = array('discount' => '折扣券', 'cash' => '代金券', 'gift' => '禮品券', 'groupon' => '團購券', 'general_coupon' => '優惠券');
if ($do == 'display') {
    $condition = ' WHERE uniacid = :aid AND acid = :cid';
    $parma[':aid'] = $_W['uniacid'];
    $parma[':cid'] = $acid;
    if (!empty($_GPC['type'])) {
        $condition .= ' AND type = :type';
        $parma[':type'] = $_GPC['type'];
    }
    if (!empty($_GPC['title'])) {
        $title = trim($_GPC['title']);
        $condition .= " AND title LIKE '%{$title}%'";
    }
    if (!empty($_GPC['status'])) {
        $status = intval($_GPC['status']);
開發者ID:6662680,項目名稱:qday_wx,代碼行數:31,代碼來源:card.ctrl.php

示例7: array

     $mass_old[$time_key] = array('msgtype' => 'news', 'group' => -1, 'time' => $time_key, 'status' => 1, 'clock' => '20:00', 'media' => array('items' => array(array('title' => '請選擇素材'))));
 }
 $mass_new = array();
 if (!empty($record)) {
     foreach ($record as &$li) {
         $time_key = date('Y-m-d', $li['sendtime']);
         $li['time'] = $time_key;
         $li['clock'] = date('H:i', $li['sendtime']);
         $li['media'] = pdo_get('wechat_attachment', array('id' => $li['attach_id']));
         $li['media']['attach'] = tomedia($li['media']['attachment']);
         if ($li['msgtype'] == 'video') {
             $li['media']['attach']['tag'] = iunserializer($li['media']['tag']);
         } elseif ($li['msgtype'] == 'news') {
             $li['media']['items'] = pdo_getall('wechat_news', array('attach_id' => $li['attach_id']));
             foreach ($li['media']['items'] as &$row) {
                 $row['thumb'] = media2local($row['thumb_media_id']);
             }
         } elseif ($li['msgtype'] == 'wxcard') {
             $li['media'] = pdo_get('coupon', array('id' => $li['attach_id']));
             $li['media']['media_id'] = $li['media']['card_id'];
             $li['media']['logo_url'] = url('utility/wxcode/image', array('attach' => $li['media']['logo_url']));
             $li['media']['type'] = 'wxcard';
         }
         $li['media']['createtime_cn'] = date('Y-m-d H:i', $li['media']['createtime']);
         $li['media_id'] = $li['media']['media_id'];
         $mass_new[$time_key] = $li;
     }
     unset($record);
 }
 $mass = array_values(array_merge($mass_old, $mass_new));
 template('material/mass');
開發者ID:zhang19960118,項目名稱:html11,代碼行數:31,代碼來源:mass.ctrl.php

示例8: pdo_fetchcolumn

    $psize = 10;
    if ($type == 'image') {
        $psize = 50;
    }
    $limit = " ORDER BY createtime DESC LIMIT " . ($pindex - 1) * $psize . ", {$psize}";
    $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('wechat_attachment') . $condition, $params);
    $lists = pdo_fetchall('SELECT * FROM ' . tablename('wechat_attachment') . $condition . $limit, $params, 'id');
    if (!empty($lists)) {
        foreach ($lists as &$row) {
            if ($type == 'video') {
                $row['tag'] = iunserializer($row['tag']);
                $row['attach'] = tomedia($row['attachment'], true);
            } elseif ($type == 'news') {
                $row['items'] = pdo_getall('wechat_news', array('uniacid' => $_W['uniacid'], 'attach_id' => $row['id']));
                if (!empty($row['items'])) {
                    foreach ($row['items'] as &$li) {
                        $li['thumb'] = media2local($li['thumb_media_id']);
                    }
                }
            } elseif ($type == 'image') {
                $row['attach'] = tomedia($row['attachment'], true);
                $row['url'] = "url({$row['attach']})";
            } elseif ($type == 'voice') {
                $row['attach'] = tomedia($row['attachment'], true);
            }
            $row['createtime_cn'] = date('Y-m-d H:i', $row['createtime']);
        }
    }
    $result = array('items' => $lists, 'pager' => pagination($total, $pindex, $psize, '', array('before' => '2', 'after' => '3', 'ajaxcallback' => 'null')));
    message($result, '', 'ajax');
}
開發者ID:zhang19960118,項目名稱:html11,代碼行數:31,代碼來源:material.ctrl.php


注:本文中的media2local函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。