Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                /**
 * Add regions to the search
 *
 * @access public
 *
 * @param mixed $region
 *
 * @since  unknown
 */
public
function addRegion($region = array()) {
    if (is_array($region)) {
        foreach($region as $r) {
            $r = trim($r);
            if ($r != '') {
                if (is_numeric($r)) {
                    $this - > regions[] =
                        sprintf(
                            '%st_item_location.fk_i_region_id = %d ',
                            DB_TABLE_PREFIX,
                            $this - > dao - > escapeStr($r)
                        );
                } else {
                    $this - > regions[] =
                        sprintf(
                            "%st_item_location.s_region LIKE '%s' ",
                            DB_TABLE_PREFIX,
                            $this - > dao - > escapeStr($r)
                        );
                }
            }
        }
    } else {
        $region = trim($region);
        if ($region != '') {
            if (is_numeric($region)) {
                $this - > regions[] =
                    sprintf(
                        '%st_item_location.fk_i_region_id = %d ',
                        DB_TABLE_PREFIX,
                        $this - > dao - > escapeStr($region)
                    );
            } else {
                $this - > regions[] =
                    sprintf(
                        "%st_item_location.s_region LIKE '%s' ",
                        DB_TABLE_PREFIX,
                        $this - > dao - > escapeStr($region)
                    );
            }
        }
    }
}

/**
 * Given the current search object, extract search parameters & conditions
 * as array.
 *
 * @return array
 */
