Create or open the file .git/hooks/pre-commit
and paste the following code inside it:
#!/bin/sh
mysqldump \
--no-data \
--dump-date=false \
--result-file=$PWD/dbdump.sql \
--log-error='/dev/null' \
--user='username' \
<?php | |
function htmlentities_recursive($code) { | |
if (is_array($code)) | |
{ | |
foreach ($code as &$c) $c = htmlentities_recursive($c); | |
return $code; | |
} | |
return htmlentities($code); | |
} |
filter: #{'invert()'} |
Create or open the file .git/hooks/pre-commit
and paste the following code inside it:
#!/bin/sh
mysqldump \
--no-data \
--dump-date=false \
--result-file=$PWD/dbdump.sql \
--log-error='/dev/null' \
--user='username' \
Install the json rest api wordpress plugin.
Include the following function in app/Controller/AppController.php
in your CakePHP instalation.
protected function _wpAPI($method='get', $url='/', $data=null)
{
App::uses('HttpSocket', 'Network/Http');
$http = new HttpSocket();
$http->configAuth('Basic', 'admin', 'password');
Instead of searching on the ajenti.org website every time i want to install it, i copy and paste the code from this page.
wget -O- https://raw.github.com/Eugeny/ajenti/master/scripts/install-ubuntu.sh | sudo sh
You may need apt-get remove apache2
, and finaly
apt-get install ajenti-v ajenti-v-nginx ajenti-v-mysql ajenti-v-php-fpm php5-mysql
service ajenti restart
I hereby claim:
To claim this, I am signing this object:
Add this in your .htaccess
file:
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
Create an app/gear on OpenShift with this cartidge: OpenShift Nginx PHP-FPM Cartridge
Open the file: <your-app-folder>/config/nginx.d/default.conf.erb
, earse all the content, and paste this instead:
server {
root <%= ENV['OPENSHIFT_REPO_DIR'] %>/php;
listen <%= ENV['OPENSHIFT_PHP_IP'] %>:<%= ENV['OPENSHIFT_PHP_PORT'] %>;
server_name <%= ENV['OPENSHIFT_APP_DNS'] %>;
index index.php index.html index.htm;
Add this code before </head>
:
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
You can easily mark a specified word (or array of words) in a string.
<?php
function mark($pattern, $source) {
if (is_array($pattern)) {
$finalPatterns = array_map(function ($value) { return "/(".preg_quote($value).")(?![^<]*>|[^<>]*<\/)/i"; }, $pattern);
} else {
$finalPatterns = "/(".preg_quote($pattern).")(?![^<]*>|[^<>]*<\/)/i";
}