[ Index ]

PHP Cross Reference of zeList

title

Body

[close]

/admin/ -> api.php (source)

   1  <?php
   2  /**
   3   * zeList API Page
   4   * @see includes/api.php function zelist_api_admin_load() for $_POST treatment
   5   */
   6  if (isset($_SERVER['SCRIPT_FILENAME']) && basename(__FILE__) == basename($_SERVER['SCRIPT_FILENAME']))
   7   die("Are you sure ? ");
   8  ?>
   9  <div id="zelist_api" class="wrap">
  10  <h2><?php _e('zeList API','zelist'); ?></h2>
  11  <?php global $messages; if(count($messages)) : foreach($messages as $type =>$msgs) foreach($msgs as $msg) echo '<p class="'.$type.'">'.$msg.'</p>'; ?><?php endif; ?>
  12  <?php global $updated; if($updated) : ?><div id="message" class="updated fade"><p><strong><?php _e('Settings saved.') ?></strong></p></div><?php endif; ?>
  13  <?php do_action('zelist_api_admin_before'); ?>
  14  
  15  <?php if(!zelist_api_get_key() || !zelist_api_get_site_id()) : ?>
  16  <div class="narrow">
  17  <p><?php printf(__('zeList API can help you manage your directory, by detecting spam or duplicate submissions.<br />You can get a free account on <a href="%s">www.zelist.net</a>','zelist'),'http://www.zelist.net/'); ?></p>
  18  
  19  <form action="" method="post">
  20      <?php wp_nonce_field('zelist-api'); ?>
  21      <p><?php
  22      $locale = get_locale();
  23      if($locale == 'fr') $profile_link = 'http://api.zelist.net/profil/fr/';
  24      else $profile_link = 'http://api.zelist.net/profile/en/';
  25      printf(__('Enter your zeList API key. <a href="%s">Get your key here.</a>','zelist'),$profile_link); ?></p>
  26      <label for="api_key"><?php _e('API Key:','zelist'); ?></label>
  27      <input type="text" name="api_key" id="api_key" size="33" value="<?php echo $api_key; ?>" />
  28      <input type="hidden" name="method" value="CheckKey" />
  29      <p class="submit"><input type="submit" value="<?php _e('Save Changes') ?>" /></p>
  30  </form>
  31  
  32  </div>
  33  
  34  <?php else : ?>
  35  
  36  <form class="small" action="" method="post">
  37      <?php wp_nonce_field('zelist-api'); ?>
  38      <p class="success"><?php _e('Your API key is valid','zelist'); ?></p>
  39      <label for="api_key"><?php _e('API Key:','zelist'); ?></label>
  40      <input type="text" name="api_key" id="api_key" size="33" value="<?php echo get_option('zelistapi_api_key'); ?>" />
  41      <input type="hidden" name="method" value="CheckKey" />
  42      <input type="submit" value="<?php _e('Check','zelist') ?>" />
  43  </form>
  44  
  45  
  46  <br class="clear" />
  47  <form action="" method="post">
  48  <?php wp_nonce_field('zelist-api'); ?>
  49  <input type="hidden" name="method" value="GetFeatures" />
  50  <input type="submit" class="button" value="<?php _e('Refresh Features','zelist'); ?>" />
  51  </form>
  52  
  53  <br class="clear" />
  54  <div id="col-container">
  55  
  56  
  57  <div id="col-right"><div class="col-wrap">
  58  
  59  <form id="posts-filter" action="" method="get">
  60  <?php wp_nonce_field('zelist-api') ?>
  61  <div class="tablenav">
  62  
  63  <?php
  64  $features = zelist_api_get_features();
  65  
  66  $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
  67  if ( empty($pagenum) )    $pagenum = 1;
  68  if( ! isset( $linesperpage ) || $linesperpage < 0 )    $linesperpage = 20;
  69  
  70  $page_links = paginate_links( array(
  71      'base' => add_query_arg( 'pagenum', '%#%' ),
  72      'format' => '',
  73      'prev_text' => __('&laquo;'),
  74      'next_text' => __('&raquo;'),
  75      'total' => ceil(count($features) / $linesperpage),
  76      'current' => $pagenum
  77  ));
  78  
  79  if ( $page_links )
  80      echo "<div class='tablenav-pages'>$page_links</div>";
  81  ?>
  82  
  83  <div class="alignleft actions">
  84  <select name="action">
  85  <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
  86  <option value="activate"><?php _e('Activate'); ?></option>
  87  <option value="inactivate"><?php _e('Deactivate'); ?></option>
  88  </select>
  89  <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
  90  </div>
  91  
  92  <br class="clear" />
  93  </div>
  94  
  95  <table class="widefat fixed" cellspacing="0">
  96      <thead>
  97      <tr>
  98  <?php print_column_headers('zelistapi_features'); ?>
  99      </tr>
 100      </thead>
 101      <tfoot>
 102      <tr>
 103  <?php print_column_headers('zelistapi_features', false); ?>
 104      </tr>
 105      </tfoot>
 106  
 107  <tbody id="the-list" class="features">
 108  <?php
 109  zelist_api_features_rows($features, 0, 0, $pagenum, $catsperpage); ?>
 110  </tbody>
 111  
 112  </table>
 113  </div></div><!-- //col right -->
 114  
 115  
 116  <div id="col-left"><div class="col-wrap">
 117  <?php  $site_info = get_option('zelistapi_site_info'); if($site_info) : ?>
 118  <h3><?php _e('Your directory','zelist'); ?></h3>
 119  
 120  
 121  <h3><?php _e('Name:'); echo '&nbsp;'; echo $site_info['link_name']; ?></h3>
 122  <?php _e('Description:'); ?>
 123  <p><?php echo $site_info['link_description']; ?></p>
 124  <?php
 125  if($site_info['link_status'] == 'publish') printf(__('Published in %s','zelist'),$site_info['categories_list']);
 126  else printf(__('Status: %s','zelist'),__($site_info['link_status'],'zelist'));
 127  ?>
 128  <br />
 129  
 130  <a href="<?php echo $site_info['edit_link']; ?>" target="_blank"><?php _e('Edit'); ?></a>
 131  
 132  <?php endif; ?>
 133  
 134  </div></div><!-- //col left -->
 135  </div>
 136  <br class="clear" />
 137  
 138  <input type="hidden" name="action" value="update" />
 139  <p class="submit">
 140  <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
 141  </form>
 142  
 143  <?php endif; ?>
 144  
 145  
 146  <?php do_action('zelist_api_admin_after'); ?>
 147  
 148  </div>
 149  
 150  
 151  
 152  


Generated: Sat May 30 23:51:06 2009 Cross-referenced by PHPXref 0.7