/** * Return Access Token generated from App ID and App Secret, that you can use to display the posts from any public Facebook page or open group. * @return mixed|null */ public function get_access_token() { if ($this->access_token === null) { $this->access_token = fw_get_db_extension_data($this->get_name(), $this->access_token_name); } return $this->access_token; }
function fw_ext_styling_get($option, $default = null) { static $options = null; if ($options === null) { $options = fw_get_db_extension_data('styling', 'options', array()); } if (isset($options[$option])) { return $options[$option]; } return $default; }
/** * @internal * * @param null|string $index * * @return mixed|null */ private function get_admin_options($index = null) { if (is_null($this->settings_options)) { $this->settings_options = fw_get_db_extension_data($this->get_parent()->get_name(), 'options'); } if (is_null($index)) { return $this->settings_options; } if (!isset($this->settings_options[$index])) { return null; } return $this->settings_options[$index]; }
private function set_option($service_id, $key, $value) { $option_name = $this->get_option_name($service_id, $key); $settings = fw_get_db_extension_data($this->get_name(), 'settings'); $settings[$option_name] = $value; fw_set_db_extension_data($this->get_name(), 'settings', $settings); }
/** * Get extension's data from the database * * @param string|null $multi_key The key of the data you want to get. null - all data * @param null|mixed $default_value If no option found in the database, this value will be returned * @param null|bool $get_original_value Original value is that with no translations and other changes * * @return mixed|null */ public final function get_db_data($multi_key = null, $default_value = null, $get_original_value = null) { return fw_get_db_extension_data($this->get_name(), $multi_key, $default_value, $get_original_value); }
/** * Check when the sitemap was updated last time and if the time is logner then the sitemap refresh rate time, * updates it */ private function check_for_sitemap_auto_build() { $last_modif = fw_get_db_extension_data($this->get_name(), 'last_modif'); $refresh_rate = $this->get_config('sitemap_refresh_rate'); if (empty($refresh_rate)) { $refresh_rate = 2; } if (!isset($last_modif['last_sitemap_update']) || empty($last_modif['last_sitemap_update'])) { $this->set_parameters(); $this->update_sitemap(); return; } $prev_date = strtotime(date('Y-m-d', $last_modif['last_sitemap_update'])); $current_date = strtotime(date('Y-m-d')); $interval = intval(($current_date - $prev_date) / 86400); if ($interval >= $refresh_rate) { $this->update_sitemap(); } }
/** * Prints the css generated from the styling settings * @internal */ public function _theme_action_print_css() { $css = fw_get_db_extension_data($this->get_name(), 'css'); if (!empty($css)) { echo $css; } }
private static function get_storage_items() { return fw_get_db_extension_data('builder', 'fullscreen', array()); }
public function export_settings() { // Warning: Invalid argument supplied for foreach() in .../framework/extensions/backup/includes/exports/class-fw-backup-export-database.php on line 277 return (array) fw_get_db_extension_data(fw()->extensions->get('backup')->get_name()); }
private static function get_templates($builder_type) { return fw_get_db_extension_data('builder', 'templates/' . $builder_type, array()); }
private function get_admin_options() { if (is_null($this->settings_options)) { $this->settings_options = fw_get_db_extension_data($this->get_parent()->get_name(), 'options'); } return $this->settings_options; }
/** * @internal * * @param $data * * @return mixed */ public function _form_render($data) { $options = $this->get_seo_options(); if (empty($options)) { return $data; } $values = FW_Request::POST(FW_Option_Type::get_default_name_prefix(), fw_get_db_extension_data($this->get_name(), 'options')); echo fw()->backend->render_options($options, $values); $data['submit']['html'] = '<button class="button-primary button-large">' . __('Save', 'fw') . '</button>'; unset($options); return $data; }
/** * @param $builder_type * @return mixed|null */ private function get_db_templates($builder_type) { return fw_get_db_extension_data('builder', 'templates:' . $this->get_type() . '/' . $builder_type, array()); }
public function export($fp) { fwrite($fp, json_encode(fw_get_db_extension_data('backup', $this->name))); }
private function get_values() { return (array) fw_get_db_extension_data($this->backup()->get_name(), 'settings'); }
/** * @param $builder_type * @return mixed|null * * Note: Templates can be very big and saving them in a single wp option can throw mysql error on update query */ protected function get_db_templates($builder_type) { $templates = array(); /** * Note: 'prefix + name' max length should be 64 */ $option_prefix = $this->get_wp_option_prefix($builder_type); // + md5 (length=32) /** * @var WPDB $wpdb */ global $wpdb; foreach ((array) $wpdb->get_results($wpdb->prepare("SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE %s", $wpdb->esc_like($option_prefix) . '%'), ARRAY_A) as $row) { $templates[preg_replace('/^' . preg_quote($option_prefix, '/') . '/', '', $row['option_name'])] = get_option($row['option_name']); } $templates += fw_get_db_extension_data('builder', 'templates/' . $builder_type, array()); return $templates; }