コード例 #1
0
 public static function get_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #2
0
    private function edit_form_content($term_id = '')
    {
        // Update
        $source = self::select_source($term_id);
        $hash = isset($source['hash']) ? $source['hash'] : '';
        $link = isset($source['link']) ? $source['link'] : '';
        $priority = isset($source['priority']) ? $source['priority'] : '10';
        $crawl = isset($source['crawl']) ? $source['crawl'] : '0';
        $enable = isset($source['enable']) ? $source['enable'] : '1';
        $folder_selected = DLN_Term_Helper::get_selected_folder($term_id);
        $folders = DLN_Term_Helper::get_term_folder();
        ?>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="dln_source_link"><?php 
        echo __('Link', DLN_SKILL);
        ?>
</label></th>
			<td>
				<input type="text" name="dln_source_link" id="dln_source_link" size="40" value="<?php 
        echo $link;
        ?>
"/><br />
			</td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="dln_source_folder"><?php 
        echo __('Folder', DLN_SKILL);
        ?>
</label></th>
			<td>
				<select name="dln_source_folder" id="dln_source_folder" class="select2 input-medium">
					<option value="0"><?php 
        echo __('(None)', DLN_SKILL);
        ?>
</option>
					<?php 
        foreach ($folders as $i => $folder) {
            ?>
					<?php 
            if (!empty($folder)) {
                ?>
					<?php 
                if (!empty($folder_selected) && $folder_selected == $folder->term_id) {
                    ?>
					<option value="<?php 
                    echo $folder->term_id;
                    ?>
" selected="selected"><?php 
                    echo $folder->name;
                    ?>
 (<?php 
                    echo $folder->count_source;
                    ?>
)</option>
					<?php 
                } else {
                    ?>
					<?php 
                    $folder->count_source = isset($folder->count_source) ? $folder->count_source : 0;
                    ?>
					<option value="<?php 
                    echo $folder->term_id;
                    ?>
"><?php 
                    echo $folder->name;
                    ?>
 (<?php 
                    echo $folder->count_source;
                    ?>
)</option>
					<?php 
                }
                ?>
					<?php 
            }
            ?>
					<?php 
        }
        ?>
				</select>
			</td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="dln_source_hash"><?php 
        echo __('Hash Value', DLN_SKILL);
        ?>
</label></th>
			<td>
				<input type="text" name="dln_source_hash" id="dln_source_hash" size="40" value="<?php 
        echo $hash;
        ?>
"/><br />
			</td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="dln_source_priority"><?php 
        echo __('Priority', DLN_SKILL);
        ?>
</label></th>
			<td>
				<input type="number" name="dln_source_priority" id="dln_source_priority" size="40" value="<?php 
        echo $priority;
        ?>
" /><br /> 
			</td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="dln_source_crawl"><?php 
        echo __('Crawl Count', DLN_SKILL);
        ?>
</label></th>
			<td>
				<input type="text" name="dln_source_crawl" id="dln_source_crawl" size="40" readonly="readonly" value="<?php 
        echo $crawl;
        ?>
"/><br />
			</td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="dln_source_enable"><?php 
        echo __('Enable', DLN_SKILL);
        ?>
</label></th>
			<td>
				<input type="text" name="dln_source_enable" id="dln_source_enable" size="40" value="<?php 
        echo $enable;
        ?>
"/><br />
			</td>
		</tr>
		<p />
		<?php 
        return;
    }