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


PHP serendipity_plugin_api::getPluginInfo方法代码示例

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


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

示例1: 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

示例2: array

<?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);
            $counter++;
        } elseif (is_array($plugin)) {
            // Array is returned if a plugin could be fetched from info cache
            $props = $plugin;
        } else {
            $props = false;
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:31,代码来源:plugins.inc.php

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