Лог ключевых мыслей и ссылок из первого занятия по PHP.
Список паттернов. Более подбробно про паттерн Registry.
Список фреймворков (их много):
<?php | |
class A { | |
public $b; | |
function __destruct() { | |
//echo 'Уничтожается ', __CLASS__, PHP_EOL; | |
// Looks like no difference between "unset" and "null" method | |
//$this->b = null; | |
unset($this->b); | |
} |
<?php | |
function kk_embed_oembed_html_adaptive ($cache, $url, $attr, $post_ID) { | |
/** | |
* Отступ в 6 символов в начале ссылки, потому что есть http:// | |
* (для https:// тоже сработает). | |
*/ | |
if ( | |
strpos ($url, 'youtu', 6) | |
|| | |
strpos ($url, 'vimeo', 6) |
Планируем что поделать на втором занятии по PHP.
Насколько правильно и клево написан код WordPress Plugin Boilerplate?
Например, в файле class-plugin-name-loader.php
видно, что сначала описываются просто переменные, а в методе __contruct()
они заполняются данными.
"use strict"; | |
var CandyShop = ( | |
function (self) { | |
return self; | |
}(CandyShop || {}) | |
); | |
CandyShop.HighlightStockTicker = (function (self, Candy, $) { |
<?php | |
/** | |
* Notify user of signup success. | |
* | |
* This is the notification function used when no new site has | |
* been requested. | |
* | |
* Filter 'wpmu_signup_user_notification' to bypass this function or | |
* replace it with your own notification behavior. | |
* |
<?php | |
function selena_network_sanitize_file_name ($name, $original_name) { | |
$chars_table = array ( | |
// Cyrillic alphabet | |
'А' => 'a', 'Б' => 'b', 'В' => 'v', 'Г' => 'g', 'Д' => 'd', | |
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', | |
'Е' => 'e', 'Ж' => 'zh', 'З' => 'z', 'И' => 'i', 'Й' => 'j', | |
'е' => 'e', 'ж' => 'zh', 'з' => 'z', 'и' => 'i', 'й' => 'j', |
<?php | |
/* | |
* Stupid guys from http://www.gt3themes.com write this code in WordPress themes. I hate this company. | |
* Never buy their themes. | |
* | |
*/ | |
header("Content-type: text/css"); | |
$wp_include = "../../../../wp-load.php"; | |
$i = 0; | |
while (!file_exists($wp_include) && $i++ < 10) { |
"use strict"; | |
module.exports = function(grunt) { | |
var config = grunt.file.readJSON('config/config.json'); | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
config: config, | |
rsync: { |
"use strict"; | |
var CandyShop = ( | |
function (self) { | |
return self; | |
} | |
(CandyShop || {}) | |
); | |
CandyShop.Emoji = (function (self, Candy, $) { |