Git Product home page Git Product logo

Comments (16)

m1ga avatar m1ga commented on May 22, 2024

👍

from atom-beautify.

Glavin001 avatar Glavin001 commented on May 22, 2024

@m1ga have you tried the PHP-Beautifier on it's own, from PIP? I just want to confirm that it works correctly, on it's own and as expected by yourself (a PHP user), before I go down that path.

from atom-beautify.

m1ga avatar m1ga commented on May 22, 2024

@Glavin001 yes I've tried (pear) PHP-Bautifier from the command line and it looks fine. Haven't had the time to look at the options yet but even with the standard settings it looks fine!
The (atom) php-beautifier isn't working because of https://github.com/sdwood/php-beautifier/issues/3

from atom-beautify.

Glavin001 avatar Glavin001 commented on May 22, 2024

Hah, pear. As you can see, I am not a PHP user myself 😉.
I'll see if I can get it working soon.

from atom-beautify.

Glavin001 avatar Glavin001 commented on May 22, 2024

Installing pear for Mac: http://coolestguidesontheplanet.com/installing-pear-osx-10-9-mavericks-osx10-810-7/

from atom-beautify.

Glavin001 avatar Glavin001 commented on May 22, 2024

@m1ga could you give me a little sample snippet of PHP code, before and after beautification? So I can do some test.

I am trying with:

$t=date("H");

if ($t<"10") {
echo "Have a good morning!";
} elseif ($t<"20") {
echo "Have a good day!";
} else {
echo "Have a good night!";
}

However it does not change after beautifying..

Update: turns out you must have the <?php and ?> in the file, as well. Totally forgot. Silly me.

from atom-beautify.

m1ga avatar m1ga commented on May 22, 2024

sure

<?php
if (!isset($_SESSION)) session_start();
require_once("sql.req.php");


// friend requests
$q = $mysqli->query("");
$num = $q->num_rows;
echo '<a href="notifications.php">';
if ($num>0) {  echo '<i class="fa fa-star white"></i>';
}else {  echo '<i class="fa fa-star-o"></i>'; }
echo '</a>';


// new messages
$q = $mysqli->query("");
$num = $q->num_rows;
echo '<a href="messages.php">';
if ($num>0) {
echo '<i class="fa fa-envelope white"></i>';
}else {
echo '<i class="fa fa-envelope-o"></i>';
}
echo '</a>';




?>

from atom-beautify.

Glavin001 avatar Glavin001 commented on May 22, 2024

Thank you, @m1ga.


On my Mac it is not working cleanly:

$ php_beautifier --indent_spaces test.php test.php.out
PHP Strict Standards:  Non-static method Console_Getopt::readPHPArgv() should not be called statically in /Users/glavin/pear/bin/php_beautifier on line 70
PHP Strict Standards:  Non-static method Console_Getopt::getopt() should not be called statically in /Users/glavin/pear/bin/php_beautifier on line 84
PHP Strict Standards:  Non-static method Console_Getopt::doGetopt() should not be called statically in /Users/glavin/pear/share/pear/Console/Getopt.php on line 92
PHP Strict Standards:  Non-static method PEAR::isError() should not be called statically in /Users/glavin/pear/share/pear/Console/Getopt.php on line 109
PHP Strict Standards:  Non-static method Console_Getopt::_parseLongOption() should not be called statically in /Users/glavin/pear/share/pear/Console/Getopt.php on line 153
PHP Strict Standards:  Non-static method PEAR::isError() should not be called statically in /Users/glavin/pear/share/pear/Console/Getopt.php on line 154
PHP Strict Standards:  Non-static method PEAR::isError() should not be called statically in /Users/glavin/pear/bin/php_beautifier on line 85

So instead of using stdout, have php_beautify pipe to file.

Note: Use https://github.com/bruce/node-temp for creating temporary file that will receive output.

from atom-beautify.

m1ga avatar m1ga commented on May 22, 2024

I'm getting these warnings too but the test.php.out file looks good.

from atom-beautify.

Glavin001 avatar Glavin001 commented on May 22, 2024

Done and tested (on Mac).

/cc @karolyi

from atom-beautify.

Glavin001 avatar Glavin001 commented on May 22, 2024

@m1ga for the time being, until @karolyi has reviewed the Pull Request, you can use my fork:

# Clone fork repo
git clone [email protected]:Glavin001/atom-beautify.git
# Change into repo directory
cd atom-beautify/
# Install dependencies
npm install
# Uninstall old atom-beautify, if applicable
apm uninstall atom-beautify
# Link and use this atom-beautify
apm link
# Update dependencies
npm install
# Restart atom

Let me know if there is anything else.

from atom-beautify.

Batmandakh avatar Batmandakh commented on May 22, 2024

I can't use php_beautifier cause of temporary file of current active session... I'm on Ubuntu 14.04 with php 5.6 and latest version of atom. All php_beautifier dependencies have installed and they're working correctly from terminal.
Please see giving error:

Command failed: /bin/sh -c [ -f ~/.bash_profile ] && source ~/.bash_profile;[ -f ~/.bashrc ] && source ~/.bashrc;php "/usr/bin/php_beautifier " --input "/tmp/input115014-12433-1i2xoqb" --output "/tmp/115014-12433-1ke9sic" /bin/sh: 1: source: not found

I've watched carefully "/tmp/" directory. But there's no file created during any session... How to solve this?

from atom-beautify.

MikeElghali avatar MikeElghali commented on May 22, 2024

@Batmandakh I have the same error.

from atom-beautify.

jclappiway avatar jclappiway commented on May 22, 2024

+1 same error with tmp files

from atom-beautify.

Glavin001 avatar Glavin001 commented on May 22, 2024

Sounds like for some reason source ~/.bashrc; is not working on your Ubuntu computer.

The afflicting lines of code can be found at: https://github.com/Glavin001/atom-beautify/blob/master/lib/langs/cli-beautify.coffee#L45-L50

If you can comment out those lines in your local installation of Atom Beautify, that should fix it. You will have to manually set the path of php_beautifier in the Atom Beautify Package Settings.

#164 will solve this.

from atom-beautify.

john-d-pelingo avatar john-d-pelingo commented on May 22, 2024

Whenever I try to use your package to beautify my php file it throws me this.


spawn php ENOENT
spawn php ENOENT
Hide Stack Trace
Error: spawn php ENOENT
at exports._errnoException (util.js:734:11)
at Process.ChildProcess._handle.onexit (child_process.js:1035:32)
at child_process.js:1127:20
at process._tickCallback (node.js:357:13)


Is it because of wrong configuration?

from atom-beautify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.