function mg_options_wpml_sync() { if (!function_exists('icl_register_string')) { die('error'); } require_once MG_DIR . '/functions.php'; $already_saved = get_option('mg_wpml_synced_opts'); $to_save = array(); foreach (mg_main_types() as $type => $name) { $type_opts = get_option('mg_' . $type . '_opt'); $typename = $type == 'img_gallery' ? 'Image Gallery' : ucfirst($type); if (is_array($type_opts) && count($type_opts) > 0) { foreach ($type_opts as $opt) { $index = $typename . ' Options - ' . $opt; $to_save[$index] = $index; icl_register_string('Media Grid - Item Options', $index, $opt); if (isset($already_saved[$index])) { unset($already_saved[$index]); } } } } if (is_array($already_saved) && count($already_saved) > 0) { foreach ($already_saved as $opt) { icl_unregister_string('Media Grid - Item Options', $opt); } } if (!get_option('mg_wpml_synced_opts')) { add_option('mg_wpml_synced_opts', '255', '', 'yes'); } update_option('mg_wpml_synced_opts', $to_save); die('success'); }
<?php include_once MG_DIR . '/functions.php'; // item types array $types = mg_main_types(); $wooc_active = mg_woocomm_active(); if ($wooc_active) { $wc_attr = wc_get_attribute_taxonomies(); } ?> <div class="wrap lcwp_form"> <div class="icon32"><img src="<?php echo MG_URL . '/img/mg_icon.png'; ?> " alt="mediagrid" /><br/></div> <?php echo '<h2 class="lcwp_page_title" style="border: none;">' . __('Media Grid Settings', 'mg_ml') . "</h2>"; ?> <?php // HANDLE DATA if (isset($_POST['lcwp_admin_submit'])) { if (!isset($_POST['pg_nonce']) || !wp_verify_nonce($_POST['pg_nonce'], __FILE__)) { die('<p>Cheating?</p>'); } include MG_DIR . '/classes/simple_form_validator.php'; $validator = new simple_fv(); $indexes = array(); $indexes[] = array('index' => 'mg_cells_margin', 'label' => __('Cells Margin', 'mg_ml'), 'type' => 'int');
function mg_cust_opt_exists() { $types = mg_main_types(); $exists = false; foreach ($types as $type => $name) { if (get_option('mg_' . $type . '_opt') && count(get_option('mg_' . $type . '_opt')) > 0) { $exists = true; break; } } return $exists; }