我正在使用login_footer 钩子在登录表单下方显示一些信息。
我需要显示上次提交插件时的信息。
Hook definition:
$this->loader->add_action( \'login_footer\', $plugin_admin, \'e4afz_login_footer\' );
Function:
public function e4afz_login_footer() {
global $E4AFZ_PLUGIN_ROOT_DIR;
?>
<style>
#e4afz-login-footer-container {
text-align: center;
margin-top: 10px;
}
</style>
<div id="e4afz-login-footer-container">
<p>© <?php echo date( \'Y\' ); ?> , Platform Version: <?php echo $this->version; ?></p>
<p><?php
echo shell_exec( "git log --git-dir =\'" . $E4AFZ_PLUGIN_ROOT_DIR . ".git" .
"\' -1 --pretty=format:\'%h - %s (%ci)\' --abbrev-commit --work-tree =\'" . $E4AFZ_PLUGIN_ROOT_DIR );
?></p>
</div>
<?php
}
The
global variable 在主插件文件上定义如下:
$E4AFZ_PLUGIN_ROOT_DIR = plugin_dir_path( __FILE__ );
我正在
NULL shell\\u exec的结果。
想法?
ADDITIONAL TRIES:
还尝试从主插件文件中获取所需内容:
$E4AFZ_LAST_COMMIT = shell_exec( "git log -1 --git-dir=" . ABSPATH . "/wp-content/plugins/e4afz-wp/.git" . " --work-tree=" . ABSPATH . "/wp-content/plugins/e4afz-wp/ 2>&1" );
我得到了一个
"fatal: Not a git repository (or any of the parent directories): .git" 因此