小洪維尼 发表于 2017-4-5 10:50:48

PHP Code Beautifier结合editplus打造代码美化工具

工具:
PHP Code Beautifie(官方网站:http://www.waterproof.fr/)
editplus(官方网站:http://www.editplus.com/)
先 把PHP Code Beautifie下载下来放到editplus 安装目录下.
再在editplus 下点 工具>参数>用户工具>增加工具>程序
菜单文本:自己随便写一个名字,比如我们叫"代码格式化"
命令浏览到我们刚才下载的phpcb.exe
参数那儿写上:
--space-after-if --glue-arrow --optimize-eol --space-after-switch --space-after-while --space-before-start-angle-bracket --one-true-brace-function-declaration --one-true-brace --extra-padding-for-case-statement --glue-amperscore --change-shell-comment-to-double-slashes-comment --indent-with-tab --force-large-php-code-tag --force-true-false-null-contant-lowercase --comment-rendering-style PEAR --equal-align-position 50 --padding-char-count 1 "$(FilePath)"
起始目录:$(FileDir)
注意:下面一定要选上文本过滤器模式运行 替换
设置如下图(英文):

运行前代码:

<?php class Point_List extends AbstractList{ protected function _prepareLayout(){         if ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs')) {             $breadcrumbs->addCrumb('my_point', array(               'label' => $this->__($title),               'title' => $this->__($title)             ));         }   }public function getMyPoints() { $points = 0; $customer = Mage::getSingleton('customer/session')->getCustomer(); $customer = $customer->load($customer->getId()); $points = $customer->getPoints() + 0; return $points; } }

执行菜单项上的"代码格式化"

进行之后 的代码如图:

<?php class Point_List extends AbstractList
{
protected function _prepareLayout()
{
if ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs'))
{
$breadcrumbs->addCrumb('my_point', array('label' => $this->__($title), 'title' => $this->__($title)));
}
}
public function getMyPoints()
{
$points = 0;
$customer = Mage::getSingleton('customer/session')->getCustomer();
$customer = $customer->load($customer->getId());
$points = $customer->getPoints() + 0;
return $points;
}
}
页: [1]
查看完整版本: PHP Code Beautifier结合editplus打造代码美化工具