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


PHP pnModAPIFunc函数代码示例

本文整理汇总了PHP中pnModAPIFunc函数的典型用法代码示例。如果您正苦于以下问题:PHP pnModAPIFunc函数的具体用法?PHP pnModAPIFunc怎么用?PHP pnModAPIFunc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: mediashare_sourcesapi_scanSources

function mediashare_sourcesapi_scanSources()
{
    // Check access
    if (!SecurityUtil::checkPermission('mediashare::', '::', ACCESS_ADMIN)) {
        return LogUtil::registerPermissionError();
    }
    $dom = ZLanguage::getModuleDomain('mediashare');
    // Clear existing sources table
    if (!DBUtil::truncateTable('mediashare_sources')) {
        return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('sourcesapi.scanSources', __f("Could not clear the '%s' table.", 'sources', $dom)), $dom));
    }
    // Scan for sources APIs
    $files = FileUtil::getFiles('modules/mediashare', false, true, 'php', 'f');
    foreach ($files as $file) {
        if (preg_match('/^pnsource_([-a-zA-Z0-9_]+)api.php$/', $file, $matches)) {
            $sourceName = $matches[1];
            $sourceApi = "source_{$sourceName}";
            // Force load - it is used during pninit
            pnModAPILoad('mediashare', $sourceApi, true);
            if (!($title = pnModAPIFunc('mediashare', $sourceApi, 'getTitle'))) {
                return false;
            }
            if (!pnModAPIFunc('mediashare', 'sources', 'addSource', array('title' => $title, 'name' => $sourceName))) {
                return false;
            }
        }
    }
    return true;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:29,代码来源:pnsourcesapi.php

示例2: mediashare_external_pasteitem

