Blog - page 3

1 2 3 4 5 6

Blog

PHP Classes – Oblects notes

Object oriented programming logic is very usefull if you want your code to reach your imagination limits. OOP helps your code to extend easier and at the same time helps your scripts to be cleaner, reusable, and saperated according to the logic you choose. Much stuff here is taken from the official php manual paraphrased and summarized by me in an efford to create a quick guide to PHP classes and objects. Most of the examples are mine and I tried to make them playful and educational.

Continue reading “PHP Classes – Oblects notes”

0

$wpdb Class notes

WordPress Logo Symbol
Methods in the wpdb() class should not be called directly. Use the global $wpdb object instead.
$wpdb object can talk to any number of tables but only to one database.(*hyperdb)
Some of the methods in this class require from you to escape all untrusted values you incorporate.
$wpdb -> get_var(‘query’, column_offset, row_offset)
$wpdb -> get_row( ‘query’, output_type, row_offset )
$wpdb -> get_col( ‘query’, column_offset )
$wpdb -> get_results( ‘query’, output_type )
$wpdb -> insert( $table, $data, $format )
$wpdb -> replace( $table, $data, $format )
$wpdb -> update( $table, $data, $where, $format=null, $where_format=null )
$wpdb -> delete( $table, $data, $where_format=null )
$wpdb -> query( ‘query’ )
$wpdb -> get_col_info( ‘type’, offset )
$wpdb -> show_errors()
$wpdb -> hide_errors()
$wpdb -> print_error()

Continue reading “$wpdb Class notes”

0

WP Settings Api notes

settings control panel

The Settings API, lets you define settings pages, sections within those pages, and fields within the sections.

The form posts to wp-admin/options.php which provides strick capabilities checking and users will need to ‘manage_options’ capability to submit the form.

These are my quick notes for personal use, and they only resume the official wp codex.

Setting API functions

register_setting( $option_group, $option_name , $sanitize_callback )
unregister_setting( $option_group, $option_name , $sanitize_callback )
add_settings_field( $id, $title, $callback, $page, $section, $args )
add_settings_section( $id, $title, $callback, $page )
setting_fields( $option_group )
do_settings_sections( $page )
do_settings_fields( $page, $section )
add_settings_error( $setting, $code, $message, $type )
get_settings_errors( $settings, $sanitize )
settings_errors( $setting, $sanitize, $hide_on_update )

Continue reading “WP Settings Api notes”

0

CSS rules for responsive design

Twitter Bootstrap logo

I read bootstrap’s 3 code and here I will factor out some of the main concepts that I have found at their stylesheet(css).

I read their stylesheet for educational purposes, and because after all I don’t like overriding their sheet, or have 200 classes that I will never use for my projects. I also don’t like including their js files, and it seems that many css classes have connections with the js code.

By reading bootstrap’s code for the first time I narrowed down the code from 6 thousand lines to 1.5 thousand. And here’s the most interesting teqniques they use:

Continue reading “CSS rules for responsive design”

0