plugin_option; $options->refresh(); /* ***************************************** * * Option page saving * ***************************************** */ if (isset($_POST['submitted'])) { check_admin_referer('urlyar-urlshortener'); //Shortener $options->set('urlserviceenable',sanitize_text_field( $_POST['urlserviceenable'])); $options->set('useslug', sanitize_text_field($_POST['useslug'])); $options->set('appendurl', array('home' =>sanitize_text_field( $_POST['appendurl_home']), 'single' => sanitize_text_field($_POST['appendurl_single']), 'page' => sanitize_text_field($_POST['appendurl_page']), 'product' => sanitize_text_field($_POST['appendurl_product']), 'text' => strip_tags(sanitize_text_field($_POST['appendurl_text'])), ) ); $options->set('appendqr', array('home' => sanitize_text_field($_POST['appendqr_home']), 'single' => sanitize_text_field($_POST['appendqr_single']), 'page' => sanitize_text_field($_POST['appendqr_page']), 'product' => sanitize_text_field($_POST['appendqr_product']), 'text' => strip_tags(sanitize_text_field($_POST['appendqr_text'])), 'provider' => sanitize_text_field($_POST['appendqr_provider']), ) ); //Nice ID $options->set('niceid', sanitize_text_field($_POST['niceid'])); $options->set('niceid_prefix', esc_url_raw($_POST['niceid_prefix'])); //Shortcode $options->set('url_shortcode', sanitize_text_field($_POST['url_shortcode'])); //Services $service_list = $this->shortener->service_list('detailed'); foreach ($service_list as $keys => $values) { switch ($values[2]) { case 1: case 4: $options->set('apiuser_' . $keys, sanitize_text_field($_POST['apiuser_' . $keys])); break; case 2: case 5: $options->set('apikey_' . $keys, sanitize_text_field($_POST['apikey_' . $keys])); break; case 3: case 6: case 101: $options->set('apiuser_' . $keys, sanitize_text_field($_POST['apiuser_' . $keys])); $options->set('apikey_' . $keys, sanitize_text_field($_POST['apikey_' . $keys])); break; default: break; } } $options->set('generic_yourls', array('endpoint' => sanitize_text_field($_POST['generic_yourls_endpoint']) ) ); $options->set('generic_interdose', array('service' => sanitize_text_field($_POST['generic_interdose_service']) ) ); //last command includes save. $options->set('urlservice', sanitize_text_field($_POST['urlservice'])); $options->save(); echo '

Plugin settings saved.

'; } /* ***************************************** * * Setup option page display * ***************************************** */ $options->refresh(); $urlserviceenable = $options->get('urlserviceenable'); $urlservice = $options->get('urlservice'); $useslug = $options->get('useslug'); $appendurl = $options->get('appendurl'); $appendqr = $options->get('appendqr'); $niceid = $options->get('niceid'); $niceid_prefix = $options->get('niceid_prefix'); $url_shortcode = $options->get('url_shortcode'); //$sfx = new FTShared(); $supported = $this->shortener->service_list('detailed'); $authkey = $this->shortener->service_list('authkey'); $authuser = $this->shortener->service_list('authuser'); $reqkey = $this->shortener->service_list('reqkey'); $requser = $this->shortener->service_list('requser'); /* ***************************************** * * Start of the form * ***************************************** */ ?>

plugin_version ?>

:

/> configured service.', 'url-shortener'); ?>
/> permalinks to generate the Short URL.'), get_option('siteurl')); ?>
/>
/>
/>
/>


/>

Examples:
"prefix/" = http://yoursite/prefix/123
"prefix-" = http://yoursite/prefix-123

', 'url-shortener'); ?>

/>

/>
/>
/>
/>
class="regular-radio code"/>
class="regular-radio code"/>

shortener_modules as $modules){ ?>
Version:
*/ ?>

* are required configurations for that service.', 'url-shortener'); ?>

$value) { if ($urlservice == $key) { $sh = 'show'; $rh = 'class="detail"'; } else { $sh = 'hide'; $rh=''; } $apirow = ''; $apirow .= ''; $apirow .= ''; $rh = ''; echo $apirow; } ?>
'; $apirow .= '
'; $apireq = ''; /* ***************************************** * User Authentication ***************************************** */ if (in_array($key, $authuser)) { $apireq .= ''; } /* ***************************************** * Key Authentication ***************************************** */ if (in_array($key, $authkey)) { $apireq .= ''; } /* ***************************************** * Misc Authentication Fields.. * Case by Case Basis ***************************************** */ switch ($key) { case 'yourls': $apireq .= ''; $apireq .= ''; $apireq .= '
'; $apireq .= 'Example: http://site.com/yourls-api.php'; $apireq .= '
Note: Please check out Known issues before activiting yourls support'; $apireq .= '
'; break; case 'interdose': $apireq .= '
'; $apireq .= 'Example: piep.net, xlnk.cc'; $apireq .= '
'; break; default: break; } /*if (in_array($key, $this->generic)){ $apireq .= '
'; $data = $sfx->openurl('http://api.interdose.com/api/shorturl/v1/services.json'); $data = $sfx->processjson($data); $count = count($data); if ($count){ $apireq .= '
Public Services: '; for ($i = 0; $i < $count; $i++){ $apireq .= ''.$data[$i]->service.''; } } break; default: break; } } */ if ($apireq == '') { $apireq = '' . __('No Configuration Needed', 'url-shortener') . ''; } $apirow .= $apireq; $apirow .= '