• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP AmpConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: call_url

 /**
  * call_url
  * This is a generic caller for HTTP requests
  * It need the method (GET/POST), the url and the parameters
  */
 public function call_url($url, $method = 'GET', $vars = null)
 {
     // Encode parameters per RFC1738
     $params = http_build_query($vars);
     $opts = array('http' => array('method' => $method, 'header' => array('Host: ' . $this->host, 'User-Agent: Ampache/' . AmpConfig::get('version'))));
     // POST request need parameters in body and additional headers
     if ($method == 'POST') {
         $opts['http']['content'] = $params;
         $opts['http']['header'][] = 'Content-type: application/x-www-form-urlencoded';
         $opts['http']['header'][] = 'Content-length: ' . strlen($params);
         $params = '';
     }
     $context = stream_context_create($opts);
     if ($params != '') {
         // If there are paramters for GET request, adding the "?" caracter before
         $params = '?' . $params;
     }
     //debug_event('SCROBBLER', "$this->scheme://$this->host$url$params", 5);
     //debug_event('SCROBBLER', serialize($opts), 5);
     $fp = fopen("{$this->scheme}://{$this->host}{$url}{$params}", 'r', false, $context);
     if (!$fp) {
         return false;
     }
     ob_start();
     fpassthru($fp);
     $buffer = ob_get_contents();
     ob_end_clean();
     fclose($fp);
     //debug_event('SCROBBLER', $buffer, 5);
     return $buffer;
 }
开发者ID:ivan801,项目名称:ampache,代码行数:36,代码来源:scrobbler.class.php


示例2: getName

 public function getName()
 {
     if ($this->catalog_id > 0) {
         $catalog = Catalog::create_from_id($this->catalog_id);
         return $catalog->name;
     }
     return AmpConfig::get('site_title');
 }
开发者ID:nioc,项目名称:ampache,代码行数:8,代码来源:webdav_catalog.class.php