private
function _getConditions() {
    $aData = array();

    $item_id = DB_TABLE_PREFIX.
    't_item.pk_i_id';
    $item_category_id = DB_TABLE_PREFIX.
    't_item.fk_i_category_id';
    $item_description_id = 'd.fk_i_item_id';
    $category_id = DB_TABLE_PREFIX.
    't_category.pk_i_id';
    $item_location_id = DB_TABLE_PREFIX.
    't_item_location.fk_i_item_id';
    $item_resource_id = DB_TABLE_PREFIX.
    't_item_resource.fk_i_item_id';

    // get item conditions
    foreach($this - > conditions as $condition) {
        // item table
        if (preg_match('/'.DB_TABLE_PREFIX.
                't_item\.b_active/', $condition, $matches)) {
            $aData['itemConditions'][] = $condition;
        }
        elseif(preg_match('/'.DB_TABLE_PREFIX.
            't_item\.b_spam/', $condition, $matches)) {
            $aData['itemConditions'][] = $condition;
        }
        elseif(preg_match(
            '/'.DB_TABLE_PREFIX.
            't_item\.b_enabled/',
            $condition,
            $matches
        )) {
            $aData['itemConditions'][] = $condition;
        }
        elseif(preg_match(
            '/'.DB_TABLE_PREFIX.
            't_item\.b_premium/',
            $condition,
            $matches
        )) {
            $aData['itemConditions'][] = $condition;
        }
        elseif(preg_match(
            '/('.DB_TABLE_PREFIX.
            't_item\.)?f_price >= (.*)/',
            $condition,
            $matches
        )) {
            $aData['price_min'] = (int) $matches[2];
        }
        elseif(preg_match(
            '/('.DB_TABLE_PREFIX.
            't_item\.)?f_price <= (.*)/',
            $condition,
            $matches
        )) {
            $aData['price_max'] = (int) $matches[2];
        }
        elseif(preg_match(
            '/('.DB_TABLE_PREFIX.
            't_item\.)?i_price >= (.*)/',
            $condition,
            $matches
        )) {
            $aData['price_min'] = ((double) $matches[2] / 1000000);
        }
        elseif(preg_match(
            '/('.DB_TABLE_PREFIX.
            't_item\.)?i_price <= (.*)/',
            $condition,
            $matches
        )) {
            $aData['price_max'] = ((double) $matches[2] / 1000000);
        }
        elseif(preg_match(
            '/'.DB_TABLE_PREFIX.
            't_category.b_enabled/',
            $condition,
            $matches
        )) {
            // t_category.b_enabled is not longer needed
        }
        elseif(preg_match_all(
            '/('.DB_TABLE_PREFIX
            .
            't_item_location.s_city_area\s*LIKE\s*\'%([\s\p{L}\p{N}]*)%\'\s*)/u',
            $condition,
            $matches
        )) { // OJO
            // Comprobar: si ( s_name existe ) then get location id,
            $aData['s_city_area'][] =
                DB_TABLE_PREFIX.
            't_item_location.s_city_area LIKE \'%'.$matches[2][0]
                .
            '%\'';
        }
        elseif(preg_match('/'.DB_TABLE_PREFIX
            .
            't_item_location.fk_i_city_area_id = (.*)/', $condition, $matches)) {
            $aData['fk_i_city_area_id'][] =
                DB_TABLE_PREFIX.
            't_item_location.fk_i_city_area_id = '.$matches[1];
        }
        elseif(preg_match_all(
            '/('.DB_TABLE_PREFIX
            .
            't_item_location.s_city\s*LIKE\s*\'%([\s\p{L}\p{N}]*)%\'\s*)/u',
            $condition,
            $matches
        )) { // OJO
            // Comprobar: si ( s_name existe ) then get location id,
            $aData['cities'][] =
                DB_TABLE_PREFIX.
            't_item_location.s_city LIKE \'%'.$matches[2][0].
            '%\'';
        }
        elseif(preg_match(
            '/'.DB_TABLE_PREFIX.
            't_item_location.fk_i_city_id = (.*)/',
            $condition,
            $matches
        )) {
            $aData['cities'][] =
                DB_TABLE_PREFIX.
            't_item_location.fk_i_city_id = '.$matches[1];
        }
        elseif(preg_match_all(
            '/('.DB_TABLE_PREFIX
            .
            't_item_location.s_region\s*LIKE\s*\'%([\s\p{L}\p{N}]*)%\'\s*)/u',
            $condition,
            $matches
        )) { // OJO
            // Comprobar: si ( s_name existe ) then get location id,
            $aData['s_region'][] =
                DB_TABLE_PREFIX.
            't_item_location.s_region LIKE \'%'.$matches[2][0].
            '%\'';
        }
        elseif(preg_match(
            '/'.DB_TABLE_PREFIX.
            't_item_location.fk_i_region_id = (.*)/',
            $condition,
            $matches
        )) {
            $aData['fk_i_region_id'] =
                DB_TABLE_PREFIX.
            't_item_location.fk_i_region_id = '.$matches[1];
        }
        elseif(preg_match_all(
            '/('.DB_TABLE_PREFIX
            .
            't_item_location.s_country\s*LIKE\s*\'%([\s\p{L}\p{N}]*)%\'\s*)/u',
            $condition,
            $matches
        )) { // OJO
            // Comprobar: si ( s_name existe ) then get location id,
            $aData['s_country'][] =
                DB_TABLE_PREFIX.
            't_item_location.s_country LIKE \'%'.$matches[2][0].
            '%\'';
        }
        elseif(preg_match('/'.DB_TABLE_PREFIX
            .
            't_item_location.fk_c_country_code = \'?(.*)\'?/', $condition, $matches)) {
            $aData['fk_c_country_code'][] =
                DB_TABLE_PREFIX.
            't_item_location.fk_c_country_code = '.$matches[1];
        }
        elseif(preg_match(
            '/d\.s_title\s*LIKE\s*\'%([\s\p{L}\p{N}]*)%\'/u',
            $condition,
            $matches
        )) { // OJO
            $aData['sPattern'] = $matches[1];
            $aData['withPattern'] = true;
        }
        elseif(preg_match(
            '/MATCH\(d\.s_title, d\.s_description\) AGAINST\(\'([\s\p{L}\p{N}]*)\' IN BOOLEAN MODE\)/u',
            $condition,
            $matches
        )) { // OJO
            $aData['sPattern'] = $matches[1];
            $aData['withPattern'] = true;
        }
        elseif(preg_match("/$item_id\s*=\s*$item_description_id/", $condition, $matches_1) ||
            preg_match("/$item_description_id\s*=\s*$item_id/", $condition, $matches_2)
        ) {}
        elseif(preg_match("/$category_id\s*=\s*$item_category_id/", $condition, $matches_1) ||
            preg_match("/$item_id\s*=\s*$item_category_id/", $condition, $matches_2)
        ) {}
        elseif(preg_match("/$item_location_id\s*=\s*$item_id/", $condition, $matches_1) ||
            preg_match("/$item_id\s*=\s*$item_location_id/", $condition, $matches_2)
        ) {}
        elseif(preg_match("/$item_id\s*=\s*$item_resource_id/", $condition, $matches_1) ||
            preg_match("/$item_resource_id\s*=\s*$item_id/", $condition, $matches_2)
        ) {
            // nothing to do, catch table
        }
        elseif(preg_match_all(
            '/('.DB_TABLE_PREFIX.
            't_item\.fk_i_category_id = (\d*))/',
            $condition,
            $matches
        )) {
            $aData['aCategories'] = $matches[2];
        } else {
            $aData['no_catched_conditions'][] = $condition;
        }
    }

    // get tables
    foreach($this - > tables as $table) {
        if (preg_match('/('.DB_TABLE_PREFIX.
                't_item$)/', $table, $matches)) {
            // t_item is allways included
        }
        elseif(preg_match(
            '/('.DB_TABLE_PREFIX.
            't_item_description( as d)?)/',
            $table,
            $matches
        )) {
            // t_item_description is allways included
        }
        elseif(preg_match('/'.DB_TABLE_PREFIX.
            't_category/', $table, $matches)) {
            // t_category is allways included
        }
        elseif(preg_match(
            '/('.DB_TABLE_PREFIX.
            't_category_description( as cd)?)/',
            $table,
            $matches
        )) {
            // t_item_description
            $aData['tables'][] = $matches[1];
        }
        elseif(preg_match('/('.DB_TABLE_PREFIX.
            't_item_resource)/', $table, $matches)) {
            $aData['withPicture'] = true;
        } else {
            $aData['no_catched_tables'][] = $table;
        }
    }

    // get order & limit
    $aData['order_column'] = $this - > order_column;
    $aData['order_direction'] = $this - > order_direction;
    $aData['limit_init'] = $this - > limit_init;
    $aData['results_per_page'] = $this - > results_per_page;

    return $aData;
}
              
            
!
999px

Console