Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dev.biuro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Biuro
dev.biuro
Commits
e6ea63ab
Commit
e6ea63ab
authored
Sep 05, 2019
by
Simonas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
in progress
parent
20e25b36
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
256 additions
and
3 deletions
+256
-3
biuro-contacts.php
wp-content/plugins/biuro-contacts/biuro-contacts.php
+2
-2
class-biuro-contacts-activator.php
...iuro-contacts/includes/class-biuro-contacts-activator.php
+40
-0
class-biuro-contacts.php
.../plugins/biuro-contacts/includes/class-biuro-contacts.php
+1
-0
class-biuro-contacts-public.php
...ins/biuro-contacts/public/class-biuro-contacts-public.php
+21
-1
biuro-contacts-public--recommend.php
...acts/public/partials/biuro-contacts-public--recommend.php
+120
-0
page-recommend-friend.php
wp-content/themes/biuro/page-recommend-friend.php
+72
-0
No files found.
wp-content/plugins/biuro-contacts/biuro-contacts.php
View file @
e6ea63ab
...
...
@@ -16,7 +16,7 @@
* Plugin Name: Biuro Contacts
* Plugin URI: https://www.biuro.lt
* Description: This is a short description of what the plugin does. It's displayed in the WordPress admin area.
* Version:
1
.0.0
* Version:
2
.0.0
* Author: Biuro
* Author URI: https://www.biuro.lt
* License: GPL-2.0+
...
...
@@ -35,7 +35,7 @@ if ( ! defined( 'WPINC' ) ) {
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define
(
'BIURO_CONTACTS_VERSION'
,
'
1
.0.0'
);
define
(
'BIURO_CONTACTS_VERSION'
,
'
2
.0.0'
);
/**
* The code that runs during plugin activation.
...
...
wp-content/plugins/biuro-contacts/includes/class-biuro-contacts-activator.php
View file @
e6ea63ab
...
...
@@ -39,6 +39,7 @@ class Biuro_Contacts_Activator {
switch_to_blog
(
$blog_id
);
self
::
create_db_employees
();
self
::
create_db_employers
();
self
::
create_db_recommend
();
restore_current_blog
();
}
}
else
{
...
...
@@ -125,6 +126,45 @@ class Biuro_Contacts_Activator {
}
}
public
static
function
create_db_recommend
()
{
global
$wpdb
;
$table_name
=
$wpdb
->
prefix
.
"biuro_recommend"
;
$version
=
get_option
(
'biuro-recommend_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,
recommended_name tinytext,
recommended_email varchar(128) DEFAULT '',
recommended_phone varchar(128) DEFAULT '',
recommended_city varchar(255) DEFAULT null,
recommended_city_id int DEFAULT null,
confirm tinyint DEFAULT 0,
referer text DEFAULT null,
request text 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-recommend_db_version'
,
$plugin_name_db_version
);
}
}
}
wp-content/plugins/biuro-contacts/includes/class-biuro-contacts.php
View file @
e6ea63ab
...
...
@@ -193,6 +193,7 @@ class Biuro_Contacts {
$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
);
$this
->
loader
->
add_shortcode
(
"biuro-contacts--recommend"
,
$plugin_public
,
"recommend_form"
,
$priority
=
10
,
$accepted_args
=
2
);
}
/**
...
...
wp-content/plugins/biuro-contacts/public/class-biuro-contacts-public.php
View file @
e6ea63ab
...
...
@@ -44,12 +44,14 @@ class Biuro_Contacts_Public {
'employees'
=>
[
'name'
,
'phone'
,
'email'
],
'employers'
=>
[
'name'
,
'phone'
,
'email'
],
'position'
=>
[
'name'
,
'phone'
,
'email'
,
'city'
,
'city_id'
,
'message'
,
'confirm'
,
'job_id'
,
'cv'
],
'recommend'
=>
[
'name'
,
'phone'
,
'email'
,
'city'
],
];
const
DB_NAMES
=
[
'employees'
=>
[
'name'
,
'phone'
,
'email'
],
'employers'
=>
[
'name'
,
'phone'
,
'email'
],
'position'
=>
[
'name'
,
'phone'
,
'email'
,
'city'
,
'city_id'
,
'message'
,
'confirm'
,
'job_id'
]
'position'
=>
[
'name'
,
'phone'
,
'email'
,
'city'
,
'city_id'
,
'message'
,
'confirm'
,
'job_id'
],
'recommend'
=>
[
'name'
,
'phone'
,
'email'
,
'city'
],
];
const
BIURO_INSIGHTLY
=
[
...
...
@@ -946,6 +948,24 @@ class Biuro_Contacts_Public {
exit
;
}
public
function
recommend_form
(
$attr
=
array
()
)
{
ob_start
();
include_once
(
'partials/biuro-contacts-public--recommend.php'
);
unset
(
$_SESSION
[
'recommend--step'
]);
$output
=
ob_get_contents
();
ob_end_clean
();
static
::
delete_sessions
(
'recommend'
);
return
$output
;
}
// position_form()
/**
* @method getContacts
* get contacts data from DB for API endpoint "contacts" endpoint;
...
...
wp-content/plugins/biuro-contacts/public/partials/biuro-contacts-public--recommend.php
0 → 100644
View file @
e6ea63ab
<?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 2.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
;
?>
<form
name=
"form-recommend"
action=
"
<?php
echo
esc_url
(
admin_url
(
'admin-post.php'
)
);
?>
"
method=
"post"
enctype=
"multipart/form-data"
class=
"c-form c-form--recommend"
>
<div
id=
"action"
class=
"c-form--action"
></div>
Recommend friend
</form>
<?php
/*
<?php if (isset($_SESSION['employers--s']) && $_SESSION['employers--s'] == 1) : ?>
<div class="c-form--success">
<?php _e('Thank You for contacting!', 'biuro-contacts'); ?>
<br>
<?php _e('You request was send successfully, we will contact You.', 'biuro-contacts'); ?>
</div>
<?php endif; ?>
<?php
if ( isset($_SESSION['employers--captcha-status']) && $_SESSION['employers--captcha-status'] == 'error' ):
?>
<div class="c-form--validation-static c-form--validation-error">
<?php _e('Sorry, something went wrong. Please try again', 'biuro-contacts'); ?>
</div>
<?php
unset($_SESSION['employers--captcha-status']);
endif;
?>
<?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'); ?>
<input type="hidden" id="g-recaptcha-response" name="captcha">
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCaptcha&render=6Lc76qoUAAAAALk0aYR500zOZVG1BicNl3GTb-Hu" async defer></script>
<script>
function onloadCaptcha () {
window.grecaptcha.ready(function () {
execCaptcha();
setInterval(execCaptcha, 90000);
});
}
function execCaptcha () {
var no = Math.floor(Math.random() * 999999) + 100000;
window.grecaptcha.execute('6Lc76qoUAAAAALk0aYR500zOZVG1BicNl3GTb-Hu', { action: 'employers/' + no }).then(function (token) {
if (document.getElementById('g-recaptcha-response')) {
document.getElementById('g-recaptcha-response').value = token;
}
});
}
</script>
</form>
<?php if($_SESSION['employers--s'] == 1) {
?>
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ event: 'b2b_form_submit_success_validated' });
</script>
<?php
unset($_SESSION['employers--s']);
}?>
<?php if($_SESSION['employers--s'] == 2) {
?>
<div class="c-modal">
<div class="c-modal--inner">
<svg width="67px" height="67px">
<use xlink:href="#ico--success"></use>
</svg>
<p><?php _e('Thank You! The information has been successfully supplemented.', 'biuro-contacts'); ?></p>
<p><button class="js-modal--close o-btn c-btn--main"><?php _e('OK', 'biuro-contacts'); ?></button></p>
</div>
</div>
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ event: 'b2b_form_update_success_validated' });
</script>
<?php
unset($_SESSION['employers--s']);
}?>
*/
?>
wp-content/themes/biuro/page-recommend-friend.php
0 → 100644
View file @
e6ea63ab
<?php
/**
* Template Name: Recommend Friend Page
*
* The employees landing page template file
* Learn more: https://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Biuro
* @since 1.0
* @version 1.0
*/
get_header
(
'langing'
);
?>
<div
class=
"l-section l-section--landing-1"
>
<div
class=
"l-section--inner"
>
<?php
while
(
have_posts
()
)
:
?>
<div
class=
"c-heading--landing-1"
>
<?php
the_post
();
the_content
();
?>
</div>
<?php
endwhile
;
?>
</div>
</div>
<div
id=
"content"
>
<main
id=
"main"
class=
"l-main"
>
<div
class=
"c-contact-landing-1"
>
<div
class=
"c-contact-landing-1--inner"
>
<div
class=
"c-contact-landing-1--content"
>
<?php
if
(
is_active_sidebar
(
'landing_page_employees_1'
)
)
:
dynamic_sidebar
(
'landing_page_employees_1'
);
endif
;
?>
<div
class=
"c-contact-landing-1--img"
>
<picture>
<source
srcset=
"/wp-content/themes/biuro/i/contact.webp"
type=
"image/webp"
>
<img
src=
"/wp-content/themes/biuro/i/contact.png"
alt=
""
width=
"328"
height=
"95"
>
</picture>
</div>
</div>
<div
class=
"c-contact-landing-1--form"
>
<?php
echo
do_shortcode
(
'[biuro-contacts--recommend]'
);
?>
</div>
</div>
<!-- .c-contact-landing-1--inner -->
</div>
<!-- .c-contact-landing-1 -->
<?php
if
(
is_active_sidebar
(
'front_page_feedbacks'
)
)
:
dynamic_sidebar
(
'front_page_feedbacks'
);
endif
;
?>
</main>
<!-- .l-main -->
</div>
<!-- #content -->
<?php
get_footer
();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment