private function init_variables() { global $wpdb; $plugin = Arlo_For_Wordpress::get_instance(); $settings = get_option('arlo_settings'); $this->plugin_slug = $plugin->plugin_slug; $this->wpdb =& $wpdb; }
private function init_variables() { global $wpdb; $plugin = Arlo_For_Wordpress::get_instance(); $settings = get_option('arlo_settings'); $this->active = $plugin->get_import_id(); $this->plugin_slug = $plugin->plugin_slug; $this->version = Arlo_For_Wordpress::VERSION; $this->wpdb =& $wpdb; $this->platform_name = $settings['platform_name']; }
<?php $plugin = Arlo_For_Wordpress::get_instance(); $plugin_slug = $plugin->get_plugin_slug(); $event_name = Arlo_For_Wordpress::$post_types['event']['singular_name']; // output the widget title $title = apply_filters('widget_title', empty($instance['title']) ? $event_name . ' ' . __('Categories', $plugin_slug) : $instance['title'], $instance, $this->id_base); echo $before_title . $title . $after_title; // number of levels to display, "0" displays the full tree $depth = isset($instance['depth']) ? $instance['depth'] : 0; $parent = $instance['parent'] ? '' : ' parent="0"'; $shortcode = '[arlo_categories' . $parent . ' depth="' . $depth . '"]'; $output = do_shortcode($shortcode); if (!empty($output)) { $output = '<div class="arlo-categories-widget">' . $output . '</div>'; } else { $output = '<p>' . __('No categories to display.', $plugin_slug) . '</p>'; } // output the events list echo $output;
public static function dismiss_message_callback() { $id = intval($_POST['id']); if ($id > 0) { $plugin = Arlo_For_Wordpress::get_instance(); $message_handler = $plugin->get_message_handler(); $message_handler->dismiss_message($id); } echo $id; wp_die(); }
public function settings_saved($old) { $new = get_option('arlo_settings', array()); $old_regions = get_option('arlo_regions', array()); if ($old['platform_name'] != $new['platform_name'] && !empty($new['platform_name'])) { $plugin = Arlo_For_Wordpress::get_instance(); $plugin->determine_url_structure($new['platform_name']); $scheduler = $plugin->get_scheduler(); $scheduler->set_task("import", -1); } else { if (empty($new['platform_name'])) { $notice_id = Arlo_For_Wordpress::$dismissible_notices['welcome']; $user = wp_get_current_user(); update_user_meta($user->ID, $notice_id, 1); } } update_option('arlo_customcss', 'inline'); $access_type = get_filesystem_method(); if ($access_type === 'direct') { $creds = request_filesystem_credentials(site_url() . '/wp-admin/', '', false, false, array()); if (WP_Filesystem($creds)) { global $wp_filesystem; $filename = trailingslashit(plugin_dir_path(__FILE__)) . '../public/assets/css/custom.css'; if ($wp_filesystem->put_contents($filename, $new['customcss'], FS_CHMOD_FILE)) { update_option('arlo_customcss', 'file'); update_option('arlo_customcss_timestamp', time()); } } } //normalize regions $regions = array(); if (is_array($new['regionid']) && count($new['regionid'])) { foreach ($new['regionid'] as $key => $regionid) { if (!empty($regionid) && !empty($new['regionname'][$key])) { $regions[$regionid] = $new['regionname'][$key]; } } } update_option('arlo_regions', $regions); // need to check for posts-page change here // loop through each post type and check if the posts-page has changed foreach ($new['post_types'] as $id => $post_type) { if ($old['post_types'][$id]['posts_page'] != $new['post_types'][$id]['posts_page']) { $posts = get_posts(array('posts_per_page' => -1, 'post_type' => 'arlo_' . $id, 'post_status' => 'publish')); $posts = array_merge($posts, $regions); // update all posts of this type to have this parent id foreach ($posts as $post) { wp_update_post(array('ID' => $post->ID, 'post_parent' => $new['post_types'][$id]['posts_page'])); } } } }
function arlo_check_current_tasks() { global $wpdb; $plugin = Arlo_For_Wordpress::get_instance(); $scheduler = $plugin->get_scheduler(); $next_immediate_task = $scheduler->get_next_immediate_tasks(); $next_immediate_task_ids = []; $running_task = $scheduler->get_running_tasks(); $running_task_ids = []; $running_task = array_merge($running_task, $scheduler->get_paused_tasks()); foreach ($next_immediate_task as $task) { $next_immediate_task_ids[] = $task->task_id; } foreach ($running_task as $task) { $running_task_ids[] = $task->task_id; } echo "\n\t\t<script type='text/javascript'>\n\t\t\tvar ArloImmediateTaskIDs = " . wp_json_encode($next_immediate_task_ids) . ";\n\t\t\tvar ArloRunningTaskIDs = " . wp_json_encode($running_task_ids) . ";\n\t\t</script>\n\t\t"; }