示例3: format

 /**
  * format
  * This format the string url according to settings.
  */
 public static function format($url)
 {
     if (AmpConfig::get('stream_beautiful_url')) {
         $url = str_replace('index.php?&', '', $url);
         $url = str_replace('index.php?', '', $url);
         $url = str_replace('&', '/', $url);
         $url = str_replace('=', '/', $url);
     }
     return $url;
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:14,代码来源:stream_url.class.php


示例4: display_home

 /**
  * display_home
  * This display the module in home page
  */
 public function display_home()
 {
     if (@is_readable(AmpConfig::get('prefix') . '/config/motd.php')) {
         echo '<div id="motd">';
         UI::show_box_top(T_('Message of the Day'));
         require_once AmpConfig::get('prefix') . '/config/motd.php';
         UI::show_box_bottom();
         echo '</div>';
     }
 }
开发者ID:ivan801,项目名称:ampache,代码行数:14,代码来源:MOTDHome.plugin.php


示例5: install

 /**
  * install
  * This is a required plugin function. It inserts our preferences
  * into Ampache
  */
 public function install()
 {
     // Check and see if it's already installed
     if (Preference::exists('piwik_site_id')) {
         return false;
     }
     Preference::insert('piwik_site_id', 'Piwik Site ID', '1', 100, 'string', 'plugins', 'piwik');
     Preference::insert('piwik_url', 'Piwik URL', AmpConfig::get('web_path') . '/piwik/', 100, 'string', 'plugins', $this->name);
     return true;
 }
开发者ID:bl00m,项目名称:ampache,代码行数:15,代码来源:Piwik.plugin.php


示例6: display_home

 /**
  * display_home
  * This display the module in home page
  */
 public function display_home()
 {
     if (AmpConfig::get('sociable')) {
         echo "<div id='shout_objects'>\n";
         $shouts = Shoutbox::get_top($this->maxitems);
         if (count($shouts)) {
             require_once AmpConfig::get('prefix') . UI::find_template('show_shoutbox.inc.php');
         }
         echo "</div>\n";
     }
 }
开发者ID:bl00m,项目名称:ampache,代码行数:15,代码来源:ShoutHome.plugin.php


示例7: load_gettext

/**
 * load_gettext
 * Sets up our local gettext settings.
 *
 * @return void
 */
function load_gettext()
{
    $lang = AmpConfig::get('lang');
    $popath = AmpConfig::get('prefix') . '/locale/' . $lang . '/LC_MESSAGES/messages.po';
    $t = new Translator();
    if (file_exists($popath)) {
        $translations = Gettext\Translations::fromPoFile($popath);
        $t->loadTranslations($translations);
    }
    $t->register();
}
开发者ID:bl00m,项目名称:ampache,代码行数:17,代码来源:i18n.php


示例8: get_policies

 public static function get_policies()
 {
     $openid_required_pape = AmpConfig::get('openid_required_pape');
     $policies = array();
     if (!empty($openid_required_pape)) {
         $papes = explode(',', $openid_required_pape);
         foreach ($papes as $pape) {
             $policies[] = constant($pape);
         }
     }
     return $policies;
 }
开发者ID:nioc,项目名称:ampache,代码行数:12,代码来源:openid.class.php


示例9: get_plugins

 /**
  * get_plugins
  * This returns an array of plugin names
  */
 public static function get_plugins($type = '')
 {
     // make static cache for optimization when multiple call
     static $plugins_list = array();
     if (isset($plugins_list[$type])) {
         return $plugins_list[$type];
     }
     $plugins_list[$type] = array();
     // Open up the plugin dir
     $basedir = AmpConfig::get('prefix') . '/modules/plugins';
     $handle = opendir($basedir);
     if (!is_resource($handle)) {
         debug_event('Plugins', 'Unable to read plugins directory', '1');
     }
     // Recurse the directory
     while (false !== ($file = readdir($handle))) {
         if ($file === '.' || $file === '..') {
             continue;
         }
         // Take care of directories only
         if (!is_dir($basedir . '/' . $file)) {
             debug_event('Plugins', $file . ' is not a directory.', 3);
             continue;
         }
         // Make sure the plugin base file exists inside the plugin directory
         if (!file_exists($basedir . '/' . $file . '/' . $file . '.plugin.php')) {
             debug_event('Plugins', 'Missing class for ' . $file, 3);
             continue;
         }
         if ($type != '') {
             $plugin = new Plugin($file);
             if (!Plugin::is_installed($plugin->_plugin->name)) {
                 debug_event('Plugins', 'Plugin ' . $plugin->_plugin->name . ' is not installed, skipping', 6);
                 continue;
             }
             if (!$plugin->is_valid()) {
                 debug_event('Plugins', 'Plugin ' . $file . ' is not valid, skipping', 6);
                 continue;
             }
             if (!method_exists($plugin->_plugin, $type)) {
                 debug_event('Plugins', 'Plugin ' . $file . ' does not support ' . $type . ', skipping', 6);
                 continue;
             }
         }
         // It's a plugin record it
         $plugins_list[$type][$file] = $file;
     }
     // end while
     // Little stupid but hey
     ksort($plugins_list[$type]);
     return $plugins_list[$type];
 }
开发者ID:ivan801,项目名称:ampache,代码行数:56,代码来源:plugin.class.php


示例10: load_gettext

/**
 * load_gettext
 * Sets up our local gettext settings.
 *
 * @return void
 */
function load_gettext()
{
    $lang = AmpConfig::get('lang');
    $charset = AmpConfig::get('site_charset') ?: 'UTF-8';
    $locale = $lang . '.' . $charset;
    //debug_event('i18n', 'Setting locale to ' . $locale, 5);
    T_setlocale(LC_MESSAGES, $locale);
    /* Bind the Text Domain */
    T_bindtextdomain('messages', AmpConfig::get('prefix') . "/locale/");
    T_bind_textdomain_codeset('messages', $charset);
    T_textdomain('messages');
    //debug_event('i18n', 'gettext is ' . (locale_emulation() ? 'emulated' : 'native'), 5);
}
开发者ID:axelsimon,项目名称:ampache,代码行数:19,代码来源:i18n.php


示例11: show_agreement

 /**
  * show_agreement
  * This shows the registration agreement, /config/registration_agreement.php
  */
 public static function show_agreement()
 {
     $filename = AmpConfig::get('prefix') . '/config/registration_agreement.php';
     if (!file_exists($filename)) {
         return false;
     }
     /* Check for existance */
     $fp = fopen($filename, 'r');
     if (!$fp) {
         return false;
     }
     $data = fread($fp, filesize($filename));
     /* Scrub and show */
     echo $data;
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:19,代码来源:registration.class.php


示例12: get_past_events

 /**
  * get_past_events
  * Returns a list of past events
  * @param Artist $artist
  * @return SimpleXMLElement|boolean
  */
 public static function get_past_events(Artist $artist)
 {
     if (isset($artist->mbid)) {
         $query = 'mbid=' . rawurlencode($artist->mbid);
     } else {
         $query = 'artist=' . rawurlencode($artist->name);
     }
     $limit = AmpConfig::get('concerts_limit_past');
     if ($limit) {
         $query .= '&limit=' . $limit;
     }
     $xml = Recommendation::get_lastfm_results('artist.getpastevents', $query);
     if ($xml->events) {
         return $xml->events;
     }
     return false;
 }
开发者ID:cheese1,项目名称:ampache,代码行数:23,代码来源:artist_event.class.php


示例13: get_plugins

 /**
  * get_plugins
  * This returns an array of plugin names
  */
 public static function get_plugins($type = '')
 {
     // make static cache for optimization when multiple call
     static $plugins_list = array();
     if (isset($plugins_list[$type])) {
         return $plugins_list[$type];
     }
     $plugins_list[$type] = array();
     // Open up the plugin dir
     $handle = opendir(AmpConfig::get('prefix') . '/modules/plugins');
     if (!is_resource($handle)) {
         debug_event('Plugins', 'Unable to read plugins directory', '1');
     }
     // Recurse the directory
     while (false !== ($file = readdir($handle))) {
         // Ignore non-plugin files
         if (substr($file, -10, 10) != 'plugin.php') {
             continue;
         }
         if (is_dir($file)) {
             continue;
         }
         $plugin_name = basename($file, '.plugin.php');
         if ($type != '') {
             $plugin = new Plugin($plugin_name);
             if (!Plugin::is_installed($plugin->_plugin->name)) {
                 debug_event('Plugins', 'Plugin ' . $plugin->_plugin->name . ' is not installed, skipping', 6);
                 continue;
             }
             if (!$plugin->is_valid()) {
                 debug_event('Plugins', 'Plugin ' . $plugin_name . ' is not valid, skipping', 6);
                 continue;
             }
             if (!method_exists($plugin->_plugin, $type)) {
                 debug_event('Plugins', 'Plugin ' . $plugin_name . ' does not support ' . $type . ', skipping', 6);
                 continue;
             }
         }
         // It's a plugin record it
         $plugins_list[$type][$plugin_name] = $plugin_name;
     }
     // end while
     // Little stupid but hey
     ksort($plugins_list[$type]);
     return $plugins_list[$type];
 }
开发者ID:nioc,项目名称:ampache,代码行数:50,代码来源:plugin.class.php


示例14: display_home

 /**
  * display_home
  * This display the module in home page
  */
 public function display_home()
 {
     if (AmpConfig::get('sociable')) {
         $user_id = $GLOBALS['user']->id;
         if ($user_id) {
             $activities = Useractivity::get_friends_activities($user_id, $this->maxitems);
             if (count($activities) > 0) {
                 UI::show_box_top(T_('Friends Timeline'));
                 Useractivity::build_cache($activities);
                 foreach ($activities as $aid) {
                     $activity = new Useractivity($aid);
                     $activity->show();
                 }
                 UI::show_box_bottom();
             }
         }
     }
 }
开发者ID:bl00m,项目名称:ampache,代码行数:22,代码来源:FriendsTimeline.plugin.php


示例15: display_user_field

 /**
  * display_user_field
  * This display the module in user page
  */
 public function display_user_field(library_item $libitem = null)
 {
     $name = $libitem != null ? $libitem->get_fullname() : T_('User') . " `" . $this->user->fullname . "` " . T_('on') . " " . AmpConfig::get('site_title');
     $lang = substr(AmpConfig::get('lang'), 0, 2);
     if (empty($lang)) {
         $lang = 'US';
     }
     echo "<form action='https://www.paypal.com/cgi-bin/webscr' method='post' target='_top'>\n";
     echo "<input type='hidden' name='cmd' value='_donations'>\n";
     echo "<input type='hidden' name='business' value='" . scrub_out($this->business) . "'>\n";
     echo "<input type='hidden' name='lc' value='" . $lang . "'>\n";
     echo "<input type='hidden' name='item_name' value='" . $name . "'>\n";
     echo "<input type='hidden' name='no_note' value='0'>\n";
     echo "<input type='hidden' name='currency_code' value='" . scrub_out($this->currency_code) . "'>\n";
     echo "<input type='hidden' name='bn' value='PP-DonationsBF:btn_donate_SM.gif:NonHostedGuest'>\n";
     echo "<input type='image' src='https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif' border='0' name='submit' alt='PayPal - The safer, easier way to pay online!'>\n";
     echo "<img alt='' border='0' src='https://www.paypalobjects.com/fr_XC/i/scr/pixel.gif' width='1' height='1'>\n";
     echo "</form>\n";
 }
开发者ID:bl00m,项目名称:ampache,代码行数:23,代码来源:Paypal.plugin.php


示例16: get_images

 protected static function get_images($artist_name)
 {
     $images = array();
     if (AmpConfig::get('echonest_api_key')) {
         $echonest = new EchoNest_Client(new EchoNest_HttpClient_Requests());
         $echonest->authenticate(AmpConfig::get('echonest_api_key'));
         try {
             $images = $echonest->getArtistApi()->setName($artist_name)->getImages();
         } catch (Exception $e) {
             debug_event('echonest', 'EchoNest artist images error: ' . $e->getMessage(), '1');
         }
     }
     foreach (Plugin::get_plugins('get_photos') as $plugin_name) {
         $plugin = new Plugin($plugin_name);
         if ($plugin->load($GLOBALS['user'])) {
             $images += $plugin->_plugin->get_photos($artist_name);
         }
     }
     return $images;
 }
开发者ID:nioc,项目名称:ampache,代码行数:20,代码来源:slideshow.class.php


示例17: send_zip

/**
 * send_zip
 *
 * takes array of full paths to songs
 * zips them and sends them
 *
 * @param    string    $name    name of the zip file to be created
 * @param    array    $song_files    array of full paths to songs to zip create w/ call to get_song_files
 */
function send_zip($name, $song_files)
{
    // Check if they want to save it to a file, if so then make sure they've
    // got a defined path as well and that it's writable.
    $basedir = '';
    if (AmpConfig::get('file_zip_download') && AmpConfig::get('tmp_dir_path')) {
        // Check writeable
        if (!is_writable(AmpConfig::get('tmp_dir_path'))) {
            $in_memory = '1';
            debug_event('Error', 'File Zip Path:' . AmpConfig::get('tmp_dir_path') . ' is not writable', '1');
        } else {
            $in_memory = '0';
            $basedir = AmpConfig::get('tmp_dir_path');
        }
    } else {
        $in_memory = '1';
    }
    // if file downloads
    /* Require needed library */
    require_once AmpConfig::get('prefix') . '/modules/archive/archive.lib.php';
    $arc = new zip_file($name . ".zip");
    $options = array('inmemory' => $in_memory, 'basedir' => $basedir, 'storepaths' => 0, 'level' => 0, 'comment' => AmpConfig::get('file_zip_comment'), 'type' => "zip");
    $arc->set_options($options);
    foreach ($song_files as $dir => $files) {
        $arc->add_files($files, $dir);
    }
    if (count($arc->error)) {
        debug_event('archive', "Error: unable to add songs", '3');
        return false;
    }
    // if failed to add songs
    if (!$arc->create_archive()) {
        debug_event('archive', "Error: unable to create archive", '3');
        return false;
    }
    // if failed to create archive
    $arc->download_file();
}
开发者ID:axelsimon,项目名称:ampache,代码行数:47,代码来源:batch.lib.php


示例18:

    ?>
</th>
        <?php 
}
?>
        <?php 
if (AmpConfig::get('userflags')) {
    ?>
            <th class="cel_userflag"></th>
        <?php 
}
?>
            <th class="cel_action"></th>
        <?php 
if (isset($argument) && $argument) {
    ?>
            <th class="cel_drag"></th>
        <?php 
}
?>
        </tr>
    </tfoot>
</table>
<script src="<?php 
echo AmpConfig::get('web_path');
?>
/lib/javascript/tabledata.js" language="javascript" type="text/javascript"></script>
<?php 
if ($browse->get_show_header()) {
    require AmpConfig::get('prefix') . '/templates/list_header.inc.php';
}
开发者ID:axelsimon,项目名称:ampache,代码行数:31,代码来源:show_songs.inc.php


示例19: array

/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
 *
 * LICENSE: GNU General Public License, version 2 (GPLv2)
 * Copyright 2001 - 2015 Ampache.org
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License v2
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */
require_once '../../lib/class/plex_xml_data.class.php';
$ow_config = array('http_host' => $_SERVER["SERVER_NAME"] . ':' . $_SERVER["SERVER_PORT"], 'web_path' => '/web');
require_once '../../lib/init.php';
if (!AmpConfig::get('plex_backend')) {
    echo "Disabled.";
    exit;
}
if (!defined('NO_SESSION') && !Access::check('interface', '100')) {
    echo T_('Unauthorized.');
    exit;
}
开发者ID:nioc,项目名称:ampache,代码行数:31,代码来源:init.php


示例20: ini_set

            if (ini_get($ini_default_charset)) {
                ini_set($ini_default_charset, "UTF-8");
            }
            mb_language("uni");
        }
        $mailer = new Mailer();
        // Set the vars on the object
        $mailer->subject = $_REQUEST['subject'];
        $mailer->message = $_REQUEST['message'];
        if ($_REQUEST['from'] == 'system') {
            $mailer->set_default_sender();
        } else {
            $mailer->sender = $GLOBALS['user']->email;
            $mailer->sender_name = $GLOBALS['user']->fullname;
        }
        if ($mailer->send_to_group($_REQUEST['to'])) {
            $title = T_('E-mail Sent');
            $body = T_('Your E-mail was successfully sent.');
        } else {
            $title = T_('E-mail Not Sent');
            $body = T_('Your E-mail was not sent.');
        }
        $url = AmpConfig::get('web_path') . '/admin/mail.php';
        show_confirmation($title, $body, $url);
        break;
    default:
        require_once AmpConfig::get('prefix') . UI::find_template('show_mail_users.inc.php');
        break;
}
// end switch
UI::show_footer();
开发者ID:cheese1,项目名称:ampache,代码行数:31,代码来源:mail.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Anchors类代码示例发布时间:2022-05-23
下一篇:
PHP Amazon_FPS_Model类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap