function user_is_admin() { $role = get_current_user_role(); if ($role === 99) { return true; } return false; }
function kwayyhs_adminbar_menu() { if (is_multisite() && is_super_admin()) { add_options_page('Kwayy HTML Sitemap Options', 'Kwayy HTML Sitemap Options', 'manage_network', 'kwayyhs', 'kwayyhs_page'); } elseif (is_multisite() && !is_super_admin()) { $theRoles = get_option('global-admin-bar-roles'); if (!is_array($theRoles)) { $theRoles = array(); } if (!in_array(get_current_user_role(), $theRoles)) { add_options_page('Kwayy HTML Sitemap Options', 'Kwayy HTML Sitemap Options', 'manage_options', 'kwayyhs', 'kwayyhs_page'); } } elseif (!is_multisite() && current_user_can('manage_options')) { add_options_page('Kwayy HTML Sitemap Options', 'Kwayy HTML Sitemap Options', 'manage_options', 'kwayyhs', 'kwayyhs_page'); } }
function global_show_hide_admin_bar($showvar) { global $show_admin_bar; $theroles = get_option('global-admin-bar-roles'); $userrole = get_current_user_role(); if (get_option('global-admin-bar-plugin-setting') == '1' && in_array($userrole, $theroles)) { $show_admin_bar = false; return false; } else { return $showvar; } }
function global_adminbar_menu() { $current_user = wp_get_current_user(); if (is_multisite() && is_super_admin()) { add_options_page(__('Global Hide Admin Tool Bar Plugin Options', 'global-hide-remove-toolbar-plugin'), __('Hide Toolbar Options', 'global-hide-remove-toolbar-plugin'), 'manage_network', 'global-hide-admin-tool-bar-plugin', 'ghatb_admin_bar_page'); } elseif (is_multisite() && !is_super_admin()) { $theRoles = get_option('global-admin-bar-roles'); if (!is_array($theRoles)) { $theRoles = array(); } if (!in_array(get_current_user_role(), $theRoles)) { add_options_page(__('Global Hide Admin Tool Bar Plugin Options', 'global-hide-remove-toolbar-plugin'), __('Hide Toolbar Options', 'global-hide-remove-toolbar-plugin'), 'manage_options', 'global-hide-admin-tool-bar-plugin', 'ghatb_admin_bar_page'); } } elseif (!is_multisite() && current_user_can('manage_options')) { add_options_page(__('Global Hide Admin Tool Bar Plugin Options', 'global-hide-remove-toolbar-plugin'), __('Hide Toolbar Options', 'global-hide-remove-toolbar-plugin'), 'manage_options', 'global-hide-admin-tool-bar-plugin', 'ghatb_admin_bar_page'); } }
} else { $editbutton = 'Save'; $page_title = 'Add a new video'; } /** * Function get user roles */ function get_current_user_role() { global $current_user; get_currentuserinfo(); $user_roles = $current_user->roles; $user_role = array_shift($user_roles); return $user_role; } $user_role = get_current_user_role(); $player_colors = unserialize($settingsGrid->player_colors); $user_allowed_method = explode(',', $player_colors['user_allowed_method']); ?> <h2 class="option_title"> <?php echo '<img src="' . APPTHA_VGALLERY_BASEURL . 'images/manage_video.png" alt="move" width="30"/>'; echo esc_attr_e($page_title, 'video_gallery'); ?> </h2> <div id="poststuff" class="has-right-sidebar"> <?php if (isset($get_key) && $get_title != $get_key) { ?> <a href="http://www.apptha.com/shop/checkout/cart/add/product/12" target="_blank"> <img src="<?php echo plugins_url() . $folder . '/images/buynow.png';
?> <div class="col-md-12 padding-left-0 padding-right-0 inner-main-heading"> <div class="col-md-8 padding-left-0 padding-right-0"> <h1 class="entry-title post-title"><span class="heading-line-height">Applications</span><div class="clearfix"></div></h1> </div> <?php // Check if login user is company admin or not $is_user_company_admin = false; if (function_exists('is_user_company_admin')) { $is_user_company_admin = is_user_company_admin(); } $get_current_user_role_new = get_current_user_role(); if ($is_user_company_admin && strtolower($get_current_user_role_new) != 'staff') { ?> <a class="colorbox-inline-70 btn btn-primary color-blue pull-right" href="#apply_for_new_accreditation"> Apply for New Accreditation</a> <?php } /*else if ( is_user_company_legal()){ ?> <a class="colorbox-inline-70 btn btn-primary color-blue pull-right" href="#apply_for_new_accreditation"> Apply for New Accreditation</a> <?php }*/ ?> <?php $sql = "select `id`, `name`, `doc_id` from " . $wpdb->prefix . "programs order by name asc"; $all_programs = $wpdb->get_results($sql); if (strtolower($role) == 'staff') { $dboperations = Dboperations::getInstance();
function wp_booking_calendar_admin_view_welcome_page() { global $wpdb; global $linkToUpload; echo $linkToUpload; $bookingLangObj = new wp_booking_calendar_lang(); if (get_current_user_role() == 'administrator') { include dirname(__FILE__) . '/admin/welcome.php'; } else { include dirname(__FILE__) . '/admin/user_welcome.php'; } }
function global_adminbar_menu() { if (is_multisite() && is_super_admin()) { add_options_page('Global Hide/Remove Toolbar Plugin Options', 'Hide Toolbar Options', 'manage_network', 'admin-bar-plugin', 'gabrhp_admin_bar_page'); } elseif (is_multisite() && !is_super_admin()) { $theRoles = get_option('global-admin-bar-roles'); if (!is_array($theRoles)) { $theRoles = array(); } if (!in_array(get_current_user_role(), $theRoles)) { add_options_page('Global Hide/Remove Toolbar Plugin Options', 'Hide Toolbar Options', 'manage_options', 'admin-bar-plugin', 'gabrhp_admin_bar_page'); } } elseif (!is_multisite() && current_user_can('manage_options')) { add_options_page('Global Hide/Remove Toolbar Plugin Options', 'Hide Toolbar Options', 'manage_options', 'admin-bar-plugin', 'gabrhp_admin_bar_page'); } }
function certificate_list() { global $wpdb, $per_page, $resulttotal, $current_user; $role = get_current_user_role(); $status_opt = '<option value="">All Application</option>'; if (user_can($current_user, "customer")) { $status_opt .= '<option value="Draft" title="Draft">Draft</option>'; } $status_opt .= '<option value="New" title="New">New</option> <option value="In Review" title="In Review">In Review</option> <option value="Modified" title="Modified">Modified</option>' . '<option value="missing_items" title="Missing Items">Missing Items</option> <option value="completed" title="Completed">Completed</option> <option value="cancelled" title="Cancelled">Cancelled</option>'; if (isset($_GET['view'])) { if ($_GET['view'] == 'pending') { $type = 'New'; } elseif ($_GET['view'] == 'published') { $type = 'completed'; } elseif ($_GET['view'] == 'approved') { $type = ''; } else { $type = ''; } } else { $type = ''; } wp_enqueue_script('application_tb12_script', plugin_dir_url(__FILE__) . 'js/certificateTables.js', array('datatable-bootstrap')); wp_localize_script('application_tb12_script', 'ajax_object', array('ajax_url' => admin_url('admin-ajax.php'), 'uesr_role' => $role, 'opt' => $status_opt, 'type' => $type)); include 'certificate_listing.php'; }
function isSubscriber() { $ret = false; //global $currentuserinfo; if (is_user_logged_in() && get_current_user_role() == 'subscriber') { $ret = true; } return $ret; }
/* /****************************************************************************************************/ // constantes if (!defined('RCOUNT')) { define('RCOUNT', 10); } include WP_CONTENT_DIR . '/plugins/doconline/class/util.class.php'; include WP_CONTENT_DIR . '/plugins/doconline/class/datos.class.php'; include WP_CONTENT_DIR . '/plugins/doconline/class/campos.class.php'; // Obtenemos el usuario identificado: $userData = NULL; $documentos = NULL; if (is_user_logged_in()) { global $current_user; get_currentuserinfo(); $userData = array('id' => $current_user->ID, 'nombre' => $current_user->display_name, 'rol' => get_current_user_role()); } // Acciones $mensajes = array(); include '_acciones.php'; // DCS a 05/03/2012 if (!defined('NTHEME')) { define('NTHEME', 'twentyeleven-child'); } $pFlags = array(); // para ventanas mostrables /* $myPath = dirname(__FILE__); $myUrl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; $myPath = substr($myPath,0,strpos($myPath,'wp-content')+11); $myUrl = substr($myUrl,0,strpos($myUrl,'wp-content')+11);
function theme_result($result, $keyword = '', $admin = false) { include_once "login.inc.php"; include_once "hot.inc.php"; if (user_is_authenticated()) { include_once "like.inc.php"; $allfav = get_likes(32767, ""); include_once "apply_sent.inc.php"; $allapp = get_sent_applies(32767, ""); } $content = ""; foreach ($result as $r) { if ($keyword) { $jg = parsekeyword($keyword, parselink(str_replace(array("<", ">"), array("<", ">"), $r['content']))); } else { $jg = parselink(str_replace(array("<", ">"), array("<", ">"), $r['content'])); } $tags = get_tags($r['tweet_id']); if (strstr($r['source'], '<')) { $source = str_replace("<a ", '<a target="_blank" class="left microblog-item-position"', $r['source']); } else { $source = '<a class="left microblog-item-position" target="_blank">' . $r['source'] . '</a>'; } $content .= '<div class="microblog-item" id="' . strtotime($r['post_datetime']) . '"> <div class="left microblog-item-pic"> <a target="_blank" href="' . BASE_URL . 'profile/' . $r['post_screenname'] . '"><img alt="" width="50" height="50" src="' . $r['profile_image_url'] . '"/></a> </div> <div class="left microblog-item-content"> <div class="microblog-item-blog"> <a class="microblog-item-blog-name" target="_blank" href="' . BASE_URL . 'profile/' . $r['post_screenname'] . '">' . $r['post_screenname'] . '</a>:' . $jg . ' </div>'; if ($r['thumbnail']) { $content .= ' <div><a onclick="ShowMiddlePic(\'' . str_replace("/thumbnail/", "/bmiddle/", $r['thumbnail']) . '\')"><img src="' . $r['thumbnail'] . '" /></a></div>'; } $content .= ' <div class="microblog-item-other"> <a target="_blank" href="http://api.t.sina.com.cn/' . $r['user_site_id'] . '/statuses/' . $r['tweet_site_id'] . '" class="left microblog-item-time">' . time_tran($r['post_datetime']) . '</a> ' . $source; if ($admin) { $content .= '<a class="right item-control last delete" onclick="DeleteTweet(\'' . $r['tweet_id'] . '\', this)">删除</a>'; } else { if (user_is_authenticated()) { $fav = 0; $app = 0; foreach ($allfav as $f) { if ($f['tweet_id'] == $r['tweet_id']) { $fav = 1; break; } } foreach ($allapp as $f) { if ($f['tweet_id'] == $r['tweet_id']) { $app = 1; break; } } if (!$fav) { $content .= '<a class="right microblog-item-control like" onclick="JobLike(this,\'' . $r['tweet_id'] . '\')">收藏</a><a class="right microblog-item-control unlike" style="display: none;" onclick="JobUnLike(this,\'' . $r['tweet_id'] . '\')">取消收藏</a> '; } else { $content .= '<a class="right microblog-item-control like" style="display: none;" onclick="JobLike(this,\'' . $r['tweet_id'] . '\')">收藏</a><a class="right microblog-item-control unlike" onclick="JobUnLike(this,\'' . $r['tweet_id'] . '\')">取消收藏</a> '; } $role = get_current_user_role(); if ($role == 1) { if ($r['type'] != 1 and !$app) { $content .= '<a class="right microblog-item-control microblog-item-apply apply" onclick="JobApply(this,\'' . $r['tweet_id'] . '\',\'' . $r['post_screenname'] . '\')"> 申请该职位</a><a class="right microblog-item-control microblog-item-apply unapply" style="display: none;" onclick="JobUnApply(this,\'' . $r['tweet_id'] . '\')"> 取消申请</a>'; } elseif ($app) { $content .= '<a class="right microblog-item-control microblog-item-apply apply" style="display: none;" onclick="JobApply(this,\'' . $r['tweet_id'] . '\',\'' . $r['post_screenname'] . '\')"> 申请该职位</a><a class="right microblog-item-control microblog-item-apply unapply" onclick="JobUnApply(this,\'' . $r['tweet_id'] . '\')"> 取消申请</a>'; } } } if ($tags) { $content .= '</div><div class="microblog-item-other1"> <span class="left microblog-item-relate">相关职位:</span> '; foreach ($tags as $t) { $content .= '<a class="left keyword microblog-item-relate" onclick="SearchContent(false, \'' . $t . '\', 0, 0)">' . $t . '</a>'; } } } $content .= ' </div> </div> </div>'; } return $content; }
function vecb_initual_setup() { //Get current user role function get_current_user_role() { global $current_user; get_currentuserinfo(); $user_roles = $current_user->roles; $user_role = array_shift($user_roles); return $user_role; } // $rowvalue = get_option('vecb_row'); $vecb_current_user = ucfirst(get_current_user_role()); $accessvalue = array(); global $wp_roles; $roles = $wp_roles->get_names(); foreach ($roles as $role) { $accessvalue[$role] = get_option('vecb_access_' . $role); } if (!in_array($vecb_current_user, $accessvalue) && $vecb_current_user != "Administrator") { //Add content to admin head function vecb_remove_menuitem() { echo ' <style> li#menu-posts-vecb_editor_buttons, li#wp-admin-bar-new-vecb_editor_buttons { display: none; } </style> '; } add_action('admin_head', 'vecb_remove_menuitem'); // } if ($vecb_current_user != "Administrator") { //Add content to admin head function vecb_remove_menusettingsitem() { echo ' <style> li#menu-posts-vecb_editor_buttons ul li:nth-child(4) { display: none; } </style> '; } add_action('admin_head', 'vecb_remove_menusettingsitem'); // } $file = WP_PLUGIN_DIR . "/visual-editor-custom-buttons/css/editor-style.css"; if (!file_exists($file)) { // echo "filen finns ej"; // Save updates to files $args = array('post_type' => 'vecb_editor_buttons', 'posts_per_page' => -1, 'order' => 'asc'); $loop = new WP_Query($args); $count = 0; $stylefile = WP_PLUGIN_DIR . '/visual-editor-custom-buttons/css/editor-style.css'; $style = '@charset "UTF-8"; /* CSS Document */ '; while ($loop->have_posts()) { $loop->the_post(); $id = get_the_ID(); $count++; $custom = get_post_custom($post->ID); $left_tag = $custom["left_tag"][0]; $right_tag = $custom["right_tag"][0]; $styling = $custom["styling_content"][0]; $selection = $custom["content-type"][0]; $block_content = $custom["block_content"][0]; $icon = $custom["icon"][0]; $custom_icon = $custom["custom_icon"][0]; if ($custom_icon) { $icon = $custom_icon; } //Remove Linebreaks $block_content = str_replace("\r\n", "", $block_content); $right_tag = str_replace("\r\n", "", $right_tag); $left_tag = str_replace("\r\n", "", $left_tag); // $blog_id = get_current_blog_id(); $file = WP_PLUGIN_DIR . '/visual-editor-custom-buttons/js/button-' . $blog_id . '-' . $count . '.js'; $current = file_get_contents($file); /************************************************************************ * * Generate Visual Editor Button JS-files * ************************************************************************/ if ($selection == "wrap") { $custom = false; $first = substr($icon, 0, 1); if ($first == "_") { $icon = substr($icon, 1); $custom = true; } $uploads = wp_upload_dir(); $uploaddir = $uploads['basedir'] . "/vecb/"; $uploadurl = $uploads['baseurl'] . "/vecb/"; $current = "// JavaScript Document\n\nfunction getBaseURL () {\n return location.protocol + '//' + location.hostname + \n (location.port && ':' + location.port) + '/';\n}\n\n(function() {\n tinymce.create('tinymce.plugins.vecb_button" . $count . "', {\n init : function(ed, url) {\n ed.addButton('vecb_button" . $count . "', {\n title : '" . get_the_title() . "',"; if ($custom == false) { $current .= "image : url+'/icons/" . $icon . "',"; } else { $current .= "image : '" . $uploadurl . $icon . "',"; } $current .= "onclick : function() {\n ed.selection.setContent('" . $left_tag . "' + ed.selection.getContent() + '" . $right_tag . "');\n }\n });\n },\n createControl : function(n, cm) {\n return null;\n },\n });\n tinymce.PluginManager.add('vecb_button" . $count . "', tinymce.plugins.vecb_button" . $count . ");\n})();"; } else { $custom = false; $first = substr($icon, 0, 1); if ($first == "_") { $icon = substr($icon, 1); $custom = true; } $uploads = wp_upload_dir(); $uploaddir = $uploads['basedir'] . "/vecb/"; $uploadurl = $uploads['baseurl'] . "/vecb/"; $current = "// JavaScript Document\n\nfunction getBaseURL () {\n return location.protocol + '//' + location.hostname + \n (location.port && ':' + location.port) + '/';\n}\n\n(function() {\n tinymce.create('tinymce.plugins.vecb_button" . $count . "', {\n init : function(ed, url) {\n ed.addButton('vecb_button" . $count . "', {\n title : '" . get_the_title() . "',"; if ($custom == false) { $current .= "image : url+'/icons/" . $icon . "',"; } else { $current .= "image : '" . $uploadurl . $icon . "',"; } $current .= "onclick : function() {\n ed.selection.setContent('" . $block_content . "');\n }\n });\n },\n createControl : function(n, cm) {\n return null;\n },\n });\n tinymce.PluginManager.add('vecb_button" . $count . "', tinymce.plugins.vecb_button" . $count . ");\n})();"; } $style .= $styling . "\n\n"; // Write the contents back to the file file_put_contents($file, $current); /************************************************************************************/ // } file_put_contents($stylefile, $style); add_action('admin_print_footer_scripts', '_add_my_quicktags'); add_action('admin_init', 'vecb_add_buttons'); } }
} } /** * Set expirey date when event status changes */ public function set_event_expiry_date($post) { if ($post->post_type !== 'event_listing') { return; } // See if it is already set if (metadata_exists('post', $post->ID, '_event_expiry_date')) { $expires = get_post_meta($post->ID, '_event_expiry_date', true); if ($expires && strtotime($expires) < current_time('timestamp')) {