
## work with SVN



Public page: https://wordpress.org/plugins/rega-verifier
Public Pgae(serialized): https://api.wordpress.org/plugins/info/1.0/rega-verifier
Public Pgae(JSON): https://api.wordpress.org/plugins/info/1.0/rega-verifier.json

Plugin directory SVN: https://plugins.svn.wordpress.org/rega-verifier

readme.txt Example: https://wordpress.org/plugins/readme.txt

create svn repo
```bash
# 1. Check out --> like git clone
svn co https://plugins.svn.wordpress.org/rega-verifier

# 2. make your changes

# 3. Commit
svn commit -m "Tagging version 1.2.31"
```

## **How to install**

### 1. Install REGA in Wordpress Plugin normally.

### 2. Goto `WP > Settings > REGA` page

```bash
# on Windows
ssh -D 5001 aqarnet@aqar.net.sa
npm install -g http-proxy-to-socks
node C:\D\Program_Files\node\node_modules\http-proxy-to-socks\bin\hpts -s 127.0.0.1:5001 -p 8080

# on Linux
ssh -D 5001 aqarnet@aqar.net.sa
mkdir npmtest
cd npmtest
node init
npm install http-proxy-to-socks
node node_modules/http-proxy-to-socks/bin/hpts -s 127.0.0.1:5001 -p 8080
```



### 3. insert input widget: just add this widget in any page you want.
```php
  the_widget( 
      'Rega_Create_Listing_Widget',
      array( 
          'show_frm_check' => 'yes',
          'show_frm_add_prop_initially' => 'no',
          'show_frm_add_prop_afterload' => 'yes',
          'hide_null_elements' => 'yes',
          'show_icon_for_list_item' => 'yes',
          'auto_getAd' => 'no',
          'css_class_cols' => 'list-3-cols', //list-2-cols
      ) 
  ); 
```

## **5 Install on Houzez:**
Repeate same steps of 1 and 2.

#### 5.2 for Houzez (2.7) 
In `/houzez/property-details/partials/details.php`
Add new Widget instance in the property view. No need for any html wrapping.

```php
<?php 
    the_widget( 
        'Rega_Create_Listing_Widget',
        array( // instance 
            'show_frm_check' => 'no',
            'show_frm_add_prop_initially' => 'no',
            'show_frm_add_prop_afterload' => 'no',
            'hide_null_elements' => 'yes',
            'show_icon_for_list_item' => 'yes',
            'auto_getAd' => 'yes',
            'css_class_cols' => 'list-2-cols',
        ) 
    ); 
?>
```


### 8. Change `houzez_required_field()` (Optional)
In `/themes/houzez/framework/functions/helper_functions.php` This function to display a word of '`Requried`' beside any requried field in add-new-property page.

```php
if( !function_exists('houzez_required_field') ) 
{
    function houzez_required_field( $field ) {
        if( $field != 0 ) {
            return "<span style='color:red;'> *". __('Required', 'rega-verifier') ."* </span>";
            //return '*';
        }
        return '';
    }
}
```
### 9. Change `100000` to `100,000` in overview section (Optional)
In `/public_html/wp-content/themes/houzez/property-details/partials/overview-data.php` This file to display the section of '`Overview`' in the property display details page.

```php
    // insert this code in the appropriate place in the file
    if('fave_'.$key == 'fave_income'){
        $custom_field_value = number_format($custom_field_value, 0, '.', ',');
    }

```


```sql
SELECT * FROM `wp_postmeta` 
WHERE post_id = 17945
```

# How to make translation

Install and download the wp-cli (Very easy, single file download) [read](https://make.wordpress.org/cli/handbook/guides/installing/)
```bash

# Then, check if it works:
php wp-cli.phar --info

# Make it for everyone everywhere
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp

# Check 
wp --info

```

write good translation functions __(), _e(), _x() ...and [more](https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/)

```bash

cd ~/public_html/wp-content/plugins/rega-verifier

# Step-1: Create POT file. this will looks for all __() _e() and other functions
wp i18n make-pot . languages/rega-verifier.pot --include="*.php" --domain="rega-verifier"

# Step-2: Copy the POT into PO file 
cp languages/rega-verifier.pot  languages/rega-verifier-ar.po

# Step-3: Write your translation in PO file.
<?php _e("Create A Listing", 'rega-verifier') ?>

# Step-4 (Optional): Upate PO file, use this when you change your code and regenerate POT file.
wp i18n update-po  languages/rega-verifier.pot  languages/rega-verifier-ar.po

# Step-5: Make MO file
wp i18n make-mo languages/rega-verifier-ar.po  languages
```

add `Text Domain` and `Domain Path` in the plugin header `index.php`.

Note: Text Domain must match slug and use dashes, not Underscore

```php

/** 
 * Plugin Name: My Plugin
 * Author: Plugin Author
 * Text Domain: rega-verifier
 * Domain Path: /languages
 */

```

Now copy the code that loads MO file based on the current Locale.

Note: Text Domain must match slug and use dashes, not Underscore.

```php

 
add_action( 'init', function() 
{
    // rega-verifier/languages => relative to WP_PLUGIN_DIR
    load_plugin_textdomain( 'rega-verifier', false, 'rega-verifier/languages' ); 
});


add_filter( 'load_textdomain_mofile', function( $mofile, $domain ) 
{
    if ( 'rega-verifier' === $domain && false !== strpos( $mofile, WP_LANG_DIR . '/plugins/' ) ) 
    {
        $locale = apply_filters( 'plugin_locale', determine_locale(), $domain );
        $mofile = WP_PLUGIN_DIR . '/rega-verifier/languages/' . $domain . '-' . $locale . '.mo';
    }
    return $mofile;
}, 10, 2 );  
  
```

# How to Publish
* First, keep all important files in pro/ folder.
* Second, copy files after modify them to be empty.
* Now upload pro/ to Farawla (sami.netzerooo.com:/.../plugins/pro/rega-pro/)
```bash
$ ./helper publish
```
*  