function mediashare_external_pasteitem($args)
{
    // FIXME access check
    $albumId = mediashareGetIntUrl('aid', $args, 0);
    $mediaId = mediashareGetIntUrl('mid', $args, 0);
    $mode = FormUtil::getPassedValue('mode');
    if (isset($_POST['backButton'])) {
        return pnRedirect(pnModUrl('mediashare', 'external', 'finditem', array('aid' => $albumId, 'mid' => $mediaId, 'mode' => $mode)));
    }
    $mediaItem = pnModAPIFunc('mediashare', 'user', 'getMediaItem', array('mediaId' => $mediaId));
    /*
        if (!($handler = pnModAPIFunc('mediashare', 'mediahandler', 'loadHandler', array('handlerName' => $mediaItem['mediaHandler'])))) {
            return false;
        }
    */
    $render =& pnRender::getInstance('mediashare', false);
    mediashareExternalLoadTheme($render);
    $render->assign('albumId', $albumId);
    $render->assign('mediaId', $mediaId);
    $render->assign('mediaItem', $mediaItem);
    if ($mediaItem['mediaHandler'] != 'extapp') {
        $mediadir = pnModAPIFunc('mediashare', 'user', 'getRelativeMediadir');
        $render->assign('thumbnailUrl', $mediadir . $mediaItem['thumbnailRef']);
        $render->assign('previewUrl', $mediadir . $mediaItem['previewRef']);
        $render->assign('originalUrl', $mediadir . $mediaItem['originalRef']);
    } else {
        $render->assign('thumbnailUrl', "{$mediaItem['thumbnailRef']}");
        $render->assign('previewUrl', "{$mediaItem['previewRef']}");
        $render->assign('originalUrl', "{$mediaItem['originalRef']}");
    }
    $render->assign('mode', $mode);
    echo $render->fetch('mediashare_external_pasteitem.html');
    return true;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:34,代码来源:pnexternal.php

示例3: mediashare_source_youtubeapi_getUploadInfo

function mediashare_source_youtubeapi_getUploadInfo()
{
    if (!($userInfo = pnModAPIFunc('mediashare', 'edit', 'getUserInfo'))) {
        return false;
    }
    return array('post_max_size' => (int) ($post_max_size / 1000), 'upload_max_filesize' => (int) ($upload_max_filesize / 1000));
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:7,代码来源:pnsource_youtubeapi.php

示例4: smarty_resource_userdb_fetch

/** 
* Smarty plugin 
* ------------------------------------------------------------- 
* Type:     resource 
* Name:     userdb 
* Purpose:  read user maintained source as a template 
*           $tpl_name is parsed as a uri type of string where 
*          the path to the template field is encoded as: 
* 
* table/source_field?field=condtional&field=conditional... 
* 
* results in: 
*    SELECT source_field FROM table WHERE conditions... 
* ------------------------------------------------------------- 
*/
function smarty_resource_userdb_fetch($tpl_name, &$tpl_source, &$smarty, $default = false)
{
    $_url = parse_url($tpl_name);
    // (required) expected syntax: table/source_field
    $_path_items = explode('/', $_url['path']);
    $table = $_path_items[0];
    $source = $_path_items[1];
    // Theme Configuration
    $skinid = pnModAPIFunc('Xanthia', 'user', 'getSkinID', array('skin' => $table));
    $dbconn =& pnDBGetConn(true);
    $pntable =& pnDBGetTables();
    $table = $pntable['theme_tplsource'];
    $column =& $pntable['theme_tplsource_column'];
    $query = "SELECT {$column['tpl_source']}\n\t\t\t\t\tFROM {$table}\n\t\t\t\t\tWHERE {$column['tpl_file_name']}='{$source}'\n\t\t\t\t\tAND {$column['tpl_skin_id']}= '{$skinid}' LIMIT 1";
    $result =& $dbconn->Execute($query);
    if ($result->EOF) {
    } else {
        list($tpl_source) = $result->fields;
    }
    $result->MoveNext();
    $result->Close();
    if ($tpl_source) {
        return true;
    } else {
        return $default;
    }
}
开发者ID:orbitroom,项目名称:EVE-Online-POS-Tracker,代码行数:42,代码来源:resource.userdb.php

示例5: smarty_function_mediashare_breadcrumb

function smarty_function_mediashare_breadcrumb($params, &$smarty)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    if (!isset($params['albumId'])) {
        $smarty->trigger_error(__f('Missing [%1$s] in \'%2$s\'', array('albumId', 'mediashare_breadcrumb'), $dom));
        return false;
    }
    $mode = isset($params['mode']) ? $params['mode'] : 'view';
    $breadcrumb = pnModAPIFunc('mediashare', 'user', 'getAlbumBreadcrumb', array('albumId' => (int) $params['albumId']));
    if ($breadcrumb === false) {
        $smarty->trigger_error(LogUtil::getErrorMessagesText());
        return false;
    }
    $urlType = $mode == 'edit' ? 'edit' : 'user';
    $url = pnModUrl('mediashare', $urlType, 'view', array('aid' => 0));
    $result = "<div class=\"mediashare-breadcrumb\">";
    $first = true;
    foreach ($breadcrumb as $album) {
        $url = DataUtil::formatForDisplay(pnModUrl('mediashare', $urlType, 'view', array('aid' => $album['id'])));
        $result .= ($first ? '' : ' &raquo; ') . "<a href=\"{$url}\">" . htmlspecialchars($album['title']) . "</a>";
        $first = false;
    }
    $result .= "</div>";
    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], $result);
    }
    return $result;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:28,代码来源:function.mediashare_breadcrumb.php

示例6: smarty_function_mediashare_mediaUrl

function smarty_function_mediashare_mediaUrl($params, &$smarty)
{
    $result = pnModAPIFunc('mediashare', 'user', 'getMediaUrl', $params);
    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], $result);
    }
    return DataUtil::formatForDisplay($result);
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:8,代码来源:function.mediashare_mediaUrl.php

示例7: mediashare_vfs_db_dump

