Commit 63be86b2 authored by Simon's avatar Simon

Merge branch 'dev'

parents c52dca1c 773793dd
......@@ -17,7 +17,7 @@
### DB backup
- `C:\web\dev.biuro> docker exec -i dev-biuro-mysql mysqldump -udev_user -pY6V6bFkD6@GyD!wTShgFmWz! --default-character-set=utf8 dev_biuro > docker/mariadb/data-004.sql`
- `sudo docker exec -i biuro-staging-mysql mysqldump -ustaging_user -p'qzl8pMNV^gZ&c1!7ebVsXqQh' --default-character-set=utf8 staging_biuro > docker/mariadb/data-007.sql`
- `sudo docker exec -i biuro-staging-mysql mysqldump -ustaging_user -p'qzl8pMNV^gZ&c1!7ebVsXqQh' --default-character-set=utf8 staging_biuro > docker/mariadb/data-008.sql`
### DB restore
- `C:\web\dev.biuro> docker exec -i dev-biuro-mysql mysql -udev_user -pY6V6bFkD6@GyD!wTShgFmWz! --default-character-set=utf8 dev_biuro < docker/mariadb/data-004.sql`
......@@ -43,6 +43,10 @@
#### Polylang
#### Yoast SEO
### Basic Auth
- biuro_wp_api
- LabAiGeRsKodsu89wapI
### SEO
- [Biuro SEO auditas](https://docs.google.com/document/d/1FiwVoiLvGGmi9V-HPBgJ3gsh3wGswt27csgvfdTU24w/edit?usp=sharing)
- [Biuro raktinių žodžių analizė](https://docs.google.com/spreadsheets/d/1ggnqKuGxFFkLgI6NDZq4PXpRY_whdHX0kjZj7pCP_fk/edit?ts=5b5eaa62#gid=0)
......@@ -64,6 +68,11 @@ ERROR: for mysql Cannot start service mysql: error while creating mount source
### Solution
Restart docker (sometimes PC restart may be required)
### Error
Can't share C drive
### Solution
- https://tomssl.com/2018/01/11/sharing-your-c-drive-with-docker-for-windows-when-using-azure-active-directory-azuread-aad/
## Other (Commands)
- docker-compose up -d
......@@ -103,19 +112,20 @@ Restart docker (sometimes PC restart may be required)
- docker load --input ourdemo.tar
- docker build -t biuro/web:0.0.5 .
- docker build -t biuro/web:0.0.10 .
- docker login --username=biuro --password=9Ndtjd2vKsLvGuFOeFq1KdJs
- sudo docker login --username=biuro --password=9Ndtjd2vKsLvGuFOeFq1KdJs
- docker push biuro/web:0.0.4
- docker push biuro/web:0.0.9
- sudo chown -R www-data:www-data wordpress/wp-content/plugins
### DB preview
- `docker exec -it dev-biuro-nginx sh`
- `docker exec -it dev-biuro-wordpress bash`
- `docker exec -it dev-biuro-mysql bash`
- `mysql -uroot -pIiIjnsLi2wR9i1kWVbVpUAzP --default-character-set=utf8`
- `use wordpress;`
- `mysql -uroot -p'q@z!z29AO5rpzMjsDhjnFKyF' --default-character-set=utf8`
- `use dev_biuro;`
- `show tables;`
- `use information_schema;`
......
......@@ -26,10 +26,12 @@ services:
- "front"
- "back"
volumes:
- ./nginx/.htpasswd:/etc/nginx/.htpasswd
- ./nginx/php.ini:/usr/local/etc/php/conf.d/php.ini
- ./wp-content/plugins/biuro-contacts:/var/www/html/wp-content/plugins/biuro-contacts
- ./wp-content/plugins/biuro-feedbacks:/var/www/html/wp-content/plugins/biuro-feedbacks
- ./wp-content/plugins/biuro-html:/var/www/html/wp-content/plugins/biuro-html
- ./wp-content/plugins/biuro-sections:/var/www/html/wp-content/plugins/biuro-sections
- ./wp-content/plugins/biuro-services:/var/www/html/wp-content/plugins/biuro-services
- ./wp-content/plugins/biuro-values:/var/www/html/wp-content/plugins/biuro-values
......@@ -74,6 +76,7 @@ services:
- '80:80'
- '443:443'
volumes:
- ./nginx/.htpasswd:/etc/nginx/.htpasswd
- ./nginx/conf.d:/etc/nginx/conf.d
- ./nginx/h5bp:/etc/nginx/h5bp
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
......@@ -86,6 +89,7 @@ services:
- ./wp-content/plugins/biuro-contacts:/var/www/html/wp-content/plugins/biuro-contacts
- ./wp-content/plugins/biuro-feedbacks:/var/www/html/wp-content/plugins/biuro-feedbacks
- ./wp-content/plugins/biuro-html:/var/www/html/wp-content/plugins/biuro-html
- ./wp-content/plugins/biuro-sections:/var/www/html/wp-content/plugins/biuro-sections
- ./wp-content/plugins/biuro-services:/var/www/html/wp-content/plugins/biuro-services
- ./wp-content/plugins/biuro-values:/var/www/html/wp-content/plugins/biuro-values
......@@ -120,6 +124,7 @@ services:
- ./wp-content/plugins/biuro-contacts:/var/www/html/wp-content/plugins/biuro-contacts
- ./wp-content/plugins/biuro-feedbacks:/var/www/html/wp-content/plugins/biuro-feedbacks
- ./wp-content/plugins/biuro-html:/var/www/html/wp-content/plugins/biuro-html
- ./wp-content/plugins/biuro-sections:/var/www/html/wp-content/plugins/biuro-sections
- ./wp-content/plugins/biuro-services:/var/www/html/wp-content/plugins/biuro-services
- ./wp-content/plugins/biuro-values:/var/www/html/wp-content/plugins/biuro-values
......@@ -133,8 +138,39 @@ services:
- ./wordpress:/var/www/html
- './wp-init.sh:/usr/local/bin/wp-init.sh'
command:
- wp-init.sh
# command:
# - wp-init.sh
command: >
/bin/sh -c '
sleep 45;
echo "WP CLI init";
wp core update --force;
wp core update-db --network;
wp option update permalink_structure "/%postname%/" --skip-themes --skip-plugins;
wp option update timezone_string "Manual Offsets/UTC+2";
wp option update date_format "Y-m-d";
wp option update time_format "H:i";
wp plugin install permalink-manager --force --activate-network;
wp plugin install pods --activate-network;
wp plugin install polylang --activate-network;
wp plugin install wordpress-seo --activate-network;
wp plugin update --all;
wp plugin activate akismet --network;
wp plugin activate biuro-contacts --network;
wp plugin activate biuro-feedbacks --network;
wp plugin activate biuro-html --network;
wp plugin activate biuro-sections --network;
wp plugin activate biuro-services --network;
wp plugin activate biuro-values --network;
wp plugin activate cookies-warning --network;
wp plugin activate data-controller --network;
wp theme update --all;
wp theme activate biuro;
wp language core update;
wp language theme update --all;
wp language plugin update --all;
echo "WP CLI done. Ready to use.";
'
networks:
front:
......
This diff is collapsed.
biuro_wp_api:$apr1$vvI07kKw$MysnayQWamZReKludVojG.
......@@ -15,6 +15,15 @@ index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
# auth_basic "Restricted Content";
# auth_basic_user_file /etc/nginx/.htpasswd;
}
location /wp-json/api/v1/contacts {
try_files $uri $uri/ /index.php?$args;
auth_basic "Basic auth";
auth_basic_user_file /etc/nginx/.htpasswd;
# auth_basic_user_file /var/www/html/.htpasswd;
}
location ~ \.php$ {
......
......@@ -35,8 +35,8 @@ export function server () {
bs.init({
logPrefix: 'Biuro',
socket: {
// domain: 'localhost:443'
domain: 'https://10.0.75.1:3000/'
domain: 'dev.biuro.lt:2000'
// domain: 'https://10.0.75.1:3000/'
// // port: 2000
},
// proxy: {
......@@ -45,13 +45,14 @@ export function server () {
// },
proxy: {
target: 'https://dev.biuro.lt/',
proxyRes: [
function (proxyRes, req, res) {
// console.log(proxyRes.headers);
console.log(req);
}
],
ws: true
// target: 'dev.biuro.lt:443',
// proxyRes: [
// function (proxyRes, req, res) {
// // console.log(proxyRes.headers);
// console.log(req);
// }
// ],
ws: false
},
// httpModule: http2,
https: {
......@@ -64,7 +65,7 @@ export function server () {
// ],
ghostMode: false,
open: false,
// port: 2000,
port: 2000,
// server: false,
ui: false,
// notify: false,
......
......@@ -30,7 +30,59 @@ class Biuro_Contacts_Activator {
* @since 1.0.0
*/
public static function activate() {
global $wpdb;
if ( is_multisite() ) {
// Get all blogs in the network and activate plugin on each one
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
foreach ( $blog_ids as $blog_id ) {
switch_to_blog( $blog_id );
self::create_db_employees();
restore_current_blog();
}
} else {
// create_table();
self::create_db_employees();
}
}
public static function create_db_employees() {
global $wpdb;
$table_name = $wpdb->prefix . "biuro_employees";
$version = get_option( 'biuro-contacts_db_version', '1.0' );
if( $wpdb->get_var( "show tables like '{$table_name}'" ) != $table_name ||
version_compare( $version, '1.0' ) < 0 ) {
$charset_collate = $wpdb->get_charset_collate();
$sql[] = "CREATE TABLE " . $table_name . " (
id mediumint(9) NOT NULL AUTO_INCREMENT,
created datetime DEFAULT '0000-00-00 00:00:00',
name tinytext,
email varchar(128) DEFAULT '',
phone varchar(128) DEFAULT '',
city varchar(255) DEFAULT null,
city_id int DEFAULT null,
message longtext DEFAULT null,
cv text DEFAULT null,
updated datetime DEFAULT '0000-00-00 00:00:00',
confirm tinyint DEFAULT 0,
job_id int DEFAULT null,
PRIMARY KEY (id)
) $charset_collate;";
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
/**
* It seems IF NOT EXISTS isn't needed if you're using dbDelta - if the table already exists it'll
* compare the schema and update it instead of overwriting the whole table.
*
* @link https://code.tutsplus.com/tutorials/custom-database-tables-maintaining-the-database--wp-28455
*/
dbDelta( $sql );
add_option( 'biuro-contacts_db_version', $plugin_name_db_version );
}
}
}
......@@ -41,6 +41,15 @@ class Biuro_Contacts_Loader {
*/
protected $filters;
/**
* The array of shortcodes registered with WordPress.
*
* @since 1.0.0
* @access protected
* @var array $shortcodes The shortcodes registered with WordPress to fire when the plugin loads.
*/
protected $shortcodes;
/**
* Initialize the collections used to maintain the actions and filters.
*
......@@ -50,6 +59,7 @@ class Biuro_Contacts_Loader {
$this->actions = array();
$this->filters = array();
$this->shortcodes = array();
}
......@@ -81,6 +91,18 @@ class Biuro_Contacts_Loader {
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
}
/**
* Add a new shortcode to the collection to be registered with WordPress
*
* @since 1.0.0
* @param string $tag The name of the new shortcode.
* @param object $component A reference to the instance of the object on which the shortcode is defined.
* @param string $callback The name of the function that defines the shortcode.
*/
public function add_shortcode( $tag, $component, $callback, $priority = 10, $accepted_args = 2 ) {
$this->shortcodes = $this->add( $this->shortcodes, $tag, $component, $callback, $priority, $accepted_args );
}
/**
* A utility function that is used to register the actions and hooks into a single
* collection.
......@@ -124,6 +146,9 @@ class Biuro_Contacts_Loader {
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
}
foreach ( $this->shortcodes as $hook ) {
add_shortcode( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
}
}
}
......@@ -156,7 +156,6 @@ class Biuro_Contacts {
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
}
/**
......@@ -173,7 +172,27 @@ class Biuro_Contacts {
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
$this->loader->add_action( 'init', $plugin_public, 'register_shortcodes' );
$this->loader->add_action('admin_post_employees_post', $plugin_public, 'employees_post');
$this->loader->add_action('admin_post_nopriv_employees_post', $plugin_public, 'employees_post');
$this->loader->add_action('admin_post_employers_post', $plugin_public, 'employers_post');
$this->loader->add_action('admin_post_nopriv_employers_post', $plugin_public, 'employers_post');
$this->loader->add_action('admin_post_position_post', $plugin_public, 'position_post');
$this->loader->add_action('admin_post_nopriv_position_post', $plugin_public, 'position_post');
// $this->loader->add_action( 'init', $plugin_public, 'register_shortcodes' );
/**
* Register shortcode via loader
*
* Use: [short-code-name args]
*
* @link https://github.com/DevinVinson/WordPress-Plugin-Boilerplate/issues/262
*/
$this->loader->add_shortcode( "biuro-contacts--employees", $plugin_public, "employees_form", $priority = 10, $accepted_args = 2 );
$this->loader->add_shortcode( "biuro-contacts--employers", $plugin_public, "employers_form", $priority = 10, $accepted_args = 2 );
$this->loader->add_shortcode( "biuro-contacts--position", $plugin_public, "position_form", $priority = 10, $accepted_args = 2 );
}
/**
......
<?php
/**
* Provide a public-facing view for the plugin
*
* This file is used to markup the public-facing aspects of the plugin.
*
* @link https://www.biuro.lt
* @since 1.0.0
*
* @package Biuro_Contacts
* @subpackage Biuro_Contacts/public/partials
*/
/**
* @link https://codex.wordpress.org/Creating_Options_Pages
* @link https://www.smashingmagazine.com/2016/04/three-approaches-to-adding-configurable-fields-to-your-plugin/
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) die;
?>
<?php
$nameValue = $_SESSION['employees--name-value'];
$nameStatus = $_SESSION['employees--name-status'];
$nameMessage = $_SESSION['employees--name-message'];
?>
<div class="c-form--row">
<label class="c-form--label" for="form-name"><?php _e('Name, surname', 'biuro'); ?></label>
<div class="c-form--input-wrap <?php if ($nameStatus) { echo "c-form--input-wrap--$nameStatus"; } ?>">
<input type="text" class="c-form--input" id="form-name" name="name" value="<?php echo $nameValue; ?>" <?php if ($nameStatus == 'error'): ?> autofocus="autofocus" <?php endif; ?>>
</div>
<?php if ($nameMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $nameStatus; ?>">
<?php echo $nameMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<?php
$phoneValue = $_SESSION['employees--phone-value'];
$phoneStatus = $_SESSION['employees--phone-status'];
$phoneMessage = $_SESSION['employees--phone-message'];
?>
<div class="c-form--row">
<label class="c-form--label" for="form-phone"><?php _e('Phone no.', 'biuro'); ?></label>
<div class="c-form--input-wrap <?php if ($phoneStatus) { echo "c-form--input-wrap--$phoneStatus"; } ?>">
<input type="tel" class="c-form--input" id="form-phone" name="phone" value="<?php echo $phoneValue; ?>" <?php if ($nameStatus != 'error' && $phoneStatus == 'error'): ?> autofocus="autofocus" <?php endif; ?>>
</div>
<?php if ($phoneMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $phoneStatus; ?>">
<?php echo $phoneMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<?php
$emailValue = $_SESSION['employees--email-value'];
$emailStatus = $_SESSION['employees--email-status'];
$emailMessage = $_SESSION['employees--email-message'];
?>
<div class="c-form--row">
<label class="c-form--label" for="form-email"><?php _e('Email address', 'biuro'); ?></label>
<div class="c-form--input-wrap <?php if ($emailStatus) { echo "c-form--input-wrap--$emailStatus"; } ?>">
<input type="email" class="c-form--input" id="form-email" name="email" value="<?php echo $emailValue; ?>">
</div>
<?php if ($emailMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $emailStatus; ?>">
<?php echo $emailMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<div class="c-form--row">
<div class="c-form--submit-wrap">
<button type="submit" class="o-btn c-btn--main c-btn--fill" name="submit" value="1"><?php _e('Submit', 'biuro'); ?></button>
</div>
</div><!-- .c-form--row -->
<?php
$agreeValue = $_SESSION['employees--agree-value'];
$agreeStatus = $_SESSION['employees--agree-status'];
$agreeMessage = $_SESSION['employees--agree-message'];
?>
<div class="c-form--row">
<div class="c-form--checkbox-wrap">
<input id="form-agree" type="checkbox" class="c-form--checkbox <?php if ($agreeStatus) { echo "c-form--checkbox--$agreeStatus"; } ?>" name="agree" value="1" <?php if ($agreeValue): ?> checked="checked"<?php endif; ?>>
<label class="c-form--label-checkbox" for="form-agree"><?php _e('Rem possimus, delectus unde enim dolores doloribus, recusandae a veritatis ducimus repudiandae iste eos voluptatum architecto mollitia?', 'biuro'); ?></label>
</div>
<?php if ($agreeMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $agreeStatus; ?>">
<?php echo $agreeMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
......@@ -11,54 +11,44 @@
* @package Biuro_Contacts
* @subpackage Biuro_Contacts/public/partials
*/
?>
<form action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method="post" enctype="multipart/form-data" class="c-form">
/**
* @link https://codex.wordpress.org/Creating_Options_Pages
* @link https://www.smashingmagazine.com/2016/04/three-approaches-to-adding-configurable-fields-to-your-plugin/
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) die;
?>
<div class="c-form--row">
<label class="c-form--label" for="form-name">Name, Surname*</label>
<label class="c-form--label" for="form-city"><?php _e('City', 'biuro'); ?></label>
<div class="c-form--input-wrap">
<input type="text" class="c-form--input <?php if ($response) { echo 'c-form--input--error'; } ?>" id="form-name" name="name" value="">
</div>
<div class="c-form--validation-error">
Name and Surname is required
<input type="text" class="c-form--input" id="form-city" name="city" value="" autofocus="autofocus">
</div>
</div><!-- .c-form--row -->
<div class="c-form--row">
<label class="c-form--label" for="form-phone">Phone no.*</label>
<div class="c-form--input-wrap">
<input type="tel" class="c-form--input <?php if ($response) { echo 'c-form--input--error'; } ?>" id="form-phone" name="phone" value="">
</div>
<div class="c-form--validation-error">
Phone number is required
<label class="c-form--label" for="form-message"><?php _e('Message', 'biuro'); ?></label>
<div class="c-form--textarea-wrap">
<textarea name="message" id="form-message" cols="30" rows="3" class="c-form--textarea"></textarea>
</div>
</div><!-- .c-form--row -->
<div class="c-form--row">
<label class="c-form--label" for="form-email">Email address*</label>
<label class="c-form--label" for="form-cv"><?php _e('CV', 'biuro'); ?></label>
<div class="c-form--input-wrap">
<input type="email" class="c-form--input <?php if ($response) { echo 'c-form--input--error'; } ?>" id="form-email" name="email" value="">
</div>
<div class="c-form--validation-error">
Email address is required
<input type="file" class="c-form--input" id="form-cv" name="cv" value="">
</div>
</div><!-- .c-form--row -->
<div class="c-form--row">
<div class="c-form--submit-wrap">
<button type="submit" class="c-form--submit" name="submit" value="1">Submit</button>
<button type="submit" class="o-btn c-btn--main c-btn--fill" name="submit" value="2"><?php _e('Submit', 'biuro'); ?></button>
</div>
</div><!-- .c-form--row -->
<div class="c-form--row">
<div class="c-form--checkbox-wrap">
<input id="form-agree" type="checkbox" class="c-form--checkbox <?php if ($response) { echo 'c-form--checkbox--error'; } ?>" name="agree" value="1">
<label class="c-form--label-checkbox" for="form-agree">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem possimus, delectus unde enim dolores doloribus, recusandae a veritatis ducimus repudiandae iste eos voluptatum architecto mollitia?</label>
</div>
<div class="c-form--validation-error">
You have to agree with conditions
<input id="form-confirm" type="checkbox" class="c-form--checkbox" name="confirm" value="1">
<label class="c-form--label-checkbox" for="form-confirm"><?php _e('Noster apster lorem ipsum dolor sit amet, consectetur adipisicing elit?', 'biuro'); ?></label>
</div>
</div><!-- .c-form--row -->
</form>
......@@ -11,49 +11,25 @@
* @package Biuro_Contacts
* @subpackage Biuro_Contacts/public/partials
*/
?>
<form id="ContactFormEmployee_ContactFormEmployee" action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method="post" enctype="multipart/form-data" class="contact-form">
<ul class="form">
<li>
<label for="ContactFormEmployee_ContactFormEmployee_Name">Name (mandatory field):</label>
<input type="text" class="text holder-required <?php if ($response) { echo 'error'; } ?>" id="ContactFormEmployee_ContactFormEmployee_Name" name="Name" value="">
<?php if ($response) : ?>
<div id="errorname" class="errormessage">"Name (mandatory field):" is required.</div>
<?php endif; ?>
</li>
<li>
<label for="ContactFormEmployee_ContactFormEmployee_Email">E-mail (mandatory field):</label>
<input type="text" class="text holder-required <?php if ($response) { echo 'error'; } ?>" id="ContactFormEmployee_ContactFormEmployee_Email" name="Email" value="">
<?php if ($response) : ?>
<div id="erroremail" class="errormessage">"E-mail (mandatory field):" is required.</div>
<?php endif; ?>
</li>
<li>
<label for="ContactFormEmployee_ContactFormEmployee_Phone">Telephone number:</label>
<input type="text" class="text" id="ContactFormEmployee_ContactFormEmployee_Phone" name="Phone" value="">
</li>
<li>
<label for="ContactFormEmployee_ContactFormEmployee_Phone">City:</label>
<select id="ContactFormEmployee_ContactFormEmployee_City" name="City"><option selected="selected" value="">Choose the nearest city</option><option value="31">Vilnius</option><option value="32">Kaunas</option><option value="33">Klaipėda</option><option value="34">Šilutė</option><option value="35">Utena</option><option value="36">Panevėžys</option><option value="37">Šiauliai</option><option value="38">Plungė</option><option value="41">Marijampolė</option><option value="44">Ukmergė</option></select>
</li>
<li>
<label for="ContactFormEmployee_ContactFormEmployee_Comments">Your question (mandatory field):</label>
<textarea id="ContactFormEmployee_ContactFormEmployee_Comments" class="holder-required <?php if ($response) { echo 'error'; } ?>" name="Comments" rows="5" cols="20"></textarea>
<?php if ($response) : ?>
<div id="errorcomments" class="errormessage">"Your question (mandatory field):" is required.</div>
<?php endif; ?>
</li>
<li>
<label for="ContactFormEmployee_ContactFormEmployee_Cvfield">Curriculum vitae:</label>
<input type="file" name="Cvfield" id="ContactFormEmployee_ContactFormEmployee_Cvfield"><input type="hidden" name="MAX_FILE_SIZE" value="">
</li>
/**
* @link https://codex.wordpress.org/Creating_Options_Pages
* @link https://www.smashingmagazine.com/2016/04/three-approaches-to-adding-configurable-fields-to-your-plugin/
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) die;
?>
<li class="last">
<input class="action " id="ContactFormEmployee_ContactFormEmployee_action_SendContactForm" type="submit" name="action-submit" value="Send" title="Send" onclick="ga('send', 'event', 'ContactFormEmployee', 'Button', 'SendContactFormEmployee');">
</li>
<form action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" method="post" enctype="multipart/form-data" class="c-form c-form--employees">
</ul>
<?php
if ( !$_SESSION['employees--step'] ):
include_once('biuro-contacts-public--employees--step-1.php');
else:
include_once('biuro-contacts-public--employees--step-2.php');
endif;
?>
<input type="hidden" name="action" value="employees_post">
<?php wp_nonce_field('employees_post_nonce'); ?>
</form>
<?php
/**
* Provide a public-facing view for the plugin
*
* This file is used to markup the public-facing aspects of the plugin.
*
* @link https://www.biuro.lt
* @since 1.0.0
*
* @package Biuro_Contacts
* @subpackage Biuro_Contacts/public/partials
*/
/**
* @link https://codex.wordpress.org/Creating_Options_Pages
* @link https://www.smashingmagazine.com/2016/04/three-approaches-to-adding-configurable-fields-to-your-plugin/
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) die;
?>
<?php
$nameValue = $_SESSION['employers--name-value'];
$nameStatus = $_SESSION['employers--name-status'];
$nameMessage = $_SESSION['employers--name-message'];
?>
<div class="c-form--row">
<label class="c-form--label" for="form-name"><?php _e('Name, surname', 'biuro'); ?></label>
<div class="c-form--input-wrap <?php if ($nameStatus) { echo "c-form--input-wrap--$nameStatus"; } ?>">
<input type="text" class="c-form--input" id="form-name" name="name" value="<?php echo $nameValue; ?>" <?php if ($nameStatus == 'error'): ?> autofocus="autofocus" <?php endif; ?>>
</div>
<?php if ($nameMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $nameStatus; ?>">
<?php echo $nameMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<?php
$phoneValue = $_SESSION['employers--phone-value'];
$phoneStatus = $_SESSION['employers--phone-status'];
$phoneMessage = $_SESSION['employers--phone-message'];
?>
<div class="c-form--row">
<label class="c-form--label" for="form-phone"><?php _e('Phone no.', 'biuro'); ?></label>
<div class="c-form--input-wrap <?php if ($phoneStatus) { echo "c-form--input-wrap--$phoneStatus"; } ?>">
<input type="tel" class="c-form--input" id="form-phone" name="phone" value="<?php echo $phoneValue; ?>" <?php if ($nameStatus != 'error' && $phoneStatus == 'error'): ?> autofocus="autofocus" <?php endif; ?>>
</div>
<?php if ($phoneMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $phoneStatus; ?>">
<?php echo $phoneMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<?php
$emailValue = $_SESSION['employers--email-value'];
$emailStatus = $_SESSION['employers--email-status'];
$emailMessage = $_SESSION['employers--email-message'];
?>
<div class="c-form--row">
<label class="c-form--label" for="form-email"><?php _e('Email address', 'biuro'); ?></label>
<div class="c-form--input-wrap <?php if ($emailStatus) { echo "c-form--input-wrap--$emailStatus"; } ?>">
<input type="email" class="c-form--input" id="form-email" name="email" value="<?php echo $emailValue; ?>">
</div>
<?php if ($emailMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $emailStatus; ?>">
<?php echo $emailMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<div class="c-form--row">
<div class="c-form--submit-wrap">
<button type="submit" class="o-btn c-btn--main c-btn--fill" name="submit" value="1"><?php _e('Submit', 'biuro'); ?></button>
</div>
</div><!-- .c-form--row -->
<?php
$agreeValue = $_SESSION['employers--agree-value'];
$agreeStatus = $_SESSION['employers--agree-status'];
$agreeMessage = $_SESSION['employers--agree-message'];
?>
<div class="c-form--row">
<div class="c-form--checkbox-wrap">
<input id="form-agree" type="checkbox" class="c-form--checkbox <?php if ($agreeStatus) { echo "c-form--checkbox--$agreeStatus"; } ?>" name="agree" value="1" <?php if ($agreeValue): ?> checked="checked"<?php endif; ?>>
<label class="c-form--label-checkbox" for="form-agree"><?php _e('Rem possimus, delectus unde enim dolores doloribus, recusandae a veritatis ducimus repudiandae iste eos voluptatum architecto mollitia?', 'biuro'); ?></label>
</div>
<?php if ($agreeMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $agreeStatus; ?>">
<?php echo $agreeMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<?php
/**
* Provide a public-facing view for the plugin
*
* This file is used to markup the public-facing aspects of the plugin.
*
* @link https://www.biuro.lt
* @since 1.0.0
*
* @package Biuro_Contacts
* @subpackage Biuro_Contacts/public/partials
*/
/**
* @link https://codex.wordpress.org/Creating_Options_Pages
* @link https://www.smashingmagazine.com/2016/04/three-approaches-to-adding-configurable-fields-to-your-plugin/
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) die;
?>
<div class="c-form--row">
<label class="c-form--label" for="form-city"><?php _e('City', 'biuro'); ?></label>
<div class="c-form--input-wrap">
<input type="text" class="c-form--input" id="form-city" name="city" value="">
</div>
</div><!-- .c-form--row -->
<div class="c-form--row">
<label class="c-form--label" for="form-message"><?php _e('Message', 'biuro'); ?></label>
<div class="c-form--textarea-wrap">
<textarea name="message" id="form-message" cols="30" rows="3" class="c-form--textarea"></textarea>
</div>
</div><!-- .c-form--row -->
<?php /*
<div class="c-form--row">
<label class="c-form--label" for="form-cv"><?php _e('CV', 'biuro'); ?></label>
<div class="c-form--input-wrap">
<input type="file" class="c-form--input" id="form-cv" name="cv" value="">
</div>
</div><!-- .c-form--row -->
*/ ?>
<div class="c-form--row">
<div class="c-form--submit-wrap">
<button type="submit" class="o-btn c-btn--main c-btn--fill" name="submit" value="2"><?php _e('Submit', 'biuro'); ?></button>
</div>
</div><!-- .c-form--row -->
<div class="c-form--row">
<div class="c-form--checkbox-wrap">
<input id="form-confirm" type="checkbox" class="c-form--checkbox" name="confirm" value="1">
<label class="c-form--label-checkbox" for="form-confirm"><?php _e('Noster apster lorem ipsum dolor sit amet, consectetur adipisicing elit?', 'biuro'); ?></label>
</div>
</div><!-- .c-form--row -->
......@@ -11,50 +11,25 @@
* @package Biuro_Contacts
* @subpackage Biuro_Contacts/public/partials
*/
?>
<form id="ContactForm_ContactForm" action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method="post" enctype="application/x-www-form-urlencoded" class="contact-form">
<p id="ContactForm_ContactForm_error" class="message " style="display: none"></p>
/**
* @link https://codex.wordpress.org/Creating_Options_Pages
* @link https://www.smashingmagazine.com/2016/04/three-approaches-to-adding-configurable-fields-to-your-plugin/
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) die;
?>
<ul class="form">
<li>
<label for="ContactForm_ContactForm_Company">Company (mandatory field):</label>
<input type="text" class="text holder-required <?php if ($response) { echo 'error'; } ?>" id="ContactForm_ContactForm_Company" name="Company" value="">
<?php if ($response) : ?>
<div id="errorcompany" class="errormessage">"Company (mandatory field):" is required.</div>
<?php endif; ?>
</li>
<li>
<label for="ContactForm_ContactForm_Name">Name (mandatory field):</label>
<input type="text" class="text holder-required <?php if ($response) { echo 'error'; } ?>" id="ContactForm_ContactForm_Name" name="Name" value="">
<?php if ($response) : ?>
<div id="errorname" class="errormessage">"Name (mandatory field):" is required.</div>
<?php endif; ?>
</li>
<li>
<label for="ContactForm_ContactForm_Email">E-mail (mandatory field):</label>
<input type="text" class="text holder-required <?php if ($response) { echo 'error'; } ?>" id="ContactForm_ContactForm_Email" name="Email" value="">
<?php if ($response) : ?>
<div id="erroremail" class="errormessage">"E-mail (mandatory field):" is required.</div>
<?php endif; ?>
</li>
<li>
<label for="ContactForm_ContactForm_Phone">Telephone number:</label>
<input type="text" class="text" id="ContactForm_ContactForm_Phone" name="Phone" value="">
</li>
<li>
<label for="ContactForm_ContactForm_Comments">Your question (mandatory field):</label>
<textarea id="ContactForm_ContactForm_Comments" class="holder-required <?php if ($response) { echo 'error'; } ?>" name="Comments" rows="5" cols="20"></textarea>
<?php if ($response) : ?>
<div id="errorcomments" class="errormessage">"Your question (mandatory field):" is required.</div>
<?php endif; ?>
</li>
<li class="last">
<input class="action " id="ContactForm_ContactForm_action_SendContactForm" type="submit" name="action-submit" value="Send" title="Send" onclick="ga('send', 'event', 'ContactForm', 'Button', 'SendContactForm');">
</li>
<form action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" method="post" enctype="multipart/form-data" class="c-form c-form--employers">
</ul>
<?php
if ( !$_SESSION['employers--step'] ):
include_once('biuro-contacts-public--employers--step-1.php');
else:
include_once('biuro-contacts-public--employers--step-2.php');
endif;
?>
<input type="hidden" name="action" value="employers_post">
<?php wp_nonce_field('employers_post_nonce'); ?>
</form>
<?php
/**
* Provide a public-facing view for the plugin
*
* This file is used to markup the public-facing aspects of the plugin.
*
* @link https://www.biuro.lt
* @since 1.0.0
*
* @package Biuro_Contacts
* @subpackage Biuro_Contacts/public/partials
*/
/**
* @link https://codex.wordpress.org/Creating_Options_Pages
* @link https://www.smashingmagazine.com/2016/04/three-approaches-to-adding-configurable-fields-to-your-plugin/
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) die;
?>
<div class="c-form--row">
<button type="submit" class="o-btn c-btn--main c-btn--fill" name="submit" value="1"><?php _e('Candidate', 'biuro'); ?></button>
</div><!-- .c-form--row -->
<?php
/**
* Provide a public-facing view for the plugin
*
* This file is used to markup the public-facing aspects of the plugin.
*
* @link https://www.biuro.lt
* @since 1.0.0
*
* @package Biuro_Contacts
* @subpackage Biuro_Contacts/public/partials
*/
/**
* @link https://codex.wordpress.org/Creating_Options_Pages
* @link https://www.smashingmagazine.com/2016/04/three-approaches-to-adding-configurable-fields-to-your-plugin/
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) die;
?>
<?php
$nameValue = $_SESSION['position--name-value'];
$nameStatus = $_SESSION['position--name-status'];
$nameMessage = $_SESSION['position--name-message'];
?>
<div class="c-form--row">
<label class="c-form--label" for="form-name"><?php _e('Name, surname', 'biuro'); ?></label>
<div class="c-form--input-wrap <?php if ($nameStatus) { echo "c-form--input-wrap--$nameStatus"; } ?>">
<input type="text" class="c-form--input" id="form-name" name="name" value="<?php echo $nameValue; ?>" <?php if ($nameStatus == 'error'): ?> autofocus="autofocus" <?php endif; ?>>
</div>
<?php if ($nameMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $nameStatus; ?>">
<?php echo $nameMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<?php
$phoneValue = $_SESSION['position--phone-value'];
$phoneStatus = $_SESSION['position--phone-status'];
$phoneMessage = $_SESSION['position--phone-message'];
?>
<div class="c-form--row">
<label class="c-form--label" for="form-phone"><?php _e('Phone no.', 'biuro'); ?></label>
<div class="c-form--input-wrap <?php if ($phoneStatus) { echo "c-form--input-wrap--$phoneStatus"; } ?>">
<input type="tel" class="c-form--input" id="form-phone" name="phone" value="<?php echo $phoneValue; ?>" <?php if ($nameStatus != 'error' && $phoneStatus == 'error'): ?> autofocus="autofocus" <?php endif; ?>>
</div>
<?php if ($phoneMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $phoneStatus; ?>">
<?php echo $phoneMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<?php
$emailValue = $_SESSION['position--email-value'];
$emailStatus = $_SESSION['position--email-status'];
$emailMessage = $_SESSION['position--email-message'];
?>
<div class="c-form--row">
<label class="c-form--label" for="form-email"><?php _e('Email address', 'biuro'); ?></label>
<div class="c-form--input-wrap <?php if ($emailStatus) { echo "c-form--input-wrap--$emailStatus"; } ?>">
<input type="email" class="c-form--input" id="form-email" name="email" value="<?php echo $emailValue; ?>">
</div>
<?php if ($emailMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $emailStatus; ?>">
<?php echo $emailMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<div class="c-form--row">
<label class="c-form--label" for="form-city"><?php _e('City', 'biuro'); ?></label>
<div class="c-form--input-wrap">
<input type="text" class="c-form--input" id="form-city" name="city" value="">
</div>
</div><!-- .c-form--row -->
<div class="c-form--row">
<label class="c-form--label" for="form-message"><?php _e('Message', 'biuro'); ?></label>
<div class="c-form--textarea-wrap">
<textarea name="message" id="form-message" cols="30" rows="3" class="c-form--textarea"></textarea>
</div>
</div><!-- .c-form--row -->
<div class="c-form--row">
<label class="c-form--label" for="form-cv"><?php _e('CV', 'biuro'); ?></label>
<div class="c-form--input-wrap">
<input type="file" class="c-form--input" id="form-cv" name="cv" value="">
</div>
</div><!-- .c-form--row -->
<?php
$agreeValue = $_SESSION['position--agree-value'];
$agreeStatus = $_SESSION['position--agree-status'];
$agreeMessage = $_SESSION['position--agree-message'];
?>
<div class="c-form--row">
<div class="c-form--checkbox-wrap">
<input id="form-agree" type="checkbox" class="c-form--checkbox <?php if ($agreeStatus) { echo "c-form--checkbox--$agreeStatus"; } ?>" name="agree" value="1" <?php if ($agreeValue): ?> checked="checked"<?php endif; ?>>
<label class="c-form--label-checkbox" for="form-agree"><?php _e('Rem possimus, delectus unde enim dolores doloribus, recusandae a veritatis ducimus repudiandae iste eos voluptatum architecto mollitia?', 'biuro'); ?></label>
</div>
<?php if ($agreeMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $agreeStatus; ?>">
<?php echo $agreeMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<div class="c-form--row">
<div class="c-form--checkbox-wrap">
<input id="form-confirm" type="checkbox" class="c-form--checkbox" name="confirm" value="1">
<label class="c-form--label-checkbox" for="form-confirm"><?php _e('Noster apster lorem ipsum dolor sit amet, consectetur adipisicing elit?', 'biuro'); ?></label>
</div>
</div><!-- .c-form--row -->
<div class="c-form--row">
<div class="c-form--submit-wrap">
<button type="submit" class="o-btn c-btn--main c-btn--fill" name="submit" value="2"><?php _e('Candidate', 'biuro'); ?></button>
</div>
</div><!-- .c-form--row -->
......@@ -11,40 +11,26 @@
* @package Biuro_Contacts
* @subpackage Biuro_Contacts/public/partials
*/
/**
* @link https://codex.wordpress.org/Creating_Options_Pages
* @link https://www.smashingmagazine.com/2016/04/three-approaches-to-adding-configurable-fields-to-your-plugin/
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) die;
?>
<form id="CVForm_CVForm" action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method="post" enctype="multipart/form-data" class="contact-form">
<ul class="form">
<li>
<label for="CVForm_CVForm_Name">Name, Surname (mandatory field):</label>
<input type="text" class="text holder-required <?php if ($response) { echo 'error'; } ?>" id="CVForm_CVForm_Name" name="Name" value="">
<?php if ($response) : ?>
<div id="errorname" class="errormessage">"Name, Surname (mandatory field):" is required.</div>
<?php endif; ?>
</li>
<li>
<label for="CVForm_CVForm_Email">E-mail (mandatory field): </label>
<input type="text" class="text holder-required <?php if ($response) { echo 'error'; } ?>" id="CVForm_CVForm_Email" name="Email" value="">
<?php if ($response) : ?>
<div id="erroremail" class="errormessage">"E-mail (mandatory field): " is required.</div>
<?php endif; ?>
</li>
<li>
<label for="CVForm_CVForm_Phone">Telephone number:</label>
<input type="text" class="text" id="CVForm_CVForm_Phone" name="Phone" value="">
</li>
<li>
<label for="CVForm_CVForm_Cvfield">Curriculum vitae:</label>
<input type="file" name="Cvfield" id="CVForm_CVForm_Cvfield"><input type="hidden" name="MAX_FILE_SIZE" value="">
</li>
<li>
<label for="CVForm_CVForm_Additional">Other:</label>
<textarea id="CVForm_CVForm_Additional" name="Additional" rows="5" cols="20"></textarea>
</li>
<li class="last">
<input class="action " id="CVForm_CVForm_action_SendCVForm" type="submit" name="action-submit" value="Send" title="Send" onclick="ga('send', 'event', 'CVForm', 'Button', 'SendCVForm');">
</li>
</ul>
<input class="hidden" type="hidden" id="CVForm_CVForm_offerid" name="offerid" value="14675">
<form action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" method="post" enctype="multipart/form-data" class="c-form c-form--position">
<?php
if ( !$_SESSION['position--step'] ):
include_once('biuro-contacts-public--position--step-1.php');
else:
include_once('biuro-contacts-public--position--step-2.php');
endif;
?>
<input type="hidden" name="job_id" value="<?php echo $job_id; ?>">
<input type="hidden" name="action" value="position_post">
<?php wp_nonce_field('position_post_nonce'); ?>
</form>
......@@ -24,6 +24,7 @@ class Biuro_Feedbacks extends WP_Widget {
public function form( $instance ) {
// Set widget defaults
$defaults = array(
'title' => '',
'name1' => '',
'img1' => '',
'feedback1' => '',
......@@ -54,16 +55,20 @@ class Biuro_Feedbacks extends WP_Widget {
// Parse current settings with defaults
extract( wp_parse_args( ( array ) $instance, $defaults ) ); ?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title', 'biuro' ); ?><?php echo ' ' . $i . ':'; ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( ${'title'} ); ?>" />
</p>
<?php
for ($i = 1; $i <= 8; $i++):
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'name' . $i ) ); ?>"><?php _e( 'Name', 'biuro' ); ?><?php echo ' ' . $i . ':'; ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'name' . $i ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'name' . $i ) ); ?>" type="text" name="<?php echo esc_attr( ${'name' . $i} ); ?>" />
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'name' . $i ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'name' . $i ) ); ?>" type="text" value="<?php echo esc_attr( ${'name' . $i} ); ?>" />
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'img' . $i ) ); ?>"><?php _e( 'Image', 'biuro' ); ?><?php echo ' ' . $i . ':'; ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'img' . $i ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'img' . $i ) ); ?>" type="text" name="<?php echo esc_attr( ${'img' . $i} ); ?>" />
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'img' . $i ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'img' . $i ) ); ?>" type="text" value="<?php echo esc_attr( ${'img' . $i} ); ?>" />
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'feedback' . $i ) ); ?>"><?php _e( 'Feedback', 'biuro' ); ?><?php echo ' ' . $i . ':'; ?></label>
......@@ -79,6 +84,8 @@ class Biuro_Feedbacks extends WP_Widget {
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = isset( $new_instance['title'] ) ? wp_strip_all_tags( $new_instance['title'] ) : '';
for ($i = 1; $i <= 8; $i++):
$instance['name' . $i] = isset( $new_instance['name' . $i] ) ? wp_strip_all_tags( $new_instance['name' . $i] ) : '';
$instance['img' . $i] = isset( $new_instance['img' . $i] ) ? wp_strip_all_tags( $new_instance['img' . $i] ) : '';
......@@ -92,6 +99,8 @@ class Biuro_Feedbacks extends WP_Widget {
public function widget( $args, $instance ) {
extract( $args );
$title = isset( $instance['title'] ) ?$instance['title'] : '';
for ($i = 1; $i <= 8; $i++):
${'name' . $i} = isset( $instance['name' . $i] ) ?$instance['name' . $i] : '';
${'img' . $i} = isset( $instance['img' . $i] ) ?$instance['img' . $i] : '';
......@@ -101,18 +110,45 @@ class Biuro_Feedbacks extends WP_Widget {
// WordPress core before_widget hook (always include )
echo $before_widget;
// Display the widget
echo '<div class="c-biuro-feedbacks">';
echo '<div class="c-feedbacks">';
if ( $title != "" ) {
echo '<h2 class="c-feedbacks--heading">' . $title . '</h2>';
}
echo '<div class="c-feedbacks--inner">';
echo '<div class="swiper-wrapper">';
for ($i = 1; $i <= 8; $i++):
if ( ${'name' . $i} ) {
echo '<h3>' . ${'name' . $i} . ${'img' . $i} . '</h3>';
if ( ${'name' . $i} != "" && ${'feedback' . $i} != ""):
echo '<div class="swiper-slide">';
echo '<div class="c-feedbacks--section">';
echo '<div class="c-feedbacks--section-inner">';
if ( ${'img' . $i} != "" ) {
echo '<img src="/wp-content/themes/biuro/i/feedbacks/' . ${'img' . $i} . '" class="c-feedbacks--img" width="85px" height="83px"/>';
}
if ( ${'feedback' . $i} ) {
echo '<p>' . ${'feedback' . $i} . '</p>';
if ( ${'feedback' . $i} != "" ) {
echo '<div class="c-feedbacks--feedback">' . ${'feedback' . $i} . '</div>';
}
if ( ${'name' . $i} != "" ) {
echo '<div class="c-feedbacks--name">' . ${'name' . $i} . '</div>';
}
echo '</div>';
echo '</div>';
echo '</div>';
endif;
endfor;
echo '</div>';
echo '<div class="swiper-pagination"></div>';
echo '</div>';
echo '</div>';
// WordPress core after_widget hook (always include )
echo $after_widget;
......
<?php
/*
Plugin Name: Biuro HTML
Description: Biuro Biuro HTML plugin
Author: Biuro
Version: 1.0
Author URI: https://www.biuro.lt/
*/
class Biuro_HTML extends WP_Widget {
// Main constructor
public function __construct() {
parent::__construct(
'biuro-html',
__( 'Biuro HTML | Biuro', 'biuro' ),
array(
'customize_selective_refresh' => true,
)
);
}
// The widget form (for the backend )
public function form( $instance ) {
// Set widget defaults
$defaults = array(
'title' => '',
'content' => '',
);
// Parse current settings with defaults
extract( wp_parse_args( ( array ) $instance, $defaults ) ); ?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title', 'biuro' ); ?><?php echo ' ' . $i . ':'; ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( ${'title'} ); ?>" />
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'content' ) ); ?>"><?php _e( 'Content:', 'biuro' ); ?></label>
<textarea class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'content' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'content' ) ); ?>" rows="12"><?php echo wp_kses_post( $content ); ?></textarea>
</p>
<?php }
// Update widget settings
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = isset( $new_instance['title'] ) ? wp_strip_all_tags( $new_instance['title'] ) : '';
$instance['content'] = isset( $new_instance['content'] ) ? wp_kses_post( $new_instance['content'] ) : '';
return $instance;
}
// Display the widget
public function widget( $args, $instance ) {
extract( $args );
// Check the widget options
$title = isset( $instance['title'] ) ?$instance['title'] : '';
$content = isset( $instance['content'] ) ?$instance['content'] : '';
// WordPress core before_widget hook (always include )
echo $before_widget;
if ( $title != "" ) {
echo '<h3>' . $title . '</h3>';
}
if ( $content != "" ) {
echo '<p>' . $content . '</p>';
}
// WordPress core after_widget hook (always include )
echo $after_widget;
}
}
// register Biuro_HTML
add_action( 'widgets_init', function(){
register_widget( 'Biuro_HTML' );
});
......@@ -24,36 +24,29 @@ class Biuro_Sections extends WP_Widget {
public function form( $instance ) {
// Set widget defaults
$defaults = array(
'title' => '',
'title1' => '',
'img1' => '',
'description1' => '',
'content1' => '',
'title2' => '',
'img2' => '',
'description2' => '',
'content2' => '',
'title3' => '',
'img3' => '',
'description3' => '',
'content3' => '',
'title4' => '',
'img4' => '',
'description4' => '',
'content4' => '',
'title5' => '',
'img5' => '',
'description5' => '',
'content5' => '',
'title6' => '',
'img6' => '',
'description6' => '',
'content6' => '',
'title7' => '',
'img7' => '',
'description7' => '',
'content7' => '',
'title8' => '',
'img8' => '',
'description8' => '',
'content8' => '',
);
......@@ -62,17 +55,18 @@ class Biuro_Sections extends WP_Widget {
// Parse current settings with defaults
extract( wp_parse_args( ( array ) $instance, $defaults ) ); ?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Heading', 'biuro' ); ?><?php echo ' ' . $i . ':'; ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( ${'title'} ); ?>" />
</p>
<?php
for ($i = 1; $i <= 8; $i++):
for ($i = 1; $i <= 6; $i++):
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' . $i ) ); ?>"><?php _e( 'Title', 'biuro' ); ?><?php echo ' ' . $i . ':'; ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' . $i ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' . $i ) ); ?>" type="text" value="<?php echo esc_attr( ${'title' . $i} ); ?>" />
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'img' . $i ) ); ?>"><?php _e( 'Image', 'biuro' ); ?><?php echo ' ' . $i . ':'; ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'img' . $i ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'img' . $i ) ); ?>" type="text" value="<?php echo esc_attr( ${'img' . $i} ); ?>" />
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'description' . $i ) ); ?>"><?php _e( 'Description', 'biuro' ); ?><?php echo ' ' . $i . ':'; ?></label>
<textarea class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'description' . $i ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'description' . $i ) ); ?>" rows="4"><?php echo wp_kses_post( ${'description' . $i} ); ?></textarea>
......@@ -93,9 +87,10 @@ class Biuro_Sections extends WP_Widget {
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
for ($i = 1; $i <= 8; $i++):
$instance['title'] = isset( $new_instance['title'] ) ? wp_strip_all_tags( $new_instance['title'] ) : '';
for ($i = 1; $i <= 6; $i++):
$instance['title' . $i] = isset( $new_instance['title' . $i] ) ? wp_strip_all_tags( $new_instance['title' . $i] ) : '';
$instance['img' . $i] = isset( $new_instance['img' . $i] ) ? wp_strip_all_tags( $new_instance['img' . $i] ) : '';
$instance['description' . $i] = isset( $new_instance['description' . $i] ) ? wp_kses_post( $new_instance['description' . $i] ) : '';
$instance['content' . $i] = isset( $new_instance['content' . $i] ) ? wp_kses_post( $new_instance['content' . $i] ) : '';
endfor;
......@@ -107,9 +102,10 @@ class Biuro_Sections extends WP_Widget {
public function widget( $args, $instance ) {
extract( $args );
for ($i = 1; $i <= 8; $i++):
$title = isset( $instance['title'] ) ?$instance['title'] : '';
for ($i = 1; $i <= 6; $i++):
${'title' . $i} = isset( $instance['title' . $i] ) ?$instance['title' . $i] : '';
${'img' . $i} = isset( $instance['img' . $i] ) ?$instance['img' . $i] : '';
${'description' . $i} = isset( $instance['description' . $i] ) ?$instance['description' . $i] : '';
${'content' . $i} = isset( $instance['content' . $i] ) ?$instance['content' . $i] : '';
endfor;
......@@ -117,19 +113,42 @@ class Biuro_Sections extends WP_Widget {
// WordPress core before_widget hook (always include )
echo $before_widget;
// Display the widget
echo '<div class="c-biuro-sections">';
echo '<div class="c-sections">';
if ( $title != "" ) {
echo '<h2 class="c-sections--heading">' . $title . '</h2>';
}
for ($i = 1; $i <= 8; $i++):
if ( ${'title' . $i} ) {
echo '<h3>' . ${'title' . $i} . ' (img: ' . ${'img' . $i} . ')</h3>';
echo '<div class="c-sections--inner">';
for ($i = 1; $i <= 6; $i++):
if ( ${'title' . $i} != "" && ${'description' . $i} != ""&& ${'content' . $i} != ""):
echo '<div class="c-sections--item">';
echo '<div class="c-sections--item-inner">';
if ( ${'title' . $i} != "" ) {
echo '<div class="c-sections--header"><div class="c-sections--ico"><svg width="56px" height="56px"><use xlink:href="#ico--section-' . $i . '"></use></svg></div>' . ${'title' . $i} . '</div>';
}
if ( ${'description' . $i} ) {
echo '<div>' . ${'description' . $i} . '</div>';
echo '<div class="c-sections--content">';
if ( ${'description' . $i} != "" ) {
echo '<div class="c-sections--description">' . ${'description' . $i} . '</div>';
}
if ( ${'content' . $i} ) {
echo '<div>' . ${'content' . $i} . '</div>';
if ( ${'content' . $i} != "" ) {
echo ${'content' . $i};
}
echo '</div>';
echo '<div class="js-toggle--sections c-sections--toggle">
<svg width="13px" height="8px" class="c-sections--toggle-down"><use xlink:href="#ico--down"></use></svg>
<svg width="13px" height="8px" class="c-sections--toggle-up"><use xlink:href="#ico--up"></use></svg>
</div>';
echo '</div>';
echo '</div>';
endif;
endfor;
echo '</div>';
echo '</div>';
......
......@@ -55,7 +55,7 @@ class Biuro_Services extends WP_Widget {
extract( wp_parse_args( ( array ) $instance, $defaults ) ); ?>
<?php
for ($i = 1; $i <= 8; $i++):
for ($i = 1; $i <= 3; $i++):
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' . $i ) ); ?>"><?php _e( 'Title', 'biuro' ); ?><?php echo ' ' . $i . ':'; ?></label>
......@@ -79,7 +79,7 @@ class Biuro_Services extends WP_Widget {
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
for ($i = 1; $i <= 8; $i++):
for ($i = 1; $i <= 3; $i++):
$instance['title' . $i] = isset( $new_instance['title' . $i] ) ? wp_strip_all_tags( $new_instance['title' . $i] ) : '';
$instance['position' . $i] = isset( $new_instance['position' . $i] ) ? wp_strip_all_tags( $new_instance['position' . $i] ) : '';
$instance['content' . $i] = isset( $new_instance['content' . $i] ) ? wp_kses_post( $new_instance['content' . $i] ) : '';
......@@ -92,7 +92,7 @@ class Biuro_Services extends WP_Widget {
public function widget( $args, $instance ) {
extract( $args );
for ($i = 1; $i <= 8; $i++):
for ($i = 1; $i <= 3; $i++):
${'title' . $i} = isset( $instance['title' . $i] ) ?$instance['title' . $i] : '';
${'position' . $i} = isset( $instance['position' . $i] ) ?$instance['position' . $i] : '';
${'content' . $i} = isset( $instance['content' . $i] ) ?$instance['content' . $i] : '';
......@@ -101,15 +101,34 @@ class Biuro_Services extends WP_Widget {
// WordPress core before_widget hook (always include )
echo $before_widget;
// Display the widget
echo '<div class="c-biuro-services">';
echo '<div class="c-services">';
for ($i = 1; $i <= 8; $i++):
if ( ${'title' . $i} ) {
echo '<h3>' . ${'title' . $i} . ${'position' . $i} . '</h3>';
for ($i = 1; $i <= 3; $i++):
if ( ${'title' . $i} != "" && ${'content' . $i} != ""):
echo '<div class="c-services--item">';
echo '<div class="c-services--item-inner">';
echo '<div class="c-services--ico"><svg width="56px" height="56px"><use xlink:href="#ico--service-' . $i . '"></use></svg></div>';
if ( ${'title' . $i} != "" ) {
echo '<p class="c-services--heading">' . ${'title' . $i} . '</p>';
}
if ( ${'content' . $i} ) {
echo '<p>' . ${'content' . $i} . '</p>';
if ( ${'position' . $i} != "" ) {
echo '<p class="c-services--sub-heading">' . ${'position' . $i} . '</p>';
}
if ( ${'content' . $i} != "" ) {
echo '<div class="c-services--content">' . ${'content' . $i} . '</div>';
}
echo '<div class="js-toggle--services c-services--toggle">
<svg width="13px" height="8px" class="c-services--toggle-down"><use xlink:href="#ico--down"></use></svg>
<svg width="13px" height="8px" class="c-services--toggle-up"><use xlink:href="#ico--up"></use></svg>
</div>';
echo '</div>';
echo '</div>';
endif;
endfor;
echo '</div>';
......
......@@ -47,7 +47,7 @@ class Biuro_Values extends WP_Widget {
extract( wp_parse_args( ( array ) $instance, $defaults ) ); ?>
<?php
for ($i = 1; $i <= 8; $i++):
for ($i = 1; $i <= 4; $i++):
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'value' . $i ) ); ?>"><?php _e( 'Value', 'biuro' ); ?><?php echo ' ' . $i . ':'; ?></label>
......@@ -67,7 +67,7 @@ class Biuro_Values extends WP_Widget {
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
for ($i = 1; $i <= 8; $i++):
for ($i = 1; $i <= 4; $i++):
$instance['value' . $i] = isset( $new_instance['value' . $i] ) ? wp_strip_all_tags( $new_instance['value' . $i] ) : '';
$instance['content' . $i] = isset( $new_instance['content' . $i] ) ? wp_kses_post( $new_instance['content' . $i] ) : '';
endfor;
......@@ -79,26 +79,35 @@ class Biuro_Values extends WP_Widget {
public function widget( $args, $instance ) {
extract( $args );
for ($i = 1; $i <= 8; $i++):
for ($i = 1; $i <= 4; $i++):
${'value' . $i} = isset( $instance['value' . $i] ) ?$instance['value' . $i] : '';
${'content' . $i} = isset( $instance['content' . $i] ) ?$instance['content' . $i] : '';
endfor;
// WordPress core before_widget hook (always include )
echo $before_widget;
// Display the widget
echo '<div class="c-biuro-values">';
for ($i = 1; $i <= 8; $i++):
if ( ${'value' . $i} ) {
echo '<h3>' . ${'value' . $i} . '</h3>';
echo '<div class="c-values">';
echo '<div class="c-values--inner">';
for ($i = 1; $i <= 4; $i++):
if ( ${'value' . $i} != "" && ${'content' . $i} != ""):
echo '<div class="c-values--section">';
if ( ${'value' . $i} != "" ) {
echo '<h3 class="c-values--heading">' . ${'value' . $i} . '</h3>';
}
if ( ${'content' . $i} ) {
echo '<p>' . ${'content' . $i} . '</p>';
if ( ${'content' . $i} != "" ) {
echo '<div class="c-values--content">' . ${'content' . $i} . '</div>';
}
echo '</div>';
endif;
endfor;
echo '</div>';
echo '</div>';
// WordPress core after_widget hook (always include )
echo $after_widget;
......
......@@ -79,17 +79,18 @@ class Cookies_Warning extends WP_Widget {
if ( $content ) {
echo $content;
}
echo '<br >';
echo '<p class="c-cookies-warning--actions">';
// Display agree button
if ( $agree ) {
echo '<button id="cookie-agree" class="bu-action bu-action--main" type="button" title="' . $agree . '">' . $agree . '</button>';
echo '<button id="cookie-agree" class="o-btn c-btn--main" type="button" title="' . $agree . '">' . $agree . '</button>';
}
// Display close button
if ( $close ) {
echo '<button id="cookie-close" class="bu-action bu-action--alt" type="button" title="' . $close . '">' . $close . '</button>';
echo '<button id="cookie-close" class="o-btn c-btn--slim" type="button" title="' . $close . '">' . $close . '</button>';
}
echo '</p>';
echo '</div>';
......
......@@ -110,6 +110,7 @@ class JobsImporter
$podId = $pod->save($adData);
// Set post language
$this->setPostLang($podId, $ad['lang']);
print_r("Job ID: <b>$podId</b> <br>");
print_r("Old record ($this->primaryKey: $primaryKey) has been updated. <br>");
} catch (Exception $e) {
......@@ -132,11 +133,35 @@ class JobsImporter
}
}
// Set primary properties
if (is_plugin_active('wordpress-seo/wp-seo.php')) {
foreach ($this->primaryTerms as $term => $termKey) {
update_post_meta($podId, "_yoast_wpseo_primary_{$term}", $termKey);
}
}
$this->addSeoProperties($ad, $podId);
}
}
/**
* Add SEO properties for ad
* @uses Yoast SEO plugin
*
* @param $ad
* @param $postId
*/
private function addSeoProperties($ad, $postId)
{
if (is_plugin_active('wordpress-seo/wp-seo.php')) {
foreach ($ad['seo_properties'] as $key => $item) {
update_post_meta($postId, '_yoast_wpseo_' . $key, $item);
}
}
}
/**
......@@ -389,4 +414,25 @@ class JobsImporter
}
private function add_to_yoast_seo($post_id, $metatitle, $metadesc, $metakeywords){
$ret = false;
// Include plugin library to check if Yoast Seo is presently active
include_once( ABSPATH.'panel/includes/plugin.php' );
if(is_plugin_active('wordpress-seo/wp-seo.php')) {
//plugin is activated
$updated_title = update_post_meta($post_id, '_yoast_wpseo_title', $metatitle);
$updated_desc = update_post_meta($post_id, '_yoast_wpseo_metadesc', $metadesc);
$updated_kw = update_post_meta($post_id, '_yoast_wpseo_metakeywords', $metakeywords);
if($updated_title && $updated_desc && $updated_kw){
$ret = true;
}
}
return $ret;
}
}
......@@ -49,6 +49,10 @@ class JsonDataCollector
],
];
protected $seoProperties = [
'metadesc' => 'seo_description'
];
// Custom posts data map
protected $posts = [
'division' => [
......@@ -130,6 +134,7 @@ class JsonDataCollector
$item['terms'] = $this->getTerms($ad);
$item['posts'] = $this->getPosts($ad);
$item['relations'] = $this->relationsMap;
$item['seo_properties'] = $this->getSeoProperties($ad);
$result[] = $item;
};
......@@ -151,6 +156,20 @@ class JsonDataCollector
return $result;
}
private function getSeoProperties($ad)
{
$result = [];
foreach ($this->seoProperties as $propertyKey => $propertyValue) {
if (isset($ad->{$propertyValue})) {
$dataValue = $ad->{$propertyValue};
}
$result[$propertyKey] = $this->getValue($dataValue);
}
return $result;
}
private function getTerms($ad)
{
$result = [];
......@@ -171,7 +190,7 @@ class JsonDataCollector
foreach ($appends as $propertyKey => $propertyValues) {
if (isset($ad->{$propertyKey})) {
if (isset($ad->{$propertyKey}) && !empty($ad->{$propertyKey})) {
foreach ($ad->{$propertyKey} as $data) {
$result[$termKey][] = $this->getEntity($data, $propertyValues);
}
......
......@@ -38,23 +38,8 @@ function importer_admin_menu()
*/
function do_import()
{
// Set environment type
$env = 'prod';
//Set dev env. only on dev subdomain
$subDomain = strstr($_SERVER['SERVER_NAME'], '.biuro.lt', true);
if ($subDomain == 'dev') {
$env = 'dev';
}
// Set data source path by environment type
if ($env === 'dev') {
// $inputFile = plugin_dir_path(__FILE__) . "source_data/wp_biuro.php.xml";
$inputFile = "https://base.biuro.lt/_export/wp_biuro.php";
$inputFile = "https://base.biuro.lt/_export/new_wp.php";
} elseif ($env === 'prod') {
$inputFile = "http://export.biuro.lt/wp_biuro.php";
}
$env = getEnvironment();
$inputFile = getSource($env);
print_r("<div style='background: lightgrey;'>
<small style='float: right;'>Working in <strong>$env</strong> mode</small>
......@@ -106,6 +91,51 @@ function do_import()
}
function getSource($env)
{
$url = parse_url(site_url());
$exploded = explode('.', $url['host']);
$site = strtoupper(end($exploded));
switch ($site) {
case 'LT':
$script = 'new_wp.php';
break;
case 'LV':
$script = 'new_wp_lv.php';
break;
case 'EE':
$script = 'new_wp_ee.php';
break;
}
// Set data source path by environment type
if ($env === 'dev') {
// $inputFile = plugin_dir_path(__FILE__) . "source_data/wp_biuro.php.xml";
// $inputFile = "https://base.biuro.lt/_export/wp_biuro.php";
$inputFile = "https://base.biuro.lt/_export/{$script}";
} elseif ($env === 'prod') {
// $inputFile = "http://export.biuro.lt/wp_biuro.php";
$inputFile = "http://export.biuro.lt/{$script}";
}
return $inputFile;
}
function getEnvironment()
{
// Set environment type
$env = 'prod';
//Set dev env. only on dev subdomain
$subDomain = strstr($_SERVER['SERVER_NAME'], '.biuro', true);
if ($subDomain == 'dev') {
$env = 'dev';
}
return $env;
}
function current_location()
{
if (isset($_SERVER['HTTPS']) &&
......
......@@ -3,8 +3,14 @@
/* critical:start */
:root {
--color--gray: #4d4d4d;
--color--green: #006957;
--color--gray: #7e8683;
--color--gray-darker: #2A3644;
--color--green: #1fb299;
--color--green-darker: #149a83;
--color--green-dark: #006957;
--color--blue-dark: #1d2a3a;
--color--gray-light: #f8f8f8;
}
/* critical:end */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment