本文整理汇总了PHP中Plugin::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::getName方法的具体用法?PHP Plugin::getName怎么用?PHP Plugin::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin::getName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enqueueScripts
/**
* Register the JavaScript for the dashboard.
*
* @since 1.0.0
*/
public function enqueueScripts()
{
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in PluginName_Loader as all of the hooks are defined
* in that particular class.
*
* The PluginName_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
wp_enqueue_script($this->plugin->getName(), plugin_dir_url(dirname(__FILE__)) . 'dist/scripts/plugin-name-admin.js', array('jquery'), $this->plugin->getVersion(), false);
}
示例2: getItemtypes
/**
* Return all injectable types
*
* @param $only_primary return only primary types (false by default)
*
* @return an array which contains array(itemtype => itemtype name)
**/
static function getItemtypes($only_primary = false)
{
global $INJECTABLE_TYPES;
getTypesToInject();
$plugin = new Plugin();
$values = array();
foreach ($INJECTABLE_TYPES as $type => $from) {
$injectionclass = new $type();
if (class_exists($type) && (!$only_primary || $only_primary && $injectionclass->isPrimaryType())) {
$instance = new $type();
//If user has no right to create an object of this type, do not display type in the list
if (!$instance->canCreate()) {
continue;
}
$typename = get_parent_class($type);
$name = '';
if ($from != 'datainjection') {
$plugin->getFromDBbyDir($from);
$name = $plugin->getName() . ': ';
}
$name .= call_user_func(array($type, 'getTypeName'));
$values[$typename] = $name;
}
}
asort($values);
return $values;
}
示例3: testPlugin
public function testPlugin()
{
$pl = new Plugin(123, 'A Plugin', true);
$this->assertEquals(123, $pl->getID());
$this->assertEquals('A Plugin', $pl->getName());
$this->assertEquals(true, $pl->isActive());
}
示例4: __construct
/**
* @param array $remote - Array containing $host,$port,$auth data
* @param str $cmd - remote command to execute
* @param Plugin $plugin - plugin to receive results
* @param str $callback - method from plugin to callback with results
* @param mixed $data - data passed to callback function
*/
public function __construct($remote, $cmd, $plugin, $callback, $data)
{
$this->server = $remote;
$this->cmd = $cmd;
$this->sock = false;
$this->plugin = $plugin->getName();
$this->callback = $callback;
$this->data = $data;
}
示例5: getMissingDependencies
private function getMissingDependencies(Plugin $plugin, array $plugins_collection)
{
$missing_dependencies = array();
foreach ($plugins_collection as $candidate_plugin) {
if (in_array($plugin->getName(), $candidate_plugin->getDependencies())) {
$missing_dependencies[] = $candidate_plugin->getName();
}
}
return $missing_dependencies;
}
示例6: actionIndex
public function actionIndex()
{
// список всех плагинов
$plugins = Yii::app()->getPlugins();
// все плагины регистрируем в бд
// TODO если в базе нашлись плагины, которых уже нет, то помечаем их как удаленные
// список плагинов, зарегистрированных в системе
$pluginsDb = Plugin::model()->findAll();
$finded = array();
foreach ($plugins as $code => $config) {
if (is_int($code)) {
$code = $config;
$config = array();
}
if (!isset($config['class'])) {
$config['class'] = $code;
}
foreach ($pluginsDb as $plugin) {
if ($plugin->code == $code) {
if ($plugin->class_name != $config['class']) {
$plugin->class_name = $config['class'];
$plugin->save();
}
$finded[] = $code;
continue 2;
}
}
// плагина ещё нет в базе
$newPlugin = new Plugin();
$newPlugin->code = $code;
$newPlugin->status = Plugin::STATUS_NEW;
$newPlugin->class_name = $config['class'];
//-------------------
$newPlugin->name = $newPlugin->getName();
// нигде не используется, исключительно для легкого чтения таблицы
//-------------------
$finded[] = $code;
$newPlugin->save();
}
foreach ($pluginsDb as $plugin) {
if (!in_array($plugin->code, $finded)) {
// пропавшие плагины просто удаляем из базы
try {
$plugin->deactivate($plugin);
} catch (Exception $e) {
}
$plugin->delete();
Yii::app()->compilePluginsConfig();
}
}
$plugins = Plugin::model()->notDeleted()->findAll(array('order' => 'name'));
$this->render('/index', array('plugins' => $plugins));
}
示例7: foreach
if (is_dir(ADMIN . '/plugins/' . $file)) {
$xmlFile = ADMIN . '/plugins/' . $file . '/info.xml';
if (!file_exists($xmlFile)) {
continue;
}
$exists = false;
foreach (getPlugins() as $plugin) {
if ($plugin->getInfoPath() == $xmlFile) {
$exists = true;
}
}
if ($exists) {
continue;
}
if (file_exists($xmlFile)) {
$ainfo = Plugin::getAuthorInfo($xmlFile);
$manager->addItem("Not installed plugins", array(Plugin::getName($xmlFile), Plugin::getDescription($xmlFile), $ainfo['name'], '<a href="' . $ainfo['website'] . '">' . $ainfo['website'] . '</a>', "override_actions" => array("<a href='" . orongoURL("orongo-admin/plugin-install.php?xml_path=" . urlencode(str_replace(ADMIN . '/plugins', "", $xmlFile))) . "'>" . l("Install") . "</a>")), "", "");
}
} else {
continue;
}
}
}
$manage->addObject($manager);
$manage->render();
break;
default:
header("Location: " . orongoURL("orongo-admin/index.php?msg=1"));
exit;
break;
}
示例8: getMoney
/**
* Gets player balance
*
* @param Plugin $api Economy plugin (from moneyPlugin)
* @param str|IPlayer $player Player to lookup
*
* @return int
*/
public static function getMoney($api, $player)
{
if (!$api) {
return false;
}
switch ($api->getName()) {
case "GoldStd":
return $api->getMoney($player);
break;
case "PocketMoney":
case "MassiveEconomy":
if ($player instanceof IPlayer) {
$player = $player->getName();
}
return $api->getMoney($player);
case "EconomyAPI":
if ($player instanceof IPlayer) {
$player = $player->getName();
}
return $api->mymoney($player);
default:
return false;
break;
}
}
示例9: __construct
/**
* Constructor
*
* @param Plugin $plugin The plugin the installer is associated with
*/
public function __construct($plugin)
{
$this->plugin = $plugin;
$this->_plugin = $plugin->getName();
}
示例10: getName
/**
* @return String plugin name
*/
public final function getName()
{
return Plugin::getName($this->getInfoPath());
}
示例11: getMetrics
public function getMetrics()
{
return array('metrics' => array('compile_time' => number_format($this->t2 - $this->t1, 3), 'execution_time' => number_format($this->t3 - $this->t2, 3), 'total_time' => number_format($this->t3 - $this->t1, 3), 'memory_usage' => number_format(memory_get_peak_usage(true) / 1024 / 1024, 1)), 'plugin' => array('Id' => $this->plugin->getId(), 'Name' => $this->plugin->getName(), 'Identifier' => $this->plugin->getIdentifier(), 'Event' => $this->plugin->getEvent(), 'Entity' => $this->plugin->getEntity()), 'output' => $this->output);
}
示例12: addPluginCommand
/**
* Add a response command that is generated by a plugin
*
* @param Plugin $xPlugin The plugin object
* @param array $aAttributes The attributes for this response command
* @param mixed $mData The data to be sent with this command
*
* @return \Jaxon\Plugin\Response
*/
public function addPluginCommand($xPlugin, $aAttributes, $mData)
{
$aAttributes['plg'] = $xPlugin->getName();
return $this->addCommand($aAttributes, $mData);
}