File: /var/www/lipovac/wp-content/plugins/senior-plugin/plugin.php
<?php
/**
* Plugin Name: Senior Care
* Plugin URI: http://wordpress.org/plugins
* Description: Senior Care theme helper plugin
* Version: 1.1
* Author: Aislin Themes
* Author URI: http://themeforest.net/user/Aislin/portfolio
* License: GPLv2+
* Text Domain: chp
* Domain Path: /languages
*/
define( 'SCP_PLUGIN_VERSION', '1.1' );
define( 'SCP_PLUGIN_NAME', 'Senior Care' );
define( 'SCP_PLUGIN_PREFIX', 'scp_' );
define( 'SCP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'SCP_PLUGIN_PATH', dirname( __FILE__ ) . '/' );
define( 'SCP_TEXT_DOMAIN', 'scp_donation' );
register_activation_hook( __FILE__, 'scp_activate' );
register_deactivation_hook( __FILE__, 'scp_deactivate' );
add_action( 'plugins_loaded', 'scp_init' );
add_action( 'widgets_init', 'scp_register_wp_widgets' );
// add_action( 'show_user_profile', 'scp_show_extra_profile_fields' );
// add_action( 'edit_user_profile', 'scp_show_extra_profile_fields' );
// add_action( 'personal_options_update', 'scp_save_extra_profile_fields' );
// add_action( 'edit_user_profile_update', 'scp_save_extra_profile_fields' );
add_action( 'wp_head', 'scp_set_js_global_var' );
// Dynamically add a section. Can be also used to modify sections/fields
// add_filter( 'redux/options/wheels_options/sections', 'scp_dynamic_section' );
add_filter( 'pre_get_posts', 'scp_portfolio_posts' );
require_once 'shortcodes.php';
function scp_clean($item) {
$firstClosingPTag = substr($item, 0, 4);
$lastOpeningPTag = substr($item, -3);
if ($firstClosingPTag == '</p>') {
$item = substr($item, 4);
}
if ($lastOpeningPTag == '<p>') {
$item = substr($item, 0, -3);
}
return $item;
}
function scp_init() {
scp_add_extensions();
scp_add_vc_custom_addons();
}
function scp_activate() {
scp_init();
flush_rewrite_rules();
}
function scp_deactivate() {
}
function scp_add_vc_custom_addons() {
// require_once 'vc-addons/courses-teachers/courses-teachers.php';
// require_once 'vc-addons/our-process/our-process.php';
// require_once 'vc-addons/posts-grid-custom/posts-grid-custom.php';
// require_once 'vc-addons/pricing-plan/pricing-plan.php';
}
function scp_add_extensions() {
if ( apply_filters( 'scp_filter_enable_portfolio', false ) ) {
require_once 'extensions/portfolio-post-type/portfolio-post-type.php';
}
if ( apply_filters( 'scp_filter_enable_post_subtitles', false ) ) {
require_once 'extensions/easy-post-subtitle/easy-post-subtitle.php';
}
}
function scp_dynamic_section( $sections ) {
$sections[] = array(
'title' => __( 'Widgets', SCP_TEXT_DOMAIN ),
'desc' => __( '<p class="description">This where you style widgets used mostly on the home page. Each subsection holds settings for custom widgets included with the theme.</p>', SCP_TEXT_DOMAIN ),
'icon' => 'el-icon-cog',
// Leave this as a blank section, no options just some intro text set above.
'fields' => array()
);
include 'vc-addons/our-process/redux-options.php';
return $sections;
}
function scp_get_wheels_option( $option_name, $default = false ) {
// global $senior_care_options;
// $options = $senior_care_options;
// if ( isset( $options ) && is_string( $option_name ) ) {
// return isset( $options[ $option_name ] ) ? $options[ $option_name ] : $default;
// }
if ( function_exists( 'wheels_get_option' ) ) {
return wheels_get_option( $option_name, $default );
}
return $default;
}
function scp_set_js_global_var() {
$our_process_breakpoint = scp_get_wheels_option( 'dntp-our-process-widget-device-trigger', '480' );
?>
<script>
var scp = scp ||
{
data: {
vcWidgets: {
ourProcess: {
breakpoint: '<?php echo (int) $our_process_breakpoint; ?>'
}
}
}
};
</script>
<?php
}
function scp_show_extra_profile_fields( $user ) {
?>
<h3>Extra profile information</h3>
<table class="form-table">
<tr>
<th><label for="twitter"><?php _e('Twitter', SCP_TEXT_DOMAIN) ?></label></th>
<td>
<input type="text" name="twitter" id="twitter"
value="<?php echo esc_attr( get_the_author_meta( 'twitter', $user->ID ) ); ?>"
class="regular-text"/><br/>
<span class="description"><?php _e('Please enter your Twitter username.', SCP_TEXT_DOMAIN) ?></span>
</td>
</tr>
<tr>
<th><label for="facebook"><?php _e('Facebook', SCP_TEXT_DOMAIN) ?></label></th>
<td>
<input type="text" name="facebook" id="facebook"
value="<?php echo esc_attr( get_the_author_meta( 'facebook', $user->ID ) ); ?>"
class="regular-text"/><br/>
<span class="description"><?php _e('Please enter your Facebook username.', SCP_TEXT_DOMAIN) ?></span>
</td>
</tr>
<tr>
<th><label for="google_plus"><?php _e('Google+', SCP_TEXT_DOMAIN) ?></label></th>
<td>
<input type="text" name="google_plus" id="google_plus"
value="<?php echo esc_attr( get_the_author_meta( 'google_plus', $user->ID ) ); ?>"
class="regular-text"/><br/>
<span class="description"><?php _e('Please enter your Google+ username.', SCP_TEXT_DOMAIN) ?></span>
</td>
</tr>
</table>
<?php
}
function scp_save_extra_profile_fields( $user_id ) {
if ( !current_user_can( 'edit_user', $user_id ) )
return false;
/* Copy and paste this line for additional fields. Make sure to change 'twitter' to the field ID. */
update_user_meta( $user_id, 'twitter', $_POST['twitter'] );
update_user_meta( $user_id, 'facebook', $_POST['facebook'] );
update_user_meta( $user_id, 'google_plus', $_POST['google_plus'] );
}
function scp_register_wp_widgets() {
require_once 'wp-widgets/SCP_Latest_Posts_Widget.php';
// require_once 'wp-widgets/dntp-personal-contact-info-widget/scp_Personal_Contact_Info.php';
}
function scp_portfolio_posts( $query ) {
if ( is_admin() || ! $query->is_main_query() ) {
return;
}
if ( is_tax() && isset( $query->tax_query ) && $query->tax_query->queries[0]['taxonomy'] == 'portfolio_category' ) {
$query->set( 'posts_per_page', 10 );
return;
}
}
// function scp_enqueue_scripts()
// {
// wp_enqueue_style('dntp-css', SCP_PLUGIN_URL . '/public/css/scp-style.css', false);
// wp_enqueue_script('dntp-main', SCP_PLUGIN_URL . '/public/js/dntp-main.js', array('jquery'), false, true);
// }