function mediashare_vfs_db_dump()
{
    $fileref = $_GET['ref'];
    // Retrieve image information
    if (!($media = pnModAPIFunc('mediashare', 'vfs_db', 'getMedia', array('fileref' => $fileref)))) {
        return false;
    }
    // Check access
    if (!mediashareAccessAlbum($media['albumId'], mediashareAccessRequirementView, null)) {
        return LogUtil::registerPermissionError();
    }
    // Some Mediashare users have reported this to make their setup work. The buffer may contain something
    // due to a buggy template or block
    while (@ob_end_clean()) {
    }
    if (pnConfigGetVar('UseCompression') == 1) {
        // With the "while (@ob_end_clean());" stuff above we are guranteed that no z-buffering is done
        // But(!) the "ob_start("ob_gzhandler");" made by pnAPI.php means a "Content-Encoding: gzip" is set.
        // So we need to reset this header since no compression is done
        header("Content-Encoding: identity");
    }
    // Check cached versus modified date
    $lastModifiedDate = date('D, d M Y H:i:s T', $media['modifiedDate']);
    $currentETag = $media['modifiedDate'];
    global $HTTP_SERVER_VARS;
    $cachedDate = isset($HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE']) ? $HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE'] : null;
    $cachedETag = isset($HTTP_SERVER_VARS['HTTP_IF_NONE_MATCH']) ? $HTTP_SERVER_VARS['HTTP_IF_NONE_MATCH'] : null;
    // If magic quotes are on then all query/post variables are escaped - so strip slashes to make a compare possible
    // - only cachedETag is expected to contain quotes
    if (get_magic_quotes_gpc()) {
        $cachedETag = stripslashes($cachedETag);
    }
    if ((empty($cachedDate) || $lastModifiedDate == $cachedDate) && '"' . $currentETag . '"' == $cachedETag) {
        header("HTTP/1.1 304 Not Modified");
        header("Status: 304 Not Modified");
        header("Expires: " . date('D, d M Y H:i:s T', time() + 180 * 24 * 3600));
        // My PHP insists on Expires in 1981 as default!
        header('Pragma: cache');
        // My PHP insists on putting a pragma "no-cache", so this is an attempt to avoid that
        header('Cache-Control: public');
        header("ETag: \"{$media['modifiedDate']}\"");
        return true;
    }
    header("Expires: " . date('D, d M Y H:i:s T', time() + 180 * 24 * 3600));
    // My PHP insists on Expires in 1981 as default!
    header('Pragma: cache');
    // My PHP insists on putting a pragma "no-cache", so this is an attempt to avoid that
    header('Cache-Control: public');
    header("ETag: \"{$media['modifiedDate']}\"");
    // Ensure correct content-type and a filename for eventual download
    header("Content-Type: {$media['mimeType']}");
    header("Content-Disposition: inline; filename=\"{$media['title']}\"");
    header("Last-Modified: {$lastModifiedDate}");
    header("Content-Length: " . strlen($media['data']));
    echo $media['data'];
    return true;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:57,代码来源:pnvfs_db.php

示例8: mediashare_adminapi_scanAllPlugins

/**
 * Scan for all media
 */
function mediashare_adminapi_scanAllPlugins()
{
    // Force load - it is used during pninit
    pnModAPILoad('mediashare', 'mediahandler', true);
    if (!pnModAPIFunc('mediashare', 'mediahandler', 'scanMediaHandlers')) {
        return false;
    }
    // Force load - it is used during pninit
    pnModAPILoad('mediashare', 'sources', true);
    return pnModAPIFunc('mediashare', 'sources', 'scanSources');
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:14,代码来源:pnadminapi.php

示例9: update

 function update($force)
 {
     if ($force || count($this->items) == 0) {
         $albums = pnModAPIFunc('mediashare', 'user', 'getAllAlbums', array('albumId' => 1, 'access' => $this->access, 'onlyMine' => $this->onlyMine));
         if ($albums === false) {
             pn_exit(LogUtil::getErrorMessagesText());
         }
         foreach ($albums as $album) {
             $this->addItem($album['title'], $album['id']);
         }
     }
 }
开发者ID:ro0f,项目名称:Mediashare,代码行数:12,代码来源:function.mediasharealbumselector.php

示例10: mediashare_ajax_getitems

/**
 * Mediashare AJAX handler
 *
 * @copyright (C) 2007, Jorn Wildt
 * @link http://www.elfisk.dk
 * @version $Id$
 * @license See license.txt
 */
function mediashare_ajax_getitems($args)
{
    $items = pnModAPIFunc('mediashare', 'user', 'getMediaItems', array('albumId' => FormUtil::getPassedValue('aid')));
    if ($items === false) {
        AjaxUtil::error(LogUtil::getErrorMessagesText(' - '), '403 Forbidden');
    }
    $mediaItems = array();
    foreach ($items as $item) {
        $mediaItems[] = array('id' => $item['id'], 'isExternal' => $item['mediaHandler'] == 'extapp', 'thumbnailRef' => $item['thumbnailRef'], 'previewRef' => $item['previewRef'], 'title' => $item['title']);
    }
    return array('mediaItems' => $mediaItems);
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:20,代码来源:pnajax.php

示例11: smarty_function_mediashare_albumSelector

function smarty_function_mediashare_albumSelector($params, &$smarty)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    if (!isset($params['albumId'])) {
        $smarty->trigger_error(__f('Missing [%1$s] in \'%2$s\'', array('albumId', 'mediashare_albumSelector'), $dom));
        return false;
    }
    $albumId = $params['albumId'];
    $id = isset($params['id']) ? $params['id'] : 'album';
    $name = isset($params['name']) ? $params['name'] : $id;
    $excludeAlbumId = isset($params['excludeAlbumId']) ? $params['excludeAlbumId'] : null;
    $onlyMine = isset($params['onlyMine']) ? $params['onlyMine'] : false;
    $access = isset($params['access']) ? constant($params['access']) : 0xff;
    $albums = pnModAPIFunc('mediashare', 'user', 'getAllAlbums', array('albumId' => 1, 'excludeAlbumId' => $excludeAlbumId, 'access' => $access, 'onlyMine' => $onlyMine));
    if ($albums === false) {
        $smarty->trigger_error(LogUtil::getErrorMessagesText());
        return false;
    }
    if (isset($params['onchange'])) {
        $onChangeHtml = " onchange=\"{$params['onchange']}\"";
    } else {
        $onChangeHtml = '';
    }
    if (isset($params['id'])) {
        $idHtml = " id=\"{$id}\"";
    } else {
        $idHtml = '';
    }
    $html = "<select name=\"{$name}\"{$onChangeHtml}{$idHtml}>\n";
    foreach ($albums as $album) {
        $title = $album['title'];
        $id = (int) $album['id'];
        $level = $album['nestedSetLevel'] - 1;
        $indent = '';
        for ($i = 0; $i < $level; ++$i) {
            $indent .= '+ ';
        }
        $selectedHtml = $id == $albumId ? ' selected="selected"' : '';
        $html .= "<option value=\"{$id}\"{$selectedHtml}>{$indent}{$title}</option>\n";
    }
    $html .= "</select>";
    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], $html);
    }
    return $html;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:46,代码来源:function.mediashare_albumSelector.php

示例12: FlashChatBridge_Onlineblock_display

/**
 * display block
 *
 * @param        array       $blockinfo     a blockinfo structure
 * @return       output      the rendered bock
 */
function FlashChatBridge_Onlineblock_display($blockinfo)
{
    if (!SecurityUtil::checkPermission('FlashChatBridge:Onlineblock:', "::", ACCESS_READ)) {
        return false;
    }
    if (!pnModAvailable('FlashChatBridge') || !pnUserLoggedIn()) {
        return false;
    }
    //pnModLoad("FlashChatBridge");
    $Users = pnModAPIFunc('FlashChatBridge', 'user', 'getChatterList');
    $count = count($Users);
    $render = pnRender::getInstance('FlashChatBridge', false);
    $render->assign('Users', $Users);
    $render->assign('Count', $count);
    $blockinfo['content'] = $render->fetch('flashchatbridge_block_online.htm');
    return pnBlockThemeBlock($blockinfo);
}
开发者ID:tempbottle,项目名称:FlashChatBridge,代码行数:23,代码来源:Online.php

示例13: smarty_function_mediashare_userinfo

function smarty_function_mediashare_userinfo($params, $smarty)
{
    if (!($userInfo = pnModAPIFunc('mediashare', 'edit', 'getUserInfo'))) {
        return false;
    }
    $dom = ZLanguage::getModuleDomain('mediashare');
    $maxSize = $userInfo['mediaSizeLimitTotal'];
    $size = $userInfo['totalCapacityUsed'];
    $imageDir = 'modules/mediashare/pnimages';
    $leftSize = intval($maxSize > $size ? $size * 100 / $maxSize : 100);
    $rightSize = intval($maxSize > $size ? 100 - $leftSize : 0);
    $scale = 1000000;
    $unitTitle = 'Mb';
    $str = sprintf("%.2f %s %.2f %s", $size / $scale, __('of', $dom), $maxSize / $scale, $unitTitle);
    $result = "<div class=\"mediashare-userinfo\"><img src=\"{$imageDir}/bar_left.gif\" height=\"5\" width=\"{$leftSize}\" alt=\"\" />" . "<img src=\"{$imageDir}/bar_right.gif\" height=\"5\" width=\"{$rightSize}\" alt=\"\" />" . " {$leftSize}% ({$str})</div>";
    return $result;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:17,代码来源:function.mediashare_userinfo.php

示例14: mediashare_source_zipapi_getUploadInfo

function mediashare_source_zipapi_getUploadInfo()
{
    if (!($userInfo = pnModAPIFunc('mediashare', 'edit', 'getUserInfo'))) {
        return false;
    }
    $upload_max_filesize = mediashareSourceZipParseIni(ini_get('upload_max_filesize'));
    if ($userInfo['totalCapacityLeft'] < $upload_max_filesize) {
        $upload_max_filesize = $userInfo['totalCapacityLeft'];
    }
    if ($userInfo['mediaSizeLimitSingle'] < $upload_max_filesize) {
        $upload_max_filesize = $userInfo['mediaSizeLimitSingle'];
    }
    $post_max_size = mediashareSourceZipParseIni(ini_get('post_max_size'));
    if ($userInfo['totalCapacityLeft'] < $post_max_size) {
        $post_max_size = $userInfo['totalCapacityLeft'];
    }
    return array('post_max_size' => (int) ($post_max_size / 1000), 'upload_max_filesize' => (int) ($upload_max_filesize / 1000));
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:18,代码来源:pnsource_zipapi.php

示例15: smarty_function_mediashare_mediaItem

function smarty_function_mediashare_mediaItem($params, &$smarty)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    pnModLoad('mediashare', 'user');
    $mediaBase = pnModAPIFunc('mediashare', 'user', 'getRelativeMediadir');
    // Check for absolute URLs returned by external apps.
    $src = substr($params['src'], 0, 4) == 'http' ? $params['src'] : $mediaBase . htmlspecialchars($params['src']);
    $title = isset($params['title']) ? $params['title'] : '';
    $id = isset($params['id']) ? $params['id'] : null;
    $isThumbnail = isset($params['isThumbnail']) ? (bool) $params['isThumbnail'] : false;
    $width = isset($params['width']) ? $params['width'] : null;
    $height = isset($params['height']) ? $params['height'] : null;
    $class = isset($params['class']) ? $params['class'] : null;
    $style = isset($params['style']) ? $params['style'] : null;
    $onclick = isset($params['onclick']) ? $params['onclick'] : null;
    $onmousedown = isset($params['onmousedown']) ? $params['onmousedown'] : null;
    if ($params['src'] == '') {
        $result = __('No media item found in this album', $dom);
    } else {
        if ($isThumbnail) {
            $onclickHtml = $onclick != null ? " onclick=\"{$onclick}\"" : '';
            $onmousedownHtml = $onmousedown != null ? " onmousedown=\"{$onmousedown}\"" : '';
            $widthHtml = $width == null ? '' : " width=\"{$width}\"";
            $heightHtml = $height == null ? '' : " height=\"{$height}\"";
            $classHtml = $class == null ? '' : " class=\"{$class}\"";
            $styleHtml = $style == null ? '' : " style=\"{$style}\"";
            $idHtml = isset($params['id']) ? " id=\"{$params['id']}\"" : '';
            $result = "<img src=\"{$src}\" alt=\"" . htmlspecialchars($title) . "\"{$idHtml}{$widthHtml}{$heightHtml}{$classHtml}{$styleHtml}{$onclickHtml}{$onmousedownHtml}/>";
        } else {
            $handler = pnModAPIFunc('mediashare', 'mediahandler', 'loadHandler', array('handlerName' => $params['mediaHandler']));
            if ($handler === false) {
                return false;
            }
            $result = $handler->getMediaDisplayHtml($src, $width, $height, $id, array('title' => $title, 'onclick' => $onclick, 'onmousedown' => $onmousedown, 'class' => $class, 'style' => $style));
        }
    }
    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], $result);
    }
    return $result;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:41,代码来源:function.mediashare_mediaItem.php


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