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


PHP serendipity_plugin_api::get_installed_plugins方法代码示例

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


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

示例1: array

    } else {
        ?>
    <h2><?php 
        echo SIDEBAR_PLUGINS;
        ?>
</h2>
<?php 
    }
    ?>
<br />
<?php 
    $foreignPlugins = $pluginstack = $errorstack = array();
    serendipity_plugin_api::hook_event('backend_plugins_fetchlist', $foreignPlugins);
    $pluginstack = array_merge((array) $foreignPlugins['pluginstack'], $pluginstack);
    $errorstack = array_merge((array) $foreignPlugins['errorstack'], $errorstack);
    $plugins = serendipity_plugin_api::get_installed_plugins();
    $classes = serendipity_plugin_api::enum_plugin_classes($serendipity['GET']['type'] === 'event');
    usort($classes, 'serendipity_pluginListSort');
    $counter = 0;
    foreach ($classes as $class_data) {
        $pluginFile = serendipity_plugin_api::probePlugin($class_data['name'], $class_data['classname'], $class_data['pluginPath']);
        $plugin =& serendipity_plugin_api::getPluginInfo($pluginFile, $class_data, $serendipity['GET']['type']);
        if (is_object($plugin)) {
            // Object is returned when a plugin could not be cached.
            $bag = new serendipity_property_bag();
            $plugin->introspect($bag);
            // If a foreign plugin is upgradable, keep the new version number.
            if (isset($foreignPlugins['pluginstack'][$class_data['name']]) && $foreignPlugins['pluginstack'][$class_data['name']]['upgradable']) {
                $class_data['upgrade_version'] = $foreignPlugins['pluginstack'][$class_data['name']]['upgrade_version'];
            }
            $props = serendipity_plugin_api::setPluginInfo($plugin, $pluginFile, $bag, $class_data, 'local', $foreignPlugins);
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:31,代码来源:plugins.inc.php

示例2: selectPlugins

 /**
  *
  * prepare an list with available plugins for use in staticpage
  *
  * @access private
  * @return array
  *
  */
 function selectPlugins()
 {
     global $serendipity;
     $plugins = serendipity_plugin_api::get_installed_plugins('event');
     foreach ($plugins as $plugin) {
         switch ($plugin) {
             case 'serendipity_event_downloadmanager':
                 if ($serendipity['rewrite'] == 'none') {
                     $q = 'SELECT value
                             FROM ' . $serendipity['dbPrefix'] . 'config
                            WHERE name LIKE \'serendipity_event_downloadmanager%pageurl\'';
                 } else {
                     $q = 'SELECT value
                             FROM ' . $serendipity['dbPrefix'] . 'config
                            WHERE name LIKE \'serendipity_event_downloadmanager%permalink\'';
                 }
                 $ret = serendipity_db_query($q, true, 'assoc');
                 if (is_array($ret)) {
                     if ($serendipity['rewrite'] == 'none') {
                         $page[$plugin]['link'] = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?serendipity[subpage]=' . $ret['value'];
                     } else {
                         $page[$plugin]['link'] = $ret['value'];
                     }
                     $page[$plugin]['name'] = PLUGIN_DOWNLOADMANAGER_TITLE;
                 }
                 break;
             case 'serendipity_event_guestbook':
                 $q = 'SELECT value
                         FROM ' . $serendipity['dbPrefix'] . 'config
                        WHERE name LIKE \'serendipity_event_guestbook%' . ($serendipity['rewrite'] != 'none' ? 'permalink' : 'pagetitle') . '\'';
                 $ret = serendipity_db_query($q, true, 'assoc');
                 if (is_array($ret)) {
                     $page[$plugin]['name'] = defined('GUESTBOOK_TITLE') ? GUESTBOOK_TITLE : PLUGIN_GUESTBOOK_TITLE;
                     if ($serendipity['rewrite'] != 'none') {
                         $page[$plugin]['link'] = $ret['value'];
                     } else {
                         $page[$plugin]['link'] = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?serendipity[subpage]=' . $ret['value'];
                     }
                 }
                 break;
             case 'serendipity_event_forum':
                 $q = 'SELECT value
                         FROM ' . $serendipity['dbPrefix'] . 'config
                        WHERE name LIKE \'serendipity_event_forum%pageurl\'';
                 $ret = serendipity_db_query($q, true, 'assoc');
                 if (is_array($ret)) {
                     $page[$plugin] = array('name' => PLUGIN_FORUM_TITLE, 'link' => $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?serendipity[subpage]=' . $ret['value']);
                 }
                 break;
             case 'serendipity_event_contactform':
                 $q = 'SELECT value
                         FROM ' . $serendipity['dbPrefix'] . 'config
                        WHERE name LIKE \'serendipity_event_contactform%' . ($serendipity['rewrite'] != 'none' ? 'permalink' : 'pagetitle') . '\'';
                 $ret = serendipity_db_query($q, true, 'assoc');
                 if (is_array($ret)) {
                     if ($serendipity['rewrite'] != 'none') {
                         $page[$plugin]['link'] = $ret['value'];
                     } else {
                         $page[$plugin]['link'] = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?serendipity[subpage]=' . $ret['value'];
                     }
                 }
                 $page[$plugin]['name'] = PLUGIN_CONTACTFORM_TITLE;
                 break;
             case 'serendipity_event_thumbnails':
                 $page[$plugin] = array('name' => THUMBPAGE_TITLE, 'link' => $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?serendipity[page]=thumbs');
                 break;
             case 'serendipity_event_usergallery':
                 if ($serendipity['rewrite'] == 'none') {
                     $q = 'SELECT value
                             FROM ' . $serendipity['dbPrefix'] . 'config
                            WHERE name LIKE \'serendipity_event_usergallery%subpage\'';
                 } else {
                     $q = 'SELECT value
                             FROM ' . $serendipity['dbPrefix'] . 'config
                            WHERE name LIKE \'serendipity_event_usergallery%permalink\'';
                 }
                 $ret = serendipity_db_query($q, true, 'assoc');
                 if (is_array($ret)) {
                     if ($serendipity['rewrite'] == 'none') {
                         $page[$plugin]['link'] = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?serendipity[subpage]=' . $ret['value'];
                     } else {
                         $page[$plugin]['link'] = $ret['value'];
                     }
                     $page[$plugin]['name'] = PLUGIN_EVENT_USERGALLERY_TITLE;
                 }
                 break;
             case 'serendipity_event_faq':
                 $q = 'SELECT value
                         FROM ' . $serendipity['dbPrefix'] . 'config
                        WHERE name LIKE \'serendipity_event_faq%faqurl\'';
                 $ret = serendipity_db_query($q, true, 'assoc');
                 if (is_array($ret)) {
//.........这里部分代码省略.........
开发者ID:sqall01,项目名称:additional_plugins,代码行数:101,代码来源:serendipity_event_staticpage.php

示例3: event_hook

 function event_hook($event, &$bag, &$eventData, $addData = null)
 {
     global $serendipity;
     $hooks =& $bag->get('event_hooks');
     if (isset($hooks[$event])) {
         switch ($event) {
             case 'cronjob':
                 if ($this->get_config('cronjob') == $eventData) {
                     serendipity_event_cronjob::log('Spartacus', 'plugin');
                     $avail = array();
                     $install = array();
                     $meth = array('event', 'sidebar');
                     $active = serendipity_plugin_api::get_installed_plugins();
                     $avail['event'] = $this->buildList($this->fetchOnline('event'), 'event');
                     $avail['sidebar'] = $this->buildList($this->fetchOnline('sidebar'), 'sidebar');
                     #echo "XAVAIL:<pre>" . print_r($avail, true) . "</pre>";
                     $install['event'] = serendipity_plugin_api::enum_plugin_classes(true);
                     $install['sidebar'] = serendipity_plugin_api::enum_plugin_classes(false);
                     #echo "XINSTALL:<pre>" . print_r($install, true) . "</pre>";
                     $mailtext = '';
                     foreach ($meth as $method) {
                         foreach ($install[$method] as $class_data) {
                             #echo "Probe " . $class_data['name']. "<br />\n"; // DEBUG
                             $pluginFile = serendipity_plugin_api::probePlugin($class_data['name'], $class_data['classname'], $class_data['pluginPath']);
                             $plugin = serendipity_plugin_api::getPluginInfo($pluginFile, $class_data, $method);
                             if (is_object($plugin)) {
                                 #echo "Non cached<br />\n";
                                 #echo "<pre>" . print_r($avail[$method][$class_data['name']], true) . "</pre>";
                                 // Object is returned when a plugin could not be cached.
                                 $bag = new serendipity_property_bag();
                                 $plugin->introspect($bag);
                                 // If a foreign plugin is upgradable, keep the new version number.
                                 if (isset($avail[$method][$class_data['name']])) {
                                     $class_data['upgrade_version'] = $avail[$method][$class_data['name']]['upgrade_version'];
                                 }
                                 $props = serendipity_plugin_api::setPluginInfo($plugin, $pluginFile, $bag, $class_data, 'local', $avail[$method]);
                                 #echo "<pre>" . print_r($props, true) . "</pre>";
                             } elseif (is_array($plugin)) {
                                 // Array is returned if a plugin could be fetched from info cache
                                 $props = $plugin;
                                 #echo "Cached<br />\n";
                             } else {
                                 $props = false;
                                 #echo "Error<br />\n";
                             }
                             if (is_array($props)) {
                                 #echo "<pre>" . print_r($props, true) . "</pre>\n";
                                 if (version_compare($props['version'], $props['upgrade_version'], '<')) {
                                     $mailtext .= ' * ' . $class_data['name'] . " NEW VERSION: " . $props['upgrade_version'] . " - CURRENT VERSION: " . $props['version'] . "\n";
                                 }
                             } else {
                                 $mailtext .= " X ERROR: " . $class_data['true_name'] . "\n";
                             }
                         }
                     }
                     if (!empty($mailtext)) {
                         serendipity_sendMail($serendipity['blogMail'], 'Spartacus update report ' . $serendipity['baseURL'], $mailtext, $serendipity['blogMail']);
                         echo nl2br($mailtext);
                     }
                 } else {
                     $propbag->add('type', 'suboption');
                 }
                 break;
             case 'external_plugin':
                 if (!serendipity_db_bool($this->get_config('enable_remote'))) {
                     return false;
                 }
                 if ($eventData == $this->get_config('remote_url')) {
                     header('Content-Type: text/plain');
                     $avail = array();
                     $install = array();
                     $meth = array('event', 'sidebar');
                     $active = serendipity_plugin_api::get_installed_plugins();
                     $avail['event'] = $this->buildList($this->fetchOnline('event'), 'event');
                     $avail['sidebar'] = $this->buildList($this->fetchOnline('sidebar'), 'sidebar');
                     $install['event'] = serendipity_plugin_api::enum_plugin_classes(true);
                     $install['sidebar'] = serendipity_plugin_api::enum_plugin_classes(false);
                     foreach ($meth as $method) {
                         echo "LISTING: {$method}\n-------------------\n";
                         foreach ($install[$method] as $class_data) {
                             $pluginFile = serendipity_plugin_api::probePlugin($class_data['name'], $class_data['classname'], $class_data['pluginPath']);
                             $plugin = serendipity_plugin_api::getPluginInfo($pluginFile, $class_data, $method);
                             if (is_object($plugin)) {
                                 // Object is returned when a plugin could not be cached.
                                 $bag = new serendipity_property_bag();
                                 $plugin->introspect($bag);
                                 // If a foreign plugin is upgradable, keep the new version number.
                                 if (isset($avail[$method][$class_data['name']])) {
                                     $class_data['upgrade_version'] = $avail[$method][$class_data['name']]['upgrade_version'];
                                 }
                                 $props = serendipity_plugin_api::setPluginInfo($plugin, $pluginFile, $bag, $class_data, 'local', $avail[$method]);
                             } elseif (is_array($plugin)) {
                                 // Array is returned if a plugin could be fetched from info cache
                                 $props = $plugin;
                             } else {
                                 $props = false;
                             }
                             if (is_array($props)) {
                                 #print_r($props);
                                 if (version_compare($props['version'], $props['upgrade_version'], '<')) {
//.........这里部分代码省略.........
开发者ID:amirchrist,项目名称:Serendipity,代码行数:101,代码来源:serendipity_event_spartacus.php

示例4: ob_start

 if (isset($serendipity['GET']['install_plugin'])) {
     $authorid = $serendipity['authorid'];
     if (serendipity_checkPermission('adminPluginsMaintainOthers')) {
         $authorid = '0';
     }
     if ($serendipity['ajax']) {
         // we need to catch the spartacus messages to return only them to the ajax call (used by the update all button)
         ob_start();
     }
     $fetchplugin_data = array('GET' => &$serendipity['GET'], 'install' => true);
     serendipity_plugin_api::hook_event('backend_plugins_fetchplugin', $fetchplugin_data);
     // we now have to check that the plugin is not already installed, or stackable, to prevent invalid double instances
     $new_plugin = true;
     if ($fetchplugin_data['install']) {
         // spartacus will set this to false on upgrade, and we want to check this only on install
         foreach (serendipity_plugin_api::get_installed_plugins() as $pluginName) {
             if ($serendipity['GET']['install_plugin'] === $pluginName) {
                 $existingPlugin =& serendipity_plugin_api::load_plugin($serendipity['GET']['install_plugin']);
                 if (is_object($existingPlugin)) {
                     $bag = new serendipity_property_bag();
                     $existingPlugin->introspect($bag);
                     if ($bag->get('stackable') != true) {
                         $new_plugin = false;
                     }
                 }
                 break;
             }
         }
     }
     $data['new_plugin_failed'] = !$new_plugin;
     if ($fetchplugin_data['install'] && $new_plugin) {
开发者ID:vonnordmann,项目名称:Serendipity,代码行数:31,代码来源:plugins.inc.php

示例5: event_hook

 function event_hook($event, &$bag, &$eventData)
 {
     global $serendipity;
     $hooks =& $bag->get('event_hooks');
     if (isset($hooks[$event])) {
         switch ($event) {
             case 'external_plugin':
                 if (!serendipity_db_bool($this->get_config('enable_remote'))) {
                     return false;
                 }
                 if ($eventData == $this->get_config('remote_url')) {
                     header('Content-Type: text/plain');
                     $avail = array();
                     $install = array();
                     $meth = array('event', 'sidebar');
                     $active = serendipity_plugin_api::get_installed_plugins();
                     $avail['event'] = $this->buildList($this->fetchOnline('event'), 'event');
                     $avail['sidebar'] = $this->buildList($this->fetchOnline('sidebar'), 'sidebar');
                     $install['event'] = serendipity_plugin_api::enum_plugin_classes(true);
                     $install['sidebar'] = serendipity_plugin_api::enum_plugin_classes(false);
                     foreach ($meth as $method) {
                         echo "LISTING: {$method}\n-------------------\n";
                         foreach ($install[$method] as $class_data) {
                             $pluginFile = serendipity_plugin_api::probePlugin($class_data['name'], $class_data['classname'], $class_data['pluginPath']);
                             $plugin = serendipity_plugin_api::getPluginInfo($pluginFile, $class_data, $method);
                             if (is_object($plugin)) {
                                 // Object is returned when a plugin could not be cached.
                                 $bag = new serendipity_property_bag();
                                 $plugin->introspect($bag);
                                 // If a foreign plugin is upgradable, keep the new version number.
                                 if (isset($avail[$method][$class_data['name']]) && $avail[$method][$class_data['name']]['upgradable']) {
                                     $class_data['upgrade_version'] = $avail[$method][$class_data['name']]['upgrade_version'];
                                 }
                                 $props = serendipity_plugin_api::setPluginInfo($plugin, $pluginFile, $bag, $class_data, 'local', $avail[$method]);
                             } elseif (is_array($plugin)) {
                                 // Array is returned if a plugin could be fetched from info cache
                                 $props = $plugin;
                             } else {
                                 $props = false;
                             }
                             if (is_array($props)) {
                                 #print_r($props);
                                 if (version_compare($props['version'], $props['upgrade_version'], '<')) {
                                     echo "UPGRADE: " . $class_data['name'] . " -- " . $props['upgrade_version'] . "\n";
                                 } else {
                                     echo "OK: " . $class_data['name'] . " -- " . $props['version'] . "\n";
                                 }
                             } else {
                                 echo "ERROR: " . $class_data['true_name'] . "\n";
                             }
                         }
                     }
                 }
                 return true;
                 break;
             case 'backend_pluginlisting_header':
                 if (serendipity_db_bool($this->get_config('enable_plugins'))) {
                     echo '<br /><div id="upgrade_notice" class="serendipityAdminMsgSuccess">';
                     echo '<a href="?serendipity[adminModule]=plugins&amp;serendipity[adminAction]=addnew&amp;serendipity[only_group]=UPGRADE" class="serendipityIconLink upgrade_sidebar"><img src="' . serendipity_getTemplateFile('admin/img/upgrade_now.png') . '" style="border: 0px none ; vertical-align: middle; display: inline;" alt="" />' . PLUGIN_EVENT_SPARTACUS_CHECK_SIDEBAR . '</a> &nbsp; ';
                     echo '<a href="?serendipity[adminModule]=plugins&amp;serendipity[adminAction]=addnew&amp;serendipity[only_group]=UPGRADE&amp;serendipity[type]=event" class="serendipityIconLink upgrade_event"><img src="' . serendipity_getTemplateFile('admin/img/upgrade_now.png') . '" style="border: 0px none ; vertical-align: middle; display: inline;" alt="" />' . PLUGIN_EVENT_SPARTACUS_CHECK_EVENT . '</a> ';
                     echo '</div>';
                 }
                 return true;
                 break;
             case 'backend_pluginlisting_header_upgrade':
                 echo '<em>' . PLUGIN_EVENT_SPARTACUS_CHECK_HINT . '</em><br />';
                 return true;
                 break;
             case 'backend_templates_fetchlist':
                 if (serendipity_db_bool($this->get_config('enable_themes'))) {
                     $eventData = $this->buildTemplateList($this->fetchOnline('template', true), 'template');
                 }
                 return true;
                 break;
             case 'backend_templates_fetchtemplate':
                 if (serendipity_db_bool($this->get_config('enable_themes'))) {
                     if (!empty($eventData['GET']['spartacus_fetch'])) {
                         $this->download($this->fetchOnline('template', true), $eventData['GET']['theme'], 'templates');
                     }
                 }
                 return false;
                 break;
             case 'backend_plugins_fetchlist':
                 if (serendipity_db_bool($this->get_config('enable_plugins'))) {
                     $type = isset($serendipity['GET']['type']) && !empty($serendipity['GET']['type']) ? $serendipity['GET']['type'] : 'sidebar';
                     $eventData = array('pluginstack' => $this->buildList($this->fetchOnline($type), $type), 'errorstack' => array(), 'upgradeURI' => '&amp;serendipity[spartacus_upgrade]=true', 'baseURI' => '&amp;serendipity[spartacus_fetch]=' . $type);
                 }
                 return true;
                 break;
             case 'backend_plugins_fetchplugin':
                 if (serendipity_db_bool($this->get_config('enable_plugins'))) {
                     if (!empty($eventData['GET']['spartacus_fetch'])) {
                         $baseDir = $this->download($this->fetchOnline($eventData['GET']['spartacus_fetch'], true), $eventData['GET']['install_plugin']);
                         if ($baseDir === false) {
                             $eventData['install'] = false;
                         } elseif (!empty($baseDir)) {
                             $eventData['GET']['pluginPath'] = $baseDir;
                         } else {
                             $eventData['GET']['pluginPath'] = $eventData['GET']['install_plugin'];
                         }
//.........这里部分代码省略.........
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:101,代码来源:serendipity_event_spartacus.php


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